svn-gvsig-desktop / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / extension / InitialWarningExtension.java @ 40337
History | View | Annotate | Download (5.6 KB)
1 |
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib��ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
|
42 |
/* CVS MESSAGES:
|
43 |
*
|
44 |
* $Id: InitialWarningExtension.java 39337 2012-11-26 09:59:22Z jldominguez $
|
45 |
* $Log$
|
46 |
* Revision 1.4 2006-10-02 13:52:34 jaume
|
47 |
* organize impots
|
48 |
*
|
49 |
* Revision 1.3 2006/08/29 07:56:27 cesar
|
50 |
* Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
|
51 |
*
|
52 |
* Revision 1.2 2006/08/29 07:13:53 cesar
|
53 |
* Rename class com.iver.andami.ui.mdiManager.View to com.iver.andami.ui.mdiManager.IWindow
|
54 |
*
|
55 |
* Revision 1.1 2006/05/25 16:27:21 jaume
|
56 |
* *** empty log message ***
|
57 |
*
|
58 |
*
|
59 |
*/
|
60 |
package org.gvsig.app.extension; |
61 |
|
62 |
import java.awt.Color; |
63 |
import java.awt.Window; |
64 |
|
65 |
import javax.swing.JButton; |
66 |
import javax.swing.JCheckBox; |
67 |
import javax.swing.JLabel; |
68 |
import javax.swing.JPanel; |
69 |
import javax.swing.JWindow; |
70 |
import javax.swing.border.TitledBorder; |
71 |
|
72 |
import org.gvsig.andami.PluginServices; |
73 |
import org.gvsig.andami.plugins.Extension; |
74 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
75 |
|
76 |
|
77 |
public class InitialWarningExtension extends Extension { |
78 |
// public static Preferences fPrefs = Preferences.userRoot().node( "gvsig.initial_warkning" );
|
79 |
// private boolean show = fPrefs.getBoolean( "show_panel", true);
|
80 |
private DlgWaring dlgWarning;
|
81 |
/**
|
82 |
* @see org.gvsig.andami.plugins.IExtension#isEnabled()
|
83 |
*/
|
84 |
public boolean isEnabled() { |
85 |
return false; |
86 |
} |
87 |
|
88 |
/**
|
89 |
* @see com.iver.mdiApp.plugins.IExtension#isVisible()
|
90 |
*/
|
91 |
public boolean isVisible() { |
92 |
return true; |
93 |
} |
94 |
|
95 |
/**
|
96 |
* @see org.gvsig.andami.plugins.IExtension#initialize()
|
97 |
*/
|
98 |
public void initialize() { |
99 |
|
100 |
if (isEnabled() && isVisible()) {
|
101 |
dlgWarning = new DlgWaring();
|
102 |
dlgWarning.setText(PluginServices.getText(this, "initial_warning")); |
103 |
dlgWarning.setVisible(true);
|
104 |
// PluginServices.getMDIManager().addWindow(dlgWarning);
|
105 |
} |
106 |
|
107 |
} |
108 |
|
109 |
/**
|
110 |
* @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
|
111 |
*/
|
112 |
public void execute(String actionCommand) { |
113 |
|
114 |
} |
115 |
|
116 |
private class DlgWaring extends JWindow{ |
117 |
|
118 |
private JButton btnOk = null; |
119 |
private JCheckBox chkBoxShowAgain = null; |
120 |
private JLabel lblText = null; |
121 |
private JPanel panel=null; |
122 |
private JPanel panel2; |
123 |
/**
|
124 |
* This is the default constructor
|
125 |
*/
|
126 |
public DlgWaring() {
|
127 |
super((Window)PluginServices.getMainFrame()); |
128 |
Window window=(Window)PluginServices.getMainFrame(); |
129 |
setLocation(window.getWidth()/2+window.getX()-150,window.getHeight()/2+window.getY()-150); |
130 |
initialize(); |
131 |
this.setAlwaysOnTop(true); |
132 |
} |
133 |
|
134 |
public void setText(String string) { |
135 |
lblText.setText(string); |
136 |
} |
137 |
|
138 |
/**
|
139 |
* This method initializes this
|
140 |
*
|
141 |
* @return void
|
142 |
*/
|
143 |
private void initialize() { |
144 |
panel=new JPanel(); |
145 |
panel.setBackground(Color.black);
|
146 |
panel.setLayout(null);
|
147 |
panel.setBounds(0,0,300,300); |
148 |
panel2=new JPanel(); |
149 |
panel2.setLayout(null);
|
150 |
panel2.setBounds(2,2,298,298); |
151 |
lblText = new JLabel(); |
152 |
lblText.setBounds(15, 15, 271, 200); |
153 |
lblText.setText("JLabel");
|
154 |
lblText.setBorder(new TitledBorder(PluginServices.getText(this, "warning"))); |
155 |
panel2.add(lblText); |
156 |
panel2.setSize((int)(panel.getSize().getWidth()-4),(int)(panel.getSize().getHeight()-4)); |
157 |
panel.add(panel2); |
158 |
this.setLayout(null); |
159 |
this.setSize(300, 300); |
160 |
this.add(getBtnOk(), null); |
161 |
// this.add(getChkBoxShowAgain(), null);
|
162 |
this.add(panel, null); |
163 |
} |
164 |
|
165 |
/**
|
166 |
* This method initializes btnOk
|
167 |
*
|
168 |
* @return javax.swing.JButton
|
169 |
*/
|
170 |
private JButton getBtnOk() { |
171 |
if (btnOk == null) { |
172 |
btnOk = new JButton(); |
173 |
btnOk.setBounds(100, 250, 100, 20); |
174 |
btnOk.setText(PluginServices.getText(this, "aceptar")); |
175 |
btnOk.addActionListener(new java.awt.event.ActionListener() {
|
176 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
177 |
dlgWarning.setVisible(false);
|
178 |
dlgWarning.dispose(); |
179 |
// PluginServices.getMDIManager().closeWindow(dlgWarning);
|
180 |
} |
181 |
}); |
182 |
} |
183 |
return btnOk;
|
184 |
} |
185 |
|
186 |
/**
|
187 |
* This method initializes chkBoxShowAgain
|
188 |
*
|
189 |
* @return javax.swing.JCheckBox
|
190 |
*/
|
191 |
// private JCheckBox getChkBoxShowAgain() {
|
192 |
// if (chkBoxShowAgain == null) {
|
193 |
// chkBoxShowAgain = new JCheckBox();
|
194 |
// chkBoxShowAgain.setBounds(44, 116, 241, 21);
|
195 |
// chkBoxShowAgain.setSelected(true);
|
196 |
// chkBoxShowAgain.setText(PluginServices.getText(this, "show_this_dialog_next_startup"));
|
197 |
// }
|
198 |
// return chkBoxShowAgain;
|
199 |
// }
|
200 |
|
201 |
public WindowInfo getWindowInfo() {
|
202 |
WindowInfo vi = new WindowInfo(WindowInfo.MODALDIALOG);
|
203 |
vi.setWidth(300+8); |
204 |
vi.setHeight(250);
|
205 |
vi.setTitle(PluginServices.getText(this, "warning")); |
206 |
return vi;
|
207 |
} |
208 |
|
209 |
} // @jve:decl-index=0:visual-constraint="10,10"
|
210 |
|
211 |
} |