Merge lp:~tapaal-contributor/tapaal/untimed-timed-gui into lp:tapaal
- untimed-timed-gui
- Merge into trunk
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 |
Related bugs: |
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.
Description of the change
Kenneth Yrke Jørgensen (yrke) wrote : | # |
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).
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.
- 1099. By Kenneth Yrke Jørgensen
-
Merged trunk
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.
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.
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
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.
Kenneth Yrke Jørgensen (yrke) wrote : | # |
insted of using the hasNestedPathQu
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.
Jiri Srba (srba) : | # |
Preview Diff
1 | === modified file 'src/dk/aau/cs/TCTL/AritmeticOperator.java' | |||
2 | --- src/dk/aau/cs/TCTL/AritmeticOperator.java 2017-03-12 00:33:00 +0000 | |||
3 | +++ src/dk/aau/cs/TCTL/AritmeticOperator.java 2020-08-19 11:36:17 +0000 | |||
4 | @@ -50,7 +50,12 @@ | |||
5 | 50 | return false; | 50 | return false; |
6 | 51 | } | 51 | } |
7 | 52 | 52 | ||
9 | 53 | @Override | 53 | @Override |
10 | 54 | public boolean hasNestedPathQuantifiers() { | ||
11 | 55 | return false; | ||
12 | 56 | } | ||
13 | 57 | |||
14 | 58 | @Override | ||
15 | 54 | public TCTLAbstractProperty findFirstPlaceHolder() { | 59 | public TCTLAbstractProperty findFirstPlaceHolder() { |
16 | 55 | return null; | 60 | return null; |
17 | 56 | } | 61 | } |
18 | 57 | 62 | ||
19 | === modified file 'src/dk/aau/cs/TCTL/TCTLAFNode.java' | |||
20 | --- src/dk/aau/cs/TCTL/TCTLAFNode.java 2017-03-12 00:33:00 +0000 | |||
21 | +++ src/dk/aau/cs/TCTL/TCTLAFNode.java 2020-08-19 11:36:17 +0000 | |||
22 | @@ -82,8 +82,13 @@ | |||
23 | 82 | public boolean containsPlaceHolder() { | 82 | public boolean containsPlaceHolder() { |
24 | 83 | return property.containsPlaceHolder(); | 83 | return property.containsPlaceHolder(); |
25 | 84 | } | 84 | } |
28 | 85 | 85 | ||
29 | 86 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | 86 | @Override |
30 | 87 | public boolean hasNestedPathQuantifiers() { | ||
31 | 88 | return property instanceof TCTLPathToStateConverter || property.hasNestedPathQuantifiers(); | ||
32 | 89 | } | ||
33 | 90 | |||
34 | 91 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | ||
35 | 87 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); | 92 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); |
36 | 88 | } | 93 | } |
37 | 89 | 94 | ||
38 | 90 | 95 | ||
39 | === modified file 'src/dk/aau/cs/TCTL/TCTLAGNode.java' | |||
40 | --- src/dk/aau/cs/TCTL/TCTLAGNode.java 2017-03-12 00:33:00 +0000 | |||
41 | +++ src/dk/aau/cs/TCTL/TCTLAGNode.java 2020-08-19 11:36:17 +0000 | |||
42 | @@ -84,7 +84,12 @@ | |||
43 | 84 | return property.containsPlaceHolder(); | 84 | return property.containsPlaceHolder(); |
44 | 85 | } | 85 | } |
45 | 86 | 86 | ||
47 | 87 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | 87 | @Override |
48 | 88 | public boolean hasNestedPathQuantifiers() { | ||
49 | 89 | return property instanceof TCTLPathToStateConverter || property.hasNestedPathQuantifiers(); | ||
50 | 90 | } | ||
51 | 91 | |||
52 | 92 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | ||
53 | 88 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); | 93 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); |
54 | 89 | } | 94 | } |
55 | 90 | 95 | ||
56 | 91 | 96 | ||
57 | === modified file 'src/dk/aau/cs/TCTL/TCTLAUNode.java' | |||
58 | --- src/dk/aau/cs/TCTL/TCTLAUNode.java 2017-03-12 00:33:00 +0000 | |||
59 | +++ src/dk/aau/cs/TCTL/TCTLAUNode.java 2020-08-19 11:36:17 +0000 | |||
60 | @@ -105,8 +105,14 @@ | |||
61 | 105 | return left.containsPlaceHolder() | 105 | return left.containsPlaceHolder() |
62 | 106 | || right.containsPlaceHolder(); | 106 | || right.containsPlaceHolder(); |
63 | 107 | } | 107 | } |
66 | 108 | 108 | ||
67 | 109 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | 109 | @Override |
68 | 110 | public boolean hasNestedPathQuantifiers() { | ||
69 | 111 | return left instanceof TCTLPathToStateConverter || right instanceof TCTLPathToStateConverter | ||
70 | 112 | || left.hasNestedPathQuantifiers() || right.hasNestedPathQuantifiers(); | ||
71 | 113 | } | ||
72 | 114 | |||
73 | 115 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | ||
74 | 110 | return left.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName) | 116 | return left.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName) |
75 | 111 | || right.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); | 117 | || right.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); |
76 | 112 | } | 118 | } |
77 | 113 | 119 | ||
78 | === modified file 'src/dk/aau/cs/TCTL/TCTLAXNode.java' | |||
79 | --- src/dk/aau/cs/TCTL/TCTLAXNode.java 2017-03-12 00:33:00 +0000 | |||
80 | +++ src/dk/aau/cs/TCTL/TCTLAXNode.java 2020-08-19 11:36:17 +0000 | |||
81 | @@ -82,8 +82,13 @@ | |||
82 | 82 | public boolean containsPlaceHolder() { | 82 | public boolean containsPlaceHolder() { |
83 | 83 | return property.containsPlaceHolder(); | 83 | return property.containsPlaceHolder(); |
84 | 84 | } | 84 | } |
87 | 85 | 85 | ||
88 | 86 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | 86 | @Override |
89 | 87 | public boolean hasNestedPathQuantifiers() { | ||
90 | 88 | return property instanceof TCTLPathToStateConverter || property.hasNestedPathQuantifiers(); | ||
91 | 89 | } | ||
92 | 90 | |||
93 | 91 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | ||
94 | 87 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); | 92 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); |
95 | 88 | } | 93 | } |
96 | 89 | 94 | ||
97 | 90 | 95 | ||
98 | === modified file 'src/dk/aau/cs/TCTL/TCTLAbstractProperty.java' | |||
99 | --- src/dk/aau/cs/TCTL/TCTLAbstractProperty.java 2017-03-12 00:33:00 +0000 | |||
100 | +++ src/dk/aau/cs/TCTL/TCTLAbstractProperty.java 2020-08-19 11:36:17 +0000 | |||
101 | @@ -57,7 +57,7 @@ | |||
102 | 57 | public abstract boolean containsAtomicPropositionWithSpecificTransitionInTemplate(String templateName, String transitionName); | 57 | public abstract boolean containsAtomicPropositionWithSpecificTransitionInTemplate(String templateName, String transitionName); |
103 | 58 | 58 | ||
104 | 59 | public abstract boolean containsPlaceHolder(); | 59 | public abstract boolean containsPlaceHolder(); |
106 | 60 | 60 | public abstract boolean hasNestedPathQuantifiers(); | |
107 | 61 | // This method assumes that a place holder exists in the current query | 61 | // This method assumes that a place holder exists in the current query |
108 | 62 | public abstract TCTLAbstractProperty findFirstPlaceHolder(); | 62 | public abstract TCTLAbstractProperty findFirstPlaceHolder(); |
109 | 63 | 63 | ||
110 | 64 | 64 | ||
111 | === modified file 'src/dk/aau/cs/TCTL/TCTLAndListNode.java' | |||
112 | --- src/dk/aau/cs/TCTL/TCTLAndListNode.java 2017-03-12 00:33:00 +0000 | |||
113 | +++ src/dk/aau/cs/TCTL/TCTLAndListNode.java 2020-08-19 11:36:17 +0000 | |||
114 | @@ -194,7 +194,20 @@ | |||
115 | 194 | return placeHolderFound; | 194 | return placeHolderFound; |
116 | 195 | } | 195 | } |
117 | 196 | 196 | ||
119 | 197 | @Override | 197 | @Override |
120 | 198 | public boolean hasNestedPathQuantifiers() { | ||
121 | 199 | boolean foundNestedQuantifier = false; | ||
122 | 200 | |||
123 | 201 | for (TCTLAbstractStateProperty p : properties) { | ||
124 | 202 | foundNestedQuantifier = foundNestedQuantifier || p instanceof TCTLPathToStateConverter || p.hasNestedPathQuantifiers(); | ||
125 | 203 | if(foundNestedQuantifier){ | ||
126 | 204 | break; | ||
127 | 205 | } | ||
128 | 206 | } | ||
129 | 207 | return foundNestedQuantifier; | ||
130 | 208 | } | ||
131 | 209 | |||
132 | 210 | @Override | ||
133 | 198 | public TCTLAbstractProperty findFirstPlaceHolder() { | 211 | public TCTLAbstractProperty findFirstPlaceHolder() { |
134 | 199 | TCTLAbstractProperty ph = null; | 212 | TCTLAbstractProperty ph = null; |
135 | 200 | for (TCTLAbstractStateProperty p : properties) { | 213 | for (TCTLAbstractStateProperty p : properties) { |
136 | 201 | 214 | ||
137 | === modified file 'src/dk/aau/cs/TCTL/TCTLAtomicPropositionNode.java' | |||
138 | --- src/dk/aau/cs/TCTL/TCTLAtomicPropositionNode.java 2017-03-12 00:33:00 +0000 | |||
139 | +++ src/dk/aau/cs/TCTL/TCTLAtomicPropositionNode.java 2020-08-19 11:36:17 +0000 | |||
140 | @@ -83,7 +83,12 @@ | |||
141 | 83 | return left.containsPlaceHolder() || right.containsPlaceHolder(); | 83 | return left.containsPlaceHolder() || right.containsPlaceHolder(); |
142 | 84 | } | 84 | } |
143 | 85 | 85 | ||
145 | 86 | @Override | 86 | @Override |
146 | 87 | public boolean hasNestedPathQuantifiers() { | ||
147 | 88 | return false; | ||
148 | 89 | } | ||
149 | 90 | |||
150 | 91 | @Override | ||
151 | 87 | public TCTLAbstractProperty findFirstPlaceHolder() { | 92 | public TCTLAbstractProperty findFirstPlaceHolder() { |
152 | 88 | TCTLAbstractProperty rightP = right.findFirstPlaceHolder(); | 93 | TCTLAbstractProperty rightP = right.findFirstPlaceHolder(); |
153 | 89 | 94 | ||
154 | 90 | 95 | ||
155 | === modified file 'src/dk/aau/cs/TCTL/TCTLConstNode.java' | |||
156 | --- src/dk/aau/cs/TCTL/TCTLConstNode.java 2017-03-12 00:33:00 +0000 | |||
157 | +++ src/dk/aau/cs/TCTL/TCTLConstNode.java 2020-08-19 11:36:17 +0000 | |||
158 | @@ -54,7 +54,12 @@ | |||
159 | 54 | return false; | 54 | return false; |
160 | 55 | } | 55 | } |
161 | 56 | 56 | ||
163 | 57 | @Override | 57 | @Override |
164 | 58 | public boolean hasNestedPathQuantifiers() { | ||
165 | 59 | return false; | ||
166 | 60 | } | ||
167 | 61 | |||
168 | 62 | @Override | ||
169 | 58 | public TCTLAbstractProperty findFirstPlaceHolder() { | 63 | public TCTLAbstractProperty findFirstPlaceHolder() { |
170 | 59 | return null; | 64 | return null; |
171 | 60 | } | 65 | } |
172 | 61 | 66 | ||
173 | === modified file 'src/dk/aau/cs/TCTL/TCTLDeadlockNode.java' | |||
174 | --- src/dk/aau/cs/TCTL/TCTLDeadlockNode.java 2017-03-12 00:33:00 +0000 | |||
175 | +++ src/dk/aau/cs/TCTL/TCTLDeadlockNode.java 2020-08-19 11:36:17 +0000 | |||
176 | @@ -35,7 +35,12 @@ | |||
177 | 35 | return false; | 35 | return false; |
178 | 36 | } | 36 | } |
179 | 37 | 37 | ||
181 | 38 | public TCTLAbstractProperty findFirstPlaceHolder() { | 38 | @Override |
182 | 39 | public boolean hasNestedPathQuantifiers() { | ||
183 | 40 | return false; | ||
184 | 41 | } | ||
185 | 42 | |||
186 | 43 | public TCTLAbstractProperty findFirstPlaceHolder() { | ||
187 | 39 | return null; | 44 | return null; |
188 | 40 | } | 45 | } |
189 | 41 | 46 | ||
190 | 42 | 47 | ||
191 | === modified file 'src/dk/aau/cs/TCTL/TCTLEFNode.java' | |||
192 | --- src/dk/aau/cs/TCTL/TCTLEFNode.java 2017-03-12 00:33:00 +0000 | |||
193 | +++ src/dk/aau/cs/TCTL/TCTLEFNode.java 2020-08-19 11:36:17 +0000 | |||
194 | @@ -83,7 +83,12 @@ | |||
195 | 83 | return property.containsPlaceHolder(); | 83 | return property.containsPlaceHolder(); |
196 | 84 | } | 84 | } |
197 | 85 | 85 | ||
199 | 86 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | 86 | @Override |
200 | 87 | public boolean hasNestedPathQuantifiers() { | ||
201 | 88 | return property instanceof TCTLPathToStateConverter || property.hasNestedPathQuantifiers(); | ||
202 | 89 | } | ||
203 | 90 | |||
204 | 91 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | ||
205 | 87 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); | 92 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); |
206 | 88 | } | 93 | } |
207 | 89 | 94 | ||
208 | 90 | 95 | ||
209 | === modified file 'src/dk/aau/cs/TCTL/TCTLEGNode.java' | |||
210 | --- src/dk/aau/cs/TCTL/TCTLEGNode.java 2017-03-12 00:33:00 +0000 | |||
211 | +++ src/dk/aau/cs/TCTL/TCTLEGNode.java 2020-08-19 11:36:17 +0000 | |||
212 | @@ -82,8 +82,13 @@ | |||
213 | 82 | public boolean containsPlaceHolder() { | 82 | public boolean containsPlaceHolder() { |
214 | 83 | return property.containsPlaceHolder(); | 83 | return property.containsPlaceHolder(); |
215 | 84 | } | 84 | } |
218 | 85 | 85 | ||
219 | 86 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | 86 | @Override |
220 | 87 | public boolean hasNestedPathQuantifiers() { | ||
221 | 88 | return property instanceof TCTLPathToStateConverter || property.hasNestedPathQuantifiers(); | ||
222 | 89 | } | ||
223 | 90 | |||
224 | 91 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | ||
225 | 87 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); | 92 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); |
226 | 88 | } | 93 | } |
227 | 89 | 94 | ||
228 | 90 | 95 | ||
229 | === modified file 'src/dk/aau/cs/TCTL/TCTLEUNode.java' | |||
230 | --- src/dk/aau/cs/TCTL/TCTLEUNode.java 2017-03-12 00:33:00 +0000 | |||
231 | +++ src/dk/aau/cs/TCTL/TCTLEUNode.java 2020-08-19 11:36:17 +0000 | |||
232 | @@ -106,7 +106,13 @@ | |||
233 | 106 | || right.containsPlaceHolder(); | 106 | || right.containsPlaceHolder(); |
234 | 107 | } | 107 | } |
235 | 108 | 108 | ||
237 | 109 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | 109 | @Override |
238 | 110 | public boolean hasNestedPathQuantifiers() { | ||
239 | 111 | return left instanceof TCTLPathToStateConverter || right instanceof TCTLPathToStateConverter | ||
240 | 112 | || left.hasNestedPathQuantifiers() || right.hasNestedPathQuantifiers(); | ||
241 | 113 | } | ||
242 | 114 | |||
243 | 115 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | ||
244 | 110 | return left.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName) | 116 | return left.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName) |
245 | 111 | || right.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); | 117 | || right.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); |
246 | 112 | } | 118 | } |
247 | 113 | 119 | ||
248 | === modified file 'src/dk/aau/cs/TCTL/TCTLEXNode.java' | |||
249 | --- src/dk/aau/cs/TCTL/TCTLEXNode.java 2017-03-12 00:33:00 +0000 | |||
250 | +++ src/dk/aau/cs/TCTL/TCTLEXNode.java 2020-08-19 11:36:17 +0000 | |||
251 | @@ -82,8 +82,13 @@ | |||
252 | 82 | public boolean containsPlaceHolder() { | 82 | public boolean containsPlaceHolder() { |
253 | 83 | return property.containsPlaceHolder(); | 83 | return property.containsPlaceHolder(); |
254 | 84 | } | 84 | } |
257 | 85 | 85 | ||
258 | 86 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | 86 | @Override |
259 | 87 | public boolean hasNestedPathQuantifiers() { | ||
260 | 88 | return property instanceof TCTLPathToStateConverter || property.hasNestedPathQuantifiers(); | ||
261 | 89 | } | ||
262 | 90 | |||
263 | 91 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | ||
264 | 87 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); | 92 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); |
265 | 88 | } | 93 | } |
266 | 89 | 94 | ||
267 | 90 | 95 | ||
268 | === modified file 'src/dk/aau/cs/TCTL/TCTLFalseNode.java' | |||
269 | --- src/dk/aau/cs/TCTL/TCTLFalseNode.java 2017-03-12 00:33:00 +0000 | |||
270 | +++ src/dk/aau/cs/TCTL/TCTLFalseNode.java 2020-08-19 11:36:17 +0000 | |||
271 | @@ -35,7 +35,12 @@ | |||
272 | 35 | return false; | 35 | return false; |
273 | 36 | } | 36 | } |
274 | 37 | 37 | ||
276 | 38 | public TCTLAbstractProperty findFirstPlaceHolder() { | 38 | @Override |
277 | 39 | public boolean hasNestedPathQuantifiers() { | ||
278 | 40 | return false; | ||
279 | 41 | } | ||
280 | 42 | |||
281 | 43 | public TCTLAbstractProperty findFirstPlaceHolder() { | ||
282 | 39 | return null; | 44 | return null; |
283 | 40 | } | 45 | } |
284 | 41 | 46 | ||
285 | 42 | 47 | ||
286 | === modified file 'src/dk/aau/cs/TCTL/TCTLNotNode.java' | |||
287 | --- src/dk/aau/cs/TCTL/TCTLNotNode.java 2017-03-12 00:33:00 +0000 | |||
288 | +++ src/dk/aau/cs/TCTL/TCTLNotNode.java 2020-08-19 11:36:17 +0000 | |||
289 | @@ -88,7 +88,12 @@ | |||
290 | 88 | return property.containsPlaceHolder(); | 88 | return property.containsPlaceHolder(); |
291 | 89 | } | 89 | } |
292 | 90 | 90 | ||
294 | 91 | @Override | 91 | @Override |
295 | 92 | public boolean hasNestedPathQuantifiers() { | ||
296 | 93 | return property instanceof TCTLPathToStateConverter || property.hasNestedPathQuantifiers(); | ||
297 | 94 | } | ||
298 | 95 | |||
299 | 96 | @Override | ||
300 | 92 | public TCTLAbstractProperty findFirstPlaceHolder() { | 97 | public TCTLAbstractProperty findFirstPlaceHolder() { |
301 | 93 | return property.findFirstPlaceHolder(); | 98 | return property.findFirstPlaceHolder(); |
302 | 94 | 99 | ||
303 | 95 | 100 | ||
304 | === modified file 'src/dk/aau/cs/TCTL/TCTLOrListNode.java' | |||
305 | --- src/dk/aau/cs/TCTL/TCTLOrListNode.java 2017-03-12 00:33:00 +0000 | |||
306 | +++ src/dk/aau/cs/TCTL/TCTLOrListNode.java 2020-08-19 11:36:17 +0000 | |||
307 | @@ -194,7 +194,20 @@ | |||
308 | 194 | return placeHolderFound; | 194 | return placeHolderFound; |
309 | 195 | } | 195 | } |
310 | 196 | 196 | ||
312 | 197 | @Override | 197 | @Override |
313 | 198 | public boolean hasNestedPathQuantifiers() { | ||
314 | 199 | boolean foundNestedQuantifier = false; | ||
315 | 200 | |||
316 | 201 | for (TCTLAbstractStateProperty p : properties) { | ||
317 | 202 | foundNestedQuantifier = foundNestedQuantifier || p instanceof TCTLPathToStateConverter || p.hasNestedPathQuantifiers(); | ||
318 | 203 | if(foundNestedQuantifier){ | ||
319 | 204 | break; | ||
320 | 205 | } | ||
321 | 206 | } | ||
322 | 207 | return foundNestedQuantifier; | ||
323 | 208 | } | ||
324 | 209 | |||
325 | 210 | @Override | ||
326 | 198 | public TCTLAbstractProperty findFirstPlaceHolder() { | 211 | public TCTLAbstractProperty findFirstPlaceHolder() { |
327 | 199 | TCTLAbstractProperty ph = null; | 212 | TCTLAbstractProperty ph = null; |
328 | 200 | for (TCTLAbstractStateProperty p : properties) { | 213 | for (TCTLAbstractStateProperty p : properties) { |
329 | 201 | 214 | ||
330 | === modified file 'src/dk/aau/cs/TCTL/TCTLPathPlaceHolder.java' | |||
331 | --- src/dk/aau/cs/TCTL/TCTLPathPlaceHolder.java 2017-03-12 00:33:00 +0000 | |||
332 | +++ src/dk/aau/cs/TCTL/TCTLPathPlaceHolder.java 2020-08-19 11:36:17 +0000 | |||
333 | @@ -26,7 +26,12 @@ | |||
334 | 26 | return true; | 26 | return true; |
335 | 27 | } | 27 | } |
336 | 28 | 28 | ||
338 | 29 | @Override | 29 | @Override |
339 | 30 | public boolean hasNestedPathQuantifiers() { | ||
340 | 31 | return false; | ||
341 | 32 | } | ||
342 | 33 | |||
343 | 34 | @Override | ||
344 | 30 | public boolean equals(Object o) { | 35 | public boolean equals(Object o) { |
345 | 31 | if (o instanceof TCTLPathPlaceHolder) { | 36 | if (o instanceof TCTLPathPlaceHolder) { |
346 | 32 | return true; | 37 | return true; |
347 | 33 | 38 | ||
348 | === modified file 'src/dk/aau/cs/TCTL/TCTLPathToStateConverter.java' | |||
349 | --- src/dk/aau/cs/TCTL/TCTLPathToStateConverter.java 2017-03-12 00:33:00 +0000 | |||
350 | +++ src/dk/aau/cs/TCTL/TCTLPathToStateConverter.java 2020-08-19 11:36:17 +0000 | |||
351 | @@ -76,8 +76,13 @@ | |||
352 | 76 | public boolean containsPlaceHolder() { | 76 | public boolean containsPlaceHolder() { |
353 | 77 | return property.containsPlaceHolder(); | 77 | return property.containsPlaceHolder(); |
354 | 78 | } | 78 | } |
357 | 79 | 79 | ||
358 | 80 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | 80 | @Override |
359 | 81 | public boolean hasNestedPathQuantifiers() { | ||
360 | 82 | return false; | ||
361 | 83 | } | ||
362 | 84 | |||
363 | 85 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | ||
364 | 81 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); | 86 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); |
365 | 82 | } | 87 | } |
366 | 83 | 88 | ||
367 | 84 | 89 | ||
368 | === modified file 'src/dk/aau/cs/TCTL/TCTLPlaceNode.java' | |||
369 | --- src/dk/aau/cs/TCTL/TCTLPlaceNode.java 2017-03-12 00:33:00 +0000 | |||
370 | +++ src/dk/aau/cs/TCTL/TCTLPlaceNode.java 2020-08-19 11:36:17 +0000 | |||
371 | @@ -57,7 +57,12 @@ | |||
372 | 57 | return false; | 57 | return false; |
373 | 58 | } | 58 | } |
374 | 59 | 59 | ||
376 | 60 | @Override | 60 | @Override |
377 | 61 | public boolean hasNestedPathQuantifiers() { | ||
378 | 62 | return false; | ||
379 | 63 | } | ||
380 | 64 | |||
381 | 65 | @Override | ||
382 | 61 | public TCTLAbstractProperty findFirstPlaceHolder() { | 66 | public TCTLAbstractProperty findFirstPlaceHolder() { |
383 | 62 | return null; | 67 | return null; |
384 | 63 | } | 68 | } |
385 | 64 | 69 | ||
386 | === modified file 'src/dk/aau/cs/TCTL/TCTLPlusListNode.java' | |||
387 | --- src/dk/aau/cs/TCTL/TCTLPlusListNode.java 2017-03-12 00:33:00 +0000 | |||
388 | +++ src/dk/aau/cs/TCTL/TCTLPlusListNode.java 2020-08-19 11:36:17 +0000 | |||
389 | @@ -84,7 +84,12 @@ | |||
390 | 84 | return false; | 84 | return false; |
391 | 85 | } | 85 | } |
392 | 86 | 86 | ||
394 | 87 | @Override | 87 | @Override |
395 | 88 | public boolean hasNestedPathQuantifiers() { | ||
396 | 89 | return false; | ||
397 | 90 | } | ||
398 | 91 | |||
399 | 92 | @Override | ||
400 | 88 | public TCTLAbstractProperty findFirstPlaceHolder() { | 93 | public TCTLAbstractProperty findFirstPlaceHolder() { |
401 | 89 | for(TCTLAbstractStateProperty term : terms){ | 94 | for(TCTLAbstractStateProperty term : terms){ |
402 | 90 | TCTLAbstractProperty placeholder = term.findFirstPlaceHolder(); | 95 | TCTLAbstractProperty placeholder = term.findFirstPlaceHolder(); |
403 | 91 | 96 | ||
404 | === modified file 'src/dk/aau/cs/TCTL/TCTLStatePlaceHolder.java' | |||
405 | --- src/dk/aau/cs/TCTL/TCTLStatePlaceHolder.java 2017-03-12 00:33:00 +0000 | |||
406 | +++ src/dk/aau/cs/TCTL/TCTLStatePlaceHolder.java 2020-08-19 11:36:17 +0000 | |||
407 | @@ -26,7 +26,12 @@ | |||
408 | 26 | return true; | 26 | return true; |
409 | 27 | } | 27 | } |
410 | 28 | 28 | ||
412 | 29 | @Override | 29 | @Override |
413 | 30 | public boolean hasNestedPathQuantifiers() { | ||
414 | 31 | return false; | ||
415 | 32 | } | ||
416 | 33 | |||
417 | 34 | @Override | ||
418 | 30 | public boolean equals(Object o) { | 35 | public boolean equals(Object o) { |
419 | 31 | if (o instanceof TCTLStatePlaceHolder) { | 36 | if (o instanceof TCTLStatePlaceHolder) { |
420 | 32 | return true; | 37 | return true; |
421 | 33 | 38 | ||
422 | === modified file 'src/dk/aau/cs/TCTL/TCTLStateToPathConverter.java' | |||
423 | --- src/dk/aau/cs/TCTL/TCTLStateToPathConverter.java 2017-03-12 00:33:00 +0000 | |||
424 | +++ src/dk/aau/cs/TCTL/TCTLStateToPathConverter.java 2020-08-19 11:36:17 +0000 | |||
425 | @@ -76,8 +76,13 @@ | |||
426 | 76 | public boolean containsPlaceHolder() { | 76 | public boolean containsPlaceHolder() { |
427 | 77 | return property.containsPlaceHolder(); | 77 | return property.containsPlaceHolder(); |
428 | 78 | } | 78 | } |
431 | 79 | 79 | ||
432 | 80 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | 80 | @Override |
433 | 81 | public boolean hasNestedPathQuantifiers() { | ||
434 | 82 | return property.hasNestedPathQuantifiers(); | ||
435 | 83 | } | ||
436 | 84 | |||
437 | 85 | public boolean containsAtomicPropositionWithSpecificPlaceInTemplate(String templateName, String placeName) { | ||
438 | 81 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); | 86 | return property.containsAtomicPropositionWithSpecificPlaceInTemplate(templateName, placeName); |
439 | 82 | } | 87 | } |
440 | 83 | 88 | ||
441 | 84 | 89 | ||
442 | === modified file 'src/dk/aau/cs/TCTL/TCTLTermListNode.java' | |||
443 | --- src/dk/aau/cs/TCTL/TCTLTermListNode.java 2017-06-23 08:38:31 +0000 | |||
444 | +++ src/dk/aau/cs/TCTL/TCTLTermListNode.java 2020-08-19 11:36:17 +0000 | |||
445 | @@ -84,7 +84,12 @@ | |||
446 | 84 | return false; | 84 | return false; |
447 | 85 | } | 85 | } |
448 | 86 | 86 | ||
450 | 87 | @Override | 87 | @Override |
451 | 88 | public boolean hasNestedPathQuantifiers() { | ||
452 | 89 | return false; | ||
453 | 90 | } | ||
454 | 91 | |||
455 | 92 | @Override | ||
456 | 88 | public TCTLAbstractProperty findFirstPlaceHolder() { | 93 | public TCTLAbstractProperty findFirstPlaceHolder() { |
457 | 89 | for(TCTLAbstractStateProperty factor : factors){ | 94 | for(TCTLAbstractStateProperty factor : factors){ |
458 | 90 | TCTLAbstractProperty placeholder = factor.findFirstPlaceHolder(); | 95 | TCTLAbstractProperty placeholder = factor.findFirstPlaceHolder(); |
459 | 91 | 96 | ||
460 | === modified file 'src/dk/aau/cs/TCTL/TCTLTransitionNode.java' | |||
461 | --- src/dk/aau/cs/TCTL/TCTLTransitionNode.java 2017-03-12 00:33:00 +0000 | |||
462 | +++ src/dk/aau/cs/TCTL/TCTLTransitionNode.java 2020-08-19 11:36:17 +0000 | |||
463 | @@ -57,7 +57,12 @@ | |||
464 | 57 | return false; | 57 | return false; |
465 | 58 | } | 58 | } |
466 | 59 | 59 | ||
468 | 60 | @Override | 60 | @Override |
469 | 61 | public boolean hasNestedPathQuantifiers() { | ||
470 | 62 | return false; | ||
471 | 63 | } | ||
472 | 64 | |||
473 | 65 | @Override | ||
474 | 61 | public TCTLAbstractProperty findFirstPlaceHolder() { | 66 | public TCTLAbstractProperty findFirstPlaceHolder() { |
475 | 62 | return null; | 67 | return null; |
476 | 63 | } | 68 | } |
477 | 64 | 69 | ||
478 | === modified file 'src/dk/aau/cs/TCTL/TCTLTrueNode.java' | |||
479 | --- src/dk/aau/cs/TCTL/TCTLTrueNode.java 2017-03-12 00:33:00 +0000 | |||
480 | +++ src/dk/aau/cs/TCTL/TCTLTrueNode.java 2020-08-19 11:36:17 +0000 | |||
481 | @@ -35,7 +35,12 @@ | |||
482 | 35 | return false; | 35 | return false; |
483 | 36 | } | 36 | } |
484 | 37 | 37 | ||
486 | 38 | public TCTLAbstractProperty findFirstPlaceHolder() { | 38 | @Override |
487 | 39 | public boolean hasNestedPathQuantifiers() { | ||
488 | 40 | return false; | ||
489 | 41 | } | ||
490 | 42 | |||
491 | 43 | public TCTLAbstractProperty findFirstPlaceHolder() { | ||
492 | 39 | return null; | 44 | return null; |
493 | 40 | } | 45 | } |
494 | 41 | 46 | ||
495 | 42 | 47 | ||
496 | === modified file 'src/dk/aau/cs/gui/TabContent.java' | |||
497 | --- src/dk/aau/cs/gui/TabContent.java 2020-08-11 11:33:28 +0000 | |||
498 | +++ src/dk/aau/cs/gui/TabContent.java 2020-08-19 11:36:17 +0000 | |||
499 | @@ -1,5 +1,17 @@ | |||
500 | 1 | package dk.aau.cs.gui; | 1 | package dk.aau.cs.gui; |
501 | 2 | 2 | ||
502 | 3 | import java.awt.*; | ||
503 | 4 | import java.awt.event.ActionEvent; | ||
504 | 5 | import java.awt.event.MouseAdapter; | ||
505 | 6 | import java.awt.event.MouseEvent; | ||
506 | 7 | import java.awt.geom.Point2D; | ||
507 | 8 | import java.io.*; | ||
508 | 9 | import java.math.BigDecimal; | ||
509 | 10 | import java.util.*; | ||
510 | 11 | import java.util.List; | ||
511 | 12 | |||
512 | 13 | import javax.swing.*; | ||
513 | 14 | import javax.swing.border.BevelBorder; | ||
514 | 3 | import dk.aau.cs.debug.Logger; | 15 | import dk.aau.cs.debug.Logger; |
515 | 4 | import dk.aau.cs.gui.components.BugHandledJXMultisplitPane; | 16 | import dk.aau.cs.gui.components.BugHandledJXMultisplitPane; |
516 | 5 | import dk.aau.cs.gui.components.StatisticsPanel; | 17 | import dk.aau.cs.gui.components.StatisticsPanel; |
517 | @@ -27,6 +39,7 @@ | |||
518 | 27 | import pipe.dataLayer.TAPNQuery; | 39 | import pipe.dataLayer.TAPNQuery; |
519 | 28 | import pipe.dataLayer.Template; | 40 | import pipe.dataLayer.Template; |
520 | 29 | import pipe.gui.*; | 41 | import pipe.gui.*; |
521 | 42 | import pipe.gui.action.GuiAction; | ||
522 | 30 | import pipe.gui.canvas.DrawingSurfaceImpl; | 43 | import pipe.gui.canvas.DrawingSurfaceImpl; |
523 | 31 | import pipe.gui.graphicElements.*; | 44 | import pipe.gui.graphicElements.*; |
524 | 32 | import pipe.gui.graphicElements.tapn.*; | 45 | import pipe.gui.graphicElements.tapn.*; |
525 | @@ -36,17 +49,7 @@ | |||
526 | 36 | import pipe.gui.widgets.WorkflowDialog; | 49 | import pipe.gui.widgets.WorkflowDialog; |
527 | 37 | import pipe.gui.widgets.filebrowser.FileBrowser; | 50 | import pipe.gui.widgets.filebrowser.FileBrowser; |
528 | 38 | 51 | ||
529 | 39 | import javax.swing.*; | ||
530 | 40 | import javax.swing.border.BevelBorder; | ||
531 | 41 | import java.awt.*; | ||
532 | 42 | import java.awt.event.MouseAdapter; | ||
533 | 43 | import java.awt.event.MouseEvent; | ||
534 | 44 | import java.awt.event.MouseWheelEvent; | 52 | import java.awt.event.MouseWheelEvent; |
535 | 45 | import java.awt.geom.Point2D; | ||
536 | 46 | import java.io.*; | ||
537 | 47 | import java.math.BigDecimal; | ||
538 | 48 | import java.util.List; | ||
539 | 49 | import java.util.*; | ||
540 | 50 | 53 | ||
541 | 51 | public class TabContent extends JSplitPane implements TabContentActions{ | 54 | public class TabContent extends JSplitPane implements TabContentActions{ |
542 | 52 | 55 | ||
543 | @@ -56,7 +59,8 @@ | |||
544 | 56 | this.guiFrameControllerActions.setReference(guiFrameControllerActions); | 59 | this.guiFrameControllerActions.setReference(guiFrameControllerActions); |
545 | 57 | } | 60 | } |
546 | 58 | 61 | ||
548 | 59 | public static class TAPNLens { | 62 | public static final class TAPNLens { |
549 | 63 | public static final TAPNLens Default = new TAPNLens(true, true); | ||
550 | 60 | public boolean isTimed() { | 64 | public boolean isTimed() { |
551 | 61 | return timed; | 65 | return timed; |
552 | 62 | } | 66 | } |
553 | @@ -68,7 +72,7 @@ | |||
554 | 68 | private final boolean timed; | 72 | private final boolean timed; |
555 | 69 | private final boolean game; | 73 | private final boolean game; |
556 | 70 | 74 | ||
558 | 71 | TAPNLens(boolean timed, boolean game) { | 75 | public TAPNLens(boolean timed, boolean game) { |
559 | 72 | this.timed = timed; | 76 | this.timed = timed; |
560 | 73 | this.game = game; | 77 | this.game = game; |
561 | 74 | } | 78 | } |
562 | @@ -156,7 +160,7 @@ | |||
563 | 156 | Require.notNull(p, "Point can't be null"); | 160 | Require.notNull(p, "Point can't be null"); |
564 | 157 | 161 | ||
565 | 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))); |
567 | 159 | TimedPlaceComponent pnObject = new TimedPlaceComponent(p.x, p.y, tp); | 163 | TimedPlaceComponent pnObject = new TimedPlaceComponent(p.x, p.y, tp, lens); |
568 | 160 | guiModelToModel.get(c).add(tp); | 164 | guiModelToModel.get(c).add(tp); |
569 | 161 | c.addPetriNetObject(pnObject); | 165 | c.addPetriNetObject(pnObject); |
570 | 162 | 166 | ||
571 | @@ -167,7 +171,7 @@ | |||
572 | 167 | public Result<TimedTransitionComponent, ModelViolation> addNewTimedTransitions(DataLayer c, Point p) { | 171 | public Result<TimedTransitionComponent, ModelViolation> addNewTimedTransitions(DataLayer c, Point p) { |
573 | 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))); |
574 | 169 | 173 | ||
576 | 170 | TimedTransitionComponent pnObject = new TimedTransitionComponent(p.x, p.y, transition); | 174 | TimedTransitionComponent pnObject = new TimedTransitionComponent(p.x, p.y, transition, lens); |
577 | 171 | 175 | ||
578 | 172 | guiModelToModel.get(c).add(transition); | 176 | guiModelToModel.get(c).add(transition); |
579 | 173 | c.addPetriNetObject(pnObject); | 177 | c.addPetriNetObject(pnObject); |
580 | @@ -207,7 +211,7 @@ | |||
581 | 207 | TimeInterval.ZERO_INF | 211 | TimeInterval.ZERO_INF |
582 | 208 | ); | 212 | ); |
583 | 209 | 213 | ||
585 | 210 | TimedInputArcComponent tiac = new TimedInputArcComponent(p, t, tia); | 214 | TimedInputArcComponent tiac = new TimedInputArcComponent(p, t, tia, lens); |
586 | 211 | 215 | ||
587 | 212 | if (path != null) { | 216 | if (path != null) { |
588 | 213 | tiac.setArcPath(new ArcPath(tiac, path)); | 217 | tiac.setArcPath(new ArcPath(tiac, path)); |
589 | @@ -563,7 +567,7 @@ | |||
590 | 563 | }).start(); | 567 | }).start(); |
591 | 564 | } | 568 | } |
592 | 565 | 569 | ||
594 | 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()); |
595 | 567 | 571 | ||
596 | 568 | tab.setInitialName(name); | 572 | tab.setInitialName(name); |
597 | 569 | 573 | ||
598 | @@ -784,6 +788,9 @@ | |||
599 | 784 | addGuiModel(template.model(), template.guiModel()); | 788 | addGuiModel(template.model(), template.guiModel()); |
600 | 785 | zoomLevels.put(template.model(), template.zoomer()); | 789 | zoomLevels.put(template.model(), template.zoomer()); |
601 | 786 | hasPositionalInfos.put(template.model(), template.getHasPositionalInfo()); | 790 | hasPositionalInfos.put(template.model(), template.getHasPositionalInfo()); |
602 | 791 | for(PetriNetObject o : template.guiModel().getPetriNetObjects()){ | ||
603 | 792 | o.setLens(this.lens); | ||
604 | 793 | } | ||
605 | 787 | } | 794 | } |
606 | 788 | 795 | ||
607 | 789 | drawingSurface = new DrawingSurfaceImpl(new DataLayer(), this, managerRef); | 796 | drawingSurface = new DrawingSurfaceImpl(new DataLayer(), this, managerRef); |
608 | @@ -831,7 +838,7 @@ | |||
609 | 831 | private TabContent(TimedArcPetriNetNetwork network, Collection<Template> templates, Iterable<TAPNQuery> tapnqueries) { | 838 | private TabContent(TimedArcPetriNetNetwork network, Collection<Template> templates, Iterable<TAPNQuery> tapnqueries) { |
610 | 832 | this(network, templates, tapnqueries, new TAPNLens(true, false)); | 839 | this(network, templates, tapnqueries, new TAPNLens(true, false)); |
611 | 833 | } | 840 | } |
613 | 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) { |
614 | 835 | this(network, templates, lens); | 842 | this(network, templates, lens); |
615 | 836 | 843 | ||
616 | 837 | setNetwork(network, templates); | 844 | setNetwork(network, templates); |
617 | @@ -1133,9 +1140,15 @@ | |||
618 | 1133 | showEnabledTransitionsList(showEnabledTransitions); | 1140 | showEnabledTransitionsList(showEnabledTransitions); |
619 | 1134 | 1141 | ||
620 | 1135 | this.setLeftComponent(animatorSplitPaneScroller); | 1142 | this.setLeftComponent(animatorSplitPaneScroller); |
621 | 1136 | |||
622 | 1137 | } | 1143 | } |
623 | 1138 | 1144 | ||
624 | 1145 | private void hideTimedInformation(){ | ||
625 | 1146 | if(!lens.isTimed()){ | ||
626 | 1147 | animControlerBox.setVisible(false); | ||
627 | 1148 | } | ||
628 | 1149 | |||
629 | 1150 | } | ||
630 | 1151 | |||
631 | 1139 | public void switchToEditorComponents() { | 1152 | public void switchToEditorComponents() { |
632 | 1140 | 1153 | ||
633 | 1141 | //Remove dummy | 1154 | //Remove dummy |
634 | @@ -1220,7 +1233,7 @@ | |||
635 | 1220 | } | 1233 | } |
636 | 1221 | 1234 | ||
637 | 1222 | private void createAnimationControlSidePanel() { | 1235 | private void createAnimationControlSidePanel() { |
639 | 1223 | animControlerBox = new AnimationControlSidePanel(animator); | 1236 | animControlerBox = new AnimationControlSidePanel(animator, lens); |
640 | 1224 | } | 1237 | } |
641 | 1225 | 1238 | ||
642 | 1226 | public AnimationHistoryList getAnimationHistorySidePanel() { | 1239 | public AnimationHistoryList getAnimationHistorySidePanel() { |
643 | @@ -1228,7 +1241,7 @@ | |||
644 | 1228 | } | 1241 | } |
645 | 1229 | 1242 | ||
646 | 1230 | private void createTransitionFireing() { | 1243 | private void createTransitionFireing() { |
648 | 1231 | transitionFireing = new TransitionFireingComponent(CreateGui.getApp().isShowingDelayEnabledTransitions()); | 1244 | transitionFireing = new TransitionFireingComponent(CreateGui.getApp().isShowingDelayEnabledTransitions(), lens); |
649 | 1232 | } | 1245 | } |
650 | 1233 | 1246 | ||
651 | 1234 | public TransitionFireingComponent getTransitionFireingComponent() { | 1247 | public TransitionFireingComponent getTransitionFireingComponent() { |
652 | @@ -1486,13 +1499,13 @@ | |||
653 | 1486 | } | 1499 | } |
654 | 1487 | 1500 | ||
655 | 1488 | private void createNewAndConvertUntimed() { | 1501 | private void createNewAndConvertUntimed() { |
657 | 1489 | TabContent tab = duplicateTab(FeatureOption.TIME, false); | 1502 | TabContent tab = duplicateTab(new TAPNLens(false, lens.isGame()), "-untimed"); |
658 | 1490 | convertToUntimedTab(tab); | 1503 | convertToUntimedTab(tab); |
659 | 1491 | guiFrameControllerActions.ifPresent(o -> o.openTab(tab)); | 1504 | guiFrameControllerActions.ifPresent(o -> o.openTab(tab)); |
660 | 1492 | } | 1505 | } |
661 | 1493 | 1506 | ||
662 | 1494 | private void createNewAndConvertNonGame() { | 1507 | private void createNewAndConvertNonGame() { |
664 | 1495 | TabContent tab = duplicateTab(FeatureOption.GAME, false); | 1508 | TabContent tab = duplicateTab(new TAPNLens(lens.isTimed(), false), "-nongame"); |
665 | 1496 | TabTransformer.removeGameInformation(tab); | 1509 | TabTransformer.removeGameInformation(tab); |
666 | 1497 | guiFrameControllerActions.ifPresent(o -> o.openTab(tab)); | 1510 | guiFrameControllerActions.ifPresent(o -> o.openTab(tab)); |
667 | 1498 | } | 1511 | } |
668 | @@ -1512,13 +1525,31 @@ | |||
669 | 1512 | createNewAndConvertUntimed(); | 1525 | createNewAndConvertUntimed(); |
670 | 1513 | } | 1526 | } |
671 | 1514 | } else { | 1527 | } else { |
673 | 1515 | TabContent tab = duplicateTab(FeatureOption.TIME, isTime); | 1528 | TabContent tab = duplicateTab(new TAPNLens(true, lens.isGame()), "-timed"); |
674 | 1529 | findAndRemoveAffectedQueries(tab); | ||
675 | 1516 | guiFrameControllerActions.ifPresent(o -> o.openTab(tab)); | 1530 | guiFrameControllerActions.ifPresent(o -> o.openTab(tab)); |
676 | 1517 | } | 1531 | } |
677 | 1518 | updateFeatureText(); | 1532 | updateFeatureText(); |
678 | 1519 | } | 1533 | } |
679 | 1520 | } | 1534 | } |
680 | 1521 | 1535 | ||
681 | 1536 | private void findAndRemoveAffectedQueries(TabContent tab){ | ||
682 | 1537 | List<TAPNQuery> queriesToRemove = new ArrayList<TAPNQuery>(); | ||
683 | 1538 | for (TAPNQuery q : tab.queries()){ | ||
684 | 1539 | if(q.hasUntimedOnlyProperties()){ | ||
685 | 1540 | queriesToRemove.add(q); | ||
686 | 1541 | tab.removeQuery(q); | ||
687 | 1542 | } | ||
688 | 1543 | } | ||
689 | 1544 | String message = "The following queries will be removed in the conversion:"; | ||
690 | 1545 | for(TAPNQuery q : queriesToRemove){ | ||
691 | 1546 | message += "\n" + q.getName(); | ||
692 | 1547 | } | ||
693 | 1548 | if(!queriesToRemove.isEmpty()){ | ||
694 | 1549 | JOptionPane.showMessageDialog(this,message,"Information", JOptionPane.INFORMATION_MESSAGE); | ||
695 | 1550 | } | ||
696 | 1551 | } | ||
697 | 1552 | |||
698 | 1522 | @Override | 1553 | @Override |
699 | 1523 | public void changeGameFeature(boolean isGame) { | 1554 | public void changeGameFeature(boolean isGame) { |
700 | 1524 | if (isGame != lens.isGame()) { | 1555 | if (isGame != lens.isGame()) { |
701 | @@ -1534,7 +1565,7 @@ | |||
702 | 1534 | createNewAndConvertNonGame(); | 1565 | createNewAndConvertNonGame(); |
703 | 1535 | } | 1566 | } |
704 | 1536 | } else { | 1567 | } else { |
706 | 1537 | TabContent tab = duplicateTab(FeatureOption.GAME, isGame); | 1568 | TabContent tab = duplicateTab(new TAPNLens(lens.isTimed(), true), "-game"); |
707 | 1538 | guiFrameControllerActions.ifPresent(o -> o.openTab(tab)); | 1569 | guiFrameControllerActions.ifPresent(o -> o.openTab(tab)); |
708 | 1539 | } | 1570 | } |
709 | 1540 | updateFeatureText(); | 1571 | updateFeatureText(); |
710 | @@ -1642,6 +1673,8 @@ | |||
711 | 1642 | drawingSurface().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); | 1673 | drawingSurface().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
712 | 1643 | 1674 | ||
713 | 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, |
714 | 1676 | app.ifPresent(o->o.setStatusBarText(textforAnimation)); | ||
715 | 1677 | |||
716 | 1645 | } else { | 1678 | } else { |
717 | 1646 | JOptionPane.showMessageDialog(CreateGui.getApp(), | 1679 | JOptionPane.showMessageDialog(CreateGui.getApp(), |
718 | 1647 | "You need at least one active template to enter simulation mode", | 1680 | "You need at least one active template to enter simulation mode", |
719 | @@ -1669,6 +1702,7 @@ | |||
720 | 1669 | // Undo/Redo is enabled based on undo/redo manager | 1702 | // Undo/Redo is enabled based on undo/redo manager |
721 | 1670 | getUndoManager().setUndoRedoStatus(); | 1703 | getUndoManager().setUndoRedoStatus(); |
722 | 1671 | animationmode = false; | 1704 | animationmode = false; |
723 | 1705 | app.ifPresent(o->o.setStatusBarText(textforDrawing)); | ||
724 | 1672 | } | 1706 | } |
725 | 1673 | animator.updateAnimationButtonsEnabled(); //Update stepBack/Forward | 1707 | animator.updateAnimationButtonsEnabled(); //Update stepBack/Forward |
726 | 1674 | } | 1708 | } |
727 | @@ -1679,11 +1713,13 @@ | |||
728 | 1679 | @Override | 1713 | @Override |
729 | 1680 | public void setMode(Pipe.ElementType mode) { | 1714 | public void setMode(Pipe.ElementType mode) { |
730 | 1681 | 1715 | ||
732 | 1682 | app.ifPresent(o->o.updateMode(mode)); | 1716 | CreateGui.guiMode = mode; |
733 | 1717 | changeStatusbarText(mode); | ||
734 | 1683 | 1718 | ||
735 | 1684 | //Disable selection and deselect current selection | 1719 | //Disable selection and deselect current selection |
736 | 1685 | drawingSurface().getSelectionObject().clearSelection(); | 1720 | drawingSurface().getSelectionObject().clearSelection(); |
737 | 1686 | editorMode = mode; | 1721 | editorMode = mode; |
738 | 1722 | updateMode(); | ||
739 | 1687 | switch (mode) { | 1723 | switch (mode) { |
740 | 1688 | case ADDTOKEN: | 1724 | case ADDTOKEN: |
741 | 1689 | setManager(new AbstractDrawingSurfaceManager() { | 1725 | setManager(new AbstractDrawingSurfaceManager() { |
742 | @@ -1851,6 +1887,11 @@ | |||
743 | 1851 | app.ifPresent(o->o.setGUIMode(GuiFrame.GUIMode.draw)); | 1887 | app.ifPresent(o->o.setGUIMode(GuiFrame.GUIMode.draw)); |
744 | 1852 | app.ifPresent(o->setMode(Pipe.ElementType.SELECT)); | 1888 | app.ifPresent(o->setMode(Pipe.ElementType.SELECT)); |
745 | 1853 | } | 1889 | } |
746 | 1890 | app.ifPresent(o->o.registerDrawingActions(getAvailableDrawActions())); | ||
747 | 1891 | app.ifPresent(o->o.registerAnimationActions(getAvailableSimActions())); | ||
748 | 1892 | |||
749 | 1893 | //TODO: this is a temporary implementation untill actions can be moved | ||
750 | 1894 | app.ifPresent(o->o.registerViewActions(List.of())); | ||
751 | 1854 | 1895 | ||
752 | 1855 | } | 1896 | } |
753 | 1856 | 1897 | ||
754 | @@ -1947,8 +1988,7 @@ | |||
755 | 1947 | allTemplates(), | 1988 | allTemplates(), |
756 | 1948 | queriesOverwrite, | 1989 | queriesOverwrite, |
757 | 1949 | network().constants(), | 1990 | network().constants(), |
760 | 1950 | lens.timed, | 1991 | lens |
759 | 1951 | lens.game | ||
761 | 1952 | ); | 1992 | ); |
762 | 1953 | 1993 | ||
763 | 1954 | tapnWriter.savePNML(outFile); | 1994 | tapnWriter.savePNML(outFile); |
764 | @@ -2026,51 +2066,26 @@ | |||
765 | 2026 | drawingSurface().updatePreferredSize(); | 2066 | drawingSurface().updatePreferredSize(); |
766 | 2027 | } | 2067 | } |
767 | 2028 | 2068 | ||
812 | 2029 | public TabContent duplicateTab(FeatureOption option, boolean isYes) { | 2069 | public TabContent duplicateTab(TAPNLens overwriteLens, String appendName) { |
813 | 2030 | NetWriter tapnWriter = new TimedArcPetriNetNetworkWriter( | 2070 | NetWriter tapnWriter = new TimedArcPetriNetNetworkWriter( |
814 | 2031 | network(), | 2071 | network(), |
815 | 2032 | allTemplates(), | 2072 | allTemplates(), |
816 | 2033 | queries(), | 2073 | queries(), |
817 | 2034 | network().constants() | 2074 | network().constants(), |
818 | 2035 | ); | 2075 | overwriteLens |
819 | 2036 | 2076 | ); | |
820 | 2037 | option = isNetChanged(option, isYes) ? option : FeatureOption.TIME; | 2077 | |
821 | 2038 | 2078 | try { | |
822 | 2039 | try { | 2079 | ByteArrayOutputStream outputStream = tapnWriter.savePNML(); |
823 | 2040 | ByteArrayOutputStream outputStream = tapnWriter.savePNML(); | 2080 | String composedName = getTabTitle(); |
824 | 2041 | String composedName = getTabTitle(); | 2081 | composedName = composedName.replace(".tapn", ""); |
825 | 2042 | composedName = composedName.replace(".tapn", ""); | 2082 | composedName += appendName; |
826 | 2043 | 2083 | return createNewTabFromInputStream(new ByteArrayInputStream(outputStream.toByteArray()), composedName); | |
827 | 2044 | switch (option) { | 2084 | } catch (Exception e1) { |
828 | 2045 | case TIME: | 2085 | Logger.log("Could not load model"); |
829 | 2046 | composedName += isYes ? "-timed" : "-untimed"; | 2086 | e1.printStackTrace(); |
786 | 2047 | break; | ||
787 | 2048 | case GAME: | ||
788 | 2049 | composedName += isYes ? "-game" : "-noGame"; | ||
789 | 2050 | break; | ||
790 | 2051 | } | ||
791 | 2052 | |||
792 | 2053 | if (isNetChanged(option, isYes)) { | ||
793 | 2054 | return createNewTabFromInputStream(new ByteArrayInputStream(outputStream.toByteArray()), composedName, option, isYes); | ||
794 | 2055 | } else { | ||
795 | 2056 | return createNewTabFromInputStream(new ByteArrayInputStream(outputStream.toByteArray()), composedName); | ||
796 | 2057 | } | ||
797 | 2058 | } catch (Exception e1) { | ||
798 | 2059 | e1.printStackTrace(); | ||
799 | 2060 | System.console().printf(e1.getMessage()); | ||
800 | 2061 | } | ||
801 | 2062 | return null; | ||
802 | 2063 | } | ||
803 | 2064 | |||
804 | 2065 | private boolean isNetChanged(FeatureOption option, boolean isYes) { | ||
805 | 2066 | switch (option) { | ||
806 | 2067 | case TIME: | ||
807 | 2068 | return lens.isTimed() != isYes; | ||
808 | 2069 | case GAME: | ||
809 | 2070 | return lens.isGame() != isYes; | ||
810 | 2071 | default: | ||
811 | 2072 | return false; | ||
830 | 2073 | } | 2087 | } |
831 | 2088 | return null; | ||
832 | 2074 | } | 2089 | } |
833 | 2075 | 2090 | ||
834 | 2076 | class CanvasPlaceDrawController extends AbstractDrawingSurfaceManager { | 2091 | class CanvasPlaceDrawController extends AbstractDrawingSurfaceManager { |
835 | @@ -2651,4 +2666,216 @@ | |||
836 | 2651 | ); | 2666 | ); |
837 | 2652 | } | 2667 | } |
838 | 2653 | } | 2668 | } |
839 | 2669 | public List<GuiAction> getAvailableDrawActions(){ | ||
840 | 2670 | if(lens.isTimed()){ | ||
841 | 2671 | return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction,transAction, timedArcAction, transportArcAction, inhibarcAction, tokenAction, deleteTokenAction)); | ||
842 | 2672 | } else{ | ||
843 | 2673 | return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction,transAction, timedArcAction, inhibarcAction, tokenAction, deleteTokenAction)); | ||
844 | 2674 | } | ||
845 | 2675 | } | ||
846 | 2676 | |||
847 | 2677 | public List<GuiAction> getAvailableSimActions(){ | ||
848 | 2678 | if(lens.isTimed()){ | ||
849 | 2679 | return new ArrayList<>(Arrays.asList(timeAction, delayFireAction)); | ||
850 | 2680 | } else{ | ||
851 | 2681 | delayFireAction.setName("Fire"); | ||
852 | 2682 | delayFireAction.setTooltip("Fire Selected Transition"); | ||
853 | 2683 | return new ArrayList<>(Arrays.asList(delayFireAction)); | ||
854 | 2684 | } | ||
855 | 2685 | } | ||
856 | 2686 | |||
857 | 2687 | private final GuiAction selectAction = new GuiAction("Select", "Select components (S)", "S", true) { | ||
858 | 2688 | public void actionPerformed(ActionEvent e) { | ||
859 | 2689 | setMode(Pipe.ElementType.SELECT); | ||
860 | 2690 | } | ||
861 | 2691 | }; | ||
862 | 2692 | private final GuiAction annotationAction = new GuiAction("Annotation", "Add an annotation (N)", "N", true) { | ||
863 | 2693 | public void actionPerformed(ActionEvent e) { | ||
864 | 2694 | setMode(Pipe.ElementType.ANNOTATION); | ||
865 | 2695 | } | ||
866 | 2696 | }; | ||
867 | 2697 | private final GuiAction inhibarcAction = new GuiAction("Inhibitor arc", "Add an inhibitor arc (I)", "I", true) { | ||
868 | 2698 | public void actionPerformed(ActionEvent e) { | ||
869 | 2699 | setMode(Pipe.ElementType.TAPNINHIBITOR_ARC); | ||
870 | 2700 | } | ||
871 | 2701 | }; | ||
872 | 2702 | private final GuiAction transAction = new GuiAction("Transition", "Add a transition (T)", "T", true) { | ||
873 | 2703 | public void actionPerformed(ActionEvent e) { | ||
874 | 2704 | setMode(Pipe.ElementType.TAPNTRANS); | ||
875 | 2705 | } | ||
876 | 2706 | }; | ||
877 | 2707 | private final GuiAction tokenAction = new GuiAction("Add token", "Add a token (+)", "typed +", true) { | ||
878 | 2708 | public void actionPerformed(ActionEvent e) { | ||
879 | 2709 | setMode(Pipe.ElementType.ADDTOKEN); | ||
880 | 2710 | } | ||
881 | 2711 | }; | ||
882 | 2712 | |||
883 | 2713 | private final GuiAction deleteTokenAction = new GuiAction("Delete token", "Delete a token (-)", "typed -", true) { | ||
884 | 2714 | public void actionPerformed(ActionEvent e) { | ||
885 | 2715 | setMode(Pipe.ElementType.DELTOKEN); | ||
886 | 2716 | } | ||
887 | 2717 | }; | ||
888 | 2718 | private final GuiAction timedPlaceAction = new GuiAction("Place", "Add a place (P)", "P", true) { | ||
889 | 2719 | public void actionPerformed(ActionEvent e) { | ||
890 | 2720 | setMode(Pipe.ElementType.TAPNPLACE); | ||
891 | 2721 | } | ||
892 | 2722 | }; | ||
893 | 2723 | |||
894 | 2724 | private final GuiAction timedArcAction = new GuiAction("Arc", "Add an arc (A)", "A", true) { | ||
895 | 2725 | public void actionPerformed(ActionEvent e) { | ||
896 | 2726 | setMode(Pipe.ElementType.TAPNARC); | ||
897 | 2727 | } | ||
898 | 2728 | }; | ||
899 | 2729 | private final GuiAction transportArcAction = new GuiAction("Transport arc", "Add a transport arc (R)", "R", true) { | ||
900 | 2730 | public void actionPerformed(ActionEvent e) { | ||
901 | 2731 | setMode(Pipe.ElementType.TRANSPORTARC); | ||
902 | 2732 | } | ||
903 | 2733 | }; | ||
904 | 2734 | private final GuiAction timeAction = new GuiAction("Delay one time unit", "Let time pass one time unit", "W") { | ||
905 | 2735 | public void actionPerformed(ActionEvent e) { | ||
906 | 2736 | timeDelay(); | ||
907 | 2737 | } | ||
908 | 2738 | }; | ||
909 | 2739 | private final GuiAction delayFireAction = new GuiAction("Delay and fire", "Delay and fire selected transition", "F") { | ||
910 | 2740 | public void actionPerformed(ActionEvent e) { | ||
911 | 2741 | delayAndFire(); | ||
912 | 2742 | } | ||
913 | 2743 | }; | ||
914 | 2744 | |||
915 | 2745 | public void updateMode() { | ||
916 | 2746 | // deselect other actions | ||
917 | 2747 | selectAction.setSelected(CreateGui.guiMode == Pipe.ElementType.SELECT); | ||
918 | 2748 | transAction.setSelected(editorMode == Pipe.ElementType.TAPNTRANS); | ||
919 | 2749 | timedPlaceAction.setSelected(editorMode == Pipe.ElementType.TAPNPLACE); | ||
920 | 2750 | timedArcAction.setSelected(editorMode == Pipe.ElementType.TAPNARC); | ||
921 | 2751 | transportArcAction.setSelected(editorMode == Pipe.ElementType.TRANSPORTARC); | ||
922 | 2752 | inhibarcAction.setSelected(editorMode == Pipe.ElementType.TAPNINHIBITOR_ARC); | ||
923 | 2753 | tokenAction.setSelected(editorMode == Pipe.ElementType.ADDTOKEN); | ||
924 | 2754 | deleteTokenAction.setSelected(editorMode == Pipe.ElementType.DELTOKEN); | ||
925 | 2755 | annotationAction.setSelected(editorMode == Pipe.ElementType.ANNOTATION); | ||
926 | 2756 | } | ||
927 | 2757 | @Override | ||
928 | 2758 | public void updateEnabledActions(GuiFrame.GUIMode mode){ | ||
929 | 2759 | switch(mode){ | ||
930 | 2760 | case draw: | ||
931 | 2761 | selectAction.setEnabled(true); | ||
932 | 2762 | transAction.setEnabled(true); | ||
933 | 2763 | timedPlaceAction.setEnabled(true); | ||
934 | 2764 | timedArcAction.setEnabled(true); | ||
935 | 2765 | transportArcAction.setEnabled(true); | ||
936 | 2766 | inhibarcAction.setEnabled(true); | ||
937 | 2767 | tokenAction.setEnabled(true); | ||
938 | 2768 | deleteTokenAction.setEnabled(true); | ||
939 | 2769 | annotationAction.setEnabled(true); | ||
940 | 2770 | delayFireAction.setEnabled(false); | ||
941 | 2771 | timeAction.setEnabled(false); | ||
942 | 2772 | break; | ||
943 | 2773 | case noNet: | ||
944 | 2774 | selectAction.setEnabled(false); | ||
945 | 2775 | transAction.setEnabled(false); | ||
946 | 2776 | timedPlaceAction.setEnabled(false); | ||
947 | 2777 | timedArcAction.setEnabled(false); | ||
948 | 2778 | transportArcAction.setEnabled(false); | ||
949 | 2779 | inhibarcAction.setEnabled(false); | ||
950 | 2780 | tokenAction.setEnabled(false); | ||
951 | 2781 | deleteTokenAction.setEnabled(false); | ||
952 | 2782 | annotationAction.setEnabled(false); | ||
953 | 2783 | delayFireAction.setEnabled(false); | ||
954 | 2784 | timeAction.setEnabled(false); | ||
955 | 2785 | case animation: | ||
956 | 2786 | selectAction.setEnabled(false); | ||
957 | 2787 | transAction.setEnabled(false); | ||
958 | 2788 | timedPlaceAction.setEnabled(false); | ||
959 | 2789 | timedArcAction.setEnabled(false); | ||
960 | 2790 | transportArcAction.setEnabled(false); | ||
961 | 2791 | inhibarcAction.setEnabled(false); | ||
962 | 2792 | tokenAction.setEnabled(false); | ||
963 | 2793 | deleteTokenAction.setEnabled(false); | ||
964 | 2794 | annotationAction.setEnabled(false); | ||
965 | 2795 | delayFireAction.setEnabled(true); | ||
966 | 2796 | if(lens.isTimed()) | ||
967 | 2797 | timeAction.setEnabled(true); | ||
968 | 2798 | break; | ||
969 | 2799 | } | ||
970 | 2800 | } | ||
971 | 2801 | |||
972 | 2802 | |||
973 | 2803 | public static final String textforDrawing = "Drawing Mode: Click on a button to start adding components to the Editor"; | ||
974 | 2804 | public static final String textforPlace = "Place Mode: Right click on a place to see menu options "; | ||
975 | 2805 | public static final String textforTAPNPlace = "Place Mode: Right click on a place to see menu options "; | ||
976 | 2806 | public static final String textforTrans = "Transition Mode: Right click on a transition to see menu options [Mouse wheel -> rotate]"; | ||
977 | 2807 | public static final String textforTimedTrans = "Timed Transition Mode: Right click on a transition to see menu options [Mouse wheel -> rotate]"; | ||
978 | 2808 | public static final String textforAddtoken = "Add Token Mode: Click on a place to add a token"; | ||
979 | 2809 | public static final String textforDeltoken = "Delete Token Mode: Click on a place to delete a token "; | ||
980 | 2810 | public static final String textforAnimation = "Simulation Mode: Red transitions are enabled, click a transition to fire it"; | ||
981 | 2811 | public static final String textforArc = "Arc Mode: Right click on an arc to see menu options "; | ||
982 | 2812 | public static final String textforTransportArc = "Transport Arc Mode: Right click on an arc to see menu options "; | ||
983 | 2813 | public static final String textforInhibArc = "Inhibitor Mode: Right click on an arc to see menu options "; | ||
984 | 2814 | public static final String textforMove = "Select Mode: Click/drag to select objects; drag to move them"; | ||
985 | 2815 | public static final String textforAnnotation = "Annotation Mode: Right click on an annotation to see menu options; double click to edit"; | ||
986 | 2816 | public static final String textforDrag = "Drag Mode"; | ||
987 | 2817 | |||
988 | 2818 | public void changeStatusbarText(Pipe.ElementType type) { | ||
989 | 2819 | switch (type) { | ||
990 | 2820 | case PLACE: | ||
991 | 2821 | app.ifPresent(o13 -> o13.setStatusBarText(textforPlace)); | ||
992 | 2822 | break; | ||
993 | 2823 | |||
994 | 2824 | case TAPNPLACE: | ||
995 | 2825 | app.ifPresent(o12 -> o12.setStatusBarText(textforTAPNPlace)); | ||
996 | 2826 | break; | ||
997 | 2827 | |||
998 | 2828 | case IMMTRANS: | ||
999 | 2829 | case TAPNTRANS: | ||
1000 | 2830 | app.ifPresent(o11 -> o11.setStatusBarText(textforTrans)); | ||
1001 | 2831 | break; | ||
1002 | 2832 | |||
1003 | 2833 | case TIMEDTRANS: | ||
1004 | 2834 | app.ifPresent(o10 -> o10.setStatusBarText(textforTimedTrans)); | ||
1005 | 2835 | break; | ||
1006 | 2836 | |||
1007 | 2837 | case ARC: | ||
1008 | 2838 | case TAPNARC: | ||
1009 | 2839 | app.ifPresent(o9 -> o9.setStatusBarText(textforArc)); | ||
1010 | 2840 | break; | ||
1011 | 2841 | |||
1012 | 2842 | case TRANSPORTARC: | ||
1013 | 2843 | app.ifPresent(o8 -> o8.setStatusBarText(textforTransportArc)); | ||
1014 | 2844 | break; | ||
1015 | 2845 | |||
1016 | 2846 | case TAPNINHIBITOR_ARC: | ||
1017 | 2847 | case INHIBARC: | ||
1018 | 2848 | app.ifPresent(o7 -> o7.setStatusBarText(textforInhibArc)); | ||
1019 | 2849 | break; | ||
1020 | 2850 | |||
1021 | 2851 | case ADDTOKEN: | ||
1022 | 2852 | app.ifPresent(o6 -> o6.setStatusBarText(textforAddtoken)); | ||
1023 | 2853 | break; | ||
1024 | 2854 | |||
1025 | 2855 | case DELTOKEN: | ||
1026 | 2856 | app.ifPresent(o5 -> o5.setStatusBarText(textforDeltoken)); | ||
1027 | 2857 | break; | ||
1028 | 2858 | |||
1029 | 2859 | case SELECT: | ||
1030 | 2860 | app.ifPresent(o4 -> o4.setStatusBarText(textforMove)); | ||
1031 | 2861 | break; | ||
1032 | 2862 | |||
1033 | 2863 | case DRAW: | ||
1034 | 2864 | app.ifPresent(o3 -> o3.setStatusBarText(textforDrawing)); | ||
1035 | 2865 | break; | ||
1036 | 2866 | |||
1037 | 2867 | case ANNOTATION: | ||
1038 | 2868 | app.ifPresent(o2 -> o2.setStatusBarText(textforAnnotation)); | ||
1039 | 2869 | break; | ||
1040 | 2870 | |||
1041 | 2871 | case DRAG: | ||
1042 | 2872 | app.ifPresent(o1 -> o1.setStatusBarText(textforDrag)); | ||
1043 | 2873 | break; | ||
1044 | 2874 | |||
1045 | 2875 | default: | ||
1046 | 2876 | app.ifPresent(o->o.setStatusBarText("To-do (textfor" + type)); | ||
1047 | 2877 | break; | ||
1048 | 2878 | } | ||
1049 | 2879 | } | ||
1050 | 2880 | |||
1051 | 2654 | } | 2881 | } |
1052 | 2655 | 2882 | ||
1053 | === modified file 'src/dk/aau/cs/gui/TabContentActions.java' | |||
1054 | --- src/dk/aau/cs/gui/TabContentActions.java 2020-08-11 11:33:28 +0000 | |||
1055 | +++ src/dk/aau/cs/gui/TabContentActions.java 2020-08-19 11:36:17 +0000 | |||
1056 | @@ -1,5 +1,6 @@ | |||
1057 | 1 | package dk.aau.cs.gui; | 1 | package dk.aau.cs.gui; |
1058 | 2 | 2 | ||
1059 | 3 | import pipe.gui.GuiFrame; | ||
1060 | 3 | import pipe.gui.GuiFrameActions; | 4 | import pipe.gui.GuiFrameActions; |
1061 | 4 | import pipe.gui.Pipe; | 5 | import pipe.gui.Pipe; |
1062 | 5 | import pipe.gui.SafeGuiFrameActions; | 6 | import pipe.gui.SafeGuiFrameActions; |
1063 | @@ -89,7 +90,10 @@ | |||
1064 | 89 | 90 | ||
1065 | 90 | void setResizeingDefault(); | 91 | void setResizeingDefault(); |
1066 | 91 | 92 | ||
1067 | 93 | void updateEnabledActions(GuiFrame.GUIMode mode); | ||
1068 | 94 | |||
1069 | 92 | void changeTimeFeature(boolean isTime); | 95 | void changeTimeFeature(boolean isTime); |
1070 | 93 | 96 | ||
1071 | 94 | void changeGameFeature(boolean isGame); | 97 | void changeGameFeature(boolean isGame); |
1072 | 98 | |||
1073 | 95 | } | 99 | } |
1074 | 96 | 100 | ||
1075 | === modified file 'src/dk/aau/cs/gui/TabTransformer.java' | |||
1076 | --- src/dk/aau/cs/gui/TabTransformer.java 2020-08-10 09:25:25 +0000 | |||
1077 | +++ src/dk/aau/cs/gui/TabTransformer.java 2020-08-19 11:36:17 +0000 | |||
1078 | @@ -51,12 +51,15 @@ | |||
1079 | 51 | DataLayer guiModel = template.guiModel(); | 51 | DataLayer guiModel = template.guiModel(); |
1080 | 52 | Place guiSource = guiModel.getPlaceByName(arc.getSource().getName()); | 52 | Place guiSource = guiModel.getPlaceByName(arc.getSource().getName()); |
1081 | 53 | Transition guiTarget = guiModel.getTransitionByName(arc.getTarget().getName()); | 53 | Transition guiTarget = guiModel.getTransitionByName(arc.getTarget().getName()); |
1084 | 54 | TimedInputArcComponent newArc = new TimedInputArcComponent(new TimedOutputArcComponent( | 54 | TimedInputArcComponent newArc = new TimedInputArcComponent( |
1085 | 55 | guiSource, | 55 | new TimedOutputArcComponent( |
1086 | 56 | guiSource, | ||
1087 | 56 | guiTarget, | 57 | guiTarget, |
1088 | 57 | arc.getWeight().value(), | 58 | arc.getWeight().value(), |
1089 | 58 | arc.getSource().getName() + "_to_" + arc.getTarget().getName() | 59 | arc.getSource().getName() + "_to_" + arc.getTarget().getName() |
1091 | 59 | )); | 60 | ), |
1092 | 61 | tab.getLens() | ||
1093 | 62 | ); | ||
1094 | 60 | 63 | ||
1095 | 61 | // Build ArcPath | 64 | // Build ArcPath |
1096 | 62 | Place oldGuiSource = guiModel.getPlaceByName(arc.getSource().getName()); | 65 | Place oldGuiSource = guiModel.getPlaceByName(arc.getSource().getName()); |
1097 | 63 | 66 | ||
1098 | === modified file 'src/dk/aau/cs/gui/components/EnabledTransitionsList.java' | |||
1099 | --- src/dk/aau/cs/gui/components/EnabledTransitionsList.java 2020-07-20 12:17:24 +0000 | |||
1100 | +++ src/dk/aau/cs/gui/components/EnabledTransitionsList.java 2020-08-19 11:36:17 +0000 | |||
1101 | @@ -20,6 +20,7 @@ | |||
1102 | 20 | import org.jetbrains.annotations.NotNull; | 20 | import org.jetbrains.annotations.NotNull; |
1103 | 21 | import pipe.dataLayer.Template; | 21 | import pipe.dataLayer.Template; |
1104 | 22 | import pipe.gui.CreateGui; | 22 | import pipe.gui.CreateGui; |
1105 | 23 | import pipe.gui.SimulationControl; | ||
1106 | 23 | import pipe.gui.graphicElements.Transition; | 24 | import pipe.gui.graphicElements.Transition; |
1107 | 24 | import pipe.gui.graphicElements.tapn.TimedTransitionComponent; | 25 | import pipe.gui.graphicElements.tapn.TimedTransitionComponent; |
1108 | 25 | //TODO clean up!!! | 26 | //TODO clean up!!! |
1109 | @@ -63,7 +64,7 @@ | |||
1110 | 63 | } | 64 | } |
1111 | 64 | 65 | ||
1112 | 65 | public void reInitDone(){ | 66 | public void reInitDone(){ |
1114 | 66 | if(CreateGui.getCurrentTab().getDelayEnabledTransitionControl().isRandomTransitionMode()){ | 67 | if(SimulationControl.getInstance().isRandomTransitionMode()){ |
1115 | 67 | selectRandom(); | 68 | selectRandom(); |
1116 | 68 | return; | 69 | return; |
1117 | 69 | } | 70 | } |
1118 | @@ -125,7 +126,7 @@ | |||
1119 | 125 | 126 | ||
1120 | 126 | public String toString(boolean showIntervals) { | 127 | public String toString(boolean showIntervals) { |
1121 | 127 | 128 | ||
1123 | 128 | String interval = transition.getDInterval() == null || !showIntervals ? "" : transition.getDInterval().toString() + " "; | 129 | String interval = transition.getDInterval() == null || !showIntervals || !transition.isTimed() ? "" : transition.getDInterval().toString() + " "; |
1124 | 129 | 130 | ||
1125 | 130 | String transitionName = getTransition().getName(); | 131 | String transitionName = getTransition().getName(); |
1126 | 131 | if(isShared()){ | 132 | if(isShared()){ |
1127 | 132 | 133 | ||
1128 | === modified file 'src/dk/aau/cs/gui/components/TransitionFireingComponent.java' | |||
1129 | --- src/dk/aau/cs/gui/components/TransitionFireingComponent.java 2020-07-13 13:58:47 +0000 | |||
1130 | +++ src/dk/aau/cs/gui/components/TransitionFireingComponent.java 2020-08-19 11:36:17 +0000 | |||
1131 | @@ -10,6 +10,7 @@ | |||
1132 | 10 | import javax.swing.JButton; | 10 | import javax.swing.JButton; |
1133 | 11 | import javax.swing.JPanel; | 11 | import javax.swing.JPanel; |
1134 | 12 | 12 | ||
1135 | 13 | import dk.aau.cs.gui.TabContent; | ||
1136 | 13 | import pipe.dataLayer.Template; | 14 | import pipe.dataLayer.Template; |
1137 | 14 | import pipe.gui.AnimationSettingsDialog; | 15 | import pipe.gui.AnimationSettingsDialog; |
1138 | 15 | import pipe.gui.DelayEnabledTransitionControl; | 16 | import pipe.gui.DelayEnabledTransitionControl; |
1139 | @@ -22,12 +23,12 @@ | |||
1140 | 22 | private final EnabledTransitionsList enabledTransitionsList; | 23 | private final EnabledTransitionsList enabledTransitionsList; |
1141 | 23 | private final JButton fireButton; | 24 | private final JButton fireButton; |
1142 | 24 | private final JButton settingsButton; | 25 | private final JButton settingsButton; |
1143 | 26 | private final TabContent.TAPNLens lens; | ||
1144 | 25 | 27 | ||
1146 | 26 | public TransitionFireingComponent(boolean showDelayEnabledTransitions) { | 28 | public TransitionFireingComponent(boolean showDelayEnabledTransitions, TabContent.TAPNLens lens) { |
1147 | 27 | super(new GridBagLayout()); | 29 | super(new GridBagLayout()); |
1148 | 28 | |||
1149 | 29 | enabledTransitionsList = new EnabledTransitionsList(); | 30 | enabledTransitionsList = new EnabledTransitionsList(); |
1151 | 30 | 31 | this.lens = lens; | |
1152 | 31 | this.setBorder( | 32 | this.setBorder( |
1153 | 32 | BorderFactory.createCompoundBorder( | 33 | BorderFactory.createCompoundBorder( |
1154 | 33 | BorderFactory.createTitledBorder("Enabled Transitions"), | 34 | BorderFactory.createTitledBorder("Enabled Transitions"), |
1155 | @@ -44,7 +45,7 @@ | |||
1156 | 44 | 45 | ||
1157 | 45 | settingsButton = new JButton("Settings"); | 46 | settingsButton = new JButton("Settings"); |
1158 | 46 | settingsButton.setPreferredSize(new Dimension(0, settingsButton.getPreferredSize().height)); //Make the two buttons equal in size | 47 | settingsButton.setPreferredSize(new Dimension(0, settingsButton.getPreferredSize().height)); //Make the two buttons equal in size |
1160 | 47 | settingsButton.addActionListener(e -> AnimationSettingsDialog.showAnimationSettings()); | 48 | settingsButton.addActionListener(e -> AnimationSettingsDialog.showAnimationSettings(lens)); |
1161 | 48 | 49 | ||
1162 | 49 | fireButton = new JButton("Delay & Fire"); | 50 | fireButton = new JButton("Delay & Fire"); |
1163 | 50 | fireButton.setPreferredSize(new Dimension(0, fireButton.getPreferredSize().height)); //Make the two buttons equal in size | 51 | fireButton.setPreferredSize(new Dimension(0, fireButton.getPreferredSize().height)); //Make the two buttons equal in size |
1164 | @@ -125,7 +126,10 @@ | |||
1165 | 125 | fireButton.setToolTipText(SIMULATE_ACTIVATED_TOOL_TIP); | 126 | fireButton.setToolTipText(SIMULATE_ACTIVATED_TOOL_TIP); |
1166 | 126 | } | 127 | } |
1167 | 127 | } else { //If random simulation is not enabled. | 128 | } else { //If random simulation is not enabled. |
1169 | 128 | fireButton.setText(CreateGui.getApp().isShowingDelayEnabledTransitions() ? "Delay & Fire" : "Fire"); | 129 | fireButton.setText(CreateGui.getApp().isShowingDelayEnabledTransitions() ? "Delay & Fire" : "Fire"); |
1170 | 130 | if(!lens.isTimed()){ | ||
1171 | 131 | fireButton.setText("Fire"); | ||
1172 | 132 | } | ||
1173 | 129 | 133 | ||
1174 | 130 | if(enabledTransitionsList.getNumberOfTransitions() == 0){ | 134 | if(enabledTransitionsList.getNumberOfTransitions() == 0){ |
1175 | 131 | fireButton.setEnabled(false); | 135 | fireButton.setEnabled(false); |
1176 | 132 | 136 | ||
1177 | === modified file 'src/dk/aau/cs/io/LoadedModel.java' | |||
1178 | --- src/dk/aau/cs/io/LoadedModel.java 2020-08-04 08:53:19 +0000 | |||
1179 | +++ src/dk/aau/cs/io/LoadedModel.java 2020-08-19 11:36:17 +0000 | |||
1180 | @@ -3,6 +3,7 @@ | |||
1181 | 3 | import java.util.Collection; | 3 | import java.util.Collection; |
1182 | 4 | import java.util.List; | 4 | import java.util.List; |
1183 | 5 | 5 | ||
1184 | 6 | import dk.aau.cs.gui.TabContent; | ||
1185 | 6 | import dk.aau.cs.io.batchProcessing.LoadedBatchProcessingModel; | 7 | import dk.aau.cs.io.batchProcessing.LoadedBatchProcessingModel; |
1186 | 7 | import pipe.dataLayer.TAPNQuery; | 8 | import pipe.dataLayer.TAPNQuery; |
1187 | 8 | import pipe.dataLayer.Template; | 9 | import pipe.dataLayer.Template; |
1188 | @@ -13,23 +14,21 @@ | |||
1189 | 13 | private final Collection<Template> templates; | 14 | private final Collection<Template> templates; |
1190 | 14 | private final Collection<TAPNQuery> queries; | 15 | private final Collection<TAPNQuery> queries; |
1191 | 15 | private final TimedArcPetriNetNetwork network; | 16 | private final TimedArcPetriNetNetwork network; |
1192 | 16 | private final boolean isTimed; | ||
1193 | 17 | private final boolean isGame; | ||
1194 | 18 | private final Collection<String> messages; | 17 | private final Collection<String> messages; |
1198 | 19 | 18 | private final TabContent.TAPNLens lens; | |
1199 | 20 | public LoadedModel(TimedArcPetriNetNetwork network, Collection<Template> templates, Collection<TAPNQuery> queries, Collection<String> messages){ | 19 | |
1200 | 21 | this(network, templates, queries, messages, true, false); | 20 | public LoadedModel(TimedArcPetriNetNetwork network, Collection<Template> templates, Collection<TAPNQuery> queries, Collection<String> messages){ |
1201 | 21 | this(network, templates, queries, messages, TabContent.TAPNLens.Default); | ||
1202 | 22 | } | 22 | } |
1203 | 23 | public LoadedModel(TimedArcPetriNetNetwork network, Collection<Template> templates, Collection<TAPNQuery> queries){ | 23 | public LoadedModel(TimedArcPetriNetNetwork network, Collection<Template> templates, Collection<TAPNQuery> queries){ |
1205 | 24 | this(network, templates, queries, List.of(), true, false); | 24 | this(network, templates, queries, List.of(), TabContent.TAPNLens.Default); |
1206 | 25 | } | 25 | } |
1207 | 26 | 26 | ||
1209 | 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){ |
1210 | 28 | this.templates = templates; | 28 | this.templates = templates; |
1211 | 29 | this.network = network; | 29 | this.network = network; |
1212 | 30 | this.queries = queries; | 30 | this.queries = queries; |
1215 | 31 | this.isTimed = isTimed; | 31 | this.lens = lens; |
1214 | 32 | this.isGame = isGame; | ||
1216 | 33 | this.messages = messages; | 32 | this.messages = messages; |
1217 | 34 | } | 33 | } |
1218 | 35 | 34 | ||
1219 | @@ -38,12 +37,15 @@ | |||
1220 | 38 | public TimedArcPetriNetNetwork network(){ return network; } | 37 | public TimedArcPetriNetNetwork network(){ return network; } |
1221 | 39 | public Collection<String> getMessages() { return messages; } | 38 | public Collection<String> getMessages() { return messages; } |
1222 | 40 | 39 | ||
1223 | 40 | public TabContent.TAPNLens getLens(){ | ||
1224 | 41 | return lens; | ||
1225 | 42 | } | ||
1226 | 41 | 43 | ||
1227 | 42 | public boolean isTimed() { | 44 | public boolean isTimed() { |
1229 | 43 | return isTimed; | 45 | return lens.isTimed(); |
1230 | 44 | } | 46 | } |
1231 | 45 | public boolean isGame() { | 47 | public boolean isGame() { |
1233 | 46 | return isGame; | 48 | return lens.isGame(); |
1234 | 47 | } | 49 | } |
1235 | 48 | 50 | ||
1236 | 49 | } | 51 | } |
1237 | 50 | \ No newline at end of file | 52 | \ No newline at end of file |
1238 | 51 | 53 | ||
1239 | === modified file 'src/dk/aau/cs/io/PNMLoader.java' | |||
1240 | --- src/dk/aau/cs/io/PNMLoader.java 2020-07-20 09:53:59 +0000 | |||
1241 | +++ src/dk/aau/cs/io/PNMLoader.java 2020-08-19 11:36:17 +0000 | |||
1242 | @@ -15,6 +15,7 @@ | |||
1243 | 15 | import javax.xml.parsers.DocumentBuilderFactory; | 15 | import javax.xml.parsers.DocumentBuilderFactory; |
1244 | 16 | import javax.xml.parsers.ParserConfigurationException; | 16 | import javax.xml.parsers.ParserConfigurationException; |
1245 | 17 | 17 | ||
1246 | 18 | import dk.aau.cs.gui.TabContent; | ||
1247 | 18 | import org.w3c.dom.Document; | 19 | import org.w3c.dom.Document; |
1248 | 19 | import org.w3c.dom.Element; | 20 | import org.w3c.dom.Element; |
1249 | 20 | import org.w3c.dom.Node; | 21 | import org.w3c.dom.Node; |
1250 | @@ -51,8 +52,10 @@ | |||
1251 | 51 | import pipe.gui.graphicElements.tapn.TimedTransitionComponent; | 52 | import pipe.gui.graphicElements.tapn.TimedTransitionComponent; |
1252 | 52 | 53 | ||
1253 | 53 | public class PNMLoader { | 54 | public class PNMLoader { |
1256 | 54 | 55 | ||
1257 | 55 | enum GraphicsType { Position, Offset } | 56 | private final TabContent.TAPNLens lens = new TabContent.TAPNLens(false, false); |
1258 | 57 | |||
1259 | 58 | enum GraphicsType { Position, Offset } | ||
1260 | 56 | 59 | ||
1261 | 57 | private final NameGenerator nameGenerator = new NameGenerator(); | 60 | private final NameGenerator nameGenerator = new NameGenerator(); |
1262 | 58 | private final IdResolver idResolver = new IdResolver(); | 61 | private final IdResolver idResolver = new IdResolver(); |
1263 | @@ -192,7 +195,7 @@ | |||
1264 | 192 | 195 | ||
1265 | 193 | if(isNetDrawable()){ | 196 | if(isNetDrawable()){ |
1266 | 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 |
1268 | 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); |
1269 | 196 | placeComponent.setUnderlyingPlace(place); | 199 | placeComponent.setUnderlyingPlace(place); |
1270 | 197 | template.guiModel().addPetriNetObject(placeComponent); | 200 | template.guiModel().addPetriNetObject(placeComponent); |
1271 | 198 | } | 201 | } |
1272 | @@ -236,8 +239,7 @@ | |||
1273 | 236 | if(isNetDrawable()){ | 239 | if(isNetDrawable()){ |
1274 | 237 | TimedTransitionComponent transitionComponent = | 240 | TimedTransitionComponent transitionComponent = |
1275 | 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 |
1278 | 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); |
1277 | 240 | true, false, 0, 0); | ||
1279 | 241 | transitionComponent.setUnderlyingTransition(transition); | 243 | transitionComponent.setUnderlyingTransition(transition); |
1280 | 242 | template.guiModel().addPetriNetObject(transitionComponent); | 244 | template.guiModel().addPetriNetObject(transitionComponent); |
1281 | 243 | } | 245 | } |
1282 | @@ -423,7 +425,7 @@ | |||
1283 | 423 | TimedInputArcComponent arc = null; | 425 | TimedInputArcComponent arc = null; |
1284 | 424 | 426 | ||
1285 | 425 | if(isNetDrawable()){ | 427 | if(isNetDrawable()){ |
1287 | 426 | arc = new TimedInputArcComponent(new TimedOutputArcComponent(source, target, weight, arcId)); | 428 | arc = new TimedInputArcComponent(new TimedOutputArcComponent(source, target, weight, arcId), lens); |
1288 | 427 | arc.setUnderlyingArc(inputArc); | 429 | arc.setUnderlyingArc(inputArc); |
1289 | 428 | 430 | ||
1290 | 429 | template.guiModel().addPetriNetObject(arc); | 431 | template.guiModel().addPetriNetObject(arc); |
1291 | 430 | 432 | ||
1292 | === modified file 'src/dk/aau/cs/io/TapnLegacyXmlLoader.java' | |||
1293 | --- src/dk/aau/cs/io/TapnLegacyXmlLoader.java 2020-08-04 08:53:19 +0000 | |||
1294 | +++ src/dk/aau/cs/io/TapnLegacyXmlLoader.java 2020-08-19 11:36:17 +0000 | |||
1295 | @@ -13,6 +13,7 @@ | |||
1296 | 13 | import javax.xml.parsers.DocumentBuilderFactory; | 13 | import javax.xml.parsers.DocumentBuilderFactory; |
1297 | 14 | import javax.xml.parsers.ParserConfigurationException; | 14 | import javax.xml.parsers.ParserConfigurationException; |
1298 | 15 | 15 | ||
1299 | 16 | import dk.aau.cs.gui.TabContent; | ||
1300 | 16 | import org.w3c.dom.Document; | 17 | import org.w3c.dom.Document; |
1301 | 17 | import org.w3c.dom.Element; | 18 | import org.w3c.dom.Element; |
1302 | 18 | import org.w3c.dom.Node; | 19 | import org.w3c.dom.Node; |
1303 | @@ -83,9 +84,10 @@ | |||
1304 | 83 | private final IdResolver idResolver = new IdResolver(); | 84 | private final IdResolver idResolver = new IdResolver(); |
1305 | 84 | 85 | ||
1306 | 85 | private final Collection<String> messages = new ArrayList<>(10); | 86 | private final Collection<String> messages = new ArrayList<>(10); |
1310 | 86 | 87 | private final TabContent.TAPNLens lens = new TabContent.TAPNLens(true, false); | |
1311 | 87 | 88 | ||
1312 | 88 | public TapnLegacyXmlLoader() {} | 89 | |
1313 | 90 | public TapnLegacyXmlLoader() {} | ||
1314 | 89 | 91 | ||
1315 | 90 | public LoadedModel load(InputStream file) throws FormatException { | 92 | public LoadedModel load(InputStream file) throws FormatException { |
1316 | 91 | Require.that(file != null, "file must be non-null and exist"); | 93 | Require.that(file != null, "file must be non-null and exist"); |
1317 | @@ -278,7 +280,7 @@ | |||
1318 | 278 | PlaceTransitionObject targetIn, | 280 | PlaceTransitionObject targetIn, |
1319 | 279 | int _endx, int _endy) throws FormatException { | 281 | int _endx, int _endy) throws FormatException { |
1320 | 280 | 282 | ||
1322 | 281 | TimedInputArcComponent tempArc = new TimedInputArcComponent(new TimedOutputArcComponent(sourceIn, targetIn, 1, idInput)); | 283 | TimedInputArcComponent tempArc = new TimedInputArcComponent(new TimedOutputArcComponent(sourceIn, targetIn, 1, idInput), lens); |
1323 | 282 | 284 | ||
1324 | 283 | TimedPlace place = tapn.getPlaceByName(sourceIn.getName()); | 285 | TimedPlace place = tapn.getPlaceByName(sourceIn.getName()); |
1325 | 284 | TimedTransition transition = tapn.getTransitionByName(targetIn.getName()); | 286 | TimedTransition transition = tapn.getTransitionByName(targetIn.getName()); |
1326 | @@ -523,7 +525,7 @@ | |||
1327 | 523 | TimedTransitionComponent transition = new TimedTransitionComponent( | 525 | TimedTransitionComponent transition = new TimedTransitionComponent( |
1328 | 524 | positionXInput, positionYInput, idInput, | 526 | positionXInput, positionYInput, idInput, |
1329 | 525 | nameOffsetXInput, nameOffsetYInput, timedTransition, | 527 | nameOffsetXInput, nameOffsetYInput, timedTransition, |
1331 | 526 | infiniteServer, angle, priority); | 528 | infiniteServer, angle, priority, lens); |
1332 | 527 | transition.setUnderlyingTransition(t); | 529 | transition.setUnderlyingTransition(t); |
1333 | 528 | guiModel.addPetriNetObject(transition); | 530 | guiModel.addPetriNetObject(transition); |
1334 | 529 | tapn.add(t); | 531 | tapn.add(t); |
1335 | @@ -556,7 +558,7 @@ | |||
1336 | 556 | } | 558 | } |
1337 | 557 | idResolver.add(tapn.name(), idInput, nameInput); | 559 | idResolver.add(tapn.name(), idInput, nameInput); |
1338 | 558 | 560 | ||
1340 | 559 | TimedPlaceComponent place = new TimedPlaceComponent(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput); | 561 | TimedPlaceComponent place = new TimedPlaceComponent(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput, lens); |
1341 | 560 | 562 | ||
1342 | 561 | LocalTimedPlace p = new LocalTimedPlace(nameInput, TimeInvariant.parse(invariant, constants)); | 563 | LocalTimedPlace p = new LocalTimedPlace(nameInput, TimeInvariant.parse(invariant, constants)); |
1343 | 562 | tapn.add(p); | 564 | tapn.add(p); |
1344 | @@ -615,9 +617,7 @@ | |||
1345 | 615 | 617 | ||
1346 | 616 | } else { | 618 | } else { |
1347 | 617 | if (type.equals("timed")) { | 619 | if (type.equals("timed")) { |
1351 | 618 | tempArc = parseAndAddTimedInputArc(idInput, taggedArc, | 620 | tempArc = parseAndAddTimedInputArc(idInput, taggedArc, inscriptionTempStorage, sourceIn, targetIn, aEndx, aEndy); |
1349 | 619 | inscriptionTempStorage, sourceIn, targetIn, | ||
1350 | 620 | aEndx, aEndy); | ||
1352 | 621 | 621 | ||
1353 | 622 | } else if (type.equals("transport")) { | 622 | } else if (type.equals("transport")) { |
1354 | 623 | tempArc = parseAndAddTransportArc(idInput, taggedArc, | 623 | tempArc = parseAndAddTransportArc(idInput, taggedArc, |
1355 | 624 | 624 | ||
1356 | === modified file 'src/dk/aau/cs/io/TapnXmlLoader.java' | |||
1357 | --- src/dk/aau/cs/io/TapnXmlLoader.java 2020-08-10 06:46:22 +0000 | |||
1358 | +++ src/dk/aau/cs/io/TapnXmlLoader.java 2020-08-19 11:36:17 +0000 | |||
1359 | @@ -14,6 +14,7 @@ | |||
1360 | 14 | import javax.xml.parsers.ParserConfigurationException; | 14 | import javax.xml.parsers.ParserConfigurationException; |
1361 | 15 | 15 | ||
1362 | 16 | import dk.aau.cs.debug.Logger; | 16 | import dk.aau.cs.debug.Logger; |
1363 | 17 | import dk.aau.cs.gui.TabContent; | ||
1364 | 17 | import org.w3c.dom.Document; | 18 | import org.w3c.dom.Document; |
1365 | 18 | import org.w3c.dom.Element; | 19 | import org.w3c.dom.Element; |
1366 | 19 | import org.w3c.dom.Node; | 20 | import org.w3c.dom.Node; |
1367 | @@ -26,10 +27,7 @@ | |||
1368 | 26 | import pipe.gui.CreateGui; | 27 | import pipe.gui.CreateGui; |
1369 | 27 | import pipe.gui.Pipe; | 28 | import pipe.gui.Pipe; |
1370 | 28 | import pipe.gui.Zoomer; | 29 | import pipe.gui.Zoomer; |
1375 | 29 | import pipe.gui.graphicElements.AnnotationNote; | 30 | import pipe.gui.graphicElements.*; |
1372 | 30 | import pipe.gui.graphicElements.Arc; | ||
1373 | 31 | import pipe.gui.graphicElements.Place; | ||
1374 | 32 | import pipe.gui.graphicElements.PlaceTransitionObject; | ||
1376 | 33 | import pipe.gui.graphicElements.tapn.TimedInhibitorArcComponent; | 31 | import pipe.gui.graphicElements.tapn.TimedInhibitorArcComponent; |
1377 | 34 | import pipe.gui.graphicElements.tapn.TimedInputArcComponent; | 32 | import pipe.gui.graphicElements.tapn.TimedInputArcComponent; |
1378 | 35 | import pipe.gui.graphicElements.tapn.TimedOutputArcComponent; | 33 | import pipe.gui.graphicElements.tapn.TimedOutputArcComponent; |
1379 | @@ -73,9 +71,7 @@ | |||
1380 | 73 | private final IdResolver idResolver = new IdResolver(); | 71 | private final IdResolver idResolver = new IdResolver(); |
1381 | 74 | private final Collection<String> messages = new ArrayList<>(10); | 72 | private final Collection<String> messages = new ArrayList<>(10); |
1382 | 75 | 73 | ||
1386 | 76 | private boolean isTimed; | 74 | private TabContent.TAPNLens lens; |
1384 | 77 | private boolean isGame; | ||
1385 | 78 | private boolean isUncontrollable = false; | ||
1387 | 79 | 75 | ||
1388 | 80 | public TapnXmlLoader() { | 76 | public TapnXmlLoader() { |
1389 | 81 | 77 | ||
1390 | @@ -118,6 +114,8 @@ | |||
1391 | 118 | 114 | ||
1392 | 119 | private LoadedModel parse(Document doc) throws FormatException { | 115 | private LoadedModel parse(Document doc) throws FormatException { |
1393 | 120 | idResolver.clear(); | 116 | idResolver.clear(); |
1394 | 117 | |||
1395 | 118 | parseFeature(doc); | ||
1396 | 121 | 119 | ||
1397 | 122 | ConstantStore constants = new ConstantStore(parseConstants(doc)); | 120 | ConstantStore constants = new ConstantStore(parseConstants(doc)); |
1398 | 123 | 121 | ||
1399 | @@ -133,9 +131,9 @@ | |||
1400 | 133 | 131 | ||
1401 | 134 | parseBound(doc, network); | 132 | parseBound(doc, network); |
1402 | 135 | 133 | ||
1406 | 136 | parseFeature(doc, network); | 134 | |
1407 | 137 | 135 | ||
1408 | 138 | return new LoadedModel(network, templates, queries,messages, isTimed, isGame); | 136 | return new LoadedModel(network, templates, queries,messages, lens); |
1409 | 139 | } | 137 | } |
1410 | 140 | 138 | ||
1411 | 141 | private void parseBound(Document doc, TimedArcPetriNetNetwork network){ | 139 | private void parseBound(Document doc, TimedArcPetriNetNetwork network){ |
1412 | @@ -145,27 +143,16 @@ | |||
1413 | 145 | } | 143 | } |
1414 | 146 | } | 144 | } |
1415 | 147 | 145 | ||
1419 | 148 | private void parseFeature(Document doc, TimedArcPetriNetNetwork network) { | 146 | private void parseFeature(Document doc) { |
1417 | 149 | boolean networkIsTimed = !network.isUntimed(); | ||
1418 | 150 | |||
1420 | 151 | if (doc.getElementsByTagName("feature").getLength() > 0) { | 147 | if (doc.getElementsByTagName("feature").getLength() > 0) { |
1421 | 152 | NodeList nodeList = doc.getElementsByTagName("feature"); | 148 | NodeList nodeList = doc.getElementsByTagName("feature"); |
1422 | 153 | 149 | ||
1435 | 154 | isTimed = Boolean.parseBoolean(nodeList.item(0).getAttributes().getNamedItem("isTimed").getNodeValue()); | 150 | var isTimed = Boolean.parseBoolean(nodeList.item(0).getAttributes().getNamedItem("isTimed").getNodeValue()); |
1436 | 155 | isGame = Boolean.parseBoolean(nodeList.item(0).getAttributes().getNamedItem("isGame").getNodeValue()); | 151 | var isGame = Boolean.parseBoolean(nodeList.item(0).getAttributes().getNamedItem("isGame").getNodeValue()); |
1437 | 156 | 152 | ||
1438 | 157 | if (networkIsTimed && !isTimed) { | 153 | lens = new TabContent.TAPNLens(isTimed, isGame); |
1427 | 158 | isTimed = true; | ||
1428 | 159 | Logger.log("The net contains time features. The entire net will be changed to include time features."); | ||
1429 | 160 | } | ||
1430 | 161 | if (isUncontrollable && !isGame) { | ||
1431 | 162 | isGame = true; | ||
1432 | 163 | Logger.log("The net contains game features. The entire net will be changed to include game features."); | ||
1433 | 164 | |||
1434 | 165 | } | ||
1439 | 166 | } else { | 154 | } else { |
1442 | 167 | isTimed = networkIsTimed; | 155 | lens = new TabContent.TAPNLens(true, false); |
1441 | 168 | isGame = isUncontrollable; | ||
1443 | 169 | } | 156 | } |
1444 | 170 | } | 157 | } |
1445 | 171 | 158 | ||
1446 | @@ -380,9 +367,6 @@ | |||
1447 | 380 | boolean isUrgent = Boolean.parseBoolean(transition.getAttribute("urgent")); | 367 | boolean isUrgent = Boolean.parseBoolean(transition.getAttribute("urgent")); |
1448 | 381 | 368 | ||
1449 | 382 | String player = transition.getAttribute("player"); | 369 | String player = transition.getAttribute("player"); |
1450 | 383 | if (player.length() > 0 && player.equals("1")) { | ||
1451 | 384 | isUncontrollable = true; | ||
1452 | 385 | } | ||
1453 | 386 | 370 | ||
1454 | 387 | idResolver.add(tapn.name(), idInput, nameInput); | 371 | idResolver.add(tapn.name(), idInput, nameInput); |
1455 | 388 | 372 | ||
1456 | @@ -417,7 +401,7 @@ | |||
1457 | 417 | TimedTransitionComponent transitionComponent = new TimedTransitionComponent( | 401 | TimedTransitionComponent transitionComponent = new TimedTransitionComponent( |
1458 | 418 | positionXInput, positionYInput, idInput, | 402 | positionXInput, positionYInput, idInput, |
1459 | 419 | nameOffsetXInput, nameOffsetYInput, true, | 403 | nameOffsetXInput, nameOffsetYInput, true, |
1461 | 420 | infiniteServer, angle, priority); | 404 | infiniteServer, angle, priority, lens); |
1462 | 421 | transitionComponent.setUnderlyingTransition(t); | 405 | transitionComponent.setUnderlyingTransition(t); |
1463 | 422 | 406 | ||
1464 | 423 | if (!displayName){ | 407 | if (!displayName){ |
1465 | @@ -468,7 +452,7 @@ | |||
1466 | 468 | } | 452 | } |
1467 | 469 | } | 453 | } |
1468 | 470 | nameGenerator.updateIndicesForAllModels(nameInput); | 454 | nameGenerator.updateIndicesForAllModels(nameInput); |
1470 | 471 | TimedPlaceComponent placeComponent = new TimedPlaceComponent(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput); | 455 | TimedPlaceComponent placeComponent = new TimedPlaceComponent(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput, lens); |
1471 | 472 | placeComponent.setUnderlyingPlace(p); | 456 | placeComponent.setUnderlyingPlace(p); |
1472 | 473 | 457 | ||
1473 | 474 | if (!displayName){ | 458 | if (!displayName){ |
1474 | @@ -646,7 +630,8 @@ | |||
1475 | 646 | String inscriptionTempStorage, PlaceTransitionObject sourceIn, | 630 | String inscriptionTempStorage, PlaceTransitionObject sourceIn, |
1476 | 647 | PlaceTransitionObject targetIn, | 631 | PlaceTransitionObject targetIn, |
1477 | 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 { |
1479 | 649 | TimedInputArcComponent tempArc = new TimedInputArcComponent(new TimedOutputArcComponent(sourceIn, targetIn, 1, idInput)); | 633 | |
1480 | 634 | TimedInputArcComponent tempArc = new TimedInputArcComponent(new TimedOutputArcComponent(sourceIn, targetIn, 1, idInput), lens); | ||
1481 | 650 | 635 | ||
1482 | 651 | TimedPlace place = template.model().getPlaceByName(sourceIn.getName()); | 636 | TimedPlace place = template.model().getPlaceByName(sourceIn.getName()); |
1483 | 652 | TimedTransition transition = template.model().getTransitionByName(targetIn.getName()); | 637 | TimedTransition transition = template.model().getTransitionByName(targetIn.getName()); |
1484 | 653 | 638 | ||
1485 | === modified file 'src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java' | |||
1486 | --- src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java 2020-08-10 06:46:22 +0000 | |||
1487 | +++ src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java 2020-08-19 11:36:17 +0000 | |||
1488 | @@ -17,6 +17,7 @@ | |||
1489 | 17 | import javax.xml.transform.dom.DOMSource; | 17 | import javax.xml.transform.dom.DOMSource; |
1490 | 18 | import javax.xml.transform.stream.StreamResult; | 18 | import javax.xml.transform.stream.StreamResult; |
1491 | 19 | 19 | ||
1492 | 20 | import dk.aau.cs.gui.TabContent; | ||
1493 | 20 | import org.w3c.dom.Attr; | 21 | import org.w3c.dom.Attr; |
1494 | 21 | import org.w3c.dom.DOMException; | 22 | import org.w3c.dom.DOMException; |
1495 | 22 | import org.w3c.dom.Document; | 23 | import org.w3c.dom.Document; |
1496 | @@ -55,18 +56,19 @@ | |||
1497 | 55 | private final Iterable<TAPNQuery> queries; | 56 | private final Iterable<TAPNQuery> queries; |
1498 | 56 | private final Iterable<Constant> constants; | 57 | private final Iterable<Constant> constants; |
1499 | 57 | private final TimedArcPetriNetNetwork network; | 58 | private final TimedArcPetriNetNetwork network; |
1502 | 58 | private boolean isTimed; | 59 | private final TabContent.TAPNLens lens; |
1501 | 59 | private boolean isGame; | ||
1503 | 60 | 60 | ||
1504 | 61 | public TimedArcPetriNetNetworkWriter( | 61 | public TimedArcPetriNetNetworkWriter( |
1505 | 62 | TimedArcPetriNetNetwork network, | 62 | TimedArcPetriNetNetwork network, |
1506 | 63 | Iterable<Template> templates, | 63 | Iterable<Template> templates, |
1507 | 64 | Iterable<TAPNQuery> queries, | 64 | Iterable<TAPNQuery> queries, |
1509 | 65 | Iterable<Constant> constants) { | 65 | Iterable<Constant> constants |
1510 | 66 | ) { | ||
1511 | 66 | this.network = network; | 67 | this.network = network; |
1512 | 67 | this.templates = templates; | 68 | this.templates = templates; |
1513 | 68 | this.queries = queries; | 69 | this.queries = queries; |
1514 | 69 | this.constants = constants; | 70 | this.constants = constants; |
1515 | 71 | this.lens = TabContent.TAPNLens.Default; | ||
1516 | 70 | } | 72 | } |
1517 | 71 | 73 | ||
1518 | 72 | public TimedArcPetriNetNetworkWriter( | 74 | public TimedArcPetriNetNetworkWriter( |
1519 | @@ -74,14 +76,13 @@ | |||
1520 | 74 | Iterable<Template> templates, | 76 | Iterable<Template> templates, |
1521 | 75 | Iterable<TAPNQuery> queries, | 77 | Iterable<TAPNQuery> queries, |
1522 | 76 | Iterable<Constant> constants, | 78 | Iterable<Constant> constants, |
1525 | 77 | boolean isTimed, | 79 | TabContent.TAPNLens lens |
1526 | 78 | boolean isGame) { | 80 | ) { |
1527 | 79 | this.network = network; | 81 | this.network = network; |
1528 | 80 | this.templates = templates; | 82 | this.templates = templates; |
1529 | 81 | this.queries = queries; | 83 | this.queries = queries; |
1530 | 82 | this.constants = constants; | 84 | this.constants = constants; |
1533 | 83 | this.isTimed = isTimed; | 85 | this.lens = lens; |
1532 | 84 | this.isGame = isGame; | ||
1534 | 85 | } | 86 | } |
1535 | 86 | 87 | ||
1536 | 87 | public ByteArrayOutputStream savePNML() throws IOException, ParserConfigurationException, DOMException, TransformerConfigurationException, TransformerException { | 88 | public ByteArrayOutputStream savePNML() throws IOException, ParserConfigurationException, DOMException, TransformerConfigurationException, TransformerException { |
1537 | @@ -161,10 +162,10 @@ | |||
1538 | 161 | private void appendFeature(Document document, Element root) { | 162 | private void appendFeature(Document document, Element root) { |
1539 | 162 | String isTimed = "true"; | 163 | String isTimed = "true"; |
1540 | 163 | String isGame = "true"; | 164 | String isGame = "true"; |
1542 | 164 | if (!this.isTimed) { | 165 | if (!lens.isTimed()) { |
1543 | 165 | isTimed = "false"; | 166 | isTimed = "false"; |
1544 | 166 | } | 167 | } |
1546 | 167 | if (!this.isGame) { | 168 | if (!lens.isGame()) { |
1547 | 168 | isGame = "false"; | 169 | isGame = "false"; |
1548 | 169 | } | 170 | } |
1549 | 170 | 171 | ||
1550 | 171 | 172 | ||
1551 | === modified file 'src/dk/aau/cs/verification/TAPNComposer.java' | |||
1552 | --- src/dk/aau/cs/verification/TAPNComposer.java 2020-08-10 06:46:22 +0000 | |||
1553 | +++ src/dk/aau/cs/verification/TAPNComposer.java 2020-08-19 11:36:17 +0000 | |||
1554 | @@ -4,6 +4,7 @@ | |||
1555 | 4 | import java.util.HashSet; | 4 | import java.util.HashSet; |
1556 | 5 | import java.util.Map.Entry; | 5 | import java.util.Map.Entry; |
1557 | 6 | 6 | ||
1558 | 7 | import dk.aau.cs.gui.TabContent; | ||
1559 | 7 | import pipe.dataLayer.DataLayer; | 8 | import pipe.dataLayer.DataLayer; |
1560 | 8 | import pipe.gui.ExportBatchDialog; | 9 | import pipe.gui.ExportBatchDialog; |
1561 | 9 | import pipe.gui.graphicElements.Arc; | 10 | import pipe.gui.graphicElements.Arc; |
1562 | @@ -45,8 +46,9 @@ | |||
1563 | 45 | private HashSet<String> processedSharedObjects; | 46 | private HashSet<String> processedSharedObjects; |
1564 | 46 | private HashMap<TimedArcPetriNet, DataLayer> guiModels; | 47 | private HashMap<TimedArcPetriNet, DataLayer> guiModels; |
1565 | 47 | private DataLayer composedGuiModel; | 48 | private DataLayer composedGuiModel; |
1566 | 49 | private final TabContent.TAPNLens lens = TabContent.TAPNLens.Default; | ||
1567 | 48 | 50 | ||
1569 | 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){ |
1570 | 50 | this.messenger = messenger; | 52 | this.messenger = messenger; |
1571 | 51 | 53 | ||
1572 | 52 | HashMap<TimedArcPetriNet, DataLayer> newGuiModels = new HashMap<TimedArcPetriNet, DataLayer>(); | 54 | HashMap<TimedArcPetriNet, DataLayer> newGuiModels = new HashMap<TimedArcPetriNet, DataLayer>(); |
1573 | @@ -185,8 +187,9 @@ | |||
1574 | 185 | oldPlace.getPositionY(), | 187 | oldPlace.getPositionY(), |
1575 | 186 | oldPlace.getId(), | 188 | oldPlace.getId(), |
1576 | 187 | oldPlace.getNameOffsetX(), | 189 | oldPlace.getNameOffsetX(), |
1579 | 188 | oldPlace.getNameOffsetY() | 190 | oldPlace.getNameOffsetY(), |
1580 | 189 | ); | 191 | lens |
1581 | 192 | ); | ||
1582 | 190 | newPlace.setUnderlyingPlace(constructedPlace); | 193 | newPlace.setUnderlyingPlace(constructedPlace); |
1583 | 191 | newPlace.setName(uniquePlaceName); | 194 | newPlace.setName(uniquePlaceName); |
1584 | 192 | guiModel.addPetriNetObject(newPlace); | 195 | guiModel.addPetriNetObject(newPlace); |
1585 | @@ -227,13 +230,14 @@ | |||
1586 | 227 | // Gui work | 230 | // Gui work |
1587 | 228 | if (this.guiModels != null) { | 231 | if (this.guiModels != null) { |
1588 | 229 | Place oldPlace = currentGuiModel.getPlaceByName(timedPlace.name()); | 232 | Place oldPlace = currentGuiModel.getPlaceByName(timedPlace.name()); |
1596 | 230 | TimedPlaceComponent newPlace = new TimedPlaceComponent( | 233 | TimedPlaceComponent newPlace = new TimedPlaceComponent( |
1597 | 231 | oldPlace.getPositionX() + offset.value1() * greatestWidth, | 234 | oldPlace.getPositionX() + offset.value1() * greatestWidth, |
1598 | 232 | oldPlace.getPositionY() + offset.value2() * greatestHeight, | 235 | oldPlace.getPositionY() + offset.value2() * greatestHeight, |
1599 | 233 | oldPlace.getId(), | 236 | oldPlace.getId(), |
1600 | 234 | oldPlace.getNameOffsetX(), | 237 | oldPlace.getNameOffsetX(), |
1601 | 235 | oldPlace.getNameOffsetY() | 238 | oldPlace.getNameOffsetY(), |
1602 | 236 | ); | 239 | lens |
1603 | 240 | ); | ||
1604 | 237 | newPlace.setGuiModel(guiModel); | 241 | newPlace.setGuiModel(guiModel); |
1605 | 238 | 242 | ||
1606 | 239 | newPlace.setUnderlyingPlace(place); | 243 | newPlace.setUnderlyingPlace(place); |
1607 | @@ -284,15 +288,17 @@ | |||
1608 | 284 | if (this.guiModels != null) { | 288 | if (this.guiModels != null) { |
1609 | 285 | Transition oldTransition = currentGuiModel.getTransitionByName(timedTransition.name()); | 289 | Transition oldTransition = currentGuiModel.getTransitionByName(timedTransition.name()); |
1610 | 286 | TimedTransitionComponent newTransition = new TimedTransitionComponent( | 290 | TimedTransitionComponent newTransition = new TimedTransitionComponent( |
1620 | 287 | oldTransition.getPositionX() + offset.value1() * greatestWidth, | 291 | oldTransition.getPositionX() + offset.value1() * greatestWidth, |
1621 | 288 | oldTransition.getPositionY() + offset.value2() * greatestHeight, | 292 | oldTransition.getPositionY() + offset.value2() * greatestHeight, |
1622 | 289 | oldTransition.getId(), | 293 | oldTransition.getId(), |
1623 | 290 | oldTransition.getNameOffsetX(), | 294 | oldTransition.getNameOffsetX(), |
1624 | 291 | oldTransition.getNameOffsetY(), | 295 | oldTransition.getNameOffsetY(), |
1625 | 292 | true, | 296 | true, |
1626 | 293 | false, | 297 | false, |
1627 | 294 | oldTransition.getAngle(), | 298 | oldTransition.getAngle(), |
1628 | 295 | 0); | 299 | 0, |
1629 | 300 | lens | ||
1630 | 301 | ); | ||
1631 | 296 | newTransition.setUnderlyingTransition(transition); | 302 | newTransition.setUnderlyingTransition(transition); |
1632 | 297 | newTransition.setName(uniqueTransitionName); | 303 | newTransition.setName(uniqueTransitionName); |
1633 | 298 | guiModel.addPetriNetObject(newTransition); | 304 | guiModel.addPetriNetObject(newTransition); |
1634 | @@ -380,12 +386,14 @@ | |||
1635 | 380 | Place guiSource = guiModel.getPlaceByName(mapping.map(sourceTemplate, arc.source().name())); | 386 | Place guiSource = guiModel.getPlaceByName(mapping.map(sourceTemplate, arc.source().name())); |
1636 | 381 | Transition guiTarget = guiModel.getTransitionByName(mapping.map(targetTemplate, arc.destination().name())); | 387 | Transition guiTarget = guiModel.getTransitionByName(mapping.map(targetTemplate, arc.destination().name())); |
1637 | 382 | 388 | ||
1644 | 383 | TimedInputArcComponent newArc = new TimedInputArcComponent(new TimedOutputArcComponent( | 389 | TimedInputArcComponent newArc = new TimedInputArcComponent( |
1645 | 384 | guiSource, | 390 | new TimedOutputArcComponent( |
1646 | 385 | guiTarget, | 391 | guiSource, |
1647 | 386 | arc.getWeight().value(), | 392 | guiTarget, |
1648 | 387 | mapping.map(sourceTemplate, arc.source().name()) + "_to_" + mapping.map(targetTemplate, arc.destination().name()) | 393 | arc.getWeight().value(), |
1649 | 388 | ) | 394 | mapping.map(sourceTemplate, arc.source().name()) + "_to_" + mapping.map(targetTemplate, arc.destination().name()) |
1650 | 395 | ), | ||
1651 | 396 | lens | ||
1652 | 389 | ); | 397 | ); |
1653 | 390 | 398 | ||
1654 | 391 | // Build ArcPath | 399 | // Build ArcPath |
1655 | 392 | 400 | ||
1656 | === modified file 'src/pipe/dataLayer/TAPNQuery.java' | |||
1657 | --- src/pipe/dataLayer/TAPNQuery.java 2019-03-22 11:36:50 +0000 | |||
1658 | +++ src/pipe/dataLayer/TAPNQuery.java 2020-08-19 11:36:17 +0000 | |||
1659 | @@ -1,11 +1,8 @@ | |||
1660 | 1 | package pipe.dataLayer; | 1 | package pipe.dataLayer; |
1661 | 2 | 2 | ||
1662 | 3 | import dk.aau.cs.TCTL.*; | ||
1663 | 3 | import pipe.dataLayer.TAPNQuery.QueryCategory; | 4 | import pipe.dataLayer.TAPNQuery.QueryCategory; |
1664 | 4 | import pipe.gui.widgets.InclusionPlaces; | 5 | import pipe.gui.widgets.InclusionPlaces; |
1665 | 5 | import dk.aau.cs.TCTL.TCTLAFNode; | ||
1666 | 6 | import dk.aau.cs.TCTL.TCTLAbstractProperty; | ||
1667 | 7 | import dk.aau.cs.TCTL.TCTLEFNode; | ||
1668 | 8 | import dk.aau.cs.TCTL.TCTLEGNode; | ||
1669 | 9 | import dk.aau.cs.translations.ReductionOption; | 6 | import dk.aau.cs.translations.ReductionOption; |
1670 | 10 | import dk.aau.cs.verification.QueryType; | 7 | import dk.aau.cs.verification.QueryType; |
1671 | 11 | 8 | ||
1672 | @@ -416,4 +413,13 @@ | |||
1673 | 416 | public AlgorithmOption getAlgorithmOption(){ | 413 | public AlgorithmOption getAlgorithmOption(){ |
1674 | 417 | return this.algorithmOption; | 414 | return this.algorithmOption; |
1675 | 418 | } | 415 | } |
1676 | 416 | |||
1677 | 417 | public boolean hasUntimedOnlyProperties(){ | ||
1678 | 418 | if(!(property instanceof TCTLAFNode || property instanceof TCTLAGNode || property instanceof TCTLEFNode || property instanceof TCTLEGNode)){ | ||
1679 | 419 | return true; | ||
1680 | 420 | } else if(property.hasNestedPathQuantifiers()){ | ||
1681 | 421 | return true; | ||
1682 | 422 | } | ||
1683 | 423 | return false; | ||
1684 | 424 | } | ||
1685 | 419 | } | 425 | } |
1686 | 420 | 426 | ||
1687 | === modified file 'src/pipe/gui/AnimationControlSidePanel.java' | |||
1688 | --- src/pipe/gui/AnimationControlSidePanel.java 2020-07-16 09:52:11 +0000 | |||
1689 | +++ src/pipe/gui/AnimationControlSidePanel.java 2020-08-19 11:36:17 +0000 | |||
1690 | @@ -21,6 +21,7 @@ | |||
1691 | 21 | import javax.swing.border.EmptyBorder; | 21 | import javax.swing.border.EmptyBorder; |
1692 | 22 | import javax.swing.text.AbstractDocument; | 22 | import javax.swing.text.AbstractDocument; |
1693 | 23 | 23 | ||
1694 | 24 | import dk.aau.cs.gui.TabContent; | ||
1695 | 24 | import dk.aau.cs.util.Require; | 25 | import dk.aau.cs.util.Require; |
1696 | 25 | import net.tapaal.swinghelpers.DecimalOnlyDocumentFilter; | 26 | import net.tapaal.swinghelpers.DecimalOnlyDocumentFilter; |
1697 | 26 | import dk.aau.cs.gui.components.NonsearchableJComboBox; | 27 | import dk.aau.cs.gui.components.NonsearchableJComboBox; |
1698 | @@ -46,14 +47,17 @@ | |||
1699 | 46 | private int delayScale = 10; | 47 | private int delayScale = 10; |
1700 | 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."; |
1701 | 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"; |
1706 | 49 | 50 | private JPanel sliderPanel; | |
1707 | 50 | 51 | private JPanel timedelayPanel; | |
1708 | 51 | 52 | JPanel firemode; | |
1709 | 52 | JTextField TimeDelayField = new JTextField(); | 53 | |
1710 | 54 | |||
1711 | 55 | |||
1712 | 56 | JTextField TimeDelayField = new JTextField(); | ||
1713 | 53 | JComboBox<String> firermodebox; | 57 | JComboBox<String> firermodebox; |
1714 | 54 | 58 | ||
1715 | 55 | 59 | ||
1717 | 56 | public AnimationControlSidePanel(Animator animator) { | 60 | public AnimationControlSidePanel(Animator animator, TabContent.TAPNLens lens) { |
1718 | 57 | Require.notNull(animator, "Animator can't be null"); | 61 | Require.notNull(animator, "Animator can't be null"); |
1719 | 58 | 62 | ||
1720 | 59 | this.animator = animator; | 63 | this.animator = animator; |
1721 | @@ -80,7 +84,7 @@ | |||
1722 | 80 | c.gridy = 2; | 84 | c.gridy = 2; |
1723 | 81 | add(animationToolBar, c); | 85 | add(animationToolBar, c); |
1724 | 82 | 86 | ||
1726 | 83 | JPanel firemode = new JPanel(new FlowLayout(FlowLayout.LEFT)); | 87 | firemode = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
1727 | 84 | 88 | ||
1728 | 85 | JLabel label = new JLabel("Token selection: "); | 89 | JLabel label = new JLabel("Token selection: "); |
1729 | 86 | 90 | ||
1730 | @@ -104,10 +108,21 @@ | |||
1731 | 104 | this.setMinimumSize(new Dimension(275, 180)); | 108 | this.setMinimumSize(new Dimension(275, 180)); |
1732 | 105 | 109 | ||
1733 | 106 | initializeDocumentFilterForDelayInput(); | 110 | initializeDocumentFilterForDelayInput(); |
1734 | 111 | hideIrrelevantInformation(lens); | ||
1735 | 107 | } | 112 | } |
1736 | 108 | 113 | ||
1737 | 114 | private void hideIrrelevantInformation(TabContent.TAPNLens lens){ | ||
1738 | 115 | sliderPanel.setVisible(lens.isTimed()); | ||
1739 | 116 | timedelayPanel.setVisible(lens.isTimed()); | ||
1740 | 117 | firemode.setVisible(lens.isTimed()); | ||
1741 | 118 | if(!lens.isTimed()){ | ||
1742 | 119 | this.setPreferredSize(new Dimension(275, 50)); | ||
1743 | 120 | this.setMinimumSize(new Dimension(275, 50)); | ||
1744 | 121 | } | ||
1745 | 122 | } | ||
1746 | 123 | |||
1747 | 109 | private void initDelaySlider() { | 124 | private void initDelaySlider() { |
1749 | 110 | JPanel sliderPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); | 125 | sliderPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); |
1750 | 111 | JButton decrese = new JButton("-"); | 126 | JButton decrese = new JButton("-"); |
1751 | 112 | decrese.setPreferredSize(new Dimension(20, 30)); | 127 | decrese.setPreferredSize(new Dimension(20, 30)); |
1752 | 113 | decrese.addActionListener(e -> { | 128 | decrese.addActionListener(e -> { |
1753 | @@ -174,7 +189,7 @@ | |||
1754 | 174 | 189 | ||
1755 | 175 | 190 | ||
1756 | 176 | private void initDelayTimePanel(JToolBar animationToolBar) { | 191 | private void initDelayTimePanel(JToolBar animationToolBar) { |
1758 | 177 | JPanel timedelayPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); | 192 | timedelayPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
1759 | 178 | 193 | ||
1760 | 179 | okButton = new javax.swing.JButton(); | 194 | okButton = new javax.swing.JButton(); |
1761 | 180 | 195 | ||
1762 | 181 | 196 | ||
1763 | === modified file 'src/pipe/gui/AnimationSettingsDialog.java' | |||
1764 | --- src/pipe/gui/AnimationSettingsDialog.java 2020-07-20 07:19:51 +0000 | |||
1765 | +++ src/pipe/gui/AnimationSettingsDialog.java 2020-08-19 11:36:17 +0000 | |||
1766 | @@ -9,6 +9,7 @@ | |||
1767 | 9 | import javax.swing.JDialog; | 9 | import javax.swing.JDialog; |
1768 | 10 | import javax.swing.JPanel; | 10 | import javax.swing.JPanel; |
1769 | 11 | 11 | ||
1770 | 12 | import dk.aau.cs.gui.TabContent; | ||
1771 | 12 | import pipe.gui.widgets.EscapableDialog; | 13 | import pipe.gui.widgets.EscapableDialog; |
1772 | 13 | 14 | ||
1773 | 14 | public class AnimationSettingsDialog { | 15 | public class AnimationSettingsDialog { |
1774 | @@ -16,8 +17,8 @@ | |||
1775 | 16 | private static JDialog dialog; | 17 | private static JDialog dialog; |
1776 | 17 | private static DelayEnabledTransitionControl delayEnabled; | 18 | private static DelayEnabledTransitionControl delayEnabled; |
1777 | 18 | private static SimulationControl simControl; | 19 | private static SimulationControl simControl; |
1780 | 19 | 20 | ||
1781 | 20 | private static JPanel getContent(){ | 21 | private static JPanel getContent(TabContent.TAPNLens lens){ |
1782 | 21 | JPanel content = new JPanel(new BorderLayout()); | 22 | JPanel content = new JPanel(new BorderLayout()); |
1783 | 22 | 23 | ||
1784 | 23 | delayEnabled = DelayEnabledTransitionControl.getInstance(); | 24 | delayEnabled = DelayEnabledTransitionControl.getInstance(); |
1785 | @@ -26,28 +27,32 @@ | |||
1786 | 26 | 27 | ||
1787 | 27 | simControl.addRandomSimulationActionListener(e -> { | 28 | simControl.addRandomSimulationActionListener(e -> { |
1788 | 28 | if(simControl.randomSimulation()){ | 29 | if(simControl.randomSimulation()){ |
1790 | 29 | delayEnabled.randomMode.setSelected(true); | 30 | simControl.randomMode.setSelected(true); |
1791 | 30 | } | 31 | } |
1792 | 31 | CreateGui.getCurrentTab().getTransitionFireingComponent().updateFireButton(); | 32 | CreateGui.getCurrentTab().getTransitionFireingComponent().updateFireButton(); |
1793 | 32 | }); | 33 | }); |
1794 | 33 | 34 | ||
1795 | 34 | content.add(delayEnabled, BorderLayout.NORTH); | 35 | content.add(delayEnabled, BorderLayout.NORTH); |
1796 | 35 | content.add(simControl, BorderLayout.SOUTH); | 36 | content.add(simControl, BorderLayout.SOUTH); |
1797 | 37 | hideTimedInformation(lens); | ||
1798 | 36 | return content; | 38 | return content; |
1799 | 37 | } | 39 | } |
1803 | 38 | 40 | ||
1804 | 39 | 41 | private static void hideTimedInformation(TabContent.TAPNLens lens){ | |
1805 | 40 | public static void showAnimationSettings(){ | 42 | delayEnabled.setVisible(lens.isTimed()); |
1806 | 43 | } | ||
1807 | 44 | |||
1808 | 45 | public static void showAnimationSettings(TabContent.TAPNLens lens){ | ||
1809 | 41 | JPanel contentPane = new JPanel(new GridBagLayout()); | 46 | JPanel contentPane = new JPanel(new GridBagLayout()); |
1810 | 42 | 47 | ||
1811 | 43 | JButton closeDialogButton = new JButton("Close"); | 48 | JButton closeDialogButton = new JButton("Close"); |
1812 | 44 | closeDialogButton.addActionListener(o -> dialog.setVisible(false)); | 49 | closeDialogButton.addActionListener(o -> dialog.setVisible(false)); |
1814 | 45 | 50 | ||
1815 | 46 | GridBagConstraints gbc = new GridBagConstraints(); | 51 | GridBagConstraints gbc = new GridBagConstraints(); |
1816 | 47 | gbc.anchor = GridBagConstraints.NORTHWEST; | 52 | gbc.anchor = GridBagConstraints.NORTHWEST; |
1817 | 48 | gbc.insets = new Insets(0, 3, 0, 3); | 53 | gbc.insets = new Insets(0, 3, 0, 3); |
1818 | 49 | gbc.fill = GridBagConstraints.BOTH; | 54 | gbc.fill = GridBagConstraints.BOTH; |
1820 | 50 | contentPane.add(getContent(), gbc); | 55 | contentPane.add(getContent(lens), gbc); |
1821 | 51 | 56 | ||
1822 | 52 | gbc = new GridBagConstraints(); | 57 | gbc = new GridBagConstraints(); |
1823 | 53 | gbc.anchor = GridBagConstraints.NORTHWEST; | 58 | gbc.anchor = GridBagConstraints.NORTHWEST; |
1824 | 54 | 59 | ||
1825 | === modified file 'src/pipe/gui/Animator.java' | |||
1826 | --- src/pipe/gui/Animator.java 2020-07-20 12:17:24 +0000 | |||
1827 | +++ src/pipe/gui/Animator.java 2020-08-19 11:36:17 +0000 | |||
1828 | @@ -705,4 +705,8 @@ | |||
1829 | 705 | } | 705 | } |
1830 | 706 | } | 706 | } |
1831 | 707 | 707 | ||
1832 | 708 | public TabContent getTab(){ | ||
1833 | 709 | return tab; | ||
1834 | 710 | } | ||
1835 | 711 | |||
1836 | 708 | } | 712 | } |
1837 | 709 | 713 | ||
1838 | === modified file 'src/pipe/gui/CreateGui.java' | |||
1839 | --- src/pipe/gui/CreateGui.java 2020-07-22 10:39:07 +0000 | |||
1840 | +++ src/pipe/gui/CreateGui.java 2020-08-19 11:36:17 +0000 | |||
1841 | @@ -157,4 +157,8 @@ | |||
1842 | 157 | 157 | ||
1843 | 158 | public static boolean useExtendedBounds = false; | 158 | public static boolean useExtendedBounds = false; |
1844 | 159 | 159 | ||
1845 | 160 | //XXX Moved from guiframe to static access, while refactoring. | ||
1846 | 161 | @Deprecated | ||
1847 | 162 | public static Pipe.ElementType guiMode; | ||
1848 | 163 | |||
1849 | 160 | } | 164 | } |
1850 | 161 | 165 | ||
1851 | === modified file 'src/pipe/gui/DelayEnabledTransitionControl.java' | |||
1852 | --- src/pipe/gui/DelayEnabledTransitionControl.java 2020-07-20 08:04:40 +0000 | |||
1853 | +++ src/pipe/gui/DelayEnabledTransitionControl.java 2020-08-19 11:36:17 +0000 | |||
1854 | @@ -23,14 +23,12 @@ | |||
1855 | 23 | 23 | ||
1856 | 24 | private static DelayMode defaultDelayMode = ShortestDelayMode.getInstance(); | 24 | private static DelayMode defaultDelayMode = ShortestDelayMode.getInstance(); |
1857 | 25 | private static BigDecimal defaultGranularity = new BigDecimal("0.1"); | 25 | private static BigDecimal defaultGranularity = new BigDecimal("0.1"); |
1860 | 26 | private static boolean defaultIsRandomTrasition; | 26 | |
1859 | 27 | |||
1861 | 28 | private final JLabel precitionLabel; | 27 | private final JLabel precitionLabel; |
1862 | 29 | private final JSlider delayEnabledPrecision; | 28 | private final JSlider delayEnabledPrecision; |
1863 | 30 | private final JLabel delayModeLabel; | 29 | private final JLabel delayModeLabel; |
1864 | 31 | private final JComboBox<DelayMode> delayMode; | 30 | private final JComboBox<DelayMode> delayMode; |
1867 | 32 | final JCheckBox randomMode = new JCheckBox("Choose next transition randomly"); | 31 | |
1866 | 33 | |||
1868 | 34 | private DelayEnabledTransitionControl() { | 32 | private DelayEnabledTransitionControl() { |
1869 | 35 | super(new GridBagLayout()); | 33 | super(new GridBagLayout()); |
1870 | 36 | 34 | ||
1871 | @@ -57,8 +55,7 @@ | |||
1872 | 57 | delayMode = new JComboBox<>(items); | 55 | delayMode = new JComboBox<>(items); |
1873 | 58 | setDelayMode(defaultDelayMode); | 56 | setDelayMode(defaultDelayMode); |
1874 | 59 | 57 | ||
1877 | 60 | setRandomTransitionMode(defaultIsRandomTrasition); | 58 | |
1876 | 61 | |||
1878 | 62 | GridBagConstraints gbc = new GridBagConstraints(); | 59 | GridBagConstraints gbc = new GridBagConstraints(); |
1879 | 63 | gbc.gridwidth = 2; | 60 | gbc.gridwidth = 2; |
1880 | 64 | gbc.anchor = GridBagConstraints.WEST; | 61 | gbc.anchor = GridBagConstraints.WEST; |
1881 | @@ -92,13 +89,6 @@ | |||
1882 | 92 | gbc.gridy = 2; | 89 | gbc.gridy = 2; |
1883 | 93 | add(delayMode, gbc); | 90 | add(delayMode, gbc); |
1884 | 94 | 91 | ||
1885 | 95 | gbc = new GridBagConstraints(); | ||
1886 | 96 | gbc.anchor = GridBagConstraints.WEST; | ||
1887 | 97 | gbc.weightx = 1.0; | ||
1888 | 98 | gbc.gridx = 0; | ||
1889 | 99 | gbc.gridy = 3; | ||
1890 | 100 | add(randomMode, gbc); | ||
1891 | 101 | |||
1892 | 102 | setBorder(BorderFactory.createCompoundBorder( | 92 | setBorder(BorderFactory.createCompoundBorder( |
1893 | 103 | BorderFactory.createTitledBorder("Delay controller"), | 93 | BorderFactory.createTitledBorder("Delay controller"), |
1894 | 104 | BorderFactory.createEmptyBorder(3, 3, 3, 3))); | 94 | BorderFactory.createEmptyBorder(3, 3, 3, 3))); |
1895 | @@ -130,19 +120,9 @@ | |||
1896 | 130 | public void setDelayMode(DelayMode delayMode){ | 120 | public void setDelayMode(DelayMode delayMode){ |
1897 | 131 | this.delayMode.setSelectedItem(delayMode); | 121 | this.delayMode.setSelectedItem(delayMode); |
1898 | 132 | } | 122 | } |
1912 | 133 | 123 | ||
1913 | 134 | public boolean isRandomTransitionMode(){ | 124 | |
1914 | 135 | if(SimulationControl.getInstance().randomSimulation()){ | 125 | |
1902 | 136 | return true; | ||
1903 | 137 | } else { | ||
1904 | 138 | return randomMode.isSelected(); | ||
1905 | 139 | } | ||
1906 | 140 | } | ||
1907 | 141 | |||
1908 | 142 | public void setRandomTransitionMode(boolean randomTransition){ | ||
1909 | 143 | randomMode.setSelected(randomTransition); | ||
1910 | 144 | } | ||
1911 | 145 | |||
1915 | 146 | private static DelayEnabledTransitionControl instance; | 126 | private static DelayEnabledTransitionControl instance; |
1916 | 147 | 127 | ||
1917 | 148 | public static DelayEnabledTransitionControl getInstance(){ | 128 | public static DelayEnabledTransitionControl getInstance(){ |
1918 | @@ -176,18 +156,6 @@ | |||
1919 | 176 | } | 156 | } |
1920 | 177 | } | 157 | } |
1921 | 178 | 158 | ||
1922 | 179 | public static void setDefaultIsRandomTransition(boolean delayEnabledTransitionIsRandomTransition) { | ||
1923 | 180 | defaultIsRandomTrasition = delayEnabledTransitionIsRandomTransition; | ||
1924 | 181 | } | ||
1925 | 182 | |||
1926 | 183 | public static boolean isRandomTransition(){ | ||
1927 | 184 | if(instance != null){ | ||
1928 | 185 | return getInstance().isRandomTransitionMode(); | ||
1929 | 186 | } else { | ||
1930 | 187 | return defaultIsRandomTrasition; | ||
1931 | 188 | } | ||
1932 | 189 | } | ||
1933 | 190 | |||
1934 | 191 | @Override | 159 | @Override |
1935 | 192 | public void setEnabled(boolean enabled) { | 160 | public void setEnabled(boolean enabled) { |
1936 | 193 | super.setEnabled(enabled); | 161 | super.setEnabled(enabled); |
1937 | @@ -195,6 +163,5 @@ | |||
1938 | 195 | delayEnabledPrecision.setEnabled(enabled); | 163 | delayEnabledPrecision.setEnabled(enabled); |
1939 | 196 | delayModeLabel.setEnabled(enabled); | 164 | delayModeLabel.setEnabled(enabled); |
1940 | 197 | delayMode.setEnabled(enabled); | 165 | delayMode.setEnabled(enabled); |
1941 | 198 | randomMode.setEnabled(enabled); | ||
1942 | 199 | } | 166 | } |
1943 | 200 | } | 167 | } |
1944 | 201 | 168 | ||
1945 | === modified file 'src/pipe/gui/GuiFrame.java' | |||
1946 | --- src/pipe/gui/GuiFrame.java 2020-08-13 08:58:53 +0000 | |||
1947 | +++ src/pipe/gui/GuiFrame.java 2020-08-19 11:36:17 +0000 | |||
1948 | @@ -11,6 +11,7 @@ | |||
1949 | 11 | import java.net.*; | 11 | import java.net.*; |
1950 | 12 | import java.nio.charset.StandardCharsets; | 12 | import java.nio.charset.StandardCharsets; |
1951 | 13 | import java.util.*; | 13 | import java.util.*; |
1952 | 14 | import java.util.List; | ||
1953 | 14 | import java.util.jar.JarEntry; | 15 | import java.util.jar.JarEntry; |
1954 | 15 | import java.util.jar.JarFile; | 16 | import java.util.jar.JarFile; |
1955 | 16 | import javax.swing.*; | 17 | import javax.swing.*; |
1956 | @@ -25,6 +26,7 @@ | |||
1957 | 25 | import net.tapaal.helpers.Reference.Reference; | 26 | import net.tapaal.helpers.Reference.Reference; |
1958 | 26 | import net.tapaal.swinghelpers.ExtendedJTabbedPane; | 27 | import net.tapaal.swinghelpers.ExtendedJTabbedPane; |
1959 | 27 | import net.tapaal.swinghelpers.ToggleButtonWithoutText; | 28 | import net.tapaal.swinghelpers.ToggleButtonWithoutText; |
1960 | 29 | import org.jetbrains.annotations.NotNull; | ||
1961 | 28 | import pipe.gui.Pipe.ElementType; | 30 | import pipe.gui.Pipe.ElementType; |
1962 | 29 | import pipe.gui.action.GuiAction; | 31 | import pipe.gui.action.GuiAction; |
1963 | 30 | import pipe.gui.widgets.WorkflowDialog; | 32 | import pipe.gui.widgets.WorkflowDialog; |
1964 | @@ -43,8 +45,6 @@ | |||
1965 | 43 | 45 | ||
1966 | 44 | private final String frameTitle; | 46 | private final String frameTitle; |
1967 | 45 | 47 | ||
1968 | 46 | private Pipe.ElementType mode; | ||
1969 | 47 | |||
1970 | 48 | private int newNameCounter = 1; | 48 | private int newNameCounter = 1; |
1971 | 49 | 49 | ||
1972 | 50 | final MutableReference<GuiFrameControllerActions> guiFrameController = new MutableReference<>(); | 50 | final MutableReference<GuiFrameControllerActions> guiFrameController = new MutableReference<>(); |
1973 | @@ -53,6 +53,9 @@ | |||
1974 | 53 | 53 | ||
1975 | 54 | private final StatusBar statusBar; | 54 | private final StatusBar statusBar; |
1976 | 55 | private JMenuBar menuBar; | 55 | private JMenuBar menuBar; |
1977 | 56 | JMenu drawMenu; | ||
1978 | 57 | JMenu animateMenu; | ||
1979 | 58 | JMenu viewMenu; | ||
1980 | 56 | private JToolBar drawingToolBar; | 59 | private JToolBar drawingToolBar; |
1981 | 57 | private final JLabel featureInfoText = new JLabel(); | 60 | private final JLabel featureInfoText = new JLabel(); |
1982 | 58 | private JComboBox<String> timeFeatureOptions = new JComboBox(new String[]{"No", "Yes"}); | 61 | private JComboBox<String> timeFeatureOptions = new JComboBox(new String[]{"No", "Yes"}); |
1983 | @@ -281,47 +284,6 @@ | |||
1984 | 281 | currentTab.ifPresent(o -> o.setMode(ElementType.ANNOTATION)); | 284 | currentTab.ifPresent(o -> o.setMode(ElementType.ANNOTATION)); |
1985 | 282 | } | 285 | } |
1986 | 283 | }; | 286 | }; |
1987 | 284 | private final GuiAction inhibarcAction = new GuiAction("Inhibitor arc", "Add an inhibitor arc (I)", "I", true) { | ||
1988 | 285 | public void actionPerformed(ActionEvent e) { | ||
1989 | 286 | currentTab.ifPresent(o -> o.setMode(ElementType.TAPNINHIBITOR_ARC)); | ||
1990 | 287 | } | ||
1991 | 288 | }; | ||
1992 | 289 | private final GuiAction transAction = new GuiAction("Transition", "Add a transition (T)", "T", true) { | ||
1993 | 290 | public void actionPerformed(ActionEvent e) { | ||
1994 | 291 | currentTab.ifPresent(o -> o.setMode(ElementType.TAPNTRANS)); | ||
1995 | 292 | } | ||
1996 | 293 | }; | ||
1997 | 294 | private final GuiAction tokenAction = new GuiAction("Add token", "Add a token (+)", "typed +", true) { | ||
1998 | 295 | public void actionPerformed(ActionEvent e) { | ||
1999 | 296 | currentTab.ifPresent(o -> o.setMode(ElementType.ADDTOKEN)); | ||
2000 | 297 | } | ||
2001 | 298 | }; | ||
2002 | 299 | private final GuiAction selectAction = new GuiAction("Select", "Select components (S)", "S", true) { | ||
2003 | 300 | public void actionPerformed(ActionEvent e) { | ||
2004 | 301 | currentTab.ifPresent(o -> o.setMode(ElementType.SELECT)); | ||
2005 | 302 | } | ||
2006 | 303 | }; | ||
2007 | 304 | private final GuiAction deleteTokenAction = new GuiAction("Delete token", "Delete a token (-)", "typed -", true) { | ||
2008 | 305 | public void actionPerformed(ActionEvent e) { | ||
2009 | 306 | currentTab.ifPresent(o -> o.setMode(ElementType.DELTOKEN)); | ||
2010 | 307 | } | ||
2011 | 308 | }; | ||
2012 | 309 | private final GuiAction timedPlaceAction = new GuiAction("Place", "Add a place (P)", "P", true) { | ||
2013 | 310 | public void actionPerformed(ActionEvent e) { | ||
2014 | 311 | currentTab.ifPresent(o -> o.setMode(ElementType.TAPNPLACE)); | ||
2015 | 312 | } | ||
2016 | 313 | }; | ||
2017 | 314 | |||
2018 | 315 | private final GuiAction timedArcAction = new GuiAction("Arc", "Add an arc (A)", "A", true) { | ||
2019 | 316 | public void actionPerformed(ActionEvent e) { | ||
2020 | 317 | currentTab.ifPresent(o -> o.setMode(ElementType.TAPNARC)); | ||
2021 | 318 | } | ||
2022 | 319 | }; | ||
2023 | 320 | private final GuiAction transportArcAction = new GuiAction("Transport arc", "Add a transport arc (R)", "R", true) { | ||
2024 | 321 | public void actionPerformed(ActionEvent e) { | ||
2025 | 322 | currentTab.ifPresent(o -> o.setMode(ElementType.TRANSPORTARC)); | ||
2026 | 323 | } | ||
2027 | 324 | }; | ||
2028 | 325 | 287 | ||
2029 | 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) { |
2030 | 327 | public void actionPerformed(ActionEvent e) { | 289 | public void actionPerformed(ActionEvent e) { |
2031 | @@ -436,17 +398,9 @@ | |||
2032 | 436 | currentTab.ifPresent(TabContentActions::stepBackwards); | 398 | currentTab.ifPresent(TabContentActions::stepBackwards); |
2033 | 437 | } | 399 | } |
2034 | 438 | }; | 400 | }; |
2046 | 439 | private final GuiAction timeAction = new GuiAction("Delay one time unit", "Let time pass one time unit", "W") { | 401 | |
2047 | 440 | public void actionPerformed(ActionEvent e) { | 402 | |
2048 | 441 | currentTab.ifPresent(TabContentActions::timeDelay); | 403 | private GuiAction prevcomponentAction = new GuiAction("Previous component", "Previous component", "pressed UP") { |
2038 | 442 | } | ||
2039 | 443 | }; | ||
2040 | 444 | private final GuiAction delayFireAction = new GuiAction("Delay and fire", "Delay and fire selected transition", "F") { | ||
2041 | 445 | public void actionPerformed(ActionEvent e) { | ||
2042 | 446 | currentTab.ifPresent(TabContentActions::delayAndFire); | ||
2043 | 447 | } | ||
2044 | 448 | }; | ||
2045 | 449 | private final GuiAction prevcomponentAction = new GuiAction("Previous component", "Previous component", "pressed UP") { | ||
2049 | 450 | public void actionPerformed(ActionEvent e) { | 404 | public void actionPerformed(ActionEvent e) { |
2050 | 451 | currentTab.ifPresent(TabContentActions::previousComponent); | 405 | currentTab.ifPresent(TabContentActions::previousComponent); |
2051 | 452 | } | 406 | } |
2052 | @@ -477,6 +431,7 @@ | |||
2053 | 477 | 431 | ||
2054 | 478 | private JCheckBoxMenuItem showZeroToInfinityIntervalsCheckBox; | 432 | private JCheckBoxMenuItem showZeroToInfinityIntervalsCheckBox; |
2055 | 479 | private JCheckBoxMenuItem showTokenAgeCheckBox; | 433 | private JCheckBoxMenuItem showTokenAgeCheckBox; |
2056 | 434 | private JCheckBoxMenuItem showDelayEnabledTransitionsCheckbox; | ||
2057 | 480 | 435 | ||
2058 | 481 | private JMenu zoomMenu; | 436 | private JMenu zoomMenu; |
2059 | 482 | 437 | ||
2060 | @@ -496,7 +451,7 @@ | |||
2061 | 496 | this.setMinimumSize(new Dimension(825, 480)); | 451 | this.setMinimumSize(new Dimension(825, 480)); |
2062 | 497 | 452 | ||
2063 | 498 | setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); | 453 | setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); |
2065 | 499 | appTab= new ExtendedJTabbedPane<TabContent>() { | 454 | appTab = new ExtendedJTabbedPane<TabContent>() { |
2066 | 500 | @Override | 455 | @Override |
2067 | 501 | public Component generator() { | 456 | public Component generator() { |
2068 | 502 | return new TabComponent(this) { | 457 | return new TabComponent(this) { |
2069 | @@ -586,7 +541,7 @@ | |||
2070 | 586 | } | 541 | } |
2071 | 587 | 542 | ||
2072 | 588 | 543 | ||
2074 | 589 | if (Platform.isMac()){ | 544 | if (Platform.isMac()) { |
2075 | 590 | 545 | ||
2076 | 591 | //Set specific settings | 546 | //Set specific settings |
2077 | 592 | System.setProperty("apple.laf.useScreenMenuBar", "true"); | 547 | System.setProperty("apple.laf.useScreenMenuBar", "true"); |
2078 | @@ -616,11 +571,11 @@ | |||
2079 | 616 | **/ | 571 | **/ |
2080 | 617 | private void buildMenus() { | 572 | private void buildMenus() { |
2081 | 618 | menuBar = new JMenuBar(); | 573 | menuBar = new JMenuBar(); |
2082 | 619 | |||
2083 | 620 | menuBar.add(buildMenuFiles()); | 574 | menuBar.add(buildMenuFiles()); |
2084 | 621 | menuBar.add(buildMenuEdit()); | 575 | menuBar.add(buildMenuEdit()); |
2085 | 622 | menuBar.add(buildMenuView()); | 576 | menuBar.add(buildMenuView()); |
2086 | 623 | menuBar.add(buildMenuDraw()); | 577 | menuBar.add(buildMenuDraw()); |
2087 | 578 | |||
2088 | 624 | menuBar.add(buildMenuAnimation()); | 579 | menuBar.add(buildMenuAnimation()); |
2089 | 625 | menuBar.add(buildMenuTools()); | 580 | menuBar.add(buildMenuTools()); |
2090 | 626 | menuBar.add(buildMenuHelp()); | 581 | menuBar.add(buildMenuHelp()); |
2091 | @@ -658,35 +613,14 @@ | |||
2092 | 658 | 613 | ||
2093 | 659 | private JMenu buildMenuDraw() { | 614 | private JMenu buildMenuDraw() { |
2094 | 660 | /* Draw menu */ | 615 | /* Draw menu */ |
2096 | 661 | JMenu drawMenu = new JMenu("Draw"); | 616 | drawMenu = new JMenu("Draw"); |
2097 | 662 | drawMenu.setMnemonic('D'); | 617 | drawMenu.setMnemonic('D'); |
2098 | 663 | |||
2099 | 664 | drawMenu.add(selectAction); | ||
2100 | 665 | drawMenu.addSeparator(); | ||
2101 | 666 | |||
2102 | 667 | drawMenu.add(timedPlaceAction); | ||
2103 | 668 | |||
2104 | 669 | drawMenu.add(transAction); | ||
2105 | 670 | |||
2106 | 671 | drawMenu.add(timedArcAction); | ||
2107 | 672 | |||
2108 | 673 | drawMenu.add(transportArcAction); | ||
2109 | 674 | |||
2110 | 675 | drawMenu.add(inhibarcAction); | ||
2111 | 676 | |||
2112 | 677 | drawMenu.add(annotationAction); | ||
2113 | 678 | |||
2114 | 679 | drawMenu.addSeparator(); | ||
2115 | 680 | |||
2116 | 681 | drawMenu.add(tokenAction); | ||
2117 | 682 | |||
2118 | 683 | drawMenu.add(deleteTokenAction); | ||
2119 | 684 | return drawMenu; | 618 | return drawMenu; |
2120 | 685 | } | 619 | } |
2121 | 686 | 620 | ||
2122 | 687 | private JMenu buildMenuView() { | 621 | private JMenu buildMenuView() { |
2123 | 688 | /* ViewMenu */ | 622 | /* ViewMenu */ |
2125 | 689 | JMenu viewMenu = new JMenu("View"); | 623 | viewMenu = new JMenu("View"); |
2126 | 690 | viewMenu.setMnemonic('V'); | 624 | viewMenu.setMnemonic('V'); |
2127 | 691 | 625 | ||
2128 | 692 | zoomMenu = new JMenu("Zoom"); | 626 | zoomMenu = new JMenu("Zoom"); |
2129 | @@ -725,7 +659,7 @@ | |||
2130 | 725 | 659 | ||
2131 | 726 | addCheckboxMenuItem(viewMenu, showEnabledTransitionsAction); | 660 | addCheckboxMenuItem(viewMenu, showEnabledTransitionsAction); |
2132 | 727 | 661 | ||
2134 | 728 | addCheckboxMenuItem(viewMenu, showDelayEnabledTransitionsAction); | 662 | showDelayEnabledTransitionsCheckbox = addCheckboxMenuItem(viewMenu, showDelayEnabledTransitionsAction); |
2135 | 729 | 663 | ||
2136 | 730 | showZeroToInfinityIntervalsCheckBox = addCheckboxMenuItem(viewMenu, showZeroToInfinityIntervals(), showZeroToInfinityIntervalsAction); | 664 | showZeroToInfinityIntervalsCheckBox = addCheckboxMenuItem(viewMenu, showZeroToInfinityIntervals(), showZeroToInfinityIntervalsAction); |
2137 | 731 | 665 | ||
2138 | @@ -744,7 +678,7 @@ | |||
2139 | 744 | 678 | ||
2140 | 745 | private JMenu buildMenuAnimation() { | 679 | private JMenu buildMenuAnimation() { |
2141 | 746 | /* Simulator */ | 680 | /* Simulator */ |
2143 | 747 | JMenu animateMenu = new JMenu("Simulator"); | 681 | animateMenu = new JMenu("Simulator"); |
2144 | 748 | animateMenu.setMnemonic('A'); | 682 | animateMenu.setMnemonic('A'); |
2145 | 749 | animateMenu.add(startAction); | 683 | animateMenu.add(startAction); |
2146 | 750 | 684 | ||
2147 | @@ -752,10 +686,6 @@ | |||
2148 | 752 | animateMenu.add(stepbackwardAction); | 686 | animateMenu.add(stepbackwardAction); |
2149 | 753 | animateMenu.add(stepforwardAction); | 687 | animateMenu.add(stepforwardAction); |
2150 | 754 | 688 | ||
2151 | 755 | animateMenu.add(timeAction); | ||
2152 | 756 | |||
2153 | 757 | animateMenu.add(delayFireAction); | ||
2154 | 758 | |||
2155 | 759 | animateMenu.add(prevcomponentAction); | 689 | animateMenu.add(prevcomponentAction); |
2156 | 760 | 690 | ||
2157 | 761 | animateMenu.add(nextcomponentAction); | 691 | animateMenu.add(nextcomponentAction); |
2158 | @@ -878,25 +808,6 @@ | |||
2159 | 878 | drawingToolBar.addSeparator(); | 808 | drawingToolBar.addSeparator(); |
2160 | 879 | drawingToolBar.setRequestFocusEnabled(false); | 809 | drawingToolBar.setRequestFocusEnabled(false); |
2161 | 880 | 810 | ||
2162 | 881 | // Normal arraw | ||
2163 | 882 | drawingToolBar.add(new ToggleButtonWithoutText(selectAction)); | ||
2164 | 883 | |||
2165 | 884 | |||
2166 | 885 | // Drawing elements | ||
2167 | 886 | drawingToolBar.addSeparator(); | ||
2168 | 887 | drawingToolBar.add(new ToggleButtonWithoutText(timedPlaceAction)); | ||
2169 | 888 | drawingToolBar.add(new ToggleButtonWithoutText(transAction)); | ||
2170 | 889 | drawingToolBar.add(new ToggleButtonWithoutText(timedArcAction)); | ||
2171 | 890 | drawingToolBar.add(new ToggleButtonWithoutText(transportArcAction)); | ||
2172 | 891 | drawingToolBar.add(new ToggleButtonWithoutText(inhibarcAction)); | ||
2173 | 892 | |||
2174 | 893 | drawingToolBar.add(new ToggleButtonWithoutText(annotationAction)); | ||
2175 | 894 | |||
2176 | 895 | // Tokens | ||
2177 | 896 | drawingToolBar.addSeparator(); | ||
2178 | 897 | drawingToolBar.add(new ToggleButtonWithoutText(tokenAction)); | ||
2179 | 898 | drawingToolBar.add(new ToggleButtonWithoutText(deleteTokenAction)); | ||
2180 | 899 | |||
2181 | 900 | // Create panel to put toolbars in | 811 | // Create panel to put toolbars in |
2182 | 901 | JPanel toolBarPanel = new JPanel(); | 812 | JPanel toolBarPanel = new JPanel(); |
2183 | 902 | toolBarPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); | 813 | toolBarPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
2184 | @@ -1001,21 +912,10 @@ | |||
2185 | 1001 | exportTraceAction.setEnabled(false); | 912 | exportTraceAction.setEnabled(false); |
2186 | 1002 | importTraceAction.setEnabled(false); | 913 | importTraceAction.setEnabled(false); |
2187 | 1003 | 914 | ||
2188 | 1004 | timedPlaceAction.setEnabled(true); | ||
2189 | 1005 | timedArcAction.setEnabled(true); | ||
2190 | 1006 | inhibarcAction.setEnabled(true); | ||
2191 | 1007 | transportArcAction.setEnabled(true); | ||
2192 | 1008 | |||
2193 | 1009 | annotationAction.setEnabled(true); | 915 | annotationAction.setEnabled(true); |
2194 | 1010 | transAction.setEnabled(true); | ||
2195 | 1011 | tokenAction.setEnabled(true); | ||
2196 | 1012 | deleteAction.setEnabled(true); | 916 | deleteAction.setEnabled(true); |
2197 | 1013 | selectAllAction.setEnabled(true); | 917 | selectAllAction.setEnabled(true); |
2198 | 1014 | selectAction.setEnabled(true); | ||
2199 | 1015 | deleteTokenAction.setEnabled(true); | ||
2200 | 1016 | 918 | ||
2201 | 1017 | timeAction.setEnabled(false); | ||
2202 | 1018 | delayFireAction.setEnabled(false); | ||
2203 | 1019 | stepbackwardAction.setEnabled(false); | 919 | stepbackwardAction.setEnabled(false); |
2204 | 1020 | stepforwardAction.setEnabled(false); | 920 | stepforwardAction.setEnabled(false); |
2205 | 1021 | prevcomponentAction.setEnabled(false); | 921 | prevcomponentAction.setEnabled(false); |
2206 | @@ -1038,7 +938,6 @@ | |||
2207 | 1038 | WorkflowDialog.showDialog(); | 938 | WorkflowDialog.showDialog(); |
2208 | 1039 | } | 939 | } |
2209 | 1040 | 940 | ||
2210 | 1041 | statusBar.changeText(StatusBar.textforDrawing); | ||
2211 | 1042 | //Enable editor focus traversal policy | 941 | //Enable editor focus traversal policy |
2212 | 1043 | setFocusTraversalPolicy(new EditorFocusTraversalPolicy()); | 942 | setFocusTraversalPolicy(new EditorFocusTraversalPolicy()); |
2213 | 1044 | fixBug812694GrayMenuAfterSimulationOnMac(); | 943 | fixBug812694GrayMenuAfterSimulationOnMac(); |
2214 | @@ -1047,18 +946,9 @@ | |||
2215 | 1047 | case animation: | 946 | case animation: |
2216 | 1048 | enableAllActions(true); | 947 | enableAllActions(true); |
2217 | 1049 | 948 | ||
2218 | 1050 | timedPlaceAction.setEnabled(false); | ||
2219 | 1051 | timedArcAction.setEnabled(false); | ||
2220 | 1052 | inhibarcAction.setEnabled(false); | ||
2221 | 1053 | transportArcAction.setEnabled(false); | ||
2222 | 1054 | |||
2223 | 1055 | annotationAction.setEnabled(false); | 949 | annotationAction.setEnabled(false); |
2224 | 1056 | transAction.setEnabled(false); | ||
2225 | 1057 | tokenAction.setEnabled(false); | ||
2226 | 1058 | deleteAction.setEnabled(false); | 950 | deleteAction.setEnabled(false); |
2227 | 1059 | selectAllAction.setEnabled(false); | 951 | selectAllAction.setEnabled(false); |
2228 | 1060 | selectAction.setEnabled(false); | ||
2229 | 1061 | deleteTokenAction.setEnabled(false); | ||
2230 | 1062 | 952 | ||
2231 | 1063 | alignToGrid.setEnabled(false); | 953 | alignToGrid.setEnabled(false); |
2232 | 1064 | 954 | ||
2233 | @@ -1066,9 +956,6 @@ | |||
2234 | 1066 | showConstantsAction.setEnabled(false); | 956 | showConstantsAction.setEnabled(false); |
2235 | 1067 | showQueriesAction.setEnabled(false); | 957 | showQueriesAction.setEnabled(false); |
2236 | 1068 | 958 | ||
2237 | 1069 | timeAction.setEnabled(true); | ||
2238 | 1070 | |||
2239 | 1071 | delayFireAction.setEnabled(true); | ||
2240 | 1072 | stepbackwardAction.setEnabled(true); | 959 | stepbackwardAction.setEnabled(true); |
2241 | 1073 | stepforwardAction.setEnabled(true); | 960 | stepforwardAction.setEnabled(true); |
2242 | 1074 | prevcomponentAction.setEnabled(true); | 961 | prevcomponentAction.setEnabled(true); |
2243 | @@ -1091,7 +978,6 @@ | |||
2244 | 1091 | 978 | ||
2245 | 1092 | getCurrentTab().getAnimationController().requestFocusInWindow(); | 979 | getCurrentTab().getAnimationController().requestFocusInWindow(); |
2246 | 1093 | 980 | ||
2247 | 1094 | statusBar.changeText(StatusBar.textforAnimation); | ||
2248 | 1095 | //Enable simulator focus traversal policy | 981 | //Enable simulator focus traversal policy |
2249 | 1096 | setFocusTraversalPolicy(new SimulatorFocusTraversalPolicy()); | 982 | setFocusTraversalPolicy(new SimulatorFocusTraversalPolicy()); |
2250 | 1097 | 983 | ||
2251 | @@ -1101,21 +987,9 @@ | |||
2252 | 1101 | importTraceAction.setEnabled(false); | 987 | importTraceAction.setEnabled(false); |
2253 | 1102 | verifyAction.setEnabled(false); | 988 | verifyAction.setEnabled(false); |
2254 | 1103 | 989 | ||
2255 | 1104 | timedPlaceAction.setEnabled(false); | ||
2256 | 1105 | timedArcAction.setEnabled(false); | ||
2257 | 1106 | inhibarcAction.setEnabled(false); | ||
2258 | 1107 | transportArcAction.setEnabled(false); | ||
2259 | 1108 | |||
2260 | 1109 | annotationAction.setEnabled(false); | 990 | annotationAction.setEnabled(false); |
2261 | 1110 | transAction.setEnabled(false); | ||
2262 | 1111 | tokenAction.setEnabled(false); | ||
2263 | 1112 | deleteAction.setEnabled(false); | ||
2264 | 1113 | selectAllAction.setEnabled(false); | 991 | selectAllAction.setEnabled(false); |
2265 | 1114 | selectAction.setEnabled(false); | ||
2266 | 1115 | deleteTokenAction.setEnabled(false); | ||
2267 | 1116 | 992 | ||
2268 | 1117 | timeAction.setEnabled(false); | ||
2269 | 1118 | delayFireAction.setEnabled(false); | ||
2270 | 1119 | stepbackwardAction.setEnabled(false); | 993 | stepbackwardAction.setEnabled(false); |
2271 | 1120 | stepforwardAction.setEnabled(false); | 994 | stepforwardAction.setEnabled(false); |
2272 | 1121 | 995 | ||
2273 | @@ -1135,7 +1009,7 @@ | |||
2274 | 1135 | enableAllActions(false); | 1009 | enableAllActions(false); |
2275 | 1136 | 1010 | ||
2276 | 1137 | // Disable All Actions | 1011 | // Disable All Actions |
2278 | 1138 | statusBar.changeText(StatusBar.textforNoNet); | 1012 | statusBar.changeText("Open a net to start editing"); |
2279 | 1139 | setFocusTraversalPolicy(null); | 1013 | setFocusTraversalPolicy(null); |
2280 | 1140 | 1014 | ||
2281 | 1141 | break; | 1015 | break; |
2282 | @@ -1262,6 +1136,9 @@ | |||
2283 | 1262 | break; | 1136 | break; |
2284 | 1263 | case noNet: | 1137 | case noNet: |
2285 | 1264 | setFeatureInfoText(null); | 1138 | setFeatureInfoText(null); |
2286 | 1139 | registerDrawingActions(List.of()); | ||
2287 | 1140 | registerAnimationActions(List.of()); | ||
2288 | 1141 | //registerViewActions(List.of()); | ||
2289 | 1265 | break; | 1142 | break; |
2290 | 1266 | 1143 | ||
2291 | 1267 | default: | 1144 | default: |
2292 | @@ -1270,7 +1147,74 @@ | |||
2293 | 1270 | 1147 | ||
2294 | 1271 | // Enable actions based on GUI mode | 1148 | // Enable actions based on GUI mode |
2295 | 1272 | enableGUIActions(mode); | 1149 | enableGUIActions(mode); |
2297 | 1273 | 1150 | if (currentTab != null) { | |
2298 | 1151 | currentTab.ifPresent(o -> o.updateEnabledActions(mode)); | ||
2299 | 1152 | } | ||
2300 | 1153 | } | ||
2301 | 1154 | |||
2302 | 1155 | @Override | ||
2303 | 1156 | public void registerDrawingActions(@NotNull List<GuiAction> drawActions) { | ||
2304 | 1157 | |||
2305 | 1158 | drawingToolBar.removeAll(); | ||
2306 | 1159 | drawMenu.removeAll(); | ||
2307 | 1160 | |||
2308 | 1161 | if (drawActions.size() > 0) { | ||
2309 | 1162 | drawMenu.setEnabled(true); | ||
2310 | 1163 | drawingToolBar.addSeparator(); | ||
2311 | 1164 | |||
2312 | 1165 | for (GuiAction action : drawActions) { | ||
2313 | 1166 | drawingToolBar.add(new ToggleButtonWithoutText(action)); | ||
2314 | 1167 | drawMenu.add(action); | ||
2315 | 1168 | } | ||
2316 | 1169 | |||
2317 | 1170 | drawingToolBar.addSeparator(); | ||
2318 | 1171 | drawingToolBar.add(featureInfoText); | ||
2319 | 1172 | } else { | ||
2320 | 1173 | drawMenu.setEnabled(false); | ||
2321 | 1174 | } | ||
2322 | 1175 | |||
2323 | 1176 | } | ||
2324 | 1177 | @Override | ||
2325 | 1178 | public void registerAnimationActions(@NotNull List<GuiAction> animationActions) { | ||
2326 | 1179 | |||
2327 | 1180 | animateMenu.removeAll(); | ||
2328 | 1181 | |||
2329 | 1182 | if (animationActions.size() > 0) { | ||
2330 | 1183 | |||
2331 | 1184 | animateMenu.setEnabled(true); | ||
2332 | 1185 | animateMenu.add(startAction); | ||
2333 | 1186 | |||
2334 | 1187 | animateMenu.add(stepbackwardAction); | ||
2335 | 1188 | animateMenu.add(stepforwardAction); | ||
2336 | 1189 | |||
2337 | 1190 | for (GuiAction action : animationActions) { | ||
2338 | 1191 | animateMenu.add(action); | ||
2339 | 1192 | } | ||
2340 | 1193 | |||
2341 | 1194 | animateMenu.add(prevcomponentAction); | ||
2342 | 1195 | animateMenu.add(nextcomponentAction); | ||
2343 | 1196 | |||
2344 | 1197 | animateMenu.addSeparator(); | ||
2345 | 1198 | animateMenu.add(exportTraceAction); | ||
2346 | 1199 | animateMenu.add(importTraceAction); | ||
2347 | 1200 | } else { | ||
2348 | 1201 | animateMenu.setEnabled(false); | ||
2349 | 1202 | } | ||
2350 | 1203 | } | ||
2351 | 1204 | |||
2352 | 1205 | @Override | ||
2353 | 1206 | public void registerViewActions(@NotNull List<GuiAction> viewActions) { | ||
2354 | 1207 | //TODO: This is a temporary implementation until view actions can be moved to tab content | ||
2355 | 1208 | |||
2356 | 1209 | if (!getCurrentTab().getLens().isTimed()) { | ||
2357 | 1210 | showZeroToInfinityIntervalsCheckBox.setVisible(false); | ||
2358 | 1211 | showTokenAgeCheckBox.setVisible(false); | ||
2359 | 1212 | showDelayEnabledTransitionsCheckbox.setVisible(false); | ||
2360 | 1213 | } else { | ||
2361 | 1214 | showZeroToInfinityIntervalsCheckBox.setVisible(true); | ||
2362 | 1215 | showTokenAgeCheckBox.setVisible(true); | ||
2363 | 1216 | showDelayEnabledTransitionsCheckbox.setVisible(true); | ||
2364 | 1217 | } | ||
2365 | 1274 | } | 1218 | } |
2366 | 1275 | 1219 | ||
2367 | 1276 | private void fixBug812694GrayMenuAfterSimulationOnMac() { | 1220 | private void fixBug812694GrayMenuAfterSimulationOnMac() { |
2368 | @@ -1284,24 +1228,9 @@ | |||
2369 | 1284 | a.dispose(); | 1228 | a.dispose(); |
2370 | 1285 | } | 1229 | } |
2371 | 1286 | 1230 | ||
2372 | 1287 | //XXX temp while refactoring, kyrke - 2019-07-25, should only be called from TabContent | ||
2373 | 1288 | @Override | 1231 | @Override |
2390 | 1289 | public void updateMode(Pipe.ElementType _mode) { | 1232 | public void setStatusBarText(String s) { |
2391 | 1290 | 1233 | statusBar.changeText(Objects.requireNonNullElse(s, "")); | |
2376 | 1291 | mode = _mode; | ||
2377 | 1292 | |||
2378 | 1293 | // deselect other actions | ||
2379 | 1294 | transAction.setSelected(mode == ElementType.TAPNTRANS); | ||
2380 | 1295 | timedPlaceAction.setSelected(mode == ElementType.TAPNPLACE); | ||
2381 | 1296 | timedArcAction.setSelected(mode == ElementType.TAPNARC); | ||
2382 | 1297 | transportArcAction.setSelected(mode == ElementType.TRANSPORTARC); | ||
2383 | 1298 | inhibarcAction.setSelected(mode == ElementType.TAPNINHIBITOR_ARC); | ||
2384 | 1299 | tokenAction.setSelected(mode == ElementType.ADDTOKEN); | ||
2385 | 1300 | deleteTokenAction.setSelected(mode == ElementType.DELTOKEN); | ||
2386 | 1301 | selectAction.setSelected(mode == ElementType.SELECT); | ||
2387 | 1302 | annotationAction.setSelected(mode == ElementType.ANNOTATION); | ||
2388 | 1303 | |||
2389 | 1304 | statusBar.changeText(mode); | ||
2392 | 1305 | } | 1234 | } |
2393 | 1306 | 1235 | ||
2394 | 1307 | 1236 | ||
2395 | @@ -1368,10 +1297,6 @@ | |||
2396 | 1368 | showTokenAgeAction.setSelected(b); | 1297 | showTokenAgeAction.setSelected(b); |
2397 | 1369 | } | 1298 | } |
2398 | 1370 | 1299 | ||
2399 | 1371 | public Pipe.ElementType getMode() { | ||
2400 | 1372 | return mode; | ||
2401 | 1373 | } | ||
2402 | 1374 | |||
2403 | 1375 | public void setTitle(String title) { | 1300 | public void setTitle(String title) { |
2404 | 1376 | super.setTitle((title == null) ? frameTitle : frameTitle + ": " + title); | 1301 | super.setTitle((title == null) ? frameTitle : frameTitle + ": " + title); |
2405 | 1377 | } | 1302 | } |
2406 | @@ -1403,7 +1328,6 @@ | |||
2407 | 1403 | zoomComboBox.addActionListener(zoomComboListener); | 1328 | zoomComboBox.addActionListener(zoomComboListener); |
2408 | 1404 | } | 1329 | } |
2409 | 1405 | 1330 | ||
2410 | 1406 | |||
2411 | 1407 | private boolean canNetBeSavedAndShowMessage() { | 1331 | private boolean canNetBeSavedAndShowMessage() { |
2412 | 1408 | if (getCurrentTab().network().paintNet()) { | 1332 | if (getCurrentTab().network().paintNet()) { |
2413 | 1409 | return true; | 1333 | return true; |
2414 | 1410 | 1334 | ||
2415 | === modified file 'src/pipe/gui/GuiFrameActions.java' | |||
2416 | --- src/pipe/gui/GuiFrameActions.java 2020-08-04 19:07:12 +0000 | |||
2417 | +++ src/pipe/gui/GuiFrameActions.java 2020-08-19 11:36:17 +0000 | |||
2418 | @@ -3,8 +3,10 @@ | |||
2419 | 3 | import dk.aau.cs.gui.TabContent; | 3 | import dk.aau.cs.gui.TabContent; |
2420 | 4 | import dk.aau.cs.gui.TabContentActions; | 4 | import dk.aau.cs.gui.TabContentActions; |
2421 | 5 | import net.tapaal.helpers.Reference.Reference; | 5 | import net.tapaal.helpers.Reference.Reference; |
2422 | 6 | import pipe.gui.action.GuiAction; | ||
2423 | 6 | 7 | ||
2424 | 7 | import java.awt.*; | 8 | import java.awt.*; |
2425 | 9 | import java.util.List; | ||
2426 | 8 | 10 | ||
2427 | 9 | /** | 11 | /** |
2428 | 10 | * Used to delegate control of the state of AppGUI to tabs | 12 | * Used to delegate control of the state of AppGUI to tabs |
2429 | @@ -26,8 +28,13 @@ | |||
2430 | 26 | 28 | ||
2431 | 27 | void setGUIMode(GuiFrame.GUIMode animation); | 29 | void setGUIMode(GuiFrame.GUIMode animation); |
2432 | 28 | 30 | ||
2435 | 29 | //XXX temp while refactoring, kyrke - 2019-07-25 | 31 | void registerDrawingActions(List<GuiAction> drawActions); |
2436 | 30 | void updateMode(Pipe.ElementType mode); | 32 | |
2437 | 33 | void registerAnimationActions(List<GuiAction> animationActions); | ||
2438 | 34 | |||
2439 | 35 | void registerViewActions(List<GuiAction> viewActions); | ||
2440 | 36 | |||
2441 | 37 | void setStatusBarText(String s); | ||
2442 | 31 | 38 | ||
2443 | 32 | void registerController(GuiFrameControllerActions guiFrameController, Reference<TabContentActions> currentTab); | 39 | void registerController(GuiFrameControllerActions guiFrameController, Reference<TabContentActions> currentTab); |
2444 | 33 | 40 | ||
2445 | 34 | 41 | ||
2446 | === modified file 'src/pipe/gui/GuiFrameController.java' | |||
2447 | --- src/pipe/gui/GuiFrameController.java 2020-08-10 09:25:25 +0000 | |||
2448 | +++ src/pipe/gui/GuiFrameController.java 2020-08-19 11:36:17 +0000 | |||
2449 | @@ -85,7 +85,7 @@ | |||
2450 | 85 | 85 | ||
2451 | 86 | DelayEnabledTransitionControl.setDefaultDelayMode(prefs.getDelayEnabledTransitionDelayMode()); | 86 | DelayEnabledTransitionControl.setDefaultDelayMode(prefs.getDelayEnabledTransitionDelayMode()); |
2452 | 87 | DelayEnabledTransitionControl.setDefaultGranularity(prefs.getDelayEnabledTransitionGranularity()); | 87 | DelayEnabledTransitionControl.setDefaultGranularity(prefs.getDelayEnabledTransitionGranularity()); |
2454 | 88 | DelayEnabledTransitionControl.setDefaultIsRandomTransition(prefs.getDelayEnabledTransitionIsRandomTransition()); | 88 | SimulationControl.setDefaultIsRandomTransition(prefs.getDelayEnabledTransitionIsRandomTransition()); |
2455 | 89 | 89 | ||
2456 | 90 | showToolTips = prefs.getShowToolTips(); | 90 | showToolTips = prefs.getShowToolTips(); |
2457 | 91 | setDisplayToolTips(showToolTips); | 91 | setDisplayToolTips(showToolTips); |
2458 | @@ -221,7 +221,7 @@ | |||
2459 | 221 | prefs.setShowTokenAge(guiFrameDirectAccess.showTokenAge()); | 221 | prefs.setShowTokenAge(guiFrameDirectAccess.showTokenAge()); |
2460 | 222 | prefs.setDelayEnabledTransitionDelayMode(DelayEnabledTransitionControl.getDefaultDelayMode()); | 222 | prefs.setDelayEnabledTransitionDelayMode(DelayEnabledTransitionControl.getDefaultDelayMode()); |
2461 | 223 | prefs.setDelayEnabledTransitionGranularity(DelayEnabledTransitionControl.getDefaultGranularity()); | 223 | prefs.setDelayEnabledTransitionGranularity(DelayEnabledTransitionControl.getDefaultGranularity()); |
2463 | 224 | prefs.setDelayEnabledTransitionIsRandomTransition(DelayEnabledTransitionControl.isRandomTransition()); | 224 | prefs.setDelayEnabledTransitionIsRandomTransition(SimulationControl.isRandomTransition()); |
2464 | 225 | 225 | ||
2465 | 226 | JOptionPane.showMessageDialog(guiFrameDirectAccess, | 226 | JOptionPane.showMessageDialog(guiFrameDirectAccess, |
2466 | 227 | "The workspace has now been saved into your preferences.\n" | 227 | "The workspace has now been saved into your preferences.\n" |
2467 | @@ -726,7 +726,7 @@ | |||
2468 | 726 | //showDelayEnabledTransitions(advanced); | 726 | //showDelayEnabledTransitions(advanced); |
2469 | 727 | DelayEnabledTransitionControl.getInstance().setValue(new BigDecimal("0.1")); | 727 | DelayEnabledTransitionControl.getInstance().setValue(new BigDecimal("0.1")); |
2470 | 728 | DelayEnabledTransitionControl.getInstance().setDelayMode(ShortestDelayMode.getInstance()); | 728 | DelayEnabledTransitionControl.getInstance().setDelayMode(ShortestDelayMode.getInstance()); |
2472 | 729 | DelayEnabledTransitionControl.getInstance().setRandomTransitionMode(false); | 729 | SimulationControl.getInstance().setRandomTransitionMode(false); |
2473 | 730 | } | 730 | } |
2474 | 731 | 731 | ||
2475 | 732 | } | 732 | } |
2476 | 733 | 733 | ||
2477 | === modified file 'src/pipe/gui/SimulationControl.java' | |||
2478 | --- src/pipe/gui/SimulationControl.java 2020-06-21 11:16:52 +0000 | |||
2479 | +++ src/pipe/gui/SimulationControl.java 2020-08-19 11:36:17 +0000 | |||
2480 | @@ -22,9 +22,10 @@ | |||
2481 | 22 | 22 | ||
2482 | 23 | final JSlider simulationSpeed = new JSlider(); | 23 | final JSlider simulationSpeed = new JSlider(); |
2483 | 24 | final JCheckBox randomSimulation = new JCheckBox("Enable automatic random simulation"); | 24 | final JCheckBox randomSimulation = new JCheckBox("Enable automatic random simulation"); |
2487 | 25 | final Timer timer = new Timer(simulationSpeed.getValue()*20, e -> CreateGui.getCurrentTab().getTransitionFireingComponent().fireSelectedTransition()); | 25 | final JCheckBox randomMode = new JCheckBox("Choose next transition randomly"); |
2488 | 26 | 26 | final Timer timer = new Timer(simulationSpeed.getValue()*20, e -> CreateGui.getCurrentTab().getTransitionFireingComponent().fireSelectedTransition()); | |
2489 | 27 | private static SimulationControl instance; | 27 | private static boolean defaultIsRandomTrasition; |
2490 | 28 | private static SimulationControl instance; | ||
2491 | 28 | 29 | ||
2492 | 29 | public static SimulationControl getInstance(){ | 30 | public static SimulationControl getInstance(){ |
2493 | 30 | if(instance == null){ | 31 | if(instance == null){ |
2494 | @@ -62,13 +63,23 @@ | |||
2495 | 62 | gbc.gridx = 0; | 63 | gbc.gridx = 0; |
2496 | 63 | gbc.gridy = 0; | 64 | gbc.gridy = 0; |
2497 | 64 | add(randomSimulation, gbc); | 65 | add(randomSimulation, gbc); |
2499 | 65 | 66 | ||
2500 | 66 | gbc = new GridBagConstraints(); | 67 | gbc = new GridBagConstraints(); |
2501 | 68 | gbc.anchor = GridBagConstraints.WEST; | ||
2502 | 69 | gbc.fill = GridBagConstraints.HORIZONTAL; | ||
2503 | 70 | gbc.weightx = 1.0; | ||
2504 | 71 | gbc.gridx = 0; | ||
2505 | 72 | gbc.gridy = 1; | ||
2506 | 73 | add(randomMode, gbc); | ||
2507 | 74 | |||
2508 | 75 | setRandomTransitionMode(defaultIsRandomTrasition); | ||
2509 | 76 | |||
2510 | 77 | gbc = new GridBagConstraints(); | ||
2511 | 67 | gbc.anchor = GridBagConstraints.WEST; | 78 | gbc.anchor = GridBagConstraints.WEST; |
2512 | 68 | gbc.fill = GridBagConstraints.HORIZONTAL; | 79 | gbc.fill = GridBagConstraints.HORIZONTAL; |
2513 | 69 | gbc.weightx = 1.0; | 80 | gbc.weightx = 1.0; |
2514 | 70 | gbc.gridx = 0; | 81 | gbc.gridx = 0; |
2516 | 71 | gbc.gridy = 1; | 82 | gbc.gridy = 2; |
2517 | 72 | add(new JLabel("Set simulation speed:"), gbc); | 83 | add(new JLabel("Set simulation speed:"), gbc); |
2518 | 73 | 84 | ||
2519 | 74 | gbc = new GridBagConstraints(); | 85 | gbc = new GridBagConstraints(); |
2520 | @@ -76,7 +87,7 @@ | |||
2521 | 76 | gbc.fill = GridBagConstraints.HORIZONTAL; | 87 | gbc.fill = GridBagConstraints.HORIZONTAL; |
2522 | 77 | gbc.weightx = 1.0; | 88 | gbc.weightx = 1.0; |
2523 | 78 | gbc.gridx = 0; | 89 | gbc.gridx = 0; |
2525 | 79 | gbc.gridy = 2; | 90 | gbc.gridy = 3; |
2526 | 80 | add(simulationSpeed, gbc); | 91 | add(simulationSpeed, gbc); |
2527 | 81 | 92 | ||
2528 | 82 | setBorder(BorderFactory.createCompoundBorder( | 93 | setBorder(BorderFactory.createCompoundBorder( |
2529 | @@ -159,4 +170,26 @@ | |||
2530 | 159 | dialog.setLocation(x, y); | 170 | dialog.setLocation(x, y); |
2531 | 160 | dialog.setVisible(true); | 171 | dialog.setVisible(true); |
2532 | 161 | } | 172 | } |
2533 | 173 | |||
2534 | 174 | public boolean isRandomTransitionMode(){ | ||
2535 | 175 | if(SimulationControl.getInstance().randomSimulation()){ | ||
2536 | 176 | return true; | ||
2537 | 177 | } else { | ||
2538 | 178 | return randomMode.isSelected(); | ||
2539 | 179 | } | ||
2540 | 180 | } | ||
2541 | 181 | |||
2542 | 182 | public void setRandomTransitionMode(boolean randomTransition){ | ||
2543 | 183 | randomMode.setSelected(randomTransition); | ||
2544 | 184 | } | ||
2545 | 185 | public static boolean isRandomTransition(){ | ||
2546 | 186 | if(instance != null){ | ||
2547 | 187 | return getInstance().isRandomTransitionMode(); | ||
2548 | 188 | } else { | ||
2549 | 189 | return defaultIsRandomTrasition; | ||
2550 | 190 | } | ||
2551 | 191 | } | ||
2552 | 192 | public static void setDefaultIsRandomTransition(boolean delayEnabledTransitionIsRandomTransition) { | ||
2553 | 193 | defaultIsRandomTrasition = delayEnabledTransitionIsRandomTransition; | ||
2554 | 194 | } | ||
2555 | 162 | } | 195 | } |
2556 | 163 | 196 | ||
2557 | === modified file 'src/pipe/gui/StatusBar.java' | |||
2558 | --- src/pipe/gui/StatusBar.java 2020-07-13 13:58:47 +0000 | |||
2559 | +++ src/pipe/gui/StatusBar.java 2020-08-19 11:36:17 +0000 | |||
2560 | @@ -8,41 +8,11 @@ | |||
2561 | 8 | /* Status Bar to let users know what to do*/ | 8 | /* Status Bar to let users know what to do*/ |
2562 | 9 | public class StatusBar extends JPanel { | 9 | public class StatusBar extends JPanel { |
2563 | 10 | 10 | ||
2564 | 11 | /* Provides the appropriate text for the mode that the user is in */ | ||
2565 | 12 | public static final String textforNoNet = "Open a net to start editing"; | ||
2566 | 13 | |||
2567 | 14 | public static final String textforDrawing = "Drawing Mode: Click on a button to start adding components to the " | ||
2568 | 15 | + "Editor"; | ||
2569 | 16 | public static final String textforPlace = "Place Mode: Right click on a place to see menu options " | ||
2570 | 17 | + ""; | ||
2571 | 18 | public static final String textforTAPNPlace = "Place Mode: Right click on a place to see menu options " | ||
2572 | 19 | + ""; | ||
2573 | 20 | public static final String textforTrans = "Transition Mode: Right click on a transition to see menu " | ||
2574 | 21 | + "options [Mouse wheel -> rotate]"; | ||
2575 | 22 | public static final String textforTimedTrans = "Timed Transition Mode: Right click on a transition to see menu " | ||
2576 | 23 | + "options [Mouse wheel -> rotate]"; | ||
2577 | 24 | public static final String textforAddtoken = "Add Token Mode: Click on a place to add a token"; | ||
2578 | 25 | public static final String textforDeltoken = "Delete Token Mode: Click on a place to delete a token "; | ||
2579 | 26 | public static final String textforAnimation = "Simulation Mode: Red transitions are enabled, click a transition to " | ||
2580 | 27 | + "fire it"; | ||
2581 | 28 | public static final String textforArc = "Arc Mode: Right click on an arc to see menu options " | ||
2582 | 29 | + ""; | ||
2583 | 30 | public static final String textforTransportArc = "Transport Arc Mode: Right click on an arc to see menu options " | ||
2584 | 31 | + ""; | ||
2585 | 32 | public static final String textforInhibArc = "Inhibitor Mode: Right click on an arc to see menu options " | ||
2586 | 33 | + ""; | ||
2587 | 34 | public static final String textforMove = "Select Mode: Click/drag to select objects; drag to move them"; | ||
2588 | 35 | public static final String textforAnnotation = "Annotation Mode: Right click on an annotation to see menu options; " | ||
2589 | 36 | + "double click to edit"; | ||
2590 | 37 | |||
2591 | 38 | public static final String textforDrag = "Drag Mode"; | ||
2592 | 39 | |||
2593 | 40 | |||
2594 | 41 | private final JLabel label; | 11 | private final JLabel label; |
2595 | 42 | 12 | ||
2596 | 43 | public StatusBar() { | 13 | public StatusBar() { |
2597 | 44 | super(); | 14 | super(); |
2599 | 45 | label = new JLabel(textforDrawing); // got to put something in there | 15 | label = new JLabel(""); |
2600 | 46 | this.setLayout(new BorderLayout(0, 0)); | 16 | this.setLayout(new BorderLayout(0, 0)); |
2601 | 47 | this.add(label); | 17 | this.add(label); |
2602 | 48 | } | 18 | } |
2603 | @@ -51,67 +21,6 @@ | |||
2604 | 51 | label.setText(newText); | 21 | label.setText(newText); |
2605 | 52 | } | 22 | } |
2606 | 53 | 23 | ||
2669 | 54 | public void changeText(Pipe.ElementType type) { | 24 | |
2608 | 55 | switch (type) { | ||
2609 | 56 | case PLACE: | ||
2610 | 57 | changeText(textforPlace); | ||
2611 | 58 | break; | ||
2612 | 59 | |||
2613 | 60 | case TAPNPLACE: | ||
2614 | 61 | changeText(textforTAPNPlace); | ||
2615 | 62 | break; | ||
2616 | 63 | |||
2617 | 64 | case IMMTRANS: | ||
2618 | 65 | case TAPNTRANS: | ||
2619 | 66 | changeText(textforTrans); | ||
2620 | 67 | break; | ||
2621 | 68 | |||
2622 | 69 | case TIMEDTRANS: | ||
2623 | 70 | changeText(textforTimedTrans); | ||
2624 | 71 | break; | ||
2625 | 72 | |||
2626 | 73 | case ARC: | ||
2627 | 74 | case TAPNARC: | ||
2628 | 75 | changeText(textforArc); | ||
2629 | 76 | break; | ||
2630 | 77 | |||
2631 | 78 | case TRANSPORTARC: | ||
2632 | 79 | changeText(textforTransportArc); | ||
2633 | 80 | break; | ||
2634 | 81 | |||
2635 | 82 | case TAPNINHIBITOR_ARC: | ||
2636 | 83 | case INHIBARC: | ||
2637 | 84 | changeText(textforInhibArc); | ||
2638 | 85 | break; | ||
2639 | 86 | |||
2640 | 87 | case ADDTOKEN: | ||
2641 | 88 | changeText(textforAddtoken); | ||
2642 | 89 | break; | ||
2643 | 90 | |||
2644 | 91 | case DELTOKEN: | ||
2645 | 92 | changeText(textforDeltoken); | ||
2646 | 93 | break; | ||
2647 | 94 | |||
2648 | 95 | case SELECT: | ||
2649 | 96 | changeText(textforMove); | ||
2650 | 97 | break; | ||
2651 | 98 | |||
2652 | 99 | case DRAW: | ||
2653 | 100 | changeText(textforDrawing); | ||
2654 | 101 | break; | ||
2655 | 102 | |||
2656 | 103 | case ANNOTATION: | ||
2657 | 104 | changeText(textforAnnotation); | ||
2658 | 105 | break; | ||
2659 | 106 | |||
2660 | 107 | case DRAG: | ||
2661 | 108 | changeText(textforDrag); | ||
2662 | 109 | break; | ||
2663 | 110 | |||
2664 | 111 | default: | ||
2665 | 112 | changeText("To-do (textfor" + type); | ||
2666 | 113 | break; | ||
2667 | 114 | } | ||
2668 | 115 | } | ||
2670 | 116 | 25 | ||
2671 | 117 | } | 26 | } |
2672 | 118 | 27 | ||
2673 | === modified file 'src/pipe/gui/action/GuiAction.java' | |||
2674 | --- src/pipe/gui/action/GuiAction.java 2020-07-20 07:19:51 +0000 | |||
2675 | +++ src/pipe/gui/action/GuiAction.java 2020-08-19 11:36:17 +0000 | |||
2676 | @@ -109,4 +109,12 @@ | |||
2677 | 109 | 109 | ||
2678 | 110 | } | 110 | } |
2679 | 111 | 111 | ||
2680 | 112 | public void setName(String newName){ | ||
2681 | 113 | putValue(NAME, newName); | ||
2682 | 114 | } | ||
2683 | 115 | |||
2684 | 116 | public void setTooltip(String newTooltip){ | ||
2685 | 117 | putValue(SHORT_DESCRIPTION, newTooltip); | ||
2686 | 118 | } | ||
2687 | 119 | |||
2688 | 112 | } | 120 | } |
2689 | 113 | 121 | ||
2690 | === modified file 'src/pipe/gui/canvas/DrawingSurfaceImpl.java' | |||
2691 | --- src/pipe/gui/canvas/DrawingSurfaceImpl.java 2020-08-10 06:46:22 +0000 | |||
2692 | +++ src/pipe/gui/canvas/DrawingSurfaceImpl.java 2020-08-19 11:36:17 +0000 | |||
2693 | @@ -412,7 +412,7 @@ | |||
2694 | 412 | 412 | ||
2695 | 413 | if (SwingUtilities.isLeftMouseButton(e)) { | 413 | if (SwingUtilities.isLeftMouseButton(e)) { |
2696 | 414 | 414 | ||
2698 | 415 | Pipe.ElementType mode = app.getMode(); | 415 | Pipe.ElementType mode = CreateGui.guiMode; |
2699 | 416 | 416 | ||
2700 | 417 | switch (mode) { | 417 | switch (mode) { |
2701 | 418 | case DRAG: | 418 | case DRAG: |
2702 | @@ -443,7 +443,7 @@ | |||
2703 | 443 | dragStart = null; | 443 | dragStart = null; |
2704 | 444 | setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); | 444 | setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
2705 | 445 | } | 445 | } |
2707 | 446 | if (app.getMode() == ElementType.SELECT) { | 446 | if (CreateGui.guiMode == ElementType.SELECT) { |
2708 | 447 | getSelectionObject().dispatchEvent(e); | 447 | getSelectionObject().dispatchEvent(e); |
2709 | 448 | } | 448 | } |
2710 | 449 | } | 449 | } |
2711 | @@ -461,9 +461,9 @@ | |||
2712 | 461 | if (managerRef!=null && managerRef.get() != null) { | 461 | if (managerRef!=null && managerRef.get() != null) { |
2713 | 462 | managerRef.get().drawingSurfaceMouseDragged(e); | 462 | managerRef.get().drawingSurfaceMouseDragged(e); |
2714 | 463 | } | 463 | } |
2716 | 464 | if (dragStart != null) { | 464 | if (dragStart != null) { |
2717 | 465 | view.drag(dragStart, e.getPoint()); | 465 | view.drag(dragStart, e.getPoint()); |
2719 | 466 | } else if (app.getMode() == ElementType.SELECT) { | 466 | } else if (CreateGui.guiMode == ElementType.SELECT) { |
2720 | 467 | getSelectionObject().dispatchEvent(e); | 467 | getSelectionObject().dispatchEvent(e); |
2721 | 468 | } | 468 | } |
2722 | 469 | } | 469 | } |
2723 | 470 | 470 | ||
2724 | === modified file 'src/pipe/gui/graphicElements/PetriNetObject.java' | |||
2725 | --- src/pipe/gui/graphicElements/PetriNetObject.java 2020-06-30 06:41:30 +0000 | |||
2726 | +++ src/pipe/gui/graphicElements/PetriNetObject.java 2020-08-19 11:36:17 +0000 | |||
2727 | @@ -3,6 +3,8 @@ | |||
2728 | 3 | import java.awt.Graphics; | 3 | import java.awt.Graphics; |
2729 | 4 | import java.awt.Rectangle; | 4 | import java.awt.Rectangle; |
2730 | 5 | import java.awt.event.*; | 5 | import java.awt.event.*; |
2731 | 6 | |||
2732 | 7 | import dk.aau.cs.gui.TabContent; | ||
2733 | 6 | import pipe.dataLayer.DataLayer; | 8 | import pipe.dataLayer.DataLayer; |
2734 | 7 | import pipe.gui.canvas.DrawingSurfaceImpl; | 9 | import pipe.gui.canvas.DrawingSurfaceImpl; |
2735 | 8 | import pipe.gui.Pipe; | 10 | import pipe.gui.Pipe; |
2736 | @@ -19,6 +21,7 @@ | |||
2737 | 19 | /** x/y position position on screen (zoomed) */ | 21 | /** x/y position position on screen (zoomed) */ |
2738 | 20 | protected int positionX; | 22 | protected int positionX; |
2739 | 21 | protected int positionY; | 23 | protected int positionY; |
2740 | 24 | protected TabContent.TAPNLens lens = TabContent.TAPNLens.Default; | ||
2741 | 22 | 25 | ||
2742 | 23 | // The x/y coordinate of object at 100% zoom. | 26 | // The x/y coordinate of object at 100% zoom. |
2743 | 24 | //XXX: pushed down from PlaceTransitionObject and consolidated from note, need further refactoring and rename, //kyrke 2019-08-23 | 27 | //XXX: pushed down from PlaceTransitionObject and consolidated from note, need further refactoring and rename, //kyrke 2019-08-23 |
2744 | @@ -285,6 +288,14 @@ | |||
2745 | 285 | return positionY; | 288 | return positionY; |
2746 | 286 | } | 289 | } |
2747 | 287 | 290 | ||
2748 | 291 | public boolean isTimed(){ | ||
2749 | 292 | return lens.isTimed(); | ||
2750 | 293 | } | ||
2751 | 294 | |||
2752 | 295 | public void setLens(TabContent.TAPNLens lens){ | ||
2753 | 296 | this.lens = lens; | ||
2754 | 297 | } | ||
2755 | 298 | |||
2756 | 288 | @Override | 299 | @Override |
2757 | 289 | public GraphicalElement getGraphicalElement() { | 300 | public GraphicalElement getGraphicalElement() { |
2758 | 290 | return this; | 301 | return this; |
2759 | 291 | 302 | ||
2760 | === modified file 'src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java' | |||
2761 | --- src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java 2020-07-20 07:19:51 +0000 | |||
2762 | +++ src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java 2020-08-19 11:36:17 +0000 | |||
2763 | @@ -2,6 +2,7 @@ | |||
2764 | 2 | 2 | ||
2765 | 3 | import java.util.Hashtable; | 3 | import java.util.Hashtable; |
2766 | 4 | 4 | ||
2767 | 5 | import dk.aau.cs.gui.TabContent; | ||
2768 | 5 | import pipe.gui.CreateGui; | 6 | import pipe.gui.CreateGui; |
2769 | 6 | import pipe.gui.Pipe; | 7 | import pipe.gui.Pipe; |
2770 | 7 | import pipe.gui.graphicElements.PlaceTransitionObject; | 8 | import pipe.gui.graphicElements.PlaceTransitionObject; |
2771 | @@ -24,11 +25,12 @@ | |||
2772 | 24 | updateLabel(true); | 25 | updateLabel(true); |
2773 | 25 | } | 26 | } |
2774 | 26 | 27 | ||
2776 | 27 | public TimedInputArcComponent(PlaceTransitionObject source, PlaceTransitionObject target, TimedInputArc modelArc){ | 28 | public TimedInputArcComponent(PlaceTransitionObject source, PlaceTransitionObject target, TimedInputArc modelArc, TabContent.TAPNLens lens){ |
2777 | 28 | super(source); | 29 | super(source); |
2778 | 29 | setTarget(target); | 30 | setTarget(target); |
2779 | 30 | setUnderlyingArc(modelArc); | 31 | setUnderlyingArc(modelArc); |
2780 | 31 | updateLabel(true); | 32 | updateLabel(true); |
2781 | 33 | this.lens = lens; | ||
2782 | 32 | sealArc(); | 34 | sealArc(); |
2783 | 33 | } | 35 | } |
2784 | 34 | 36 | ||
2785 | @@ -37,6 +39,12 @@ | |||
2786 | 37 | updateLabel(true); | 39 | updateLabel(true); |
2787 | 38 | } | 40 | } |
2788 | 39 | 41 | ||
2789 | 42 | public TimedInputArcComponent(TimedOutputArcComponent arc, TabContent.TAPNLens lens) { | ||
2790 | 43 | super(arc); | ||
2791 | 44 | updateLabel(true); | ||
2792 | 45 | this.lens = lens; | ||
2793 | 46 | } | ||
2794 | 47 | |||
2795 | 40 | @Override | 48 | @Override |
2796 | 41 | protected void addMouseHandler() { | 49 | protected void addMouseHandler() { |
2797 | 42 | //XXX: kyrke 2018-09-06, this is bad as we leak "this", think its ok for now, as it alwas constructed when | 50 | //XXX: kyrke 2018-09-06, this is bad as we leak "this", think its ok for now, as it alwas constructed when |
2798 | @@ -82,7 +90,7 @@ | |||
2799 | 82 | if (inputArc == null) | 90 | if (inputArc == null) |
2800 | 83 | getNameLabel().setText(""); | 91 | getNameLabel().setText(""); |
2801 | 84 | else { | 92 | else { |
2803 | 85 | if (!CreateGui.getApp().showZeroToInfinityIntervals()) { | 93 | if (!CreateGui.getApp().showZeroToInfinityIntervals() || !lens.isTimed()) { |
2804 | 86 | if (inputArc.interval().toString(showConstantNames).equals("[0,inf)")){ | 94 | if (inputArc.interval().toString(showConstantNames).equals("[0,inf)")){ |
2805 | 87 | getNameLabel().setText(""); | 95 | getNameLabel().setText(""); |
2806 | 88 | } | 96 | } |
2807 | 89 | 97 | ||
2808 | === modified file 'src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java' | |||
2809 | --- src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java 2020-07-16 08:39:06 +0000 | |||
2810 | +++ src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java 2020-08-19 11:36:17 +0000 | |||
2811 | @@ -51,6 +51,7 @@ | |||
2812 | 51 | Grid.getModifiedX((int) (arc.getNameLabel().getXPosition() + Zoomer.getZoomedValue(getNameOffsetX(), getZoom()))), | 51 | Grid.getModifiedX((int) (arc.getNameLabel().getXPosition() + Zoomer.getZoomedValue(getNameOffsetX(), getZoom()))), |
2813 | 52 | Grid.getModifiedY((int) (arc.getNameLabel().getYPosition() + Zoomer.getZoomedValue(getNameOffsetY(), getZoom()))) | 52 | Grid.getModifiedY((int) (arc.getNameLabel().getYPosition() + Zoomer.getZoomedValue(getNameOffsetY(), getZoom()))) |
2814 | 53 | ); | 53 | ); |
2815 | 54 | this.lens = arc.lens; | ||
2816 | 54 | 55 | ||
2817 | 55 | } | 56 | } |
2818 | 56 | 57 | ||
2819 | 57 | 58 | ||
2820 | === modified file 'src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java' | |||
2821 | --- src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java 2020-07-20 07:19:51 +0000 | |||
2822 | +++ src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java 2020-08-19 11:36:17 +0000 | |||
2823 | @@ -23,6 +23,7 @@ | |||
2824 | 23 | import javax.swing.BoxLayout; | 23 | import javax.swing.BoxLayout; |
2825 | 24 | import javax.swing.JTextArea; | 24 | import javax.swing.JTextArea; |
2826 | 25 | 25 | ||
2827 | 26 | import dk.aau.cs.gui.TabContent; | ||
2828 | 26 | import pipe.gui.CreateGui; | 27 | import pipe.gui.CreateGui; |
2829 | 27 | import pipe.gui.Pipe; | 28 | import pipe.gui.Pipe; |
2830 | 28 | import pipe.gui.graphicElements.Place; | 29 | import pipe.gui.graphicElements.Place; |
2831 | @@ -49,11 +50,11 @@ | |||
2832 | 49 | private Window ageOfTokensWindow = new Window(new Frame()); | 50 | private Window ageOfTokensWindow = new Window(new Frame()); |
2833 | 50 | private final Shape dashedOutline = createDashedOutline(); | 51 | private final Shape dashedOutline = createDashedOutline(); |
2834 | 51 | 52 | ||
2836 | 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) { |
2837 | 53 | super(positionXInput, positionYInput); | 54 | super(positionXInput, positionYInput); |
2838 | 54 | this.place = place; | 55 | this.place = place; |
2839 | 55 | this.place.addTimedPlaceListener(listener); | 56 | this.place.addTimedPlaceListener(listener); |
2841 | 56 | 57 | this.lens = lens; | |
2842 | 57 | attributesVisible = true; | 58 | attributesVisible = true; |
2843 | 58 | 59 | ||
2844 | 59 | } | 60 | } |
2845 | @@ -63,15 +64,17 @@ | |||
2846 | 63 | int positionYInput, | 64 | int positionYInput, |
2847 | 64 | String idInput, | 65 | String idInput, |
2848 | 65 | int nameOffsetXInput, | 66 | int nameOffsetXInput, |
2850 | 66 | int nameOffsetYInput | 67 | int nameOffsetYInput, |
2851 | 68 | TabContent.TAPNLens lens | ||
2852 | 67 | ) { | 69 | ) { |
2853 | 68 | 70 | ||
2854 | 69 | super(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput); | 71 | super(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput); |
2855 | 70 | attributesVisible = true; | 72 | attributesVisible = true; |
2856 | 73 | this.lens = lens; | ||
2857 | 71 | 74 | ||
2858 | 72 | } | 75 | } |
2859 | 73 | 76 | ||
2861 | 74 | @Override | 77 | @Override |
2862 | 75 | protected void addMouseHandler() { | 78 | protected void addMouseHandler() { |
2863 | 76 | //XXX: kyrke 2018-09-06, this is bad as we leak "this", think its ok for now, as it alwas constructed when | 79 | //XXX: kyrke 2018-09-06, this is bad as we leak "this", think its ok for now, as it alwas constructed when |
2864 | 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. |
2865 | @@ -173,7 +176,9 @@ | |||
2866 | 173 | } | 176 | } |
2867 | 174 | } | 177 | } |
2868 | 175 | } | 178 | } |
2870 | 176 | 179 | if(!lens.isTimed()){ | |
2871 | 180 | drawDots = (marking > 0 && marking < 6); | ||
2872 | 181 | } | ||
2873 | 177 | // structure sees how many markings there are and fills the place in | 182 | // structure sees how many markings there are and fills the place in |
2874 | 178 | // with the appropriate number or tokens. | 183 | // with the appropriate number or tokens. |
2875 | 179 | if(drawDots) { | 184 | if(drawDots) { |
2876 | @@ -277,7 +282,7 @@ | |||
2877 | 277 | } | 282 | } |
2878 | 278 | 283 | ||
2879 | 279 | // Build interface | 284 | // Build interface |
2881 | 280 | if (show) { | 285 | if (show && isTimed()) { |
2882 | 281 | ageOfTokensWindow = new Window(new Frame()); | 286 | ageOfTokensWindow = new Window(new Frame()); |
2883 | 282 | ageOfTokensWindow.add(new JTextArea(getStringOfTokens())); | 287 | ageOfTokensWindow.add(new JTextArea(getStringOfTokens())); |
2884 | 283 | ageOfTokensWindow.getComponent(0).setBackground(Color.lightGray); | 288 | ageOfTokensWindow.getComponent(0).setBackground(Color.lightGray); |
2885 | @@ -410,7 +415,7 @@ | |||
2886 | 410 | } | 415 | } |
2887 | 411 | 416 | ||
2888 | 412 | public TimedPlaceComponent copy(TimedArcPetriNet tapn) { | 417 | public TimedPlaceComponent copy(TimedArcPetriNet tapn) { |
2890 | 413 | TimedPlaceComponent placeComponent = new TimedPlaceComponent(getOriginalX(), getOriginalY(), id, getNameOffsetX(), getNameOffsetY()); | 418 | TimedPlaceComponent placeComponent = new TimedPlaceComponent(getOriginalX(), getOriginalY(), id, getNameOffsetX(), getNameOffsetY(), lens); |
2891 | 414 | placeComponent.setUnderlyingPlace(tapn.getPlaceByName(place.name())); | 419 | placeComponent.setUnderlyingPlace(tapn.getPlaceByName(place.name())); |
2892 | 415 | 420 | ||
2893 | 416 | return placeComponent; | 421 | return placeComponent; |
2894 | 417 | 422 | ||
2895 | === modified file 'src/pipe/gui/graphicElements/tapn/TimedTransitionComponent.java' | |||
2896 | --- src/pipe/gui/graphicElements/tapn/TimedTransitionComponent.java 2020-08-10 06:46:22 +0000 | |||
2897 | +++ src/pipe/gui/graphicElements/tapn/TimedTransitionComponent.java 2020-08-19 11:36:17 +0000 | |||
2898 | @@ -16,6 +16,7 @@ | |||
2899 | 16 | import javax.swing.BoxLayout; | 16 | import javax.swing.BoxLayout; |
2900 | 17 | import javax.swing.JTextArea; | 17 | import javax.swing.JTextArea; |
2901 | 18 | 18 | ||
2902 | 19 | import dk.aau.cs.gui.TabContent; | ||
2903 | 19 | import pipe.gui.CreateGui; | 20 | import pipe.gui.CreateGui; |
2904 | 20 | import pipe.gui.Pipe; | 21 | import pipe.gui.Pipe; |
2905 | 21 | import pipe.gui.graphicElements.Transition; | 22 | import pipe.gui.graphicElements.Transition; |
2906 | @@ -36,12 +37,13 @@ | |||
2907 | 36 | private final dk.aau.cs.model.tapn.event.TimedTransitionListener listener; | 37 | private final dk.aau.cs.model.tapn.event.TimedTransitionListener listener; |
2908 | 37 | private GeneralPath dashedOutline; | 38 | private GeneralPath dashedOutline; |
2909 | 38 | 39 | ||
2911 | 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) { |
2912 | 40 | super(positionXInput, positionYInput); | 41 | super(positionXInput, positionYInput); |
2913 | 41 | this.transition = transition; | 42 | this.transition = transition; |
2914 | 42 | listener = timedTransitionListener(); | 43 | listener = timedTransitionListener(); |
2915 | 43 | transition.addTimedTransitionListener(listener); | 44 | transition.addTimedTransitionListener(listener); |
2916 | 44 | attributesVisible = true; | 45 | attributesVisible = true; |
2917 | 46 | this.lens = lens; | ||
2918 | 45 | 47 | ||
2919 | 46 | } | 48 | } |
2920 | 47 | 49 | ||
2921 | @@ -54,7 +56,8 @@ | |||
2922 | 54 | boolean timedTransition, | 56 | boolean timedTransition, |
2923 | 55 | boolean infServer, | 57 | boolean infServer, |
2924 | 56 | int angleInput, | 58 | int angleInput, |
2926 | 57 | int priority | 59 | int priority, |
2927 | 60 | TabContent.TAPNLens lens | ||
2928 | 58 | ) { | 61 | ) { |
2929 | 59 | super( | 62 | super( |
2930 | 60 | positionXInput, | 63 | positionXInput, |
2931 | @@ -66,6 +69,7 @@ | |||
2932 | 66 | ); | 69 | ); |
2933 | 67 | listener = timedTransitionListener(); | 70 | listener = timedTransitionListener(); |
2934 | 68 | attributesVisible = true; | 71 | attributesVisible = true; |
2935 | 72 | this.lens = lens; | ||
2936 | 69 | 73 | ||
2937 | 70 | } | 74 | } |
2938 | 71 | 75 | ||
2939 | @@ -222,7 +226,7 @@ | |||
2940 | 222 | } | 226 | } |
2941 | 223 | 227 | ||
2942 | 224 | public TimedTransitionComponent copy(TimedArcPetriNet tapn) { | 228 | public TimedTransitionComponent copy(TimedArcPetriNet tapn) { |
2944 | 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); |
2945 | 226 | transitionComponent.setUnderlyingTransition(tapn.getTransitionByName(transition.name())); | 230 | transitionComponent.setUnderlyingTransition(tapn.getTransitionByName(transition.name())); |
2946 | 227 | 231 | ||
2947 | 228 | return transitionComponent; | 232 | return transitionComponent; |
2948 | @@ -237,7 +241,7 @@ | |||
2949 | 237 | } | 241 | } |
2950 | 238 | 242 | ||
2951 | 239 | // Build interface | 243 | // Build interface |
2953 | 240 | if (show && (transition.getdInterval() != null)) { | 244 | if (show && (transition.getdInterval() != null) && isTimed()) { |
2954 | 241 | dIntervalWindow = new Window(new Frame()); | 245 | dIntervalWindow = new Window(new Frame()); |
2955 | 242 | dIntervalWindow.add(new JTextArea(transition.getdInterval().toString())); | 246 | dIntervalWindow.add(new JTextArea(transition.getdInterval().toString())); |
2956 | 243 | 247 | ||
2957 | 244 | 248 | ||
2958 | === modified file 'src/pipe/gui/handler/PetriNetObjectHandler.java' | |||
2959 | --- src/pipe/gui/handler/PetriNetObjectHandler.java 2020-07-20 07:19:51 +0000 | |||
2960 | +++ src/pipe/gui/handler/PetriNetObjectHandler.java 2020-08-19 11:36:17 +0000 | |||
2961 | @@ -66,8 +66,8 @@ | |||
2962 | 66 | @Override | 66 | @Override |
2963 | 67 | public void mousePressed(MouseEvent e) { | 67 | public void mousePressed(MouseEvent e) { |
2964 | 68 | if(CreateGui.getCurrentTab().isInAnimationMode()) return; | 68 | if(CreateGui.getCurrentTab().isInAnimationMode()) return; |
2967 | 69 | 69 | ||
2968 | 70 | if (CreateGui.getApp().getMode() == ElementType.SELECT) { | 70 | if (CreateGui.guiMode == ElementType.SELECT) { |
2969 | 71 | if (!myObject.isSelected()) { | 71 | if (!myObject.isSelected()) { |
2970 | 72 | if (!e.isShiftDown()) { | 72 | if (!e.isShiftDown()) { |
2971 | 73 | myObject.getParent().getSelectionObject().clearSelection(); | 73 | myObject.getParent().getSelectionObject().clearSelection(); |
2972 | @@ -92,7 +92,7 @@ | |||
2973 | 92 | return; | 92 | return; |
2974 | 93 | } | 93 | } |
2975 | 94 | 94 | ||
2977 | 95 | if (CreateGui.getApp().getMode() == ElementType.SELECT) { | 95 | if (CreateGui.guiMode == ElementType.SELECT) { |
2978 | 96 | if (isDragging) { | 96 | if (isDragging) { |
2979 | 97 | isDragging = false; | 97 | isDragging = false; |
2980 | 98 | CreateGui.getDrawingSurface().translateSelection(myObject.getParent().getSelectionObject().getSelection(), totalX, totalY); | 98 | CreateGui.getDrawingSurface().translateSelection(myObject.getParent().getSelectionObject().getSelection(), totalX, totalY); |
2981 | @@ -124,7 +124,7 @@ | |||
2982 | 124 | return; | 124 | return; |
2983 | 125 | } | 125 | } |
2984 | 126 | 126 | ||
2986 | 127 | if (CreateGui.getApp().getMode() == ElementType.SELECT) { | 127 | if (CreateGui.guiMode == ElementType.SELECT) { |
2987 | 128 | if (myObject.isDraggable()) { | 128 | if (myObject.isDraggable()) { |
2988 | 129 | if (!isDragging) { | 129 | if (!isDragging) { |
2989 | 130 | isDragging = true; | 130 | isDragging = true; |
2990 | 131 | 131 | ||
2991 | === modified file 'src/pipe/gui/widgets/GuardDialogue.java' | |||
2992 | --- src/pipe/gui/widgets/GuardDialogue.java 2020-07-20 08:14:17 +0000 | |||
2993 | +++ src/pipe/gui/widgets/GuardDialogue.java 2020-08-19 11:36:17 +0000 | |||
2994 | @@ -27,6 +27,7 @@ | |||
2995 | 27 | import javax.swing.SpinnerNumberModel; | 27 | import javax.swing.SpinnerNumberModel; |
2996 | 28 | import javax.swing.event.ChangeEvent; | 28 | import javax.swing.event.ChangeEvent; |
2997 | 29 | 29 | ||
2998 | 30 | import dk.aau.cs.gui.TabContent; | ||
2999 | 30 | import dk.aau.cs.model.tapn.*; | 31 | import dk.aau.cs.model.tapn.*; |
3000 | 31 | import net.tapaal.swinghelpers.WidthAdjustingComboBox; | 32 | import net.tapaal.swinghelpers.WidthAdjustingComboBox; |
3001 | 32 | import pipe.gui.CreateGui; | 33 | import pipe.gui.CreateGui; |
3002 | @@ -76,7 +77,10 @@ | |||
3003 | 76 | if(objectToBeEdited instanceof TimedInputArcComponent && !(objectToBeEdited instanceof TimedInhibitorArcComponent)){ | 77 | if(objectToBeEdited instanceof TimedInputArcComponent && !(objectToBeEdited instanceof TimedInhibitorArcComponent)){ |
3004 | 77 | initTimeGuardPanel(); | 78 | initTimeGuardPanel(); |
3005 | 78 | } | 79 | } |
3007 | 79 | 80 | if(!objectToBeEdited.isTimed() ){ | |
3008 | 81 | guardEditPanel.setVisible(false); | ||
3009 | 82 | } | ||
3010 | 83 | |||
3011 | 80 | initWeightPanel(); | 84 | initWeightPanel(); |
3012 | 81 | initButtonPanel(objectToBeEdited); | 85 | initButtonPanel(objectToBeEdited); |
3013 | 82 | 86 | ||
3014 | 83 | 87 | ||
3015 | === modified file 'src/pipe/gui/widgets/PlaceEditorPanel.java' | |||
3016 | --- src/pipe/gui/widgets/PlaceEditorPanel.java 2020-07-23 09:18:11 +0000 | |||
3017 | +++ src/pipe/gui/widgets/PlaceEditorPanel.java 2020-08-19 11:36:17 +0000 | |||
3018 | @@ -22,6 +22,7 @@ | |||
3019 | 22 | import javax.swing.JSpinner; | 22 | import javax.swing.JSpinner; |
3020 | 23 | import javax.swing.event.ChangeListener; | 23 | import javax.swing.event.ChangeListener; |
3021 | 24 | 24 | ||
3022 | 25 | import dk.aau.cs.gui.TabContent; | ||
3023 | 25 | import net.tapaal.swinghelpers.CustomJSpinner; | 26 | import net.tapaal.swinghelpers.CustomJSpinner; |
3024 | 26 | import net.tapaal.swinghelpers.GridBagHelper; | 27 | import net.tapaal.swinghelpers.GridBagHelper; |
3025 | 27 | import net.tapaal.swinghelpers.WidthAdjustingComboBox; | 28 | import net.tapaal.swinghelpers.WidthAdjustingComboBox; |
3026 | @@ -67,17 +68,26 @@ | |||
3027 | 67 | private final Context context; | 68 | private final Context context; |
3028 | 68 | private boolean makeNewShared = false; | 69 | private boolean makeNewShared = false; |
3029 | 69 | private boolean doNewEdit = true; | 70 | private boolean doNewEdit = true; |
3030 | 71 | private final TabContent currentTab; | ||
3031 | 70 | 72 | ||
3032 | 71 | private Vector<TimedPlace> sharedPlaces; | 73 | private Vector<TimedPlace> sharedPlaces; |
3033 | 72 | private final int maxNumberOfPlacesToShowAtOnce = 20; | 74 | private final int maxNumberOfPlacesToShowAtOnce = 20; |
3034 | 73 | 75 | ||
3035 | 74 | public PlaceEditorPanel(JRootPane rootPane, TimedPlaceComponent placeComponent, Context context) { | 76 | public PlaceEditorPanel(JRootPane rootPane, TimedPlaceComponent placeComponent, Context context) { |
3036 | 75 | this.rootPane = rootPane; | 77 | this.rootPane = rootPane; |
3037 | 78 | currentTab = context.tabContent(); | ||
3038 | 76 | place = placeComponent; | 79 | place = placeComponent; |
3039 | 77 | this.context = context; | 80 | this.context = context; |
3040 | 78 | initComponents(); | 81 | initComponents(); |
3041 | 82 | hideTimedInformation(); | ||
3042 | 79 | } | 83 | } |
3043 | 80 | 84 | ||
3044 | 85 | private void hideTimedInformation(){ | ||
3045 | 86 | if(!place.isTimed()) { | ||
3046 | 87 | timeInvariantPanel.setVisible(false); | ||
3047 | 88 | } | ||
3048 | 89 | } | ||
3049 | 90 | |||
3050 | 81 | private void initComponents() { | 91 | private void initComponents() { |
3051 | 82 | setLayout(new java.awt.GridBagLayout()); | 92 | setLayout(new java.awt.GridBagLayout()); |
3052 | 83 | 93 | ||
3053 | @@ -90,6 +100,7 @@ | |||
3054 | 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)); |
3055 | 91 | add(timeInvariantPanel, gridBagConstraints); | 101 | add(timeInvariantPanel, gridBagConstraints); |
3056 | 92 | 102 | ||
3057 | 103 | |||
3058 | 93 | initButtonPanel(); | 104 | initButtonPanel(); |
3059 | 94 | 105 | ||
3060 | 95 | gridBagConstraints = GridBagHelper.as(0,2, new Insets(0, 8, 5, 8)); | 106 | gridBagConstraints = GridBagHelper.as(0,2, new Insets(0, 8, 5, 8)); |
3061 | 96 | 107 | ||
3062 | === modified file 'src/pipe/gui/widgets/QueryPane.java' | |||
3063 | --- src/pipe/gui/widgets/QueryPane.java 2020-08-10 06:46:22 +0000 | |||
3064 | +++ src/pipe/gui/widgets/QueryPane.java 2020-08-19 11:36:17 +0000 | |||
3065 | @@ -372,7 +372,7 @@ | |||
3066 | 372 | TAPNQuery newQuery = null; | 372 | TAPNQuery newQuery = null; |
3067 | 373 | 373 | ||
3068 | 374 | if(q.isActive()) { | 374 | if(q.isActive()) { |
3070 | 375 | if(q.getCategory() == TAPNQuery.QueryCategory.CTL) { | 375 | if(!tabContent.getLens().isTimed()) { |
3071 | 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()); |
3072 | 377 | } else { | 377 | } else { |
3073 | 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()); |
3074 | 379 | 379 | ||
3075 | === modified file 'src/pipe/gui/widgets/TAPNTransitionEditor.java' | |||
3076 | --- src/pipe/gui/widgets/TAPNTransitionEditor.java 2020-08-10 06:46:22 +0000 | |||
3077 | +++ src/pipe/gui/widgets/TAPNTransitionEditor.java 2020-08-19 11:36:17 +0000 | |||
3078 | @@ -16,8 +16,6 @@ | |||
3079 | 16 | import javax.swing.JRootPane; | 16 | import javax.swing.JRootPane; |
3080 | 17 | import javax.swing.JTextField; | 17 | import javax.swing.JTextField; |
3081 | 18 | import javax.swing.event.CaretListener; | 18 | import javax.swing.event.CaretListener; |
3082 | 19 | |||
3083 | 20 | |||
3084 | 21 | import net.tapaal.swinghelpers.GridBagHelper; | 19 | import net.tapaal.swinghelpers.GridBagHelper; |
3085 | 22 | import dk.aau.cs.gui.undo.*; | 20 | import dk.aau.cs.gui.undo.*; |
3086 | 23 | import net.tapaal.swinghelpers.WidthAdjustingComboBox; | 21 | import net.tapaal.swinghelpers.WidthAdjustingComboBox; |
3087 | @@ -52,10 +50,16 @@ | |||
3088 | 52 | transition = _transition; | 50 | transition = _transition; |
3089 | 53 | this.context = context; | 51 | this.context = context; |
3090 | 54 | initComponents(); | 52 | initComponents(); |
3092 | 55 | 53 | hideTimedInformation(); | |
3093 | 56 | rootPane.setDefaultButton(okButton); | 54 | rootPane.setDefaultButton(okButton); |
3094 | 57 | } | 55 | } |
3095 | 58 | 56 | ||
3096 | 57 | private void hideTimedInformation(){ | ||
3097 | 58 | if(!transition.isTimed()) { | ||
3098 | 59 | urgentCheckBox.setVisible(false); | ||
3099 | 60 | } | ||
3100 | 61 | } | ||
3101 | 62 | |||
3102 | 59 | private void initComponents() { | 63 | private void initComponents() { |
3103 | 60 | GridBagConstraints gridBagConstraints; | 64 | GridBagConstraints gridBagConstraints; |
3104 | 61 | 65 |
please see DM.