root / trunk / applications / appCatalogAndGazetteerClient / src / es / gva / cit / gazetteer / ui / search / SearchUpperPanel.java @ 15558
History | View | Annotate | Download (7.05 KB)
1 |
|
---|---|
2 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
3 |
*
|
4 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
19 |
*
|
20 |
* For more information, contact:
|
21 |
*
|
22 |
* Generalitat Valenciana
|
23 |
* Conselleria d'Infraestructures i Transport
|
24 |
* Av. Blasco Ib??ez, 50
|
25 |
* 46010 VALENCIA
|
26 |
* SPAIN
|
27 |
*
|
28 |
* +34 963862235
|
29 |
* gvsig@gva.es
|
30 |
* www.gvsig.gva.es
|
31 |
*
|
32 |
* or
|
33 |
*
|
34 |
* IVER T.I. S.A
|
35 |
* Salamanca 50
|
36 |
* 46005 Valencia
|
37 |
* Spain
|
38 |
*
|
39 |
* +34 963163400
|
40 |
* dac@iver.es
|
41 |
*/
|
42 |
package es.gva.cit.gazetteer.ui.search; |
43 |
import java.awt.Dimension; |
44 |
import java.awt.event.ActionListener; |
45 |
|
46 |
import javax.swing.ImageIcon; |
47 |
import javax.swing.JPanel; |
48 |
|
49 |
import org.gvsig.i18n.Messages; |
50 |
|
51 |
import es.gva.cit.catalog.utils.CatalogConstants; |
52 |
|
53 |
/**
|
54 |
* @author Jorge Piera Llodra (piera_jor@gva.es)
|
55 |
*/
|
56 |
public class SearchUpperPanel extends JPanel { |
57 |
private javax.swing.JCheckBox areaCheckBox;
|
58 |
private javax.swing.JPanel areaPanel;
|
59 |
private javax.swing.JPanel leftPanel;
|
60 |
private javax.swing.JLabel nameLabel;
|
61 |
private javax.swing.JPanel namePanel;
|
62 |
private javax.swing.JTextField nameText;
|
63 |
private javax.swing.JButton resizeButton;
|
64 |
private javax.swing.JPanel resizePanel;
|
65 |
/** Creates new form upperPanel */
|
66 |
public SearchUpperPanel() {
|
67 |
initComponents(); |
68 |
initLabels(); |
69 |
} |
70 |
|
71 |
/** This method is called from within the constructor to
|
72 |
* initialize the form.
|
73 |
* WARNING: Do NOT modify this code. The content of this method is
|
74 |
* always regenerated by the Form Editor.
|
75 |
*/
|
76 |
// <editor-fold defaultstate="collapsed" desc=" C?digo Generado ">
|
77 |
private void initComponents() { |
78 |
java.awt.GridBagConstraints gridBagConstraints; |
79 |
|
80 |
namePanel = new javax.swing.JPanel();
|
81 |
nameLabel = new javax.swing.JLabel();
|
82 |
nameText = new javax.swing.JTextField();
|
83 |
leftPanel = new javax.swing.JPanel();
|
84 |
areaPanel = new javax.swing.JPanel();
|
85 |
areaCheckBox = new javax.swing.JCheckBox();
|
86 |
resizePanel = new javax.swing.JPanel();
|
87 |
resizeButton = new javax.swing.JButton();
|
88 |
|
89 |
setLayout(new java.awt.GridLayout(1, 0)); |
90 |
|
91 |
setPreferredSize(new java.awt.Dimension(200, 42)); |
92 |
namePanel.setLayout(new java.awt.GridBagLayout());
|
93 |
|
94 |
namePanel.setPreferredSize(new java.awt.Dimension(100, 42)); |
95 |
nameLabel.setText("jLabel1");
|
96 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
97 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
98 |
gridBagConstraints.weightx = 1.0;
|
99 |
gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5); |
100 |
namePanel.add(nameLabel, gridBagConstraints); |
101 |
|
102 |
nameText.setText("jTextField1");
|
103 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
104 |
gridBagConstraints.gridx = 0;
|
105 |
gridBagConstraints.gridy = 1;
|
106 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
107 |
gridBagConstraints.weightx = 1.0;
|
108 |
gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 4); |
109 |
namePanel.add(nameText, gridBagConstraints); |
110 |
|
111 |
add(namePanel); |
112 |
|
113 |
leftPanel.setLayout(new java.awt.GridBagLayout());
|
114 |
|
115 |
leftPanel.setPreferredSize(new java.awt.Dimension(100, 40)); |
116 |
areaPanel.setLayout(new java.awt.GridBagLayout());
|
117 |
|
118 |
areaPanel.setPreferredSize(new java.awt.Dimension(200, 40)); |
119 |
areaCheckBox.setText("jCheckBox1");
|
120 |
areaCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
121 |
areaCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0)); |
122 |
areaCheckBox.setPreferredSize(new java.awt.Dimension(90, 30)); |
123 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
124 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
125 |
gridBagConstraints.weightx = 1.0;
|
126 |
gridBagConstraints.insets = new java.awt.Insets(20, 2, 2, 2); |
127 |
areaPanel.add(areaCheckBox, gridBagConstraints); |
128 |
|
129 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
130 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
131 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
132 |
gridBagConstraints.weightx = 0.3;
|
133 |
leftPanel.add(areaPanel, gridBagConstraints); |
134 |
|
135 |
resizePanel.setLayout(new java.awt.GridBagLayout());
|
136 |
|
137 |
resizePanel.setPreferredSize(new java.awt.Dimension(40, 40)); |
138 |
resizeButton.setMaximumSize(null);
|
139 |
resizeButton.setMinimumSize(null);
|
140 |
resizeButton.setOpaque(false);
|
141 |
resizeButton.setPreferredSize(new java.awt.Dimension(25, 25)); |
142 |
|
143 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
144 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; |
145 |
gridBagConstraints.insets = new java.awt.Insets(19, 2, 2, 2); |
146 |
resizePanel.add(resizeButton, gridBagConstraints); |
147 |
|
148 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
149 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; |
150 |
gridBagConstraints.weightx = 0.7;
|
151 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); |
152 |
leftPanel.add(resizePanel, gridBagConstraints); |
153 |
|
154 |
add(leftPanel); |
155 |
}// </editor-fold>
|
156 |
|
157 |
/**
|
158 |
* Rewrite the labels
|
159 |
*/
|
160 |
private void initLabels(){ |
161 |
nameText.setText("");
|
162 |
nameLabel.setText(Messages.getText("name"));
|
163 |
areaCheckBox.setText(Messages.getText("restrictArea"));
|
164 |
resizeButton.setSize(new Dimension(CatalogConstants.RESIZE_WINDOW_BUTTON_SIZE, |
165 |
CatalogConstants.RESIZE_WINDOW_BUTTON_SIZE)); |
166 |
setDownIcon(); |
167 |
} |
168 |
|
169 |
/**
|
170 |
* Add a listener for the buttons
|
171 |
* @param listener
|
172 |
* Listener to add
|
173 |
*/
|
174 |
public void addActionListener(ActionListener listener){ |
175 |
resizeButton.addActionListener(listener); |
176 |
resizeButton.setActionCommand("resize");
|
177 |
} |
178 |
|
179 |
/**
|
180 |
* Sets the up triangle icon (to minimize)
|
181 |
*/
|
182 |
public void setUpIcon() { |
183 |
resizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/up.png")); |
184 |
} |
185 |
|
186 |
/**
|
187 |
* Sets the down triangle icon (to maximize)
|
188 |
*/
|
189 |
public void setDownIcon() { |
190 |
resizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/down.png")); |
191 |
} |
192 |
|
193 |
/**
|
194 |
* @return if the are check is clicked
|
195 |
*/
|
196 |
public boolean isRestrictAreaClicked() { |
197 |
return areaCheckBox.isSelected();
|
198 |
} |
199 |
|
200 |
/**
|
201 |
* @return the geoname
|
202 |
*/
|
203 |
public String getName(){ |
204 |
return nameText.getText();
|
205 |
} |
206 |
} |