svn-document-layout / trunk / org.gvsig.app.document.layout.app / org.gvsig.app.document.layout.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / gui / dialogs / Tag.java @ 5
History | View | Annotate | Download (4.44 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
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 2
|
9 |
* 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 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.app.project.documents.layout.gui.dialogs; |
23 |
|
24 |
import javax.swing.JButton; |
25 |
import javax.swing.JLabel; |
26 |
import javax.swing.JPanel; |
27 |
import javax.swing.JTextField; |
28 |
|
29 |
import org.gvsig.andami.PluginServices; |
30 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
31 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
32 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
33 |
|
34 |
/**
|
35 |
* Di?logo para insertar o modificar el Tag asociado a un FFrame.
|
36 |
*
|
37 |
* @author Vicente Caballero Navarro
|
38 |
*/
|
39 |
public class Tag extends JPanel implements IWindow { |
40 |
|
41 |
private static final long serialVersionUID = -2139875729308113677L; |
42 |
private JTextField jTextField = null; |
43 |
private JLabel jLabel = null; |
44 |
private JButton jButton = null; |
45 |
private JButton jButton1 = null; |
46 |
private IFFrame fframe = null; |
47 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.PALETTE);
|
48 |
|
49 |
/**
|
50 |
* This is the default constructor
|
51 |
*
|
52 |
* @param f
|
53 |
* FFrame al que asociar el Tag.
|
54 |
*/
|
55 |
public Tag(IFFrame f) {
|
56 |
super();
|
57 |
fframe = f; |
58 |
initialize(); |
59 |
} |
60 |
|
61 |
/**
|
62 |
* This method initializes jTextField
|
63 |
*
|
64 |
* @return javax.swing.JTextField
|
65 |
*/
|
66 |
private JTextField getJTextField() { |
67 |
if (jTextField == null) { |
68 |
jTextField = new JTextField(); |
69 |
|
70 |
if (fframe.getTag() != null) { |
71 |
jTextField.setText(fframe.getTag()); |
72 |
} |
73 |
|
74 |
jTextField.setPreferredSize(new java.awt.Dimension(200, 20)); |
75 |
} |
76 |
|
77 |
return jTextField;
|
78 |
} |
79 |
|
80 |
/**
|
81 |
* This method initializes jButton
|
82 |
*
|
83 |
* @return javax.swing.JButton
|
84 |
*/
|
85 |
private JButton getJButton() { |
86 |
if (jButton == null) { |
87 |
jButton = new JButton(); |
88 |
jButton.setText("Aceptar");
|
89 |
jButton.addActionListener(new java.awt.event.ActionListener() {
|
90 |
|
91 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
92 |
if (getJTextField().getText().compareTo("") == 0) { |
93 |
fframe.setTag(null);
|
94 |
} else {
|
95 |
fframe.setTag(getJTextField().getText()); |
96 |
} |
97 |
|
98 |
PluginServices.getMDIManager().closeWindow(Tag.this); |
99 |
} |
100 |
}); |
101 |
} |
102 |
|
103 |
return jButton;
|
104 |
} |
105 |
|
106 |
/**
|
107 |
* This method initializes jButton1
|
108 |
*
|
109 |
* @return javax.swing.JButton
|
110 |
*/
|
111 |
private JButton getJButton1() { |
112 |
if (jButton1 == null) { |
113 |
jButton1 = new JButton(); |
114 |
jButton1.setText("Cancelar");
|
115 |
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
116 |
|
117 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
118 |
PluginServices.getMDIManager().closeWindow(Tag.this); |
119 |
} |
120 |
}); |
121 |
} |
122 |
|
123 |
return jButton1;
|
124 |
} |
125 |
|
126 |
/**
|
127 |
* This method initializes this
|
128 |
*/
|
129 |
private void initialize() { |
130 |
jLabel = new JLabel(); |
131 |
this.setSize(284, 100); |
132 |
jLabel.setText("tag");
|
133 |
this.add(jLabel, null); |
134 |
this.add(getJTextField(), null); |
135 |
this.add(getJButton(), null); |
136 |
this.add(getJButton1(), null); |
137 |
} |
138 |
|
139 |
/**
|
140 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
|
141 |
*/
|
142 |
public WindowInfo getWindowInfo() {
|
143 |
m_viewinfo.setTitle(PluginServices.getText(this, "tag")); |
144 |
|
145 |
return m_viewinfo;
|
146 |
} |
147 |
|
148 |
/**
|
149 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
150 |
*/
|
151 |
public void viewActivated() { |
152 |
} |
153 |
|
154 |
public Object getWindowProfile() { |
155 |
return WindowInfo.TOOL_PROFILE;
|
156 |
} |
157 |
|
158 |
} |