Revision 10341 trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSAreaPanel.java
WFSAreaPanel.java | ||
---|---|---|
3 | 3 |
import java.awt.Color; |
4 | 4 |
import java.awt.Dimension; |
5 | 5 |
import java.awt.GridBagLayout; |
6 |
import java.awt.Point; |
|
6 | 7 |
import java.awt.Rectangle; |
7 | 8 |
import java.awt.event.ActionEvent; |
8 | 9 |
import java.awt.event.ActionListener; |
9 | 10 |
import java.awt.event.FocusAdapter; |
10 | 11 |
import java.awt.event.FocusEvent; |
11 | 12 |
import java.awt.event.FocusListener; |
13 |
import java.awt.event.ItemEvent; |
|
14 |
import java.awt.event.ItemListener; |
|
12 | 15 |
import java.awt.event.MouseAdapter; |
13 | 16 |
import java.awt.event.MouseEvent; |
14 | 17 |
import java.awt.event.MouseListener; |
18 |
import java.awt.event.MouseMotionListener; |
|
19 |
import java.awt.event.MouseWheelListener; |
|
15 | 20 |
import java.awt.geom.Rectangle2D; |
16 | 21 |
import java.io.Serializable; |
17 | 22 |
|
... | ... | |
22 | 27 |
import javax.swing.JPanel; |
23 | 28 |
import javax.swing.JRadioButton; |
24 | 29 |
import javax.swing.JTextField; |
30 |
import javax.swing.JToggleButton; |
|
25 | 31 |
import javax.swing.SwingConstants; |
26 | 32 |
|
27 | 33 |
import com.iver.andami.PluginServices; |
... | ... | |
44 | 50 |
import com.iver.cit.gvsig.fmap.tools.Behavior.PolylineBehavior; |
45 | 51 |
import com.iver.cit.gvsig.fmap.tools.Behavior.RectangleBehavior; |
46 | 52 |
import com.iver.cit.gvsig.gui.wizards.WFSWizardData; |
47 |
import com.iver.cit.gvsig.project.documents.ProjectDocument; |
|
53 |
//import com.iver.cit.gvsig.project.documents.ProjectDocument;
|
|
48 | 54 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
49 | 55 |
import com.iver.cit.gvsig.project.documents.view.toolListeners.AreaListener; |
50 | 56 |
import com.iver.cit.gvsig.project.documents.view.toolListeners.MeasureListener; |
... | ... | |
106 | 112 |
* |
107 | 113 |
* $Id$ |
108 | 114 |
* $Log$ |
109 |
* Revision 1.14 2007-02-12 11:29:37 ppiqueras |
|
115 |
* Revision 1.15 2007-02-15 11:36:57 ppiqueras |
|
116 |
* Mejorada la interfaz: nuevas herramientas, mejoradas las de coordenadas absolutas. Y corregido alg?n bug de interacci?n con otros paneles. |
|
117 |
* |
|
118 |
* Revision 1.14 2007/02/12 11:29:37 ppiqueras |
|
110 | 119 |
* Mejoras de la interfaz y uso de las herramientas |
111 | 120 |
* |
112 | 121 |
* Revision 1.13 2007/02/09 14:22:07 ppiqueras |
... | ... | |
166 | 175 |
private final Rectangle DEFAULT_AREA_MAPCONTROL_PANEL_RECTANGLE = new Rectangle(8, 115, 481, 265); |
167 | 176 |
|
168 | 177 |
// private final Rectangle DEFAULT_COORDINATES_CHECKBOX_RECTANGLE = new Rectangle(6, 19, 445, 20); |
169 |
private final Rectangle DEFAULT_ERASER_ICON_BUTTON_RECTANGLE = new Rectangle (250, 85, 25, 25); |
|
178 |
private final Rectangle DEFAULT_UNDO_ICON_BUTTON_RECTANGLE = new Rectangle (250, 85, 25, 25); |
|
179 |
private final Rectangle DEFAULT_REDO_ICON_BUTTON_RECTANGLE = new Rectangle (277, 85, 25, 25); |
|
180 |
private final Rectangle DEFAULT_MOVE_ICON_TOGGLE_BUTTON_RECTANGLE = new Rectangle (304, 85, 25, 25); |
|
181 |
private final Rectangle DEFAULT_SCALING_ICON_TOGGLE_BUTTON_RECTANGLE = new Rectangle (331, 85, 25, 25); |
|
170 | 182 |
private final Rectangle DEFAULT_PAN_ICON_BUTTON_RECTANGLE = new Rectangle(250, 85, 25, 25); |
171 | 183 |
private final Rectangle DEFAULT_TOOL_JCOMBOBOX_RECTANGLE = new Rectangle(10, 87, 230, 21); |
172 | 184 |
private final Rectangle DEFAULT_ZOOMINANDOUT_JCOMBOBOX_RECTANGLE = new Rectangle(277, 85, 47, 25); |
... | ... | |
192 | 204 |
private AreaCoordinatesPanel coordinatesPanel = null; |
193 | 205 |
private SelectableMapControlAreaPanel selectableMapAreaPanel = null; |
194 | 206 |
private JComboBox jComboBoxToolSelection = null; |
195 |
private JButton jButtonEraser = null; |
|
207 |
private JButton jButtonUndo = null; |
|
208 |
private JButton jButtonRedo = null; |
|
209 |
private JToggleButton jToggleButtonMove = null; |
|
210 |
private JToggleButton jToggleButtonScaling = null; |
|
196 | 211 |
private JButton jButtonPan = null; |
197 | 212 |
// private JButton jButtonZoomIn = null; |
198 | 213 |
// private JButton jButtonZoomOut = null; |
... | ... | |
207 | 222 |
private JComboBoxWithImageIconItems jComboBoxZoomInAndOutViewCentered = null; |
208 | 223 |
private JComboBoxWithImageIconItems jComboBoxOtherTools = null; |
209 | 224 |
|
225 |
// private Point last_V1; |
|
226 |
// private Point last_V2; |
|
227 |
|
|
210 | 228 |
/* Tool identifier constants */ |
211 | 229 |
private final String PAN_TOOL = "HAND"; |
212 | 230 |
// private final String ERASER_TOOL = "ERASER"; |
... | ... | |
245 | 263 |
|
246 | 264 |
// Adds JPanel with the coordinates |
247 | 265 |
this.add(getCoordinatesPanel(), null); |
248 |
|
|
266 |
|
|
249 | 267 |
// Adds JComboBox to select a part of the graphical interface |
250 | 268 |
this.add(getJComboBoxToolSelection(), null); |
251 | 269 |
this.getJComboBoxToolSelection().setSelectedIndex(0); // By default select first element |
... | ... | |
280 | 298 |
Rectangle2D r2d = activeView.getMapControl().getViewPort().getExtent(); |
281 | 299 |
if (r2d != null){ |
282 | 300 |
// getCoordinatesPanel().setExtent(r2d); |
283 |
getCoordinatesPanel().getJTextFieldVertex1X().setText(Double.toString(r2d.getMinX()));
|
|
284 |
getCoordinatesPanel().getJTextFieldVertex1Y().setText(Double.toString(r2d.getMinY()));
|
|
285 |
getCoordinatesPanel().getJTextFieldVertex2X().setText(Double.toString(r2d.getMaxX()));
|
|
286 |
getCoordinatesPanel().getJTextFieldVertex2Y().setText(Double.toString(r2d.getMaxY()));
|
|
301 |
getCoordinatesPanel().getJTextFieldVertex1X().setText(Double.toString(r2d.getMaxX()));
|
|
302 |
getCoordinatesPanel().getJTextFieldVertex1Y().setText(Double.toString(r2d.getMaxY()));
|
|
303 |
getCoordinatesPanel().getJTextFieldVertex2X().setText(Double.toString(r2d.getMinX()));
|
|
304 |
getCoordinatesPanel().getJTextFieldVertex2Y().setText(Double.toString(r2d.getMinY()));
|
|
287 | 305 |
} |
288 | 306 |
} |
289 |
|
|
307 |
|
|
290 | 308 |
/** |
291 | 309 |
* This method initializes coordinatesPanel |
292 | 310 |
* |
... | ... | |
325 | 343 |
case DISABLED_OPERATION: |
326 | 344 |
disableCoorderatesRegionOperation(); |
327 | 345 |
disableAreaRegionOperation(); |
328 |
// getJButtonInfo().setEnabled(false); |
|
329 | 346 |
break; |
330 | 347 |
case SELECTION_BY_COORDINATES_OPERATION: |
331 | 348 |
disableAreaRegionOperation(); |
332 | 349 |
enableCoorderatesRegionOperation(); |
333 |
// getJButtonInfo().setEnabled(true); |
|
334 | 350 |
break; |
335 | 351 |
case SELECTION_BY_AREA_OPERATION: |
336 |
disableCoorderatesRegionOperation(); |
|
337 |
enableAreaRegionOperation(); |
|
338 |
// getJButtonInfo().setEnabled(true); |
|
352 |
// Only enable the area operation if there is data loaded in this MapControl |
|
353 |
if (getSelectableMapAreaPanel().getMapContext().getLayers().getLayersCount() > 0) { |
|
354 |
disableCoorderatesRegionOperation(); |
|
355 |
enableAreaRegionOperation(); |
|
356 |
} |
|
357 |
else { |
|
358 |
JOptionPane.showMessageDialog(jComboBoxToolSelection, PluginServices.getText(null, "there_is_no_layer_loaded_in_the_active_view"), PluginServices.getText(null, "information"), JOptionPane.INFORMATION_MESSAGE); |
|
359 |
|
|
360 |
// Select: no tools |
|
361 |
jComboBoxToolSelection.setSelectedIndex(0); |
|
362 |
} |
|
363 |
|
|
339 | 364 |
break; |
340 | 365 |
} |
341 | 366 |
} |
... | ... | |
349 | 374 |
*/ |
350 | 375 |
private void enableCoorderatesRegionOperation() { |
351 | 376 |
// Adds associated icons |
352 |
this.add(getJButtonEraser(), null); |
|
377 |
this.add(getJButtonUndo(), null); |
|
378 |
this.add(getJButtonRedo(), null); |
|
379 |
this.add(getJToggleButtonMove(), null); |
|
380 |
this.add(getJToggleButtonScaling(), null); |
|
353 | 381 |
// this.add(getJButtonInfo(), null); |
354 | 382 |
|
355 | 383 |
getCoordinatesPanel().setAllTextFieldsEnabled(true); |
356 |
getCoordinatesPanel().getJRadioButtonGoToArea().setEnabled(true); |
|
384 |
getCoordinatesPanel().getJRadioButtonPreviewArea().setEnabled(true); |
|
385 |
|
|
386 |
// Force update this panel |
|
387 |
// this.invalidate(); |
|
357 | 388 |
} |
358 | 389 |
|
359 | 390 |
/** |
... | ... | |
365 | 396 |
// this.add(getJButtonZoomIn(), null); |
366 | 397 |
// this.add(getJButtonZoomOut(), null); |
367 | 398 |
this.add(getJComboBoxZoomInAndOut(), null); |
399 |
getJComboBoxZoomInAndOut().revalidate(); // Force update this component |
|
368 | 400 |
// this.add(getJButtonZoomRectangleSelection(), null); |
369 | 401 |
this.add(getJButtonZoomPrevious(), null); |
370 | 402 |
this.add(getJButtonZoomComplete(), null); |
371 | 403 |
this.add(getJComboBoxZoomInAndOutViewCentered(), null); |
404 |
getJComboBoxZoomInAndOutViewCentered().revalidate(); // Force update this component |
|
372 | 405 |
this.add(getJComboBoxOtherTools(), null); |
406 |
getJComboBoxOtherTools().revalidate(); // Force update this component |
|
373 | 407 |
// this.add(getJButtonInfo(), null); |
374 | 408 |
|
375 | 409 |
// Enables the icons |
... | ... | |
382 | 416 |
|
383 | 417 |
// Enables the MapControl area |
384 | 418 |
getSelectableMapAreaPanel().setEnabled(true); |
419 |
// getSelectableMapAreaPanel().enableAllMouseListeners(); |
|
420 |
|
|
421 |
// Force update this panel |
|
422 |
// this.invalidate(); |
|
385 | 423 |
} |
386 | 424 |
|
387 | 425 |
/** |
... | ... | |
389 | 427 |
*/ |
390 | 428 |
private void disableCoorderatesRegionOperation() { |
391 | 429 |
// Removes associated icons |
392 |
this.remove(getJButtonEraser()); |
|
393 |
|
|
430 |
this.remove(getJButtonUndo()); |
|
431 |
this.remove(getJButtonRedo()); |
|
432 |
this.remove(getJToggleButtonMove()); |
|
433 |
this.remove(getJToggleButtonScaling()); |
|
394 | 434 |
// if (jButtonInfo != null) |
395 | 435 |
// this.remove(jButtonInfo); |
396 | 436 |
|
397 | 437 |
getCoordinatesPanel().setAllTextFieldsEnabled(false); |
398 |
getCoordinatesPanel().getJRadioButtonGoToArea().setEnabled(false); |
|
438 |
getCoordinatesPanel().getJRadioButtonPreviewArea().setEnabled(false); |
|
439 |
|
|
440 |
// Force update this panel |
|
441 |
// this.invalidate(); |
|
399 | 442 |
} |
400 | 443 |
|
401 | 444 |
/** |
... | ... | |
426 | 469 |
// getJComboBoxZoomInAndOutViewCentered().setEnabled(false); |
427 | 470 |
|
428 | 471 |
// Disables the MapControl area |
472 |
// getSelectableMapAreaPanel().disableAllMouseListeners(); |
|
429 | 473 |
getSelectableMapAreaPanel().setEnabled(false); |
474 |
|
|
475 |
// Force update this panel |
|
476 |
// this.invalidate(); |
|
430 | 477 |
} |
431 | 478 |
|
432 | 479 |
/** |
... | ... | |
443 | 490 |
} |
444 | 491 |
|
445 | 492 |
/** |
446 |
* This method initializes jButtonEraser
|
|
447 |
*
|
|
448 |
* @return javax.swing.JButton
|
|
493 |
* This method initializes jButtonUndo
|
|
494 |
* |
|
495 |
* @return javax.swing.JButton |
|
449 | 496 |
*/ |
450 |
private JButton getJButtonEraser() { |
|
451 |
if (jButtonEraser == null) { |
|
452 |
jButtonEraser = new JButton(); |
|
453 |
jButtonEraser.setBounds(DEFAULT_ERASER_ICON_BUTTON_RECTANGLE); |
|
454 |
jButtonEraser.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/eraser.png"))); |
|
455 |
jButtonEraser.setToolTipText(PluginServices.getText(this, "erases_coordinates")); |
|
497 |
private JButton getJButtonUndo() { |
|
498 |
if (jButtonUndo == null) { |
|
499 |
jButtonUndo = new JButton(); |
|
500 |
jButtonUndo.setBounds(DEFAULT_UNDO_ICON_BUTTON_RECTANGLE); |
|
501 |
jButtonUndo.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/edit-undo.png"))); |
|
502 |
jButtonUndo.setToolTipText(PluginServices.getText(this, "previous_area")); |
|
503 |
jButtonUndo.addMouseListener(new MouseAdapter() { |
|
504 |
/* |
|
505 |
* (non-Javadoc) |
|
506 |
* @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent) |
|
507 |
*/ |
|
508 |
public void mouseClicked(MouseEvent e) { |
|
509 |
goToPreviousZoom(); |
|
510 |
} |
|
511 |
}); |
|
456 | 512 |
} |
457 |
return jButtonEraser; |
|
513 |
|
|
514 |
return jButtonUndo; |
|
458 | 515 |
} |
459 |
|
|
516 |
|
|
460 | 517 |
/** |
518 |
* This method initializes jButtonUndo |
|
519 |
* |
|
520 |
* @return javax.swing.JButton |
|
521 |
*/ |
|
522 |
private JButton getJButtonRedo() { |
|
523 |
if (jButtonRedo == null) { |
|
524 |
jButtonRedo = new JButton(); |
|
525 |
jButtonRedo.setBounds(DEFAULT_REDO_ICON_BUTTON_RECTANGLE); |
|
526 |
jButtonRedo.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/edit-redo.png"))); |
|
527 |
jButtonRedo.setToolTipText(PluginServices.getText(this, "following_area")); |
|
528 |
} |
|
529 |
|
|
530 |
return jButtonRedo; |
|
531 |
} |
|
532 |
|
|
533 |
/** |
|
534 |
* This method initializes jToggleButtonMove |
|
535 |
* |
|
536 |
* @return javax.swing.JButton |
|
537 |
*/ |
|
538 |
private JToggleButton getJToggleButtonMove() { |
|
539 |
if (jToggleButtonMove == null) { |
|
540 |
jToggleButtonMove = new JToggleButton(); |
|
541 |
jToggleButtonMove.setBounds(DEFAULT_MOVE_ICON_TOGGLE_BUTTON_RECTANGLE); |
|
542 |
jToggleButtonMove.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/move.png"))); |
|
543 |
jToggleButtonMove.setToolTipText(PluginServices.getText(this, "move")); |
|
544 |
jToggleButtonMove.addItemListener(new ItemListener() { |
|
545 |
/* |
|
546 |
* (non-Javadoc) |
|
547 |
* @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) |
|
548 |
*/ |
|
549 |
public void itemStateChanged(ItemEvent e) { |
|
550 |
// Isn't allowed that the two JToggleButton would be selected (can't move and scale) |
|
551 |
if (jToggleButtonMove.isSelected()) |
|
552 |
jToggleButtonScaling.setSelected(false); |
|
553 |
} |
|
554 |
}); |
|
555 |
} |
|
556 |
|
|
557 |
return jToggleButtonMove; |
|
558 |
} |
|
559 |
|
|
560 |
/** |
|
561 |
* This method initializes jToggleButtonScaling |
|
562 |
* |
|
563 |
* @return javax.swing.JButton |
|
564 |
*/ |
|
565 |
private JToggleButton getJToggleButtonScaling() { |
|
566 |
if (jToggleButtonScaling == null) { |
|
567 |
jToggleButtonScaling = new JToggleButton(); |
|
568 |
jToggleButtonScaling.setBounds(DEFAULT_SCALING_ICON_TOGGLE_BUTTON_RECTANGLE); |
|
569 |
jToggleButtonScaling.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/scaling.png"))); |
|
570 |
jToggleButtonScaling.setToolTipText(PluginServices.getText(this, "scaling")); |
|
571 |
jToggleButtonScaling.addItemListener(new ItemListener() { |
|
572 |
/* |
|
573 |
* (non-Javadoc) |
|
574 |
* @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) |
|
575 |
*/ |
|
576 |
public void itemStateChanged(ItemEvent e) { |
|
577 |
// Isn't allowed that the two JToggleButton would be selected (can't move and scale) |
|
578 |
if (jToggleButtonScaling.isSelected()) |
|
579 |
jToggleButtonMove.setSelected(false); |
|
580 |
} |
|
581 |
}); |
|
582 |
} |
|
583 |
|
|
584 |
return jToggleButtonScaling; |
|
585 |
} |
|
586 |
/** |
|
461 | 587 |
* This method initializes jButtonPan |
462 | 588 |
* |
463 | 589 |
* @return javax.swing.JButton |
... | ... | |
590 | 716 |
// ((ProjectDocument)vista.getModel()).setModified(true); |
591 | 717 |
|
592 | 718 |
// if (vista.) |
593 |
// Gets the view port and sets its previous extent |
|
594 |
ViewPort vp = getSelectableMapAreaPanel().getMapContext().getViewPort(); |
|
595 |
|
|
596 |
if (vp.getExtents().hasPrevious()) { |
|
597 |
vp.setPreviousExtent(); |
|
598 |
((ProjectDocument)((View) PluginServices.getMDIManager().getActiveWindow()).getModel()).setModified(true); |
|
599 |
} |
|
719 |
goToPreviousZoom(); |
|
720 |
|
|
600 | 721 |
// else { |
601 | 722 |
// // Disables Previous JButton if there isn't any previous zoom view |
602 | 723 |
// jButtonZoomPrevious.setEnabled(false); |
... | ... | |
630 | 751 |
getSelectableMapAreaPanel().getViewPort().setExtent(getSelectableMapAreaPanel().getMapContext().getLayers().getFullExtent()); |
631 | 752 |
View view =((View)PluginServices.getMDIManager().getActiveWindow()); |
632 | 753 |
view.repaintMap(); |
633 |
((ProjectDocument)view.getModel()).setModified(true); |
|
754 |
//((ProjectDocument)view.getModel()).setModified(true);
|
|
634 | 755 |
// mapa.endAtomicEvent(); |
635 | 756 |
} catch (DriverException de) { |
636 | 757 |
NotificationManager.addError("Error obteniendo el full extent", de); |
... | ... | |
698 | 819 |
// ((ProjectDocument)vista.getModel()).setModified(true); |
699 | 820 |
} |
700 | 821 |
|
701 |
((ProjectDocument)((View)PluginServices.getMDIManager().getActiveWindow()).getModel()).setModified(true); |
|
822 |
// ((ProjectDocument)((View)PluginServices.getMDIManager().getActiveWindow()).getModel()).setModified(true);
|
|
702 | 823 |
|
703 | 824 |
// getSelectableMapAreaPanel().setTool((String)iiii.getItemValue()); |
704 | 825 |
} |
... | ... | |
796 | 917 |
} |
797 | 918 |
|
798 | 919 |
/** |
920 |
* Goes to previous zoom |
|
921 |
*/ |
|
922 |
private void goToPreviousZoom() { |
|
923 |
// Gets the view port and sets its previous extent |
|
924 |
ViewPort vp = getSelectableMapAreaPanel().getMapContext().getViewPort(); |
|
925 |
|
|
926 |
if (vp.getExtents().hasPrevious()) { |
|
927 |
vp.setPreviousExtent(); |
|
928 |
// ((ProjectDocument)((View) PluginServices.getMDIManager().getActiveWindow()).getModel()).setModified(true); |
|
929 |
} |
|
930 |
} |
|
931 |
|
|
932 |
/** |
|
799 | 933 |
* Represents an object that stores the necessary information for know each operation of the 'jComboBoxToolSelection' |
800 | 934 |
* |
801 | 935 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com) |
... | ... | |
859 | 993 |
private final int DEFAULT_COORDINATE_HEIGHT = 25; |
860 | 994 |
private final Dimension DEFAULT_JLABEL_VERTEX_DIMENSION = new Dimension(60, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT); // @jve:decl-index=0: |
861 | 995 |
private final int DEFAULT_XY_COORDINATES_WIDTH = 2 * DEFAULT_COORDINATE_WIDTH + DEFAULT_JLABEL_VERTEX_DIMENSION.width + 10 ; |
996 |
|
|
997 |
private final String JTEXTFIELD_V1X_NAME = "V1X"; |
|
998 |
private final String JTEXTFIELD_V1Y_NAME = "V1Y"; |
|
999 |
private final String JTEXTFIELD_V2X_NAME = "V2X"; |
|
1000 |
private final String JTEXTFIELD_V2Y_NAME = "V2Y"; |
|
862 | 1001 |
|
863 | 1002 |
private JPanel jPanelVertex1 = null; |
864 | 1003 |
private JPanel jPanelVertex2 = null; |
... | ... | |
877 | 1016 |
private JTextFieldWithSpecificCaretPosition jTextFieldVertex1Y = null; |
878 | 1017 |
private JTextFieldWithSpecificCaretPosition jTextFieldVertex2X = null; |
879 | 1018 |
private JTextFieldWithSpecificCaretPosition jTextFieldVertex2Y = null; |
880 |
private JRadioButton jRadioButtonGoToArea = null; |
|
881 |
|
|
1019 |
private JRadioButton jRadioButtonPreviewArea = null; |
|
1020 |
private String last_Coordinates[]; |
|
1021 |
private boolean hasChanged_v1X; |
|
1022 |
private boolean hasChanged_v1Y; |
|
1023 |
private boolean hasChanged_v2X; |
|
1024 |
private boolean hasChanged_v2Y; |
|
1025 |
|
|
882 | 1026 |
private FocusListener focusListenerForCoordinateValidation = null; |
883 | 1027 |
|
884 | 1028 |
/** |
... | ... | |
903 | 1047 |
// null, PluginServices.getText(this, "select_by_vertexes_coordinates"), |
904 | 1048 |
// javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
905 | 1049 |
// javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
1050 |
|
|
1051 |
this.last_Coordinates = new String[4]; |
|
1052 |
this.last_Coordinates[0] = ""; |
|
1053 |
this.last_Coordinates[1] = ""; |
|
1054 |
this.last_Coordinates[2] = ""; |
|
1055 |
this.last_Coordinates[3] = ""; |
|
1056 |
|
|
1057 |
// By default no coordinates have changed |
|
1058 |
this.resetCoordinatesFlags(); |
|
1059 |
|
|
906 | 1060 |
this.add(getJPanelVertex1()); |
907 | 1061 |
this.add(getJPanelVertex2()); |
908 |
this.add(getJRadioButtonGoToArea());
|
|
1062 |
this.add(getJRadioButtonPreviewArea());
|
|
909 | 1063 |
} |
910 | 1064 |
|
911 | 1065 |
/** |
... | ... | |
925 | 1079 |
public int getDefaultHeight() { |
926 | 1080 |
return DEFAULT_COORDINATE_HEIGHT * 2; |
927 | 1081 |
} |
1082 |
|
|
1083 |
/** |
|
1084 |
* Sets all flags about if a coordinate has change to false (haven't changed) |
|
1085 |
*/ |
|
1086 |
private void resetCoordinatesFlags() { |
|
1087 |
hasChanged_v1X = false; |
|
1088 |
hasChanged_v1Y = false; |
|
1089 |
hasChanged_v2X = false; |
|
1090 |
hasChanged_v2Y = false; |
|
1091 |
} |
|
928 | 1092 |
|
1093 |
// /** |
|
1094 |
// * This method initializes last_V1 |
|
1095 |
// * |
|
1096 |
// * @return java.awt.Point |
|
1097 |
// */ |
|
1098 |
// private Point get_Last_V1() { |
|
1099 |
// if (last_V1 == null) { |
|
1100 |
// last_V1 = new Point(); |
|
1101 |
// } |
|
1102 |
// |
|
1103 |
// return last_V1; |
|
1104 |
// } |
|
1105 |
// |
|
1106 |
// /** |
|
1107 |
// * This method initializes last_V2 |
|
1108 |
// * |
|
1109 |
// * @return java.awt.Point |
|
1110 |
// */ |
|
1111 |
// private Point get_Last_V2() { |
|
1112 |
// if (last_V2 == null) { |
|
1113 |
// last_V2 = new Point(); |
|
1114 |
// } |
|
1115 |
// |
|
1116 |
// return last_V2; |
|
1117 |
// } |
|
1118 |
|
|
929 | 1119 |
/** |
930 | 1120 |
* This method initializes jPanelVertex1 |
931 | 1121 |
* |
... | ... | |
971 | 1161 |
if (jLabelVertex1 == null) { |
972 | 1162 |
jLabelVertex1 = new JLabel(); |
973 | 1163 |
jLabelVertex1.setPreferredSize(DEFAULT_JLABEL_VERTEX_DIMENSION); |
974 |
jLabelVertex1.setToolTipText(PluginServices.getText(this, "coordinates_from_area_left_up_vertex"));
|
|
1164 |
jLabelVertex1.setToolTipText(PluginServices.getText(this, "coordinates_from_area_right_up_vertex"));
|
|
975 | 1165 |
jLabelVertex1.setText(PluginServices.getText(this, "vertex") + " 1:"); |
976 | 1166 |
jLabelVertex1.setHorizontalAlignment(SwingConstants.LEFT); |
977 | 1167 |
jLabelVertex1.setVerticalAlignment(SwingConstants.CENTER); |
... | ... | |
989 | 1179 |
if (jLabelVertex2 == null) { |
990 | 1180 |
jLabelVertex2 = new JLabel(); |
991 | 1181 |
jLabelVertex2.setPreferredSize(DEFAULT_JLABEL_VERTEX_DIMENSION); |
992 |
jLabelVertex2.setToolTipText(PluginServices.getText(this, "coordinates_from_area_right_bottom_vertex"));
|
|
1182 |
jLabelVertex2.setToolTipText(PluginServices.getText(this, "coordinates_from_area_left_bottom_vertex"));
|
|
993 | 1183 |
jLabelVertex2.setText(PluginServices.getText(this, "vertex") + " 2:"); |
994 | 1184 |
jLabelVertex2.setHorizontalAlignment(SwingConstants.LEFT); |
995 | 1185 |
jLabelVertex2.setVerticalAlignment(SwingConstants.CENTER); |
... | ... | |
1075 | 1265 |
if (jLabelVertex1X == null) { |
1076 | 1266 |
jLabelVertex1X = new JLabel(); |
1077 | 1267 |
jLabelVertex1X.setPreferredSize(new java.awt.Dimension(DEFAULT_COORDIANTE_LABEL_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT)); |
1078 |
jLabelVertex1X.setToolTipText(PluginServices.getText(this, "x_coordinate_from_area_left_up_vertex"));
|
|
1268 |
jLabelVertex1X.setToolTipText(PluginServices.getText(this, "x_coordinate_from_area_right_up_vertex"));
|
|
1079 | 1269 |
jLabelVertex1X.setText(PluginServices.getText(this, "x") + ":"); |
1080 | 1270 |
jLabelVertex1X.setHorizontalAlignment(SwingConstants.CENTER); |
1081 | 1271 |
jLabelVertex1X.setVerticalAlignment(SwingConstants.CENTER); |
... | ... | |
1094 | 1284 |
if (jLabelVertex2X == null) { |
1095 | 1285 |
jLabelVertex2X = new JLabel(); |
1096 | 1286 |
jLabelVertex2X.setPreferredSize(new java.awt.Dimension(DEFAULT_COORDIANTE_LABEL_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT)); |
1097 |
jLabelVertex2X.setToolTipText(PluginServices.getText(this, "x_coordinate_from_area_right_bottom_vertex"));
|
|
1287 |
jLabelVertex2X.setToolTipText(PluginServices.getText(this, "x_coordinate_from_area_left_bottom_vertex"));
|
|
1098 | 1288 |
jLabelVertex2X.setText(PluginServices.getText(this, "x") + ":"); |
1099 | 1289 |
jLabelVertex2X.setHorizontalAlignment(SwingConstants.CENTER); |
1100 | 1290 |
jLabelVertex2X.setVerticalAlignment(SwingConstants.CENTER); |
... | ... | |
1113 | 1303 |
if (jLabelVertex1Y == null) { |
1114 | 1304 |
jLabelVertex1Y = new JLabel(); |
1115 | 1305 |
jLabelVertex1Y.setPreferredSize(new java.awt.Dimension(DEFAULT_COORDIANTE_LABEL_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT)); |
1116 |
jLabelVertex1Y.setToolTipText(PluginServices.getText(this, "y_coordinate_from_area_left_up_vertex"));
|
|
1306 |
jLabelVertex1Y.setToolTipText(PluginServices.getText(this, "y_coordinate_from_area_right_up_vertex"));
|
|
1117 | 1307 |
jLabelVertex1Y.setText(PluginServices.getText(this, "y") + ":"); |
1118 | 1308 |
jLabelVertex1Y.setHorizontalAlignment(SwingConstants.CENTER); |
1119 | 1309 |
jLabelVertex1Y.setVerticalAlignment(SwingConstants.CENTER); |
... | ... | |
1132 | 1322 |
if (jLabelVertex2Y == null) { |
1133 | 1323 |
jLabelVertex2Y = new JLabel(); |
1134 | 1324 |
jLabelVertex2Y.setPreferredSize(new java.awt.Dimension(DEFAULT_COORDIANTE_LABEL_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT)); |
1135 |
jLabelVertex2Y.setToolTipText(PluginServices.getText(this, "y_coordinate_from_area_right_bottom_vertex"));
|
|
1325 |
jLabelVertex2Y.setToolTipText(PluginServices.getText(this, "y_coordinate_from_area_left_bottom_vertex"));
|
|
1136 | 1326 |
jLabelVertex2Y.setText(PluginServices.getText(this, "y") + ":"); |
1137 | 1327 |
jLabelVertex2Y.setHorizontalAlignment(SwingConstants.CENTER); |
1138 | 1328 |
jLabelVertex2Y.setVerticalAlignment(SwingConstants.CENTER); |
... | ... | |
1171 | 1361 |
*/ |
1172 | 1362 |
private FocusListener getFocusListenerForCoordinateValidation() { |
1173 | 1363 |
if (focusListenerForCoordinateValidation == null) { |
1174 |
focusListenerForCoordinateValidation = new FocusAdapter() {
|
|
1364 |
focusListenerForCoordinateValidation = new FocusListener() {
|
|
1175 | 1365 |
/* |
1176 | 1366 |
* (non-Javadoc) |
1177 | 1367 |
* @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent) |
1178 | 1368 |
*/ |
1179 | 1369 |
public void focusLost(FocusEvent e) { |
1180 |
validateCoordinate((JTextField)e.getSource()); |
|
1370 |
JTextField jTF = (JTextField)e.getSource(); |
|
1371 |
|
|
1372 |
// If a coordinate has lost focus, is valid and has changed -> store the new value and set its related 'hasChanged' flag to true |
|
1373 |
if (validateCoordinate(jTF)) { |
|
1374 |
String text = jTF.getText(); |
|
1375 |
|
|
1376 |
if (jTF.getName().compareTo(JTEXTFIELD_V1X_NAME) == 0) { |
|
1377 |
if (text.compareTo(last_Coordinates[0]) != 0) { |
|
1378 |
hasChanged_v1X = true; |
|
1379 |
} |
|
1380 |
|
|
1381 |
return; |
|
1382 |
} |
|
1383 |
if (jTF.getName().compareTo(JTEXTFIELD_V1Y_NAME) == 0) { |
|
1384 |
if (text.compareTo(last_Coordinates[1]) != 0) { |
|
1385 |
hasChanged_v1Y = true; |
|
1386 |
} |
|
1387 |
|
|
1388 |
return; |
|
1389 |
} |
|
1390 |
if (jTF.getName().compareTo(JTEXTFIELD_V2X_NAME) == 0) { |
|
1391 |
if (text.compareTo(last_Coordinates[2]) != 0) { |
|
1392 |
hasChanged_v2X = true; |
|
1393 |
} |
|
1394 |
|
|
1395 |
return; |
|
1396 |
} |
|
1397 |
if (jTF.getName().compareTo(JTEXTFIELD_V2Y_NAME) == 0) { |
|
1398 |
if (text.compareTo(last_Coordinates[3]) != 0) { |
|
1399 |
hasChanged_v2Y = true; |
|
1400 |
} |
|
1401 |
|
|
1402 |
return; |
|
1403 |
} |
|
1404 |
} |
|
1405 |
} |
|
1406 |
|
|
1407 |
/* |
|
1408 |
* (non-Javadoc) |
|
1409 |
* @see java.awt.event.FocusListener#focusGained(java.awt.event.FocusEvent) |
|
1410 |
*/ |
|
1411 |
public void focusGained(FocusEvent e) { |
|
1412 |
JTextField jTF = (JTextField)e.getSource(); |
|
1413 |
|
|
1414 |
// If a coordinate has lost focus, is valid and has changed -> store the new value and set its related 'hasChanged' flag to true |
|
1415 |
if (validateCoordinate(jTF)) { |
|
1416 |
String text = jTF.getText(); |
|
1417 |
|
|
1418 |
if (jTF.getName().compareTo(JTEXTFIELD_V1X_NAME) == 0) { |
|
1419 |
last_Coordinates[0] = text; |
|
1420 |
|
|
1421 |
return; |
|
1422 |
} |
|
1423 |
if (jTF.getName().compareTo(JTEXTFIELD_V1Y_NAME) == 0) { |
|
1424 |
last_Coordinates[1] = text; |
|
1425 |
|
|
1426 |
return; |
|
1427 |
} |
|
1428 |
if (jTF.getName().compareTo(JTEXTFIELD_V2X_NAME) == 0) { |
|
1429 |
last_Coordinates[2] = text; |
|
1430 |
|
|
1431 |
return; |
|
1432 |
} |
|
1433 |
if (jTF.getName().compareTo(JTEXTFIELD_V2Y_NAME) == 0) { |
|
1434 |
last_Coordinates[3] = text; |
|
1435 |
|
|
1436 |
return; |
|
1437 |
} |
|
1438 |
} |
|
1181 | 1439 |
} |
1182 | 1440 |
}; |
1183 | 1441 |
} |
... | ... | |
1194 | 1452 |
if (jTextFieldVertex1X == null) { |
1195 | 1453 |
jTextFieldVertex1X = new JTextFieldWithSpecificCaretPosition(); |
1196 | 1454 |
jTextFieldVertex1X.setPreferredSize(new Dimension(DEFAULT_TEXT_FIELDS_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT)); |
1197 |
jTextFieldVertex1X.setToolTipText(PluginServices.getText(this, "x_coordinate_from_area_left_up_vertex"));
|
|
1455 |
jTextFieldVertex1X.setToolTipText(PluginServices.getText(this, "x_coordinate_from_area_right_up_vertex"));
|
|
1198 | 1456 |
jTextFieldVertex1X.addFocusListener(getFocusListenerForCoordinateValidation()); |
1457 |
jTextFieldVertex1X.setName(JTEXTFIELD_V1X_NAME); |
|
1199 | 1458 |
} |
1200 | 1459 |
return jTextFieldVertex1X; |
1201 | 1460 |
} |
... | ... | |
1209 | 1468 |
if (jTextFieldVertex1Y == null) { |
1210 | 1469 |
jTextFieldVertex1Y = new JTextFieldWithSpecificCaretPosition(); |
1211 | 1470 |
jTextFieldVertex1Y.setPreferredSize(new Dimension(DEFAULT_TEXT_FIELDS_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT)); |
1212 |
jTextFieldVertex1Y.setToolTipText(PluginServices.getText(this, "y_coordinate_from_area_left_up_vertex"));
|
|
1471 |
jTextFieldVertex1Y.setToolTipText(PluginServices.getText(this, "y_coordinate_from_area_right_up_vertex"));
|
|
1213 | 1472 |
jTextFieldVertex1Y.addFocusListener(getFocusListenerForCoordinateValidation()); |
1473 |
jTextFieldVertex1Y.setName(JTEXTFIELD_V1Y_NAME); |
|
1214 | 1474 |
} |
1215 | 1475 |
return jTextFieldVertex1Y; |
1216 | 1476 |
} |
... | ... | |
1224 | 1484 |
if (jTextFieldVertex2X == null) { |
1225 | 1485 |
jTextFieldVertex2X = new JTextFieldWithSpecificCaretPosition(); |
1226 | 1486 |
jTextFieldVertex2X.setPreferredSize(new Dimension(DEFAULT_TEXT_FIELDS_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT)); |
1227 |
jTextFieldVertex2X.setToolTipText(PluginServices.getText(this, "x_coordinate_from_area_right_bottom_vertex"));
|
|
1487 |
jTextFieldVertex2X.setToolTipText(PluginServices.getText(this, "x_coordinate_from_area_left_bottom_vertex"));
|
|
1228 | 1488 |
jTextFieldVertex2X.addFocusListener(getFocusListenerForCoordinateValidation()); |
1489 |
jTextFieldVertex2X.setName(JTEXTFIELD_V2X_NAME); |
|
1229 | 1490 |
} |
1230 | 1491 |
return jTextFieldVertex2X; |
1231 | 1492 |
} |
... | ... | |
1239 | 1500 |
if (jTextFieldVertex2Y == null) { |
1240 | 1501 |
jTextFieldVertex2Y = new JTextFieldWithSpecificCaretPosition(); |
1241 | 1502 |
jTextFieldVertex2Y.setPreferredSize(new Dimension(DEFAULT_TEXT_FIELDS_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT)); |
1242 |
jTextFieldVertex2Y.setToolTipText(PluginServices.getText(this, "y_coordinate_from_area_right_bottom_vertex"));
|
|
1503 |
jTextFieldVertex2Y.setToolTipText(PluginServices.getText(this, "y_coordinate_from_area_left_bottom_vertex"));
|
|
1243 | 1504 |
jTextFieldVertex2Y.addFocusListener(getFocusListenerForCoordinateValidation()); |
1505 |
jTextFieldVertex2Y.setName(JTEXTFIELD_V2Y_NAME); |
|
1244 | 1506 |
} |
1245 | 1507 |
return jTextFieldVertex2Y; |
1246 | 1508 |
} |
... | ... | |
1265 | 1527 |
} |
1266 | 1528 |
|
1267 | 1529 |
/** |
1268 |
* This method initializes jbuttonGoToArea
|
|
1530 |
* This method initializes jRadioButtonPreviewArea
|
|
1269 | 1531 |
* |
1270 | 1532 |
* @return javax.swing.JRadioButton |
1271 | 1533 |
*/ |
1272 |
private JRadioButton getJRadioButtonGoToArea() {
|
|
1273 |
if (jRadioButtonGoToArea == null) {
|
|
1274 |
jRadioButtonGoToArea = new JRadioButton();
|
|
1275 |
jRadioButtonGoToArea.setBounds(DEFAULT_JRADIOBUTTON_GO_TO_AREA_RECTANGLE);
|
|
1276 |
jRadioButtonGoToArea.setToolTipText(PluginServices.getText(this, "to_previsualize"));
|
|
1277 |
jRadioButtonGoToArea.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/to_previsualize_area.png")));
|
|
1278 |
// jRadioButtonGoToArea.addActionListener(new ActionListener() {
|
|
1534 |
private JRadioButton getJRadioButtonPreviewArea() {
|
|
1535 |
if (jRadioButtonPreviewArea == null) {
|
|
1536 |
jRadioButtonPreviewArea = new JRadioButton();
|
|
1537 |
jRadioButtonPreviewArea.setBounds(DEFAULT_JRADIOBUTTON_GO_TO_AREA_RECTANGLE);
|
|
1538 |
jRadioButtonPreviewArea.setToolTipText(PluginServices.getText(this, "to_previsualize"));
|
|
1539 |
jRadioButtonPreviewArea.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/to_previsualize_area.png")));
|
|
1540 |
// jRadioButtonPreviewArea.addActionListener(new ActionListener() {
|
|
1279 | 1541 |
// /* |
1280 | 1542 |
// * (non-Javadoc) |
1281 | 1543 |
// * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) |
... | ... | |
1285 | 1547 |
// } |
1286 | 1548 |
// }); |
1287 | 1549 |
|
1288 |
jRadioButtonGoToArea.addMouseListener(new MouseListener() { |
|
1289 |
|
|
1550 |
jRadioButtonPreviewArea.addMouseListener(new MouseAdapter() { |
|
1551 |
/* |
|
1552 |
* (non-Javadoc) |
|
1553 |
* @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent) |
|
1554 |
*/ |
|
1290 | 1555 |
public void mouseClicked(MouseEvent e) { |
1291 |
System.out.println("Mouse clicked"); |
|
1556 |
// System.out.println("Mouse clicked");
|
|
1292 | 1557 |
if ((validateCoordinate(getJTextFieldVertex1X())) && (validateCoordinate(getJTextFieldVertex1Y())) && (validateCoordinate(getJTextFieldVertex2X())) && (validateCoordinate(getJTextFieldVertex2Y()))) { |
1293 | 1558 |
// ViewPort vP = getSelectableMapAreaPanel().getViewPort(); |
1294 | 1559 |
// if (vP != null) { |
... | ... | |
1306 | 1571 |
// View activeView = (View) PluginServices.getMDIManager().getActiveWindow(); |
1307 | 1572 |
// Rectangle2D r2d= activeView.getMapControl().getViewPort().getAdjustedExtent(); |
1308 | 1573 |
// Rectangle2D r2d = getViewPort().getExtent(); |
1574 |
|
|
1309 | 1575 |
ViewPort vP = getSelectableMapAreaPanel().getViewPort(); |
1310 | 1576 |
if (vP != null) { |
1311 |
Rectangle2D r2d = vP.getExtent(); |
|
1312 |
if (r2d != null){ |
|
1577 |
// If has to scale the area |
|
1578 |
if (getJToggleButtonScaling().isSelected()) { |
|
1579 |
// Scale Vertex 1 |
|
1580 |
if ((hasChanged_v1X) || (hasChanged_v1Y)) { |
|
1581 |
double cx = Double.parseDouble(getJTextFieldVertex1X().getText()); |
|
1582 |
double cy = Double.parseDouble(getJTextFieldVertex1Y().getText()); |
|
1583 |
double sx, sy, aux; |
|
1584 |
|
|
1585 |
if (hasChanged_v1X) { |
|
1586 |
aux = Double.parseDouble(last_Coordinates[0]); |
|
1587 |
if (aux == 0.0) |
|
1588 |
sx = 1.0; // Don't scale if new coordenate is zero |
|
1589 |
else |
|
1590 |
sx = cx / aux; |
|
1591 |
} |
|
1592 |
else |
|
1593 |
sx = 1.0; |
|
1594 |
|
|
1595 |
if (hasChanged_v1Y) { |
|
1596 |
aux = Double.parseDouble(last_Coordinates[1]); |
|
1597 |
if (aux == 0.0) |
|
1598 |
sy = 1.0; // Don't scale if new coordenate is zero |
|
1599 |
else |
|
1600 |
sy = cy / aux; |
|
1601 |
} |
|
1602 |
else |
|
1603 |
sy = 1.0; |
|
1604 |
|
|
1605 |
if (sx == 1.0) { |
|
1606 |
// It's supposed that sy != 1.0 |
|
1607 |
cx *= sy; |
|
1608 |
|
|
1609 |
if (cx < Double.parseDouble(getJTextFieldVertex2X().getText())) { |
|
1610 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "problem_with_the_new_calculated_area") + ": " + PluginServices.getText(jRadioButtonPreviewArea, "v1x") + " < " + PluginServices.getText(jRadioButtonPreviewArea, "v2x"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1611 |
getJTextFieldVertex1Y().setText(last_Coordinates[1]); // Restore to the last value |
|
1612 |
return; |
|
1613 |
} |
|
1614 |
|
|
1615 |
getJTextFieldVertex1X().setText(Double.toString(cx)); |
|
1616 |
} |
|
1617 |
else { |
|
1618 |
if (sy == 1.0) { |
|
1619 |
// It's supposed that sx != 1.0 |
|
1620 |
cy *= sx; |
|
1621 |
|
|
1622 |
if (cy < Double.parseDouble(getJTextFieldVertex2Y().getText())) { |
|
1623 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "problem_with_the_new_calculated_area") + ": " + PluginServices.getText(jRadioButtonPreviewArea, "v1y") + " < " + PluginServices.getText(jRadioButtonPreviewArea, "v2y"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1624 |
getJTextFieldVertex1X().setText(last_Coordinates[0]); // Restore to the last value |
|
1625 |
return; |
|
1626 |
} |
|
1627 |
|
|
1628 |
getJTextFieldVertex1Y().setText(Double.toString(cy)); |
|
1629 |
} |
|
1630 |
else { |
|
1631 |
// If there has been an error -> can't move different distances in X the two vertexes |
|
1632 |
if (sx != sy) { |
|
1633 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "problem_with_the_new_calculated_area") + ": " + PluginServices.getText(jRadioButtonPreviewArea, "different_scale_factors"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1634 |
return; |
|
1635 |
} |
|
1636 |
} |
|
1637 |
} |
|
1638 |
|
|
1639 |
hasChanged_v1X = false; |
|
1640 |
hasChanged_v1Y = false; |
|
1641 |
} |
|
1642 |
|
|
1643 |
// Scale Vertex2 |
|
1644 |
if ((hasChanged_v2X) || (hasChanged_v2Y)) { |
|
1645 |
double cx = Double.parseDouble(getJTextFieldVertex2X().getText()); |
|
1646 |
double cy = Double.parseDouble(getJTextFieldVertex2Y().getText()); |
|
1647 |
double sx, sy, aux; |
|
1648 |
|
|
1649 |
if (hasChanged_v2X) { |
|
1650 |
aux = Double.parseDouble(last_Coordinates[2]); |
|
1651 |
if (aux == 0.0) |
|
1652 |
sx = 1.0; // Don't scale if new coordenate is zero |
|
1653 |
else |
|
1654 |
sx = cx / aux; |
|
1655 |
} |
|
1656 |
else |
|
1657 |
sx = 1.0; |
|
1658 |
|
|
1659 |
if (hasChanged_v2Y) { |
|
1660 |
aux = Double.parseDouble(last_Coordinates[3]); |
|
1661 |
if (aux == 0.0) |
|
1662 |
sy = 1.0; // Don't scale if new coordenate is zero |
|
1663 |
else |
|
1664 |
sy = cy / aux; |
|
1665 |
} |
|
1666 |
else |
|
1667 |
sy = 1.0; |
|
1668 |
|
|
1669 |
if (sx == 1.0) { |
|
1670 |
// It's supposed that sy != 1.0 |
|
1671 |
cx *= sy; |
|
1672 |
|
|
1673 |
if (cx > Double.parseDouble(getJTextFieldVertex1X().getText())) { |
|
1674 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "problem_with_the_new_calculated_area") + ": " + PluginServices.getText(jRadioButtonPreviewArea, "v2x") + " > " + PluginServices.getText(jRadioButtonPreviewArea, "v1x"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1675 |
getJTextFieldVertex2Y().setText(last_Coordinates[3]); // Restore to the last value |
|
1676 |
return; |
|
1677 |
} |
|
1678 |
|
|
1679 |
getJTextFieldVertex2X().setText(Double.toString(cx)); |
|
1680 |
} |
|
1681 |
else { |
|
1682 |
if (sy == 1.0) { |
|
1683 |
// It's supposed that sx != 1.0 |
|
1684 |
cy *= sx; |
|
1685 |
|
|
1686 |
if (cy > Double.parseDouble(getJTextFieldVertex1Y().getText())) { |
|
1687 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "problem_with_the_new_calculated_area") + ": " + PluginServices.getText(jRadioButtonPreviewArea, "v2y") + " > " + PluginServices.getText(jRadioButtonPreviewArea, "v1y"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1688 |
getJTextFieldVertex2X().setText(last_Coordinates[2]); // Restore to the last value |
|
1689 |
return; |
|
1690 |
} |
|
1691 |
|
|
1692 |
getJTextFieldVertex2Y().setText(Double.toString(cy)); |
|
1693 |
} |
|
1694 |
else { |
|
1695 |
// If there has been an error -> can't move different distances in X the two vertexes |
|
1696 |
if (sx != sy) { |
|
1697 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "problem_with_the_new_calculated_area") + ": " + PluginServices.getText(jRadioButtonPreviewArea, "different_scale_factors"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1698 |
return; |
|
1699 |
} |
|
1700 |
} |
|
1701 |
} |
|
1702 |
|
|
1703 |
hasChanged_v2X = false; |
|
1704 |
hasChanged_v2Y = false; |
|
1705 |
} |
|
1706 |
} |
|
1707 |
else { |
|
1708 |
// If has to move the area |
|
1709 |
if (getJToggleButtonMove().isSelected()) { |
|
1710 |
// Move in X |
|
1711 |
if ((hasChanged_v1X) || (hasChanged_v2X)) { |
|
1712 |
double c1 = Double.parseDouble(getJTextFieldVertex1X().getText()); |
|
1713 |
double c2 = Double.parseDouble(getJTextFieldVertex2X().getText()); |
|
1714 |
double d1, d2; |
|
1715 |
|
|
1716 |
if (hasChanged_v1X) |
|
1717 |
d1 = c1 - Double.parseDouble(last_Coordinates[0]); |
|
1718 |
else |
|
1719 |
d1 = 0.0; |
|
1720 |
|
|
1721 |
if (hasChanged_v2X) |
|
1722 |
d2 = c2 - Double.parseDouble(last_Coordinates[2]); |
|
1723 |
else |
|
1724 |
d2 = 0.0; |
|
1725 |
|
|
1726 |
if (d1 == 0.0) { |
|
1727 |
// It's supposed that d2 != 0 |
|
1728 |
c1 += d2; |
|
1729 |
|
|
1730 |
if (c1 < Double.parseDouble(getJTextFieldVertex2X().getText())) { |
|
1731 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "problem_with_the_new_calculated_area") + ": " + PluginServices.getText(jRadioButtonPreviewArea, "v1x") + " < " + PluginServices.getText(jRadioButtonPreviewArea, "v2x"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1732 |
getJTextFieldVertex1X().setText(last_Coordinates[0]); // Restore to the last value |
|
1733 |
return; |
|
1734 |
} |
|
1735 |
|
|
1736 |
getJTextFieldVertex1X().setText(Double.toString(c1)); |
|
1737 |
} |
|
1738 |
else { |
|
1739 |
if (d2 == 0.0) { |
|
1740 |
// It's supposed that d1 != 0 |
|
1741 |
c2 += d1; |
|
1742 |
|
|
1743 |
if (c2 > Double.parseDouble(getJTextFieldVertex1X().getText())) { |
|
1744 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "problem_with_the_new_calculated_area") + ": " + PluginServices.getText(jRadioButtonPreviewArea, "v2x") + " > " + PluginServices.getText(jRadioButtonPreviewArea, "v1x"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1745 |
getJTextFieldVertex2X().setText(last_Coordinates[2]); // Restore to the last value |
|
1746 |
return; |
|
1747 |
} |
|
1748 |
|
|
1749 |
getJTextFieldVertex2X().setText(Double.toString(c2)); |
|
1750 |
} |
|
1751 |
else { |
|
1752 |
// If there has been an error -> can't move different distances in X the two vertexes |
|
1753 |
if (d1 != d2) { |
|
1754 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "different_distances_in_X"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1755 |
return; |
|
1756 |
} |
|
1757 |
} |
|
1758 |
} |
|
1759 |
|
|
1760 |
hasChanged_v1X = false; |
|
1761 |
hasChanged_v2X = false; |
|
1762 |
} |
|
1763 |
|
|
1764 |
// Move in Y |
|
1765 |
if ((hasChanged_v1Y) || (hasChanged_v2Y)) { |
|
1766 |
double c1 = Double.parseDouble(getJTextFieldVertex1Y().getText()); |
|
1767 |
double c2 = Double.parseDouble(getJTextFieldVertex2Y().getText()); |
|
1768 |
double d1, d2; |
|
1769 |
|
|
1770 |
if (hasChanged_v1Y) |
|
1771 |
d1 = c1 - Double.parseDouble(last_Coordinates[1]); |
|
1772 |
else |
|
1773 |
d1 = 0.0; |
|
1774 |
|
|
1775 |
if (hasChanged_v2Y) |
|
1776 |
d2 = c2 - Double.parseDouble(last_Coordinates[3]); |
|
1777 |
else |
|
1778 |
d2 = 0.0; |
|
1779 |
|
|
1780 |
if (d1 == 0.0) { |
|
1781 |
// It's supposed that d2 != 0 |
|
1782 |
c1 += d2; |
|
1783 |
|
|
1784 |
if (c1 < Double.parseDouble(getJTextFieldVertex2Y().getText())) { |
|
1785 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "problem_with_the_new_calculated_area") + ": " + PluginServices.getText(jRadioButtonPreviewArea, "v1y") + " < " + PluginServices.getText(jRadioButtonPreviewArea, "v2y"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1786 |
getJTextFieldVertex1Y().setText(last_Coordinates[1]); // Restore to the last value |
|
1787 |
return; |
|
1788 |
} |
|
1789 |
|
|
1790 |
getJTextFieldVertex1Y().setText(Double.toString(c1)); |
|
1791 |
} |
|
1792 |
else { |
|
1793 |
if (d2 == 0.0) { |
|
1794 |
// It's supposed that d1 != 0 |
|
1795 |
c2 += d1; |
|
1796 |
|
|
1797 |
if (c2 > Double.parseDouble(getJTextFieldVertex1Y().getText())) { |
|
1798 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "problem_with_the_new_calculated_area") + ": " + PluginServices.getText(jRadioButtonPreviewArea, "v2y") + " > " + PluginServices.getText(jRadioButtonPreviewArea, "v1y"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1799 |
getJTextFieldVertex2Y().setText(last_Coordinates[3]); // Restore to the last value |
|
1800 |
return; |
|
1801 |
} |
|
1802 |
|
|
1803 |
getJTextFieldVertex2Y().setText(Double.toString(c2)); |
|
1804 |
} |
|
1805 |
else { |
|
1806 |
// If there has been an error -> can't move different distances in Y the two vertexes |
|
1807 |
if (d1 != d2) { |
|
1808 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "different_distances_in_Y"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1809 |
return; |
|
1810 |
} |
|
1811 |
} |
|
1812 |
} |
|
1813 |
|
|
1814 |
hasChanged_v1Y = false; |
|
1815 |
hasChanged_v2Y = false; |
|
1816 |
} |
|
1817 |
} |
|
1818 |
else { |
|
1819 |
boolean canSetExtent = true; |
|
1820 |
|
|
1821 |
// Check if there is a impossible coordinate |
|
1822 |
if (hasChanged_v1X) { |
|
1823 |
if (Double.parseDouble(getJTextFieldVertex1X().getText()) < Double.parseDouble(getJTextFieldVertex2X().getText())) { |
|
1824 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "v1x") + " < " + PluginServices.getText(jRadioButtonPreviewArea, "v2x"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1825 |
getJTextFieldVertex1X().setText(last_Coordinates[0]); // Restores its last value |
|
1826 |
canSetExtent = false; |
|
1827 |
} |
|
1828 |
|
|
1829 |
hasChanged_v1X = false; |
|
1830 |
} |
|
1831 |
|
|
1832 |
if (hasChanged_v1Y) { |
|
1833 |
if (Double.parseDouble(getJTextFieldVertex1Y().getText()) < Double.parseDouble(getJTextFieldVertex2Y().getText())) { |
|
1834 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "v1y") + " < " + PluginServices.getText(jRadioButtonPreviewArea, "v2y"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1835 |
getJTextFieldVertex1Y().setText(last_Coordinates[1]); // Restores its last value |
|
1836 |
canSetExtent = false; |
|
1837 |
} |
|
1838 |
|
|
1839 |
hasChanged_v1Y = false; |
|
1840 |
} |
|
1841 |
|
|
1842 |
if (hasChanged_v2X) { |
|
1843 |
if (Double.parseDouble(getJTextFieldVertex2X().getText()) > Double.parseDouble(getJTextFieldVertex1X().getText())) { |
|
1844 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "v2x") + " > " + PluginServices.getText(jRadioButtonPreviewArea, "v1x"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1845 |
getJTextFieldVertex2X().setText(last_Coordinates[2]); // Restores its last value |
|
1846 |
canSetExtent = false; |
|
1847 |
} |
|
1848 |
|
|
1849 |
hasChanged_v2X = false; |
|
1850 |
} |
|
1851 |
|
|
1852 |
if (hasChanged_v2Y) { |
|
1853 |
if (Double.parseDouble(getJTextFieldVertex2Y().getText()) > Double.parseDouble(getJTextFieldVertex1Y().getText())) { |
|
1854 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "v2y") + " > " + PluginServices.getText(jRadioButtonPreviewArea, "v1y"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE); |
|
1855 |
getJTextFieldVertex2Y().setText(last_Coordinates[3]); // Restores its last value |
|
1856 |
canSetExtent = false; |
|
1857 |
} |
|
1858 |
|
|
1859 |
hasChanged_v2Y = false; |
|
1860 |
} |
|
1861 |
|
|
1862 |
// If can set the new Extent -> finish |
|
1863 |
if (!canSetExtent) |
|
1864 |
return; |
|
1865 |
} |
|
1866 |
} |
|
1867 |
|
|
1868 |
//Rectangle2D r2d = vP.getExtent(); |
|
1869 |
if (vP.getExtent() != null){ |
|
1313 | 1870 |
// getCoordinatesPanel().setExtent(r2d); |
1314 | 1871 |
// getCoordinatesPanel().getJTextFieldVertex1X().setText(Double.toString(r2d.getMinX())); |
1315 | 1872 |
// getCoordinatesPanel().getJTextFieldVertex1Y().setText(Double.toString(r2d.getMinY())); |
1316 | 1873 |
// getCoordinatesPanel().getJTextFieldVertex2X().setText(Double.toString(r2d.getMaxX())); |
1317 | 1874 |
// getCoordinatesPanel().getJTextFieldVertex2Y().setText(Double.toString(r2d.getMaxY())); |
1318 |
r2d.setRect(Double.parseDouble(getJTextFieldVertex1X().getText()), Double.parseDouble(getJTextFieldVertex1Y().getText()), Math.abs(Double.parseDouble(getJTextFieldVertex2X().getText()) - Double.parseDouble(getJTextFieldVertex1X().getText())), Math.abs(Double.parseDouble(getJTextFieldVertex2Y().getText()) - Double.parseDouble(getJTextFieldVertex1Y().getText()))); |
|
1875 |
//r2d.setRect(getNewRectangleByCoordinates()); |
|
1876 |
vP.setExtent(getNewRectangleByCoordinates()); |
|
1319 | 1877 |
vP.refreshExtent(); |
1320 | 1878 |
} |
1321 | 1879 |
} |
1322 | 1880 |
} |
1323 | 1881 |
else { |
1324 |
JOptionPane.showMessageDialog(jRadioButtonGoToArea, PluginServices.getText(null, "at_least_one_incorrect_coordinate"), PluginServices.getText(null, "error"), JOptionPane.ERROR_MESSAGE);
|
|
1882 |
JOptionPane.showMessageDialog(jRadioButtonPreviewArea, PluginServices.getText(jRadioButtonPreviewArea, "at_least_one_incorrect_coordinate"), PluginServices.getText(jRadioButtonPreviewArea, "error"), JOptionPane.ERROR_MESSAGE);
|
|
1325 | 1883 |
} |
1326 |
} |
|
1327 |
|
|
1328 |
public void mouseEntered(MouseEvent e) { |
|
1329 |
// TODO Auto-generated method stub |
|
1330 |
|
|
1331 |
} |
|
1332 |
|
|
1333 |
public void mouseExited(MouseEvent e) { |
|
1334 |
// TODO Auto-generated method stub |
|
1335 |
|
|
1336 |
} |
|
1337 |
|
|
1338 |
public void mousePressed(MouseEvent e) { |
|
1339 |
|
|
1340 |
|
|
1341 |
} |
|
1342 |
|
|
1343 |
public void mouseReleased(MouseEvent e) { |
|
1344 |
// TODO Auto-generated method stub |
|
1345 |
|
|
1346 |
} |
|
1347 |
|
|
1884 |
} |
|
1348 | 1885 |
}); |
1349 | 1886 |
} |
1350 |
return jRadioButtonGoToArea;
|
|
1887 |
return jRadioButtonPreviewArea;
|
|
1351 | 1888 |
} |
1889 |
|
|
1890 |
private Rectangle2D getNewRectangleByCoordinates() { |
|
1891 |
return new Rectangle2D.Double(Double.parseDouble(getJTextFieldVertex2X().getText()), Double.parseDouble(getJTextFieldVertex2Y().getText()), Double.parseDouble(getJTextFieldVertex1X().getText()) - Double.parseDouble(getJTextFieldVertex2X().getText()), Double.parseDouble(getJTextFieldVertex1Y().getText()) - Double.parseDouble(getJTextFieldVertex2Y().getText())); |
|
1892 |
// return new Rectangle2D.Double(Double.parseDouble(getJTextFieldVertex2X().getText()), Double.parseDouble(getJTextFieldVertex1Y().getText()), Double.parseDouble(getJTextFieldVertex1X().getText()) - Double.parseDouble(getJTextFieldVertex2X().getText()), Double.parseDouble(getJTextFieldVertex2Y().getText()) - Double.parseDouble(getJTextFieldVertex1Y().getText())); |
|
1893 |
} |
|
1352 | 1894 |
|
1353 | 1895 |
/** |
1354 | 1896 |
* Sets the extent |
1355 | 1897 |
* @param extent |
1356 | 1898 |
*/ |
1357 | 1899 |
public void setExtent(Rectangle2D extent){ |
1358 |
getJTextFieldVertex1X().setText(String.valueOf(extent.getMinX()));
|
|
1359 |
getJTextFieldVertex1Y().setText(String.valueOf(extent.getMinY()));
|
|
1360 |
getJTextFieldVertex2X().setText(String.valueOf(extent.getMaxX()));
|
|
1361 |
getJTextFieldVertex2Y().setText(String.valueOf(extent.getMaxY()));
|
|
1900 |
getJTextFieldVertex1X().setText(String.valueOf(extent.getMaxX()));
|
|
1901 |
getJTextFieldVertex1Y().setText(String.valueOf(extent.getMaxY()));
|
|
1902 |
getJTextFieldVertex2X().setText(String.valueOf(extent.getMinX()));
|
|
1903 |
getJTextFieldVertex2Y().setText(String.valueOf(extent.getMinY()));
|
|
1362 | 1904 |
} |
1363 | 1905 |
|
1364 | 1906 |
/** |
... | ... | |
1394 | 1936 |
// public void updateCoordinates(Rectangle r) { |
1395 | 1937 |
// |
1396 | 1938 |
// } |
1939 |
|
|
1940 |
/** |
|
1941 |
* Updates the inner attribute that stores the values of the last coordinates |
|
1942 |
*/ |
|
1943 |
private void updateLastCoordinates() { |
|
1944 |
last_Coordinates[0] = getJTextFieldVertex1X().getText(); |
|
1945 |
last_Coordinates[1] = getJTextFieldVertex1Y().getText(); |
|
1946 |
last_Coordinates[2] = getJTextFieldVertex2X().getText(); |
|
1947 |
last_Coordinates[3] = getJTextFieldVertex2Y().getText(); |
|
1948 |
} |
|
1397 | 1949 |
} |
1398 | 1950 |
|
1399 | 1951 |
/** |
... | ... | |
1402 | 1954 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com) |
1403 | 1955 |
*/ |
1404 | 1956 |
private class SelectableMapControlAreaPanel extends MapControl implements Serializable { |
1405 |
private MouseListener[] mouseListeners; |
|
1957 |
private MouseListener[] mouseListeners; |
|
1958 |
private MouseWheelListener[] mouseWheelListeners; |
|
1959 |
private MouseMotionListener[] mouseMotionListeners; |
|
1406 | 1960 |
|
1407 | 1961 |
public SelectableMapControlAreaPanel() { |
1408 | 1962 |
super(); |
... | ... | |
1455 | 2009 |
try { |
1456 | 2010 |
MapContext mp = ((View) PluginServices.getMDIManager().getActiveWindow()).getMapControl().getMapContext(); |
1457 | 2011 |
this.setMapContext(mp.cloneFMap()); |
2012 |
this.getViewPort().refreshExtent(); |
|
2013 |
|
|
1458 | 2014 |
} catch (XMLException e) { |
1459 | 2015 |
e.printStackTrace(); |
1460 | 2016 |
} |
... | ... | |
1756 | 2312 |
getCoordinatesPanel().setExtent(r2d); |
1757 | 2313 |
|
1758 | 2314 |
getJButtonZoomPrevious().setEnabled(true); |
2315 |
getJButtonUndo().setEnabled(true); |
|
1759 | 2316 |
} |
1760 |
else |
|
2317 |
else {
|
|
1761 | 2318 |
getJButtonZoomPrevious().setEnabled(false); |
2319 |
getJButtonUndo().setEnabled(false); |
|
2320 |
} |
|
1762 | 2321 |
|
1763 | 2322 |
// View activeView = |
1764 | 2323 |
// (View) PluginServices.getMDIManager().getActiveWindow(); |
... | ... | |
1821 | 2380 |
disableAllMouseListeners(); |
1822 | 2381 |
} |
1823 | 2382 |
|
1824 |
private void disableAllMouseListeners() { |
|
2383 |
public void disableAllMouseListeners() { |
|
2384 |
int i; |
|
2385 |
|
|
1825 | 2386 |
// Only disable listeners if there are listeners to remove (it's supposed that there are always the same number of mouse listeners, and this listeners |
1826 | 2387 |
// are referenciated by this component or by the private attribute 'mouseListeners') |
2388 |
|
|
2389 |
// Mouse Button Listeners |
|
1827 | 2390 |
if (mouseListeners == null) { |
1828 | 2391 |
mouseListeners = this.getMouseListeners(); |
1829 | 2392 |
|
1830 |
for (int i = 0; i < mouseListeners.length; i++) {
|
|
2393 |
for (i = 0; i < mouseListeners.length; i++) { |
|
1831 | 2394 |
removeMouseListener(mouseListeners[i]); |
1832 | 2395 |
} |
1833 | 2396 |
} |
2397 |
|
|
2398 |
// Mouse Wheel Listeners |
|
2399 |
if (mouseWheelListeners == null) { |
|
2400 |
mouseWheelListeners = this.getMouseWheelListeners(); |
|
2401 |
|
|
2402 |
for (i = 0; i < mouseWheelListeners.length; i++) { |
|
2403 |
removeMouseWheelListener(mouseWheelListeners[i]); |
|
2404 |
} |
|
2405 |
} |
|
2406 |
|
|
2407 |
// Mouse motion listeners |
|
2408 |
if (mouseMotionListeners == null) { |
|
2409 |
mouseMotionListeners = this.getMouseMotionListeners(); |
|
2410 |
|
|
2411 |
for (i = 0; i < mouseMotionListeners.length; i++) { |
|
2412 |
removeMouseMotionListener(mouseMotionListeners[i]); |
|
2413 |
} |
|
2414 |
} |
|
1834 | 2415 |
} |
1835 |
|
|
1836 |
private void enableAllMouseListeners() { |
|
1837 |
for (int i = 0; i < mouseListeners.length; i++) { |
|
2416 |
|
|
2417 |
public void enableAllMouseListeners() { |
|
2418 |
int i; |
|
2419 |
|
|
2420 |
// Mouse Button Listeners |
|
2421 |
for (i = 0; i < mouseListeners.length; i++) { |
|
1838 | 2422 |
addMouseListener(mouseListeners[i]); |
1839 | 2423 |
} |
2424 |
|
|
2425 |
mouseListeners = null; |
|
2426 |
|
|
2427 |
// Mouse Wheel Listeners |
|
2428 |
for (i = 0; i < mouseWheelListeners.length; i++) { |
|
2429 |
addMouseWheelListener(mouseWheelListeners[i]); |
|
2430 |
} |
|
2431 |
|
|
2432 |
mouseWheelListeners = null; |
|
2433 |
|
|
2434 |
// Mouse motion listeners |
|
2435 |
for (i = 0; i < mouseMotionListeners.length; i++) { |
|
2436 |
addMouseMotionListener(mouseMotionListeners[i]); |
|
2437 |
} |
|
2438 |
|
|
2439 |
mouseMotionListeners = null; |
|
1840 | 2440 |
} |
1841 | 2441 |
} |
1842 | 2442 |
} |
Also available in: Unified diff