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