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