root / branches / v2_0_0_prep / extensions / extGeoDB / src / org / gvsig / geodb / vectorialdb / JPasswordDlg.java @ 38608
History | View | Annotate | Download (7.49 KB)
1 | 23176 | vcaballero | /*
|
---|---|---|---|
2 | * Created on 07-oct-2005
|
||
3 | *
|
||
4 | * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
5 | *
|
||
6 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
7 | *
|
||
8 | * This program is free software; you can redistribute it and/or
|
||
9 | * modify it under the terms of the GNU General Public License
|
||
10 | * as published by the Free Software Foundation; either version 2
|
||
11 | * of the License, or (at your option) any later version.
|
||
12 | *
|
||
13 | * This program is distributed in the hope that it will be useful,
|
||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
16 | * GNU General Public License for more details.
|
||
17 | *
|
||
18 | * You should have received a copy of the GNU General Public License
|
||
19 | * along with this program; if not, write to the Free Software
|
||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||
21 | *
|
||
22 | * For more information, contact:
|
||
23 | *
|
||
24 | * Generalitat Valenciana
|
||
25 | * Conselleria d'Infraestructures i Transport
|
||
26 | * Av. Blasco Ib??ez, 50
|
||
27 | * 46010 VALENCIA
|
||
28 | * SPAIN
|
||
29 | *
|
||
30 | * +34 963862235
|
||
31 | * gvsig@gva.es
|
||
32 | * www.gvsig.gva.es
|
||
33 | *
|
||
34 | * or
|
||
35 | *
|
||
36 | * IVER T.I. S.A
|
||
37 | * Salamanca 50
|
||
38 | * 46005 Valencia
|
||
39 | * Spain
|
||
40 | *
|
||
41 | * +34 963163400
|
||
42 | * dac@iver.es
|
||
43 | */
|
||
44 | 29628 | jpiera | package org.gvsig.geodb.vectorialdb; |
45 | 23176 | vcaballero | |
46 | import java.awt.event.KeyEvent; |
||
47 | |||
48 | import javax.swing.JButton; |
||
49 | import javax.swing.JEditorPane; |
||
50 | import javax.swing.JPanel; |
||
51 | import javax.swing.JPasswordField; |
||
52 | import javax.swing.JTextArea; |
||
53 | |||
54 | 29628 | jpiera | import org.gvsig.andami.PluginServices; |
55 | import org.gvsig.andami.ui.mdiManager.IWindow; |
||
56 | import org.gvsig.andami.ui.mdiManager.WindowInfo; |
||
57 | 23176 | vcaballero | |
58 | 29628 | jpiera | |
59 | 23176 | vcaballero | public class JPasswordDlg extends JPanel implements IWindow { |
60 | |||
61 | private JPanel jContentPane = null; |
||
62 | |||
63 | private JButton jButtonOK = null; |
||
64 | |||
65 | private JButton jButton1 = null; |
||
66 | |||
67 | private JPasswordField jPasswordField = null; |
||
68 | |||
69 | private String password = null; |
||
70 | |||
71 | private JEditorPane jEditorPane = null; |
||
72 | |||
73 | private JTextArea jLblMensaje = null; |
||
74 | |||
75 | // private WindowEventsHandler windowHandler = new WindowEventsHandler();
|
||
76 | |||
77 | /**
|
||
78 | * This is the default constructor
|
||
79 | */
|
||
80 | public JPasswordDlg() {
|
||
81 | super();
|
||
82 | initialize(); |
||
83 | } |
||
84 | |||
85 | // class WindowEventsHandler extends WindowAdapter
|
||
86 | // {
|
||
87 | //
|
||
88 | // /* (non-Javadoc)
|
||
89 | // * @see java.awt.event.WindowAdapter#windowActivated(java.awt.event.WindowEvent)
|
||
90 | // */
|
||
91 | // public void windowActivated(WindowEvent e) {
|
||
92 | // // TODO Auto-generated method stub
|
||
93 | // super.windowActivated(e);
|
||
94 | // jPasswordField.requestFocus();
|
||
95 | // }
|
||
96 | //
|
||
97 | // }
|
||
98 | /**
|
||
99 | * This method initializes this
|
||
100 | *
|
||
101 | * @return void
|
||
102 | */
|
||
103 | private void initialize() { |
||
104 | this.setSize(287, 172); |
||
105 | this.setLayout(null); |
||
106 | this.add(getJContentPane());
|
||
107 | // this.setModal(true);
|
||
108 | // this.setResizable(false);
|
||
109 | // this.setTitle("Enter Password");
|
||
110 | // this.setContentPane(getJContentPane());
|
||
111 | //
|
||
112 | // addWindowListener(windowHandler);
|
||
113 | } |
||
114 | /**
|
||
115 | * This method initializes jContentPane
|
||
116 | *
|
||
117 | * @return javax.swing.JPanel
|
||
118 | */
|
||
119 | private JPanel getJContentPane() { |
||
120 | if (jContentPane == null) { |
||
121 | jContentPane = new JPanel(); |
||
122 | jContentPane.setLayout(null);
|
||
123 | jContentPane.add(getJButton1(), null);
|
||
124 | jContentPane.add(getJButtonOK(), null);
|
||
125 | jContentPane.add(getJPasswordField(), null);
|
||
126 | jContentPane.add(getJLblMensaje(), null);
|
||
127 | jContentPane.setBounds(0,0,300,200); |
||
128 | } |
||
129 | return jContentPane;
|
||
130 | } |
||
131 | |||
132 | /**
|
||
133 | * This method initializes jButton
|
||
134 | *
|
||
135 | * @return javax.swing.JButton
|
||
136 | */
|
||
137 | private JButton getJButtonOK() { |
||
138 | if (jButtonOK == null) { |
||
139 | jButtonOK = new JButton(); |
||
140 | jButtonOK.setText("OK");
|
||
141 | jButtonOK.setPreferredSize(new java.awt.Dimension(65, 23)); |
||
142 | jButtonOK.setBounds(35, 110, 101, 22); |
||
143 | jButtonOK.addActionListener(new java.awt.event.ActionListener() {
|
||
144 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
145 | System.out.println("actionPerformed()"); // TODO |
||
146 | // Auto-generated
|
||
147 | // Event stub
|
||
148 | // actionPerformed()
|
||
149 | password = String.copyValueOf(getJPasswordField()
|
||
150 | .getPassword()); |
||
151 | PluginServices.getMDIManager().closeWindow(JPasswordDlg.this); |
||
152 | // dispose();
|
||
153 | } |
||
154 | }); |
||
155 | } |
||
156 | return jButtonOK;
|
||
157 | } |
||
158 | |||
159 | /**
|
||
160 | * This method initializes jButton1
|
||
161 | *
|
||
162 | * @return javax.swing.JButton
|
||
163 | */
|
||
164 | private JButton getJButton1() { |
||
165 | if (jButton1 == null) { |
||
166 | jButton1 = new JButton(); |
||
167 | jButton1.setText("Cancel");
|
||
168 | jButton1.setBounds(136, 110, 99, 22); |
||
169 | jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||
170 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
171 | password = null;
|
||
172 | PluginServices.getMDIManager().closeWindow(JPasswordDlg.this); |
||
173 | // dispose();
|
||
174 | } |
||
175 | }); |
||
176 | } |
||
177 | return jButton1;
|
||
178 | } |
||
179 | |||
180 | /**
|
||
181 | * This method initializes jPasswordField
|
||
182 | *
|
||
183 | * @return javax.swing.JPasswordField
|
||
184 | */
|
||
185 | private JPasswordField getJPasswordField() { |
||
186 | if (jPasswordField == null) { |
||
187 | jPasswordField = new JPasswordField(); |
||
188 | jPasswordField.setPreferredSize(new java.awt.Dimension(60, 22)); |
||
189 | jPasswordField.setBounds(65, 78, 145, 21); |
||
190 | jPasswordField.addKeyListener(new java.awt.event.KeyAdapter() {
|
||
191 | public void keyTyped(java.awt.event.KeyEvent e) { |
||
192 | if (e.getKeyChar() == KeyEvent.VK_ENTER) { |
||
193 | // System.out.println("INTRO");
|
||
194 | getJButtonOK().doClick(); |
||
195 | } |
||
196 | } |
||
197 | }); |
||
198 | } |
||
199 | return jPasswordField;
|
||
200 | } |
||
201 | |||
202 | /**
|
||
203 | * @return Returns the password.
|
||
204 | */
|
||
205 | public String getPassword() { |
||
206 | return password;
|
||
207 | } |
||
208 | |||
209 | public void setMessage(String str) { |
||
210 | getJLblMensaje().setText(str); |
||
211 | } |
||
212 | |||
213 | /**
|
||
214 | * This method initializes jTextArea
|
||
215 | *
|
||
216 | * @return javax.swing.JTextArea
|
||
217 | */
|
||
218 | private JTextArea getJLblMensaje() { |
||
219 | if (jLblMensaje == null) { |
||
220 | jLblMensaje = new JTextArea(); |
||
221 | jLblMensaje.setEditable(false);
|
||
222 | jLblMensaje.setForeground(java.awt.Color.black); |
||
223 | jLblMensaje.setBackground(java.awt.SystemColor.control); |
||
224 | jLblMensaje.setText("Mensaje");
|
||
225 | jLblMensaje.setLineWrap(true);
|
||
226 | jLblMensaje.setFont(new java.awt.Font("SansSerif", |
||
227 | java.awt.Font.PLAIN, 12));
|
||
228 | jLblMensaje.setPreferredSize(new java.awt.Dimension(270, 50)); |
||
229 | jLblMensaje.setBounds(9, 6, 266, 68); |
||
230 | jLblMensaje.setWrapStyleWord(true);
|
||
231 | } |
||
232 | return jLblMensaje;
|
||
233 | } |
||
234 | public WindowInfo getWindowInfo() {
|
||
235 | WindowInfo wi=new WindowInfo(WindowInfo.MODALDIALOG|WindowInfo.RESIZABLE);
|
||
236 | wi.setTitle(PluginServices.getText(this,"enter_password")); |
||
237 | return wi;
|
||
238 | } |
||
239 | 26449 | jmvivo | public Object getWindowProfile() { |
240 | // TODO Auto-generated method stub
|
||
241 | return WindowInfo.DIALOG_PROFILE;
|
||
242 | } |
||
243 | |||
244 | 23176 | vcaballero | } // @jve:decl-index=0:visual-constraint="10,10" |