Merge lp:~yrke/tapaal/cleanup-selectionmanager into lp:tapaal

Proposed by Kenneth Yrke Jørgensen
Status: Merged
Approved by: Jiri Srba
Approved revision: 976
Merged at revision: 976
Proposed branch: lp:~yrke/tapaal/cleanup-selectionmanager
Merge into: lp:tapaal
Diff against target: 107 lines (+1/-57)
1 file modified
src/pipe/gui/SelectionManager.java (+1/-57)
To merge this branch: bzr merge lp:~yrke/tapaal/cleanup-selectionmanager
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Review via email: mp+355536@code.launchpad.net

Commit message

Removed unused function, remove useless comments and code reformatting

Description of the change

Code fixes only, no changes in behavior

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/pipe/gui/SelectionManager.java'
2--- src/pipe/gui/SelectionManager.java 2018-04-11 23:20:44 +0000
3+++ src/pipe/gui/SelectionManager.java 2018-09-24 12:02:46 +0000
4@@ -28,9 +28,6 @@
5 java.awt.event.MouseListener, java.awt.event.MouseWheelListener,
6 java.awt.event.MouseMotionListener {
7
8- /**
9- *
10- */
11 private static final long serialVersionUID = 9057152447545103393L;
12 private Point startPoint;
13 private Rectangle selectionRectangle = new Rectangle(-1, -1);
14@@ -174,19 +171,13 @@
15 return selection;
16 }
17
18- /*
19- * (non-Javadoc)
20- *
21- * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
22- */
23 public void mousePressed(MouseEvent e) {
24 CreateGui.getCurrentTab().removeConstantHighlights();
25 if (e.getButton() == MouseEvent.BUTTON1 && !(e.isControlDown())) {
26 isSelecting = true;
27 drawingSurface.setLayer(this, Pipe.SELECTION_LAYER_OFFSET);
28 startPoint = e.getPoint();
29- selectionRectangle.setRect(startPoint.getX(), startPoint.getY(), 0,
30- 0);
31+ selectionRectangle.setRect(startPoint.getX(), startPoint.getY(), 0, 0);
32 // Select anything that intersects with the rectangle.
33 processSelection(e);
34 repaint();
35@@ -195,12 +186,6 @@
36 }
37 }
38
39- /*
40- * (non-Javadoc)
41- *
42- * @see
43- * java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
44- */
45 public void mouseReleased(MouseEvent e) {
46 if (isSelecting) {
47 // Select anything that intersects with the rectangle.
48@@ -212,13 +197,6 @@
49 }
50 }
51
52- /*
53- * (non-Javadoc)
54- *
55- * @see
56- * java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent
57- * )
58- */
59 public void mouseDragged(MouseEvent e) {
60 if(CreateGui.getApp().getGUIMode().equals(GUIMode.animation)) return;
61
62@@ -255,12 +233,6 @@
63 public void mouseExited(MouseEvent e) {
64 }
65
66- /*
67- * (non-Javadoc)
68- *
69- * @see
70- * java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)
71- */
72 public void mouseMoved(MouseEvent e) {
73 }
74
75@@ -272,32 +244,4 @@
76 drawingSurface.repaint();
77 }
78
79- public int getSelectionCount() {
80- Component[] netObj = drawingSurface.getComponents();
81- int selectionCount = 0;
82- // Get all the objects in the current window
83- for (int i = 0; i < netObj.length; i++) {
84- // Handle Arcs and Arc Points
85- if ((netObj[i] instanceof Arc)
86- && ((PetriNetObject) netObj[i]).isSelectable()) {
87- Arc thisArc = (Arc) netObj[i];
88- ArcPath thisArcPath = thisArc.getArcPath();
89- for (int j = 1; j < thisArcPath.getEndIndex(); j++) {
90- if (thisArcPath.isPointSelected(j)) {
91- selectionCount++;
92- }
93- }
94- }
95-
96- // Handle PlaceTransition Objects
97- if ((netObj[i] instanceof PlaceTransitionObject)
98- && ((PetriNetObject) netObj[i]).isSelectable()) {
99- if (((PlaceTransitionObject) netObj[i]).isSelected()) {
100- selectionCount++;
101- }
102- }
103- }
104- return selectionCount;
105- }
106-
107 }

Subscribers

People subscribed via source and target branches