svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / layout / gui / dialogs / FBorderDialog.java @ 9532
History | View | Annotate | Download (21.1 KB)
1 |
/*
|
---|---|
2 |
* Created on 28-jul-2004
|
3 |
*
|
4 |
*/
|
5 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
6 |
*
|
7 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
8 |
*
|
9 |
* This program is free software; you can redistribute it and/or
|
10 |
* modify it under the terms of the GNU General Public License
|
11 |
* as published by the Free Software Foundation; either version 2
|
12 |
* of the License, or (at your option) any later version.
|
13 |
*
|
14 |
* This program is distributed in the hope that it will be useful,
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
* GNU General Public License for more details.
|
18 |
*
|
19 |
* You should have received a copy of the GNU General Public License
|
20 |
* along with this program; if not, write to the Free Software
|
21 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
22 |
*
|
23 |
* For more information, contact:
|
24 |
*
|
25 |
* Generalitat Valenciana
|
26 |
* Conselleria d'Infraestructures i Transport
|
27 |
* Av. Blasco Ib??ez, 50
|
28 |
* 46010 VALENCIA
|
29 |
* SPAIN
|
30 |
*
|
31 |
* +34 963862235
|
32 |
* gvsig@gva.es
|
33 |
* www.gvsig.gva.es
|
34 |
*
|
35 |
* or
|
36 |
*
|
37 |
* IVER T.I. S.A
|
38 |
* Salamanca 50
|
39 |
* 46005 Valencia
|
40 |
* Spain
|
41 |
*
|
42 |
* +34 963163400
|
43 |
* dac@iver.es
|
44 |
*/
|
45 |
package com.iver.cit.gvsig.project.documents.layout.gui.dialogs; |
46 |
|
47 |
import java.awt.Color; |
48 |
import java.awt.geom.AffineTransform; |
49 |
import java.awt.geom.Point2D; |
50 |
import java.awt.geom.Rectangle2D; |
51 |
|
52 |
import javax.swing.ButtonGroup; |
53 |
import javax.swing.JPanel; |
54 |
|
55 |
import com.iver.andami.PluginServices; |
56 |
import com.iver.andami.ui.mdiManager.IWindow; |
57 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
58 |
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.FFrameGraphicsDialog; |
59 |
import com.iver.cit.gvsig.fmap.core.adapter.GeometryAdapter; |
60 |
import com.iver.cit.gvsig.fmap.core.adapter.RectangleAdapter; |
61 |
import com.iver.cit.gvsig.project.documents.layout.FLayoutGraphics; |
62 |
import com.iver.cit.gvsig.project.documents.layout.LayoutControl; |
63 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGraphics; |
64 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGraphicsFactory; |
65 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FrameFactory; |
66 |
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame; |
67 |
import com.iver.cit.gvsig.project.documents.layout.gui.Layout; |
68 |
|
69 |
|
70 |
/**
|
71 |
* Di?logo con todas las opciones para crear un borde a los fframes.
|
72 |
*
|
73 |
* @author Vicente Caballero Navarro
|
74 |
*/
|
75 |
public class FBorderDialog extends JPanel implements IWindow { |
76 |
private javax.swing.JRadioButton rbSeleccionados = null; |
77 |
private javax.swing.JRadioButton rbTodos = null; |
78 |
private javax.swing.JRadioButton rbMargen = null; |
79 |
private javax.swing.JCheckBox chbAgrupar = null; |
80 |
private javax.swing.JPanel pPosicion = null; |
81 |
private javax.swing.JCheckBox chbIgualLados = null; |
82 |
private javax.swing.JLabel lunidades = null; |
83 |
private javax.swing.JTextField tTodosLados = null; |
84 |
private javax.swing.JLabel lSuperior = null; |
85 |
private javax.swing.JLabel lInferior = null; |
86 |
private javax.swing.JTextField tSuperior = null; |
87 |
private javax.swing.JTextField tInferior = null; |
88 |
private javax.swing.JLabel lIzquierda = null; |
89 |
private javax.swing.JLabel lDerecha = null; |
90 |
private javax.swing.JTextField tIzquierda = null; |
91 |
private javax.swing.JTextField tDerecha = null; |
92 |
private javax.swing.JLabel lUnidades = null; |
93 |
private javax.swing.JButton bAceptar = null; |
94 |
private javax.swing.JButton bCancelar = null; |
95 |
private Layout layout = null; |
96 |
private IFFrame[] selecList;// = new ArrayList(); |
97 |
private FFrameGraphics fframegraphics = null; |
98 |
private FLayoutGraphics flg = null; |
99 |
private String m_NameUnit = null; |
100 |
private javax.swing.JButton bConfigurar = null; |
101 |
GeometryAdapter geometry=new RectangleAdapter();
|
102 |
private boolean isAccepted=false; |
103 |
|
104 |
/**
|
105 |
* This is the default constructor
|
106 |
*
|
107 |
* @param l Referencia al Layout.
|
108 |
*/
|
109 |
public FBorderDialog(Layout l) {
|
110 |
super();
|
111 |
layout = l; |
112 |
flg = new FLayoutGraphics(layout);
|
113 |
fframegraphics =(FFrameGraphics)FrameFactory.createFrameFromName(FFrameGraphicsFactory.registerName); |
114 |
|
115 |
fframegraphics.setLayout(layout); |
116 |
|
117 |
fframegraphics.setColor(Color.black);
|
118 |
fframegraphics.update(FFrameGraphics.RECTANGLE, layout.getLayoutControl().getAT()); |
119 |
|
120 |
|
121 |
initialize(); |
122 |
startFFrameGraphic(); |
123 |
} |
124 |
private void startFFrameGraphic() { |
125 |
IFFrame[] fframes=layout.getLayoutContext().getFFrames();
|
126 |
double x = Double.parseDouble(getTIzquierda().getText() |
127 |
.toString()); |
128 |
double y = Double.parseDouble(getTSuperior().getText() |
129 |
.toString()); |
130 |
double w = Double.parseDouble(getTDerecha().getText() |
131 |
.toString()); |
132 |
double h = Double.parseDouble(getTInferior().getText() |
133 |
.toString()); |
134 |
|
135 |
Rectangle2D re = new Rectangle2D.Double(); |
136 |
|
137 |
if (getRbSeleccionados().isSelected()) {
|
138 |
if (selecList.length > 0) { |
139 |
re=getRectangle(selecList[0]);
|
140 |
|
141 |
} |
142 |
|
143 |
for (int i = 1; i < selecList.length; i++) { |
144 |
Rectangle2D rectaux = getRectangle(selecList[i]);
|
145 |
re.add(rectaux); |
146 |
} |
147 |
|
148 |
// crear un Rect?ngulo alrededor de los fframes seleccionados.
|
149 |
} else if (getRbTodos().isSelected()) { |
150 |
if (fframes.length > 0) { |
151 |
re=getRectangle(fframes[0]);
|
152 |
} |
153 |
|
154 |
for (int i = 1; i < fframes.length; |
155 |
i++) { |
156 |
Rectangle2D rectaux = getRectangle(fframes[i]);
|
157 |
re.add(rectaux); |
158 |
} |
159 |
|
160 |
// creaer un Rect?ngulo que incluya a todos los fframes.
|
161 |
} else if (getRbMargen().isSelected()) { |
162 |
// creaer un Rect?ngulo en los m?rgenes del Layout.
|
163 |
re.setRect(layout.getLayoutContext().getAtributes().getArea()); |
164 |
} |
165 |
|
166 |
re.setRect(re.getX() - x, re.getY() - y, re.getWidth() + x + w, |
167 |
re.getHeight() + y + h); |
168 |
|
169 |
geometry=new RectangleAdapter();
|
170 |
geometry.addPoint(new Point2D.Double(re.getX(),re.getY())); |
171 |
geometry.addPoint(new Point2D.Double(re.getMaxX(),re.getMaxY())); |
172 |
geometry.end(); |
173 |
fframegraphics.setGeometryAdapter(geometry); |
174 |
} |
175 |
/**
|
176 |
* This method initializes this
|
177 |
*/
|
178 |
private void initialize() { |
179 |
selecList=layout.getLayoutContext().getFFrameSelected(); |
180 |
this.setLayout(null); |
181 |
m_NameUnit = layout.getLayoutContext().getAtributes().getNameUnit(); |
182 |
this.add(getRbSeleccionados(), null); |
183 |
this.add(getRbTodos(), null); |
184 |
this.add(getRbMargen(), null); |
185 |
this.add(getChbAgrupar(), null); |
186 |
this.add(getPPosicion(), null); |
187 |
this.add(getBAceptar(), null); |
188 |
this.add(getBCancelar(), null); |
189 |
this.add(getBConfigurar(), null); |
190 |
this.setSize(371, 223); |
191 |
|
192 |
ButtonGroup group = new ButtonGroup(); |
193 |
group.add(getRbSeleccionados()); |
194 |
group.add(getRbTodos()); |
195 |
group.add(getRbMargen()); |
196 |
} |
197 |
|
198 |
/**
|
199 |
* This method initializes rbSeleccionados
|
200 |
*
|
201 |
* @return javax.swing.JRadioButton
|
202 |
*/
|
203 |
private javax.swing.JRadioButton getRbSeleccionados() {
|
204 |
if (rbSeleccionados == null) { |
205 |
rbSeleccionados = new javax.swing.JRadioButton();
|
206 |
rbSeleccionados.setBounds(10, 8, 416, 20); |
207 |
rbSeleccionados.setText(PluginServices.getText(this,
|
208 |
"colocar_alrededor_seleccionados"));
|
209 |
|
210 |
if (selecList.length == 0) { |
211 |
rbSeleccionados.setEnabled(false);
|
212 |
getRbTodos().setSelected(true);
|
213 |
} else {
|
214 |
rbSeleccionados.setSelected(true);
|
215 |
} |
216 |
} |
217 |
|
218 |
return rbSeleccionados;
|
219 |
} |
220 |
|
221 |
/**
|
222 |
* This method initializes rbTodos
|
223 |
*
|
224 |
* @return javax.swing.JRadioButton
|
225 |
*/
|
226 |
private javax.swing.JRadioButton getRbTodos() {
|
227 |
if (rbTodos == null) { |
228 |
rbTodos = new javax.swing.JRadioButton();
|
229 |
rbTodos.setBounds(10, 29, 332, 20); |
230 |
rbTodos.setText(PluginServices.getText(this,
|
231 |
"colocar_alrededor_todos"));
|
232 |
} |
233 |
|
234 |
return rbTodos;
|
235 |
} |
236 |
|
237 |
/**
|
238 |
* This method initializes rbMargen
|
239 |
*
|
240 |
* @return javax.swing.JRadioButton
|
241 |
*/
|
242 |
private javax.swing.JRadioButton getRbMargen() {
|
243 |
if (rbMargen == null) { |
244 |
rbMargen = new javax.swing.JRadioButton();
|
245 |
rbMargen.setBounds(10, 51, 286, 20); |
246 |
rbMargen.setText(PluginServices.getText(this, "colocar_a_margenes")); |
247 |
} |
248 |
|
249 |
return rbMargen;
|
250 |
} |
251 |
|
252 |
/**
|
253 |
* This method initializes chbAgrupar
|
254 |
*
|
255 |
* @return javax.swing.JCheckBox
|
256 |
*/
|
257 |
private javax.swing.JCheckBox getChbAgrupar() {
|
258 |
if (chbAgrupar == null) { |
259 |
chbAgrupar = new javax.swing.JCheckBox();
|
260 |
chbAgrupar.setBounds(10, 70, 280, 20); |
261 |
chbAgrupar.setText(PluginServices.getText(this, "agrupar_linea")); |
262 |
} |
263 |
|
264 |
return chbAgrupar;
|
265 |
} |
266 |
|
267 |
/**
|
268 |
* This method initializes pPosicion
|
269 |
*
|
270 |
* @return javax.swing.JPanel
|
271 |
*/
|
272 |
private javax.swing.JPanel getPPosicion() {
|
273 |
if (pPosicion == null) { |
274 |
pPosicion = new javax.swing.JPanel();
|
275 |
pPosicion.setLayout(null);
|
276 |
pPosicion.add(getChbIgualLados(), null);
|
277 |
pPosicion.add(getLunidades(), null);
|
278 |
pPosicion.add(getTTodosLados(), null);
|
279 |
pPosicion.add(getLSuperior(), null);
|
280 |
pPosicion.add(getLInferior(), null);
|
281 |
pPosicion.add(getTSuperior(), null);
|
282 |
pPosicion.add(getTInferior(), null);
|
283 |
pPosicion.add(getLIzquierda(), null);
|
284 |
pPosicion.add(getLDerecha(), null);
|
285 |
pPosicion.add(getTIzquierda(), null);
|
286 |
pPosicion.add(getTDerecha(), null);
|
287 |
pPosicion.add(getLUnidades(), null);
|
288 |
pPosicion.setBounds(12, 92, 350, 97); |
289 |
pPosicion.setBorder(javax.swing.BorderFactory.createTitledBorder( |
290 |
null, PluginServices.getText(this, "posicion_linea"), |
291 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
292 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
293 |
} |
294 |
|
295 |
return pPosicion;
|
296 |
} |
297 |
|
298 |
/**
|
299 |
* This method initializes chbIgualLados
|
300 |
*
|
301 |
* @return javax.swing.JCheckBox
|
302 |
*/
|
303 |
private javax.swing.JCheckBox getChbIgualLados() {
|
304 |
if (chbIgualLados == null) { |
305 |
chbIgualLados = new javax.swing.JCheckBox();
|
306 |
chbIgualLados.setBounds(10, 16, 243, 21); |
307 |
chbIgualLados.setText(PluginServices.getText(this,
|
308 |
"igual_todos_lados"));
|
309 |
chbIgualLados.setSelected(true);
|
310 |
chbIgualLados.addActionListener(new java.awt.event.ActionListener() {
|
311 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
312 |
if (!chbIgualLados.isSelected()) {
|
313 |
getTTodosLados().setEnabled(false);
|
314 |
getTSuperior().setEnabled(true);
|
315 |
getTInferior().setEnabled(true);
|
316 |
getTIzquierda().setEnabled(true);
|
317 |
getTDerecha().setEnabled(true);
|
318 |
} else {
|
319 |
getTTodosLados().setEnabled(true);
|
320 |
getTSuperior().setEnabled(false);
|
321 |
getTInferior().setEnabled(false);
|
322 |
getTIzquierda().setEnabled(false);
|
323 |
getTDerecha().setEnabled(false);
|
324 |
getTSuperior().setText(tTodosLados.getText()); |
325 |
getTInferior().setText(tTodosLados.getText()); |
326 |
getTIzquierda().setText(tTodosLados.getText()); |
327 |
getTDerecha().setText(tTodosLados.getText()); |
328 |
} |
329 |
} |
330 |
}); |
331 |
} |
332 |
|
333 |
return chbIgualLados;
|
334 |
} |
335 |
|
336 |
/**
|
337 |
* This method initializes lunidades
|
338 |
*
|
339 |
* @return javax.swing.JLabel
|
340 |
*/
|
341 |
private javax.swing.JLabel getLunidades() {
|
342 |
if (lunidades == null) { |
343 |
lunidades = new javax.swing.JLabel();
|
344 |
lunidades.setBounds(264, 64, 78, 18); |
345 |
lunidades.setText(PluginServices.getText(this,m_NameUnit));
|
346 |
} |
347 |
|
348 |
return lunidades;
|
349 |
} |
350 |
|
351 |
/**
|
352 |
* This method initializes tTodosLados
|
353 |
*
|
354 |
* @return javax.swing.JTextField
|
355 |
*/
|
356 |
private javax.swing.JTextField getTTodosLados() {
|
357 |
if (tTodosLados == null) { |
358 |
tTodosLados = new javax.swing.JTextField();
|
359 |
tTodosLados.setBounds(267, 19, 48, 16); |
360 |
tTodosLados.setText("0.5");
|
361 |
tTodosLados.addCaretListener(new javax.swing.event.CaretListener() {
|
362 |
public void caretUpdate(javax.swing.event.CaretEvent e) { |
363 |
if (getChbIgualLados().isSelected()) {
|
364 |
getTSuperior().setText(tTodosLados.getText()); |
365 |
getTInferior().setText(tTodosLados.getText()); |
366 |
getTIzquierda().setText(tTodosLados.getText()); |
367 |
getTDerecha().setText(tTodosLados.getText()); |
368 |
} |
369 |
} |
370 |
}); |
371 |
} |
372 |
|
373 |
return tTodosLados;
|
374 |
} |
375 |
|
376 |
/**
|
377 |
* This method initializes lSuperior
|
378 |
*
|
379 |
* @return javax.swing.JLabel
|
380 |
*/
|
381 |
private javax.swing.JLabel getLSuperior() {
|
382 |
if (lSuperior == null) { |
383 |
lSuperior = new javax.swing.JLabel();
|
384 |
lSuperior.setBounds(10, 55, 62, 16); |
385 |
lSuperior.setText(PluginServices.getText(this, "Superior")); |
386 |
} |
387 |
|
388 |
return lSuperior;
|
389 |
} |
390 |
|
391 |
/**
|
392 |
* This method initializes lInferior
|
393 |
*
|
394 |
* @return javax.swing.JLabel
|
395 |
*/
|
396 |
private javax.swing.JLabel getLInferior() {
|
397 |
if (lInferior == null) { |
398 |
lInferior = new javax.swing.JLabel();
|
399 |
lInferior.setBounds(10, 72, 62, 16); |
400 |
lInferior.setText(PluginServices.getText(this, "Inferior")); |
401 |
} |
402 |
|
403 |
return lInferior;
|
404 |
} |
405 |
|
406 |
/**
|
407 |
* This method initializes tSuperior
|
408 |
*
|
409 |
* @return javax.swing.JTextField
|
410 |
*/
|
411 |
private javax.swing.JTextField getTSuperior() {
|
412 |
if (tSuperior == null) { |
413 |
tSuperior = new javax.swing.JTextField();
|
414 |
tSuperior.setBounds(78, 55, 48, 16); |
415 |
tSuperior.setText("0.5");
|
416 |
tSuperior.setEnabled(false);
|
417 |
} |
418 |
|
419 |
return tSuperior;
|
420 |
} |
421 |
|
422 |
/**
|
423 |
* This method initializes tInferior
|
424 |
*
|
425 |
* @return javax.swing.JTextField
|
426 |
*/
|
427 |
private javax.swing.JTextField getTInferior() {
|
428 |
if (tInferior == null) { |
429 |
tInferior = new javax.swing.JTextField();
|
430 |
tInferior.setBounds(78, 72, 48, 16); |
431 |
tInferior.setText("0.5");
|
432 |
tInferior.setEnabled(false);
|
433 |
} |
434 |
|
435 |
return tInferior;
|
436 |
} |
437 |
|
438 |
/**
|
439 |
* This method initializes lIzquierda
|
440 |
*
|
441 |
* @return javax.swing.JLabel
|
442 |
*/
|
443 |
private javax.swing.JLabel getLIzquierda() {
|
444 |
if (lIzquierda == null) { |
445 |
lIzquierda = new javax.swing.JLabel();
|
446 |
lIzquierda.setBounds(140, 55, 62, 16); |
447 |
lIzquierda.setText(PluginServices.getText(this, "Izquierda")); |
448 |
} |
449 |
|
450 |
return lIzquierda;
|
451 |
} |
452 |
|
453 |
/**
|
454 |
* This method initializes lDerecha
|
455 |
*
|
456 |
* @return javax.swing.JLabel
|
457 |
*/
|
458 |
private javax.swing.JLabel getLDerecha() {
|
459 |
if (lDerecha == null) { |
460 |
lDerecha = new javax.swing.JLabel();
|
461 |
lDerecha.setBounds(140, 72, 62, 16); |
462 |
lDerecha.setText(PluginServices.getText(this, "Derecha")); |
463 |
} |
464 |
|
465 |
return lDerecha;
|
466 |
} |
467 |
|
468 |
/**
|
469 |
* This method initializes tIzquierda
|
470 |
*
|
471 |
* @return javax.swing.JTextField
|
472 |
*/
|
473 |
private javax.swing.JTextField getTIzquierda() {
|
474 |
if (tIzquierda == null) { |
475 |
tIzquierda = new javax.swing.JTextField();
|
476 |
tIzquierda.setBounds(207, 55, 48, 16); |
477 |
tIzquierda.setText("0.5");
|
478 |
tIzquierda.setEnabled(false);
|
479 |
} |
480 |
|
481 |
return tIzquierda;
|
482 |
} |
483 |
|
484 |
/**
|
485 |
* This method initializes tDerecha
|
486 |
*
|
487 |
* @return javax.swing.JTextField
|
488 |
*/
|
489 |
private javax.swing.JTextField getTDerecha() {
|
490 |
if (tDerecha == null) { |
491 |
tDerecha = new javax.swing.JTextField();
|
492 |
tDerecha.setBounds(207, 72, 48, 16); |
493 |
tDerecha.setText("0.5");
|
494 |
tDerecha.setEnabled(false);
|
495 |
} |
496 |
|
497 |
return tDerecha;
|
498 |
} |
499 |
|
500 |
/**
|
501 |
* This method initializes lUnidades
|
502 |
*
|
503 |
* @return javax.swing.JLabel
|
504 |
*/
|
505 |
private javax.swing.JLabel getLUnidades() {
|
506 |
if (lUnidades == null) { |
507 |
lUnidades = new javax.swing.JLabel();
|
508 |
lUnidades.setBounds(207, 36, 134, 18); |
509 |
lUnidades.setText(PluginServices.getText(this, "map_units")); |
510 |
} |
511 |
|
512 |
return lUnidades;
|
513 |
} |
514 |
|
515 |
/**
|
516 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
|
517 |
*/
|
518 |
public WindowInfo getWindowInfo() {
|
519 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
520 |
m_viewinfo.setTitle(PluginServices.getText(this, "ajustes_linea_grafica")); |
521 |
|
522 |
return m_viewinfo;
|
523 |
} |
524 |
|
525 |
/**
|
526 |
* This method initializes bAceptar
|
527 |
*
|
528 |
* @return javax.swing.JButton
|
529 |
*/
|
530 |
private javax.swing.JButton getBAceptar() {
|
531 |
if (bAceptar == null) { |
532 |
bAceptar = new javax.swing.JButton();
|
533 |
bAceptar.setBounds(134, 193, 100, 20); |
534 |
bAceptar.setText(PluginServices.getText(this, "Aceptar")); |
535 |
bAceptar.addActionListener(new java.awt.event.ActionListener() {
|
536 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
537 |
IFFrame[] fframes=layout.getLayoutContext().getFFrames();
|
538 |
double x = Double.parseDouble(getTIzquierda().getText() |
539 |
.toString()); |
540 |
double y = Double.parseDouble(getTSuperior().getText() |
541 |
.toString()); |
542 |
double w = Double.parseDouble(getTDerecha().getText() |
543 |
.toString()); |
544 |
double h = Double.parseDouble(getTInferior().getText() |
545 |
.toString()); |
546 |
|
547 |
if (!getChbAgrupar().isSelected()) {
|
548 |
Rectangle2D re = new Rectangle2D.Double(); |
549 |
|
550 |
if (getRbSeleccionados().isSelected()) {
|
551 |
if (selecList.length > 0) { |
552 |
re=getRectangle(selecList[0]);
|
553 |
|
554 |
} |
555 |
|
556 |
for (int i = 1; i < selecList.length; i++) { |
557 |
Rectangle2D rectaux = getRectangle(selecList[i]);
|
558 |
re.add(rectaux); |
559 |
} |
560 |
|
561 |
// crear un Rect?ngulo alrededor de los fframes seleccionados.
|
562 |
} else if (getRbTodos().isSelected()) { |
563 |
if (fframes.length > 0) { |
564 |
re=getRectangle(fframes[0]);
|
565 |
} |
566 |
|
567 |
for (int i = 1; i < fframes.length; |
568 |
i++) { |
569 |
Rectangle2D rectaux = getRectangle(fframes[i]);
|
570 |
re.add(rectaux); |
571 |
} |
572 |
|
573 |
// creaer un Rect?ngulo que incluya a todos los fframes.
|
574 |
} else if (getRbMargen().isSelected()) { |
575 |
// creaer un Rect?ngulo en los m?rgenes del Layout.
|
576 |
re.setRect(layout.getLayoutContext().getAtributes().getArea()); |
577 |
} |
578 |
|
579 |
re.setRect(re.getX() - x, re.getY() - y, re.getWidth() + x + w, |
580 |
re.getHeight() + y + h); |
581 |
|
582 |
geometry=new RectangleAdapter();
|
583 |
geometry.addPoint(new Point2D.Double(re.getX(),re.getY())); |
584 |
geometry.addPoint(new Point2D.Double(re.getMaxX(),re.getMaxY())); |
585 |
geometry.end(); |
586 |
fframegraphics.setGeometryAdapter(geometry); |
587 |
fframegraphics.setBoundBox(re); |
588 |
layout.getLayoutContext().addFFrame(fframegraphics, true,true); |
589 |
} else { //Agrupar |
590 |
|
591 |
Rectangle2D re = new Rectangle2D.Double(); |
592 |
if (getRbSeleccionados().isSelected()) {
|
593 |
if (selecList.length > 0) { |
594 |
re=getRectangle(selecList[0]);
|
595 |
} |
596 |
|
597 |
for (int i = 1; i < selecList.length; i++) { |
598 |
Rectangle2D rectaux = getRectangle(selecList[i]);
|
599 |
re.add(rectaux); |
600 |
} |
601 |
|
602 |
// crear un Rect?ngulo alrededor de los fframes seleccionados.
|
603 |
} else if (getRbTodos().isSelected()) { |
604 |
if (fframes.length > 0) { |
605 |
re=getRectangle(fframes[0]);
|
606 |
} |
607 |
|
608 |
for (int i = 1; i < fframes.length; |
609 |
i++) { |
610 |
Rectangle2D rectaux = getRectangle(fframes[i]);
|
611 |
fframes[i].setSelected(true);
|
612 |
re.add(rectaux); |
613 |
} |
614 |
|
615 |
// creaer un Rect?ngulo que incluya a todos los fframes.
|
616 |
} else if (getRbMargen().isSelected()) { |
617 |
// creaer un Rect?ngulo en los m?rgenes del Layout.
|
618 |
re.setRect(layout.getLayoutContext().getAtributes().getArea()); |
619 |
} |
620 |
|
621 |
re.setRect(re.getX() - x, re.getY() - y, re.getWidth() + x + w, |
622 |
re.getHeight() + y + h); |
623 |
|
624 |
geometry=new RectangleAdapter();
|
625 |
geometry.addPoint(new Point2D.Double(re.getX(),re.getY())); |
626 |
geometry.addPoint(new Point2D.Double(re.getMaxX(),re.getMaxY())); |
627 |
geometry.end(); |
628 |
fframegraphics.setGeometryAdapter(geometry); |
629 |
fframegraphics.setBoundBox(re); |
630 |
|
631 |
layout.getLayoutContext().getEFS().startComplexCommand(); |
632 |
layout.getLayoutContext().addFFrame(fframegraphics, false,true); |
633 |
flg.grouping(); |
634 |
layout.getLayoutContext().getEFS().endComplexCommand(PluginServices.getText(this,"group_graphic_line")); |
635 |
|
636 |
} |
637 |
|
638 |
PluginServices.getMDIManager().closeWindow(FBorderDialog.this); |
639 |
layout.getLayoutControl().setStatus(LayoutControl.DESACTUALIZADO); |
640 |
layout.getLayoutControl().repaint(); |
641 |
isAccepted=true;
|
642 |
} |
643 |
}); |
644 |
} |
645 |
|
646 |
return bAceptar;
|
647 |
} |
648 |
|
649 |
/**
|
650 |
* This method initializes bCancelar
|
651 |
*
|
652 |
* @return javax.swing.JButton
|
653 |
*/
|
654 |
private javax.swing.JButton getBCancelar() {
|
655 |
if (bCancelar == null) { |
656 |
bCancelar = new javax.swing.JButton();
|
657 |
bCancelar.setBounds(251, 193, 100, 20); |
658 |
bCancelar.setText(PluginServices.getText(this, "Cancelar")); |
659 |
bCancelar.addActionListener(new java.awt.event.ActionListener() {
|
660 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
661 |
PluginServices.getMDIManager().closeWindow(FBorderDialog.this); |
662 |
isAccepted=false;
|
663 |
} |
664 |
}); |
665 |
} |
666 |
|
667 |
return bCancelar;
|
668 |
} |
669 |
|
670 |
/**
|
671 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
672 |
*/
|
673 |
public void viewActivated() { |
674 |
} |
675 |
|
676 |
/**
|
677 |
* This method initializes bConfigurar
|
678 |
*
|
679 |
* @return javax.swing.JButton
|
680 |
*/
|
681 |
private javax.swing.JButton getBConfigurar() {
|
682 |
if (bConfigurar == null) { |
683 |
bConfigurar = new javax.swing.JButton();
|
684 |
bConfigurar.setBounds(17, 193, 100, 20); |
685 |
bConfigurar.setText(PluginServices.getText(this, "configurar")); |
686 |
bConfigurar.addActionListener(new java.awt.event.ActionListener() {
|
687 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
688 |
FFrameGraphicsDialog graphicsdialog = new FFrameGraphicsDialog(layout,
|
689 |
fframegraphics); |
690 |
|
691 |
PluginServices.getMDIManager().addWindow(graphicsdialog); |
692 |
} |
693 |
}); |
694 |
} |
695 |
|
696 |
return bConfigurar;
|
697 |
} |
698 |
private Rectangle2D getRectangle(IFFrame f){ |
699 |
Rectangle2D.Double re= new Rectangle2D.Double(); |
700 |
re.setRect(f.getBoundBox()); |
701 |
Point2D p1=new Point2D.Double(); |
702 |
Point2D p2=new Point2D.Double(); |
703 |
Point2D p3=new Point2D.Double(); |
704 |
Point2D p4=new Point2D.Double(); |
705 |
double rotation=(f).getRotation();
|
706 |
AffineTransform at=new AffineTransform(); |
707 |
at.rotate(Math.toRadians(rotation), re.x + (re.width / 2), |
708 |
re.y + (re.height / 2));
|
709 |
at.transform(new Point2D.Double(re.getX(),re.getY()),p1); |
710 |
at.transform(new Point2D.Double(re.getMaxX(),re.getY()),p2); |
711 |
at.transform(new Point2D.Double(re.getMaxX(),re.getMaxY()),p3); |
712 |
at.transform(new Point2D.Double(re.getX(),re.getMaxY()),p4); |
713 |
if (p1.getX()<p4.getX()){
|
714 |
re.x=p1.getX(); |
715 |
}else{
|
716 |
re.x=p4.getX(); |
717 |
} |
718 |
if (p1.getY()<p2.getY()){
|
719 |
re.y=p1.getY(); |
720 |
}else{
|
721 |
re.y=p2.getY(); |
722 |
} |
723 |
if (p2.getX()>p3.getX()){
|
724 |
re.width=p2.getX()-re.x; |
725 |
}else{
|
726 |
re.width=p3.getX()-re.x; |
727 |
} |
728 |
if (p4.getY()>p3.getY()){
|
729 |
re.height=p4.getY()-re.y; |
730 |
}else{
|
731 |
re.height=p3.getY()-re.y; |
732 |
} |
733 |
return re;
|
734 |
} |
735 |
public boolean isAccepted() { |
736 |
return isAccepted;
|
737 |
} |
738 |
} |