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