|
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 15921 2007-11-05 16:14:10Z vcaballero $
|
|
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 com.iver.ai2.gvsig3dgui;
|
|
61 |
|
|
62 |
import java.awt.Color;
|
|
63 |
import java.awt.Component;
|
|
64 |
import java.awt.Window;
|
|
65 |
import java.util.prefs.Preferences;
|
|
66 |
|
|
67 |
import javax.swing.JButton;
|
|
68 |
import javax.swing.JCheckBox;
|
|
69 |
import javax.swing.JLabel;
|
|
70 |
import javax.swing.JPanel;
|
|
71 |
import javax.swing.JWindow;
|
|
72 |
import javax.swing.border.TitledBorder;
|
|
73 |
|
|
74 |
import com.iver.andami.PluginServices;
|
|
75 |
import com.iver.andami.plugins.Extension;
|
|
76 |
import com.iver.andami.ui.mdiManager.IWindow;
|
|
77 |
import com.iver.andami.ui.mdiManager.WindowInfo;
|
|
78 |
import com.iver.utiles.XMLEntity;
|
|
79 |
|
|
80 |
public class InitialWarningExtension3D extends Extension {
|
|
81 |
// public static Preferences fPrefs = Preferences.userRoot().node( "gvsig.initial_warkning" );
|
|
82 |
// private boolean show = fPrefs.getBoolean( "show_panel", true);
|
|
83 |
private DlgWaring dlgWarning;
|
|
84 |
|
|
85 |
private boolean compatibilitySwing;
|
|
86 |
|
|
87 |
private static Preferences prefs = Preferences.userRoot().node( "gvsig.configuration.3D" );
|
|
88 |
/**
|
|
89 |
* @see com.iver.andami.plugins.IExtension#isEnabled()
|
|
90 |
*/
|
|
91 |
public boolean isEnabled() {
|
|
92 |
return true;
|
|
93 |
}
|
|
94 |
|
|
95 |
/**
|
|
96 |
* @see com.iver.mdiApp.plugins.IExtension#isVisible()
|
|
97 |
*/
|
|
98 |
public boolean isVisible() {
|
|
99 |
return true;
|
|
100 |
}
|
|
101 |
|
|
102 |
/**
|
|
103 |
* @see com.iver.andami.plugins.IExtension#initialize()
|
|
104 |
*/
|
|
105 |
public void initialize() {
|
|
106 |
|
|
107 |
boolean showDialog = false;
|
|
108 |
compatibilitySwing = prefs.getBoolean("compatibilitySwing", compatibilitySwing);
|
|
109 |
|
|
110 |
String message = PluginServices.getText(this, "initial_warning_3D");
|
|
111 |
if (compatibilitySwing){
|
|
112 |
message += PluginServices.getText(this, "initial_canvas_warning");
|
|
113 |
showDialog = true;
|
|
114 |
}
|
|
115 |
String skinName = "";
|
|
116 |
PluginServices ps = PluginServices.getPluginServices("com.iver.core");
|
|
117 |
XMLEntity xml = ps.getPersistentXML();
|
|
118 |
if (xml.contains("Skin-Selected")) {
|
|
119 |
skinName = xml.getStringProperty("Skin-Selected");
|
|
120 |
}
|
|
121 |
|
|
122 |
if (!skinName.equals("com.iver.ai2.gvsig3dgui.JDialogSkin")){
|
|
123 |
message += PluginServices.getText(this, "initial_skin_warning");
|
|
124 |
showDialog = true;
|
|
125 |
}
|
|
126 |
|
|
127 |
if (showDialog){
|
|
128 |
dlgWarning = new DlgWaring();
|
|
129 |
dlgWarning.setText(message);
|
|
130 |
dlgWarning.setVisible(true);
|
|
131 |
}
|
|
132 |
|
|
133 |
}
|
|
134 |
|
|
135 |
/**
|
|
136 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
|
137 |
*/
|
|
138 |
public void execute(String actionCommand) {
|
|
139 |
|
|
140 |
}
|
|
141 |
|
|
142 |
private class DlgWaring extends JWindow{
|
|
143 |
|
|
144 |
private JButton btnOk = null;
|
|
145 |
private JCheckBox chkBoxShowAgain = null;
|
|
146 |
private JLabel lblText = null;
|
|
147 |
private JPanel panel=null;
|
|
148 |
private JPanel panel2;
|
|
149 |
/**
|
|
150 |
* This is the default constructor
|
|
151 |
*/
|
|
152 |
public DlgWaring() {
|
|
153 |
super((Window)PluginServices.getMainFrame());
|
|
154 |
Window window=(Window)PluginServices.getMainFrame();
|
|
155 |
setLocation(window.getWidth()/2+window.getX()-150,window.getHeight()/2+window.getY()-150);
|
|
156 |
initialize();
|
|
157 |
this.setAlwaysOnTop(true);
|
|
158 |
}
|
|
159 |
|
|
160 |
public void setText(String string) {
|
|
161 |
lblText.setText(string);
|
|
162 |
}
|
|
163 |
|
|
164 |
/**
|
|
165 |
* This method initializes this
|
|
166 |
*
|
|
167 |
* @return void
|
|
168 |
*/
|
|
169 |
private void initialize() {
|
|
170 |
panel=new JPanel();
|
|
171 |
panel.setBackground(Color.black);
|
|
172 |
panel.setLayout(null);
|
|
173 |
panel.setBounds(0,0,300,300);
|
|
174 |
panel2=new JPanel();
|
|
175 |
panel2.setLayout(null);
|
|
176 |
panel2.setBounds(2,2,298,298);
|
|
177 |
lblText = new JLabel();
|
|
178 |
lblText.setBounds(15, 15, 271, 200);
|
|
179 |
lblText.setText("JLabel");
|
|
180 |
lblText.setBorder(new TitledBorder(PluginServices.getText(this, "warning")));
|
|
181 |
panel2.add(lblText);
|
|
182 |
panel2.setSize((int)(panel.getSize().getWidth()-4),(int)(panel.getSize().getHeight()-4));
|
|
183 |
panel.add(panel2);
|
|
184 |
this.setLayout(null);
|
|
185 |
this.setSize(300, 300);
|
|
186 |
this.add(getBtnOk(), null);
|
|
187 |
// this.add(getChkBoxShowAgain(), null);
|
|
188 |
this.add(panel, null);
|
|
189 |
}
|
|
190 |
|
|
191 |
/**
|
|
192 |
* This method initializes btnOk
|
|
193 |
*
|
|
194 |
* @return javax.swing.JButton
|
|
195 |
*/
|
|
196 |
private JButton getBtnOk() {
|
|
197 |
if (btnOk == null) {
|
|
198 |
btnOk = new JButton();
|
|
199 |
btnOk.setBounds(100, 250, 100, 20);
|
|
200 |
btnOk.setText(PluginServices.getText(this, "aceptar"));
|
|
201 |
btnOk.addActionListener(new java.awt.event.ActionListener() {
|
|
202 |
public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
203 |
dlgWarning.setVisible(false);
|
|
204 |
dlgWarning.dispose();
|
|
205 |
// PluginServices.getMDIManager().closeWindow(dlgWarning);
|
|
206 |
}
|
|
207 |
});
|
|
208 |
}
|
|
209 |
return btnOk;
|
|
210 |
}
|
|
211 |
|
|
212 |
/**
|
|
213 |
* This method initializes chkBoxShowAgain
|
|
214 |
*
|
|
215 |
* @return javax.swing.JCheckBox
|
|
216 |
*/
|
|
217 |
// private JCheckBox getChkBoxShowAgain() {
|
|
218 |
// if (chkBoxShowAgain == null) {
|
|
219 |
// chkBoxShowAgain = new JCheckBox();
|
|
220 |
// chkBoxShowAgain.setBounds(44, 116, 241, 21);
|
|
221 |
// chkBoxShowAgain.setSelected(true);
|
|
222 |
// chkBoxShowAgain.setText(PluginServices.getText(this, "show_this_dialog_next_startup"));
|
|
223 |
// }
|
|
224 |
// return chkBoxShowAgain;
|
|
225 |
// }
|
|
226 |
|
|
227 |
public WindowInfo getWindowInfo() {
|
|
228 |
WindowInfo vi = new WindowInfo(WindowInfo.MODALDIALOG);
|
|
229 |
vi.setWidth(300+8);
|
|
230 |
vi.setHeight(250);
|
|
231 |
vi.setTitle(PluginServices.getText(this, "warning"));
|
|
232 |
return vi;
|
|
233 |
}
|
|
234 |
|
|
235 |
} // @jve:decl-index=0:visual-constraint="10,10"
|
|
236 |
|
|
237 |
}
|