Revision 3099 trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/ui/SearchDialogPanel.java
SearchDialogPanel.java | ||
---|---|---|
69 | 69 |
|
70 | 70 |
//Panels |
71 | 71 |
protected JPanel ppalPanel = null; |
72 |
protected AbstractSearchPanel controlsPanel = null; |
|
72 |
protected SearchUpperPanel upperPanel = null; |
|
73 |
protected SearchLowerPanel lowerPanel = null; |
|
73 | 74 |
protected JPanel checkBoxPanel = null; |
74 | 75 |
protected JPanel buttonsPanel = null; |
75 | 76 |
|
... | ... | |
89 | 90 |
* This method initializes |
90 | 91 |
* |
91 | 92 |
*/ |
92 |
public SearchDialogPanel(JFrame parent,boolean isMinimized,String title) {
|
|
93 |
public SearchDialogPanel(boolean isMinimized,String title, JFrame parent) {
|
|
93 | 94 |
super(); |
95 |
this.isMinimized = isMinimized; |
|
94 | 96 |
this.parent = parent; |
95 |
this.isMinimized = isMinimized; |
|
96 | 97 |
initialize(title); |
97 | 98 |
} |
98 | 99 |
|
... | ... | |
107 | 108 |
ppalPanel.setLocation(0, 0); |
108 | 109 |
ppalPanel.setLayout(new BoxLayout(ppalPanel, BoxLayout.Y_AXIS)); |
109 | 110 |
|
110 |
ppalPanel.add(getControlsPanel(), null); |
|
111 |
if (isMinimized) |
|
112 |
ppalPanel.add(getCheckBoxPanel(),null); |
|
111 |
ppalPanel.add(getUpperPanel()); |
|
113 | 112 |
|
114 |
ppalPanel.add(getButtonsPanel(), null); |
|
113 |
if (!(isMinimized)) |
|
114 |
ppalPanel.add(getLowerPanel()); |
|
115 |
|
|
116 |
ppalPanel.add(getButtonsPanel()); |
|
115 | 117 |
|
116 | 118 |
add(ppalPanel); |
117 | 119 |
|
118 | 120 |
setDefaultButtonListeners(); |
119 | 121 |
|
120 | 122 |
setTitle(title); |
121 |
} |
|
123 |
}
|
|
122 | 124 |
/** |
123 |
* Sets the CatalogClient |
|
124 |
* @param client |
|
125 |
* CatalogClient |
|
126 |
*/ |
|
127 |
public void setCatalogClient(CatalogClient client) { |
|
128 |
this.client = client; |
|
129 |
} |
|
130 |
|
|
131 |
/** |
|
132 |
* It Gets the controlsPanel |
|
125 |
* It Gets the upperPanel |
|
133 | 126 |
* @return |
134 | 127 |
*/ |
135 | 128 |
|
136 |
public AbstractSearchPanel getControlsPanel() { |
|
137 |
if (isMinimized){ |
|
138 |
parent.setSize(300, 130); |
|
139 |
controlsPanel = new SearchMiniPanel(); |
|
140 |
controlsPanel.setSize(200,55); |
|
141 |
}else{ |
|
142 |
parent.setSize(675, 520); |
|
143 |
controlsPanel = new SearchPanel(); |
|
144 |
controlsPanel.setSize(700,455); |
|
129 |
public SearchUpperPanel getUpperPanel() { |
|
130 |
if (upperPanel == null){ |
|
131 |
upperPanel = new SearchUpperPanel(); |
|
132 |
|
|
145 | 133 |
} |
146 |
return controlsPanel; |
|
134 |
return upperPanel; |
|
135 |
|
|
147 | 136 |
} |
148 |
|
|
149 | 137 |
/** |
150 |
* It gets the checkBoxPanel
|
|
138 |
* It Gets the lowePanel
|
|
151 | 139 |
* @return |
152 | 140 |
*/ |
153 |
public JPanel getCheckBoxPanel(){ |
|
154 |
if (checkBoxPanel == null) { |
|
155 |
checkBoxPanel = new JPanel(); |
|
156 |
checkBoxPanel.add(getAreaCheckBox()); |
|
157 |
} |
|
158 |
return checkBoxPanel; |
|
141 |
|
|
142 |
public SearchLowerPanel getLowerPanel() { |
|
143 |
if (!(isMinimized)){ |
|
144 |
parent.setSize(625,450); |
|
145 |
if (lowerPanel == null){ |
|
146 |
lowerPanel = new SearchLowerPanel(); |
|
147 |
upperPanel.setUpIcon(); |
|
148 |
} |
|
149 |
} |
|
150 |
return lowerPanel; |
|
159 | 151 |
} |
160 | 152 |
|
161 |
/** |
|
153 |
/**
|
|
162 | 154 |
* It gets the buttons panel |
163 | 155 |
* @return |
164 | 156 |
*/ |
... | ... | |
167 | 159 |
buttonsPanel = new JPanel(new FlowLayout()); |
168 | 160 |
buttonsPanel.add(getSearchButton()); |
169 | 161 |
buttonsPanel.add(getCloseButton()); |
170 |
buttonsPanel.add(getSizeButton()); |
|
171 | 162 |
} |
172 | 163 |
return buttonsPanel; |
173 | 164 |
} |
... | ... | |
206 | 197 |
*/ |
207 | 198 |
public JButton getSizeButton() { |
208 | 199 |
if (sizeButton == null) { |
209 |
sizeButton = new JButton("Avanzada"); |
|
210 |
if (!(isMinimized)) |
|
211 |
sizeButton.setText("Simple"); |
|
212 |
sizeButton.setSize(new Dimension(30, 20)); |
|
200 |
sizeButton = upperPanel.getSizeButton(); |
|
213 | 201 |
sizeButton.setActionCommand("Size"); |
214 | 202 |
} |
215 | 203 |
return sizeButton; |
... | ... | |
221 | 209 |
*/ |
222 | 210 |
public JCheckBox getAreaCheckBox(){ |
223 | 211 |
if (areaCheckBox == null){ |
224 |
areaCheckBox = new JCheckBox("Restringir el area de B?squeda");
|
|
212 |
areaCheckBox = upperPanel.getCoordinatesCheckBox();
|
|
225 | 213 |
areaCheckBox.setActionCommand("areaCheckButton"); |
226 | 214 |
} |
227 | 215 |
return areaCheckBox; |
... | ... | |
235 | 223 |
getSearchButton().addActionListener(this); |
236 | 224 |
getCloseButton().addActionListener(this); |
237 | 225 |
getSizeButton().addActionListener(this); |
238 |
if (isMinimized){ |
|
239 |
getAreaCheckBox().addItemListener(this); |
|
240 |
|
|
241 |
} |
|
242 |
|
|
243 |
} |
|
226 |
getAreaCheckBox().addItemListener(this); |
|
227 |
} |
|
244 | 228 |
|
245 | 229 |
/* (non-Javadoc) |
246 | 230 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) |
... | ... | |
255 | 239 |
} |
256 | 240 |
if (e.getActionCommand() == "Size") { |
257 | 241 |
sizeButtonActionPerformed(); |
258 |
}
|
|
242 |
} |
|
259 | 243 |
|
260 | 244 |
} |
261 | 245 |
|
262 | 246 |
protected void sizeButtonActionPerformed(){ |
263 | 247 |
parent.setVisible(false); |
264 |
SearchDialog panel = new SearchDialog(client,!(isMinimized),controlsPanel.getTitle());
|
|
248 |
new SearchDialog(client,!(isMinimized),upperPanel.getTitle());
|
|
265 | 249 |
} |
266 | 250 |
|
267 | 251 |
protected void searchButtonActionPerformed(){ |
... | ... | |
282 | 266 |
* @return |
283 | 267 |
*/ |
284 | 268 |
public Query doQuery() { |
285 |
Query query = new Query(controlsPanel.getTitle(), |
|
286 |
controlsPanel.getTitleOption(), controlsPanel.getAbstract(), |
|
287 |
controlsPanel.getKeys(), controlsPanel.getCathegory(), |
|
288 |
controlsPanel.getScale(), controlsPanel.getProvider(), |
|
289 |
controlsPanel.getDateFrom(), controlsPanel.getDateTo(), |
|
290 |
controlsPanel.getCoordinates(), controlsPanel.getCoordinatesOption()); |
|
269 |
Query query = null; |
|
270 |
if (isMinimized){ |
|
271 |
query = new Query(upperPanel.getTitle(), |
|
272 |
"E", null, |
|
273 |
null , null, |
|
274 |
null , null, |
|
275 |
null , null, |
|
276 |
null , null); |
|
277 |
|
|
278 |
}else{ |
|
279 |
query = new Query(upperPanel.getTitle(), |
|
280 |
lowerPanel.getTitleOption(), lowerPanel.getAbstract(), |
|
281 |
lowerPanel.getKeys(), lowerPanel.getCathegory(), |
|
282 |
lowerPanel.getScale(), lowerPanel.getProvider(), |
|
283 |
lowerPanel.getDateFrom(), lowerPanel.getDateTo(), |
|
284 |
lowerPanel.getCoordinates(), lowerPanel.getCoordinatesOption()); |
|
285 |
} |
|
291 | 286 |
query.setMinimized(isMinimized); |
292 | 287 |
return query; |
293 | 288 |
} |
... | ... | |
327 | 322 |
public void itemStateChanged(ItemEvent e) { |
328 | 323 |
|
329 | 324 |
|
330 |
} |
|
325 |
}
|
|
331 | 326 |
|
332 | 327 |
/** |
333 |
* It sets the title field into the form
|
|
334 |
* @param Title
|
|
328 |
* It sets the title field |
|
329 |
* @param title
|
|
335 | 330 |
*/ |
331 |
|
|
336 | 332 |
public void setTitle(String title){ |
337 |
controlsPanel.setTitle(title);
|
|
333 |
upperPanel.setTitle(title);
|
|
338 | 334 |
} |
339 |
|
|
340 |
|
|
335 |
|
|
341 | 336 |
/** |
342 | 337 |
* @param isMinimized The isMinimized to set. |
343 | 338 |
*/ |
... | ... | |
357 | 352 |
public void setCurrentServer(String currentServer) { |
358 | 353 |
this.currentServer = currentServer; |
359 | 354 |
} |
355 |
/** |
|
356 |
* @param parent The parent to set. |
|
357 |
*/ |
|
358 |
public void setParent(JFrame parent) { |
|
359 |
this.parent = parent; |
|
360 |
} |
|
361 |
/** |
|
362 |
* Sets the CatalogClient |
|
363 |
* @param client |
|
364 |
* CatalogClient |
|
365 |
*/ |
|
366 |
public void setCatalogClient(CatalogClient client) { |
|
367 |
this.client = client; |
|
368 |
} |
|
360 | 369 |
} |
Also available in: Unified diff