root / trunk / libraries / libUI / src / org / gvsig / gui / beans / filterPanel / filterQueryPanel / FilterQueryJPanel.java @ 8585
History | View | Annotate | Download (7.98 KB)
1 |
package org.gvsig.gui.beans.filterPanel.filterQueryPanel; |
---|---|
2 |
|
3 |
import java.awt.Color; |
4 |
import java.awt.Dimension; |
5 |
import java.awt.GridBagConstraints; |
6 |
import java.awt.GridBagLayout; |
7 |
import java.io.Serializable; |
8 |
|
9 |
import javax.swing.BorderFactory; |
10 |
import javax.swing.JPanel; |
11 |
import javax.swing.JScrollPane; |
12 |
import javax.swing.tree.DefaultMutableTreeNode; |
13 |
|
14 |
import org.gvsig.gui.beans.filterPanel.AbstractFilterQueryJPanel; |
15 |
|
16 |
import com.iver.andami.PluginServices; |
17 |
|
18 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
19 |
*
|
20 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
21 |
*
|
22 |
* This program is free software; you can redistribute it and/or
|
23 |
* modify it under the terms of the GNU General Public License
|
24 |
* as published by the Free Software Foundation; either version 2
|
25 |
* of the License, or (at your option) any later version.
|
26 |
*
|
27 |
* This program is distributed in the hope that it will be useful,
|
28 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
29 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
30 |
* GNU General Public License for more details.
|
31 |
*
|
32 |
* You should have received a copy of the GNU General Public License
|
33 |
* along with this program; if not, write to the Free Software
|
34 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
35 |
*
|
36 |
* For more information, contact:
|
37 |
*
|
38 |
* Generalitat Valenciana
|
39 |
* Conselleria d'Infraestructures i Transport
|
40 |
* Av. Blasco Ib??ez, 50
|
41 |
* 46010 VALENCIA
|
42 |
* SPAIN
|
43 |
*
|
44 |
* +34 963862235
|
45 |
* gvsig@gva.es
|
46 |
* www.gvsig.gva.es
|
47 |
*
|
48 |
* or
|
49 |
*
|
50 |
* IVER T.I. S.A
|
51 |
* Salamanca 50
|
52 |
* 46005 Valencia
|
53 |
* Spain
|
54 |
*
|
55 |
* +34 963163400
|
56 |
* dac@iver.es
|
57 |
*/
|
58 |
|
59 |
/**
|
60 |
* This class is a version of the graphical interface of "FilterDialog" which was made by Fernando and is in 'appgvSIG' project.
|
61 |
* It's supposed that other classes will extend from this and will add the logic as is in the "FilterDialog" class.
|
62 |
*
|
63 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
|
64 |
*/
|
65 |
public class FilterQueryJPanel extends AbstractFilterQueryJPanel implements Serializable{ |
66 |
private static final long serialVersionUID = -5772343767095703604L; |
67 |
|
68 |
protected int filterJScrollPaneHeight = defaultBottomJPanelHeight - 10; |
69 |
protected int filterJScrollPanelWidth = defaultBottomJPanelWidth; |
70 |
|
71 |
/**
|
72 |
* @see AbstractFilterQueryJPanel#AbstractFilterQueryJPanel()
|
73 |
*/
|
74 |
public FilterQueryJPanel() {
|
75 |
super();
|
76 |
this.initialize();
|
77 |
} |
78 |
|
79 |
/**
|
80 |
* @see AbstractFilterQueryJPanel#AbstractFilterQueryJPanel(String)
|
81 |
*/
|
82 |
public FilterQueryJPanel(String _title) { |
83 |
super(_title);
|
84 |
this.initialize();
|
85 |
} |
86 |
|
87 |
/*
|
88 |
* (non-Javadoc)
|
89 |
* @see org.gvsig.gui.beans.filterPanel.AbstractFilterQueryJPanel#initialize()
|
90 |
*/
|
91 |
protected void initialize() { |
92 |
super.initialize();
|
93 |
this.setBorder(BorderFactory.createTitledBorder(PluginServices.getText(this, "filterOnAWFSLayer"))); |
94 |
} |
95 |
|
96 |
/*
|
97 |
* (FilterQueryJPanel)
|
98 |
* @see org.gvsig.gui.beans.filterPanel.AbstractFilterQueryJPanel#getFieldsJPanel()
|
99 |
*/
|
100 |
protected JPanel getFieldsJPanel() { |
101 |
if (fieldsJPanel == null) { |
102 |
fieldsJPanel = new javax.swing.JPanel();
|
103 |
fieldsJPanel.setPreferredSize(new java.awt.Dimension(fieldsJPanelWidth, fieldsJPanelHeight));
|
104 |
fieldsJPanel.setLayout(new GridBagLayout()); |
105 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
106 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
107 |
gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
|
108 |
gridBagConstraints.anchor = GridBagConstraints.NORTH;
|
109 |
fieldsJPanel.add(getFieldsJLabel(), gridBagConstraints); |
110 |
gridBagConstraints.anchor = GridBagConstraints.SOUTH;
|
111 |
fieldsJPanel.add(getFieldsJScrollPane(), gridBagConstraints); |
112 |
|
113 |
} |
114 |
|
115 |
return fieldsJPanel;
|
116 |
} |
117 |
|
118 |
/**
|
119 |
* This method initializes jScrollPane
|
120 |
*
|
121 |
* @return javax.swing.JScrollPane
|
122 |
*/
|
123 |
protected javax.swing.JScrollPane getFieldsJScrollPane() {
|
124 |
if (fieldsJScrollPane == null) { |
125 |
fieldsJScrollPane = new javax.swing.JScrollPane();
|
126 |
fieldsJScrollPane.setPreferredSize(new java.awt.Dimension(fieldsAndValuesJScrollPaneWidth, fieldsAndValuesJScrollPaneHeight));
|
127 |
fieldsJScrollPane.setViewportView(getFieldsJTree()); |
128 |
} |
129 |
|
130 |
return fieldsJScrollPane;
|
131 |
} |
132 |
|
133 |
/*
|
134 |
* (non-Javadoc)
|
135 |
* @see org.gvsig.gui.beans.filterPanel.AbstractFilterQueryJPanel#getValuesJPanel()
|
136 |
*/
|
137 |
protected JPanel getValuesJPanel() { |
138 |
if (valuesJPanel == null) { |
139 |
valuesJPanel = new javax.swing.JPanel();
|
140 |
valuesJPanel.setPreferredSize(new java.awt.Dimension(valuesJPanelWidth, valuesJPanelHeight));
|
141 |
valuesJPanel.setLayout(new GridBagLayout()); |
142 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
143 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
144 |
gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
|
145 |
gridBagConstraints.anchor = GridBagConstraints.NORTH;
|
146 |
valuesJPanel.add(getValuesJLabel(), gridBagConstraints); |
147 |
gridBagConstraints.anchor = GridBagConstraints.SOUTH;
|
148 |
valuesJPanel.add(getValuesJScrollPane(), gridBagConstraints); |
149 |
} |
150 |
|
151 |
return valuesJPanel;
|
152 |
} |
153 |
|
154 |
/**
|
155 |
* This method initializes jScrollPane1
|
156 |
*
|
157 |
* @return javax.swing.JScrollPane
|
158 |
*/
|
159 |
protected javax.swing.JScrollPane getValuesJScrollPane() {
|
160 |
if (valuesJScrollPane == null) { |
161 |
valuesJScrollPane = new javax.swing.JScrollPane();
|
162 |
valuesJScrollPane.setPreferredSize(new Dimension(fieldsAndValuesJScrollPaneWidth, fieldsAndValuesJScrollPaneHeight)); |
163 |
valuesJScrollPane.setViewportView(getValuesJList()); |
164 |
} |
165 |
|
166 |
return valuesJScrollPane;
|
167 |
} |
168 |
|
169 |
/*
|
170 |
* (non-Javadoc)
|
171 |
* @see org.gvsig.gui.beans.filterPanel.AbstractFilterQueryJPanel#getFilterJScrollPane()
|
172 |
*/
|
173 |
protected JScrollPane getFilterJScrollPane() { |
174 |
if (filterJScrollPane == null) { |
175 |
filterJScrollPane = new javax.swing.JScrollPane();
|
176 |
filterJScrollPane.setPreferredSize(new java.awt.Dimension(filterJScrollPanelWidth, filterJScrollPaneHeight));
|
177 |
filterJScrollPane.setViewportView(getTxtExpression()); |
178 |
filterJScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); |
179 |
} |
180 |
|
181 |
return filterJScrollPane;
|
182 |
} |
183 |
|
184 |
/**
|
185 |
* This method initializes txtExpression
|
186 |
*
|
187 |
* @return javax.swing.JTextArea
|
188 |
*/
|
189 |
protected javax.swing.JTextArea getTxtExpression() {
|
190 |
if (txtExpression == null) { |
191 |
txtExpression = new javax.swing.JTextArea();
|
192 |
txtExpression.setLineWrap(true);
|
193 |
} |
194 |
|
195 |
return txtExpression;
|
196 |
} |
197 |
|
198 |
/*
|
199 |
* (non-Javadoc)
|
200 |
* @see org.gvsig.gui.beans.filterPanel.AbstractFilterQueryJPanel#getBottomJPanel()
|
201 |
*/
|
202 |
protected JPanel getBottomJPanel() { |
203 |
if (bottomJPanel == null) { |
204 |
bottomJPanel = new JPanel(); |
205 |
bottomJPanel.setPreferredSize(new Dimension(defaultBottomJPanelWidth, defaultBottomJPanelHeight)); |
206 |
bottomJPanel.add(getFilterJScrollPane(), null);
|
207 |
} |
208 |
|
209 |
return bottomJPanel;
|
210 |
} |
211 |
|
212 |
/*
|
213 |
* (non-Javadoc)
|
214 |
* @see org.gvsig.gui.beans.filterPanel.AbstractFilterQueryJPanel#resizeWidth(int)
|
215 |
*/
|
216 |
public void resizeWidth(int new_Width) { |
217 |
int difference = new_Width - DefaultWidth;
|
218 |
|
219 |
if (difference != 0) { |
220 |
this.setPreferredSize(new Dimension(this.getPreferredSize().width + difference, this.getPreferredSize().height)); |
221 |
topJPanel.setPreferredSize(new Dimension(topJPanel.getPreferredSize().width + difference, topJPanel.getPreferredSize().height)); |
222 |
bottomJPanel.setPreferredSize(new Dimension(bottomJPanel.getPreferredSize().width + difference, bottomJPanel.getPreferredSize().height)); |
223 |
filterJScrollPane.setPreferredSize(new Dimension(filterJScrollPane.getPreferredSize().width + difference, filterJScrollPane.getPreferredSize().height)); |
224 |
|
225 |
int halfDifference = difference / 2; |
226 |
|
227 |
fieldsJPanel.setPreferredSize(new Dimension(fieldsJPanel.getPreferredSize().width + halfDifference, fieldsJPanel.getPreferredSize().height)); |
228 |
fieldsJScrollPane.setPreferredSize(new Dimension(fieldsJScrollPane.getPreferredSize().width + halfDifference, fieldsJScrollPane.getPreferredSize().height)); |
229 |
|
230 |
valuesJPanel.setPreferredSize(new Dimension(valuesJPanel.getPreferredSize().width + halfDifference, valuesJPanel.getPreferredSize().height)); |
231 |
valuesJScrollPane.setPreferredSize(new Dimension(valuesJScrollPane.getPreferredSize().width + halfDifference, valuesJScrollPane.getPreferredSize().height)); |
232 |
} |
233 |
} |
234 |
} |