Revision 118

View differences:

org.gvsig.educa.batovi/trunk/org.gvsig.educa.batovi.app/org.gvsig.educa.batovi.app.skin/src/main/resources/config.xml
4 4
	<libraries library-dir="lib" />
5 5
	<extensions>
6 6
		<extension class-name="org.gvsig.educa.batovi.app.skin.BatoviSkinExtension"
7
			description="Dummy extension required for the plugin config.xml file" active="false">
7
			description="Extension to initialize some LF options"
8
			active="true">
8 9
		</extension>
9 10
		<skin-extension class-name="org.gvsig.educa.batovi.app.skin.BatoviSkin" />
10 11
	</extensions>
org.gvsig.educa.batovi/trunk/org.gvsig.educa.batovi.app/org.gvsig.educa.batovi.app.skin/src/main/java/org/gvsig/educa/batovi/app/skin/BatoviSkinExtension.java
25 25

  
26 26
/**
27 27
 * Dummy extension required for the plugin config.xml file.
28
 * 
28 29
 * @author DiSiD Technologies
29 30
 * @version $Id$
30 31
 */
......
32 33

  
33 34
    public void initialize() {
34 35
        // Nothing to do
35
        // TODO: add about related to the Batovi project
36 36
    }
37 37

  
38 38
    public void execute(String actionCommand) {
39 39
        // Nothing to do
40 40
    }
41 41

  
42
    @Override
43
    public void postInitialize() {
44
        // TODO: add about related to the Batovi project
45
        // UIManager
46
        // .put("InternalFrame.border", BorderFactory.createEmptyBorder());
47
        //
48
        // UIManager.put("InternalFrame.titlePaneHeight", 1);
49
        super.postInitialize();
50
    }
51

  
42 52
    public boolean isEnabled() {
43
        // Nothing to do
53

  
44 54
        return false;
45 55
    }
46 56

  
47 57
    public boolean isVisible() {
48
        // Nothing to do
58
        // UIManager
59
        // .put("InternalFrame.border", BorderFactory.createEmptyBorder());
60
        //
61
        // UIManager.put("InternalFrame.titlePaneHeight", 1);
49 62
        return false;
50 63
    }
51 64

  
org.gvsig.educa.batovi/trunk/org.gvsig.educa.batovi.app/org.gvsig.educa.batovi.app.skin/src/main/java/org/gvsig/educa/batovi/app/skin/MaximizedFrameWindowSupport.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.educa.batovi.app.skin;
23

  
24
import java.awt.Dimension;
25
import java.awt.Toolkit;
26
import java.beans.PropertyVetoException;
27

  
28
import javax.swing.JDialog;
29
import javax.swing.JInternalFrame;
30

  
31
import org.gvsig.andami.ui.mdiFrame.MDIFrame;
32
import org.gvsig.andami.ui.mdiManager.IWindow;
33
import org.gvsig.coreplugin.mdiManager.FrameWindowSupport;
34

  
35
/**
36
 * {@link FrameWindowSupport} specialization which creates all JInternalFrames
37
 * maximized and dialog bigger
38
 * 
39
 * @author gvSIG Team
40
 * @version $Id$
41
 * 
42
 */
43
public class MaximizedFrameWindowSupport extends FrameWindowSupport {
44

  
45
    private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory
46
        .getLogger(MaximizedFrameWindowSupport.class);
47

  
48
    /**
49
     * Property for dialog size
50
     */
51
    private final Dimension screenSize;
52

  
53
    /**
54
     * @param mainFrame
55
     */
56
    public MaximizedFrameWindowSupport(MDIFrame mainFrame) {
57
        super(mainFrame);
58

  
59
        // Gets screen size
60
        Toolkit toolkit = Toolkit.getDefaultToolkit();
61
        Dimension sSize = toolkit.getScreenSize();
62

  
63
        // Subtract a 10%
64
        screenSize =
65
            new Dimension(sSize.width - (sSize.width / 10), sSize.height
66
                - (sSize.height / 10));
67
    }
68

  
69
    /**
70
     * {@inheritDoc}
71
     * 
72
     * Set maximizable an maximum on creation
73
     */
74
    @Override
75
    public JInternalFrame createJInternalFrame(IWindow p) {
76
        JInternalFrame nuevo = super.createJInternalFrame(p);
77
        nuevo.setMaximizable(true);
78
        try {
79
            nuevo.setMaximum(true);
80
        } catch (PropertyVetoException ex) {
81
            if (LOG.isDebugEnabled()) {
82
                LOG.debug("Can't maximize IWindow: '".concat(nuevo.getTitle())
83
                    .concat("'"), ex);
84
            }
85
        } catch (NullPointerException ex) {
86
            // Do nothing
87
        }
88

  
89
        return nuevo;
90
    }
91

  
92
    /**
93
     * 
94
     * {@inheritDoc}
95
     * 
96
     * Set size to almost full screen
97
     */
98
    @Override
99
    public JDialog getJDialog(IWindow p) {
100

  
101
        JDialog dialog = super.getJDialog(p);
102

  
103
        dialog.setSize(screenSize);
104
        return dialog;
105
    }
106
}
org.gvsig.educa.batovi/trunk/org.gvsig.educa.batovi.app/org.gvsig.educa.batovi.app.skin/src/main/java/org/gvsig/educa/batovi/app/skin/BatoviSkin.java
23 23

  
24 24
import java.awt.Dimension;
25 25
import java.awt.Toolkit;
26
import java.beans.PropertyVetoException;
26 27

  
28
import javax.swing.JRootPane;
29

  
27 30
import org.gvsig.andami.ui.mdiFrame.MDIFrame;
31
import org.gvsig.andami.ui.mdiManager.IWindow;
32
import org.gvsig.andami.ui.mdiManager.SingletonDialogAlreadyShownException;
33
import org.gvsig.coreplugin.mdiManager.FrameWindowSupport;
28 34
import org.gvsig.coreplugin.mdiManager.NewSkin;
29 35

  
30 36
/**
......
35 41
 */
36 42
public class BatoviSkin extends NewSkin {
37 43

  
44
    private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory
45
        .getLogger(BatoviSkin.class);
46

  
47
    private MDIFrame mdiFrame;
48

  
38 49
    @Override
39 50
    public void init(MDIFrame f) {
40 51
        super.init(f);
......
42 53
        // f.setExtendedState(Frame.MAXIMIZED_BOTH);
43 54
        Toolkit toolkit = Toolkit.getDefaultToolkit();
44 55
        Dimension dimension = toolkit.getScreenSize();
45
        f.setSize(dimension);
46
        f.setUndecorated(true);
56
        mdiFrame = f;
57
        mdiFrame.setSize(dimension);
58
        mdiFrame.setUndecorated(true);
59
        mdiFrame.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
60

  
47 61
    }
48 62

  
63
    @Override
64
    protected FrameWindowSupport createFrameWindowSupport(MDIFrame mainFrame) {
65
        return new MaximizedFrameWindowSupport(mainFrame);
66
    }
67

  
68
    @Override
69
    public IWindow addWindow(IWindow p)
70
        throws SingletonDialogAlreadyShownException {
71
        IWindow window = super.addWindow(p);
72
        try {
73
            setMaximum(window, true);
74
        } catch (PropertyVetoException ex) {
75
            if (LOG.isDebugEnabled()) {
76
                LOG.debug(
77
                    "Can't maximize IWindow: '".concat(
78
                        window.getWindowInfo().getTitle()).concat("'"), ex);
79
            }
80
        }
81
        return window;
82
    }
83

  
49 84
}

Also available in: Unified diff