Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / InitialWarningExtension.java @ 31305

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