root / branches / v2_0_0_prep / extensions / org.gvsig.annotation.app / org.gvsig.annotation.app.extension / src / main / java / org / gvsig / annotation / app / extension / AnnotationWindow.java @ 33274
History | View | Annotate | Download (2.94 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.annotation.app.extension; |
23 |
|
24 |
import java.awt.BorderLayout; |
25 |
import java.awt.Dimension; |
26 |
|
27 |
import javax.swing.JPanel; |
28 |
|
29 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
30 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
31 |
import org.gvsig.annotation.swing.AnnotationWindowManager; |
32 |
|
33 |
/**
|
34 |
* {@link IWindow} to show a Annotation.
|
35 |
*
|
36 |
* @author gvSIG Team
|
37 |
* @version $Id$
|
38 |
*/
|
39 |
public class AnnotationWindow extends JPanel implements IWindow { |
40 |
|
41 |
private static final long serialVersionUID = -4401123724140025094L; |
42 |
|
43 |
private WindowInfo info;
|
44 |
|
45 |
private Object profile = WindowInfo.EDITOR_PROFILE; |
46 |
|
47 |
/**
|
48 |
* Constructor.
|
49 |
*
|
50 |
* @param panel
|
51 |
* the panel to show
|
52 |
* @param title
|
53 |
* the window title
|
54 |
* @param mode
|
55 |
* the window mode
|
56 |
* @see {@link AnnotationWindowManager#MODE_DIALOG}
|
57 |
* @see {@link AnnotationWindowManager#MODE_TOOL}
|
58 |
* @see {@link AnnotationWindowManager#MODE_WINDOW}
|
59 |
*/
|
60 |
public AnnotationWindow(JPanel panel, String title, int mode) { |
61 |
this.setLayout(new BorderLayout()); |
62 |
add(panel, BorderLayout.CENTER);
|
63 |
|
64 |
Dimension dimension = new Dimension(700, 400); |
65 |
setSize(dimension); |
66 |
int code =
|
67 |
WindowInfo.ICONIFIABLE | WindowInfo.MAXIMIZABLE |
68 |
| WindowInfo.RESIZABLE; |
69 |
switch (mode) {
|
70 |
case AnnotationWindowManager.MODE_DIALOG:
|
71 |
code |= WindowInfo.MODALDIALOG; |
72 |
profile = WindowInfo.DIALOG_PROFILE; |
73 |
break;
|
74 |
case AnnotationWindowManager.MODE_TOOL:
|
75 |
code |= WindowInfo.PALETTE; |
76 |
profile = WindowInfo.TOOL_PROFILE; |
77 |
break;
|
78 |
case AnnotationWindowManager.MODE_WINDOW:
|
79 |
default:
|
80 |
code |= WindowInfo.MODELESSDIALOG; |
81 |
profile = WindowInfo.EDITOR_PROFILE; |
82 |
} |
83 |
info = new WindowInfo(code);
|
84 |
info.setTitle(title); |
85 |
info.setMinimumSize(dimension); |
86 |
} |
87 |
|
88 |
public WindowInfo getWindowInfo() {
|
89 |
return info;
|
90 |
} |
91 |
|
92 |
public Object getWindowProfile() { |
93 |
return profile;
|
94 |
} |
95 |
} |