~tapaal-contributor/tapaal/update-zoom-percentage-on-ctrl+scroll-1785023

« back to all changes in this revision

Viewing changes to src/pipe/gui/graphicElements/ArcPath.java

Merged bzr merge lp:~yrke/tapaal/placetransitionobjecthandler-refactor with cleanup 
and refactorings of elements and handlers

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 * 
30
30
 * @author Pere Bonet: modified the weight label placement
31
31
 */
32
 
public class ArcPath implements Shape, Cloneable {
 
32
public class ArcPath implements Shape {
33
33
 
34
34
        private GeneralPath path = new GeneralPath();
35
35
        private List<ArcPathPoint> pathPoints = new ArrayList<ArcPathPoint>();
616
616
                        // Nadeem 21/06/2005
617
617
                        if (editWindow.getIndexOf(pathPoint) < 0) {
618
618
                                editWindow.add(pathPoint);
619
 
 
620
 
                                pointHandler = new ArcPathPointHandler(editWindow, pathPoint);
621
 
 
622
 
                                if (pathPoint.getMouseListeners().length == 0) {
623
 
                                        pathPoint.addMouseListener(pointHandler);
624
 
                                }
625
 
 
626
 
                                if (pathPoint.getMouseMotionListeners().length == 0) {
627
 
                                        pathPoint.addMouseMotionListener(pointHandler);
628
 
                                }
629
 
 
630
 
//                              if (pathPoint.getMouseWheelListeners().length == 0) {
631
 
//                                      pathPoint.addMouseWheelListener(pointHandler);
632
 
//                              }
633
 
                                pathPoint.updatePointLocation();
634
 
                        }
635
 
                }
636
 
        }
637
 
 
638
 
        public void addPointsToGui(JLayeredPane editWindow) {
639
 
                ArcPathPoint pathPoint;
640
 
                ArcPathPointHandler pointHandler;
641
 
 
642
 
                (pathPoints.get(0)).setDraggable(false);
643
 
                (pathPoints.get(pathPoints.size() - 1)).setDraggable(false);
644
 
 
645
 
                for (int i = 0; i < pathPoints.size(); i++) {
646
 
                        pathPoint = pathPoints.get(i);
647
 
                        pathPoint.setVisible(false);
648
 
 
649
 
                        // Check whether the point has already been added to the gui
650
 
                        // as addPointsToGui() may have been called after the user
651
 
                        // split an existing point. If this is the case, we don't want
652
 
                        // to add all the points again along with new action listeners,
653
 
                        // we just want to add the new point.
654
 
                        // Nadeem 21/06/2005
655
 
                        if (editWindow.getIndexOf(pathPoint) < 0) {
656
 
                                editWindow.add(pathPoint);
657
 
                                pointHandler = new ArcPathPointHandler(editWindow, pathPoint);
658
 
 
659
 
                                if (pathPoint.getMouseListeners().length == 0) {
660
 
                                        pathPoint.addMouseListener(pointHandler);
661
 
                                }
662
 
 
663
 
                                if (pathPoint.getMouseMotionListeners().length == 0) {
664
 
                                        pathPoint.addMouseMotionListener(pointHandler);
665
 
                                }
666
 
 
667
 
//                              if (pathPoint.getMouseWheelListeners().length == 0) {
668
 
//                                      pathPoint.addMouseWheelListener(pointHandler);
669
 
//                              }
670
 
                                pathPoint.updatePointLocation();
671
 
                        }
672
 
                }
673
 
        }
 
619
                                pathPoint.updatePointLocation();
 
620
                        }
 
621
                }
 
622
        }
 
623
 
 
624
 
674
625
 
675
626
        public void delete() { // Michael: Tells the arc points to remove themselves
676
627
                while (!pathPoints.isEmpty()) {
714
665
         */
715
666
        public void insertPoint(int index, ArcPathPoint newpoint) {
716
667
                pathPoints.add(index, newpoint);
717
 
                if (myArc.getParent() instanceof DrawingSurfaceImpl) {
718
 
                        addPointsToGui((DrawingSurfaceImpl) myArc.getParent());
719
 
                } else {
720
 
                        addPointsToGui((JLayeredPane) myArc.getParent());
721
 
                }
 
668
 
 
669
                addPointsToGui((DrawingSurfaceImpl) myArc.getParent());
 
670
 
722
671
        }
723
672
 
724
673
        /**