Statistics
| Revision:

root / 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 @ 118

History | View | Annotate | Download (2.75 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.Toolkit;
26
import java.beans.PropertyVetoException;
27

    
28
import javax.swing.JRootPane;
29

    
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;
34
import org.gvsig.coreplugin.mdiManager.NewSkin;
35

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

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

    
47
    private MDIFrame mdiFrame;
48

    
49
    @Override
50
    public void init(MDIFrame f) {
51
        super.init(f);
52
        // This doesn't work in OLPC. So, set frame size to screen size
53
        // f.setExtendedState(Frame.MAXIMIZED_BOTH);
54
        Toolkit toolkit = Toolkit.getDefaultToolkit();
55
        Dimension dimension = toolkit.getScreenSize();
56
        mdiFrame = f;
57
        mdiFrame.setSize(dimension);
58
        mdiFrame.setUndecorated(true);
59
        mdiFrame.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
60

    
61
    }
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

    
84
}