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
=== modified file 'src/pipe/gui/SelectionManager.java'
--- src/pipe/gui/SelectionManager.java 2018-04-11 23:20:44 +0000
+++ src/pipe/gui/SelectionManager.java 2018-09-24 12:02:46 +0000
@@ -28,9 +28,6 @@
28 java.awt.event.MouseListener, java.awt.event.MouseWheelListener,28 java.awt.event.MouseListener, java.awt.event.MouseWheelListener,
29 java.awt.event.MouseMotionListener {29 java.awt.event.MouseMotionListener {
3030
31 /**
32 *
33 */
34 private static final long serialVersionUID = 9057152447545103393L;31 private static final long serialVersionUID = 9057152447545103393L;
35 private Point startPoint;32 private Point startPoint;
36 private Rectangle selectionRectangle = new Rectangle(-1, -1);33 private Rectangle selectionRectangle = new Rectangle(-1, -1);
@@ -174,19 +171,13 @@
174 return selection;171 return selection;
175 }172 }
176173
177 /*
178 * (non-Javadoc)
179 *
180 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
181 */
182 public void mousePressed(MouseEvent e) {174 public void mousePressed(MouseEvent e) {
183 CreateGui.getCurrentTab().removeConstantHighlights();175 CreateGui.getCurrentTab().removeConstantHighlights();
184 if (e.getButton() == MouseEvent.BUTTON1 && !(e.isControlDown())) {176 if (e.getButton() == MouseEvent.BUTTON1 && !(e.isControlDown())) {
185 isSelecting = true;177 isSelecting = true;
186 drawingSurface.setLayer(this, Pipe.SELECTION_LAYER_OFFSET);178 drawingSurface.setLayer(this, Pipe.SELECTION_LAYER_OFFSET);
187 startPoint = e.getPoint();179 startPoint = e.getPoint();
188 selectionRectangle.setRect(startPoint.getX(), startPoint.getY(), 0,180 selectionRectangle.setRect(startPoint.getX(), startPoint.getY(), 0, 0);
189 0);
190 // Select anything that intersects with the rectangle.181 // Select anything that intersects with the rectangle.
191 processSelection(e);182 processSelection(e);
192 repaint();183 repaint();
@@ -195,12 +186,6 @@
195 }186 }
196 }187 }
197188
198 /*
199 * (non-Javadoc)
200 *
201 * @see
202 * java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
203 */
204 public void mouseReleased(MouseEvent e) {189 public void mouseReleased(MouseEvent e) {
205 if (isSelecting) {190 if (isSelecting) {
206 // Select anything that intersects with the rectangle.191 // Select anything that intersects with the rectangle.
@@ -212,13 +197,6 @@
212 }197 }
213 }198 }
214199
215 /*
216 * (non-Javadoc)
217 *
218 * @see
219 * java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent
220 * )
221 */
222 public void mouseDragged(MouseEvent e) {200 public void mouseDragged(MouseEvent e) {
223 if(CreateGui.getApp().getGUIMode().equals(GUIMode.animation)) return;201 if(CreateGui.getApp().getGUIMode().equals(GUIMode.animation)) return;
224 202
@@ -255,12 +233,6 @@
255 public void mouseExited(MouseEvent e) {233 public void mouseExited(MouseEvent e) {
256 }234 }
257235
258 /*
259 * (non-Javadoc)
260 *
261 * @see
262 * java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)
263 */
264 public void mouseMoved(MouseEvent e) {236 public void mouseMoved(MouseEvent e) {
265 }237 }
266238
@@ -272,32 +244,4 @@
272 drawingSurface.repaint();244 drawingSurface.repaint();
273 }245 }
274246
275 public int getSelectionCount() {
276 Component[] netObj = drawingSurface.getComponents();
277 int selectionCount = 0;
278 // Get all the objects in the current window
279 for (int i = 0; i < netObj.length; i++) {
280 // Handle Arcs and Arc Points
281 if ((netObj[i] instanceof Arc)
282 && ((PetriNetObject) netObj[i]).isSelectable()) {
283 Arc thisArc = (Arc) netObj[i];
284 ArcPath thisArcPath = thisArc.getArcPath();
285 for (int j = 1; j < thisArcPath.getEndIndex(); j++) {
286 if (thisArcPath.isPointSelected(j)) {
287 selectionCount++;
288 }
289 }
290 }
291
292 // Handle PlaceTransition Objects
293 if ((netObj[i] instanceof PlaceTransitionObject)
294 && ((PetriNetObject) netObj[i]).isSelectable()) {
295 if (((PlaceTransitionObject) netObj[i]).isSelected()) {
296 selectionCount++;
297 }
298 }
299 }
300 return selectionCount;
301 }
302
303}247}

Subscribers

People subscribed via source and target branches