Merge lp:~yrke/tapaal/fix-1887770-and-1887771-ContextMenuForArcs into lp:tapaal

Proposed by Kenneth Yrke Jørgensen
Status: Merged
Approved by: Jiri Srba
Approved revision: 1072
Merged at revision: 1073
Proposed branch: lp:~yrke/tapaal/fix-1887770-and-1887771-ContextMenuForArcs
Merge into: lp:tapaal
Diff against target: 103 lines (+16/-14)
4 files modified
src/dk/aau/cs/gui/TabContent.java (+4/-0)
src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java (+2/-1)
src/pipe/gui/graphicElements/tapn/TimedTransportArcComponent.java (+2/-3)
src/pipe/gui/handler/TimedArcHandler.java (+8/-10)
To merge this branch: bzr merge lp:~yrke/tapaal/fix-1887770-and-1887771-ContextMenuForArcs
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Kenneth Yrke Jørgensen Needs Resubmitting
Review via email: mp+387504@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) wrote :

Seems to work but rightclicking on output arc and selecting properties raises an exception on moc:

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: class pipe.gui.graphicElements.tapn.TimedOutputArcComponent cannot be cast to class pipe.gui.graphicElements.tapn.TimedInputArcComponent (pipe.gui.graphicElements.tapn.TimedOutputArcComponent and pipe.gui.graphicElements.tapn.TimedInputArcComponent are in unnamed module of loader 'app')
        at pipe.gui.handler.TimedArcHandler.lambda$getPopup$0(TimedArcHandler.java:27)
        at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
        at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
        at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
        at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
        at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:369)
        at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1020)

review: Needs Fixing
1072. By Kenneth Yrke Jørgensen

Fixed wrong cast in TimedArcHandler for output arcs

Revision history for this message
Kenneth Yrke Jørgensen (yrke) wrote :

Good catch, its fixed, was a wrong cast.

review: Needs Resubmitting
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/dk/aau/cs/gui/TabContent.java'
--- src/dk/aau/cs/gui/TabContent.java 2020-08-03 11:14:55 +0000
+++ src/dk/aau/cs/gui/TabContent.java 2020-08-04 07:42:41 +0000
@@ -2457,6 +2457,10 @@
2457 e->e.pno instanceof Arc && e.a == MouseAction.doubleClicked && e.e.isControlDown(),2457 e->e.pno instanceof Arc && e.a == MouseAction.doubleClicked && e.e.isControlDown(),
2458 e->arcDoubleClickedWithContrl(((Arc) e.pno), e.e)2458 e->arcDoubleClickedWithContrl(((Arc) e.pno), e.e)
2459 );2459 );
2460 registerEvent(
2461 e->e.pno instanceof TimedOutputArcComponent && e.a == MouseAction.doubleClicked && !e.e.isControlDown(),
2462 e -> ((TimedOutputArcComponent) e.pno).showTimeIntervalEditor()
2463 );
24602464
2461 }2465 }
24622466
24632467
=== modified file 'src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java'
--- src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java 2020-06-23 07:22:17 +0000
+++ src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java 2020-08-04 07:42:41 +0000
@@ -14,6 +14,7 @@
14import pipe.gui.graphicElements.ArcPath;14import pipe.gui.graphicElements.ArcPath;
15import pipe.gui.graphicElements.PlaceTransitionObject;15import pipe.gui.graphicElements.PlaceTransitionObject;
16import pipe.gui.handler.ArcHandler;16import pipe.gui.handler.ArcHandler;
17import pipe.gui.handler.TimedArcHandler;
17import pipe.gui.undo.ArcTimeIntervalEdit;18import pipe.gui.undo.ArcTimeIntervalEdit;
18import pipe.gui.widgets.EscapableDialog;19import pipe.gui.widgets.EscapableDialog;
19import pipe.gui.widgets.GuardDialogue;20import pipe.gui.widgets.GuardDialogue;
@@ -67,7 +68,7 @@
67 protected void addMouseHandler() {68 protected void addMouseHandler() {
68 //XXX: kyrke 2018-09-06, this is bad as we leak "this", think its ok for now, as it alwas constructed when69 //XXX: kyrke 2018-09-06, this is bad as we leak "this", think its ok for now, as it alwas constructed when
69 //XXX: handler is called. Make static constructor and add handler from there, to make it safe.70 //XXX: handler is called. Make static constructor and add handler from there, to make it safe.
70 mouseHandler = new ArcHandler(this);71 mouseHandler = new TimedArcHandler(this);
71 }72 }
7273
7374
7475
=== modified file 'src/pipe/gui/graphicElements/tapn/TimedTransportArcComponent.java'
--- src/pipe/gui/graphicElements/tapn/TimedTransportArcComponent.java 2020-06-23 09:02:28 +0000
+++ src/pipe/gui/graphicElements/tapn/TimedTransportArcComponent.java 2020-08-04 07:42:41 +0000
@@ -3,11 +3,10 @@
3import java.awt.Polygon;3import java.awt.Polygon;
4import java.util.Hashtable;4import java.util.Hashtable;
55
6import com.sun.jdi.connect.Transport;
7import pipe.gui.CreateGui;6import pipe.gui.CreateGui;
8import pipe.gui.Pipe;7import pipe.gui.Pipe;
9import pipe.gui.graphicElements.PlaceTransitionObject;8import pipe.gui.graphicElements.PlaceTransitionObject;
10import pipe.gui.handler.TransportArcHandler;9import pipe.gui.handler.TimedArcHandler;
11import pipe.gui.undo.ArcTimeIntervalEdit;10import pipe.gui.undo.ArcTimeIntervalEdit;
12import dk.aau.cs.gui.undo.Command;11import dk.aau.cs.gui.undo.Command;
13import dk.aau.cs.model.tapn.ConstantBound;12import dk.aau.cs.model.tapn.ConstantBound;
@@ -68,7 +67,7 @@
68 protected void addMouseHandler() {67 protected void addMouseHandler() {
69 //XXX: kyrke 2018-09-06, this is bad as we leak "this", think its ok for now, as it alwas constructed when68 //XXX: kyrke 2018-09-06, this is bad as we leak "this", think its ok for now, as it alwas constructed when
70 //XXX: handler is called. Make static constructor and add handler from there, to make it safe.69 //XXX: handler is called. Make static constructor and add handler from there, to make it safe.
71 mouseHandler = new TransportArcHandler(this);70 mouseHandler = new TimedArcHandler(this);
72 }71 }
7372
74 public void setUnderlyingArc(TransportArc arc) {73 public void setUnderlyingArc(TransportArc arc) {
7574
=== modified file 'src/pipe/gui/handler/TimedArcHandler.java'
--- src/pipe/gui/handler/TimedArcHandler.java 2020-07-03 06:46:54 +0000
+++ src/pipe/gui/handler/TimedArcHandler.java 2020-08-04 07:42:41 +0000
@@ -5,10 +5,12 @@
5import javax.swing.JMenuItem;5import javax.swing.JMenuItem;
6import javax.swing.JPopupMenu;6import javax.swing.JPopupMenu;
77
8import dk.aau.cs.model.tapn.TimedOutputArc;
8import pipe.gui.action.SplitArcAction;9import pipe.gui.action.SplitArcAction;
9import pipe.gui.graphicElements.Arc;10import pipe.gui.graphicElements.Arc;
10import pipe.gui.graphicElements.tapn.TimedInhibitorArcComponent;11import pipe.gui.graphicElements.tapn.TimedInhibitorArcComponent;
11import pipe.gui.graphicElements.tapn.TimedInputArcComponent;12import pipe.gui.graphicElements.tapn.TimedInputArcComponent;
13import pipe.gui.graphicElements.tapn.TimedOutputArcComponent;
12import pipe.gui.graphicElements.tapn.TimedTransportArcComponent;14import pipe.gui.graphicElements.tapn.TimedTransportArcComponent;
1315
14public class TimedArcHandler extends ArcHandler {16public class TimedArcHandler extends ArcHandler {
@@ -23,16 +25,12 @@
23 JMenuItem menuItem;25 JMenuItem menuItem;
24 JPopupMenu popup = super.getPopup(e);26 JPopupMenu popup = super.getPopup(e);
2527
26 if (myObject instanceof TimedInputArcComponent && !(myObject instanceof TimedTransportArcComponent)) {28 menuItem = new JMenuItem("Properties");
2729 menuItem.addActionListener(e1 -> ((TimedOutputArcComponent) myObject).showTimeIntervalEditor());
28 if (!(myObject instanceof TimedInhibitorArcComponent)) {30 popup.insert(menuItem, popupIndex++);
29 menuItem = new JMenuItem("Properties");31
30 menuItem.addActionListener(e1 -> ((TimedInputArcComponent) myObject).showTimeIntervalEditor());32 popup.insert(new JPopupMenu.Separator(), popupIndex);
31 popup.insert(menuItem, popupIndex++);33
32 }
33
34 popup.insert(new JPopupMenu.Separator(), popupIndex);
35 }
36 return popup;34 return popup;
37 }35 }
38}36}
3937
=== removed file 'src/pipe/gui/handler/TransportArcHandler.java'

Subscribers

People subscribed via source and target branches