svn-gvsig-desktop / branches / F2 / extensions / extJCRS / src / org / gvsig / crs / InitialWarningExtension.java @ 20027
History | View | Annotate | Download (5.62 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 8765 2006-11-15 00:08:29Z jjdelcerro $
|
45 |
* $Log$
|
46 |
* Revision 1.3.4.1 2006-11-15 00:08:08 jjdelcerro
|
47 |
* *** empty log message ***
|
48 |
*
|
49 |
* Revision 1.4 2006/10/02 13:52:34 jaume
|
50 |
* organize impots
|
51 |
*
|
52 |
* Revision 1.3 2006/08/29 07:56:27 cesar
|
53 |
* Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
|
54 |
*
|
55 |
* Revision 1.2 2006/08/29 07:13:53 cesar
|
56 |
* Rename class com.iver.andami.ui.mdiManager.View to com.iver.andami.ui.mdiManager.IWindow
|
57 |
*
|
58 |
* Revision 1.1 2006/05/25 16:27:21 jaume
|
59 |
* *** empty log message ***
|
60 |
*
|
61 |
*
|
62 |
*/
|
63 |
package org.gvsig.crs; |
64 |
|
65 |
import java.awt.Color; |
66 |
import java.awt.Window; |
67 |
|
68 |
import javax.swing.JButton; |
69 |
import javax.swing.JCheckBox; |
70 |
import javax.swing.JLabel; |
71 |
import javax.swing.JPanel; |
72 |
import javax.swing.JWindow; |
73 |
import javax.swing.border.TitledBorder; |
74 |
|
75 |
import com.iver.andami.PluginServices; |
76 |
import com.iver.andami.plugins.Extension; |
77 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
78 |
|
79 |
public class InitialWarningExtension extends Extension { |
80 |
// public static Preferences fPrefs = Preferences.userRoot().node( "gvsig.initial_warkning" );
|
81 |
// private boolean show = fPrefs.getBoolean( "show_panel", true);
|
82 |
private DlgWaring dlgWarning;
|
83 |
/**
|
84 |
* @see com.iver.andami.plugins.IExtension#isEnabled()
|
85 |
*/
|
86 |
public boolean isEnabled() { |
87 |
return true; |
88 |
} |
89 |
|
90 |
/**
|
91 |
* @see com.iver.mdiApp.plugins.IExtension#isVisible()
|
92 |
*/
|
93 |
public boolean isVisible() { |
94 |
return true; |
95 |
} |
96 |
|
97 |
/**
|
98 |
* @see com.iver.andami.plugins.IExtension#initialize()
|
99 |
*/
|
100 |
public void initialize() { |
101 |
dlgWarning = new DlgWaring();
|
102 |
dlgWarning.setText(PluginServices.getText(this, "initial_jcrs_warning")); |
103 |
dlgWarning.setVisible(true);
|
104 |
} |
105 |
|
106 |
/**
|
107 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
108 |
*/
|
109 |
public void execute(String actionCommand) { |
110 |
} |
111 |
|
112 |
private class DlgWaring extends JWindow{ |
113 |
|
114 |
private JButton btnOk = null; |
115 |
private JCheckBox chkBoxShowAgain = null; |
116 |
private JLabel lblText = null; |
117 |
private JPanel panel=null; |
118 |
private JPanel panel2; |
119 |
/**
|
120 |
* This is the default constructor
|
121 |
*/
|
122 |
public DlgWaring() {
|
123 |
super((Window)PluginServices.getMainFrame()); |
124 |
Window window=(Window)PluginServices.getMainFrame(); |
125 |
setLocation(window.getWidth()/2+window.getX()-150,window.getHeight()/2+window.getY()-150); |
126 |
initialize(); |
127 |
this.setAlwaysOnTop(true); |
128 |
} |
129 |
|
130 |
public void setText(String string) { |
131 |
lblText.setText(string); |
132 |
} |
133 |
|
134 |
/**
|
135 |
* This method initializes this
|
136 |
*
|
137 |
* @return void
|
138 |
*/
|
139 |
private void initialize() { |
140 |
panel=new JPanel(); |
141 |
panel.setBackground(Color.black);
|
142 |
panel.setLayout(null);
|
143 |
panel.setBounds(0,0,300,300); |
144 |
panel2=new JPanel(); |
145 |
panel2.setLayout(null);
|
146 |
panel2.setBounds(2,2,298,298); |
147 |
lblText = new JLabel(); |
148 |
lblText.setBounds(15, 15, 271, 200); |
149 |
lblText.setText("JLabel");
|
150 |
lblText.setBorder(new TitledBorder(PluginServices.getText(this, "warning"))); |
151 |
panel2.add(lblText); |
152 |
panel2.setSize((int)(panel.getSize().getWidth()-4),(int)(panel.getSize().getHeight()-4)); |
153 |
panel.add(panel2); |
154 |
this.setLayout(null); |
155 |
this.setSize(300, 300); |
156 |
this.add(getBtnOk(), null); |
157 |
// this.add(getChkBoxShowAgain(), null);
|
158 |
this.add(panel, null); |
159 |
} |
160 |
|
161 |
/**
|
162 |
* This method initializes btnOk
|
163 |
*
|
164 |
* @return javax.swing.JButton
|
165 |
*/
|
166 |
private JButton getBtnOk() { |
167 |
if (btnOk == null) { |
168 |
btnOk = new JButton(); |
169 |
btnOk.setBounds(100, 250, 100, 20); |
170 |
btnOk.setText(PluginServices.getText(this, "aceptar")); |
171 |
btnOk.addActionListener(new java.awt.event.ActionListener() {
|
172 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
173 |
dlgWarning.setVisible(false);
|
174 |
dlgWarning.dispose(); |
175 |
// PluginServices.getMDIManager().closeWindow(dlgWarning);
|
176 |
} |
177 |
}); |
178 |
} |
179 |
return btnOk;
|
180 |
} |
181 |
|
182 |
/**
|
183 |
* This method initializes chkBoxShowAgain
|
184 |
*
|
185 |
* @return javax.swing.JCheckBox
|
186 |
*/
|
187 |
// private JCheckBox getChkBoxShowAgain() {
|
188 |
// if (chkBoxShowAgain == null) {
|
189 |
// chkBoxShowAgain = new JCheckBox();
|
190 |
// chkBoxShowAgain.setBounds(44, 116, 241, 21);
|
191 |
// chkBoxShowAgain.setSelected(true);
|
192 |
// chkBoxShowAgain.setText(PluginServices.getText(this, "show_this_dialog_next_startup"));
|
193 |
// }
|
194 |
// return chkBoxShowAgain;
|
195 |
// }
|
196 |
|
197 |
public WindowInfo getWindowInfo() {
|
198 |
WindowInfo vi = new WindowInfo(WindowInfo.MODALDIALOG);
|
199 |
vi.setWidth(300+8); |
200 |
vi.setHeight(250);
|
201 |
vi.setTitle(PluginServices.getText(this, "warning")); |
202 |
return vi;
|
203 |
} |
204 |
|
205 |
} // @jve:decl-index=0:visual-constraint="10,10"
|
206 |
|
207 |
} |