Revision 39196

View differences:

branches/v2_0_0_prep/frameworks/_fwAndami/src/org/gvsig/andami/ui/mdiFrame/MDIFrame.java
55 55
import java.awt.event.MouseEvent;
56 56
import java.awt.event.WindowAdapter;
57 57
import java.awt.event.WindowEvent;
58
import java.lang.reflect.InvocationTargetException;
59 58
import java.util.ArrayList;
60 59
import java.util.Enumeration;
61 60
import java.util.HashMap;
......
83 82
import javax.swing.Timer;
84 83
import javax.swing.WindowConstants;
85 84

  
85
import org.slf4j.Logger;
86
import org.slf4j.LoggerFactory;
87

  
86 88
import org.gvsig.andami.IconThemeHelper;
87 89
import org.gvsig.andami.Launcher;
88 90
import org.gvsig.andami.LibraryExtension;
......
107 109
import org.gvsig.gui.beans.controls.IControl;
108 110
import org.gvsig.tools.swing.api.ToolsSwingLocator;
109 111
import org.gvsig.tools.swing.icontheme.IconTheme;
110
import org.slf4j.Logger;
111
import org.slf4j.LoggerFactory;
112 112

  
113 113
/**
114 114
 * Main application window.
......
233 233

  
234 234
        this.toolBars.addContainerListener(this);
235 235

  
236
        // TODO LWS Aqui deber�a cargar los valores salvados de la �ltima
237
        // ejecuci�n.
238
        setSize(700, 580);
239
        setLocation(10, 10);
240
        setExtendedState(MAXIMIZED_BOTH);
241 236

  
237
        /*
238
         * Setting default values. Persistence is read
239
         * afterwards
240
         */
241
        setSize(
242
            MainFrame.MAIN_FRAME_SIZE_DEFAULT[0],
243
            MainFrame.MAIN_FRAME_SIZE_DEFAULT[1]);
244
        setLocation(
245
            MainFrame.MAIN_FRAME_POS_DEFAULT[0],
246
            MainFrame.MAIN_FRAME_POS_DEFAULT[1]);
247
        setExtendedState(
248
            MainFrame.MAIN_FRAME_EXT_STATE_DEFAULT);
249

  
242 250
        mdiManager.init(this);
251
        
252
        /*
253
         * pack() would resize the main frame
254
         * 
255
         */
256
        // pack();
243 257

  
244
        pack();
245

  
246 258
    }
259
    
260
    
247 261

  
248 262
    /*
249 263
     * (non-javadoc)
branches/v2_0_0_prep/frameworks/_fwAndami/src/org/gvsig/andami/ui/mdiFrame/MainFrame.java
40 40
 */
41 41
package org.gvsig.andami.ui.mdiFrame;
42 42

  
43
import java.awt.Frame;
43 44
import java.awt.event.ActionListener;
44 45

  
45 46
import javax.swing.JComponent;
......
57 58
 * the menus, the tool bars and the status bar. 
58 59
 */
59 60
public interface MainFrame extends ThreadSafeDialogs {
61
    
62
    public static String MAIN_FRAME_POS = "MDIFramePos";
63
    public static String MAIN_FRAME_SIZE = "MDIFrameSize";
64
    public static String MAIN_FRAME_EXT_STATE = "MDIFrameState";
65
    
66
    public static int[] MAIN_FRAME_POS_DEFAULT = { 0, 0 };
67
    public static int[] MAIN_FRAME_SIZE_DEFAULT = { 1024, 768 };
68
    public static int MAIN_FRAME_EXT_STATE_DEFAULT = Frame.MAXIMIZED_BOTH;
69

  
60 70
	/**
61 71
	 * Adds the provided menu to the menu bar.
62 72
	 *
branches/v2_0_0_prep/frameworks/_fwAndami/src/org/gvsig/andami/Launcher.java
103 103
import org.apache.commons.cli.ParseException;
104 104
import org.apache.commons.cli.PosixParser;
105 105
import org.apache.commons.io.FileUtils;
106
import org.apache.commons.io.FilenameUtils;
107 106
import org.apache.log4j.AppenderSkeleton;
108 107
import org.apache.log4j.PatternLayout;
109 108
import org.apache.log4j.PropertyConfigurator;
......
111 110
import org.apache.log4j.spi.LoggingEvent;
112 111
import org.exolab.castor.xml.MarshalException;
113 112
import org.exolab.castor.xml.ValidationException;
113
import org.slf4j.Logger;
114
import org.slf4j.LoggerFactory;
115

  
114 116
import org.gvsig.andami.actioninfo.ActionInfo;
115 117
import org.gvsig.andami.actioninfo.ActionInfoManager;
116 118
import org.gvsig.andami.authentication.IAuthentication;
......
147 149
import org.gvsig.andami.ui.ToolsWindowManager;
148 150
import org.gvsig.andami.ui.fonts.FontUtils;
149 151
import org.gvsig.andami.ui.mdiFrame.MDIFrame;
152
import org.gvsig.andami.ui.mdiFrame.MainFrame;
150 153
import org.gvsig.andami.ui.mdiManager.MDIManagerFactory;
151 154
import org.gvsig.andami.ui.splash.MultiSplashWindow;
152 155
import org.gvsig.andami.ui.theme.Theme;
......
154 157
import org.gvsig.installer.lib.api.InstallerLocator;
155 158
import org.gvsig.installer.lib.api.InstallerManager;
156 159
import org.gvsig.installer.lib.api.PackageInfo;
157
import org.gvsig.installer.lib.api.Version;
158 160
import org.gvsig.installer.swing.api.SwingInstallerLocator;
159 161
import org.gvsig.installer.swing.api.execution.AbstractInstallPackageWizard;
160 162
import org.gvsig.installer.swing.api.wizard.InstallerWizardActionListener;
161 163
import org.gvsig.installer.swing.api.wizard.InstallerWizardPanel;
162
import org.gvsig.tools.exception.BaseException;
163 164
import org.gvsig.tools.exception.ListBaseException;
164 165
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
165 166
import org.gvsig.tools.swing.api.ToolsSwingLocator;
......
171 172
import org.gvsig.utils.XMLEntity;
172 173
import org.gvsig.utils.xml.XMLEncodingUtils;
173 174
import org.gvsig.utils.xmlEntity.generate.XmlTag;
174
import org.slf4j.Logger;
175
import org.slf4j.LoggerFactory;
176 175

  
177 176
/**
178 177
 * <p>
......
901 900
		if (xml == null) {
902 901
			xml = new XMLEntity();
903 902
		}
904
		// restore frame size
905
		Dimension sz = new Dimension(700, 580);
906
		if (xml.contains("MDIFrameSize")) {
907
			int[] wh = xml.getIntArrayProperty("MDIFrameSize");
908
			sz = new Dimension(wh[0], wh[1]);
909
		}
910
		frame.setSize(sz);
911
		// restore frame location
912
		Point pos = new Point(10, 10);
913
		if (xml.contains("MDIFramePos")) {
914
			int[] xy = xml.getIntArrayProperty("MDIFramePos");
915
			pos = new Point(xy[0], xy[1]);
916
		}
917
		frame.setLocation(pos);
918

  
919
		// restore frame status (Maximized, minimized, etc);
920
		int state = java.awt.Frame.MAXIMIZED_BOTH;
921
		if (xml.contains("MDIFrameState")) {
922
			state = xml.getIntProperty("MDIFrameState");
923
		}
924
		frame.setExtendedState(state);
903
        // ====================================
904
        // restore frame size
905
        Dimension sz = new Dimension(
906
            MainFrame.MAIN_FRAME_SIZE_DEFAULT[0],
907
            MainFrame.MAIN_FRAME_SIZE_DEFAULT[1]);
908
        if (xml.contains(MainFrame.MAIN_FRAME_SIZE)) {
909
            int[] wh = xml.getIntArrayProperty(MainFrame.MAIN_FRAME_SIZE);
910
            sz = new Dimension(wh[0], wh[1]);
911
        }
912
        frame.setSize(sz);
913
        // ==========================================
914
        // restore frame location
915
        Point pos = new Point(
916
            MainFrame.MAIN_FRAME_POS_DEFAULT[0],
917
            MainFrame.MAIN_FRAME_POS_DEFAULT[1]);
918
        if (xml.contains(MainFrame.MAIN_FRAME_POS)) {
919
            int[] xy = xml.getIntArrayProperty(MainFrame.MAIN_FRAME_POS);
920
            pos = new Point(xy[0], xy[1]);
921
        }
922
        frame.setLocation(pos);
923
        // =============================================
924
        // restore frame state (Maximized, minimized, etc);
925
        int state = MainFrame.MAIN_FRAME_EXT_STATE_DEFAULT;
926
        if (xml.contains(MainFrame.MAIN_FRAME_EXT_STATE)) {
927
            state = xml.getIntProperty(MainFrame.MAIN_FRAME_EXT_STATE);
928
        }
929
        frame.setExtendedState(state);
925 930
	}
926 931

  
927 932
	private XMLEntity saveMDIStatus() {
......
930 935
		int[] wh = new int[2];
931 936
		wh[0] = frame.getWidth();
932 937
		wh[1] = frame.getHeight();
933
		xml.putProperty("MDIFrameSize", wh);
938
		xml.putProperty(MainFrame.MAIN_FRAME_SIZE, wh);
934 939
		// save frame location
935 940
		int[] xy = new int[2];
936 941
		xy[0] = frame.getX();
937 942
		xy[1] = frame.getY();
938
		xml.putProperty("MDIFramePos", xy);
943
		xml.putProperty(MainFrame.MAIN_FRAME_POS, xy);
939 944
		// save frame status
940
		xml.putProperty("MDIFrameState", frame.getExtendedState());
945
		xml.putProperty(MainFrame.MAIN_FRAME_EXT_STATE,
946
		    frame.getExtendedState());
941 947
		return xml;
942 948
	}
943 949

  

Also available in: Unified diff