svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / extension / InitialWarningExtension.java @ 40558
History | View | Annotate | Download (5.41 KB)
1 | 40558 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40558 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40435 | jjdelcerro | *
|
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 | 40558 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * of the License, or (at your option) any later version.
|
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.
|
||
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 | 40558 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | * MA 02110-1301, USA.
|
||
20 | 40435 | jjdelcerro | *
|
21 | 40558 | jjdelcerro | * For any additional information, do not hesitate to contact us
|
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40435 | jjdelcerro | */
|
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 | package org.gvsig.app.extension; |
||
43 | |||
44 | import java.awt.Color; |
||
45 | import java.awt.Window; |
||
46 | |||
47 | import javax.swing.JButton; |
||
48 | import javax.swing.JCheckBox; |
||
49 | import javax.swing.JLabel; |
||
50 | import javax.swing.JPanel; |
||
51 | import javax.swing.JWindow; |
||
52 | import javax.swing.border.TitledBorder; |
||
53 | |||
54 | import org.gvsig.andami.PluginServices; |
||
55 | import org.gvsig.andami.plugins.Extension; |
||
56 | import org.gvsig.andami.ui.mdiManager.WindowInfo; |
||
57 | |||
58 | |||
59 | 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 | |||
70 | /**
|
||
71 | * @see com.iver.mdiApp.plugins.IExtension#isVisible()
|
||
72 | */
|
||
73 | public boolean isVisible() { |
||
74 | return true; |
||
75 | } |
||
76 | |||
77 | /**
|
||
78 | * @see org.gvsig.andami.plugins.IExtension#initialize()
|
||
79 | */
|
||
80 | public void initialize() { |
||
81 | |||
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 | } |
||
88 | |||
89 | } |
||
90 | |||
91 | /**
|
||
92 | * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
|
||
93 | */
|
||
94 | public void execute(String actionCommand) { |
||
95 | |||
96 | } |
||
97 | |||
98 | private class DlgWaring extends JWindow{ |
||
99 | |||
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 | } |
||
115 | |||
116 | public void setText(String string) { |
||
117 | lblText.setText(string); |
||
118 | } |
||
119 | |||
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 | } |
||
146 | |||
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 | } |
||
167 | |||
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 | // }
|
||
182 | |||
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 | } |
||
190 | |||
191 | } // @jve:decl-index=0:visual-constraint="10,10"
|
||
192 | |||
193 | } |