Merge lp:~tapaal-contributor/tapaal/untimed-timed-gui into lp:tapaal

Proposed by Peter Haahr Taankvist
Status: Merged
Approved by: Jiri Srba
Approved revision: 1105
Merged at revision: 1084
Proposed branch: lp:~tapaal-contributor/tapaal/untimed-timed-gui
Merge into: lp:tapaal
Diff against target: 3103 lines (+872/-562)
60 files modified
src/dk/aau/cs/TCTL/AritmeticOperator.java (+6/-1)
src/dk/aau/cs/TCTL/TCTLAFNode.java (+7/-2)
src/dk/aau/cs/TCTL/TCTLAGNode.java (+6/-1)
src/dk/aau/cs/TCTL/TCTLAUNode.java (+8/-2)
src/dk/aau/cs/TCTL/TCTLAXNode.java (+7/-2)
src/dk/aau/cs/TCTL/TCTLAbstractProperty.java (+1/-1)
src/dk/aau/cs/TCTL/TCTLAndListNode.java (+14/-1)
src/dk/aau/cs/TCTL/TCTLAtomicPropositionNode.java (+6/-1)
src/dk/aau/cs/TCTL/TCTLConstNode.java (+6/-1)
src/dk/aau/cs/TCTL/TCTLDeadlockNode.java (+6/-1)
src/dk/aau/cs/TCTL/TCTLEFNode.java (+6/-1)
src/dk/aau/cs/TCTL/TCTLEGNode.java (+7/-2)
src/dk/aau/cs/TCTL/TCTLEUNode.java (+7/-1)
src/dk/aau/cs/TCTL/TCTLEXNode.java (+7/-2)
src/dk/aau/cs/TCTL/TCTLFalseNode.java (+6/-1)
src/dk/aau/cs/TCTL/TCTLNotNode.java (+6/-1)
src/dk/aau/cs/TCTL/TCTLOrListNode.java (+14/-1)
src/dk/aau/cs/TCTL/TCTLPathPlaceHolder.java (+6/-1)
src/dk/aau/cs/TCTL/TCTLPathToStateConverter.java (+7/-2)
src/dk/aau/cs/TCTL/TCTLPlaceNode.java (+6/-1)
src/dk/aau/cs/TCTL/TCTLPlusListNode.java (+6/-1)
src/dk/aau/cs/TCTL/TCTLStatePlaceHolder.java (+6/-1)
src/dk/aau/cs/TCTL/TCTLStateToPathConverter.java (+7/-2)
src/dk/aau/cs/TCTL/TCTLTermListNode.java (+6/-1)
src/dk/aau/cs/TCTL/TCTLTransitionNode.java (+6/-1)
src/dk/aau/cs/TCTL/TCTLTrueNode.java (+6/-1)
src/dk/aau/cs/gui/TabContent.java (+298/-71)
src/dk/aau/cs/gui/TabContentActions.java (+4/-0)
src/dk/aau/cs/gui/TabTransformer.java (+6/-3)
src/dk/aau/cs/gui/components/EnabledTransitionsList.java (+3/-2)
src/dk/aau/cs/gui/components/TransitionFireingComponent.java (+9/-5)
src/dk/aau/cs/io/LoadedModel.java (+13/-11)
src/dk/aau/cs/io/PNMLoader.java (+8/-6)
src/dk/aau/cs/io/TapnLegacyXmlLoader.java (+9/-9)
src/dk/aau/cs/io/TapnXmlLoader.java (+18/-33)
src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java (+10/-9)
src/dk/aau/cs/verification/TAPNComposer.java (+33/-25)
src/pipe/dataLayer/TAPNQuery.java (+10/-4)
src/pipe/gui/AnimationControlSidePanel.java (+23/-8)
src/pipe/gui/AnimationSettingsDialog.java (+13/-8)
src/pipe/gui/Animator.java (+4/-0)
src/pipe/gui/CreateGui.java (+4/-0)
src/pipe/gui/DelayEnabledTransitionControl.java (+6/-39)
src/pipe/gui/GuiFrame.java (+90/-166)
src/pipe/gui/GuiFrameActions.java (+9/-2)
src/pipe/gui/GuiFrameController.java (+3/-3)
src/pipe/gui/SimulationControl.java (+39/-6)
src/pipe/gui/StatusBar.java (+2/-93)
src/pipe/gui/action/GuiAction.java (+8/-0)
src/pipe/gui/canvas/DrawingSurfaceImpl.java (+4/-4)
src/pipe/gui/graphicElements/PetriNetObject.java (+11/-0)
src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java (+10/-2)
src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java (+1/-0)
src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java (+12/-7)
src/pipe/gui/graphicElements/tapn/TimedTransitionComponent.java (+8/-4)
src/pipe/gui/handler/PetriNetObjectHandler.java (+4/-4)
src/pipe/gui/widgets/GuardDialogue.java (+5/-1)
src/pipe/gui/widgets/PlaceEditorPanel.java (+11/-0)
src/pipe/gui/widgets/QueryPane.java (+1/-1)
src/pipe/gui/widgets/TAPNTransitionEditor.java (+7/-3)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/untimed-timed-gui
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Kenneth Yrke Jørgensen Approve
Peter Haahr Taankvist (community) Needs Resubmitting
Review via email: mp+388982@code.launchpad.net

Commit message

Hide time information if net is chosen to untimed.

To post a comment you must log in.
Revision history for this message
Kenneth Yrke Jørgensen (yrke) wrote :

please see DM.

review: Needs Fixing (code)
Revision history for this message
Peter Haahr Taankvist (ptaank) wrote :

Fixed an issue with pnObjects being set as untimed while actually being timed when opening files. DrawMenu will now be disabled if there are no available items (NoNet mode).

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

The logic for loading nets has changed in order to get this working correctly:

  - pnml nets imported will be untimed, nongame
  - old format TAPAAL files, will be timed, nongame
  - new format TAPAAL files:
     - if they have lens/feature: features set in file
     - if they do not have lense/feature: timed, nongame

We can readd the feature to detect the type in a later branch, if we really need it. But right now it complicates things more that whats it good for, and with the new dropdowns its easy to change the net types.

review: Approve
1099. By Kenneth Yrke Jørgensen

Merged trunk

Revision history for this message
Jiri Srba (srba) wrote :

Open intro example and go to simulator and select Setting. Even though the net is timed,
the dialog is reduced and does not contain the granuality, delay mode etc.

Also, please move Choose next transition randomly to "Simulation controller" so that this one shows for untimed nets.

Finally, the two arrows < and > in "Simulation Control" should be visible also for untimed nets.

review: Needs Fixing
Revision history for this message
Jiri Srba (srba) wrote :

Another issue: open intro example and untime it; then open the query and it shows the reachability dialog instead of CTL dialog.

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

> Another issue: open intro example and untime it; then open the query and it
> shows the reachability dialog instead of CTL dialog.

There is a similar issue if you go from an untimed net with CTL query to timed, the net will keep the CTL query. I guess we never implemented logic for converting queries.

1100. By Peter Haahr Taankvist

Show forward backward buttons in simulation mode. Show choose next transition randomly checkbox in simulation control in settings

1101. By Peter Haahr Taankvist

Remove affected queries when changing to timed. Show info message about queries

1102. By Peter Haahr Taankvist

Only show dialog if any queries have been removed

1103. By Peter Haahr Taankvist

Show CTL dialog if untimed, else show Reachability

Revision history for this message
Peter Haahr Taankvist (ptaank) wrote :

Moved "Choose next transition randomly" to simulation controller. Arrows in simulation mode are now visible. The QueryDialog will now use the lens to choose whether or not to show the CTL query or the Reachability query.

Finally, when converting to timed nets, CTL queries are removed and a dialog is shown informing about the removed queries.

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

insted of using the hasNestedPathQuantifiers function i guess it should implement a visitor. But I can see the files has already been modified in a similar way, so I guess it ok.

review: Approve
Revision history for this message
Jiri Srba (srba) wrote :

Open intro example and go to simulation mode. When you hover over places,
it shows { 0 } and if you hover over transitions, it shows [0, inf). These
should be disabled for untimed nets.

review: Needs Fixing
1104. By Peter Taankvist <email address hidden>

only show age of tokens if timed

1105. By Peter Taankvist <email address hidden>

Only show interval if net is timed

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/TCTL/AritmeticOperator.java'
--- src/dk/aau/cs/TCTL/AritmeticOperator.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/AritmeticOperator.java 2020-08-19 11:36:17 +0000
@@ -50,7 +50,12 @@
50 return false;50 return false;
51 }51 }
5252
53 @Override53 @Override
54 public boolean hasNestedPathQuantifiers() {
55 return false;
56 }
57
58 @Override
54 public TCTLAbstractProperty findFirstPlaceHolder() {59 public TCTLAbstractProperty findFirstPlaceHolder() {
55 return null;60 return null;
56 }61 }
5762
=== modified file 'src/dk/aau/cs/TCTL/TCTLAFNode.java'
--- src/dk/aau/cs/TCTL/TCTLAFNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLAFNode.java 2020-08-19 11:36:17 +0000
@@ -82,8 +82,13 @@
82 public boolean containsPlaceHolder() {82 public boolean containsPlaceHolder() {
83 return property.containsPlaceHolder();83 return property.containsPlaceHolder();
84 }84 }
85 85
86 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {86 @Override
87 public boolean hasNestedPathQuantifiers() {
88 return property instanceof TCTLPathToStateConverter || property.hasNestedPathQuantifiers();
89 }
90
91 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {
87 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);92 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);
88 }93 }
89 94
9095
=== modified file 'src/dk/aau/cs/TCTL/TCTLAGNode.java'
--- src/dk/aau/cs/TCTL/TCTLAGNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLAGNode.java 2020-08-19 11:36:17 +0000
@@ -84,7 +84,12 @@
84 return property.containsPlaceHolder();84 return property.containsPlaceHolder();
85 }85 }
8686
87 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {87 @Override
88 public boolean hasNestedPathQuantifiers() {
89 return property instanceof TCTLPathToStateConverter || property.hasNestedPathQuantifiers();
90 }
91
92 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {
88 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);93 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);
89 }94 }
90 95
9196
=== modified file 'src/dk/aau/cs/TCTL/TCTLAUNode.java'
--- src/dk/aau/cs/TCTL/TCTLAUNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLAUNode.java 2020-08-19 11:36:17 +0000
@@ -105,8 +105,14 @@
105 return left.containsPlaceHolder() 105 return left.containsPlaceHolder()
106 || right.containsPlaceHolder();106 || right.containsPlaceHolder();
107 }107 }
108 108
109 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {109 @Override
110 public boolean hasNestedPathQuantifiers() {
111 return left instanceof TCTLPathToStateConverter || right instanceof TCTLPathToStateConverter
112 || left.hasNestedPathQuantifiers() || right.hasNestedPathQuantifiers();
113 }
114
115 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {
110 return left.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName)116 return left.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName)
111 || right.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);117 || right.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);
112 }118 }
113119
=== modified file 'src/dk/aau/cs/TCTL/TCTLAXNode.java'
--- src/dk/aau/cs/TCTL/TCTLAXNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLAXNode.java 2020-08-19 11:36:17 +0000
@@ -82,8 +82,13 @@
82 public boolean containsPlaceHolder() {82 public boolean containsPlaceHolder() {
83 return property.containsPlaceHolder();83 return property.containsPlaceHolder();
84 }84 }
85 85
86 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {86 @Override
87 public boolean hasNestedPathQuantifiers() {
88 return property instanceof TCTLPathToStateConverter || property.hasNestedPathQuantifiers();
89 }
90
91 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {
87 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);92 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);
88 }93 }
89 94
9095
=== modified file 'src/dk/aau/cs/TCTL/TCTLAbstractProperty.java'
--- src/dk/aau/cs/TCTL/TCTLAbstractProperty.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLAbstractProperty.java 2020-08-19 11:36:17 +0000
@@ -57,7 +57,7 @@
57 public abstract boolean containsAtomicPropositionWithSpecificTransitionInTemplate(String templateName, String transitionName);57 public abstract boolean containsAtomicPropositionWithSpecificTransitionInTemplate(String templateName, String transitionName);
5858
59 public abstract boolean containsPlaceHolder();59 public abstract boolean containsPlaceHolder();
6060 public abstract boolean hasNestedPathQuantifiers();
61 // This method assumes that a place holder exists in the current query61 // This method assumes that a place holder exists in the current query
62 public abstract TCTLAbstractProperty findFirstPlaceHolder();62 public abstract TCTLAbstractProperty findFirstPlaceHolder();
6363
6464
=== modified file 'src/dk/aau/cs/TCTL/TCTLAndListNode.java'
--- src/dk/aau/cs/TCTL/TCTLAndListNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLAndListNode.java 2020-08-19 11:36:17 +0000
@@ -194,7 +194,20 @@
194 return placeHolderFound;194 return placeHolderFound;
195 }195 }
196196
197 @Override197 @Override
198 public boolean hasNestedPathQuantifiers() {
199 boolean foundNestedQuantifier = false;
200
201 for (TCTLAbstractStateProperty p : properties) {
202 foundNestedQuantifier = foundNestedQuantifier || p instanceof TCTLPathToStateConverter || p.hasNestedPathQuantifiers();
203 if(foundNestedQuantifier){
204 break;
205 }
206 }
207 return foundNestedQuantifier;
208 }
209
210 @Override
198 public TCTLAbstractProperty findFirstPlaceHolder() {211 public TCTLAbstractProperty findFirstPlaceHolder() {
199 TCTLAbstractProperty ph = null;212 TCTLAbstractProperty ph = null;
200 for (TCTLAbstractStateProperty p : properties) {213 for (TCTLAbstractStateProperty p : properties) {
201214
=== modified file 'src/dk/aau/cs/TCTL/TCTLAtomicPropositionNode.java'
--- src/dk/aau/cs/TCTL/TCTLAtomicPropositionNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLAtomicPropositionNode.java 2020-08-19 11:36:17 +0000
@@ -83,7 +83,12 @@
83 return left.containsPlaceHolder() || right.containsPlaceHolder();83 return left.containsPlaceHolder() || right.containsPlaceHolder();
84 }84 }
8585
86 @Override86 @Override
87 public boolean hasNestedPathQuantifiers() {
88 return false;
89 }
90
91 @Override
87 public TCTLAbstractProperty findFirstPlaceHolder() {92 public TCTLAbstractProperty findFirstPlaceHolder() {
88 TCTLAbstractProperty rightP = right.findFirstPlaceHolder(); 93 TCTLAbstractProperty rightP = right.findFirstPlaceHolder();
89 94
9095
=== modified file 'src/dk/aau/cs/TCTL/TCTLConstNode.java'
--- src/dk/aau/cs/TCTL/TCTLConstNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLConstNode.java 2020-08-19 11:36:17 +0000
@@ -54,7 +54,12 @@
54 return false;54 return false;
55 }55 }
5656
57 @Override57 @Override
58 public boolean hasNestedPathQuantifiers() {
59 return false;
60 }
61
62 @Override
58 public TCTLAbstractProperty findFirstPlaceHolder() {63 public TCTLAbstractProperty findFirstPlaceHolder() {
59 return null;64 return null;
60 }65 }
6166
=== modified file 'src/dk/aau/cs/TCTL/TCTLDeadlockNode.java'
--- src/dk/aau/cs/TCTL/TCTLDeadlockNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLDeadlockNode.java 2020-08-19 11:36:17 +0000
@@ -35,7 +35,12 @@
35 return false;35 return false;
36 }36 }
3737
38 public TCTLAbstractProperty findFirstPlaceHolder() {38 @Override
39 public boolean hasNestedPathQuantifiers() {
40 return false;
41 }
42
43 public TCTLAbstractProperty findFirstPlaceHolder() {
39 return null;44 return null;
40 }45 }
41 46
4247
=== modified file 'src/dk/aau/cs/TCTL/TCTLEFNode.java'
--- src/dk/aau/cs/TCTL/TCTLEFNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLEFNode.java 2020-08-19 11:36:17 +0000
@@ -83,7 +83,12 @@
83 return property.containsPlaceHolder();83 return property.containsPlaceHolder();
84 }84 }
8585
86 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {86 @Override
87 public boolean hasNestedPathQuantifiers() {
88 return property instanceof TCTLPathToStateConverter || property.hasNestedPathQuantifiers();
89 }
90
91 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {
87 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);92 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);
88 }93 }
89 94
9095
=== modified file 'src/dk/aau/cs/TCTL/TCTLEGNode.java'
--- src/dk/aau/cs/TCTL/TCTLEGNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLEGNode.java 2020-08-19 11:36:17 +0000
@@ -82,8 +82,13 @@
82 public boolean containsPlaceHolder() {82 public boolean containsPlaceHolder() {
83 return property.containsPlaceHolder();83 return property.containsPlaceHolder();
84 }84 }
85 85
86 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {86 @Override
87 public boolean hasNestedPathQuantifiers() {
88 return property instanceof TCTLPathToStateConverter || property.hasNestedPathQuantifiers();
89 }
90
91 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {
87 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);92 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);
88 }93 }
8994
9095
=== modified file 'src/dk/aau/cs/TCTL/TCTLEUNode.java'
--- src/dk/aau/cs/TCTL/TCTLEUNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLEUNode.java 2020-08-19 11:36:17 +0000
@@ -106,7 +106,13 @@
106 || right.containsPlaceHolder();106 || right.containsPlaceHolder();
107 }107 }
108108
109 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {109 @Override
110 public boolean hasNestedPathQuantifiers() {
111 return left instanceof TCTLPathToStateConverter || right instanceof TCTLPathToStateConverter
112 || left.hasNestedPathQuantifiers() || right.hasNestedPathQuantifiers();
113 }
114
115 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {
110 return left.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName)116 return left.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName)
111 || right.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);117 || right.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);
112 }118 }
113119
=== modified file 'src/dk/aau/cs/TCTL/TCTLEXNode.java'
--- src/dk/aau/cs/TCTL/TCTLEXNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLEXNode.java 2020-08-19 11:36:17 +0000
@@ -82,8 +82,13 @@
82 public boolean containsPlaceHolder() {82 public boolean containsPlaceHolder() {
83 return property.containsPlaceHolder();83 return property.containsPlaceHolder();
84 }84 }
85 85
86 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {86 @Override
87 public boolean hasNestedPathQuantifiers() {
88 return property instanceof TCTLPathToStateConverter || property.hasNestedPathQuantifiers();
89 }
90
91 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {
87 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);92 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);
88 }93 }
89 94
9095
=== modified file 'src/dk/aau/cs/TCTL/TCTLFalseNode.java'
--- src/dk/aau/cs/TCTL/TCTLFalseNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLFalseNode.java 2020-08-19 11:36:17 +0000
@@ -35,7 +35,12 @@
35 return false;35 return false;
36 }36 }
3737
38 public TCTLAbstractProperty findFirstPlaceHolder() {38 @Override
39 public boolean hasNestedPathQuantifiers() {
40 return false;
41 }
42
43 public TCTLAbstractProperty findFirstPlaceHolder() {
39 return null;44 return null;
40 }45 }
41 46
4247
=== modified file 'src/dk/aau/cs/TCTL/TCTLNotNode.java'
--- src/dk/aau/cs/TCTL/TCTLNotNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLNotNode.java 2020-08-19 11:36:17 +0000
@@ -88,7 +88,12 @@
88 return property.containsPlaceHolder();88 return property.containsPlaceHolder();
89 }89 }
9090
91 @Override91 @Override
92 public boolean hasNestedPathQuantifiers() {
93 return property instanceof TCTLPathToStateConverter || property.hasNestedPathQuantifiers();
94 }
95
96 @Override
92 public TCTLAbstractProperty findFirstPlaceHolder() {97 public TCTLAbstractProperty findFirstPlaceHolder() {
93 return property.findFirstPlaceHolder();98 return property.findFirstPlaceHolder();
9499
95100
=== modified file 'src/dk/aau/cs/TCTL/TCTLOrListNode.java'
--- src/dk/aau/cs/TCTL/TCTLOrListNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLOrListNode.java 2020-08-19 11:36:17 +0000
@@ -194,7 +194,20 @@
194 return placeHolderFound;194 return placeHolderFound;
195 }195 }
196196
197 @Override197 @Override
198 public boolean hasNestedPathQuantifiers() {
199 boolean foundNestedQuantifier = false;
200
201 for (TCTLAbstractStateProperty p : properties) {
202 foundNestedQuantifier = foundNestedQuantifier || p instanceof TCTLPathToStateConverter || p.hasNestedPathQuantifiers();
203 if(foundNestedQuantifier){
204 break;
205 }
206 }
207 return foundNestedQuantifier;
208 }
209
210 @Override
198 public TCTLAbstractProperty findFirstPlaceHolder() {211 public TCTLAbstractProperty findFirstPlaceHolder() {
199 TCTLAbstractProperty ph = null;212 TCTLAbstractProperty ph = null;
200 for (TCTLAbstractStateProperty p : properties) {213 for (TCTLAbstractStateProperty p : properties) {
201214
=== modified file 'src/dk/aau/cs/TCTL/TCTLPathPlaceHolder.java'
--- src/dk/aau/cs/TCTL/TCTLPathPlaceHolder.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLPathPlaceHolder.java 2020-08-19 11:36:17 +0000
@@ -26,7 +26,12 @@
26 return true;26 return true;
27 }27 }
2828
29 @Override29 @Override
30 public boolean hasNestedPathQuantifiers() {
31 return false;
32 }
33
34 @Override
30 public boolean equals(Object o) {35 public boolean equals(Object o) {
31 if (o instanceof TCTLPathPlaceHolder) {36 if (o instanceof TCTLPathPlaceHolder) {
32 return true;37 return true;
3338
=== modified file 'src/dk/aau/cs/TCTL/TCTLPathToStateConverter.java'
--- src/dk/aau/cs/TCTL/TCTLPathToStateConverter.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLPathToStateConverter.java 2020-08-19 11:36:17 +0000
@@ -76,8 +76,13 @@
76 public boolean containsPlaceHolder() {76 public boolean containsPlaceHolder() {
77 return property.containsPlaceHolder();77 return property.containsPlaceHolder();
78 }78 }
79 79
80 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {80 @Override
81 public boolean hasNestedPathQuantifiers() {
82 return false;
83 }
84
85 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {
81 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);86 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);
82 }87 }
83 88
8489
=== modified file 'src/dk/aau/cs/TCTL/TCTLPlaceNode.java'
--- src/dk/aau/cs/TCTL/TCTLPlaceNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLPlaceNode.java 2020-08-19 11:36:17 +0000
@@ -57,7 +57,12 @@
57 return false;57 return false;
58 }58 }
5959
60 @Override60 @Override
61 public boolean hasNestedPathQuantifiers() {
62 return false;
63 }
64
65 @Override
61 public TCTLAbstractProperty findFirstPlaceHolder() {66 public TCTLAbstractProperty findFirstPlaceHolder() {
62 return null;67 return null;
63 }68 }
6469
=== modified file 'src/dk/aau/cs/TCTL/TCTLPlusListNode.java'
--- src/dk/aau/cs/TCTL/TCTLPlusListNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLPlusListNode.java 2020-08-19 11:36:17 +0000
@@ -84,7 +84,12 @@
84 return false;84 return false;
85 }85 }
8686
87 @Override87 @Override
88 public boolean hasNestedPathQuantifiers() {
89 return false;
90 }
91
92 @Override
88 public TCTLAbstractProperty findFirstPlaceHolder() {93 public TCTLAbstractProperty findFirstPlaceHolder() {
89 for(TCTLAbstractStateProperty term : terms){94 for(TCTLAbstractStateProperty term : terms){
90 TCTLAbstractProperty placeholder = term.findFirstPlaceHolder(); 95 TCTLAbstractProperty placeholder = term.findFirstPlaceHolder();
9196
=== modified file 'src/dk/aau/cs/TCTL/TCTLStatePlaceHolder.java'
--- src/dk/aau/cs/TCTL/TCTLStatePlaceHolder.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLStatePlaceHolder.java 2020-08-19 11:36:17 +0000
@@ -26,7 +26,12 @@
26 return true;26 return true;
27 }27 }
2828
29 @Override29 @Override
30 public boolean hasNestedPathQuantifiers() {
31 return false;
32 }
33
34 @Override
30 public boolean equals(Object o) {35 public boolean equals(Object o) {
31 if (o instanceof TCTLStatePlaceHolder) {36 if (o instanceof TCTLStatePlaceHolder) {
32 return true;37 return true;
3338
=== modified file 'src/dk/aau/cs/TCTL/TCTLStateToPathConverter.java'
--- src/dk/aau/cs/TCTL/TCTLStateToPathConverter.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLStateToPathConverter.java 2020-08-19 11:36:17 +0000
@@ -76,8 +76,13 @@
76 public boolean containsPlaceHolder() {76 public boolean containsPlaceHolder() {
77 return property.containsPlaceHolder();77 return property.containsPlaceHolder();
78 }78 }
79 79
80 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {80 @Override
81 public boolean hasNestedPathQuantifiers() {
82 return property.hasNestedPathQuantifiers();
83 }
84
85 public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) {
81 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);86 return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName);
82 }87 }
83 88
8489
=== modified file 'src/dk/aau/cs/TCTL/TCTLTermListNode.java'
--- src/dk/aau/cs/TCTL/TCTLTermListNode.java 2017-06-23 08:38:31 +0000
+++ src/dk/aau/cs/TCTL/TCTLTermListNode.java 2020-08-19 11:36:17 +0000
@@ -84,7 +84,12 @@
84 return false;84 return false;
85 }85 }
8686
87 @Override87 @Override
88 public boolean hasNestedPathQuantifiers() {
89 return false;
90 }
91
92 @Override
88 public TCTLAbstractProperty findFirstPlaceHolder() {93 public TCTLAbstractProperty findFirstPlaceHolder() {
89 for(TCTLAbstractStateProperty factor : factors){94 for(TCTLAbstractStateProperty factor : factors){
90 TCTLAbstractProperty placeholder = factor.findFirstPlaceHolder(); 95 TCTLAbstractProperty placeholder = factor.findFirstPlaceHolder();
9196
=== modified file 'src/dk/aau/cs/TCTL/TCTLTransitionNode.java'
--- src/dk/aau/cs/TCTL/TCTLTransitionNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLTransitionNode.java 2020-08-19 11:36:17 +0000
@@ -57,7 +57,12 @@
57 return false;57 return false;
58 }58 }
5959
60 @Override60 @Override
61 public boolean hasNestedPathQuantifiers() {
62 return false;
63 }
64
65 @Override
61 public TCTLAbstractProperty findFirstPlaceHolder() {66 public TCTLAbstractProperty findFirstPlaceHolder() {
62 return null;67 return null;
63 }68 }
6469
=== modified file 'src/dk/aau/cs/TCTL/TCTLTrueNode.java'
--- src/dk/aau/cs/TCTL/TCTLTrueNode.java 2017-03-12 00:33:00 +0000
+++ src/dk/aau/cs/TCTL/TCTLTrueNode.java 2020-08-19 11:36:17 +0000
@@ -35,7 +35,12 @@
35 return false;35 return false;
36 }36 }
3737
38 public TCTLAbstractProperty findFirstPlaceHolder() {38 @Override
39 public boolean hasNestedPathQuantifiers() {
40 return false;
41 }
42
43 public TCTLAbstractProperty findFirstPlaceHolder() {
39 return null;44 return null;
40 }45 }
41 46
4247
=== modified file 'src/dk/aau/cs/gui/TabContent.java'
--- src/dk/aau/cs/gui/TabContent.java 2020-08-11 11:33:28 +0000
+++ src/dk/aau/cs/gui/TabContent.java 2020-08-19 11:36:17 +0000
@@ -1,5 +1,17 @@
1package dk.aau.cs.gui;1package dk.aau.cs.gui;
22
3import java.awt.*;
4import java.awt.event.ActionEvent;
5import java.awt.event.MouseAdapter;
6import java.awt.event.MouseEvent;
7import java.awt.geom.Point2D;
8import java.io.*;
9import java.math.BigDecimal;
10import java.util.*;
11import java.util.List;
12
13import javax.swing.*;
14import javax.swing.border.BevelBorder;
3import dk.aau.cs.debug.Logger;15import dk.aau.cs.debug.Logger;
4import dk.aau.cs.gui.components.BugHandledJXMultisplitPane;16import dk.aau.cs.gui.components.BugHandledJXMultisplitPane;
5import dk.aau.cs.gui.components.StatisticsPanel;17import dk.aau.cs.gui.components.StatisticsPanel;
@@ -27,6 +39,7 @@
27import pipe.dataLayer.TAPNQuery;39import pipe.dataLayer.TAPNQuery;
28import pipe.dataLayer.Template;40import pipe.dataLayer.Template;
29import pipe.gui.*;41import pipe.gui.*;
42import pipe.gui.action.GuiAction;
30import pipe.gui.canvas.DrawingSurfaceImpl;43import pipe.gui.canvas.DrawingSurfaceImpl;
31import pipe.gui.graphicElements.*;44import pipe.gui.graphicElements.*;
32import pipe.gui.graphicElements.tapn.*;45import pipe.gui.graphicElements.tapn.*;
@@ -36,17 +49,7 @@
36import pipe.gui.widgets.WorkflowDialog;49import pipe.gui.widgets.WorkflowDialog;
37import pipe.gui.widgets.filebrowser.FileBrowser;50import pipe.gui.widgets.filebrowser.FileBrowser;
3851
39import javax.swing.*;
40import javax.swing.border.BevelBorder;
41import java.awt.*;
42import java.awt.event.MouseAdapter;
43import java.awt.event.MouseEvent;
44import java.awt.event.MouseWheelEvent;52import java.awt.event.MouseWheelEvent;
45import java.awt.geom.Point2D;
46import java.io.*;
47import java.math.BigDecimal;
48import java.util.List;
49import java.util.*;
5053
51public class TabContent extends JSplitPane implements TabContentActions{54public class TabContent extends JSplitPane implements TabContentActions{
5255
@@ -56,7 +59,8 @@
56 this.guiFrameControllerActions.setReference(guiFrameControllerActions);59 this.guiFrameControllerActions.setReference(guiFrameControllerActions);
57 }60 }
5861
59 public static class TAPNLens {62 public static final class TAPNLens {
63 public static final TAPNLens Default = new TAPNLens(true, true);
60 public boolean isTimed() {64 public boolean isTimed() {
61 return timed;65 return timed;
62 }66 }
@@ -68,7 +72,7 @@
68 private final boolean timed;72 private final boolean timed;
69 private final boolean game;73 private final boolean game;
7074
71 TAPNLens(boolean timed, boolean game) {75 public TAPNLens(boolean timed, boolean game) {
72 this.timed = timed;76 this.timed = timed;
73 this.game = game;77 this.game = game;
74 }78 }
@@ -156,7 +160,7 @@
156 Require.notNull(p, "Point can't be null");160 Require.notNull(p, "Point can't be null");
157161
158 dk.aau.cs.model.tapn.LocalTimedPlace tp = new dk.aau.cs.model.tapn.LocalTimedPlace(drawingSurface.getNameGenerator().getNewPlaceName(guiModelToModel.get(c)));162 dk.aau.cs.model.tapn.LocalTimedPlace tp = new dk.aau.cs.model.tapn.LocalTimedPlace(drawingSurface.getNameGenerator().getNewPlaceName(guiModelToModel.get(c)));
159 TimedPlaceComponent pnObject = new TimedPlaceComponent(p.x, p.y, tp);163 TimedPlaceComponent pnObject = new TimedPlaceComponent(p.x, p.y, tp, lens);
160 guiModelToModel.get(c).add(tp);164 guiModelToModel.get(c).add(tp);
161 c.addPetriNetObject(pnObject);165 c.addPetriNetObject(pnObject);
162166
@@ -167,7 +171,7 @@
167 public Result<TimedTransitionComponent, ModelViolation> addNewTimedTransitions(DataLayer c, Point p) {171 public Result<TimedTransitionComponent, ModelViolation> addNewTimedTransitions(DataLayer c, Point p) {
168 dk.aau.cs.model.tapn.TimedTransition transition = new dk.aau.cs.model.tapn.TimedTransition(drawingSurface.getNameGenerator().getNewTransitionName(guiModelToModel.get(c)));172 dk.aau.cs.model.tapn.TimedTransition transition = new dk.aau.cs.model.tapn.TimedTransition(drawingSurface.getNameGenerator().getNewTransitionName(guiModelToModel.get(c)));
169173
170 TimedTransitionComponent pnObject = new TimedTransitionComponent(p.x, p.y, transition);174 TimedTransitionComponent pnObject = new TimedTransitionComponent(p.x, p.y, transition, lens);
171175
172 guiModelToModel.get(c).add(transition);176 guiModelToModel.get(c).add(transition);
173 c.addPetriNetObject(pnObject);177 c.addPetriNetObject(pnObject);
@@ -207,7 +211,7 @@
207 TimeInterval.ZERO_INF211 TimeInterval.ZERO_INF
208 );212 );
209213
210 TimedInputArcComponent tiac = new TimedInputArcComponent(p, t, tia);214 TimedInputArcComponent tiac = new TimedInputArcComponent(p, t, tia, lens);
211215
212 if (path != null) {216 if (path != null) {
213 tiac.setArcPath(new ArcPath(tiac, path));217 tiac.setArcPath(new ArcPath(tiac, path));
@@ -563,7 +567,7 @@
563 }).start();567 }).start();
564 }568 }
565569
566 TabContent tab = new TabContent(loadedModel.network(), loadedModel.templates(), loadedModel.queries(), loadedModel.isTimed(), loadedModel.isGame());570 TabContent tab = new TabContent(loadedModel.network(), loadedModel.templates(), loadedModel.queries(), loadedModel.getLens());
567571
568 tab.setInitialName(name);572 tab.setInitialName(name);
569573
@@ -784,6 +788,9 @@
784 addGuiModel(template.model(), template.guiModel());788 addGuiModel(template.model(), template.guiModel());
785 zoomLevels.put(template.model(), template.zoomer());789 zoomLevels.put(template.model(), template.zoomer());
786 hasPositionalInfos.put(template.model(), template.getHasPositionalInfo());790 hasPositionalInfos.put(template.model(), template.getHasPositionalInfo());
791 for(PetriNetObject o : template.guiModel().getPetriNetObjects()){
792 o.setLens(this.lens);
793 }
787 }794 }
788795
789 drawingSurface = new DrawingSurfaceImpl(new DataLayer(), this, managerRef);796 drawingSurface = new DrawingSurfaceImpl(new DataLayer(), this, managerRef);
@@ -831,7 +838,7 @@
831 private TabContent(TimedArcPetriNetNetwork network, Collection<Template> templates, Iterable<TAPNQuery> tapnqueries) {838 private TabContent(TimedArcPetriNetNetwork network, Collection<Template> templates, Iterable<TAPNQuery> tapnqueries) {
832 this(network, templates, tapnqueries, new TAPNLens(true, false));839 this(network, templates, tapnqueries, new TAPNLens(true, false));
833 }840 }
834 private TabContent(TimedArcPetriNetNetwork network, Collection<Template> templates, Iterable<TAPNQuery> tapnqueries, TAPNLens lens) {841 public TabContent(TimedArcPetriNetNetwork network, Collection<Template> templates, Iterable<TAPNQuery> tapnqueries, TAPNLens lens) {
835 this(network, templates, lens);842 this(network, templates, lens);
836843
837 setNetwork(network, templates);844 setNetwork(network, templates);
@@ -1133,9 +1140,15 @@
1133 showEnabledTransitionsList(showEnabledTransitions);1140 showEnabledTransitionsList(showEnabledTransitions);
1134 1141
1135 this.setLeftComponent(animatorSplitPaneScroller);1142 this.setLeftComponent(animatorSplitPaneScroller);
1136
1137 }1143 }
11381144
1145 private void hideTimedInformation(){
1146 if(!lens.isTimed()){
1147 animControlerBox.setVisible(false);
1148 }
1149
1150 }
1151
1139 public void switchToEditorComponents() {1152 public void switchToEditorComponents() {
1140 1153
1141 //Remove dummy1154 //Remove dummy
@@ -1220,7 +1233,7 @@
1220 }1233 }
12211234
1222 private void createAnimationControlSidePanel() {1235 private void createAnimationControlSidePanel() {
1223 animControlerBox = new AnimationControlSidePanel(animator);1236 animControlerBox = new AnimationControlSidePanel(animator, lens);
1224 }1237 }
12251238
1226 public AnimationHistoryList getAnimationHistorySidePanel() {1239 public AnimationHistoryList getAnimationHistorySidePanel() {
@@ -1228,7 +1241,7 @@
1228 }1241 }
12291242
1230 private void createTransitionFireing() {1243 private void createTransitionFireing() {
1231 transitionFireing = new TransitionFireingComponent(CreateGui.getApp().isShowingDelayEnabledTransitions());1244 transitionFireing = new TransitionFireingComponent(CreateGui.getApp().isShowingDelayEnabledTransitions(), lens);
1232 }1245 }
12331246
1234 public TransitionFireingComponent getTransitionFireingComponent() {1247 public TransitionFireingComponent getTransitionFireingComponent() {
@@ -1486,13 +1499,13 @@
1486 }1499 }
14871500
1488 private void createNewAndConvertUntimed() {1501 private void createNewAndConvertUntimed() {
1489 TabContent tab = duplicateTab(FeatureOption.TIME, false);1502 TabContent tab = duplicateTab(new TAPNLens(false, lens.isGame()), "-untimed");
1490 convertToUntimedTab(tab);1503 convertToUntimedTab(tab);
1491 guiFrameControllerActions.ifPresent(o -> o.openTab(tab));1504 guiFrameControllerActions.ifPresent(o -> o.openTab(tab));
1492 }1505 }
14931506
1494 private void createNewAndConvertNonGame() {1507 private void createNewAndConvertNonGame() {
1495 TabContent tab = duplicateTab(FeatureOption.GAME, false);1508 TabContent tab = duplicateTab(new TAPNLens(lens.isTimed(), false), "-nongame");
1496 TabTransformer.removeGameInformation(tab);1509 TabTransformer.removeGameInformation(tab);
1497 guiFrameControllerActions.ifPresent(o -> o.openTab(tab));1510 guiFrameControllerActions.ifPresent(o -> o.openTab(tab));
1498 }1511 }
@@ -1512,13 +1525,31 @@
1512 createNewAndConvertUntimed();1525 createNewAndConvertUntimed();
1513 }1526 }
1514 } else {1527 } else {
1515 TabContent tab = duplicateTab(FeatureOption.TIME, isTime);1528 TabContent tab = duplicateTab(new TAPNLens(true, lens.isGame()), "-timed");
1529 findAndRemoveAffectedQueries(tab);
1516 guiFrameControllerActions.ifPresent(o -> o.openTab(tab));1530 guiFrameControllerActions.ifPresent(o -> o.openTab(tab));
1517 }1531 }
1518 updateFeatureText();1532 updateFeatureText();
1519 }1533 }
1520 }1534 }
15211535
1536 private void findAndRemoveAffectedQueries(TabContent tab){
1537 List<TAPNQuery> queriesToRemove = new ArrayList<TAPNQuery>();
1538 for (TAPNQuery q : tab.queries()){
1539 if(q.hasUntimedOnlyProperties()){
1540 queriesToRemove.add(q);
1541 tab.removeQuery(q);
1542 }
1543 }
1544 String message = "The following queries will be removed in the conversion:";
1545 for(TAPNQuery q : queriesToRemove){
1546 message += "\n" + q.getName();
1547 }
1548 if(!queriesToRemove.isEmpty()){
1549 JOptionPane.showMessageDialog(this,message,"Information", JOptionPane.INFORMATION_MESSAGE);
1550 }
1551 }
1552
1522 @Override1553 @Override
1523 public void changeGameFeature(boolean isGame) {1554 public void changeGameFeature(boolean isGame) {
1524 if (isGame != lens.isGame()) {1555 if (isGame != lens.isGame()) {
@@ -1534,7 +1565,7 @@
1534 createNewAndConvertNonGame();1565 createNewAndConvertNonGame();
1535 }1566 }
1536 } else {1567 } else {
1537 TabContent tab = duplicateTab(FeatureOption.GAME, isGame);1568 TabContent tab = duplicateTab(new TAPNLens(lens.isTimed(), true), "-game");
1538 guiFrameControllerActions.ifPresent(o -> o.openTab(tab));1569 guiFrameControllerActions.ifPresent(o -> o.openTab(tab));
1539 }1570 }
1540 updateFeatureText();1571 updateFeatureText();
@@ -1642,6 +1673,8 @@
1642 drawingSurface().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));1673 drawingSurface().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
16431674
1644 animationmode = true; //XXX: Must be called after setGuiMode as guiMode uses last state,1675 animationmode = true; //XXX: Must be called after setGuiMode as guiMode uses last state,
1676 app.ifPresent(o->o.setStatusBarText(textforAnimation));
1677
1645 } else {1678 } else {
1646 JOptionPane.showMessageDialog(CreateGui.getApp(),1679 JOptionPane.showMessageDialog(CreateGui.getApp(),
1647 "You need at least one active template to enter simulation mode",1680 "You need at least one active template to enter simulation mode",
@@ -1669,6 +1702,7 @@
1669 // Undo/Redo is enabled based on undo/redo manager1702 // Undo/Redo is enabled based on undo/redo manager
1670 getUndoManager().setUndoRedoStatus();1703 getUndoManager().setUndoRedoStatus();
1671 animationmode = false;1704 animationmode = false;
1705 app.ifPresent(o->o.setStatusBarText(textforDrawing));
1672 }1706 }
1673 animator.updateAnimationButtonsEnabled(); //Update stepBack/Forward1707 animator.updateAnimationButtonsEnabled(); //Update stepBack/Forward
1674 }1708 }
@@ -1679,11 +1713,13 @@
1679 @Override1713 @Override
1680 public void setMode(Pipe.ElementType mode) {1714 public void setMode(Pipe.ElementType mode) {
16811715
1682 app.ifPresent(o->o.updateMode(mode));1716 CreateGui.guiMode = mode;
1717 changeStatusbarText(mode);
16831718
1684 //Disable selection and deselect current selection1719 //Disable selection and deselect current selection
1685 drawingSurface().getSelectionObject().clearSelection();1720 drawingSurface().getSelectionObject().clearSelection();
1686 editorMode = mode;1721 editorMode = mode;
1722 updateMode();
1687 switch (mode) {1723 switch (mode) {
1688 case ADDTOKEN:1724 case ADDTOKEN:
1689 setManager(new AbstractDrawingSurfaceManager() {1725 setManager(new AbstractDrawingSurfaceManager() {
@@ -1851,6 +1887,11 @@
1851 app.ifPresent(o->o.setGUIMode(GuiFrame.GUIMode.draw));1887 app.ifPresent(o->o.setGUIMode(GuiFrame.GUIMode.draw));
1852 app.ifPresent(o->setMode(Pipe.ElementType.SELECT));1888 app.ifPresent(o->setMode(Pipe.ElementType.SELECT));
1853 }1889 }
1890 app.ifPresent(o->o.registerDrawingActions(getAvailableDrawActions()));
1891 app.ifPresent(o->o.registerAnimationActions(getAvailableSimActions()));
1892
1893 //TODO: this is a temporary implementation untill actions can be moved
1894 app.ifPresent(o->o.registerViewActions(List.of()));
18541895
1855 }1896 }
18561897
@@ -1947,8 +1988,7 @@
1947 allTemplates(),1988 allTemplates(),
1948 queriesOverwrite,1989 queriesOverwrite,
1949 network().constants(),1990 network().constants(),
1950 lens.timed,1991 lens
1951 lens.game
1952 );1992 );
19531993
1954 tapnWriter.savePNML(outFile);1994 tapnWriter.savePNML(outFile);
@@ -2026,51 +2066,26 @@
2026 drawingSurface().updatePreferredSize();2066 drawingSurface().updatePreferredSize();
2027 }2067 }
20282068
2029 public TabContent duplicateTab(FeatureOption option, boolean isYes) {2069 public TabContent duplicateTab(TAPNLens overwriteLens, String appendName) {
2030 NetWriter tapnWriter = new TimedArcPetriNetNetworkWriter(2070 NetWriter tapnWriter = new TimedArcPetriNetNetworkWriter(
2031 network(),2071 network(),
2032 allTemplates(),2072 allTemplates(),
2033 queries(),2073 queries(),
2034 network().constants()2074 network().constants(),
2035 );2075 overwriteLens
20362076 );
2037 option = isNetChanged(option, isYes) ? option : FeatureOption.TIME;2077
20382078 try {
2039 try {2079 ByteArrayOutputStream outputStream = tapnWriter.savePNML();
2040 ByteArrayOutputStream outputStream = tapnWriter.savePNML();2080 String composedName = getTabTitle();
2041 String composedName = getTabTitle();2081 composedName = composedName.replace(".tapn", "");
2042 composedName = composedName.replace(".tapn", "");2082 composedName += appendName;
20432083 return createNewTabFromInputStream(new ByteArrayInputStream(outputStream.toByteArray()), composedName);
2044 switch (option) {2084 } catch (Exception e1) {
2045 case TIME:2085 Logger.log("Could not load model");
2046 composedName += isYes ? "-timed" : "-untimed";2086 e1.printStackTrace();
2047 break;
2048 case GAME:
2049 composedName += isYes ? "-game" : "-noGame";
2050 break;
2051 }
2052
2053 if (isNetChanged(option, isYes)) {
2054 return createNewTabFromInputStream(new ByteArrayInputStream(outputStream.toByteArray()), composedName, option, isYes);
2055 } else {
2056 return createNewTabFromInputStream(new ByteArrayInputStream(outputStream.toByteArray()), composedName);
2057 }
2058 } catch (Exception e1) {
2059 e1.printStackTrace();
2060 System.console().printf(e1.getMessage());
2061 }
2062 return null;
2063 }
2064
2065 private boolean isNetChanged(FeatureOption option, boolean isYes) {
2066 switch (option) {
2067 case TIME:
2068 return lens.isTimed() != isYes;
2069 case GAME:
2070 return lens.isGame() != isYes;
2071 default:
2072 return false;
2073 }2087 }
2088 return null;
2074 }2089 }
20752090
2076 class CanvasPlaceDrawController extends AbstractDrawingSurfaceManager {2091 class CanvasPlaceDrawController extends AbstractDrawingSurfaceManager {
@@ -2651,4 +2666,216 @@
2651 );2666 );
2652 }2667 }
2653 }2668 }
2669 public List<GuiAction> getAvailableDrawActions(){
2670 if(lens.isTimed()){
2671 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction,transAction, timedArcAction, transportArcAction, inhibarcAction, tokenAction, deleteTokenAction));
2672 } else{
2673 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction,transAction, timedArcAction, inhibarcAction, tokenAction, deleteTokenAction));
2674 }
2675 }
2676
2677 public List<GuiAction> getAvailableSimActions(){
2678 if(lens.isTimed()){
2679 return new ArrayList<>(Arrays.asList(timeAction, delayFireAction));
2680 } else{
2681 delayFireAction.setName("Fire");
2682 delayFireAction.setTooltip("Fire Selected Transition");
2683 return new ArrayList<>(Arrays.asList(delayFireAction));
2684 }
2685 }
2686
2687 private final GuiAction selectAction = new GuiAction("Select", "Select components (S)", "S", true) {
2688 public void actionPerformed(ActionEvent e) {
2689 setMode(Pipe.ElementType.SELECT);
2690 }
2691 };
2692 private final GuiAction annotationAction = new GuiAction("Annotation", "Add an annotation (N)", "N", true) {
2693 public void actionPerformed(ActionEvent e) {
2694 setMode(Pipe.ElementType.ANNOTATION);
2695 }
2696 };
2697 private final GuiAction inhibarcAction = new GuiAction("Inhibitor arc", "Add an inhibitor arc (I)", "I", true) {
2698 public void actionPerformed(ActionEvent e) {
2699 setMode(Pipe.ElementType.TAPNINHIBITOR_ARC);
2700 }
2701 };
2702 private final GuiAction transAction = new GuiAction("Transition", "Add a transition (T)", "T", true) {
2703 public void actionPerformed(ActionEvent e) {
2704 setMode(Pipe.ElementType.TAPNTRANS);
2705 }
2706 };
2707 private final GuiAction tokenAction = new GuiAction("Add token", "Add a token (+)", "typed +", true) {
2708 public void actionPerformed(ActionEvent e) {
2709 setMode(Pipe.ElementType.ADDTOKEN);
2710 }
2711 };
2712
2713 private final GuiAction deleteTokenAction = new GuiAction("Delete token", "Delete a token (-)", "typed -", true) {
2714 public void actionPerformed(ActionEvent e) {
2715 setMode(Pipe.ElementType.DELTOKEN);
2716 }
2717 };
2718 private final GuiAction timedPlaceAction = new GuiAction("Place", "Add a place (P)", "P", true) {
2719 public void actionPerformed(ActionEvent e) {
2720 setMode(Pipe.ElementType.TAPNPLACE);
2721 }
2722 };
2723
2724 private final GuiAction timedArcAction = new GuiAction("Arc", "Add an arc (A)", "A", true) {
2725 public void actionPerformed(ActionEvent e) {
2726 setMode(Pipe.ElementType.TAPNARC);
2727 }
2728 };
2729 private final GuiAction transportArcAction = new GuiAction("Transport arc", "Add a transport arc (R)", "R", true) {
2730 public void actionPerformed(ActionEvent e) {
2731 setMode(Pipe.ElementType.TRANSPORTARC);
2732 }
2733 };
2734 private final GuiAction timeAction = new GuiAction("Delay one time unit", "Let time pass one time unit", "W") {
2735 public void actionPerformed(ActionEvent e) {
2736 timeDelay();
2737 }
2738 };
2739 private final GuiAction delayFireAction = new GuiAction("Delay and fire", "Delay and fire selected transition", "F") {
2740 public void actionPerformed(ActionEvent e) {
2741 delayAndFire();
2742 }
2743 };
2744
2745 public void updateMode() {
2746 // deselect other actions
2747 selectAction.setSelected(CreateGui.guiMode == Pipe.ElementType.SELECT);
2748 transAction.setSelected(editorMode == Pipe.ElementType.TAPNTRANS);
2749 timedPlaceAction.setSelected(editorMode == Pipe.ElementType.TAPNPLACE);
2750 timedArcAction.setSelected(editorMode == Pipe.ElementType.TAPNARC);
2751 transportArcAction.setSelected(editorMode == Pipe.ElementType.TRANSPORTARC);
2752 inhibarcAction.setSelected(editorMode == Pipe.ElementType.TAPNINHIBITOR_ARC);
2753 tokenAction.setSelected(editorMode == Pipe.ElementType.ADDTOKEN);
2754 deleteTokenAction.setSelected(editorMode == Pipe.ElementType.DELTOKEN);
2755 annotationAction.setSelected(editorMode == Pipe.ElementType.ANNOTATION);
2756 }
2757 @Override
2758 public void updateEnabledActions(GuiFrame.GUIMode mode){
2759 switch(mode){
2760 case draw:
2761 selectAction.setEnabled(true);
2762 transAction.setEnabled(true);
2763 timedPlaceAction.setEnabled(true);
2764 timedArcAction.setEnabled(true);
2765 transportArcAction.setEnabled(true);
2766 inhibarcAction.setEnabled(true);
2767 tokenAction.setEnabled(true);
2768 deleteTokenAction.setEnabled(true);
2769 annotationAction.setEnabled(true);
2770 delayFireAction.setEnabled(false);
2771 timeAction.setEnabled(false);
2772 break;
2773 case noNet:
2774 selectAction.setEnabled(false);
2775 transAction.setEnabled(false);
2776 timedPlaceAction.setEnabled(false);
2777 timedArcAction.setEnabled(false);
2778 transportArcAction.setEnabled(false);
2779 inhibarcAction.setEnabled(false);
2780 tokenAction.setEnabled(false);
2781 deleteTokenAction.setEnabled(false);
2782 annotationAction.setEnabled(false);
2783 delayFireAction.setEnabled(false);
2784 timeAction.setEnabled(false);
2785 case animation:
2786 selectAction.setEnabled(false);
2787 transAction.setEnabled(false);
2788 timedPlaceAction.setEnabled(false);
2789 timedArcAction.setEnabled(false);
2790 transportArcAction.setEnabled(false);
2791 inhibarcAction.setEnabled(false);
2792 tokenAction.setEnabled(false);
2793 deleteTokenAction.setEnabled(false);
2794 annotationAction.setEnabled(false);
2795 delayFireAction.setEnabled(true);
2796 if(lens.isTimed())
2797 timeAction.setEnabled(true);
2798 break;
2799 }
2800 }
2801
2802
2803 public static final String textforDrawing = "Drawing Mode: Click on a button to start adding components to the Editor";
2804 public static final String textforPlace = "Place Mode: Right click on a place to see menu options ";
2805 public static final String textforTAPNPlace = "Place Mode: Right click on a place to see menu options ";
2806 public static final String textforTrans = "Transition Mode: Right click on a transition to see menu options [Mouse wheel -> rotate]";
2807 public static final String textforTimedTrans = "Timed Transition Mode: Right click on a transition to see menu options [Mouse wheel -> rotate]";
2808 public static final String textforAddtoken = "Add Token Mode: Click on a place to add a token";
2809 public static final String textforDeltoken = "Delete Token Mode: Click on a place to delete a token ";
2810 public static final String textforAnimation = "Simulation Mode: Red transitions are enabled, click a transition to fire it";
2811 public static final String textforArc = "Arc Mode: Right click on an arc to see menu options ";
2812 public static final String textforTransportArc = "Transport Arc Mode: Right click on an arc to see menu options ";
2813 public static final String textforInhibArc = "Inhibitor Mode: Right click on an arc to see menu options ";
2814 public static final String textforMove = "Select Mode: Click/drag to select objects; drag to move them";
2815 public static final String textforAnnotation = "Annotation Mode: Right click on an annotation to see menu options; double click to edit";
2816 public static final String textforDrag = "Drag Mode";
2817
2818 public void changeStatusbarText(Pipe.ElementType type) {
2819 switch (type) {
2820 case PLACE:
2821 app.ifPresent(o13 -> o13.setStatusBarText(textforPlace));
2822 break;
2823
2824 case TAPNPLACE:
2825 app.ifPresent(o12 -> o12.setStatusBarText(textforTAPNPlace));
2826 break;
2827
2828 case IMMTRANS:
2829 case TAPNTRANS:
2830 app.ifPresent(o11 -> o11.setStatusBarText(textforTrans));
2831 break;
2832
2833 case TIMEDTRANS:
2834 app.ifPresent(o10 -> o10.setStatusBarText(textforTimedTrans));
2835 break;
2836
2837 case ARC:
2838 case TAPNARC:
2839 app.ifPresent(o9 -> o9.setStatusBarText(textforArc));
2840 break;
2841
2842 case TRANSPORTARC:
2843 app.ifPresent(o8 -> o8.setStatusBarText(textforTransportArc));
2844 break;
2845
2846 case TAPNINHIBITOR_ARC:
2847 case INHIBARC:
2848 app.ifPresent(o7 -> o7.setStatusBarText(textforInhibArc));
2849 break;
2850
2851 case ADDTOKEN:
2852 app.ifPresent(o6 -> o6.setStatusBarText(textforAddtoken));
2853 break;
2854
2855 case DELTOKEN:
2856 app.ifPresent(o5 -> o5.setStatusBarText(textforDeltoken));
2857 break;
2858
2859 case SELECT:
2860 app.ifPresent(o4 -> o4.setStatusBarText(textforMove));
2861 break;
2862
2863 case DRAW:
2864 app.ifPresent(o3 -> o3.setStatusBarText(textforDrawing));
2865 break;
2866
2867 case ANNOTATION:
2868 app.ifPresent(o2 -> o2.setStatusBarText(textforAnnotation));
2869 break;
2870
2871 case DRAG:
2872 app.ifPresent(o1 -> o1.setStatusBarText(textforDrag));
2873 break;
2874
2875 default:
2876 app.ifPresent(o->o.setStatusBarText("To-do (textfor" + type));
2877 break;
2878 }
2879 }
2880
2654}2881}
26552882
=== modified file 'src/dk/aau/cs/gui/TabContentActions.java'
--- src/dk/aau/cs/gui/TabContentActions.java 2020-08-11 11:33:28 +0000
+++ src/dk/aau/cs/gui/TabContentActions.java 2020-08-19 11:36:17 +0000
@@ -1,5 +1,6 @@
1package dk.aau.cs.gui;1package dk.aau.cs.gui;
22
3import pipe.gui.GuiFrame;
3import pipe.gui.GuiFrameActions;4import pipe.gui.GuiFrameActions;
4import pipe.gui.Pipe;5import pipe.gui.Pipe;
5import pipe.gui.SafeGuiFrameActions;6import pipe.gui.SafeGuiFrameActions;
@@ -89,7 +90,10 @@
8990
90 void setResizeingDefault();91 void setResizeingDefault();
9192
93 void updateEnabledActions(GuiFrame.GUIMode mode);
94
92 void changeTimeFeature(boolean isTime);95 void changeTimeFeature(boolean isTime);
9396
94 void changeGameFeature(boolean isGame);97 void changeGameFeature(boolean isGame);
98
95}99}
96100
=== modified file 'src/dk/aau/cs/gui/TabTransformer.java'
--- src/dk/aau/cs/gui/TabTransformer.java 2020-08-10 09:25:25 +0000
+++ src/dk/aau/cs/gui/TabTransformer.java 2020-08-19 11:36:17 +0000
@@ -51,12 +51,15 @@
51 DataLayer guiModel = template.guiModel();51 DataLayer guiModel = template.guiModel();
52 Place guiSource = guiModel.getPlaceByName(arc.getSource().getName());52 Place guiSource = guiModel.getPlaceByName(arc.getSource().getName());
53 Transition guiTarget = guiModel.getTransitionByName(arc.getTarget().getName());53 Transition guiTarget = guiModel.getTransitionByName(arc.getTarget().getName());
54 TimedInputArcComponent newArc = new TimedInputArcComponent(new TimedOutputArcComponent(54 TimedInputArcComponent newArc = new TimedInputArcComponent(
55 guiSource,55 new TimedOutputArcComponent(
56 guiSource,
56 guiTarget,57 guiTarget,
57 arc.getWeight().value(),58 arc.getWeight().value(),
58 arc.getSource().getName() + "_to_" + arc.getTarget().getName()59 arc.getSource().getName() + "_to_" + arc.getTarget().getName()
59 ));60 ),
61 tab.getLens()
62 );
6063
61 // Build ArcPath64 // Build ArcPath
62 Place oldGuiSource = guiModel.getPlaceByName(arc.getSource().getName());65 Place oldGuiSource = guiModel.getPlaceByName(arc.getSource().getName());
6366
=== modified file 'src/dk/aau/cs/gui/components/EnabledTransitionsList.java'
--- src/dk/aau/cs/gui/components/EnabledTransitionsList.java 2020-07-20 12:17:24 +0000
+++ src/dk/aau/cs/gui/components/EnabledTransitionsList.java 2020-08-19 11:36:17 +0000
@@ -20,6 +20,7 @@
20import org.jetbrains.annotations.NotNull;20import org.jetbrains.annotations.NotNull;
21import pipe.dataLayer.Template;21import pipe.dataLayer.Template;
22import pipe.gui.CreateGui;22import pipe.gui.CreateGui;
23import pipe.gui.SimulationControl;
23import pipe.gui.graphicElements.Transition;24import pipe.gui.graphicElements.Transition;
24import pipe.gui.graphicElements.tapn.TimedTransitionComponent;25import pipe.gui.graphicElements.tapn.TimedTransitionComponent;
25//TODO clean up!!! 26//TODO clean up!!!
@@ -63,7 +64,7 @@
63 }64 }
6465
65 public void reInitDone(){66 public void reInitDone(){
66 if(CreateGui.getCurrentTab().getDelayEnabledTransitionControl().isRandomTransitionMode()){67 if(SimulationControl.getInstance().isRandomTransitionMode()){
67 selectRandom();68 selectRandom();
68 return;69 return;
69 }70 }
@@ -125,7 +126,7 @@
125126
126 public String toString(boolean showIntervals) {127 public String toString(boolean showIntervals) {
127128
128 String interval = transition.getDInterval() == null || !showIntervals ? "" : transition.getDInterval().toString() + " ";129 String interval = transition.getDInterval() == null || !showIntervals || !transition.isTimed() ? "" : transition.getDInterval().toString() + " ";
129 130
130 String transitionName = getTransition().getName(); 131 String transitionName = getTransition().getName();
131 if(isShared()){132 if(isShared()){
132133
=== modified file 'src/dk/aau/cs/gui/components/TransitionFireingComponent.java'
--- src/dk/aau/cs/gui/components/TransitionFireingComponent.java 2020-07-13 13:58:47 +0000
+++ src/dk/aau/cs/gui/components/TransitionFireingComponent.java 2020-08-19 11:36:17 +0000
@@ -10,6 +10,7 @@
10import javax.swing.JButton;10import javax.swing.JButton;
11import javax.swing.JPanel;11import javax.swing.JPanel;
1212
13import dk.aau.cs.gui.TabContent;
13import pipe.dataLayer.Template;14import pipe.dataLayer.Template;
14import pipe.gui.AnimationSettingsDialog;15import pipe.gui.AnimationSettingsDialog;
15import pipe.gui.DelayEnabledTransitionControl;16import pipe.gui.DelayEnabledTransitionControl;
@@ -22,12 +23,12 @@
22 private final EnabledTransitionsList enabledTransitionsList;23 private final EnabledTransitionsList enabledTransitionsList;
23 private final JButton fireButton;24 private final JButton fireButton;
24 private final JButton settingsButton;25 private final JButton settingsButton;
26 private final TabContent.TAPNLens lens;
2527
26 public TransitionFireingComponent(boolean showDelayEnabledTransitions) {28 public TransitionFireingComponent(boolean showDelayEnabledTransitions, TabContent.TAPNLens lens) {
27 super(new GridBagLayout());29 super(new GridBagLayout());
28
29 enabledTransitionsList = new EnabledTransitionsList();30 enabledTransitionsList = new EnabledTransitionsList();
3031 this.lens = lens;
31 this.setBorder(32 this.setBorder(
32 BorderFactory.createCompoundBorder(33 BorderFactory.createCompoundBorder(
33 BorderFactory.createTitledBorder("Enabled Transitions"),34 BorderFactory.createTitledBorder("Enabled Transitions"),
@@ -44,7 +45,7 @@
4445
45 settingsButton = new JButton("Settings");46 settingsButton = new JButton("Settings");
46 settingsButton.setPreferredSize(new Dimension(0, settingsButton.getPreferredSize().height)); //Make the two buttons equal in size47 settingsButton.setPreferredSize(new Dimension(0, settingsButton.getPreferredSize().height)); //Make the two buttons equal in size
47 settingsButton.addActionListener(e -> AnimationSettingsDialog.showAnimationSettings());48 settingsButton.addActionListener(e -> AnimationSettingsDialog.showAnimationSettings(lens));
4849
49 fireButton = new JButton("Delay & Fire");50 fireButton = new JButton("Delay & Fire");
50 fireButton.setPreferredSize(new Dimension(0, fireButton.getPreferredSize().height)); //Make the two buttons equal in size51 fireButton.setPreferredSize(new Dimension(0, fireButton.getPreferredSize().height)); //Make the two buttons equal in size
@@ -125,7 +126,10 @@
125 fireButton.setToolTipText(SIMULATE_ACTIVATED_TOOL_TIP);126 fireButton.setToolTipText(SIMULATE_ACTIVATED_TOOL_TIP);
126 }127 }
127 } else { //If random simulation is not enabled.128 } else { //If random simulation is not enabled.
128 fireButton.setText(CreateGui.getApp().isShowingDelayEnabledTransitions() ? "Delay & Fire" : "Fire");129 fireButton.setText(CreateGui.getApp().isShowingDelayEnabledTransitions() ? "Delay & Fire" : "Fire");
130 if(!lens.isTimed()){
131 fireButton.setText("Fire");
132 }
129133
130 if(enabledTransitionsList.getNumberOfTransitions() == 0){134 if(enabledTransitionsList.getNumberOfTransitions() == 0){
131 fireButton.setEnabled(false);135 fireButton.setEnabled(false);
132136
=== modified file 'src/dk/aau/cs/io/LoadedModel.java'
--- src/dk/aau/cs/io/LoadedModel.java 2020-08-04 08:53:19 +0000
+++ src/dk/aau/cs/io/LoadedModel.java 2020-08-19 11:36:17 +0000
@@ -3,6 +3,7 @@
3import java.util.Collection;3import java.util.Collection;
4import java.util.List;4import java.util.List;
55
6import dk.aau.cs.gui.TabContent;
6import dk.aau.cs.io.batchProcessing.LoadedBatchProcessingModel;7import dk.aau.cs.io.batchProcessing.LoadedBatchProcessingModel;
7import pipe.dataLayer.TAPNQuery;8import pipe.dataLayer.TAPNQuery;
8import pipe.dataLayer.Template;9import pipe.dataLayer.Template;
@@ -13,23 +14,21 @@
13 private final Collection<Template> templates;14 private final Collection<Template> templates;
14 private final Collection<TAPNQuery> queries;15 private final Collection<TAPNQuery> queries;
15 private final TimedArcPetriNetNetwork network;16 private final TimedArcPetriNetNetwork network;
16 private final boolean isTimed;
17 private final boolean isGame;
18 private final Collection<String> messages;17 private final Collection<String> messages;
19 18 private final TabContent.TAPNLens lens;
20 public LoadedModel(TimedArcPetriNetNetwork network, Collection<Template> templates, Collection<TAPNQuery> queries, Collection<String> messages){19
21 this(network, templates, queries, messages, true, false);20 public LoadedModel(TimedArcPetriNetNetwork network, Collection<Template> templates, Collection<TAPNQuery> queries, Collection<String> messages){
21 this(network, templates, queries, messages, TabContent.TAPNLens.Default);
22 }22 }
23 public LoadedModel(TimedArcPetriNetNetwork network, Collection<Template> templates, Collection<TAPNQuery> queries){23 public LoadedModel(TimedArcPetriNetNetwork network, Collection<Template> templates, Collection<TAPNQuery> queries){
24 this(network, templates, queries, List.of(), true, false);24 this(network, templates, queries, List.of(), TabContent.TAPNLens.Default);
25 }25 }
2626
27 public LoadedModel(TimedArcPetriNetNetwork network, Collection<Template> templates, Collection<TAPNQuery> queries, Collection<String> messages, boolean isTimed, boolean isGame){27 public LoadedModel(TimedArcPetriNetNetwork network, Collection<Template> templates, Collection<TAPNQuery> queries, Collection<String> messages, TabContent.TAPNLens lens){
28 this.templates = templates;28 this.templates = templates;
29 this.network = network;29 this.network = network;
30 this.queries = queries;30 this.queries = queries;
31 this.isTimed = isTimed;31 this.lens = lens;
32 this.isGame = isGame;
33 this.messages = messages;32 this.messages = messages;
34 }33 }
3534
@@ -38,12 +37,15 @@
38 public TimedArcPetriNetNetwork network(){ return network; }37 public TimedArcPetriNetNetwork network(){ return network; }
39 public Collection<String> getMessages() { return messages; }38 public Collection<String> getMessages() { return messages; }
4039
40 public TabContent.TAPNLens getLens(){
41 return lens;
42 }
4143
42 public boolean isTimed() {44 public boolean isTimed() {
43 return isTimed;45 return lens.isTimed();
44 }46 }
45 public boolean isGame() {47 public boolean isGame() {
46 return isGame;48 return lens.isGame();
47 }49 }
4850
49}51}
50\ No newline at end of file52\ No newline at end of file
5153
=== modified file 'src/dk/aau/cs/io/PNMLoader.java'
--- src/dk/aau/cs/io/PNMLoader.java 2020-07-20 09:53:59 +0000
+++ src/dk/aau/cs/io/PNMLoader.java 2020-08-19 11:36:17 +0000
@@ -15,6 +15,7 @@
15import javax.xml.parsers.DocumentBuilderFactory;15import javax.xml.parsers.DocumentBuilderFactory;
16import javax.xml.parsers.ParserConfigurationException;16import javax.xml.parsers.ParserConfigurationException;
1717
18import dk.aau.cs.gui.TabContent;
18import org.w3c.dom.Document;19import org.w3c.dom.Document;
19import org.w3c.dom.Element;20import org.w3c.dom.Element;
20import org.w3c.dom.Node;21import org.w3c.dom.Node;
@@ -51,8 +52,10 @@
51import pipe.gui.graphicElements.tapn.TimedTransitionComponent;52import pipe.gui.graphicElements.tapn.TimedTransitionComponent;
5253
53public class PNMLoader {54public class PNMLoader {
54 55
55 enum GraphicsType { Position, Offset }56 private final TabContent.TAPNLens lens = new TabContent.TAPNLens(false, false);
57
58 enum GraphicsType { Position, Offset }
5659
57 private final NameGenerator nameGenerator = new NameGenerator();60 private final NameGenerator nameGenerator = new NameGenerator();
58 private final IdResolver idResolver = new IdResolver();61 private final IdResolver idResolver = new IdResolver();
@@ -192,7 +195,7 @@
192 195
193 if(isNetDrawable()){196 if(isNetDrawable()){
194 //We parse the id as both the name and id as in tapaal name = id, and name/id has to be unique 197 //We parse the id as both the name and id as in tapaal name = id, and name/id has to be unique
195 TimedPlaceComponent placeComponent = new TimedPlaceComponent(position.x, position.y, id, name.point.x, name.point.y);198 TimedPlaceComponent placeComponent = new TimedPlaceComponent(position.x, position.y, id, name.point.x, name.point.y, lens);
196 placeComponent.setUnderlyingPlace(place);199 placeComponent.setUnderlyingPlace(place);
197 template.guiModel().addPetriNetObject(placeComponent);200 template.guiModel().addPetriNetObject(placeComponent);
198 }201 }
@@ -236,8 +239,7 @@
236 if(isNetDrawable()){239 if(isNetDrawable()){
237 TimedTransitionComponent transitionComponent = 240 TimedTransitionComponent transitionComponent =
238 //We parse the id as both the name and id as in tapaal name = id, and name/id has to be unique 241 //We parse the id as both the name and id as in tapaal name = id, and name/id has to be unique
239 new TimedTransitionComponent(position.x, position.y, id, name.point.x, name.point.y,242 new TimedTransitionComponent(position.x, position.y, id, name.point.x, name.point.y, true, false, 0, 0, lens);
240 true, false, 0, 0);
241 transitionComponent.setUnderlyingTransition(transition);243 transitionComponent.setUnderlyingTransition(transition);
242 template.guiModel().addPetriNetObject(transitionComponent);244 template.guiModel().addPetriNetObject(transitionComponent);
243 }245 }
@@ -423,7 +425,7 @@
423 TimedInputArcComponent arc = null;425 TimedInputArcComponent arc = null;
424 426
425 if(isNetDrawable()){427 if(isNetDrawable()){
426 arc = new TimedInputArcComponent(new TimedOutputArcComponent(source, target, weight, arcId));428 arc = new TimedInputArcComponent(new TimedOutputArcComponent(source, target, weight, arcId), lens);
427 arc.setUnderlyingArc(inputArc);429 arc.setUnderlyingArc(inputArc);
428430
429 template.guiModel().addPetriNetObject(arc);431 template.guiModel().addPetriNetObject(arc);
430432
=== modified file 'src/dk/aau/cs/io/TapnLegacyXmlLoader.java'
--- src/dk/aau/cs/io/TapnLegacyXmlLoader.java 2020-08-04 08:53:19 +0000
+++ src/dk/aau/cs/io/TapnLegacyXmlLoader.java 2020-08-19 11:36:17 +0000
@@ -13,6 +13,7 @@
13import javax.xml.parsers.DocumentBuilderFactory;13import javax.xml.parsers.DocumentBuilderFactory;
14import javax.xml.parsers.ParserConfigurationException;14import javax.xml.parsers.ParserConfigurationException;
1515
16import dk.aau.cs.gui.TabContent;
16import org.w3c.dom.Document;17import org.w3c.dom.Document;
17import org.w3c.dom.Element;18import org.w3c.dom.Element;
18import org.w3c.dom.Node;19import org.w3c.dom.Node;
@@ -83,9 +84,10 @@
83 private final IdResolver idResolver = new IdResolver();84 private final IdResolver idResolver = new IdResolver();
8485
85 private final Collection<String> messages = new ArrayList<>(10);86 private final Collection<String> messages = new ArrayList<>(10);
8687 private final TabContent.TAPNLens lens = new TabContent.TAPNLens(true, false);
8788
88 public TapnLegacyXmlLoader() {}89
90 public TapnLegacyXmlLoader() {}
89 91
90 public LoadedModel load(InputStream file) throws FormatException {92 public LoadedModel load(InputStream file) throws FormatException {
91 Require.that(file != null, "file must be non-null and exist");93 Require.that(file != null, "file must be non-null and exist");
@@ -278,7 +280,7 @@
278 PlaceTransitionObject targetIn,280 PlaceTransitionObject targetIn,
279 int _endx, int _endy) throws FormatException {281 int _endx, int _endy) throws FormatException {
280282
281 TimedInputArcComponent tempArc = new TimedInputArcComponent(new TimedOutputArcComponent(sourceIn, targetIn, 1, idInput));283 TimedInputArcComponent tempArc = new TimedInputArcComponent(new TimedOutputArcComponent(sourceIn, targetIn, 1, idInput), lens);
282284
283 TimedPlace place = tapn.getPlaceByName(sourceIn.getName());285 TimedPlace place = tapn.getPlaceByName(sourceIn.getName());
284 TimedTransition transition = tapn.getTransitionByName(targetIn.getName());286 TimedTransition transition = tapn.getTransitionByName(targetIn.getName());
@@ -523,7 +525,7 @@
523 TimedTransitionComponent transition = new TimedTransitionComponent(525 TimedTransitionComponent transition = new TimedTransitionComponent(
524 positionXInput, positionYInput, idInput,526 positionXInput, positionYInput, idInput,
525 nameOffsetXInput, nameOffsetYInput, timedTransition,527 nameOffsetXInput, nameOffsetYInput, timedTransition,
526 infiniteServer, angle, priority);528 infiniteServer, angle, priority, lens);
527 transition.setUnderlyingTransition(t);529 transition.setUnderlyingTransition(t);
528 guiModel.addPetriNetObject(transition);530 guiModel.addPetriNetObject(transition);
529 tapn.add(t);531 tapn.add(t);
@@ -556,7 +558,7 @@
556 }558 }
557 idResolver.add(tapn.name(), idInput, nameInput);559 idResolver.add(tapn.name(), idInput, nameInput);
558560
559 TimedPlaceComponent place = new TimedPlaceComponent(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput);561 TimedPlaceComponent place = new TimedPlaceComponent(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput, lens);
560562
561 LocalTimedPlace p = new LocalTimedPlace(nameInput, TimeInvariant.parse(invariant, constants));563 LocalTimedPlace p = new LocalTimedPlace(nameInput, TimeInvariant.parse(invariant, constants));
562 tapn.add(p);564 tapn.add(p);
@@ -615,9 +617,7 @@
615617
616 } else {618 } else {
617 if (type.equals("timed")) {619 if (type.equals("timed")) {
618 tempArc = parseAndAddTimedInputArc(idInput, taggedArc,620 tempArc = parseAndAddTimedInputArc(idInput, taggedArc, inscriptionTempStorage, sourceIn, targetIn, aEndx, aEndy);
619 inscriptionTempStorage, sourceIn, targetIn,
620 aEndx, aEndy);
621621
622 } else if (type.equals("transport")) {622 } else if (type.equals("transport")) {
623 tempArc = parseAndAddTransportArc(idInput, taggedArc,623 tempArc = parseAndAddTransportArc(idInput, taggedArc,
624624
=== modified file 'src/dk/aau/cs/io/TapnXmlLoader.java'
--- src/dk/aau/cs/io/TapnXmlLoader.java 2020-08-10 06:46:22 +0000
+++ src/dk/aau/cs/io/TapnXmlLoader.java 2020-08-19 11:36:17 +0000
@@ -14,6 +14,7 @@
14import javax.xml.parsers.ParserConfigurationException;14import javax.xml.parsers.ParserConfigurationException;
1515
16import dk.aau.cs.debug.Logger;16import dk.aau.cs.debug.Logger;
17import dk.aau.cs.gui.TabContent;
17import org.w3c.dom.Document;18import org.w3c.dom.Document;
18import org.w3c.dom.Element;19import org.w3c.dom.Element;
19import org.w3c.dom.Node;20import org.w3c.dom.Node;
@@ -26,10 +27,7 @@
26import pipe.gui.CreateGui;27import pipe.gui.CreateGui;
27import pipe.gui.Pipe;28import pipe.gui.Pipe;
28import pipe.gui.Zoomer;29import pipe.gui.Zoomer;
29import pipe.gui.graphicElements.AnnotationNote;30import pipe.gui.graphicElements.*;
30import pipe.gui.graphicElements.Arc;
31import pipe.gui.graphicElements.Place;
32import pipe.gui.graphicElements.PlaceTransitionObject;
33import pipe.gui.graphicElements.tapn.TimedInhibitorArcComponent;31import pipe.gui.graphicElements.tapn.TimedInhibitorArcComponent;
34import pipe.gui.graphicElements.tapn.TimedInputArcComponent;32import pipe.gui.graphicElements.tapn.TimedInputArcComponent;
35import pipe.gui.graphicElements.tapn.TimedOutputArcComponent;33import pipe.gui.graphicElements.tapn.TimedOutputArcComponent;
@@ -73,9 +71,7 @@
73 private final IdResolver idResolver = new IdResolver();71 private final IdResolver idResolver = new IdResolver();
74 private final Collection<String> messages = new ArrayList<>(10);72 private final Collection<String> messages = new ArrayList<>(10);
7573
76 private boolean isTimed;74 private TabContent.TAPNLens lens;
77 private boolean isGame;
78 private boolean isUncontrollable = false;
7975
80 public TapnXmlLoader() {76 public TapnXmlLoader() {
8177
@@ -118,6 +114,8 @@
118114
119 private LoadedModel parse(Document doc) throws FormatException {115 private LoadedModel parse(Document doc) throws FormatException {
120 idResolver.clear();116 idResolver.clear();
117
118 parseFeature(doc);
121 119
122 ConstantStore constants = new ConstantStore(parseConstants(doc));120 ConstantStore constants = new ConstantStore(parseConstants(doc));
123121
@@ -133,9 +131,9 @@
133 131
134 parseBound(doc, network);132 parseBound(doc, network);
135133
136 parseFeature(doc, network);134
137135
138 return new LoadedModel(network, templates, queries,messages, isTimed, isGame);136 return new LoadedModel(network, templates, queries,messages, lens);
139 }137 }
140138
141 private void parseBound(Document doc, TimedArcPetriNetNetwork network){139 private void parseBound(Document doc, TimedArcPetriNetNetwork network){
@@ -145,27 +143,16 @@
145 }143 }
146 }144 }
147145
148 private void parseFeature(Document doc, TimedArcPetriNetNetwork network) {146 private void parseFeature(Document doc) {
149 boolean networkIsTimed = !network.isUntimed();
150
151 if (doc.getElementsByTagName("feature").getLength() > 0) {147 if (doc.getElementsByTagName("feature").getLength() > 0) {
152 NodeList nodeList = doc.getElementsByTagName("feature");148 NodeList nodeList = doc.getElementsByTagName("feature");
153149
154 isTimed = Boolean.parseBoolean(nodeList.item(0).getAttributes().getNamedItem("isTimed").getNodeValue());150 var isTimed = Boolean.parseBoolean(nodeList.item(0).getAttributes().getNamedItem("isTimed").getNodeValue());
155 isGame = Boolean.parseBoolean(nodeList.item(0).getAttributes().getNamedItem("isGame").getNodeValue());151 var isGame = Boolean.parseBoolean(nodeList.item(0).getAttributes().getNamedItem("isGame").getNodeValue());
156152
157 if (networkIsTimed && !isTimed) {153 lens = new TabContent.TAPNLens(isTimed, isGame);
158 isTimed = true;
159 Logger.log("The net contains time features. The entire net will be changed to include time features.");
160 }
161 if (isUncontrollable && !isGame) {
162 isGame = true;
163 Logger.log("The net contains game features. The entire net will be changed to include game features.");
164
165 }
166 } else {154 } else {
167 isTimed = networkIsTimed;155 lens = new TabContent.TAPNLens(true, false);
168 isGame = isUncontrollable;
169 }156 }
170 }157 }
171158
@@ -380,9 +367,6 @@
380 boolean isUrgent = Boolean.parseBoolean(transition.getAttribute("urgent"));367 boolean isUrgent = Boolean.parseBoolean(transition.getAttribute("urgent"));
381368
382 String player = transition.getAttribute("player");369 String player = transition.getAttribute("player");
383 if (player.length() > 0 && player.equals("1")) {
384 isUncontrollable = true;
385 }
386370
387 idResolver.add(tapn.name(), idInput, nameInput);371 idResolver.add(tapn.name(), idInput, nameInput);
388 372
@@ -417,7 +401,7 @@
417 TimedTransitionComponent transitionComponent = new TimedTransitionComponent(401 TimedTransitionComponent transitionComponent = new TimedTransitionComponent(
418 positionXInput, positionYInput, idInput,402 positionXInput, positionYInput, idInput,
419 nameOffsetXInput, nameOffsetYInput, true,403 nameOffsetXInput, nameOffsetYInput, true,
420 infiniteServer, angle, priority);404 infiniteServer, angle, priority, lens);
421 transitionComponent.setUnderlyingTransition(t);405 transitionComponent.setUnderlyingTransition(t);
422 406
423 if (!displayName){407 if (!displayName){
@@ -468,7 +452,7 @@
468 }452 }
469 }453 }
470 nameGenerator.updateIndicesForAllModels(nameInput);454 nameGenerator.updateIndicesForAllModels(nameInput);
471 TimedPlaceComponent placeComponent = new TimedPlaceComponent(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput);455 TimedPlaceComponent placeComponent = new TimedPlaceComponent(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput, lens);
472 placeComponent.setUnderlyingPlace(p);456 placeComponent.setUnderlyingPlace(p);
473 457
474 if (!displayName){458 if (!displayName){
@@ -646,7 +630,8 @@
646 String inscriptionTempStorage, PlaceTransitionObject sourceIn,630 String inscriptionTempStorage, PlaceTransitionObject sourceIn,
647 PlaceTransitionObject targetIn,631 PlaceTransitionObject targetIn,
648 int _endx, int _endy, Template template, ConstantStore constants, Weight weight) throws FormatException {632 int _endx, int _endy, Template template, ConstantStore constants, Weight weight) throws FormatException {
649 TimedInputArcComponent tempArc = new TimedInputArcComponent(new TimedOutputArcComponent(sourceIn, targetIn, 1, idInput));633
634 TimedInputArcComponent tempArc = new TimedInputArcComponent(new TimedOutputArcComponent(sourceIn, targetIn, 1, idInput), lens);
650635
651 TimedPlace place = template.model().getPlaceByName(sourceIn.getName());636 TimedPlace place = template.model().getPlaceByName(sourceIn.getName());
652 TimedTransition transition = template.model().getTransitionByName(targetIn.getName());637 TimedTransition transition = template.model().getTransitionByName(targetIn.getName());
653638
=== modified file 'src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java'
--- src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java 2020-08-10 06:46:22 +0000
+++ src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java 2020-08-19 11:36:17 +0000
@@ -17,6 +17,7 @@
17import javax.xml.transform.dom.DOMSource;17import javax.xml.transform.dom.DOMSource;
18import javax.xml.transform.stream.StreamResult;18import javax.xml.transform.stream.StreamResult;
1919
20import dk.aau.cs.gui.TabContent;
20import org.w3c.dom.Attr;21import org.w3c.dom.Attr;
21import org.w3c.dom.DOMException;22import org.w3c.dom.DOMException;
22import org.w3c.dom.Document;23import org.w3c.dom.Document;
@@ -55,18 +56,19 @@
55 private final Iterable<TAPNQuery> queries;56 private final Iterable<TAPNQuery> queries;
56 private final Iterable<Constant> constants;57 private final Iterable<Constant> constants;
57 private final TimedArcPetriNetNetwork network;58 private final TimedArcPetriNetNetwork network;
58 private boolean isTimed;59 private final TabContent.TAPNLens lens;
59 private boolean isGame;
6060
61 public TimedArcPetriNetNetworkWriter(61 public TimedArcPetriNetNetworkWriter(
62 TimedArcPetriNetNetwork network, 62 TimedArcPetriNetNetwork network,
63 Iterable<Template> templates,63 Iterable<Template> templates,
64 Iterable<TAPNQuery> queries,64 Iterable<TAPNQuery> queries,
65 Iterable<Constant> constants) {65 Iterable<Constant> constants
66 ) {
66 this.network = network;67 this.network = network;
67 this.templates = templates;68 this.templates = templates;
68 this.queries = queries;69 this.queries = queries;
69 this.constants = constants;70 this.constants = constants;
71 this.lens = TabContent.TAPNLens.Default;
70 }72 }
7173
72 public TimedArcPetriNetNetworkWriter(74 public TimedArcPetriNetNetworkWriter(
@@ -74,14 +76,13 @@
74 Iterable<Template> templates,76 Iterable<Template> templates,
75 Iterable<TAPNQuery> queries,77 Iterable<TAPNQuery> queries,
76 Iterable<Constant> constants,78 Iterable<Constant> constants,
77 boolean isTimed,79 TabContent.TAPNLens lens
78 boolean isGame) {80 ) {
79 this.network = network;81 this.network = network;
80 this.templates = templates;82 this.templates = templates;
81 this.queries = queries;83 this.queries = queries;
82 this.constants = constants;84 this.constants = constants;
83 this.isTimed = isTimed;85 this.lens = lens;
84 this.isGame = isGame;
85 }86 }
86 87
87 public ByteArrayOutputStream savePNML() throws IOException, ParserConfigurationException, DOMException, TransformerConfigurationException, TransformerException {88 public ByteArrayOutputStream savePNML() throws IOException, ParserConfigurationException, DOMException, TransformerConfigurationException, TransformerException {
@@ -161,10 +162,10 @@
161 private void appendFeature(Document document, Element root) {162 private void appendFeature(Document document, Element root) {
162 String isTimed = "true";163 String isTimed = "true";
163 String isGame = "true";164 String isGame = "true";
164 if (!this.isTimed) {165 if (!lens.isTimed()) {
165 isTimed = "false";166 isTimed = "false";
166 }167 }
167 if (!this.isGame) {168 if (!lens.isGame()) {
168 isGame = "false";169 isGame = "false";
169 }170 }
170171
171172
=== modified file 'src/dk/aau/cs/verification/TAPNComposer.java'
--- src/dk/aau/cs/verification/TAPNComposer.java 2020-08-10 06:46:22 +0000
+++ src/dk/aau/cs/verification/TAPNComposer.java 2020-08-19 11:36:17 +0000
@@ -4,6 +4,7 @@
4import java.util.HashSet;4import java.util.HashSet;
5import java.util.Map.Entry;5import java.util.Map.Entry;
66
7import dk.aau.cs.gui.TabContent;
7import pipe.dataLayer.DataLayer;8import pipe.dataLayer.DataLayer;
8import pipe.gui.ExportBatchDialog;9import pipe.gui.ExportBatchDialog;
9import pipe.gui.graphicElements.Arc;10import pipe.gui.graphicElements.Arc;
@@ -45,8 +46,9 @@
45 private HashSet<String> processedSharedObjects;46 private HashSet<String> processedSharedObjects;
46 private HashMap<TimedArcPetriNet, DataLayer> guiModels;47 private HashMap<TimedArcPetriNet, DataLayer> guiModels;
47 private DataLayer composedGuiModel;48 private DataLayer composedGuiModel;
49 private final TabContent.TAPNLens lens = TabContent.TAPNLens.Default;
4850
49 public TAPNComposer(Messenger messenger, HashMap<TimedArcPetriNet, DataLayer> guiModels, boolean singleComponentNoPrefix, boolean inlineConstants){51 public TAPNComposer(Messenger messenger, HashMap<TimedArcPetriNet, DataLayer> guiModels, boolean singleComponentNoPrefix, boolean inlineConstants){
50 this.messenger = messenger;52 this.messenger = messenger;
51 53
52 HashMap<TimedArcPetriNet, DataLayer> newGuiModels = new HashMap<TimedArcPetriNet, DataLayer>();54 HashMap<TimedArcPetriNet, DataLayer> newGuiModels = new HashMap<TimedArcPetriNet, DataLayer>();
@@ -185,8 +187,9 @@
185 oldPlace.getPositionY(),187 oldPlace.getPositionY(),
186 oldPlace.getId(),188 oldPlace.getId(),
187 oldPlace.getNameOffsetX(),189 oldPlace.getNameOffsetX(),
188 oldPlace.getNameOffsetY()190 oldPlace.getNameOffsetY(),
189 );191 lens
192 );
190 newPlace.setUnderlyingPlace(constructedPlace);193 newPlace.setUnderlyingPlace(constructedPlace);
191 newPlace.setName(uniquePlaceName);194 newPlace.setName(uniquePlaceName);
192 guiModel.addPetriNetObject(newPlace);195 guiModel.addPetriNetObject(newPlace);
@@ -227,13 +230,14 @@
227 // Gui work230 // Gui work
228 if (this.guiModels != null) {231 if (this.guiModels != null) {
229 Place oldPlace = currentGuiModel.getPlaceByName(timedPlace.name());232 Place oldPlace = currentGuiModel.getPlaceByName(timedPlace.name());
230 TimedPlaceComponent newPlace = new TimedPlaceComponent(233 TimedPlaceComponent newPlace = new TimedPlaceComponent(
231 oldPlace.getPositionX() + offset.value1() * greatestWidth,234 oldPlace.getPositionX() + offset.value1() * greatestWidth,
232 oldPlace.getPositionY() + offset.value2() * greatestHeight,235 oldPlace.getPositionY() + offset.value2() * greatestHeight,
233 oldPlace.getId(),236 oldPlace.getId(),
234 oldPlace.getNameOffsetX(),237 oldPlace.getNameOffsetX(),
235 oldPlace.getNameOffsetY()238 oldPlace.getNameOffsetY(),
236 );239 lens
240 );
237 newPlace.setGuiModel(guiModel);241 newPlace.setGuiModel(guiModel);
238242
239 newPlace.setUnderlyingPlace(place);243 newPlace.setUnderlyingPlace(place);
@@ -284,15 +288,17 @@
284 if (this.guiModels != null) {288 if (this.guiModels != null) {
285 Transition oldTransition = currentGuiModel.getTransitionByName(timedTransition.name());289 Transition oldTransition = currentGuiModel.getTransitionByName(timedTransition.name());
286 TimedTransitionComponent newTransition = new TimedTransitionComponent(290 TimedTransitionComponent newTransition = new TimedTransitionComponent(
287 oldTransition.getPositionX() + offset.value1() * greatestWidth,291 oldTransition.getPositionX() + offset.value1() * greatestWidth,
288 oldTransition.getPositionY() + offset.value2() * greatestHeight,292 oldTransition.getPositionY() + offset.value2() * greatestHeight,
289 oldTransition.getId(),293 oldTransition.getId(),
290 oldTransition.getNameOffsetX(),294 oldTransition.getNameOffsetX(),
291 oldTransition.getNameOffsetY(),295 oldTransition.getNameOffsetY(),
292 true,296 true,
293 false,297 false,
294 oldTransition.getAngle(),298 oldTransition.getAngle(),
295 0);299 0,
300 lens
301 );
296 newTransition.setUnderlyingTransition(transition);302 newTransition.setUnderlyingTransition(transition);
297 newTransition.setName(uniqueTransitionName);303 newTransition.setName(uniqueTransitionName);
298 guiModel.addPetriNetObject(newTransition);304 guiModel.addPetriNetObject(newTransition);
@@ -380,12 +386,14 @@
380 Place guiSource = guiModel.getPlaceByName(mapping.map(sourceTemplate, arc.source().name()));386 Place guiSource = guiModel.getPlaceByName(mapping.map(sourceTemplate, arc.source().name()));
381 Transition guiTarget = guiModel.getTransitionByName(mapping.map(targetTemplate, arc.destination().name()));387 Transition guiTarget = guiModel.getTransitionByName(mapping.map(targetTemplate, arc.destination().name()));
382 388
383 TimedInputArcComponent newArc = new TimedInputArcComponent(new TimedOutputArcComponent(389 TimedInputArcComponent newArc = new TimedInputArcComponent(
384 guiSource,390 new TimedOutputArcComponent(
385 guiTarget,391 guiSource,
386 arc.getWeight().value(),392 guiTarget,
387 mapping.map(sourceTemplate, arc.source().name()) + "_to_" + mapping.map(targetTemplate, arc.destination().name())393 arc.getWeight().value(),
388 )394 mapping.map(sourceTemplate, arc.source().name()) + "_to_" + mapping.map(targetTemplate, arc.destination().name())
395 ),
396 lens
389 );397 );
390 398
391 // Build ArcPath399 // Build ArcPath
392400
=== modified file 'src/pipe/dataLayer/TAPNQuery.java'
--- src/pipe/dataLayer/TAPNQuery.java 2019-03-22 11:36:50 +0000
+++ src/pipe/dataLayer/TAPNQuery.java 2020-08-19 11:36:17 +0000
@@ -1,11 +1,8 @@
1package pipe.dataLayer;1package pipe.dataLayer;
22
3import dk.aau.cs.TCTL.*;
3import pipe.dataLayer.TAPNQuery.QueryCategory;4import pipe.dataLayer.TAPNQuery.QueryCategory;
4import pipe.gui.widgets.InclusionPlaces;5import pipe.gui.widgets.InclusionPlaces;
5import dk.aau.cs.TCTL.TCTLAFNode;
6import dk.aau.cs.TCTL.TCTLAbstractProperty;
7import dk.aau.cs.TCTL.TCTLEFNode;
8import dk.aau.cs.TCTL.TCTLEGNode;
9import dk.aau.cs.translations.ReductionOption;6import dk.aau.cs.translations.ReductionOption;
10import dk.aau.cs.verification.QueryType;7import dk.aau.cs.verification.QueryType;
118
@@ -416,4 +413,13 @@
416 public AlgorithmOption getAlgorithmOption(){413 public AlgorithmOption getAlgorithmOption(){
417 return this.algorithmOption;414 return this.algorithmOption;
418 }415 }
416
417 public boolean hasUntimedOnlyProperties(){
418 if(!(property instanceof TCTLAFNode || property instanceof TCTLAGNode || property instanceof TCTLEFNode || property instanceof TCTLEGNode)){
419 return true;
420 } else if(property.hasNestedPathQuantifiers()){
421 return true;
422 }
423 return false;
424 }
419}425}
420426
=== modified file 'src/pipe/gui/AnimationControlSidePanel.java'
--- src/pipe/gui/AnimationControlSidePanel.java 2020-07-16 09:52:11 +0000
+++ src/pipe/gui/AnimationControlSidePanel.java 2020-08-19 11:36:17 +0000
@@ -21,6 +21,7 @@
21import javax.swing.border.EmptyBorder;21import javax.swing.border.EmptyBorder;
22import javax.swing.text.AbstractDocument;22import javax.swing.text.AbstractDocument;
2323
24import dk.aau.cs.gui.TabContent;
24import dk.aau.cs.util.Require;25import dk.aau.cs.util.Require;
25import net.tapaal.swinghelpers.DecimalOnlyDocumentFilter;26import net.tapaal.swinghelpers.DecimalOnlyDocumentFilter;
26import dk.aau.cs.gui.components.NonsearchableJComboBox;27import dk.aau.cs.gui.components.NonsearchableJComboBox;
@@ -46,14 +47,17 @@
46 private int delayScale = 10;47 private int delayScale = 10;
47 private static final String PRECISION_ERROR_MESSAGE = "The precision is limited to 5 decimal places, the number will be truncated.";48 private static final String PRECISION_ERROR_MESSAGE = "The precision is limited to 5 decimal places, the number will be truncated.";
48 private static final String PRECISION_ERROR_DIALOG_TITLE = "Precision of Time Delay Exceeded";49 private static final String PRECISION_ERROR_DIALOG_TITLE = "Precision of Time Delay Exceeded";
4950 private JPanel sliderPanel;
5051 private JPanel timedelayPanel;
5152 JPanel firemode;
52 JTextField TimeDelayField = new JTextField();53
54
55
56 JTextField TimeDelayField = new JTextField();
53 JComboBox<String> firermodebox;57 JComboBox<String> firermodebox;
5458
5559
56 public AnimationControlSidePanel(Animator animator) {60 public AnimationControlSidePanel(Animator animator, TabContent.TAPNLens lens) {
57 Require.notNull(animator, "Animator can't be null");61 Require.notNull(animator, "Animator can't be null");
5862
59 this.animator = animator;63 this.animator = animator;
@@ -80,7 +84,7 @@
80 c.gridy = 2;84 c.gridy = 2;
81 add(animationToolBar, c);85 add(animationToolBar, c);
8286
83 JPanel firemode = new JPanel(new FlowLayout(FlowLayout.LEFT));87 firemode = new JPanel(new FlowLayout(FlowLayout.LEFT));
8488
85 JLabel label = new JLabel("Token selection: ");89 JLabel label = new JLabel("Token selection: ");
8690
@@ -104,10 +108,21 @@
104 this.setMinimumSize(new Dimension(275, 180));108 this.setMinimumSize(new Dimension(275, 180));
105 109
106 initializeDocumentFilterForDelayInput();110 initializeDocumentFilterForDelayInput();
111 hideIrrelevantInformation(lens);
107 }112 }
108113
114 private void hideIrrelevantInformation(TabContent.TAPNLens lens){
115 sliderPanel.setVisible(lens.isTimed());
116 timedelayPanel.setVisible(lens.isTimed());
117 firemode.setVisible(lens.isTimed());
118 if(!lens.isTimed()){
119 this.setPreferredSize(new Dimension(275, 50));
120 this.setMinimumSize(new Dimension(275, 50));
121 }
122 }
123
109 private void initDelaySlider() {124 private void initDelaySlider() {
110 JPanel sliderPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));125 sliderPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
111 JButton decrese = new JButton("-");126 JButton decrese = new JButton("-");
112 decrese.setPreferredSize(new Dimension(20, 30));127 decrese.setPreferredSize(new Dimension(20, 30));
113 decrese.addActionListener(e -> {128 decrese.addActionListener(e -> {
@@ -174,7 +189,7 @@
174189
175190
176 private void initDelayTimePanel(JToolBar animationToolBar) {191 private void initDelayTimePanel(JToolBar animationToolBar) {
177 JPanel timedelayPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));192 timedelayPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
178193
179 okButton = new javax.swing.JButton();194 okButton = new javax.swing.JButton();
180195
181196
=== modified file 'src/pipe/gui/AnimationSettingsDialog.java'
--- src/pipe/gui/AnimationSettingsDialog.java 2020-07-20 07:19:51 +0000
+++ src/pipe/gui/AnimationSettingsDialog.java 2020-08-19 11:36:17 +0000
@@ -9,6 +9,7 @@
9import javax.swing.JDialog;9import javax.swing.JDialog;
10import javax.swing.JPanel;10import javax.swing.JPanel;
1111
12import dk.aau.cs.gui.TabContent;
12import pipe.gui.widgets.EscapableDialog;13import pipe.gui.widgets.EscapableDialog;
1314
14public class AnimationSettingsDialog {15public class AnimationSettingsDialog {
@@ -16,8 +17,8 @@
16 private static JDialog dialog;17 private static JDialog dialog;
17 private static DelayEnabledTransitionControl delayEnabled;18 private static DelayEnabledTransitionControl delayEnabled;
18 private static SimulationControl simControl;19 private static SimulationControl simControl;
19 20
20 private static JPanel getContent(){21 private static JPanel getContent(TabContent.TAPNLens lens){
21 JPanel content = new JPanel(new BorderLayout());22 JPanel content = new JPanel(new BorderLayout());
22 23
23 delayEnabled = DelayEnabledTransitionControl.getInstance();24 delayEnabled = DelayEnabledTransitionControl.getInstance();
@@ -26,28 +27,32 @@
26 27
27 simControl.addRandomSimulationActionListener(e -> {28 simControl.addRandomSimulationActionListener(e -> {
28 if(simControl.randomSimulation()){29 if(simControl.randomSimulation()){
29 delayEnabled.randomMode.setSelected(true);30 simControl.randomMode.setSelected(true);
30 }31 }
31 CreateGui.getCurrentTab().getTransitionFireingComponent().updateFireButton();32 CreateGui.getCurrentTab().getTransitionFireingComponent().updateFireButton();
32 });33 });
33 34
34 content.add(delayEnabled, BorderLayout.NORTH);35 content.add(delayEnabled, BorderLayout.NORTH);
35 content.add(simControl, BorderLayout.SOUTH);36 content.add(simControl, BorderLayout.SOUTH);
37 hideTimedInformation(lens);
36 return content;38 return content;
37 }39 }
38 40
39 41 private static void hideTimedInformation(TabContent.TAPNLens lens){
40 public static void showAnimationSettings(){42 delayEnabled.setVisible(lens.isTimed());
43 }
44
45 public static void showAnimationSettings(TabContent.TAPNLens lens){
41 JPanel contentPane = new JPanel(new GridBagLayout());46 JPanel contentPane = new JPanel(new GridBagLayout());
42 47
43 JButton closeDialogButton = new JButton("Close");48 JButton closeDialogButton = new JButton("Close");
44 closeDialogButton.addActionListener(o -> dialog.setVisible(false));49 closeDialogButton.addActionListener(o -> dialog.setVisible(false));
45 50
46 GridBagConstraints gbc = new GridBagConstraints();51 GridBagConstraints gbc = new GridBagConstraints();
47 gbc.anchor = GridBagConstraints.NORTHWEST;52 gbc.anchor = GridBagConstraints.NORTHWEST;
48 gbc.insets = new Insets(0, 3, 0, 3);53 gbc.insets = new Insets(0, 3, 0, 3);
49 gbc.fill = GridBagConstraints.BOTH;54 gbc.fill = GridBagConstraints.BOTH;
50 contentPane.add(getContent(), gbc);55 contentPane.add(getContent(lens), gbc);
51 56
52 gbc = new GridBagConstraints();57 gbc = new GridBagConstraints();
53 gbc.anchor = GridBagConstraints.NORTHWEST;58 gbc.anchor = GridBagConstraints.NORTHWEST;
5459
=== modified file 'src/pipe/gui/Animator.java'
--- src/pipe/gui/Animator.java 2020-07-20 12:17:24 +0000
+++ src/pipe/gui/Animator.java 2020-08-19 11:36:17 +0000
@@ -705,4 +705,8 @@
705 }705 }
706 }706 }
707707
708 public TabContent getTab(){
709 return tab;
710 }
711
708}712}
709713
=== modified file 'src/pipe/gui/CreateGui.java'
--- src/pipe/gui/CreateGui.java 2020-07-22 10:39:07 +0000
+++ src/pipe/gui/CreateGui.java 2020-08-19 11:36:17 +0000
@@ -157,4 +157,8 @@
157157
158 public static boolean useExtendedBounds = false;158 public static boolean useExtendedBounds = false;
159159
160 //XXX Moved from guiframe to static access, while refactoring.
161 @Deprecated
162 public static Pipe.ElementType guiMode;
163
160}164}
161165
=== modified file 'src/pipe/gui/DelayEnabledTransitionControl.java'
--- src/pipe/gui/DelayEnabledTransitionControl.java 2020-07-20 08:04:40 +0000
+++ src/pipe/gui/DelayEnabledTransitionControl.java 2020-08-19 11:36:17 +0000
@@ -23,14 +23,12 @@
2323
24 private static DelayMode defaultDelayMode = ShortestDelayMode.getInstance();24 private static DelayMode defaultDelayMode = ShortestDelayMode.getInstance();
25 private static BigDecimal defaultGranularity = new BigDecimal("0.1");25 private static BigDecimal defaultGranularity = new BigDecimal("0.1");
26 private static boolean defaultIsRandomTrasition;26
27
28 private final JLabel precitionLabel;27 private final JLabel precitionLabel;
29 private final JSlider delayEnabledPrecision;28 private final JSlider delayEnabledPrecision;
30 private final JLabel delayModeLabel;29 private final JLabel delayModeLabel;
31 private final JComboBox<DelayMode> delayMode;30 private final JComboBox<DelayMode> delayMode;
32 final JCheckBox randomMode = new JCheckBox("Choose next transition randomly");31
33
34 private DelayEnabledTransitionControl() {32 private DelayEnabledTransitionControl() {
35 super(new GridBagLayout());33 super(new GridBagLayout());
36 34
@@ -57,8 +55,7 @@
57 delayMode = new JComboBox<>(items);55 delayMode = new JComboBox<>(items);
58 setDelayMode(defaultDelayMode);56 setDelayMode(defaultDelayMode);
5957
60 setRandomTransitionMode(defaultIsRandomTrasition);58
61
62 GridBagConstraints gbc = new GridBagConstraints();59 GridBagConstraints gbc = new GridBagConstraints();
63 gbc.gridwidth = 2;60 gbc.gridwidth = 2;
64 gbc.anchor = GridBagConstraints.WEST;61 gbc.anchor = GridBagConstraints.WEST;
@@ -92,13 +89,6 @@
92 gbc.gridy = 2;89 gbc.gridy = 2;
93 add(delayMode, gbc);90 add(delayMode, gbc);
94 91
95 gbc = new GridBagConstraints();
96 gbc.anchor = GridBagConstraints.WEST;
97 gbc.weightx = 1.0;
98 gbc.gridx = 0;
99 gbc.gridy = 3;
100 add(randomMode, gbc);
101
102 setBorder(BorderFactory.createCompoundBorder(92 setBorder(BorderFactory.createCompoundBorder(
103 BorderFactory.createTitledBorder("Delay controller"), 93 BorderFactory.createTitledBorder("Delay controller"),
104 BorderFactory.createEmptyBorder(3, 3, 3, 3)));94 BorderFactory.createEmptyBorder(3, 3, 3, 3)));
@@ -130,19 +120,9 @@
130 public void setDelayMode(DelayMode delayMode){120 public void setDelayMode(DelayMode delayMode){
131 this.delayMode.setSelectedItem(delayMode);121 this.delayMode.setSelectedItem(delayMode);
132 }122 }
133 123
134 public boolean isRandomTransitionMode(){124
135 if(SimulationControl.getInstance().randomSimulation()){125
136 return true;
137 } else {
138 return randomMode.isSelected();
139 }
140 }
141
142 public void setRandomTransitionMode(boolean randomTransition){
143 randomMode.setSelected(randomTransition);
144 }
145
146 private static DelayEnabledTransitionControl instance;126 private static DelayEnabledTransitionControl instance;
147 127
148 public static DelayEnabledTransitionControl getInstance(){128 public static DelayEnabledTransitionControl getInstance(){
@@ -176,18 +156,6 @@
176 }156 }
177 }157 }
178158
179 public static void setDefaultIsRandomTransition(boolean delayEnabledTransitionIsRandomTransition) {
180 defaultIsRandomTrasition = delayEnabledTransitionIsRandomTransition;
181 }
182
183 public static boolean isRandomTransition(){
184 if(instance != null){
185 return getInstance().isRandomTransitionMode();
186 } else {
187 return defaultIsRandomTrasition;
188 }
189 }
190
191 @Override159 @Override
192 public void setEnabled(boolean enabled) {160 public void setEnabled(boolean enabled) {
193 super.setEnabled(enabled);161 super.setEnabled(enabled);
@@ -195,6 +163,5 @@
195 delayEnabledPrecision.setEnabled(enabled);163 delayEnabledPrecision.setEnabled(enabled);
196 delayModeLabel.setEnabled(enabled);164 delayModeLabel.setEnabled(enabled);
197 delayMode.setEnabled(enabled);165 delayMode.setEnabled(enabled);
198 randomMode.setEnabled(enabled);
199 }166 }
200}167}
201168
=== modified file 'src/pipe/gui/GuiFrame.java'
--- src/pipe/gui/GuiFrame.java 2020-08-13 08:58:53 +0000
+++ src/pipe/gui/GuiFrame.java 2020-08-19 11:36:17 +0000
@@ -11,6 +11,7 @@
11import java.net.*;11import java.net.*;
12import java.nio.charset.StandardCharsets;12import java.nio.charset.StandardCharsets;
13import java.util.*;13import java.util.*;
14import java.util.List;
14import java.util.jar.JarEntry;15import java.util.jar.JarEntry;
15import java.util.jar.JarFile;16import java.util.jar.JarFile;
16import javax.swing.*;17import javax.swing.*;
@@ -25,6 +26,7 @@
25import net.tapaal.helpers.Reference.Reference;26import net.tapaal.helpers.Reference.Reference;
26import net.tapaal.swinghelpers.ExtendedJTabbedPane;27import net.tapaal.swinghelpers.ExtendedJTabbedPane;
27import net.tapaal.swinghelpers.ToggleButtonWithoutText;28import net.tapaal.swinghelpers.ToggleButtonWithoutText;
29import org.jetbrains.annotations.NotNull;
28import pipe.gui.Pipe.ElementType;30import pipe.gui.Pipe.ElementType;
29import pipe.gui.action.GuiAction;31import pipe.gui.action.GuiAction;
30import pipe.gui.widgets.WorkflowDialog;32import pipe.gui.widgets.WorkflowDialog;
@@ -43,8 +45,6 @@
4345
44 private final String frameTitle;46 private final String frameTitle;
4547
46 private Pipe.ElementType mode;
47
48 private int newNameCounter = 1;48 private int newNameCounter = 1;
4949
50 final MutableReference<GuiFrameControllerActions> guiFrameController = new MutableReference<>();50 final MutableReference<GuiFrameControllerActions> guiFrameController = new MutableReference<>();
@@ -53,6 +53,9 @@
5353
54 private final StatusBar statusBar;54 private final StatusBar statusBar;
55 private JMenuBar menuBar;55 private JMenuBar menuBar;
56 JMenu drawMenu;
57 JMenu animateMenu;
58 JMenu viewMenu;
56 private JToolBar drawingToolBar;59 private JToolBar drawingToolBar;
57 private final JLabel featureInfoText = new JLabel();60 private final JLabel featureInfoText = new JLabel();
58 private JComboBox<String> timeFeatureOptions = new JComboBox(new String[]{"No", "Yes"});61 private JComboBox<String> timeFeatureOptions = new JComboBox(new String[]{"No", "Yes"});
@@ -281,47 +284,6 @@
281 currentTab.ifPresent(o -> o.setMode(ElementType.ANNOTATION));284 currentTab.ifPresent(o -> o.setMode(ElementType.ANNOTATION));
282 }285 }
283 };286 };
284 private final GuiAction inhibarcAction = new GuiAction("Inhibitor arc", "Add an inhibitor arc (I)", "I", true) {
285 public void actionPerformed(ActionEvent e) {
286 currentTab.ifPresent(o -> o.setMode(ElementType.TAPNINHIBITOR_ARC));
287 }
288 };
289 private final GuiAction transAction = new GuiAction("Transition", "Add a transition (T)", "T", true) {
290 public void actionPerformed(ActionEvent e) {
291 currentTab.ifPresent(o -> o.setMode(ElementType.TAPNTRANS));
292 }
293 };
294 private final GuiAction tokenAction = new GuiAction("Add token", "Add a token (+)", "typed +", true) {
295 public void actionPerformed(ActionEvent e) {
296 currentTab.ifPresent(o -> o.setMode(ElementType.ADDTOKEN));
297 }
298 };
299 private final GuiAction selectAction = new GuiAction("Select", "Select components (S)", "S", true) {
300 public void actionPerformed(ActionEvent e) {
301 currentTab.ifPresent(o -> o.setMode(ElementType.SELECT));
302 }
303 };
304 private final GuiAction deleteTokenAction = new GuiAction("Delete token", "Delete a token (-)", "typed -", true) {
305 public void actionPerformed(ActionEvent e) {
306 currentTab.ifPresent(o -> o.setMode(ElementType.DELTOKEN));
307 }
308 };
309 private final GuiAction timedPlaceAction = new GuiAction("Place", "Add a place (P)", "P", true) {
310 public void actionPerformed(ActionEvent e) {
311 currentTab.ifPresent(o -> o.setMode(ElementType.TAPNPLACE));
312 }
313 };
314
315 private final GuiAction timedArcAction = new GuiAction("Arc", "Add an arc (A)", "A", true) {
316 public void actionPerformed(ActionEvent e) {
317 currentTab.ifPresent(o -> o.setMode(ElementType.TAPNARC));
318 }
319 };
320 private final GuiAction transportArcAction = new GuiAction("Transport arc", "Add a transport arc (R)", "R", true) {
321 public void actionPerformed(ActionEvent e) {
322 currentTab.ifPresent(o -> o.setMode(ElementType.TRANSPORTARC));
323 }
324 };
325287
326 private final GuiAction showTokenAgeAction = new GuiAction("Display token age", "Show/hide displaying the token age 0.0 (when hidden the age 0.0 is drawn as a dot)", KeyStroke.getKeyStroke('9', shortcutkey), true) {288 private final GuiAction showTokenAgeAction = new GuiAction("Display token age", "Show/hide displaying the token age 0.0 (when hidden the age 0.0 is drawn as a dot)", KeyStroke.getKeyStroke('9', shortcutkey), true) {
327 public void actionPerformed(ActionEvent e) {289 public void actionPerformed(ActionEvent e) {
@@ -436,17 +398,9 @@
436 currentTab.ifPresent(TabContentActions::stepBackwards);398 currentTab.ifPresent(TabContentActions::stepBackwards);
437 }399 }
438 };400 };
439 private final GuiAction timeAction = new GuiAction("Delay one time unit", "Let time pass one time unit", "W") {401
440 public void actionPerformed(ActionEvent e) {402
441 currentTab.ifPresent(TabContentActions::timeDelay);403 private GuiAction prevcomponentAction = new GuiAction("Previous component", "Previous component", "pressed UP") {
442 }
443 };
444 private final GuiAction delayFireAction = new GuiAction("Delay and fire", "Delay and fire selected transition", "F") {
445 public void actionPerformed(ActionEvent e) {
446 currentTab.ifPresent(TabContentActions::delayAndFire);
447 }
448 };
449 private final GuiAction prevcomponentAction = new GuiAction("Previous component", "Previous component", "pressed UP") {
450 public void actionPerformed(ActionEvent e) {404 public void actionPerformed(ActionEvent e) {
451 currentTab.ifPresent(TabContentActions::previousComponent);405 currentTab.ifPresent(TabContentActions::previousComponent);
452 }406 }
@@ -477,6 +431,7 @@
477431
478 private JCheckBoxMenuItem showZeroToInfinityIntervalsCheckBox;432 private JCheckBoxMenuItem showZeroToInfinityIntervalsCheckBox;
479 private JCheckBoxMenuItem showTokenAgeCheckBox;433 private JCheckBoxMenuItem showTokenAgeCheckBox;
434 private JCheckBoxMenuItem showDelayEnabledTransitionsCheckbox;
480435
481 private JMenu zoomMenu;436 private JMenu zoomMenu;
482437
@@ -496,7 +451,7 @@
496 this.setMinimumSize(new Dimension(825, 480));451 this.setMinimumSize(new Dimension(825, 480));
497452
498 setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);453 setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
499 appTab= new ExtendedJTabbedPane<TabContent>() {454 appTab = new ExtendedJTabbedPane<TabContent>() {
500 @Override455 @Override
501 public Component generator() {456 public Component generator() {
502 return new TabComponent(this) {457 return new TabComponent(this) {
@@ -586,7 +541,7 @@
586 }541 }
587542
588543
589 if (Platform.isMac()){544 if (Platform.isMac()) {
590545
591 //Set specific settings546 //Set specific settings
592 System.setProperty("apple.laf.useScreenMenuBar", "true");547 System.setProperty("apple.laf.useScreenMenuBar", "true");
@@ -616,11 +571,11 @@
616 **/571 **/
617 private void buildMenus() {572 private void buildMenus() {
618 menuBar = new JMenuBar();573 menuBar = new JMenuBar();
619
620 menuBar.add(buildMenuFiles());574 menuBar.add(buildMenuFiles());
621 menuBar.add(buildMenuEdit());575 menuBar.add(buildMenuEdit());
622 menuBar.add(buildMenuView());576 menuBar.add(buildMenuView());
623 menuBar.add(buildMenuDraw());577 menuBar.add(buildMenuDraw());
578
624 menuBar.add(buildMenuAnimation());579 menuBar.add(buildMenuAnimation());
625 menuBar.add(buildMenuTools());580 menuBar.add(buildMenuTools());
626 menuBar.add(buildMenuHelp());581 menuBar.add(buildMenuHelp());
@@ -658,35 +613,14 @@
658613
659 private JMenu buildMenuDraw() {614 private JMenu buildMenuDraw() {
660 /* Draw menu */615 /* Draw menu */
661 JMenu drawMenu = new JMenu("Draw");616 drawMenu = new JMenu("Draw");
662 drawMenu.setMnemonic('D');617 drawMenu.setMnemonic('D');
663
664 drawMenu.add(selectAction);
665 drawMenu.addSeparator();
666
667 drawMenu.add(timedPlaceAction);
668
669 drawMenu.add(transAction);
670
671 drawMenu.add(timedArcAction);
672
673 drawMenu.add(transportArcAction);
674
675 drawMenu.add(inhibarcAction);
676
677 drawMenu.add(annotationAction);
678
679 drawMenu.addSeparator();
680
681 drawMenu.add(tokenAction);
682
683 drawMenu.add(deleteTokenAction);
684 return drawMenu;618 return drawMenu;
685 }619 }
686620
687 private JMenu buildMenuView() {621 private JMenu buildMenuView() {
688 /* ViewMenu */622 /* ViewMenu */
689 JMenu viewMenu = new JMenu("View");623 viewMenu = new JMenu("View");
690 viewMenu.setMnemonic('V');624 viewMenu.setMnemonic('V');
691625
692 zoomMenu = new JMenu("Zoom");626 zoomMenu = new JMenu("Zoom");
@@ -725,7 +659,7 @@
725659
726 addCheckboxMenuItem(viewMenu, showEnabledTransitionsAction);660 addCheckboxMenuItem(viewMenu, showEnabledTransitionsAction);
727661
728 addCheckboxMenuItem(viewMenu, showDelayEnabledTransitionsAction);662 showDelayEnabledTransitionsCheckbox = addCheckboxMenuItem(viewMenu, showDelayEnabledTransitionsAction);
729663
730 showZeroToInfinityIntervalsCheckBox = addCheckboxMenuItem(viewMenu, showZeroToInfinityIntervals(), showZeroToInfinityIntervalsAction);664 showZeroToInfinityIntervalsCheckBox = addCheckboxMenuItem(viewMenu, showZeroToInfinityIntervals(), showZeroToInfinityIntervalsAction);
731665
@@ -744,7 +678,7 @@
744678
745 private JMenu buildMenuAnimation() {679 private JMenu buildMenuAnimation() {
746 /* Simulator */680 /* Simulator */
747 JMenu animateMenu = new JMenu("Simulator");681 animateMenu = new JMenu("Simulator");
748 animateMenu.setMnemonic('A');682 animateMenu.setMnemonic('A');
749 animateMenu.add(startAction);683 animateMenu.add(startAction);
750684
@@ -752,10 +686,6 @@
752 animateMenu.add(stepbackwardAction);686 animateMenu.add(stepbackwardAction);
753 animateMenu.add(stepforwardAction);687 animateMenu.add(stepforwardAction);
754688
755 animateMenu.add(timeAction);
756
757 animateMenu.add(delayFireAction);
758
759 animateMenu.add(prevcomponentAction);689 animateMenu.add(prevcomponentAction);
760690
761 animateMenu.add(nextcomponentAction);691 animateMenu.add(nextcomponentAction);
@@ -878,25 +808,6 @@
878 drawingToolBar.addSeparator();808 drawingToolBar.addSeparator();
879 drawingToolBar.setRequestFocusEnabled(false);809 drawingToolBar.setRequestFocusEnabled(false);
880810
881 // Normal arraw
882 drawingToolBar.add(new ToggleButtonWithoutText(selectAction));
883
884
885 // Drawing elements
886 drawingToolBar.addSeparator();
887 drawingToolBar.add(new ToggleButtonWithoutText(timedPlaceAction));
888 drawingToolBar.add(new ToggleButtonWithoutText(transAction));
889 drawingToolBar.add(new ToggleButtonWithoutText(timedArcAction));
890 drawingToolBar.add(new ToggleButtonWithoutText(transportArcAction));
891 drawingToolBar.add(new ToggleButtonWithoutText(inhibarcAction));
892
893 drawingToolBar.add(new ToggleButtonWithoutText(annotationAction));
894
895 // Tokens
896 drawingToolBar.addSeparator();
897 drawingToolBar.add(new ToggleButtonWithoutText(tokenAction));
898 drawingToolBar.add(new ToggleButtonWithoutText(deleteTokenAction));
899
900 // Create panel to put toolbars in811 // Create panel to put toolbars in
901 JPanel toolBarPanel = new JPanel();812 JPanel toolBarPanel = new JPanel();
902 toolBarPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));813 toolBarPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
@@ -1001,21 +912,10 @@
1001 exportTraceAction.setEnabled(false);912 exportTraceAction.setEnabled(false);
1002 importTraceAction.setEnabled(false);913 importTraceAction.setEnabled(false);
1003914
1004 timedPlaceAction.setEnabled(true);
1005 timedArcAction.setEnabled(true);
1006 inhibarcAction.setEnabled(true);
1007 transportArcAction.setEnabled(true);
1008
1009 annotationAction.setEnabled(true);915 annotationAction.setEnabled(true);
1010 transAction.setEnabled(true);
1011 tokenAction.setEnabled(true);
1012 deleteAction.setEnabled(true);916 deleteAction.setEnabled(true);
1013 selectAllAction.setEnabled(true);917 selectAllAction.setEnabled(true);
1014 selectAction.setEnabled(true);
1015 deleteTokenAction.setEnabled(true);
1016918
1017 timeAction.setEnabled(false);
1018 delayFireAction.setEnabled(false);
1019 stepbackwardAction.setEnabled(false);919 stepbackwardAction.setEnabled(false);
1020 stepforwardAction.setEnabled(false);920 stepforwardAction.setEnabled(false);
1021 prevcomponentAction.setEnabled(false);921 prevcomponentAction.setEnabled(false);
@@ -1038,7 +938,6 @@
1038 WorkflowDialog.showDialog();938 WorkflowDialog.showDialog();
1039 }939 }
1040940
1041 statusBar.changeText(StatusBar.textforDrawing);
1042 //Enable editor focus traversal policy941 //Enable editor focus traversal policy
1043 setFocusTraversalPolicy(new EditorFocusTraversalPolicy());942 setFocusTraversalPolicy(new EditorFocusTraversalPolicy());
1044 fixBug812694GrayMenuAfterSimulationOnMac();943 fixBug812694GrayMenuAfterSimulationOnMac();
@@ -1047,18 +946,9 @@
1047 case animation:946 case animation:
1048 enableAllActions(true);947 enableAllActions(true);
1049948
1050 timedPlaceAction.setEnabled(false);
1051 timedArcAction.setEnabled(false);
1052 inhibarcAction.setEnabled(false);
1053 transportArcAction.setEnabled(false);
1054
1055 annotationAction.setEnabled(false);949 annotationAction.setEnabled(false);
1056 transAction.setEnabled(false);
1057 tokenAction.setEnabled(false);
1058 deleteAction.setEnabled(false);950 deleteAction.setEnabled(false);
1059 selectAllAction.setEnabled(false);951 selectAllAction.setEnabled(false);
1060 selectAction.setEnabled(false);
1061 deleteTokenAction.setEnabled(false);
1062952
1063 alignToGrid.setEnabled(false);953 alignToGrid.setEnabled(false);
1064954
@@ -1066,9 +956,6 @@
1066 showConstantsAction.setEnabled(false);956 showConstantsAction.setEnabled(false);
1067 showQueriesAction.setEnabled(false);957 showQueriesAction.setEnabled(false);
1068958
1069 timeAction.setEnabled(true);
1070
1071 delayFireAction.setEnabled(true);
1072 stepbackwardAction.setEnabled(true);959 stepbackwardAction.setEnabled(true);
1073 stepforwardAction.setEnabled(true);960 stepforwardAction.setEnabled(true);
1074 prevcomponentAction.setEnabled(true);961 prevcomponentAction.setEnabled(true);
@@ -1091,7 +978,6 @@
1091978
1092 getCurrentTab().getAnimationController().requestFocusInWindow();979 getCurrentTab().getAnimationController().requestFocusInWindow();
1093980
1094 statusBar.changeText(StatusBar.textforAnimation);
1095 //Enable simulator focus traversal policy981 //Enable simulator focus traversal policy
1096 setFocusTraversalPolicy(new SimulatorFocusTraversalPolicy());982 setFocusTraversalPolicy(new SimulatorFocusTraversalPolicy());
1097983
@@ -1101,21 +987,9 @@
1101 importTraceAction.setEnabled(false);987 importTraceAction.setEnabled(false);
1102 verifyAction.setEnabled(false);988 verifyAction.setEnabled(false);
1103989
1104 timedPlaceAction.setEnabled(false);
1105 timedArcAction.setEnabled(false);
1106 inhibarcAction.setEnabled(false);
1107 transportArcAction.setEnabled(false);
1108
1109 annotationAction.setEnabled(false);990 annotationAction.setEnabled(false);
1110 transAction.setEnabled(false);
1111 tokenAction.setEnabled(false);
1112 deleteAction.setEnabled(false);
1113 selectAllAction.setEnabled(false);991 selectAllAction.setEnabled(false);
1114 selectAction.setEnabled(false);
1115 deleteTokenAction.setEnabled(false);
1116992
1117 timeAction.setEnabled(false);
1118 delayFireAction.setEnabled(false);
1119 stepbackwardAction.setEnabled(false);993 stepbackwardAction.setEnabled(false);
1120 stepforwardAction.setEnabled(false);994 stepforwardAction.setEnabled(false);
1121995
@@ -1135,7 +1009,7 @@
1135 enableAllActions(false);1009 enableAllActions(false);
11361010
1137 // Disable All Actions1011 // Disable All Actions
1138 statusBar.changeText(StatusBar.textforNoNet);1012 statusBar.changeText("Open a net to start editing");
1139 setFocusTraversalPolicy(null);1013 setFocusTraversalPolicy(null);
11401014
1141 break;1015 break;
@@ -1262,6 +1136,9 @@
1262 break;1136 break;
1263 case noNet:1137 case noNet:
1264 setFeatureInfoText(null);1138 setFeatureInfoText(null);
1139 registerDrawingActions(List.of());
1140 registerAnimationActions(List.of());
1141 //registerViewActions(List.of());
1265 break;1142 break;
12661143
1267 default:1144 default:
@@ -1270,7 +1147,74 @@
12701147
1271 // Enable actions based on GUI mode1148 // Enable actions based on GUI mode
1272 enableGUIActions(mode);1149 enableGUIActions(mode);
12731150 if (currentTab != null) {
1151 currentTab.ifPresent(o -> o.updateEnabledActions(mode));
1152 }
1153 }
1154
1155 @Override
1156 public void registerDrawingActions(@NotNull List<GuiAction> drawActions) {
1157
1158 drawingToolBar.removeAll();
1159 drawMenu.removeAll();
1160
1161 if (drawActions.size() > 0) {
1162 drawMenu.setEnabled(true);
1163 drawingToolBar.addSeparator();
1164
1165 for (GuiAction action : drawActions) {
1166 drawingToolBar.add(new ToggleButtonWithoutText(action));
1167 drawMenu.add(action);
1168 }
1169
1170 drawingToolBar.addSeparator();
1171 drawingToolBar.add(featureInfoText);
1172 } else {
1173 drawMenu.setEnabled(false);
1174 }
1175
1176 }
1177 @Override
1178 public void registerAnimationActions(@NotNull List<GuiAction> animationActions) {
1179
1180 animateMenu.removeAll();
1181
1182 if (animationActions.size() > 0) {
1183
1184 animateMenu.setEnabled(true);
1185 animateMenu.add(startAction);
1186
1187 animateMenu.add(stepbackwardAction);
1188 animateMenu.add(stepforwardAction);
1189
1190 for (GuiAction action : animationActions) {
1191 animateMenu.add(action);
1192 }
1193
1194 animateMenu.add(prevcomponentAction);
1195 animateMenu.add(nextcomponentAction);
1196
1197 animateMenu.addSeparator();
1198 animateMenu.add(exportTraceAction);
1199 animateMenu.add(importTraceAction);
1200 } else {
1201 animateMenu.setEnabled(false);
1202 }
1203 }
1204
1205 @Override
1206 public void registerViewActions(@NotNull List<GuiAction> viewActions) {
1207 //TODO: This is a temporary implementation until view actions can be moved to tab content
1208
1209 if (!getCurrentTab().getLens().isTimed()) {
1210 showZeroToInfinityIntervalsCheckBox.setVisible(false);
1211 showTokenAgeCheckBox.setVisible(false);
1212 showDelayEnabledTransitionsCheckbox.setVisible(false);
1213 } else {
1214 showZeroToInfinityIntervalsCheckBox.setVisible(true);
1215 showTokenAgeCheckBox.setVisible(true);
1216 showDelayEnabledTransitionsCheckbox.setVisible(true);
1217 }
1274 }1218 }
12751219
1276 private void fixBug812694GrayMenuAfterSimulationOnMac() {1220 private void fixBug812694GrayMenuAfterSimulationOnMac() {
@@ -1284,24 +1228,9 @@
1284 a.dispose();1228 a.dispose();
1285 }1229 }
12861230
1287 //XXX temp while refactoring, kyrke - 2019-07-25, should only be called from TabContent
1288 @Override1231 @Override
1289 public void updateMode(Pipe.ElementType _mode) {1232 public void setStatusBarText(String s) {
12901233 statusBar.changeText(Objects.requireNonNullElse(s, ""));
1291 mode = _mode;
1292
1293 // deselect other actions
1294 transAction.setSelected(mode == ElementType.TAPNTRANS);
1295 timedPlaceAction.setSelected(mode == ElementType.TAPNPLACE);
1296 timedArcAction.setSelected(mode == ElementType.TAPNARC);
1297 transportArcAction.setSelected(mode == ElementType.TRANSPORTARC);
1298 inhibarcAction.setSelected(mode == ElementType.TAPNINHIBITOR_ARC);
1299 tokenAction.setSelected(mode == ElementType.ADDTOKEN);
1300 deleteTokenAction.setSelected(mode == ElementType.DELTOKEN);
1301 selectAction.setSelected(mode == ElementType.SELECT);
1302 annotationAction.setSelected(mode == ElementType.ANNOTATION);
1303
1304 statusBar.changeText(mode);
1305 }1234 }
13061235
13071236
@@ -1368,10 +1297,6 @@
1368 showTokenAgeAction.setSelected(b);1297 showTokenAgeAction.setSelected(b);
1369 }1298 }
13701299
1371 public Pipe.ElementType getMode() {
1372 return mode;
1373 }
1374
1375 public void setTitle(String title) {1300 public void setTitle(String title) {
1376 super.setTitle((title == null) ? frameTitle : frameTitle + ": " + title);1301 super.setTitle((title == null) ? frameTitle : frameTitle + ": " + title);
1377 }1302 }
@@ -1403,7 +1328,6 @@
1403 zoomComboBox.addActionListener(zoomComboListener);1328 zoomComboBox.addActionListener(zoomComboListener);
1404 }1329 }
14051330
1406
1407 private boolean canNetBeSavedAndShowMessage() {1331 private boolean canNetBeSavedAndShowMessage() {
1408 if (getCurrentTab().network().paintNet()) {1332 if (getCurrentTab().network().paintNet()) {
1409 return true;1333 return true;
14101334
=== modified file 'src/pipe/gui/GuiFrameActions.java'
--- src/pipe/gui/GuiFrameActions.java 2020-08-04 19:07:12 +0000
+++ src/pipe/gui/GuiFrameActions.java 2020-08-19 11:36:17 +0000
@@ -3,8 +3,10 @@
3import dk.aau.cs.gui.TabContent;3import dk.aau.cs.gui.TabContent;
4import dk.aau.cs.gui.TabContentActions;4import dk.aau.cs.gui.TabContentActions;
5import net.tapaal.helpers.Reference.Reference;5import net.tapaal.helpers.Reference.Reference;
6import pipe.gui.action.GuiAction;
67
7import java.awt.*;8import java.awt.*;
9import java.util.List;
810
9/**11/**
10 * Used to delegate control of the state of AppGUI to tabs12 * Used to delegate control of the state of AppGUI to tabs
@@ -26,8 +28,13 @@
2628
27 void setGUIMode(GuiFrame.GUIMode animation);29 void setGUIMode(GuiFrame.GUIMode animation);
2830
29 //XXX temp while refactoring, kyrke - 2019-07-2531 void registerDrawingActions(List<GuiAction> drawActions);
30 void updateMode(Pipe.ElementType mode);32
33 void registerAnimationActions(List<GuiAction> animationActions);
34
35 void registerViewActions(List<GuiAction> viewActions);
36
37 void setStatusBarText(String s);
3138
32 void registerController(GuiFrameControllerActions guiFrameController, Reference<TabContentActions> currentTab);39 void registerController(GuiFrameControllerActions guiFrameController, Reference<TabContentActions> currentTab);
3340
3441
=== modified file 'src/pipe/gui/GuiFrameController.java'
--- src/pipe/gui/GuiFrameController.java 2020-08-10 09:25:25 +0000
+++ src/pipe/gui/GuiFrameController.java 2020-08-19 11:36:17 +0000
@@ -85,7 +85,7 @@
8585
86 DelayEnabledTransitionControl.setDefaultDelayMode(prefs.getDelayEnabledTransitionDelayMode());86 DelayEnabledTransitionControl.setDefaultDelayMode(prefs.getDelayEnabledTransitionDelayMode());
87 DelayEnabledTransitionControl.setDefaultGranularity(prefs.getDelayEnabledTransitionGranularity());87 DelayEnabledTransitionControl.setDefaultGranularity(prefs.getDelayEnabledTransitionGranularity());
88 DelayEnabledTransitionControl.setDefaultIsRandomTransition(prefs.getDelayEnabledTransitionIsRandomTransition());88 SimulationControl.setDefaultIsRandomTransition(prefs.getDelayEnabledTransitionIsRandomTransition());
8989
90 showToolTips = prefs.getShowToolTips();90 showToolTips = prefs.getShowToolTips();
91 setDisplayToolTips(showToolTips);91 setDisplayToolTips(showToolTips);
@@ -221,7 +221,7 @@
221 prefs.setShowTokenAge(guiFrameDirectAccess.showTokenAge());221 prefs.setShowTokenAge(guiFrameDirectAccess.showTokenAge());
222 prefs.setDelayEnabledTransitionDelayMode(DelayEnabledTransitionControl.getDefaultDelayMode());222 prefs.setDelayEnabledTransitionDelayMode(DelayEnabledTransitionControl.getDefaultDelayMode());
223 prefs.setDelayEnabledTransitionGranularity(DelayEnabledTransitionControl.getDefaultGranularity());223 prefs.setDelayEnabledTransitionGranularity(DelayEnabledTransitionControl.getDefaultGranularity());
224 prefs.setDelayEnabledTransitionIsRandomTransition(DelayEnabledTransitionControl.isRandomTransition());224 prefs.setDelayEnabledTransitionIsRandomTransition(SimulationControl.isRandomTransition());
225225
226 JOptionPane.showMessageDialog(guiFrameDirectAccess,226 JOptionPane.showMessageDialog(guiFrameDirectAccess,
227 "The workspace has now been saved into your preferences.\n"227 "The workspace has now been saved into your preferences.\n"
@@ -726,7 +726,7 @@
726 //showDelayEnabledTransitions(advanced);726 //showDelayEnabledTransitions(advanced);
727 DelayEnabledTransitionControl.getInstance().setValue(new BigDecimal("0.1"));727 DelayEnabledTransitionControl.getInstance().setValue(new BigDecimal("0.1"));
728 DelayEnabledTransitionControl.getInstance().setDelayMode(ShortestDelayMode.getInstance());728 DelayEnabledTransitionControl.getInstance().setDelayMode(ShortestDelayMode.getInstance());
729 DelayEnabledTransitionControl.getInstance().setRandomTransitionMode(false);729 SimulationControl.getInstance().setRandomTransitionMode(false);
730 }730 }
731731
732}732}
733733
=== modified file 'src/pipe/gui/SimulationControl.java'
--- src/pipe/gui/SimulationControl.java 2020-06-21 11:16:52 +0000
+++ src/pipe/gui/SimulationControl.java 2020-08-19 11:36:17 +0000
@@ -22,9 +22,10 @@
22 22
23 final JSlider simulationSpeed = new JSlider();23 final JSlider simulationSpeed = new JSlider();
24 final JCheckBox randomSimulation = new JCheckBox("Enable automatic random simulation");24 final JCheckBox randomSimulation = new JCheckBox("Enable automatic random simulation");
25 final Timer timer = new Timer(simulationSpeed.getValue()*20, e -> CreateGui.getCurrentTab().getTransitionFireingComponent().fireSelectedTransition());25 final JCheckBox randomMode = new JCheckBox("Choose next transition randomly");
26 26 final Timer timer = new Timer(simulationSpeed.getValue()*20, e -> CreateGui.getCurrentTab().getTransitionFireingComponent().fireSelectedTransition());
27 private static SimulationControl instance;27 private static boolean defaultIsRandomTrasition;
28 private static SimulationControl instance;
28 29
29 public static SimulationControl getInstance(){30 public static SimulationControl getInstance(){
30 if(instance == null){31 if(instance == null){
@@ -62,13 +63,23 @@
62 gbc.gridx = 0;63 gbc.gridx = 0;
63 gbc.gridy = 0;64 gbc.gridy = 0;
64 add(randomSimulation, gbc);65 add(randomSimulation, gbc);
65 66
66 gbc = new GridBagConstraints();67 gbc = new GridBagConstraints();
68 gbc.anchor = GridBagConstraints.WEST;
69 gbc.fill = GridBagConstraints.HORIZONTAL;
70 gbc.weightx = 1.0;
71 gbc.gridx = 0;
72 gbc.gridy = 1;
73 add(randomMode, gbc);
74
75 setRandomTransitionMode(defaultIsRandomTrasition);
76
77 gbc = new GridBagConstraints();
67 gbc.anchor = GridBagConstraints.WEST;78 gbc.anchor = GridBagConstraints.WEST;
68 gbc.fill = GridBagConstraints.HORIZONTAL;79 gbc.fill = GridBagConstraints.HORIZONTAL;
69 gbc.weightx = 1.0;80 gbc.weightx = 1.0;
70 gbc.gridx = 0;81 gbc.gridx = 0;
71 gbc.gridy = 1;82 gbc.gridy = 2;
72 add(new JLabel("Set simulation speed:"), gbc);83 add(new JLabel("Set simulation speed:"), gbc);
73 84
74 gbc = new GridBagConstraints();85 gbc = new GridBagConstraints();
@@ -76,7 +87,7 @@
76 gbc.fill = GridBagConstraints.HORIZONTAL;87 gbc.fill = GridBagConstraints.HORIZONTAL;
77 gbc.weightx = 1.0;88 gbc.weightx = 1.0;
78 gbc.gridx = 0;89 gbc.gridx = 0;
79 gbc.gridy = 2;90 gbc.gridy = 3;
80 add(simulationSpeed, gbc);91 add(simulationSpeed, gbc);
81 92
82 setBorder(BorderFactory.createCompoundBorder(93 setBorder(BorderFactory.createCompoundBorder(
@@ -159,4 +170,26 @@
159 dialog.setLocation(x, y);170 dialog.setLocation(x, y);
160 dialog.setVisible(true);171 dialog.setVisible(true);
161 }172 }
173
174 public boolean isRandomTransitionMode(){
175 if(SimulationControl.getInstance().randomSimulation()){
176 return true;
177 } else {
178 return randomMode.isSelected();
179 }
180 }
181
182 public void setRandomTransitionMode(boolean randomTransition){
183 randomMode.setSelected(randomTransition);
184 }
185 public static boolean isRandomTransition(){
186 if(instance != null){
187 return getInstance().isRandomTransitionMode();
188 } else {
189 return defaultIsRandomTrasition;
190 }
191 }
192 public static void setDefaultIsRandomTransition(boolean delayEnabledTransitionIsRandomTransition) {
193 defaultIsRandomTrasition = delayEnabledTransitionIsRandomTransition;
194 }
162}195}
163196
=== modified file 'src/pipe/gui/StatusBar.java'
--- src/pipe/gui/StatusBar.java 2020-07-13 13:58:47 +0000
+++ src/pipe/gui/StatusBar.java 2020-08-19 11:36:17 +0000
@@ -8,41 +8,11 @@
8/* Status Bar to let users know what to do*/8/* Status Bar to let users know what to do*/
9public class StatusBar extends JPanel {9public class StatusBar extends JPanel {
1010
11 /* Provides the appropriate text for the mode that the user is in */
12 public static final String textforNoNet = "Open a net to start editing";
13
14 public static final String textforDrawing = "Drawing Mode: Click on a button to start adding components to the "
15 + "Editor";
16 public static final String textforPlace = "Place Mode: Right click on a place to see menu options "
17 + "";
18 public static final String textforTAPNPlace = "Place Mode: Right click on a place to see menu options "
19 + "";
20 public static final String textforTrans = "Transition Mode: Right click on a transition to see menu "
21 + "options [Mouse wheel -> rotate]";
22 public static final String textforTimedTrans = "Timed Transition Mode: Right click on a transition to see menu "
23 + "options [Mouse wheel -> rotate]";
24 public static final String textforAddtoken = "Add Token Mode: Click on a place to add a token";
25 public static final String textforDeltoken = "Delete Token Mode: Click on a place to delete a token ";
26 public static final String textforAnimation = "Simulation Mode: Red transitions are enabled, click a transition to "
27 + "fire it";
28 public static final String textforArc = "Arc Mode: Right click on an arc to see menu options "
29 + "";
30 public static final String textforTransportArc = "Transport Arc Mode: Right click on an arc to see menu options "
31 + "";
32 public static final String textforInhibArc = "Inhibitor Mode: Right click on an arc to see menu options "
33 + "";
34 public static final String textforMove = "Select Mode: Click/drag to select objects; drag to move them";
35 public static final String textforAnnotation = "Annotation Mode: Right click on an annotation to see menu options; "
36 + "double click to edit";
37
38 public static final String textforDrag = "Drag Mode";
39
40
41 private final JLabel label;11 private final JLabel label;
4212
43 public StatusBar() {13 public StatusBar() {
44 super();14 super();
45 label = new JLabel(textforDrawing); // got to put something in there15 label = new JLabel("");
46 this.setLayout(new BorderLayout(0, 0));16 this.setLayout(new BorderLayout(0, 0));
47 this.add(label);17 this.add(label);
48 }18 }
@@ -51,67 +21,6 @@
51 label.setText(newText);21 label.setText(newText);
52 }22 }
5323
54 public void changeText(Pipe.ElementType type) {24
55 switch (type) {
56 case PLACE:
57 changeText(textforPlace);
58 break;
59
60 case TAPNPLACE:
61 changeText(textforTAPNPlace);
62 break;
63
64 case IMMTRANS:
65 case TAPNTRANS:
66 changeText(textforTrans);
67 break;
68
69 case TIMEDTRANS:
70 changeText(textforTimedTrans);
71 break;
72
73 case ARC:
74 case TAPNARC:
75 changeText(textforArc);
76 break;
77
78 case TRANSPORTARC:
79 changeText(textforTransportArc);
80 break;
81
82 case TAPNINHIBITOR_ARC:
83 case INHIBARC:
84 changeText(textforInhibArc);
85 break;
86
87 case ADDTOKEN:
88 changeText(textforAddtoken);
89 break;
90
91 case DELTOKEN:
92 changeText(textforDeltoken);
93 break;
94
95 case SELECT:
96 changeText(textforMove);
97 break;
98
99 case DRAW:
100 changeText(textforDrawing);
101 break;
102
103 case ANNOTATION:
104 changeText(textforAnnotation);
105 break;
106
107 case DRAG:
108 changeText(textforDrag);
109 break;
110
111 default:
112 changeText("To-do (textfor" + type);
113 break;
114 }
115 }
11625
117}26}
11827
=== modified file 'src/pipe/gui/action/GuiAction.java'
--- src/pipe/gui/action/GuiAction.java 2020-07-20 07:19:51 +0000
+++ src/pipe/gui/action/GuiAction.java 2020-08-19 11:36:17 +0000
@@ -109,4 +109,12 @@
109109
110 }110 }
111111
112 public void setName(String newName){
113 putValue(NAME, newName);
114 }
115
116 public void setTooltip(String newTooltip){
117 putValue(SHORT_DESCRIPTION, newTooltip);
118 }
119
112}120}
113121
=== modified file 'src/pipe/gui/canvas/DrawingSurfaceImpl.java'
--- src/pipe/gui/canvas/DrawingSurfaceImpl.java 2020-08-10 06:46:22 +0000
+++ src/pipe/gui/canvas/DrawingSurfaceImpl.java 2020-08-19 11:36:17 +0000
@@ -412,7 +412,7 @@
412412
413 if (SwingUtilities.isLeftMouseButton(e)) {413 if (SwingUtilities.isLeftMouseButton(e)) {
414414
415 Pipe.ElementType mode = app.getMode();415 Pipe.ElementType mode = CreateGui.guiMode;
416416
417 switch (mode) {417 switch (mode) {
418 case DRAG:418 case DRAG:
@@ -443,7 +443,7 @@
443 dragStart = null;443 dragStart = null;
444 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));444 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
445 }445 }
446 if (app.getMode() == ElementType.SELECT) {446 if (CreateGui.guiMode == ElementType.SELECT) {
447 getSelectionObject().dispatchEvent(e);447 getSelectionObject().dispatchEvent(e);
448 }448 }
449 }449 }
@@ -461,9 +461,9 @@
461 if (managerRef!=null && managerRef.get() != null) {461 if (managerRef!=null && managerRef.get() != null) {
462 managerRef.get().drawingSurfaceMouseDragged(e);462 managerRef.get().drawingSurfaceMouseDragged(e);
463 }463 }
464 if (dragStart != null) {464 if (dragStart != null) {
465 view.drag(dragStart, e.getPoint());465 view.drag(dragStart, e.getPoint());
466 } else if (app.getMode() == ElementType.SELECT) {466 } else if (CreateGui.guiMode == ElementType.SELECT) {
467 getSelectionObject().dispatchEvent(e);467 getSelectionObject().dispatchEvent(e);
468 }468 }
469 }469 }
470470
=== modified file 'src/pipe/gui/graphicElements/PetriNetObject.java'
--- src/pipe/gui/graphicElements/PetriNetObject.java 2020-06-30 06:41:30 +0000
+++ src/pipe/gui/graphicElements/PetriNetObject.java 2020-08-19 11:36:17 +0000
@@ -3,6 +3,8 @@
3import java.awt.Graphics;3import java.awt.Graphics;
4import java.awt.Rectangle;4import java.awt.Rectangle;
5import java.awt.event.*;5import java.awt.event.*;
6
7import dk.aau.cs.gui.TabContent;
6import pipe.dataLayer.DataLayer;8import pipe.dataLayer.DataLayer;
7import pipe.gui.canvas.DrawingSurfaceImpl;9import pipe.gui.canvas.DrawingSurfaceImpl;
8import pipe.gui.Pipe;10import pipe.gui.Pipe;
@@ -19,6 +21,7 @@
19 /** x/y position position on screen (zoomed) */21 /** x/y position position on screen (zoomed) */
20 protected int positionX;22 protected int positionX;
21 protected int positionY;23 protected int positionY;
24 protected TabContent.TAPNLens lens = TabContent.TAPNLens.Default;
2225
23 // The x/y coordinate of object at 100% zoom.26 // The x/y coordinate of object at 100% zoom.
24 //XXX: pushed down from PlaceTransitionObject and consolidated from note, need further refactoring and rename, //kyrke 2019-08-2327 //XXX: pushed down from PlaceTransitionObject and consolidated from note, need further refactoring and rename, //kyrke 2019-08-23
@@ -285,6 +288,14 @@
285 return positionY;288 return positionY;
286 }289 }
287290
291 public boolean isTimed(){
292 return lens.isTimed();
293 }
294
295 public void setLens(TabContent.TAPNLens lens){
296 this.lens = lens;
297 }
298
288 @Override299 @Override
289 public GraphicalElement getGraphicalElement() {300 public GraphicalElement getGraphicalElement() {
290 return this;301 return this;
291302
=== modified file 'src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java'
--- src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java 2020-07-20 07:19:51 +0000
+++ src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java 2020-08-19 11:36:17 +0000
@@ -2,6 +2,7 @@
22
3import java.util.Hashtable;3import java.util.Hashtable;
44
5import dk.aau.cs.gui.TabContent;
5import pipe.gui.CreateGui;6import pipe.gui.CreateGui;
6import pipe.gui.Pipe;7import pipe.gui.Pipe;
7import pipe.gui.graphicElements.PlaceTransitionObject;8import pipe.gui.graphicElements.PlaceTransitionObject;
@@ -24,11 +25,12 @@
24 updateLabel(true);25 updateLabel(true);
25 }26 }
2627
27 public TimedInputArcComponent(PlaceTransitionObject source, PlaceTransitionObject target, TimedInputArc modelArc){28 public TimedInputArcComponent(PlaceTransitionObject source, PlaceTransitionObject target, TimedInputArc modelArc, TabContent.TAPNLens lens){
28 super(source);29 super(source);
29 setTarget(target);30 setTarget(target);
30 setUnderlyingArc(modelArc);31 setUnderlyingArc(modelArc);
31 updateLabel(true);32 updateLabel(true);
33 this.lens = lens;
32 sealArc();34 sealArc();
33 }35 }
3436
@@ -37,6 +39,12 @@
37 updateLabel(true);39 updateLabel(true);
38 }40 }
3941
42 public TimedInputArcComponent(TimedOutputArcComponent arc, TabContent.TAPNLens lens) {
43 super(arc);
44 updateLabel(true);
45 this.lens = lens;
46 }
47
40 @Override48 @Override
41 protected void addMouseHandler() {49 protected void addMouseHandler() {
42 //XXX: kyrke 2018-09-06, this is bad as we leak "this", think its ok for now, as it alwas constructed when50 //XXX: kyrke 2018-09-06, this is bad as we leak "this", think its ok for now, as it alwas constructed when
@@ -82,7 +90,7 @@
82 if (inputArc == null)90 if (inputArc == null)
83 getNameLabel().setText("");91 getNameLabel().setText("");
84 else {92 else {
85 if (!CreateGui.getApp().showZeroToInfinityIntervals()) {93 if (!CreateGui.getApp().showZeroToInfinityIntervals() || !lens.isTimed()) {
86 if (inputArc.interval().toString(showConstantNames).equals("[0,inf)")){94 if (inputArc.interval().toString(showConstantNames).equals("[0,inf)")){
87 getNameLabel().setText("");95 getNameLabel().setText("");
88 }96 }
8997
=== modified file 'src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java'
--- src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java 2020-07-16 08:39:06 +0000
+++ src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java 2020-08-19 11:36:17 +0000
@@ -51,6 +51,7 @@
51 Grid.getModifiedX((int) (arc.getNameLabel().getXPosition() + Zoomer.getZoomedValue(getNameOffsetX(), getZoom()))),51 Grid.getModifiedX((int) (arc.getNameLabel().getXPosition() + Zoomer.getZoomedValue(getNameOffsetX(), getZoom()))),
52 Grid.getModifiedY((int) (arc.getNameLabel().getYPosition() + Zoomer.getZoomedValue(getNameOffsetY(), getZoom())))52 Grid.getModifiedY((int) (arc.getNameLabel().getYPosition() + Zoomer.getZoomedValue(getNameOffsetY(), getZoom())))
53 );53 );
54 this.lens = arc.lens;
5455
55 }56 }
5657
5758
=== modified file 'src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java'
--- src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java 2020-07-20 07:19:51 +0000
+++ src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java 2020-08-19 11:36:17 +0000
@@ -23,6 +23,7 @@
23import javax.swing.BoxLayout;23import javax.swing.BoxLayout;
24import javax.swing.JTextArea;24import javax.swing.JTextArea;
2525
26import dk.aau.cs.gui.TabContent;
26import pipe.gui.CreateGui;27import pipe.gui.CreateGui;
27import pipe.gui.Pipe;28import pipe.gui.Pipe;
28import pipe.gui.graphicElements.Place;29import pipe.gui.graphicElements.Place;
@@ -49,11 +50,11 @@
49 private Window ageOfTokensWindow = new Window(new Frame());50 private Window ageOfTokensWindow = new Window(new Frame());
50 private final Shape dashedOutline = createDashedOutline();51 private final Shape dashedOutline = createDashedOutline();
5152
52 public TimedPlaceComponent(int positionXInput, int positionYInput, dk.aau.cs.model.tapn.TimedPlace place) {53 public TimedPlaceComponent(int positionXInput, int positionYInput, dk.aau.cs.model.tapn.TimedPlace place, TabContent.TAPNLens lens) {
53 super(positionXInput, positionYInput);54 super(positionXInput, positionYInput);
54 this.place = place;55 this.place = place;
55 this.place.addTimedPlaceListener(listener);56 this.place.addTimedPlaceListener(listener);
5657 this.lens = lens;
57 attributesVisible = true;58 attributesVisible = true;
5859
59 }60 }
@@ -63,15 +64,17 @@
63 int positionYInput,64 int positionYInput,
64 String idInput,65 String idInput,
65 int nameOffsetXInput,66 int nameOffsetXInput,
66 int nameOffsetYInput67 int nameOffsetYInput,
68 TabContent.TAPNLens lens
67 ) {69 ) {
6870
69 super(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput);71 super(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput);
70 attributesVisible = true;72 attributesVisible = true;
73 this.lens = lens;
7174
72 }75 }
7376
74 @Override77 @Override
75 protected void addMouseHandler() {78 protected void addMouseHandler() {
76 //XXX: kyrke 2018-09-06, this is bad as we leak "this", think its ok for now, as it alwas constructed when79 //XXX: kyrke 2018-09-06, this is bad as we leak "this", think its ok for now, as it alwas constructed when
77 //XXX: handler is called. Make static constructor and add handler from there, to make it safe.80 //XXX: handler is called. Make static constructor and add handler from there, to make it safe.
@@ -173,7 +176,9 @@
173 }176 }
174 }177 }
175 }178 }
176179 if(!lens.isTimed()){
180 drawDots = (marking > 0 && marking < 6);
181 }
177 // structure sees how many markings there are and fills the place in182 // structure sees how many markings there are and fills the place in
178 // with the appropriate number or tokens.183 // with the appropriate number or tokens.
179 if(drawDots) {184 if(drawDots) {
@@ -277,7 +282,7 @@
277 }282 }
278 283
279 // Build interface284 // Build interface
280 if (show) {285 if (show && isTimed()) {
281 ageOfTokensWindow = new Window(new Frame());286 ageOfTokensWindow = new Window(new Frame());
282 ageOfTokensWindow.add(new JTextArea(getStringOfTokens()));287 ageOfTokensWindow.add(new JTextArea(getStringOfTokens()));
283 ageOfTokensWindow.getComponent(0).setBackground(Color.lightGray);288 ageOfTokensWindow.getComponent(0).setBackground(Color.lightGray);
@@ -410,7 +415,7 @@
410 }415 }
411416
412 public TimedPlaceComponent copy(TimedArcPetriNet tapn) {417 public TimedPlaceComponent copy(TimedArcPetriNet tapn) {
413 TimedPlaceComponent placeComponent = new TimedPlaceComponent(getOriginalX(), getOriginalY(), id, getNameOffsetX(), getNameOffsetY());418 TimedPlaceComponent placeComponent = new TimedPlaceComponent(getOriginalX(), getOriginalY(), id, getNameOffsetX(), getNameOffsetY(), lens);
414 placeComponent.setUnderlyingPlace(tapn.getPlaceByName(place.name()));419 placeComponent.setUnderlyingPlace(tapn.getPlaceByName(place.name()));
415420
416 return placeComponent;421 return placeComponent;
417422
=== modified file 'src/pipe/gui/graphicElements/tapn/TimedTransitionComponent.java'
--- src/pipe/gui/graphicElements/tapn/TimedTransitionComponent.java 2020-08-10 06:46:22 +0000
+++ src/pipe/gui/graphicElements/tapn/TimedTransitionComponent.java 2020-08-19 11:36:17 +0000
@@ -16,6 +16,7 @@
16import javax.swing.BoxLayout;16import javax.swing.BoxLayout;
17import javax.swing.JTextArea;17import javax.swing.JTextArea;
1818
19import dk.aau.cs.gui.TabContent;
19import pipe.gui.CreateGui;20import pipe.gui.CreateGui;
20import pipe.gui.Pipe;21import pipe.gui.Pipe;
21import pipe.gui.graphicElements.Transition;22import pipe.gui.graphicElements.Transition;
@@ -36,12 +37,13 @@
36 private final dk.aau.cs.model.tapn.event.TimedTransitionListener listener;37 private final dk.aau.cs.model.tapn.event.TimedTransitionListener listener;
37 private GeneralPath dashedOutline;38 private GeneralPath dashedOutline;
3839
39 public TimedTransitionComponent(int positionXInput, int positionYInput, dk.aau.cs.model.tapn.TimedTransition transition) {40 public TimedTransitionComponent(int positionXInput, int positionYInput, dk.aau.cs.model.tapn.TimedTransition transition, TabContent.TAPNLens lens) {
40 super(positionXInput, positionYInput);41 super(positionXInput, positionYInput);
41 this.transition = transition;42 this.transition = transition;
42 listener = timedTransitionListener();43 listener = timedTransitionListener();
43 transition.addTimedTransitionListener(listener);44 transition.addTimedTransitionListener(listener);
44 attributesVisible = true;45 attributesVisible = true;
46 this.lens = lens;
4547
46 }48 }
4749
@@ -54,7 +56,8 @@
54 boolean timedTransition,56 boolean timedTransition,
55 boolean infServer,57 boolean infServer,
56 int angleInput,58 int angleInput,
57 int priority59 int priority,
60 TabContent.TAPNLens lens
58 ) {61 ) {
59 super(62 super(
60 positionXInput,63 positionXInput,
@@ -66,6 +69,7 @@
66 );69 );
67 listener = timedTransitionListener();70 listener = timedTransitionListener();
68 attributesVisible = true;71 attributesVisible = true;
72 this.lens = lens;
6973
70 }74 }
7175
@@ -222,7 +226,7 @@
222 }226 }
223227
224 public TimedTransitionComponent copy(TimedArcPetriNet tapn) {228 public TimedTransitionComponent copy(TimedArcPetriNet tapn) {
225 TimedTransitionComponent transitionComponent = new TimedTransitionComponent(getOriginalX(), getOriginalY(), id, getNameOffsetX(), getNameOffsetY(), true, false, getAngle(), 0);229 TimedTransitionComponent transitionComponent = new TimedTransitionComponent(getOriginalX(), getOriginalY(), id, getNameOffsetX(), getNameOffsetY(), true, false, getAngle(), 0, lens);
226 transitionComponent.setUnderlyingTransition(tapn.getTransitionByName(transition.name()));230 transitionComponent.setUnderlyingTransition(tapn.getTransitionByName(transition.name()));
227231
228 return transitionComponent;232 return transitionComponent;
@@ -237,7 +241,7 @@
237 }241 }
238 242
239 // Build interface243 // Build interface
240 if (show && (transition.getdInterval() != null)) {244 if (show && (transition.getdInterval() != null) && isTimed()) {
241 dIntervalWindow = new Window(new Frame());245 dIntervalWindow = new Window(new Frame());
242 dIntervalWindow.add(new JTextArea(transition.getdInterval().toString()));246 dIntervalWindow.add(new JTextArea(transition.getdInterval().toString()));
243 247
244248
=== modified file 'src/pipe/gui/handler/PetriNetObjectHandler.java'
--- src/pipe/gui/handler/PetriNetObjectHandler.java 2020-07-20 07:19:51 +0000
+++ src/pipe/gui/handler/PetriNetObjectHandler.java 2020-08-19 11:36:17 +0000
@@ -66,8 +66,8 @@
66 @Override66 @Override
67 public void mousePressed(MouseEvent e) {67 public void mousePressed(MouseEvent e) {
68 if(CreateGui.getCurrentTab().isInAnimationMode()) return;68 if(CreateGui.getCurrentTab().isInAnimationMode()) return;
69 69
70 if (CreateGui.getApp().getMode() == ElementType.SELECT) {70 if (CreateGui.guiMode == ElementType.SELECT) {
71 if (!myObject.isSelected()) {71 if (!myObject.isSelected()) {
72 if (!e.isShiftDown()) {72 if (!e.isShiftDown()) {
73 myObject.getParent().getSelectionObject().clearSelection();73 myObject.getParent().getSelectionObject().clearSelection();
@@ -92,7 +92,7 @@
92 return;92 return;
93 }93 }
9494
95 if (CreateGui.getApp().getMode() == ElementType.SELECT) {95 if (CreateGui.guiMode == ElementType.SELECT) {
96 if (isDragging) {96 if (isDragging) {
97 isDragging = false;97 isDragging = false;
98 CreateGui.getDrawingSurface().translateSelection(myObject.getParent().getSelectionObject().getSelection(), totalX, totalY);98 CreateGui.getDrawingSurface().translateSelection(myObject.getParent().getSelectionObject().getSelection(), totalX, totalY);
@@ -124,7 +124,7 @@
124 return;124 return;
125 }125 }
126126
127 if (CreateGui.getApp().getMode() == ElementType.SELECT) {127 if (CreateGui.guiMode == ElementType.SELECT) {
128 if (myObject.isDraggable()) {128 if (myObject.isDraggable()) {
129 if (!isDragging) {129 if (!isDragging) {
130 isDragging = true;130 isDragging = true;
131131
=== modified file 'src/pipe/gui/widgets/GuardDialogue.java'
--- src/pipe/gui/widgets/GuardDialogue.java 2020-07-20 08:14:17 +0000
+++ src/pipe/gui/widgets/GuardDialogue.java 2020-08-19 11:36:17 +0000
@@ -27,6 +27,7 @@
27import javax.swing.SpinnerNumberModel;27import javax.swing.SpinnerNumberModel;
28import javax.swing.event.ChangeEvent;28import javax.swing.event.ChangeEvent;
2929
30import dk.aau.cs.gui.TabContent;
30import dk.aau.cs.model.tapn.*;31import dk.aau.cs.model.tapn.*;
31import net.tapaal.swinghelpers.WidthAdjustingComboBox;32import net.tapaal.swinghelpers.WidthAdjustingComboBox;
32import pipe.gui.CreateGui;33import pipe.gui.CreateGui;
@@ -76,7 +77,10 @@
76 if(objectToBeEdited instanceof TimedInputArcComponent && !(objectToBeEdited instanceof TimedInhibitorArcComponent)){77 if(objectToBeEdited instanceof TimedInputArcComponent && !(objectToBeEdited instanceof TimedInhibitorArcComponent)){
77 initTimeGuardPanel();78 initTimeGuardPanel();
78 }79 }
79 80 if(!objectToBeEdited.isTimed() ){
81 guardEditPanel.setVisible(false);
82 }
83
80 initWeightPanel();84 initWeightPanel();
81 initButtonPanel(objectToBeEdited);85 initButtonPanel(objectToBeEdited);
8286
8387
=== modified file 'src/pipe/gui/widgets/PlaceEditorPanel.java'
--- src/pipe/gui/widgets/PlaceEditorPanel.java 2020-07-23 09:18:11 +0000
+++ src/pipe/gui/widgets/PlaceEditorPanel.java 2020-08-19 11:36:17 +0000
@@ -22,6 +22,7 @@
22import javax.swing.JSpinner;22import javax.swing.JSpinner;
23import javax.swing.event.ChangeListener;23import javax.swing.event.ChangeListener;
2424
25import dk.aau.cs.gui.TabContent;
25import net.tapaal.swinghelpers.CustomJSpinner;26import net.tapaal.swinghelpers.CustomJSpinner;
26import net.tapaal.swinghelpers.GridBagHelper;27import net.tapaal.swinghelpers.GridBagHelper;
27import net.tapaal.swinghelpers.WidthAdjustingComboBox;28import net.tapaal.swinghelpers.WidthAdjustingComboBox;
@@ -67,17 +68,26 @@
67 private final Context context;68 private final Context context;
68 private boolean makeNewShared = false;69 private boolean makeNewShared = false;
69 private boolean doNewEdit = true;70 private boolean doNewEdit = true;
71 private final TabContent currentTab;
70 72
71 private Vector<TimedPlace> sharedPlaces;73 private Vector<TimedPlace> sharedPlaces;
72 private final int maxNumberOfPlacesToShowAtOnce = 20;74 private final int maxNumberOfPlacesToShowAtOnce = 20;
7375
74 public PlaceEditorPanel(JRootPane rootPane, TimedPlaceComponent placeComponent, Context context) {76 public PlaceEditorPanel(JRootPane rootPane, TimedPlaceComponent placeComponent, Context context) {
75 this.rootPane = rootPane;77 this.rootPane = rootPane;
78 currentTab = context.tabContent();
76 place = placeComponent;79 place = placeComponent;
77 this.context = context;80 this.context = context;
78 initComponents();81 initComponents();
82 hideTimedInformation();
79 }83 }
8084
85 private void hideTimedInformation(){
86 if(!place.isTimed()) {
87 timeInvariantPanel.setVisible(false);
88 }
89 }
90
81 private void initComponents() {91 private void initComponents() {
82 setLayout(new java.awt.GridBagLayout());92 setLayout(new java.awt.GridBagLayout());
8393
@@ -90,6 +100,7 @@
90 gridBagConstraints = GridBagHelper.as(0,1, WEST, HORIZONTAL, new Insets(0, 8, 0, 8));100 gridBagConstraints = GridBagHelper.as(0,1, WEST, HORIZONTAL, new Insets(0, 8, 0, 8));
91 add(timeInvariantPanel, gridBagConstraints);101 add(timeInvariantPanel, gridBagConstraints);
92102
103
93 initButtonPanel();104 initButtonPanel();
94105
95 gridBagConstraints = GridBagHelper.as(0,2, new Insets(0, 8, 5, 8));106 gridBagConstraints = GridBagHelper.as(0,2, new Insets(0, 8, 5, 8));
96107
=== modified file 'src/pipe/gui/widgets/QueryPane.java'
--- src/pipe/gui/widgets/QueryPane.java 2020-08-10 06:46:22 +0000
+++ src/pipe/gui/widgets/QueryPane.java 2020-08-19 11:36:17 +0000
@@ -372,7 +372,7 @@
372 TAPNQuery newQuery = null;372 TAPNQuery newQuery = null;
373373
374 if(q.isActive()) {374 if(q.isActive()) {
375 if(q.getCategory() == TAPNQuery.QueryCategory.CTL) {375 if(!tabContent.getLens().isTimed()) {
376 newQuery = CTLQueryDialog.showQueryDialogue(CTLQueryDialog.QueryDialogueOption.Save, q, tabContent.network(), tabContent.getGuiModels(), tabContent.getLens());376 newQuery = CTLQueryDialog.showQueryDialogue(CTLQueryDialog.QueryDialogueOption.Save, q, tabContent.network(), tabContent.getGuiModels(), tabContent.getLens());
377 } else {377 } else {
378 newQuery = QueryDialog.showQueryDialogue(QueryDialogueOption.Save, q, tabContent.network(), tabContent.getGuiModels(), tabContent.getLens());378 newQuery = QueryDialog.showQueryDialogue(QueryDialogueOption.Save, q, tabContent.network(), tabContent.getGuiModels(), tabContent.getLens());
379379
=== modified file 'src/pipe/gui/widgets/TAPNTransitionEditor.java'
--- src/pipe/gui/widgets/TAPNTransitionEditor.java 2020-08-10 06:46:22 +0000
+++ src/pipe/gui/widgets/TAPNTransitionEditor.java 2020-08-19 11:36:17 +0000
@@ -16,8 +16,6 @@
16import javax.swing.JRootPane;16import javax.swing.JRootPane;
17import javax.swing.JTextField;17import javax.swing.JTextField;
18import javax.swing.event.CaretListener;18import javax.swing.event.CaretListener;
19
20
21import net.tapaal.swinghelpers.GridBagHelper;19import net.tapaal.swinghelpers.GridBagHelper;
22import dk.aau.cs.gui.undo.*;20import dk.aau.cs.gui.undo.*;
23import net.tapaal.swinghelpers.WidthAdjustingComboBox;21import net.tapaal.swinghelpers.WidthAdjustingComboBox;
@@ -52,10 +50,16 @@
52 transition = _transition;50 transition = _transition;
53 this.context = context;51 this.context = context;
54 initComponents();52 initComponents();
5553 hideTimedInformation();
56 rootPane.setDefaultButton(okButton);54 rootPane.setDefaultButton(okButton);
57 }55 }
5856
57 private void hideTimedInformation(){
58 if(!transition.isTimed()) {
59 urgentCheckBox.setVisible(false);
60 }
61 }
62
59 private void initComponents() {63 private void initComponents() {
60 GridBagConstraints gridBagConstraints;64 GridBagConstraints gridBagConstraints;
6165

Subscribers

People subscribed via source and target branches