Statistics
| Revision:

gvsig-educa / org.gvsig.educa.batovi / trunk / org.gvsig.educa.batovi / org.gvsig.educa.batovi.app / org.gvsig.educa.batovi.app.skin / src / main / java / org / gvsig / educa / batovi / app / skin / BatoviSkin.java @ 180

History | View | Annotate | Download (2.91 KB)

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.Frame;
26
import java.awt.Toolkit;
27
import java.beans.PropertyVetoException;
28

    
29
import javax.swing.JRootPane;
30

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

    
37
/**
38
 * gvSIG Skin to be used in the Batovi project for the OLPC computers.
39
 * 
40
 * @author DiSiD Technologies
41
 * @version $Id$
42
 */
43
public class BatoviSkin extends NewSkin {
44

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

    
48
    private MDIFrame mdiFrame;
49

    
50
    @Override
51
    public void init(MDIFrame f) {
52
        super.init(f);
53
        mdiFrame = f;
54
        Toolkit toolkit = Toolkit.getDefaultToolkit();
55
        Dimension dimension = toolkit.getScreenSize();
56
        mdiFrame.setUndecorated(true);
57
        mdiFrame.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
58
        // The extended state seems not to work in OLPC, so set first 
59
        // the frame size to be the screen size.
60
        mdiFrame.setLocation(0, 0);
61
        mdiFrame.setPreferredSize(dimension);
62
        mdiFrame.setSize(dimension);
63
        mdiFrame.setExtendedState(Frame.MAXIMIZED_BOTH);
64
    }
65

    
66
    @Override
67
    protected FrameWindowSupport createFrameWindowSupport(MDIFrame mainFrame) {
68
        return new MaximizedFrameWindowSupport(mainFrame);
69
    }
70

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

    
87
}