root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / extension / InitialWarningExtension.java @ 38614
History | View | Annotate | Download (5.58 KB)
1 | 14821 | jmvivo | /* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
|
---|---|---|---|
2 | 5464 | jaume | *
|
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 | 14821 | jmvivo | * Av. Blasco Ib��ez, 50
|
24 | 5464 | jaume | * 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$
|
||
45 | * $Log$
|
||
46 | 7738 | jaume | * 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 | 6880 | cesar | * 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 | 6877 | cesar | * 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 | 5464 | jaume | * *** empty log message ***
|
57 | *
|
||
58 | *
|
||
59 | */
|
||
60 | 29596 | jpiera | package org.gvsig.app.extension; |
61 | 5464 | jaume | |
62 | 15921 | vcaballero | import java.awt.Color; |
63 | import java.awt.Window; |
||
64 | |||
65 | 5464 | jaume | import javax.swing.JButton; |
66 | import javax.swing.JCheckBox; |
||
67 | import javax.swing.JLabel; |
||
68 | import javax.swing.JPanel; |
||
69 | 15921 | vcaballero | import javax.swing.JWindow; |
70 | import javax.swing.border.TitledBorder; |
||
71 | 5464 | jaume | |
72 | 29596 | jpiera | import org.gvsig.andami.PluginServices; |
73 | import org.gvsig.andami.plugins.Extension; |
||
74 | import org.gvsig.andami.ui.mdiManager.WindowInfo; |
||
75 | 5464 | jaume | |
76 | 29596 | jpiera | |
77 | 5464 | jaume | 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 | 29596 | jpiera | * @see org.gvsig.andami.plugins.IExtension#isEnabled()
|
83 | 5464 | jaume | */
|
84 | public boolean isEnabled() { |
||
85 | return true; |
||
86 | } |
||
87 | |||
88 | /**
|
||
89 | * @see com.iver.mdiApp.plugins.IExtension#isVisible()
|
||
90 | */
|
||
91 | public boolean isVisible() { |
||
92 | return true; |
||
93 | } |
||
94 | |||
95 | /**
|
||
96 | 29596 | jpiera | * @see org.gvsig.andami.plugins.IExtension#initialize()
|
97 | 5464 | jaume | */
|
98 | public void initialize() { |
||
99 | // if (show) {
|
||
100 | dlgWarning = new DlgWaring();
|
||
101 | dlgWarning.setText(PluginServices.getText(this, "initial_warning")); |
||
102 | 15921 | vcaballero | dlgWarning.setVisible(true);
|
103 | // PluginServices.getMDIManager().addWindow(dlgWarning);
|
||
104 | 5464 | jaume | // }
|
105 | 15912 | jmvivo | |
106 | 5464 | jaume | } |
107 | |||
108 | /**
|
||
109 | 29596 | jpiera | * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
|
110 | 5464 | jaume | */
|
111 | public void execute(String actionCommand) { |
||
112 | 15912 | jmvivo | |
113 | 5464 | jaume | } |
114 | 15912 | jmvivo | |
115 | 15921 | vcaballero | private class DlgWaring extends JWindow{ |
116 | 5464 | jaume | |
117 | private JButton btnOk = null; |
||
118 | private JCheckBox chkBoxShowAgain = null; |
||
119 | private JLabel lblText = null; |
||
120 | 15921 | vcaballero | private JPanel panel=null; |
121 | private JPanel panel2; |
||
122 | 5464 | jaume | /**
|
123 | * This is the default constructor
|
||
124 | */
|
||
125 | public DlgWaring() {
|
||
126 | 15921 | vcaballero | super((Window)PluginServices.getMainFrame()); |
127 | Window window=(Window)PluginServices.getMainFrame(); |
||
128 | setLocation(window.getWidth()/2+window.getX()-150,window.getHeight()/2+window.getY()-150); |
||
129 | 5464 | jaume | initialize(); |
130 | 15921 | vcaballero | this.setAlwaysOnTop(true); |
131 | 5464 | jaume | } |
132 | |||
133 | public void setText(String string) { |
||
134 | lblText.setText(string); |
||
135 | } |
||
136 | |||
137 | /**
|
||
138 | * This method initializes this
|
||
139 | 15912 | jmvivo | *
|
140 | 5464 | jaume | * @return void
|
141 | */
|
||
142 | private void initialize() { |
||
143 | 15921 | vcaballero | panel=new JPanel(); |
144 | panel.setBackground(Color.black);
|
||
145 | panel.setLayout(null);
|
||
146 | panel.setBounds(0,0,300,300); |
||
147 | panel2=new JPanel(); |
||
148 | panel2.setLayout(null);
|
||
149 | panel2.setBounds(2,2,298,298); |
||
150 | 5464 | jaume | lblText = new JLabel(); |
151 | lblText.setBounds(15, 15, 271, 200); |
||
152 | lblText.setText("JLabel");
|
||
153 | 15921 | vcaballero | lblText.setBorder(new TitledBorder(PluginServices.getText(this, "warning"))); |
154 | panel2.add(lblText); |
||
155 | panel2.setSize((int)(panel.getSize().getWidth()-4),(int)(panel.getSize().getHeight()-4)); |
||
156 | panel.add(panel2); |
||
157 | 5464 | jaume | this.setLayout(null); |
158 | this.setSize(300, 300); |
||
159 | this.add(getBtnOk(), null); |
||
160 | // this.add(getChkBoxShowAgain(), null);
|
||
161 | 15921 | vcaballero | this.add(panel, null); |
162 | 5464 | jaume | } |
163 | |||
164 | /**
|
||
165 | 15912 | jmvivo | * This method initializes btnOk
|
166 | *
|
||
167 | * @return javax.swing.JButton
|
||
168 | */
|
||
169 | 5464 | jaume | private JButton getBtnOk() { |
170 | if (btnOk == null) { |
||
171 | btnOk = new JButton(); |
||
172 | btnOk.setBounds(100, 250, 100, 20); |
||
173 | btnOk.setText(PluginServices.getText(this, "aceptar")); |
||
174 | 15912 | jmvivo | btnOk.addActionListener(new java.awt.event.ActionListener() {
|
175 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
176 | 15921 | vcaballero | dlgWarning.setVisible(false);
|
177 | dlgWarning.dispose(); |
||
178 | // PluginServices.getMDIManager().closeWindow(dlgWarning);
|
||
179 | 5464 | jaume | } |
180 | }); |
||
181 | } |
||
182 | return btnOk;
|
||
183 | } |
||
184 | |||
185 | /**
|
||
186 | 15912 | jmvivo | * This method initializes chkBoxShowAgain
|
187 | *
|
||
188 | * @return javax.swing.JCheckBox
|
||
189 | */
|
||
190 | 5464 | jaume | // private JCheckBox getChkBoxShowAgain() {
|
191 | // if (chkBoxShowAgain == null) {
|
||
192 | // chkBoxShowAgain = new JCheckBox();
|
||
193 | // chkBoxShowAgain.setBounds(44, 116, 241, 21);
|
||
194 | // chkBoxShowAgain.setSelected(true);
|
||
195 | // chkBoxShowAgain.setText(PluginServices.getText(this, "show_this_dialog_next_startup"));
|
||
196 | // }
|
||
197 | // return chkBoxShowAgain;
|
||
198 | // }
|
||
199 | |||
200 | 6880 | cesar | public WindowInfo getWindowInfo() {
|
201 | WindowInfo vi = new WindowInfo(WindowInfo.MODALDIALOG);
|
||
202 | 5464 | jaume | vi.setWidth(300+8); |
203 | vi.setHeight(250);
|
||
204 | vi.setTitle(PluginServices.getText(this, "warning")); |
||
205 | return vi;
|
||
206 | } |
||
207 | |||
208 | } // @jve:decl-index=0:visual-constraint="10,10"
|
||
209 | |||
210 | } |