Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.annotation.app / org.gvsig.annotation.app.mainplugin / src / main / java / org / gvsig / annotation / app / extension / AnnotationWindow.java @ 40561

History | View | Annotate | Download (2.99 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.annotation.app.extension;
25

    
26
import java.awt.BorderLayout;
27
import java.awt.Dimension;
28

    
29
import javax.swing.JPanel;
30

    
31
import org.gvsig.andami.ui.mdiManager.IWindow;
32
import org.gvsig.andami.ui.mdiManager.WindowInfo;
33
import org.gvsig.annotation.swing.AnnotationWindowManager;
34

    
35
/**
36
 * {@link IWindow} to show a Annotation.
37
 * 
38
 * @author gvSIG Team
39
 * @version $Id$
40
 */
41
public class AnnotationWindow extends JPanel implements IWindow {
42

    
43
    private static final long serialVersionUID = -4401123724140025094L;
44

    
45
    private WindowInfo info;
46

    
47
    private Object profile = WindowInfo.EDITOR_PROFILE;
48

    
49
    /**
50
     * Constructor.
51
     * 
52
     * @param panel
53
     *            the panel to show
54
     * @param title
55
     *            the window title
56
     * @param mode
57
     *            the window mode
58
     * @see {@link AnnotationWindowManager#MODE_DIALOG}
59
     * @see {@link AnnotationWindowManager#MODE_TOOL}
60
     * @see {@link AnnotationWindowManager#MODE_WINDOW}
61
     */
62
    public AnnotationWindow(JPanel panel, String title, int mode) {
63
        this.setLayout(new BorderLayout());
64
            add(panel, BorderLayout.CENTER);
65
    
66
        Dimension dimension = new Dimension(700, 400);
67
        setSize(dimension);
68
        int code =
69
            WindowInfo.ICONIFIABLE | WindowInfo.MAXIMIZABLE
70
                | WindowInfo.RESIZABLE;
71
        switch (mode) {
72
        case AnnotationWindowManager.MODE_DIALOG:
73
            code |= WindowInfo.MODALDIALOG;
74
            profile = WindowInfo.DIALOG_PROFILE;
75
            break;
76
        case AnnotationWindowManager.MODE_TOOL:
77
            code |= WindowInfo.PALETTE;
78
            profile = WindowInfo.TOOL_PROFILE;
79
            break;
80
        case AnnotationWindowManager.MODE_WINDOW:
81
        default:
82
            code |= WindowInfo.MODELESSDIALOG;
83
            profile = WindowInfo.EDITOR_PROFILE;
84
        }
85
        info = new WindowInfo(code);
86
        info.setTitle(title);
87
        info.setMinimumSize(dimension);
88
    }
89

    
90
    public WindowInfo getWindowInfo() {
91
        return info;
92
    }
93

    
94
    public Object getWindowProfile() {
95
        return profile;
96
    }
97
}