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