Merge lp:~yrke/tapaal/testbranch into lp:tapaal
- testbranch
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Jiri Srba |
Approved revision: | 1374 |
Merged at revision: | 1374 |
Proposed branch: | lp:~yrke/tapaal/testbranch |
Merge into: | lp:tapaal |
Diff against target: |
25917 lines (+8211/-7313) 254 files modified
.bzrignore (+1/-0) .editorconfig (+336/-0) build.gradle (+41/-11) gradle/wrapper/gradle-wrapper.properties (+3/-2) gradlew (+31/-20) gradlew.bat (+20/-1) src/dk/aau/cs/TCTL/CTLParsing/ParseException.java (+2/-2) src/dk/aau/cs/TCTL/CTLParsing/TAPAALCTLQueryParser.java (+0/-1) src/dk/aau/cs/TCTL/CTLParsing/TAPAALCTLQueryParserTokenManager.java (+0/-27) src/dk/aau/cs/TCTL/CTLParsing/TokenMgrError.java (+1/-1) src/dk/aau/cs/TCTL/Parsing/ParseException.java (+2/-2) src/dk/aau/cs/TCTL/Parsing/TAPAALQueryParserTokenManager.java (+0/-20) src/dk/aau/cs/TCTL/Parsing/TokenMgrError.java (+1/-1) src/dk/aau/cs/TCTL/SUMOParsing/ParseException.java (+2/-2) src/dk/aau/cs/TCTL/SUMOParsing/SUMOQueryParser.java (+0/-1) src/dk/aau/cs/TCTL/SUMOParsing/SUMOQueryParserTokenManager.java (+0/-20) src/dk/aau/cs/TCTL/SUMOParsing/TokenMgrError.java (+1/-1) src/dk/aau/cs/TCTL/XMLParsing/QueryWrapper.java (+1/-5) src/dk/aau/cs/TCTL/visitors/BroadcastTranslationQueryVisitor.java (+0/-2) src/dk/aau/cs/TCTL/visitors/CTLQueryVisitor.java (+0/-1) src/dk/aau/cs/TCTL/visitors/CombiTranslationQueryVisitor.java (+0/-3) src/dk/aau/cs/TCTL/visitors/OptimizedStandardTranslationQueryVisitor.java (+1/-3) src/dk/aau/cs/TCTL/visitors/QueryVisitor.java (+0/-4) src/dk/aau/cs/TCTL/visitors/StandardSymmetryTranslationQueryVisitor.java (+0/-2) src/dk/aau/cs/TCTL/visitors/StandardTranslationQueryVisitor.java (+1/-3) src/dk/aau/cs/approximation/ApproximationWorker.java (+89/-86) src/dk/aau/cs/approximation/OverApproximation.java (+2/-2) src/dk/aau/cs/approximation/UnderApproximation.java (+4/-4) src/dk/aau/cs/gui/BatchProcessingDialog.java (+86/-131) src/dk/aau/cs/gui/Context.java (+1/-1) src/dk/aau/cs/gui/DeleteSharedPlaceOrTransition.java (+13/-12) src/dk/aau/cs/gui/NameGenerator.java (+0/-7) src/dk/aau/cs/gui/SharedPlaceNamePanel.java (+4/-11) src/dk/aau/cs/gui/SharedPlacesAndTransitionsPanel.java (+74/-91) src/dk/aau/cs/gui/SharedTransitionNamePanel.java (+4/-11) src/dk/aau/cs/gui/TabComponent.java (+6/-9) src/dk/aau/cs/gui/TabContent.java (+845/-90) src/dk/aau/cs/gui/TabContentActions.java (+87/-0) src/dk/aau/cs/gui/TabTransformer.java (+59/-43) src/dk/aau/cs/gui/TemplateExplorer.java (+31/-59) src/dk/aau/cs/gui/components/BatchProcessingResultsTableModel.java (+0/-1) src/dk/aau/cs/gui/components/EnabledTransitionsList.java (+16/-11) src/dk/aau/cs/gui/components/ExportBatchResultTableModel.java (+0/-1) src/dk/aau/cs/gui/components/NonsearchableJComboBox.java (+3/-3) src/dk/aau/cs/gui/components/NonsearchableJList.java (+3/-3) src/dk/aau/cs/gui/components/StatisticsPanel.java (+4/-3) src/dk/aau/cs/gui/components/TransitionFireingComponent.java (+6/-14) src/dk/aau/cs/gui/smartDraw/SmartDrawDialog.java (+8/-12) src/dk/aau/cs/gui/smartDraw/SmartDrawWorker.java (+13/-19) src/dk/aau/cs/gui/undo/MakePlaceNewSharedCommand.java (+0/-1) src/dk/aau/cs/gui/undo/MakePlaceNewSharedMultiCommand.java (+22/-41) src/dk/aau/cs/gui/undo/MakeTransitionNewSharedCommand.java (+0/-4) src/dk/aau/cs/gui/undo/MakeTransitionNewSharedMultiCommand.java (+21/-39) src/dk/aau/cs/gui/undo/MovePlaceTransitionObject.java (+0/-4) src/dk/aau/cs/gui/undo/SortSharedTransitionsCommand.java (+0/-2) src/dk/aau/cs/gui/undo/SortTemplatesCommand.java (+6/-9) src/dk/aau/cs/gui/undo/ToggleTransitionUrgent.java (+0/-2) src/dk/aau/cs/gui/undo/UpdateNameLabelOffsetCommand.java (+3/-2) src/dk/aau/cs/io/LoadedModel.java (+0/-3) src/dk/aau/cs/io/ModelLoader.java (+6/-5) src/dk/aau/cs/io/PNMLWriter.java (+8/-8) src/dk/aau/cs/io/PNMLoader.java (+5/-20) src/dk/aau/cs/io/ResourceManager.java (+2/-4) src/dk/aau/cs/io/TapnLegacyXmlLoader.java (+17/-36) src/dk/aau/cs/io/TapnXmlLoader.java (+15/-34) src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java (+9/-17) src/dk/aau/cs/io/TraceImportExport.java (+1/-1) src/dk/aau/cs/io/XMLFormatter.java (+1/-7) src/dk/aau/cs/io/batchProcessing/BatchProcessingLegacyLoader.java (+1/-7) src/dk/aau/cs/io/batchProcessing/BatchProcessingLoader.java (+14/-15) src/dk/aau/cs/io/batchProcessing/BatchProcessingModelLoader.java (+2/-4) src/dk/aau/cs/io/batchProcessing/BatchProcessingResultsExporter.java (+8/-5) src/dk/aau/cs/io/batchProcessing/LoadedBatchProcessingModel.java (+0/-3) src/dk/aau/cs/io/queries/SUMOQueryLoader.java (+2/-3) src/dk/aau/cs/io/queries/TAPNQueryLoader.java (+0/-1) src/dk/aau/cs/io/queries/XMLQueryLoader.java (+1/-10) src/dk/aau/cs/model/NTA/trace/Participant.java (+0/-3) src/dk/aau/cs/model/NTA/trace/UppaalTrace.java (+1/-1) src/dk/aau/cs/model/tapn/ConstantStore.java (+3/-10) src/dk/aau/cs/model/tapn/IntWeight.java (+1/-1) src/dk/aau/cs/model/tapn/LocalTimedPlace.java (+5/-3) src/dk/aau/cs/model/tapn/NetworkMarking.java (+0/-1) src/dk/aau/cs/model/tapn/SharedPlace.java (+6/-2) src/dk/aau/cs/model/tapn/TimeInterval.java (+5/-11) src/dk/aau/cs/model/tapn/TimeInvariant.java (+3/-3) src/dk/aau/cs/model/tapn/TimedArcPetriNet.java (+11/-11) src/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java (+8/-20) src/dk/aau/cs/model/tapn/TimedPlace.java (+3/-6) src/dk/aau/cs/model/tapn/TimedToken.java (+1/-1) src/dk/aau/cs/model/tapn/TimedTransition.java (+1/-6) src/dk/aau/cs/model/tapn/simulation/ManualDelayMode.java (+12/-25) src/dk/aau/cs/model/tapn/simulation/OldestFiringMode.java (+3/-10) src/dk/aau/cs/model/tapn/simulation/RandomDelayMode.java (+2/-3) src/dk/aau/cs/model/tapn/simulation/ShortestDelayMode.java (+0/-1) src/dk/aau/cs/model/tapn/simulation/TAPNNetworkTimeDelayStep.java (+0/-3) src/dk/aau/cs/model/tapn/simulation/TimedArcPetriNetTrace.java (+2/-2) src/dk/aau/cs/model/tapn/simulation/YoungestFiringMode.java (+1/-6) src/dk/aau/cs/translations/ReductionOption.java (+0/-3) src/dk/aau/cs/translations/TranslationNamingScheme.java (+1/-1) src/dk/aau/cs/translations/tapn/BroadcastTranslation.java (+0/-2) src/dk/aau/cs/translations/tapn/CombiTranslation.java (+0/-3) src/dk/aau/cs/translations/tapn/Degree2BroadcastTranslation.java (+1/-2) src/dk/aau/cs/translations/tapn/OptimizedStandardTranslation.java (+1/-1) src/dk/aau/cs/translations/tapn/StandardTranslation.java (+1/-1) src/dk/aau/cs/util/MemoryMonitor.java (+2/-9) src/dk/aau/cs/util/StringComparator.java (+0/-1) src/dk/aau/cs/util/VerificationCallback.java (+3/-2) src/dk/aau/cs/verification/BoundednessAnalysisResult.java (+1/-1) src/dk/aau/cs/verification/BufferDrain.java (+0/-3) src/dk/aau/cs/verification/InconclusiveBoundednessAnalysisResult.java (+1/-1) src/dk/aau/cs/verification/ProcessRunner.java (+5/-8) src/dk/aau/cs/verification/QueryResult.java (+3/-6) src/dk/aau/cs/verification/ReductionStats.java (+1/-1) src/dk/aau/cs/verification/Stats.java (+6/-21) src/dk/aau/cs/verification/TAPNComposer.java (+34/-47) src/dk/aau/cs/verification/TraceConverter.java (+0/-5) src/dk/aau/cs/verification/UPPAAL/UppaalExporter.java (+1/-3) src/dk/aau/cs/verification/UPPAAL/UppaalIconSelector.java (+1/-3) src/dk/aau/cs/verification/UPPAAL/Verifyta.java (+9/-10) src/dk/aau/cs/verification/UPPAAL/VerifytaOptions.java (+8/-46) src/dk/aau/cs/verification/UPPAAL/VerifytaOutputParser.java (+0/-1) src/dk/aau/cs/verification/UPPAAL/VerifytaTraceParser.java (+2/-2) src/dk/aau/cs/verification/VerificationOptions.java (+39/-13) src/dk/aau/cs/verification/VerificationResult.java (+11/-18) src/dk/aau/cs/verification/VerifyTAPN/VerifyDTAPNOptions.java (+44/-22) src/dk/aau/cs/verification/VerifyTAPN/VerifyDTAPNOutputParser.java (+2/-8) src/dk/aau/cs/verification/VerifyTAPN/VerifyPN.java (+6/-8) src/dk/aau/cs/verification/VerifyTAPN/VerifyPNCTLOutputParser.java (+1/-5) src/dk/aau/cs/verification/VerifyTAPN/VerifyPNOptions.java (+1/-1) src/dk/aau/cs/verification/VerifyTAPN/VerifyPNOutputParser.java (+1/-2) src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPN.java (+7/-10) src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNDiscreteVerification.java (+375/-388) src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNExporter.java (+0/-3) src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNIconSelector.java (+0/-1) src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNOptions.java (+13/-66) src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNOutputParser.java (+1/-3) src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNTraceParser.java (+2/-6) src/dk/aau/cs/verification/batchProcessing/BatchProcessingVerificationOptions.java (+2/-2) src/dk/aau/cs/verification/batchProcessing/BatchProcessingWorker.java (+6/-11) src/net/tapaal/TAPAAL.java (+105/-16) src/net/tapaal/gui/DrawingSurfaceManager/AbstractDrawingSurfaceManager.java (+108/-0) src/net/tapaal/helpers/Reference/MutableReference.java (+22/-0) src/net/tapaal/helpers/Reference/Reference.java (+48/-0) src/net/tapaal/swinghelpers/CustomJSpinner.java (+148/-0) src/net/tapaal/swinghelpers/DecimalOnlyDocumentFilter.java (+54/-0) src/net/tapaal/swinghelpers/ExtendedJTabbedPane.java (+106/-0) src/net/tapaal/swinghelpers/JSplitPaneFix.java (+46/-0) src/net/tapaal/swinghelpers/RequestFocusListener.java (+38/-0) src/net/tapaal/swinghelpers/ToggleButtonWithoutText.java (+19/-0) src/net/tapaal/swinghelpers/WidthAdjustingComboBox.java (+68/-0) src/pipe/dataLayer/DataLayer.java (+143/-40) src/pipe/dataLayer/TAPNQuery.java (+4/-4) src/pipe/gui/AnimationController.java (+36/-60) src/pipe/gui/AnimationHistoryComponent.java (+1/-1) src/pipe/gui/AnimationSettings.java (+4/-6) src/pipe/gui/Animator.java (+68/-57) src/pipe/gui/CreateGui.java (+54/-13) src/pipe/gui/DelayEnabledTransitionControl.java (+2/-9) src/pipe/gui/Export.java (+4/-6) src/pipe/gui/ExportBatchDialog.java (+18/-32) src/pipe/gui/Grid.java (+2/-2) src/pipe/gui/GuiFrame.java (+416/-1647) src/pipe/gui/GuiFrameActions.java (+46/-0) src/pipe/gui/GuiFrameController.java (+712/-0) src/pipe/gui/GuiFrameControllerActions.java (+56/-0) src/pipe/gui/KBoundAnalyzer.java (+2/-3) src/pipe/gui/Pipe.java (+1/-2) src/pipe/gui/RunKBoundAnalysis.java (+1/-1) src/pipe/gui/RunVerification.java (+93/-140) src/pipe/gui/RunVerificationBase.java (+84/-64) src/pipe/gui/SafeGuiFrameActions.java (+12/-0) src/pipe/gui/SelectionManager.java (+49/-44) src/pipe/gui/SimulationControl.java (+5/-24) src/pipe/gui/TikZExporter.java (+14/-5) src/pipe/gui/Verifier.java (+9/-29) src/pipe/gui/VersionChecker.java (+1/-1) src/pipe/gui/Zoomer.java (+4/-0) src/pipe/gui/action/EditAnnotationBorderAction.java (+1/-1) src/pipe/gui/action/GuiAction.java (+1/-6) src/pipe/gui/action/SplitArcAction.java (+1/-1) src/pipe/gui/action/SplitArcPointAction.java (+1/-1) src/pipe/gui/action/ToggleArcPointAction.java (+1/-1) src/pipe/gui/canvas/Canvas.java (+13/-0) src/pipe/gui/canvas/DrawingSurfaceImpl.java (+681/-0) src/pipe/gui/canvas/PrototypeCanvas.java (+16/-0) src/pipe/gui/graphicElements/AnnotationNote.java (+118/-99) src/pipe/gui/graphicElements/Arc.java (+84/-170) src/pipe/gui/graphicElements/ArcPath.java (+87/-78) src/pipe/gui/graphicElements/ArcPathPoint.java (+13/-55) src/pipe/gui/graphicElements/NameLabel.java (+16/-11) src/pipe/gui/graphicElements/Note.java (+32/-52) src/pipe/gui/graphicElements/PetriNetObject.java (+159/-148) src/pipe/gui/graphicElements/PetriNetObjectWithLabel.java (+186/-0) src/pipe/gui/graphicElements/Place.java (+31/-51) src/pipe/gui/graphicElements/PlaceTransitionObject.java (+65/-161) src/pipe/gui/graphicElements/Transition.java (+39/-76) src/pipe/gui/graphicElements/tapn/TimedInhibitorArcComponent.java (+10/-51) src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java (+17/-70) src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java (+21/-80) src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java (+20/-28) src/pipe/gui/graphicElements/tapn/TimedTransitionComponent.java (+7/-31) src/pipe/gui/graphicElements/tapn/TimedTransportArcComponent.java (+19/-86) src/pipe/gui/handler/AnnotationNoteHandler.java (+1/-2) src/pipe/gui/handler/ArcHandler.java (+1/-33) src/pipe/gui/handler/ArcPathPointHandler.java (+1/-1) src/pipe/gui/handler/LabelHandler.java (+8/-12) src/pipe/gui/handler/NoteHandler.java (+1/-21) src/pipe/gui/handler/PetriNetObjectHandler.java (+15/-4) src/pipe/gui/handler/PlaceHandler.java (+10/-50) src/pipe/gui/handler/PlaceTransitionObjectHandler.java (+351/-305) src/pipe/gui/handler/SpecialMacHandler.java (+10/-13) src/pipe/gui/handler/TimedArcHandler.java (+1/-9) src/pipe/gui/handler/TransitionHandler.java (+4/-44) src/pipe/gui/handler/TransportArcHandler.java (+1/-8) src/pipe/gui/undo/AddAnnotationNoteCommand.java (+26/-0) src/pipe/gui/undo/AddArcPathPointEdit.java (+10/-2) src/pipe/gui/undo/AddTimedInhibitorArcCommand.java (+8/-8) src/pipe/gui/undo/AddTimedInputArcCommand.java (+7/-8) src/pipe/gui/undo/AddTimedOutputArcCommand.java (+7/-8) src/pipe/gui/undo/AddTimedPlaceCommand.java (+4/-7) src/pipe/gui/undo/AddTimedTransitionCommand.java (+5/-8) src/pipe/gui/undo/AddTransportArcCommand.java (+15/-11) src/pipe/gui/undo/ChangeSpacingEdit.java (+12/-9) src/pipe/gui/undo/DeleteAnnotationNoteCommand.java (+26/-0) src/pipe/gui/undo/DeleteArcPathPointEdit.java (+10/-2) src/pipe/gui/undo/DeleteTimedInhibitorArcCommand.java (+7/-7) src/pipe/gui/undo/DeleteTimedInputArcCommand.java (+8/-7) src/pipe/gui/undo/DeleteTimedOutputArcCommand.java (+8/-7) src/pipe/gui/undo/DeleteTimedPlaceCommand.java (+4/-9) src/pipe/gui/undo/DeleteTimedTransitionCommand.java (+5/-7) src/pipe/gui/undo/DeleteTransportArcCommand.java (+14/-9) src/pipe/gui/undo/TAPNElementCommand.java (+1/-5) src/pipe/gui/undo/UndoManager.java (+33/-158) src/pipe/gui/widgets/AnimationSelectmodeDialog.java (+4/-14) src/pipe/gui/widgets/AnnotationPanel.java (+13/-33) src/pipe/gui/widgets/ArcTokenSelector.java (+1/-3) src/pipe/gui/widgets/CTLQueryDialog.java (+51/-98) src/pipe/gui/widgets/ChooseInclusionPlacesDialog.java (+1/-7) src/pipe/gui/widgets/ConstantsDialogPanel.java (+10/-19) src/pipe/gui/widgets/ConstantsPane.java (+26/-40) src/pipe/gui/widgets/EngineDialogPanel.java (+10/-47) src/pipe/gui/widgets/GuardDialogue.java (+48/-93) src/pipe/gui/widgets/InclusionPlaces.java (+2/-4) src/pipe/gui/widgets/NewTAPNPanel.java (+5/-13) src/pipe/gui/widgets/PlaceEditorPanel.java (+69/-107) src/pipe/gui/widgets/QueryDialog.java (+89/-162) src/pipe/gui/widgets/QueryPane.java (+22/-35) src/pipe/gui/widgets/RunningVerificationDialog.java (+40/-48) src/pipe/gui/widgets/TAPNTransitionEditor.java (+23/-44) src/pipe/gui/widgets/WorkflowDialog.java (+275/-345) src/pipe/gui/widgets/filebrowser/NativeFileBrowserFallback.java (+0/-1) tests/TestTest.kt (+11/-0) tests/TimeIntervalTest.java (+33/-22) tests/TimeInvariantTests.java (+16/-16) |
To merge this branch: | bzr merge lp:~yrke/tapaal/testbranch |
Related bugs: | |
Related blueprints: |
tapaal 4 dev
(Low)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jiri Srba | Approve | ||
Review via email: mp+381500@code.launchpad.net |
Commit message
Description of the change
Kenneth Yrke Jørgensen (yrke) wrote : | # |
Jiri Srba (srba) wrote : | # |
2) Did some initial testing and can tell that trunk is not properly merged to this branch. This needs to be fixed before we can proceed with testing this branch.
Kenneth Yrke Jørgensen (yrke) wrote : | # |
You need to say whats not working:
bzr merge lp:tapaal
Connected (version 2.0, client Twisted_19.2.1)
Authentication (publickey) successful!
Secsh channel 1 opened.
Nothing to do.
- 1347. By Kenneth Yrke Jørgensen
-
Merged branch lp:~yrke/tapaal/commandlineBatchRunner
- 1348. By Kenneth Yrke Jørgensen
-
Fixed merge error not merging year update
- 1349. By Kenneth Yrke Jørgensen
-
Fixed issue with loading preferences
- 1350. By Kenneth Yrke Jørgensen
-
Removed old build files
Kenneth Yrke Jørgensen (yrke) wrote : | # |
I just reuploaded the branch as I found a problem in one of the more experimental features, so I removed this. If you already downloaded the branch, please delete it and check out again.
Kenneth Yrke Jørgensen (yrke) wrote : | # |
3) Undo of moving of labels are broken, undo does noting, redo works as expected. (There is some interesting things with undo and zoom, but they seem to be in trunk)
- 1351. By Kenneth Yrke Jørgensen
-
Fixed for label move undo.
Kenneth Yrke Jørgensen (yrke) wrote : | # |
3) Fixed
- 1352. By Kenneth Yrke Jørgensen
-
Removed the last refereces to fast mode
Peter Haahr Taankvist (ptaank) wrote : | # |
Namelabels on places and transitions are hidden by Annotation Notes. Fixed in Revision 1025 on trunk
Peter Haahr Taankvist (ptaank) wrote : | # |
Something is weird with resizing.
Resize the height of the mainwindows to as small as possible. Now drag the height downwards again very slowly. Only the global constants panel will be extended and the others will remain small.
Not a huge problem since each individual panel can be resized, but definitely weird.
Peter Haahr Taankvist (ptaank) wrote : | # |
The GIF for when doing automatic layout is gone again. It also gone in trunk.
Peter Haahr Taankvist (ptaank) wrote : | # |
I can still manage to get a stack overflow error with really large nets where all objects are on top of each other. Just import a large pnml net where everything is on top of each other and try to mouseover the places and transitions. It will try to redraw all the arc endpoints and queue a lot of redraws resulting in a stackoverflow.
Do we have a fix for this?
Peter Haahr Taankvist (ptaank) wrote : | # |
Closing very large nets seem to be slower on this branch than in trunk, if it needs to open Save As... I don't think it is a huge issue, it's only a couple of seconds.
Peter Haahr Taankvist (ptaank) wrote : | # |
Undoing recently created annotation note requires two undos, it is fixed in revision 1015.
https:/
Peter Haahr Taankvist (ptaank) wrote : | # |
Export to tikz places the namelabels right on top of the object e.g. inside the place or on top of the transition. Somehow the namelabels for arcs are still working correctly.
Peter Haahr Taankvist (ptaank) wrote : | # |
Something is off with the pnml export in this branch. If you export a net and try to import them again the arcs will all have a anchor point in the top corner.
Also it will say that there was no layout information even though there is, but this is also a problem in trunk so I reported it as a bug there.
Peter Haahr Taankvist (ptaank) wrote : | # |
I can't get it to work running tapaal with commandline arguments neiter on windows or Ubuntu. It always says the file is not found.
Example command line on Ubuntu: gradle run --args=
Peter Haahr Taankvist (ptaank) wrote : | # |
Not sure if this is a bug or intended. It is also the case in trunk.
Make multiple components with a shared place ( i used copy) then use rename in the panel. Only the shared place in the first place will be renamed.
- 1353. By Kenneth Yrke Jørgensen
-
Fixed issue where labels where hidden by notes
Kenneth Yrke Jørgensen (yrke) wrote : | # |
> Something is weird with resizing.
>
> Resize the height of the mainwindows to as small as possible. Now drag the
> height downwards again very slowly. Only the global constants panel will be
> extended and the others will remain small.
Interesting, seems to have same behavior in trunk, must be a swing thing.
Kenneth Yrke Jørgensen (yrke) wrote : | # |
> I can still manage to get a stack overflow error with really large nets where
> all objects are on top of each other. [...]
> Do we have a fix for this?
We might run into a limit with swing, but I think we will be able to do this a lot better. Still a lot that can be optimized wrt. drawing.
Kenneth Yrke Jørgensen (yrke) wrote : | # |
> Closing very large nets seem to be slower on this branch than in trunk, if it
> needs to open Save As... I don't think it is a huge issue, it's only a couple
> of seconds.
For open,
For now lets keep this. I think the sleeps that are added in order to avoid updating in the gui-thread, might work against us now, as it should not be needed. I will dig into this.
For save,
No idea, we have not changed directly wrt. this.
However for both save and open (and also drawing), i noticed that on the first actions (after opening), it really slow, until the hotspot optimizer (im guessing) optemizes the run. We should have a look if we could do somthing to the the optemizer. But also, this is one of the downsides of java. We might gain a lot of speed, when pre-optimization profiles becomes a thing.
Kenneth Yrke Jørgensen (yrke) wrote : | # |
> Undoing recently created annotation note requires two undos, it is fixed in
> revision 1015.
Thinking about this, I think I reverted it as there is an issue with the fix. (Will bind any change to an note to the next edit added). It not easy to fix, but will see if I can create a solution.
- 1354. By Kenneth Yrke Jørgensen
-
Fixed an issue with gradle, readded files
- 1355. By Kenneth Yrke Jørgensen
-
Fixed issue with opening files from command line
Kenneth Yrke Jørgensen (yrke) wrote : | # |
> I can't get it to work running tapaal with commandline arguments neiter on
> windows or Ubuntu. It always says the file is not found.
>
> Example command line on Ubuntu: gradle run --args=
I fixed an issue related to this, but not sure its the same issue as you get. I have issue with escape due to space in path, also might not accept "~", depeding on how it espands.
- 1356. By Kenneth Yrke Jørgensen
-
Fixed issue with undo/redo of AnnotationNotes
Adding a new note required to undos, this also fixes an issue where an extra
undo is added if the creation is cancled by user (not adding a note).
Kenneth Yrke Jørgensen (yrke) wrote : | # |
> Export to tikz places the namelabels right on top of the object e.g. inside
> the place or on top of the transition. Somehow the namelabels for arcs are
> still working correctly.
Can't reproduce this, seems to work for me.
- 1357. By Kenneth Yrke Jørgensen
-
Fixed icon loading for AutomaticNetLayout
Kenneth Yrke Jørgensen (yrke) wrote : | # |
> The GIF for when doing automatic layout is gone again. It also gone in trunk.
It was not correctly using the classLoader for accessing resources. Guess that means it will work only when not running it from a Jar file. I have a branch ready that adds a resoruceManager to access resources, to avoid problems like this.
Kenneth Yrke Jørgensen (yrke) wrote : | # |
> Not sure if this is a bug or intended. It is also the case in trunk.
>
> Make multiple components with a shared place ( i used copy) then use rename in
> the panel. Only the shared place in the first place will be renamed.
This is definitely a bug, not sure why, lets track this is trunk, as this also needs to be fixed in 3.6
- 1358. By Kenneth Yrke Jørgensen
-
Apply changed from intellij
- 1359. By Kenneth Yrke Jørgensen
-
Fixed gradle Java version definition
Jiri Srba (srba) wrote : | # |
PNML export is broken. Open alternating-
- 1360. By Kenneth Yrke Jørgensen
-
Pulled trunk including fix for #1871091, and applied a number of code cleanups.
- 1361. By Kenneth Yrke Jørgensen
-
Fixed TAPNComposer adding double arc-path points on copy.
This made the PNML exporter add extra arc-path point, not in the original net
- 1362. By Kenneth Yrke Jørgensen
-
Merged changes from trunk
Jiri Srba (srba) wrote : | # |
4) The About menu has not still be merged correctly to this testbrach and it differs from trunk.
- 1363. By Kenneth Yrke Jørgensen
-
Corrected project start years.
Kenneth Yrke Jørgensen (yrke) wrote : | # |
4) Fixed, updated the start year, I think i copy pasted to much. Also corrected the TAPAAL gui start year to be 2008.
Kenneth Yrke Jørgensen (yrke) wrote : | # |
5) Found an issue with trace not being displayed correctly first time animation mode is used. An exit simulation mode.
However I think we should merge anyway and fix this in trunk. We will need to do some work on how simulation works to support untimed nets anyway.
- 1364. By Kenneth Yrke Jørgensen
-
renamed SetTrace to setTrace to conform to standard
- 1365. By Kenneth Yrke Jørgensen
-
Now reset animation history before loading a trace
- 1366. By Kenneth Yrke Jørgensen
-
Fixed animation mode not correctly started
Kenneth Yrke Jørgensen (yrke) wrote : | # |
5) Fixed
Jiri Srba (srba) wrote : | # |
How do you reproduce 5)?
Jiri Srba (srba) wrote : | # |
6) Open intro example and then execute "Removing Timing Information" from tools. Extra arc anchor points get created at position (0,0).
Jiri Srba (srba) wrote : | # |
7) Open intro example, enter simulation mode (the spacing of panels on the left is unequal). Then select in View "Show advanced workspace" and the panels spacing is completely broken (e.g. too much empty space under the simulation trace).
Jiri Srba (srba) wrote : | # |
8) Open intro example, enter simulation and create manually some short trace. Then export the trace in Simulator menu. Go back to editor, enter the simulator again and open the just created trace. Now no trace is loaded and the GUI switches to editor.
- 1367. By Kenneth Yrke Jørgensen
-
Fixed an issue where there where more arcpath point inserted when removing timing from an transportarc
Kenneth Yrke Jørgensen (yrke) wrote : | # |
6)Fixed, problem when changing an transport-arc not restting default arcpath points.
- 1368. By Kenneth Yrke Jørgensen
-
Fixed import of trace exiting animation mode
Kenneth Yrke Jørgensen (yrke) wrote : | # |
8) Fixed, my fix for (5) broke this. Implemented a more robuste solution.
Kenneth Yrke Jørgensen (yrke) wrote : | # |
7) cant really reproduce, but I had an issue with the simulation history not showing if loading without settings, but this also happens in trunk.
I stated looking on this panel if we can do something to make it more consistent (also between architectures). There is also some wired behavior with width and small screens, I already did a bit of work on this in https:/
I think we need to rethink how the panel works when adding untimed nets, but its tightly coupled with both annimation and the template explorer, which makes it really hard to work on.
I have an suspicion that it might the the ScrollPane layout manager that is not playing nicely, will have a closer look.
Kenneth Yrke Jørgensen (yrke) wrote : | # |
@srba, can you please attach screenshots of 7
- 1369. By Kenneth Yrke Jørgensen
-
Upgraded swingx to 1.6.5-1 (latest)
Jiri Srba (srba) wrote : | # |
@kenneth, regarding 7) I don't know how to attach pictures here, so you will get them by email. The wrong size of panels is not because a small windows and it is not a problem in trunk either, only in this branch and only first time I enter the simulator.
- 1370. By Kenneth Yrke Jørgensen
-
Forced layout when switching to animationMode
- 1371. By Kenneth Yrke Jørgensen
-
Added do layout when first crating animation pane
- 1372. By Kenneth Yrke Jørgensen
-
removed doLayout
- 1373. By Kenneth Yrke Jørgensen
-
Fixed an issue where animationMode split pane size got changed every time chaning to animation mode
Kenneth Yrke Jørgensen (yrke) wrote : | # |
7) Fixed
Jiri Srba (srba) wrote : | # |
9) Align to Grid should be disabled in the animation/
Kenneth Yrke Jørgensen (yrke) wrote : | # |
9) can be reproduced in back to 3.6.0, could you make a bug report on it.
- 1374. By Kenneth Yrke Jørgensen
-
Disabled alight to grid in animation mode
Jiri Srba (srba) wrote : | # |
Also 9) is fixed now, to let's merge it to trunk.
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2018-12-30 15:18:00 +0000 |
3 | +++ .bzrignore 2020-04-28 09:05:34 +0000 |
4 | @@ -3,3 +3,4 @@ |
5 | .r |
6 | .bzr-repo |
7 | build |
8 | +out |
9 | |
10 | === added file '.editorconfig' |
11 | --- .editorconfig 1970-01-01 00:00:00 +0000 |
12 | +++ .editorconfig 2020-04-28 09:05:34 +0000 |
13 | @@ -0,0 +1,336 @@ |
14 | +root = true |
15 | + |
16 | +[*] |
17 | +charset = utf-8 |
18 | +#end_of_line = lf |
19 | +indent_size = 4 |
20 | +indent_style = space |
21 | +#insert_final_newline = false |
22 | +# max_line_length = 120 |
23 | +# tab_width = 4 |
24 | +# ij_continuation_indent_size = 8 |
25 | +# ij_formatter_off_tag = @formatter:off |
26 | +# ij_formatter_on_tag = @formatter:on |
27 | +# ij_formatter_tags_enabled = false |
28 | +# ij_smart_tabs = false |
29 | +# ij_wrap_on_typing = false |
30 | + |
31 | +[*.java] |
32 | +# ij_java_align_consecutive_assignments = false |
33 | +# ij_java_align_consecutive_variable_declarations = false |
34 | +# ij_java_align_group_field_declarations = false |
35 | +# ij_java_align_multiline_annotation_parameters = false |
36 | +# ij_java_align_multiline_array_initializer_expression = false |
37 | +# ij_java_align_multiline_assignment = false |
38 | +# ij_java_align_multiline_binary_operation = false |
39 | +# ij_java_align_multiline_chained_methods = false |
40 | +# ij_java_align_multiline_extends_list = false |
41 | +# ij_java_align_multiline_for = true |
42 | +# ij_java_align_multiline_method_parentheses = false |
43 | +# ij_java_align_multiline_parameters = true |
44 | +# ij_java_align_multiline_parameters_in_calls = false |
45 | +# ij_java_align_multiline_parenthesized_expression = false |
46 | +# ij_java_align_multiline_resources = true |
47 | +# ij_java_align_multiline_ternary_operation = false |
48 | +# ij_java_align_multiline_text_blocks = false |
49 | +# ij_java_align_multiline_throws_list = false |
50 | +# ij_java_align_subsequent_simple_methods = false |
51 | +# ij_java_align_throws_keyword = false |
52 | +# ij_java_annotation_parameter_wrap = off |
53 | +# ij_java_array_initializer_new_line_after_left_brace = false |
54 | +# ij_java_array_initializer_right_brace_on_new_line = false |
55 | +# ij_java_array_initializer_wrap = off |
56 | +# ij_java_assert_statement_colon_on_next_line = false |
57 | +# ij_java_assert_statement_wrap = off |
58 | +# ij_java_assignment_wrap = off |
59 | +# ij_java_binary_operation_sign_on_next_line = false |
60 | +# ij_java_binary_operation_wrap = off |
61 | +# ij_java_blank_lines_after_anonymous_class_header = 0 |
62 | +# ij_java_blank_lines_after_class_header = 0 |
63 | +# ij_java_blank_lines_after_imports = 1 |
64 | +# ij_java_blank_lines_after_package = 1 |
65 | +# ij_java_blank_lines_around_class = 1 |
66 | +# ij_java_blank_lines_around_field = 0 |
67 | +# ij_java_blank_lines_around_field_in_interface = 0 |
68 | +# ij_java_blank_lines_around_initializer = 1 |
69 | +# ij_java_blank_lines_around_method = 1 |
70 | +# ij_java_blank_lines_around_method_in_interface = 1 |
71 | +# ij_java_blank_lines_before_class_end = 0 |
72 | +# ij_java_blank_lines_before_imports = 1 |
73 | +# ij_java_blank_lines_before_method_body = 0 |
74 | +# ij_java_blank_lines_before_package = 0 |
75 | +# ij_java_block_brace_style = end_of_line |
76 | +# ij_java_block_comment_at_first_column = true |
77 | +# ij_java_call_parameters_new_line_after_left_paren = false |
78 | +# ij_java_call_parameters_right_paren_on_new_line = false |
79 | +# ij_java_call_parameters_wrap = off |
80 | +# ij_java_case_statement_on_separate_line = true |
81 | +# ij_java_catch_on_new_line = false |
82 | +# ij_java_class_annotation_wrap = split_into_lines |
83 | +# ij_java_class_brace_style = end_of_line |
84 | +# ij_java_class_count_to_use_import_on_demand = 5 |
85 | +# ij_java_class_names_in_javadoc = 1 |
86 | +# ij_java_do_not_indent_top_level_class_members = false |
87 | +# ij_java_do_not_wrap_after_single_annotation = false |
88 | +# ij_java_do_while_brace_force = never |
89 | +# ij_java_doc_add_blank_line_after_description = true |
90 | +# ij_java_doc_add_blank_line_after_param_comments = false |
91 | +# ij_java_doc_add_blank_line_after_return = false |
92 | +# ij_java_doc_add_p_tag_on_empty_lines = true |
93 | +# ij_java_doc_align_exception_comments = true |
94 | +# ij_java_doc_align_param_comments = true |
95 | +# ij_java_doc_do_not_wrap_if_one_line = false |
96 | +# ij_java_doc_enable_formatting = true |
97 | +# ij_java_doc_enable_leading_asterisks = true |
98 | +# ij_java_doc_indent_on_continuation = false |
99 | +# ij_java_doc_keep_empty_lines = true |
100 | +# ij_java_doc_keep_empty_parameter_tag = true |
101 | +# ij_java_doc_keep_empty_return_tag = true |
102 | +# ij_java_doc_keep_empty_throws_tag = true |
103 | +# ij_java_doc_keep_invalid_tags = true |
104 | +# ij_java_doc_param_description_on_new_line = false |
105 | +# ij_java_doc_preserve_line_breaks = false |
106 | +# ij_java_doc_use_throws_not_exception_tag = true |
107 | +# ij_java_else_on_new_line = false |
108 | +# ij_java_entity_dd_suffix = EJB |
109 | +# ij_java_entity_eb_suffix = Bean |
110 | +# ij_java_entity_hi_suffix = Home |
111 | +# ij_java_entity_lhi_prefix = Local |
112 | +# ij_java_entity_lhi_suffix = Home |
113 | +# ij_java_entity_li_prefix = Local |
114 | +# ij_java_entity_pk_class = java.lang.String |
115 | +# ij_java_entity_vo_suffix = VO |
116 | +# ij_java_enum_constants_wrap = off |
117 | +# ij_java_extends_keyword_wrap = off |
118 | +# ij_java_extends_list_wrap = off |
119 | +# ij_java_field_annotation_wrap = split_into_lines |
120 | +# ij_java_finally_on_new_line = false |
121 | +# ij_java_for_brace_force = never |
122 | +# ij_java_for_statement_new_line_after_left_paren = false |
123 | +# ij_java_for_statement_right_paren_on_new_line = false |
124 | +# ij_java_for_statement_wrap = off |
125 | +# ij_java_generate_final_locals = false |
126 | +# ij_java_generate_final_parameters = false |
127 | +# ij_java_if_brace_force = never |
128 | +# ij_java_imports_layout = *,|,javax.**,java.**,|,$* |
129 | +# ij_java_indent_case_from_switch = true |
130 | +# ij_java_insert_inner_class_imports = false |
131 | +# ij_java_insert_override_annotation = true |
132 | +# ij_java_keep_blank_lines_before_right_brace = 2 |
133 | +# ij_java_keep_blank_lines_between_package_declaration_and_header = 2 |
134 | +# ij_java_keep_blank_lines_in_code = 2 |
135 | +# ij_java_keep_blank_lines_in_declarations = 2 |
136 | +# ij_java_keep_control_statement_in_one_line = true |
137 | +# ij_java_keep_first_column_comment = true |
138 | +# ij_java_keep_indents_on_empty_lines = false |
139 | +# ij_java_keep_line_breaks = true |
140 | +# ij_java_keep_multiple_expressions_in_one_line = false |
141 | +# ij_java_keep_simple_blocks_in_one_line = false |
142 | +# ij_java_keep_simple_classes_in_one_line = false |
143 | +# ij_java_keep_simple_lambdas_in_one_line = false |
144 | +# ij_java_keep_simple_methods_in_one_line = false |
145 | +# ij_java_label_indent_absolute = false |
146 | +# ij_java_label_indent_size = 0 |
147 | +# ij_java_lambda_brace_style = end_of_line |
148 | +# ij_java_layout_static_imports_separately = true |
149 | +# ij_java_line_comment_add_space = false |
150 | +# ij_java_line_comment_at_first_column = true |
151 | +# ij_java_message_dd_suffix = EJB |
152 | +# ij_java_message_eb_suffix = Bean |
153 | +# ij_java_method_annotation_wrap = split_into_lines |
154 | +# ij_java_method_brace_style = end_of_line |
155 | +# ij_java_method_call_chain_wrap = off |
156 | +# ij_java_method_parameters_new_line_after_left_paren = false |
157 | +# ij_java_method_parameters_right_paren_on_new_line = false |
158 | +# ij_java_method_parameters_wrap = off |
159 | +# ij_java_modifier_list_wrap = false |
160 | +# ij_java_names_count_to_use_import_on_demand = 3 |
161 | +# ij_java_packages_to_use_import_on_demand = java.awt.*,javax.swing.* |
162 | +# ij_java_parameter_annotation_wrap = off |
163 | +# ij_java_parentheses_expression_new_line_after_left_paren = false |
164 | +# ij_java_parentheses_expression_right_paren_on_new_line = false |
165 | +# ij_java_place_assignment_sign_on_next_line = false |
166 | +# ij_java_prefer_longer_names = true |
167 | +# ij_java_prefer_parameters_wrap = false |
168 | +# ij_java_repeat_synchronized = true |
169 | +# ij_java_replace_instanceof_and_cast = false |
170 | +# ij_java_replace_null_check = true |
171 | +# ij_java_replace_sum_lambda_with_method_ref = true |
172 | +# ij_java_resource_list_new_line_after_left_paren = false |
173 | +# ij_java_resource_list_right_paren_on_new_line = false |
174 | +# ij_java_resource_list_wrap = off |
175 | +# ij_java_session_dd_suffix = EJB |
176 | +# ij_java_session_eb_suffix = Bean |
177 | +# ij_java_session_hi_suffix = Home |
178 | +# ij_java_session_lhi_prefix = Local |
179 | +# ij_java_session_lhi_suffix = Home |
180 | +# ij_java_session_li_prefix = Local |
181 | +# ij_java_session_si_suffix = Service |
182 | +# ij_java_space_after_closing_angle_bracket_in_type_argument = false |
183 | +# ij_java_space_after_colon = true |
184 | +# ij_java_space_after_comma = true |
185 | +# ij_java_space_after_comma_in_type_arguments = true |
186 | +# ij_java_space_after_for_semicolon = true |
187 | +# ij_java_space_after_quest = true |
188 | +# ij_java_space_after_type_cast = true |
189 | +# ij_java_space_before_annotation_array_initializer_left_brace = false |
190 | +# ij_java_space_before_annotation_parameter_list = false |
191 | +# ij_java_space_before_array_initializer_left_brace = false |
192 | +# ij_java_space_before_catch_keyword = true |
193 | +# ij_java_space_before_catch_left_brace = true |
194 | +# ij_java_space_before_catch_parentheses = true |
195 | +# ij_java_space_before_class_left_brace = true |
196 | +# ij_java_space_before_colon = true |
197 | +# ij_java_space_before_colon_in_foreach = true |
198 | +# ij_java_space_before_comma = false |
199 | +# ij_java_space_before_do_left_brace = true |
200 | +# ij_java_space_before_else_keyword = true |
201 | +# ij_java_space_before_else_left_brace = true |
202 | +# ij_java_space_before_finally_keyword = true |
203 | +# ij_java_space_before_finally_left_brace = true |
204 | +# ij_java_space_before_for_left_brace = true |
205 | +# ij_java_space_before_for_parentheses = true |
206 | +# ij_java_space_before_for_semicolon = false |
207 | +# ij_java_space_before_if_left_brace = true |
208 | +# ij_java_space_before_if_parentheses = true |
209 | +# ij_java_space_before_method_call_parentheses = false |
210 | +# ij_java_space_before_method_left_brace = true |
211 | +# ij_java_space_before_method_parentheses = false |
212 | +# ij_java_space_before_opening_angle_bracket_in_type_parameter = false |
213 | +# ij_java_space_before_quest = true |
214 | +# ij_java_space_before_switch_left_brace = true |
215 | +# ij_java_space_before_switch_parentheses = true |
216 | +# ij_java_space_before_synchronized_left_brace = true |
217 | +# ij_java_space_before_synchronized_parentheses = true |
218 | +# ij_java_space_before_try_left_brace = true |
219 | +# ij_java_space_before_try_parentheses = true |
220 | +# ij_java_space_before_type_parameter_list = false |
221 | +# ij_java_space_before_while_keyword = true |
222 | +# ij_java_space_before_while_left_brace = true |
223 | +# ij_java_space_before_while_parentheses = true |
224 | +# ij_java_space_inside_one_line_enum_braces = false |
225 | +# ij_java_space_within_empty_array_initializer_braces = false |
226 | +# ij_java_space_within_empty_method_call_parentheses = false |
227 | +# ij_java_space_within_empty_method_parentheses = false |
228 | +# ij_java_spaces_around_additive_operators = true |
229 | +# ij_java_spaces_around_assignment_operators = true |
230 | +# ij_java_spaces_around_bitwise_operators = true |
231 | +# ij_java_spaces_around_equality_operators = true |
232 | +# ij_java_spaces_around_lambda_arrow = true |
233 | +# ij_java_spaces_around_logical_operators = true |
234 | +# ij_java_spaces_around_method_ref_dbl_colon = false |
235 | +# ij_java_spaces_around_multiplicative_operators = true |
236 | +# ij_java_spaces_around_relational_operators = true |
237 | +# ij_java_spaces_around_shift_operators = true |
238 | +# ij_java_spaces_around_type_bounds_in_type_parameters = true |
239 | +# ij_java_spaces_around_unary_operator = false |
240 | +# ij_java_spaces_within_angle_brackets = false |
241 | +# ij_java_spaces_within_annotation_parentheses = false |
242 | +# ij_java_spaces_within_array_initializer_braces = false |
243 | +# ij_java_spaces_within_braces = false |
244 | +# ij_java_spaces_within_brackets = false |
245 | +# ij_java_spaces_within_cast_parentheses = false |
246 | +# ij_java_spaces_within_catch_parentheses = false |
247 | +# ij_java_spaces_within_for_parentheses = false |
248 | +# ij_java_spaces_within_if_parentheses = false |
249 | +# ij_java_spaces_within_method_call_parentheses = false |
250 | +# ij_java_spaces_within_method_parentheses = false |
251 | +# ij_java_spaces_within_parentheses = false |
252 | +# ij_java_spaces_within_switch_parentheses = false |
253 | +# ij_java_spaces_within_synchronized_parentheses = false |
254 | +# ij_java_spaces_within_try_parentheses = false |
255 | +# ij_java_spaces_within_while_parentheses = false |
256 | +# ij_java_special_else_if_treatment = true |
257 | +# ij_java_subclass_name_suffix = Impl |
258 | +# ij_java_ternary_operation_signs_on_next_line = false |
259 | +# ij_java_ternary_operation_wrap = off |
260 | +# ij_java_test_name_suffix = Test |
261 | +# ij_java_throws_keyword_wrap = off |
262 | +# ij_java_throws_list_wrap = off |
263 | +# ij_java_use_external_annotations = false |
264 | +# ij_java_use_fq_class_names = false |
265 | +# ij_java_use_relative_indents = false |
266 | +# ij_java_use_single_class_imports = true |
267 | +# ij_java_variable_annotation_wrap = off |
268 | +# ij_java_visibility = public |
269 | +# ij_java_while_brace_force = never |
270 | +# ij_java_while_on_new_line = false |
271 | +# ij_java_wrap_comments = false |
272 | +# ij_java_wrap_first_method_in_call_chain = false |
273 | +# ij_java_wrap_long_lines = false |
274 | + |
275 | +[{*.kts,*.kt}] |
276 | +# ij_kotlin_align_in_columns_case_branch = false |
277 | +# ij_kotlin_align_multiline_binary_operation = false |
278 | +# ij_kotlin_align_multiline_extends_list = false |
279 | +# ij_kotlin_align_multiline_method_parentheses = false |
280 | +# ij_kotlin_align_multiline_parameters = true |
281 | +# ij_kotlin_align_multiline_parameters_in_calls = false |
282 | +# ij_kotlin_assignment_wrap = off |
283 | +# ij_kotlin_blank_lines_after_class_header = 0 |
284 | +# ij_kotlin_blank_lines_around_block_when_branches = 0 |
285 | +# ij_kotlin_block_comment_at_first_column = true |
286 | +# ij_kotlin_call_parameters_new_line_after_left_paren = false |
287 | +# ij_kotlin_call_parameters_right_paren_on_new_line = false |
288 | +# ij_kotlin_call_parameters_wrap = off |
289 | +# ij_kotlin_catch_on_new_line = false |
290 | +# ij_kotlin_class_annotation_wrap = split_into_lines |
291 | +# ij_kotlin_continuation_indent_for_chained_calls = true |
292 | +# ij_kotlin_continuation_indent_for_expression_bodies = true |
293 | +# ij_kotlin_continuation_indent_in_argument_lists = true |
294 | +# ij_kotlin_continuation_indent_in_elvis = true |
295 | +# ij_kotlin_continuation_indent_in_if_conditions = true |
296 | +# ij_kotlin_continuation_indent_in_parameter_lists = true |
297 | +# ij_kotlin_continuation_indent_in_supertype_lists = true |
298 | +# ij_kotlin_else_on_new_line = false |
299 | +# ij_kotlin_enum_constants_wrap = off |
300 | +# ij_kotlin_extends_list_wrap = off |
301 | +# ij_kotlin_field_annotation_wrap = split_into_lines |
302 | +# ij_kotlin_finally_on_new_line = false |
303 | +# ij_kotlin_if_rparen_on_new_line = false |
304 | +# ij_kotlin_import_nested_classes = false |
305 | +# ij_kotlin_insert_whitespaces_in_simple_one_line_method = true |
306 | +# ij_kotlin_keep_blank_lines_before_right_brace = 2 |
307 | +# ij_kotlin_keep_blank_lines_in_code = 2 |
308 | +# ij_kotlin_keep_blank_lines_in_declarations = 2 |
309 | +# ij_kotlin_keep_first_column_comment = true |
310 | +# ij_kotlin_keep_indents_on_empty_lines = false |
311 | +# ij_kotlin_keep_line_breaks = true |
312 | +# ij_kotlin_lbrace_on_next_line = false |
313 | +# ij_kotlin_line_comment_add_space = false |
314 | +# ij_kotlin_line_comment_at_first_column = true |
315 | +# ij_kotlin_method_annotation_wrap = split_into_lines |
316 | +# ij_kotlin_method_call_chain_wrap = off |
317 | +# ij_kotlin_method_parameters_new_line_after_left_paren = false |
318 | +# ij_kotlin_method_parameters_right_paren_on_new_line = false |
319 | +# ij_kotlin_method_parameters_wrap = off |
320 | +# ij_kotlin_name_count_to_use_star_import = 5 |
321 | +# ij_kotlin_name_count_to_use_star_import_for_members = 3 |
322 | +# ij_kotlin_parameter_annotation_wrap = off |
323 | +# ij_kotlin_space_after_comma = true |
324 | +# ij_kotlin_space_after_extend_colon = true |
325 | +# ij_kotlin_space_after_type_colon = true |
326 | +# ij_kotlin_space_before_catch_parentheses = true |
327 | +# ij_kotlin_space_before_comma = false |
328 | +# ij_kotlin_space_before_extend_colon = true |
329 | +# ij_kotlin_space_before_for_parentheses = true |
330 | +# ij_kotlin_space_before_if_parentheses = true |
331 | +# ij_kotlin_space_before_lambda_arrow = true |
332 | +# ij_kotlin_space_before_type_colon = false |
333 | +# ij_kotlin_space_before_when_parentheses = true |
334 | +# ij_kotlin_space_before_while_parentheses = true |
335 | +# ij_kotlin_spaces_around_additive_operators = true |
336 | +# ij_kotlin_spaces_around_assignment_operators = true |
337 | +# ij_kotlin_spaces_around_equality_operators = true |
338 | +# ij_kotlin_spaces_around_function_type_arrow = true |
339 | +# ij_kotlin_spaces_around_logical_operators = true |
340 | +# ij_kotlin_spaces_around_multiplicative_operators = true |
341 | +# ij_kotlin_spaces_around_range = false |
342 | +# ij_kotlin_spaces_around_relational_operators = true |
343 | +# ij_kotlin_spaces_around_unary_operator = false |
344 | +# ij_kotlin_spaces_around_when_arrow = true |
345 | +# ij_kotlin_variable_annotation_wrap = off |
346 | +# ij_kotlin_while_on_new_line = false |
347 | +# ij_kotlin_wrap_elvis_expressions = 1 |
348 | +# ij_kotlin_wrap_expression_body_functions = 0 |
349 | +# ij_kotlin_wrap_first_method_in_call_chain = false |
350 | |
351 | === removed file 'Makefile' |
352 | === modified file 'build.gradle' |
353 | --- build.gradle 2018-07-10 18:02:32 +0000 |
354 | +++ build.gradle 2020-04-28 09:05:34 +0000 |
355 | @@ -1,13 +1,16 @@ |
356 | plugins { |
357 | id 'java' |
358 | id 'application' |
359 | + id 'org.jetbrains.kotlin.jvm' version '1.3.71' |
360 | } |
361 | |
362 | group 'net.tapaal' |
363 | -version '3.4-SNAPSHOT' |
364 | +version '4.0-SNAPSHOT' |
365 | |
366 | -sourceCompatibility = 1.6 |
367 | -targetCompatibility = 1.6 |
368 | +java { |
369 | + sourceCompatibility = JavaVersion.VERSION_1_8 |
370 | + targetCompatibility = JavaVersion.VERSION_1_8 |
371 | +} |
372 | |
373 | repositories { |
374 | mavenCentral() |
375 | @@ -26,9 +29,11 @@ |
376 | srcDirs = ['src/'] |
377 | include("resources/") |
378 | } |
379 | - //test { |
380 | - // srcDirs = ['tests'] |
381 | - //} |
382 | + test { |
383 | + java { |
384 | + srcDirs = ['tests/'] |
385 | + } |
386 | + } |
387 | } |
388 | } |
389 | |
390 | @@ -46,12 +51,37 @@ |
391 | } |
392 | |
393 | dependencies { |
394 | - //compile group: 'commons-cli', name: 'commons-cli', version: '1.4' |
395 | - //compile group: 'org.swinglabs.swingx', name: 'swingx-all', version: '1.6.3' |
396 | - //compile group: 'net.java.dev.jna', name: 'jna', version: '4.5.1' |
397 | + implementation group: 'commons-cli', name: 'commons-cli', version: '1.4' |
398 | + implementation group: 'org.swinglabs.swingx', name: 'swingx-all', version: '1.6.5-1' |
399 | + implementation group: 'net.java.dev.jna', name: 'jna', version: '4.5.1' |
400 | //compile group: 'com.apple', name: 'AppleJavaExtensions', version: '1.4' // Not working |
401 | |
402 | //Add jars from libs dir |
403 | - compile fileTree(dir: 'libs', include: ['*.jar']) |
404 | - testCompile group: 'junit', name: 'junit', version: '4.12' |
405 | + implementation fileTree(dir: 'libs', include: ['*.jar']) |
406 | + |
407 | + //Junit |
408 | + testImplementation( |
409 | + 'org.junit.jupiter:junit-jupiter-api:5.4.2' |
410 | + ) |
411 | + testRuntimeOnly( |
412 | + 'org.junit.jupiter:junit-jupiter-engine:5.4.2', |
413 | + 'org.junit.vintage:junit-vintage-engine:5.4.2' |
414 | + ) |
415 | + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" |
416 | +} |
417 | +test { |
418 | + useJUnitPlatform() |
419 | + afterTest { desc, result -> |
420 | + logger.quiet "Executing test ${desc.name} [${desc.className}] with result: ${result.resultType}" |
421 | + } |
422 | +} |
423 | +compileKotlin { |
424 | + kotlinOptions { |
425 | + jvmTarget = "1.8" |
426 | + } |
427 | +} |
428 | +compileTestKotlin { |
429 | + kotlinOptions { |
430 | + jvmTarget = "1.8" |
431 | + } |
432 | } |
433 | |
434 | === added file 'gradle/wrapper/gradle-wrapper.jar' |
435 | Binary files gradle/wrapper/gradle-wrapper.jar 1970-01-01 00:00:00 +0000 and gradle/wrapper/gradle-wrapper.jar 2020-04-28 09:05:34 +0000 differ |
436 | === removed file 'gradle/wrapper/gradle-wrapper.jar' |
437 | Binary files gradle/wrapper/gradle-wrapper.jar 2018-07-10 18:02:32 +0000 and gradle/wrapper/gradle-wrapper.jar 1970-01-01 00:00:00 +0000 differ |
438 | === modified file 'gradle/wrapper/gradle-wrapper.properties' |
439 | --- gradle/wrapper/gradle-wrapper.properties 2019-02-27 18:32:04 +0000 |
440 | +++ gradle/wrapper/gradle-wrapper.properties 2020-04-28 09:05:34 +0000 |
441 | @@ -1,5 +1,6 @@ |
442 | +#Mon Apr 06 14:40:09 CEST 2020 |
443 | +distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip |
444 | distributionBase=GRADLE_USER_HOME |
445 | distributionPath=wrapper/dists |
446 | +zipStorePath=wrapper/dists |
447 | zipStoreBase=GRADLE_USER_HOME |
448 | -zipStorePath=wrapper/dists |
449 | -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip |
450 | |
451 | === modified file 'gradlew' |
452 | --- gradlew 2018-07-10 18:02:32 +0000 |
453 | +++ gradlew 2020-04-28 09:05:34 +0000 |
454 | @@ -1,5 +1,21 @@ |
455 | #!/usr/bin/env sh |
456 | |
457 | +# |
458 | +# Copyright 2015 the original author or authors. |
459 | +# |
460 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
461 | +# you may not use this file except in compliance with the License. |
462 | +# You may obtain a copy of the License at |
463 | +# |
464 | +# https://www.apache.org/licenses/LICENSE-2.0 |
465 | +# |
466 | +# Unless required by applicable law or agreed to in writing, software |
467 | +# distributed under the License is distributed on an "AS IS" BASIS, |
468 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
469 | +# See the License for the specific language governing permissions and |
470 | +# limitations under the License. |
471 | +# |
472 | + |
473 | ############################################################################## |
474 | ## |
475 | ## Gradle start up script for UN*X |
476 | @@ -28,7 +44,7 @@ |
477 | APP_BASE_NAME=`basename "$0"` |
478 | |
479 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. |
480 | -DEFAULT_JVM_OPTS="" |
481 | +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' |
482 | |
483 | # Use the maximum available, or set MAX_FD != -1 to use that value. |
484 | MAX_FD="maximum" |
485 | @@ -109,8 +125,8 @@ |
486 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" |
487 | fi |
488 | |
489 | -# For Cygwin, switch paths to Windows format before running java |
490 | -if $cygwin ; then |
491 | +# For Cygwin or MSYS, switch paths to Windows format before running java |
492 | +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then |
493 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` |
494 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` |
495 | JAVACMD=`cygpath --unix "$JAVACMD"` |
496 | @@ -138,19 +154,19 @@ |
497 | else |
498 | eval `echo args$i`="\"$arg\"" |
499 | fi |
500 | - i=$((i+1)) |
501 | + i=`expr $i + 1` |
502 | done |
503 | case $i in |
504 | - (0) set -- ;; |
505 | - (1) set -- "$args0" ;; |
506 | - (2) set -- "$args0" "$args1" ;; |
507 | - (3) set -- "$args0" "$args1" "$args2" ;; |
508 | - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; |
509 | - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; |
510 | - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; |
511 | - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; |
512 | - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; |
513 | - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; |
514 | + 0) set -- ;; |
515 | + 1) set -- "$args0" ;; |
516 | + 2) set -- "$args0" "$args1" ;; |
517 | + 3) set -- "$args0" "$args1" "$args2" ;; |
518 | + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; |
519 | + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; |
520 | + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; |
521 | + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; |
522 | + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; |
523 | + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; |
524 | esac |
525 | fi |
526 | |
527 | @@ -159,14 +175,9 @@ |
528 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done |
529 | echo " " |
530 | } |
531 | -APP_ARGS=$(save "$@") |
532 | +APP_ARGS=`save "$@"` |
533 | |
534 | # Collect all arguments for the java command, following the shell quoting and substitution rules |
535 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" |
536 | |
537 | -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong |
538 | -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then |
539 | - cd "$(dirname "$0")" |
540 | -fi |
541 | - |
542 | exec "$JAVACMD" "$@" |
543 | |
544 | === modified file 'gradlew.bat' |
545 | --- gradlew.bat 2018-07-10 18:02:32 +0000 |
546 | +++ gradlew.bat 2020-04-28 09:05:34 +0000 |
547 | @@ -1,3 +1,19 @@ |
548 | +@rem |
549 | +@rem Copyright 2015 the original author or authors. |
550 | +@rem |
551 | +@rem Licensed under the Apache License, Version 2.0 (the "License"); |
552 | +@rem you may not use this file except in compliance with the License. |
553 | +@rem You may obtain a copy of the License at |
554 | +@rem |
555 | +@rem https://www.apache.org/licenses/LICENSE-2.0 |
556 | +@rem |
557 | +@rem Unless required by applicable law or agreed to in writing, software |
558 | +@rem distributed under the License is distributed on an "AS IS" BASIS, |
559 | +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
560 | +@rem See the License for the specific language governing permissions and |
561 | +@rem limitations under the License. |
562 | +@rem |
563 | + |
564 | @if "%DEBUG%" == "" @echo off |
565 | @rem ########################################################################## |
566 | @rem |
567 | @@ -13,8 +29,11 @@ |
568 | set APP_BASE_NAME=%~n0 |
569 | set APP_HOME=%DIRNAME% |
570 | |
571 | +@rem Resolve any "." and ".." in APP_HOME to make it shorter. |
572 | +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi |
573 | + |
574 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. |
575 | -set DEFAULT_JVM_OPTS= |
576 | +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" |
577 | |
578 | @rem Find java.exe |
579 | if defined JAVA_HOME goto findJavaFromJavaHome |
580 | |
581 | === removed file 'libs/commons-cli-1.2.jar' |
582 | Binary files libs/commons-cli-1.2.jar 2011-01-26 11:08:23 +0000 and libs/commons-cli-1.2.jar 1970-01-01 00:00:00 +0000 differ |
583 | === removed file 'libs/jna.jar' |
584 | Binary files libs/jna.jar 2013-02-26 09:52:28 +0000 and libs/jna.jar 1970-01-01 00:00:00 +0000 differ |
585 | === removed file 'libs/swingx-all-1.6.3.jar' |
586 | Binary files libs/swingx-all-1.6.3.jar 2012-03-20 08:17:38 +0000 and libs/swingx-all-1.6.3.jar 1970-01-01 00:00:00 +0000 differ |
587 | === removed file 'run-tapaal-j6.sh' |
588 | === removed file 'run-tapaal-j7.sh' |
589 | === modified file 'src/dk/aau/cs/TCTL/CTLParsing/ParseException.java' |
590 | --- src/dk/aau/cs/TCTL/CTLParsing/ParseException.java 2017-09-05 21:24:23 +0000 |
591 | +++ src/dk/aau/cs/TCTL/CTLParsing/ParseException.java 2020-04-28 09:05:34 +0000 |
592 | @@ -89,7 +89,7 @@ |
593 | int[][] expectedTokenSequences, |
594 | String[] tokenImage) { |
595 | String eol = System.getProperty("line.separator", "\n"); |
596 | - StringBuffer expected = new StringBuffer(); |
597 | + StringBuilder expected = new StringBuilder(); |
598 | int maxSize = 0; |
599 | for (int i = 0; i < expectedTokenSequences.length; i++) { |
600 | if (maxSize < expectedTokenSequences[i].length) { |
601 | @@ -139,7 +139,7 @@ |
602 | * string literal. |
603 | */ |
604 | static String add_escapes(String str) { |
605 | - StringBuffer retval = new StringBuffer(); |
606 | + StringBuilder retval = new StringBuilder(); |
607 | char ch; |
608 | for (int i = 0; i < str.length(); i++) { |
609 | switch (str.charAt(i)) |
610 | |
611 | === modified file 'src/dk/aau/cs/TCTL/CTLParsing/TAPAALCTLQueryParser.java' |
612 | --- src/dk/aau/cs/TCTL/CTLParsing/TAPAALCTLQueryParser.java 2017-09-05 21:24:23 +0000 |
613 | +++ src/dk/aau/cs/TCTL/CTLParsing/TAPAALCTLQueryParser.java 2020-04-28 09:05:34 +0000 |
614 | @@ -13,7 +13,6 @@ |
615 | import dk.aau.cs.TCTL.TCTLAGNode; |
616 | import dk.aau.cs.TCTL.TCTLAUNode; |
617 | import dk.aau.cs.TCTL.TCTLAXNode; |
618 | -import dk.aau.cs.TCTL.TCTLAbstractProperty; |
619 | import dk.aau.cs.TCTL.TCTLAbstractStateProperty; |
620 | import dk.aau.cs.TCTL.TCTLAbstractPathProperty; |
621 | import dk.aau.cs.TCTL.TCTLAndListNode; |
622 | |
623 | === modified file 'src/dk/aau/cs/TCTL/CTLParsing/TAPAALCTLQueryParserTokenManager.java' |
624 | --- src/dk/aau/cs/TCTL/CTLParsing/TAPAALCTLQueryParserTokenManager.java 2017-09-05 21:24:23 +0000 |
625 | +++ src/dk/aau/cs/TCTL/CTLParsing/TAPAALCTLQueryParserTokenManager.java 2020-04-28 09:05:34 +0000 |
626 | @@ -1,32 +1,5 @@ |
627 | /* Generated By:JavaCC: Do not edit this line. TAPAALCTLQueryParserTokenManager.java */ |
628 | package dk.aau.cs.TCTL.CTLParsing; |
629 | -import java.io.StringReader; |
630 | -import java.util.ArrayList; |
631 | -import dk.aau.cs.TCTL.AritmeticOperator; |
632 | -import dk.aau.cs.TCTL.TCTLTermListNode; |
633 | -import dk.aau.cs.TCTL.TCTLPlaceNode; |
634 | -import dk.aau.cs.TCTL.TCTLTransitionNode; |
635 | -import dk.aau.cs.TCTL.TCTLConstNode; |
636 | -import dk.aau.cs.TCTL.TCTLAFNode; |
637 | -import dk.aau.cs.TCTL.TCTLAGNode; |
638 | -import dk.aau.cs.TCTL.TCTLAUNode; |
639 | -import dk.aau.cs.TCTL.TCTLAXNode; |
640 | -import dk.aau.cs.TCTL.TCTLAbstractProperty; |
641 | -import dk.aau.cs.TCTL.TCTLAbstractStateProperty; |
642 | -import dk.aau.cs.TCTL.TCTLAbstractPathProperty; |
643 | -import dk.aau.cs.TCTL.TCTLAndListNode; |
644 | -import dk.aau.cs.TCTL.TCTLAtomicPropositionNode; |
645 | -import dk.aau.cs.TCTL.TCTLEFNode; |
646 | -import dk.aau.cs.TCTL.TCTLEGNode; |
647 | -import dk.aau.cs.TCTL.TCTLEUNode; |
648 | -import dk.aau.cs.TCTL.TCTLEXNode; |
649 | -import dk.aau.cs.TCTL.TCTLFalseNode; |
650 | -import dk.aau.cs.TCTL.TCTLNotNode; |
651 | -import dk.aau.cs.TCTL.TCTLOrListNode; |
652 | -import dk.aau.cs.TCTL.TCTLTrueNode; |
653 | -import dk.aau.cs.TCTL.TCTLDeadlockNode; |
654 | -import dk.aau.cs.TCTL.TCTLPathToStateConverter; |
655 | -import dk.aau.cs.TCTL.TCTLStateToPathConverter; |
656 | |
657 | /** Token Manager. */ |
658 | public class TAPAALCTLQueryParserTokenManager implements TAPAALCTLQueryParserConstants |
659 | |
660 | === modified file 'src/dk/aau/cs/TCTL/CTLParsing/TokenMgrError.java' |
661 | --- src/dk/aau/cs/TCTL/CTLParsing/TokenMgrError.java 2017-09-05 21:24:23 +0000 |
662 | +++ src/dk/aau/cs/TCTL/CTLParsing/TokenMgrError.java 2020-04-28 09:05:34 +0000 |
663 | @@ -48,7 +48,7 @@ |
664 | * equivalents in the given string |
665 | */ |
666 | protected static final String addEscapes(String str) { |
667 | - StringBuffer retval = new StringBuffer(); |
668 | + StringBuilder retval = new StringBuilder(); |
669 | char ch; |
670 | for (int i = 0; i < str.length(); i++) { |
671 | switch (str.charAt(i)) |
672 | |
673 | === modified file 'src/dk/aau/cs/TCTL/Parsing/ParseException.java' |
674 | --- src/dk/aau/cs/TCTL/Parsing/ParseException.java 2013-05-18 11:33:14 +0000 |
675 | +++ src/dk/aau/cs/TCTL/Parsing/ParseException.java 2020-04-28 09:05:34 +0000 |
676 | @@ -89,7 +89,7 @@ |
677 | int[][] expectedTokenSequences, |
678 | String[] tokenImage) { |
679 | String eol = System.getProperty("line.separator", "\n"); |
680 | - StringBuffer expected = new StringBuffer(); |
681 | + StringBuilder expected = new StringBuilder(); |
682 | int maxSize = 0; |
683 | for (int i = 0; i < expectedTokenSequences.length; i++) { |
684 | if (maxSize < expectedTokenSequences[i].length) { |
685 | @@ -139,7 +139,7 @@ |
686 | * string literal. |
687 | */ |
688 | static String add_escapes(String str) { |
689 | - StringBuffer retval = new StringBuffer(); |
690 | + StringBuilder retval = new StringBuilder(); |
691 | char ch; |
692 | for (int i = 0; i < str.length(); i++) { |
693 | switch (str.charAt(i)) |
694 | |
695 | === modified file 'src/dk/aau/cs/TCTL/Parsing/TAPAALQueryParserTokenManager.java' |
696 | --- src/dk/aau/cs/TCTL/Parsing/TAPAALQueryParserTokenManager.java 2014-05-22 20:26:41 +0000 |
697 | +++ src/dk/aau/cs/TCTL/Parsing/TAPAALQueryParserTokenManager.java 2020-04-28 09:05:34 +0000 |
698 | @@ -1,25 +1,5 @@ |
699 | /* Generated By:JavaCC: Do not edit this line. TAPAALQueryParserTokenManager.java */ |
700 | package dk.aau.cs.TCTL.Parsing; |
701 | -import java.io.StringReader; |
702 | -import java.util.ArrayList; |
703 | -import dk.aau.cs.TCTL.AritmeticOperator; |
704 | -import dk.aau.cs.TCTL.TCTLPlusListNode; |
705 | -import dk.aau.cs.TCTL.TCTLTermListNode; |
706 | -import dk.aau.cs.TCTL.TCTLPlaceNode; |
707 | -import dk.aau.cs.TCTL.TCTLConstNode; |
708 | -import dk.aau.cs.TCTL.TCTLAFNode; |
709 | -import dk.aau.cs.TCTL.TCTLAGNode; |
710 | -import dk.aau.cs.TCTL.TCTLAbstractProperty; |
711 | -import dk.aau.cs.TCTL.TCTLAbstractStateProperty; |
712 | -import dk.aau.cs.TCTL.TCTLAndListNode; |
713 | -import dk.aau.cs.TCTL.TCTLAtomicPropositionNode; |
714 | -import dk.aau.cs.TCTL.TCTLEFNode; |
715 | -import dk.aau.cs.TCTL.TCTLEGNode; |
716 | -import dk.aau.cs.TCTL.TCTLFalseNode; |
717 | -import dk.aau.cs.TCTL.TCTLNotNode; |
718 | -import dk.aau.cs.TCTL.TCTLOrListNode; |
719 | -import dk.aau.cs.TCTL.TCTLTrueNode; |
720 | -import dk.aau.cs.TCTL.TCTLDeadlockNode; |
721 | |
722 | /** Token Manager. */ |
723 | public class TAPAALQueryParserTokenManager implements TAPAALQueryParserConstants |
724 | |
725 | === modified file 'src/dk/aau/cs/TCTL/Parsing/TokenMgrError.java' |
726 | --- src/dk/aau/cs/TCTL/Parsing/TokenMgrError.java 2013-05-18 11:33:14 +0000 |
727 | +++ src/dk/aau/cs/TCTL/Parsing/TokenMgrError.java 2020-04-28 09:05:34 +0000 |
728 | @@ -48,7 +48,7 @@ |
729 | * equivalents in the given string |
730 | */ |
731 | protected static final String addEscapes(String str) { |
732 | - StringBuffer retval = new StringBuffer(); |
733 | + StringBuilder retval = new StringBuilder(); |
734 | char ch; |
735 | for (int i = 0; i < str.length(); i++) { |
736 | switch (str.charAt(i)) |
737 | |
738 | === modified file 'src/dk/aau/cs/TCTL/SUMOParsing/ParseException.java' |
739 | --- src/dk/aau/cs/TCTL/SUMOParsing/ParseException.java 2014-02-19 21:29:27 +0000 |
740 | +++ src/dk/aau/cs/TCTL/SUMOParsing/ParseException.java 2020-04-28 09:05:34 +0000 |
741 | @@ -89,7 +89,7 @@ |
742 | int[][] expectedTokenSequences, |
743 | String[] tokenImage) { |
744 | String eol = System.getProperty("line.separator", "\n"); |
745 | - StringBuffer expected = new StringBuffer(); |
746 | + StringBuilder expected = new StringBuilder(); |
747 | int maxSize = 0; |
748 | for (int i = 0; i < expectedTokenSequences.length; i++) { |
749 | if (maxSize < expectedTokenSequences[i].length) { |
750 | @@ -139,7 +139,7 @@ |
751 | * string literal. |
752 | */ |
753 | static String add_escapes(String str) { |
754 | - StringBuffer retval = new StringBuffer(); |
755 | + StringBuilder retval = new StringBuilder(); |
756 | char ch; |
757 | for (int i = 0; i < str.length(); i++) { |
758 | switch (str.charAt(i)) |
759 | |
760 | === modified file 'src/dk/aau/cs/TCTL/SUMOParsing/SUMOQueryParser.java' |
761 | --- src/dk/aau/cs/TCTL/SUMOParsing/SUMOQueryParser.java 2014-06-04 16:01:51 +0000 |
762 | +++ src/dk/aau/cs/TCTL/SUMOParsing/SUMOQueryParser.java 2020-04-28 09:05:34 +0000 |
763 | @@ -6,7 +6,6 @@ |
764 | |
765 | import dk.aau.cs.TCTL.AritmeticOperator; |
766 | import dk.aau.cs.TCTL.TCTLPlusListNode; |
767 | -import dk.aau.cs.TCTL.TCTLTermListNode; |
768 | import dk.aau.cs.TCTL.TCTLPlaceNode; |
769 | import dk.aau.cs.TCTL.TCTLConstNode; |
770 | import dk.aau.cs.TCTL.TCTLAFNode; |
771 | |
772 | === modified file 'src/dk/aau/cs/TCTL/SUMOParsing/SUMOQueryParserTokenManager.java' |
773 | --- src/dk/aau/cs/TCTL/SUMOParsing/SUMOQueryParserTokenManager.java 2014-06-04 16:01:51 +0000 |
774 | +++ src/dk/aau/cs/TCTL/SUMOParsing/SUMOQueryParserTokenManager.java 2020-04-28 09:05:34 +0000 |
775 | @@ -1,25 +1,5 @@ |
776 | /* Generated By:JavaCC: Do not edit this line. SUMOQueryParserTokenManager.java */ |
777 | package dk.aau.cs.TCTL.SUMOParsing; |
778 | -import java.io.StringReader; |
779 | -import java.util.ArrayList; |
780 | -import dk.aau.cs.TCTL.AritmeticOperator; |
781 | -import dk.aau.cs.TCTL.TCTLPlusListNode; |
782 | -import dk.aau.cs.TCTL.TCTLTermListNode; |
783 | -import dk.aau.cs.TCTL.TCTLPlaceNode; |
784 | -import dk.aau.cs.TCTL.TCTLConstNode; |
785 | -import dk.aau.cs.TCTL.TCTLAFNode; |
786 | -import dk.aau.cs.TCTL.TCTLAGNode; |
787 | -import dk.aau.cs.TCTL.TCTLAbstractProperty; |
788 | -import dk.aau.cs.TCTL.TCTLAbstractStateProperty; |
789 | -import dk.aau.cs.TCTL.TCTLAndListNode; |
790 | -import dk.aau.cs.TCTL.TCTLAtomicPropositionNode; |
791 | -import dk.aau.cs.TCTL.TCTLEFNode; |
792 | -import dk.aau.cs.TCTL.TCTLEGNode; |
793 | -import dk.aau.cs.TCTL.TCTLFalseNode; |
794 | -import dk.aau.cs.TCTL.TCTLNotNode; |
795 | -import dk.aau.cs.TCTL.TCTLOrListNode; |
796 | -import dk.aau.cs.TCTL.TCTLTrueNode; |
797 | -import dk.aau.cs.TCTL.TCTLDeadlockNode; |
798 | |
799 | /** Token Manager. */ |
800 | public class SUMOQueryParserTokenManager implements SUMOQueryParserConstants |
801 | |
802 | === modified file 'src/dk/aau/cs/TCTL/SUMOParsing/TokenMgrError.java' |
803 | --- src/dk/aau/cs/TCTL/SUMOParsing/TokenMgrError.java 2014-02-19 21:29:27 +0000 |
804 | +++ src/dk/aau/cs/TCTL/SUMOParsing/TokenMgrError.java 2020-04-28 09:05:34 +0000 |
805 | @@ -48,7 +48,7 @@ |
806 | * equivalents in the given string |
807 | */ |
808 | protected static final String addEscapes(String str) { |
809 | - StringBuffer retval = new StringBuffer(); |
810 | + StringBuilder retval = new StringBuilder(); |
811 | char ch; |
812 | for (int i = 0; i < str.length(); i++) { |
813 | switch (str.charAt(i)) |
814 | |
815 | === modified file 'src/dk/aau/cs/TCTL/XMLParsing/QueryWrapper.java' |
816 | --- src/dk/aau/cs/TCTL/XMLParsing/QueryWrapper.java 2015-10-14 18:27:09 +0000 |
817 | +++ src/dk/aau/cs/TCTL/XMLParsing/QueryWrapper.java 2020-04-28 09:05:34 +0000 |
818 | @@ -35,11 +35,7 @@ |
819 | } |
820 | |
821 | public boolean hasException(){ |
822 | - if(this.exception == null){ |
823 | - return false; |
824 | - } else{ |
825 | - return true; |
826 | - } |
827 | + return this.exception != null; |
828 | } |
829 | |
830 | public String getNameAndException(){ |
831 | |
832 | === modified file 'src/dk/aau/cs/TCTL/visitors/BroadcastTranslationQueryVisitor.java' |
833 | --- src/dk/aau/cs/TCTL/visitors/BroadcastTranslationQueryVisitor.java 2014-05-22 20:26:41 +0000 |
834 | +++ src/dk/aau/cs/TCTL/visitors/BroadcastTranslationQueryVisitor.java 2020-04-28 09:05:34 +0000 |
835 | @@ -1,7 +1,5 @@ |
836 | package dk.aau.cs.TCTL.visitors; |
837 | |
838 | -import dk.aau.cs.TCTL.TCTLAtomicPropositionNode; |
839 | -import dk.aau.cs.TCTL.TCTLConstNode; |
840 | import dk.aau.cs.TCTL.TCTLPlaceNode; |
841 | |
842 | public class BroadcastTranslationQueryVisitor extends QueryVisitor { |
843 | |
844 | === modified file 'src/dk/aau/cs/TCTL/visitors/CTLQueryVisitor.java' |
845 | --- src/dk/aau/cs/TCTL/visitors/CTLQueryVisitor.java 2017-05-14 19:42:09 +0000 |
846 | +++ src/dk/aau/cs/TCTL/visitors/CTLQueryVisitor.java 2020-04-28 09:05:34 +0000 |
847 | @@ -4,7 +4,6 @@ |
848 | |
849 | import dk.aau.cs.TCTL.*; |
850 | import dk.aau.cs.io.XMLFormatter; |
851 | -import java.util.ArrayList; |
852 | |
853 | public class CTLQueryVisitor extends VisitorBase { |
854 | |
855 | |
856 | === modified file 'src/dk/aau/cs/TCTL/visitors/CombiTranslationQueryVisitor.java' |
857 | --- src/dk/aau/cs/TCTL/visitors/CombiTranslationQueryVisitor.java 2014-06-12 20:13:57 +0000 |
858 | +++ src/dk/aau/cs/TCTL/visitors/CombiTranslationQueryVisitor.java 2020-04-28 09:05:34 +0000 |
859 | @@ -2,12 +2,9 @@ |
860 | |
861 | import java.util.Hashtable; |
862 | |
863 | -import dk.aau.cs.TCTL.TCTLAtomicPropositionNode; |
864 | -import dk.aau.cs.TCTL.TCTLConstNode; |
865 | import dk.aau.cs.TCTL.TCTLPlaceNode; |
866 | import dk.aau.cs.model.tapn.TimedArcPetriNet; |
867 | import dk.aau.cs.model.tapn.TimedPlace; |
868 | -import dk.aau.cs.model.tapn.TimedTransition; |
869 | |
870 | public class CombiTranslationQueryVisitor extends QueryVisitor { |
871 | protected static final String ID_TYPE = "id_t"; |
872 | |
873 | === modified file 'src/dk/aau/cs/TCTL/visitors/OptimizedStandardTranslationQueryVisitor.java' |
874 | --- src/dk/aau/cs/TCTL/visitors/OptimizedStandardTranslationQueryVisitor.java 2014-05-22 20:26:41 +0000 |
875 | +++ src/dk/aau/cs/TCTL/visitors/OptimizedStandardTranslationQueryVisitor.java 2020-04-28 09:05:34 +0000 |
876 | @@ -1,7 +1,5 @@ |
877 | package dk.aau.cs.TCTL.visitors; |
878 | |
879 | -import dk.aau.cs.TCTL.TCTLAtomicPropositionNode; |
880 | -import dk.aau.cs.TCTL.TCTLConstNode; |
881 | import dk.aau.cs.TCTL.TCTLPlaceNode; |
882 | |
883 | public class OptimizedStandardTranslationQueryVisitor extends QueryVisitor { |
884 | @@ -50,7 +48,7 @@ |
885 | } |
886 | |
887 | private String createAtomicPropositionSum(String place) { |
888 | - StringBuffer sum = new StringBuffer("("); |
889 | + StringBuilder sum = new StringBuilder("("); |
890 | for (int i = 0; i < totalTokens; i++) { |
891 | sum.append(String.format("%1$s%2$s.%3$s", TOKEN_TEMPLATE_NAME, i, |
892 | place)); |
893 | |
894 | === modified file 'src/dk/aau/cs/TCTL/visitors/QueryVisitor.java' |
895 | --- src/dk/aau/cs/TCTL/visitors/QueryVisitor.java 2014-05-22 20:26:41 +0000 |
896 | +++ src/dk/aau/cs/TCTL/visitors/QueryVisitor.java 2020-04-28 09:05:34 +0000 |
897 | @@ -1,6 +1,5 @@ |
898 | package dk.aau.cs.TCTL.visitors; |
899 | |
900 | -import java.util.ArrayList; |
901 | import java.util.List; |
902 | |
903 | import dk.aau.cs.TCTL.AritmeticOperator; |
904 | @@ -16,10 +15,7 @@ |
905 | import dk.aau.cs.TCTL.TCTLFalseNode; |
906 | import dk.aau.cs.TCTL.TCTLNotNode; |
907 | import dk.aau.cs.TCTL.TCTLOrListNode; |
908 | -import dk.aau.cs.TCTL.TCTLPathPlaceHolder; |
909 | -import dk.aau.cs.TCTL.TCTLPlaceNode; |
910 | import dk.aau.cs.TCTL.TCTLPlusListNode; |
911 | -import dk.aau.cs.TCTL.TCTLStatePlaceHolder; |
912 | import dk.aau.cs.TCTL.TCTLTermListNode; |
913 | import dk.aau.cs.TCTL.TCTLTrueNode; |
914 | import dk.aau.cs.model.tapn.TAPNQuery; |
915 | |
916 | === modified file 'src/dk/aau/cs/TCTL/visitors/StandardSymmetryTranslationQueryVisitor.java' |
917 | --- src/dk/aau/cs/TCTL/visitors/StandardSymmetryTranslationQueryVisitor.java 2014-05-22 20:26:41 +0000 |
918 | +++ src/dk/aau/cs/TCTL/visitors/StandardSymmetryTranslationQueryVisitor.java 2020-04-28 09:05:34 +0000 |
919 | @@ -1,7 +1,5 @@ |
920 | package dk.aau.cs.TCTL.visitors; |
921 | |
922 | -import dk.aau.cs.TCTL.TCTLAtomicPropositionNode; |
923 | -import dk.aau.cs.TCTL.TCTLConstNode; |
924 | import dk.aau.cs.TCTL.TCTLPlaceNode; |
925 | |
926 | public class StandardSymmetryTranslationQueryVisitor extends QueryVisitor { |
927 | |
928 | === modified file 'src/dk/aau/cs/TCTL/visitors/StandardTranslationQueryVisitor.java' |
929 | --- src/dk/aau/cs/TCTL/visitors/StandardTranslationQueryVisitor.java 2014-05-22 20:26:41 +0000 |
930 | +++ src/dk/aau/cs/TCTL/visitors/StandardTranslationQueryVisitor.java 2020-04-28 09:05:34 +0000 |
931 | @@ -1,7 +1,5 @@ |
932 | package dk.aau.cs.TCTL.visitors; |
933 | |
934 | -import dk.aau.cs.TCTL.TCTLAtomicPropositionNode; |
935 | -import dk.aau.cs.TCTL.TCTLConstNode; |
936 | import dk.aau.cs.TCTL.TCTLPlaceNode; |
937 | |
938 | public class StandardTranslationQueryVisitor extends QueryVisitor { |
939 | @@ -35,7 +33,7 @@ |
940 | } |
941 | |
942 | private String createAtomicPropositionSum(String place) { |
943 | - StringBuffer sum = new StringBuffer("("); |
944 | + StringBuilder sum = new StringBuilder("("); |
945 | for (int i = 0; i < totalTokens; i++) { |
946 | sum.append(String.format("%1$s%2$s.%3$s", TOKEN_TEMPLATE_NAME, i, |
947 | place)); |
948 | |
949 | === modified file 'src/dk/aau/cs/approximation/ApproximationWorker.java' |
950 | --- src/dk/aau/cs/approximation/ApproximationWorker.java 2018-07-19 13:38:27 +0000 |
951 | +++ src/dk/aau/cs/approximation/ApproximationWorker.java 2020-04-28 09:05:34 +0000 |
952 | @@ -2,8 +2,6 @@ |
953 | |
954 | import java.math.BigDecimal; |
955 | |
956 | -import javax.swing.SwingWorker.StateValue; |
957 | - |
958 | import pipe.dataLayer.TAPNQuery.TraceOption; |
959 | import pipe.gui.RunVerificationBase; |
960 | import pipe.gui.widgets.InclusionPlaces; |
961 | @@ -29,14 +27,19 @@ |
962 | import dk.aau.cs.verification.TAPNTraceDecomposer; |
963 | import dk.aau.cs.verification.VerificationOptions; |
964 | import dk.aau.cs.verification.VerificationResult; |
965 | -import dk.aau.cs.verification.UPPAAL.VerifytaOptions; |
966 | import dk.aau.cs.verification.VerifyTAPN.VerifyTAPNOptions; |
967 | import dk.aau.cs.verification.batchProcessing.BatchProcessingWorker; |
968 | |
969 | public class ApproximationWorker { |
970 | - public VerificationResult<TAPNNetworkTrace> normalWorker(VerificationOptions options, ModelChecker modelChecker, |
971 | - Tuple<TimedArcPetriNet, NameMapping> transformedModel, ITAPNComposer composer, TAPNQuery clonedQuery, |
972 | - RunVerificationBase verificationBase, TimedArcPetriNetNetwork model) throws Exception { |
973 | + public VerificationResult<TAPNNetworkTrace> normalWorker( |
974 | + VerificationOptions options, |
975 | + ModelChecker modelChecker, |
976 | + Tuple<TimedArcPetriNet, NameMapping> transformedModel, |
977 | + ITAPNComposer composer, |
978 | + TAPNQuery clonedQuery, |
979 | + RunVerificationBase verificationBase, |
980 | + TimedArcPetriNetNetwork model |
981 | + ) throws Exception { |
982 | |
983 | // If options is of an instance of VerifyTAPNOptions then save the inclusion places before verify alters them |
984 | InclusionPlaces oldInclusionPlaces = null; |
985 | @@ -45,33 +48,32 @@ |
986 | |
987 | // Enable SOME_TRACE if not already |
988 | TraceOption oldTraceOption = options.traceOption(); |
989 | - if ((options.enableOverApproximation() || options.enableUnderApproximation())) { |
990 | + if ((options.enabledOverApproximation() || options.enabledUnderApproximation())) { |
991 | options.setTraceOption(TraceOption.SOME); |
992 | } |
993 | |
994 | - VerificationResult<TAPNNetworkTrace> value = null; |
995 | + VerificationResult<TAPNNetworkTrace> toReturn = null; |
996 | VerificationResult<TimedArcPetriNetTrace> result = modelChecker.verify(options, transformedModel, clonedQuery); |
997 | - if (verificationBase.isCancelled()) { |
998 | - verificationBase.firePropertyChange("state", StateValue.PENDING, StateValue.DONE); |
999 | - } |
1000 | + |
1001 | if (result.error()) { |
1002 | options.setTraceOption(oldTraceOption); |
1003 | return new VerificationResult<TAPNNetworkTrace>(result.errorMessage(), result.verificationTime()); |
1004 | } |
1005 | - else if (options.enableOverApproximation()) { |
1006 | + else if (options.enabledOverApproximation()) { |
1007 | // Over-approximation |
1008 | + //ApproximationDenominator should not be able to be 1, if its one its the same as an exact analyses. --kyrke 2020-03-25 |
1009 | if (options.approximationDenominator() == 1) { |
1010 | // If r = 1 |
1011 | // No matter what it answered -> return that answer |
1012 | QueryResult queryResult = result.getQueryResult(); |
1013 | - value = new VerificationResult<TAPNNetworkTrace>( |
1014 | + toReturn = new VerificationResult<TAPNNetworkTrace>( |
1015 | queryResult, |
1016 | decomposeTrace(result.getTrace(), transformedModel.value2(), model), |
1017 | decomposeTrace(result.getSecondaryTrace(), transformedModel.value2(), model), |
1018 | result.verificationTime(), |
1019 | result.stats(), |
1020 | - result.isOverApproximationResult()); |
1021 | - value.setNameMapping(transformedModel.value2()); |
1022 | + result.isSolvedUsingStateEquation()); |
1023 | + toReturn.setNameMapping(transformedModel.value2()); |
1024 | } else { |
1025 | // If r > 1 |
1026 | if (result.getTrace() != null && (((result.getQueryResult().queryType() == QueryType.EF || result.getQueryResult().queryType() == QueryType.EG) && result.getQueryResult().isQuerySatisfied()) |
1027 | @@ -80,20 +82,20 @@ |
1028 | // The results are inconclusive, but we get a trace and can use trace TAPN for verification. |
1029 | |
1030 | VerificationResult<TimedArcPetriNetTrace> approxResult = result; |
1031 | - value = new VerificationResult<TAPNNetworkTrace>( |
1032 | + toReturn = new VerificationResult<TAPNNetworkTrace>( |
1033 | approxResult.getQueryResult(), |
1034 | decomposeTrace(approxResult.getTrace(), transformedModel.value2(), model), |
1035 | decomposeTrace(approxResult.getSecondaryTrace(), transformedModel.value2(), model), |
1036 | approxResult.verificationTime(), |
1037 | approxResult.stats(), |
1038 | - approxResult.isOverApproximationResult()); |
1039 | - value.setNameMapping(transformedModel.value2()); |
1040 | + approxResult.isSolvedUsingStateEquation()); |
1041 | + toReturn.setNameMapping(transformedModel.value2()); |
1042 | |
1043 | OverApproximation overaprx = new OverApproximation(); |
1044 | |
1045 | //Create trace TAPN from the trace |
1046 | Tuple<TimedArcPetriNet, NameMapping> transformedOriginalModel = composer.transformModel(model); |
1047 | - overaprx.makeTraceTAPN(transformedOriginalModel, value, clonedQuery); |
1048 | + overaprx.makeTraceTAPN(transformedOriginalModel, toReturn, clonedQuery); |
1049 | |
1050 | // Reset the inclusion places in order to avoid NullPointerExceptions |
1051 | if (options instanceof VerifyTAPNOptions && oldInclusionPlaces != null) |
1052 | @@ -102,15 +104,13 @@ |
1053 | // run model checker again for trace TAPN |
1054 | MemoryMonitor.cumulateMemory(); |
1055 | result = modelChecker.verify(options, transformedOriginalModel, clonedQuery); |
1056 | - if (verificationBase.isCancelled()) { |
1057 | - verificationBase.firePropertyChange("state", StateValue.PENDING, StateValue.DONE); |
1058 | - } |
1059 | + |
1060 | if (result.error()) { |
1061 | options.setTraceOption(oldTraceOption); |
1062 | // if the old trace option was none, we need to set the results traces to null so GUI doesn't try to display the traces later |
1063 | - if (oldTraceOption == TraceOption.NONE && value != null){ |
1064 | - value.setTrace(null); |
1065 | - value.setSecondaryTrace(null); |
1066 | + if (oldTraceOption == TraceOption.NONE && toReturn != null){ |
1067 | + toReturn.setTrace(null); |
1068 | + toReturn.setSecondaryTrace(null); |
1069 | } |
1070 | return new VerificationResult<TAPNNetworkTrace>(result.errorMessage(), approxResult.verificationTime() + result.verificationTime()); |
1071 | } |
1072 | @@ -127,14 +127,14 @@ |
1073 | |
1074 | // If satisfied trace -> Return result |
1075 | // This is satisfied for EF and EG and not satisfied for AG and AF |
1076 | - value = new VerificationResult<TAPNNetworkTrace>( |
1077 | + toReturn = new VerificationResult<TAPNNetworkTrace>( |
1078 | queryResult, |
1079 | decomposeTrace(result.getTrace(), transformedModel.value2(), model), |
1080 | decomposeTrace(result.getSecondaryTrace(), transformedModel.value2(), model), |
1081 | approxResult.verificationTime() + result.verificationTime(), |
1082 | approxResult.stats(), |
1083 | - approxResult.isOverApproximationResult()); |
1084 | - value.setNameMapping(transformedModel.value2()); |
1085 | + approxResult.isSolvedUsingStateEquation()); |
1086 | + toReturn.setNameMapping(transformedModel.value2()); |
1087 | } |
1088 | else if (((result.getQueryResult().queryType() == QueryType.EF || result.getQueryResult().queryType() == QueryType.EG) && !result.getQueryResult().isQuerySatisfied()) |
1089 | || ((result.getQueryResult().queryType() == QueryType.AG || result.getQueryResult().queryType() == QueryType.AF) && result.getQueryResult().isQuerySatisfied())) { |
1090 | @@ -147,14 +147,14 @@ |
1091 | } |
1092 | |
1093 | VerificationResult<TimedArcPetriNetTrace> approxResult = result; |
1094 | - value = new VerificationResult<TAPNNetworkTrace>( |
1095 | + toReturn = new VerificationResult<TAPNNetworkTrace>( |
1096 | approxResult.getQueryResult(), |
1097 | decomposeTrace(approxResult.getTrace(), transformedModel.value2(), model), |
1098 | decomposeTrace(approxResult.getSecondaryTrace(), transformedModel.value2(), model), |
1099 | approxResult.verificationTime(), |
1100 | approxResult.stats(), |
1101 | - approxResult.isOverApproximationResult()); |
1102 | - value.setNameMapping(transformedModel.value2()); |
1103 | + approxResult.isSolvedUsingStateEquation()); |
1104 | + toReturn.setNameMapping(transformedModel.value2()); |
1105 | } else { |
1106 | // We cannot use the result directly, and did not get a trace. |
1107 | |
1108 | @@ -162,19 +162,19 @@ |
1109 | queryResult.setApproximationInconclusive(true); |
1110 | |
1111 | VerificationResult<TimedArcPetriNetTrace> approxResult = result; |
1112 | - value = new VerificationResult<TAPNNetworkTrace>( |
1113 | + toReturn = new VerificationResult<TAPNNetworkTrace>( |
1114 | approxResult.getQueryResult(), |
1115 | decomposeTrace(approxResult.getTrace(), transformedModel.value2(), model), |
1116 | decomposeTrace(approxResult.getSecondaryTrace(), transformedModel.value2(), model), |
1117 | approxResult.verificationTime(), |
1118 | approxResult.stats(), |
1119 | - approxResult.isOverApproximationResult()); |
1120 | - value.setNameMapping(transformedModel.value2()); |
1121 | + approxResult.isSolvedUsingStateEquation()); |
1122 | + toReturn.setNameMapping(transformedModel.value2()); |
1123 | |
1124 | } |
1125 | } |
1126 | } |
1127 | - else if (options.enableUnderApproximation()) { |
1128 | + else if (options.enabledUnderApproximation()) { |
1129 | // Under-approximation |
1130 | |
1131 | if (result.getTrace() != null) { |
1132 | @@ -189,19 +189,19 @@ |
1133 | } |
1134 | } |
1135 | } |
1136 | - |
1137 | + //ApproximationDenominator should not be able to be 1, if its one its the same as an exact analyses. --kyrke 2020-03-25 |
1138 | if (options.approximationDenominator() == 1) { |
1139 | // If r = 1 |
1140 | // No matter it answered -> return that answer |
1141 | QueryResult queryResult= result.getQueryResult(); |
1142 | - value = new VerificationResult<TAPNNetworkTrace>( |
1143 | + toReturn = new VerificationResult<TAPNNetworkTrace>( |
1144 | queryResult, |
1145 | decomposeTrace(result.getTrace(), transformedModel.value2(), model), |
1146 | decomposeTrace(result.getSecondaryTrace(), transformedModel.value2(), model), |
1147 | result.verificationTime(), |
1148 | result.stats(), |
1149 | - result.isOverApproximationResult()); |
1150 | - value.setNameMapping(transformedModel.value2()); |
1151 | + result.isSolvedUsingStateEquation()); |
1152 | + toReturn.setNameMapping(transformedModel.value2()); |
1153 | } |
1154 | else { |
1155 | // If r > 1 |
1156 | @@ -210,14 +210,14 @@ |
1157 | // If ((EF OR EG) AND not satisfied) OR ((AG OR AF) and satisfied) -> Inconclusive |
1158 | QueryResult queryResult= result.getQueryResult(); |
1159 | queryResult.setApproximationInconclusive(true); |
1160 | - value = new VerificationResult<TAPNNetworkTrace>( |
1161 | + toReturn = new VerificationResult<TAPNNetworkTrace>( |
1162 | queryResult, |
1163 | decomposeTrace(result.getTrace(), transformedModel.value2(), model), |
1164 | decomposeTrace(result.getSecondaryTrace(), transformedModel.value2(), model), |
1165 | result.verificationTime(), |
1166 | result.stats(), |
1167 | - result.isOverApproximationResult()); |
1168 | - value.setNameMapping(transformedModel.value2()); |
1169 | + result.isSolvedUsingStateEquation()); |
1170 | + toReturn.setNameMapping(transformedModel.value2()); |
1171 | } else if ((result.getQueryResult().queryType() == QueryType.EF || result.getQueryResult().queryType() == QueryType.EG) && result.getQueryResult().isQuerySatisfied() |
1172 | || ((result.getQueryResult().queryType() == QueryType.AG || result.getQueryResult().queryType() == QueryType.AF) && ! result.getQueryResult().isQuerySatisfied())) { |
1173 | |
1174 | @@ -225,21 +225,21 @@ |
1175 | // If query does have deadlock or EG or AF a trace -> create trace TAPN |
1176 | //Create the verification satisfied result for the approximation |
1177 | VerificationResult<TimedArcPetriNetTrace> approxResult = result; |
1178 | - value = new VerificationResult<TAPNNetworkTrace>( |
1179 | + toReturn = new VerificationResult<TAPNNetworkTrace>( |
1180 | approxResult.getQueryResult(), |
1181 | decomposeTrace(approxResult.getTrace(), transformedModel.value2(), model), |
1182 | decomposeTrace(approxResult.getSecondaryTrace(), transformedModel.value2(), model), |
1183 | approxResult.verificationTime(), |
1184 | approxResult.stats(), |
1185 | - result.isOverApproximationResult()); |
1186 | - value.setNameMapping(transformedModel.value2()); |
1187 | + result.isSolvedUsingStateEquation()); |
1188 | + toReturn.setNameMapping(transformedModel.value2()); |
1189 | |
1190 | OverApproximation overaprx = new OverApproximation(); |
1191 | |
1192 | |
1193 | //Create trace TAPN from the trace |
1194 | Tuple<TimedArcPetriNet, NameMapping> transformedOriginalModel = composer.transformModel(model); |
1195 | - overaprx.makeTraceTAPN(transformedOriginalModel, value, clonedQuery); |
1196 | + overaprx.makeTraceTAPN(transformedOriginalModel, toReturn, clonedQuery); |
1197 | |
1198 | // Reset the inclusion places in order to avoid NullPointerExceptions |
1199 | if (options instanceof VerifyTAPNOptions && oldInclusionPlaces != null) |
1200 | @@ -248,15 +248,13 @@ |
1201 | //run model checker again for trace TAPN |
1202 | MemoryMonitor.cumulateMemory(); |
1203 | result = modelChecker.verify(options, transformedOriginalModel, clonedQuery); |
1204 | - if (verificationBase.isCancelled()) { |
1205 | - verificationBase.firePropertyChange("state", StateValue.PENDING, StateValue.DONE); |
1206 | - } |
1207 | + |
1208 | if (result.error()) { |
1209 | options.setTraceOption(oldTraceOption); |
1210 | // if the old trace option was none, we need to set the results traces to null so GUI doesn't try to display the traces later |
1211 | - if (oldTraceOption == TraceOption.NONE && value != null){ |
1212 | - value.setTrace(null); |
1213 | - value.setSecondaryTrace(null); |
1214 | + if (oldTraceOption == TraceOption.NONE && toReturn != null){ |
1215 | + toReturn.setTrace(null); |
1216 | + toReturn.setSecondaryTrace(null); |
1217 | } |
1218 | return new VerificationResult<TAPNNetworkTrace>(result.errorMessage(), result.verificationTime() + approxResult.verificationTime()); |
1219 | } |
1220 | @@ -276,14 +274,14 @@ |
1221 | |
1222 | // If satisfied trace) -> Return result |
1223 | // This is satisfied for EF and EG and not satisfied for AG and AF |
1224 | - value = new VerificationResult<TAPNNetworkTrace>( |
1225 | + toReturn = new VerificationResult<TAPNNetworkTrace>( |
1226 | queryResult, |
1227 | decomposeTrace(result.getTrace(), transformedModel.value2(), model), |
1228 | decomposeTrace(result.getSecondaryTrace(), transformedModel.value2(), model), |
1229 | approxResult.verificationTime() + result.verificationTime(), |
1230 | approxResult.stats(), |
1231 | - approxResult.isOverApproximationResult()); |
1232 | - value.setNameMapping(transformedModel.value2()); |
1233 | + approxResult.isSolvedUsingStateEquation()); |
1234 | + toReturn.setNameMapping(transformedModel.value2()); |
1235 | } |
1236 | else { |
1237 | // the query contains deadlock, but we do not have a trace. |
1238 | @@ -291,42 +289,49 @@ |
1239 | queryResult.setApproximationInconclusive(true); |
1240 | |
1241 | VerificationResult<TimedArcPetriNetTrace> approxResult = result; |
1242 | - value = new VerificationResult<TAPNNetworkTrace>( |
1243 | + toReturn = new VerificationResult<TAPNNetworkTrace>( |
1244 | approxResult.getQueryResult(), |
1245 | decomposeTrace(approxResult.getTrace(), transformedModel.value2(), model), |
1246 | decomposeTrace(approxResult.getSecondaryTrace(), transformedModel.value2(), model), |
1247 | approxResult.verificationTime(), |
1248 | approxResult.stats(), |
1249 | - approxResult.isOverApproximationResult()); |
1250 | - value.setNameMapping(transformedModel.value2()); |
1251 | + approxResult.isSolvedUsingStateEquation()); |
1252 | + toReturn.setNameMapping(transformedModel.value2()); |
1253 | } |
1254 | } |
1255 | } |
1256 | } |
1257 | else { |
1258 | - value = new VerificationResult<TAPNNetworkTrace>( |
1259 | + toReturn = new VerificationResult<TAPNNetworkTrace>( |
1260 | result.getQueryResult(), |
1261 | decomposeTrace(result.getTrace(), transformedModel.value2(), model), |
1262 | decomposeTrace(result.getSecondaryTrace(), transformedModel.value2(), model), |
1263 | result.verificationTime(), |
1264 | result.stats(), |
1265 | - result.isOverApproximationResult()); |
1266 | - value.setNameMapping(transformedModel.value2()); |
1267 | + result.isSolvedUsingStateEquation()); |
1268 | + toReturn.setNameMapping(transformedModel.value2()); |
1269 | } |
1270 | |
1271 | options.setTraceOption(oldTraceOption); |
1272 | // if the old traceoption was none, we need to set the results traces to null so GUI doesn't try to display the traces later |
1273 | if (oldTraceOption == TraceOption.NONE){ |
1274 | - value.setTrace(null); |
1275 | - value.setSecondaryTrace(null); |
1276 | + toReturn.setTrace(null); |
1277 | + toReturn.setSecondaryTrace(null); |
1278 | } |
1279 | |
1280 | - return value; |
1281 | + return toReturn; |
1282 | } |
1283 | |
1284 | - public VerificationResult<TimedArcPetriNetTrace> batchWorker(Tuple<TimedArcPetriNet, NameMapping> composedModel, |
1285 | - VerificationOptions options, pipe.dataLayer.TAPNQuery query, LoadedBatchProcessingModel model, |
1286 | - ModelChecker modelChecker, TAPNQuery queryToVerify, TAPNQuery clonedQuery, BatchProcessingWorker verificationBase) throws Exception { |
1287 | + public VerificationResult<TimedArcPetriNetTrace> batchWorker( |
1288 | + Tuple<TimedArcPetriNet, NameMapping> composedModel, |
1289 | + VerificationOptions options, |
1290 | + pipe.dataLayer.TAPNQuery query, |
1291 | + LoadedBatchProcessingModel model, |
1292 | + ModelChecker modelChecker, |
1293 | + TAPNQuery queryToVerify, |
1294 | + TAPNQuery clonedQuery, |
1295 | + BatchProcessingWorker verificationBase |
1296 | + ) throws Exception { |
1297 | InclusionPlaces oldInclusionPlaces = null; |
1298 | if (options instanceof VerifyTAPNOptions) |
1299 | oldInclusionPlaces = ((VerifyTAPNOptions) options).inclusionPlaces(); |
1300 | @@ -370,7 +375,7 @@ |
1301 | verificationResult.getSecondaryTrace(), |
1302 | verificationResult.verificationTime(), |
1303 | verificationResult.stats(), |
1304 | - verificationResult.isOverApproximationResult()); |
1305 | + verificationResult.isSolvedUsingStateEquation()); |
1306 | value.setNameMapping(composedModel.value2()); |
1307 | } else { |
1308 | // If r > 1 |
1309 | @@ -385,7 +390,7 @@ |
1310 | decomposeTrace(approxResult.getSecondaryTrace(), composedModel.value2(), model.network()), |
1311 | approxResult.verificationTime(), |
1312 | approxResult.stats(), |
1313 | - verificationResult.isOverApproximationResult()); |
1314 | + verificationResult.isSolvedUsingStateEquation()); |
1315 | valueNetwork.setNameMapping(composedModel.value2()); |
1316 | |
1317 | OverApproximation overaprx = new OverApproximation(); |
1318 | @@ -401,9 +406,7 @@ |
1319 | //run model checker again for trace TAPN |
1320 | MemoryMonitor.cumulateMemory(); |
1321 | verificationResult = modelChecker.verify(options, transformedOriginalModel, clonedQuery); |
1322 | - if (verificationBase.isCancelled()) { |
1323 | - verificationBase.firePropertyChange("state", StateValue.PENDING, StateValue.DONE); |
1324 | - } |
1325 | + |
1326 | if (verificationResult.error()) { |
1327 | options.setTraceOption(oldTraceOption); |
1328 | return new VerificationResult<TimedArcPetriNetTrace>( |
1329 | @@ -428,7 +431,7 @@ |
1330 | approxResult.getSecondaryTrace(), |
1331 | approxResult.verificationTime() + verificationResult.verificationTime(), |
1332 | approxResult.stats(), |
1333 | - verificationResult.isOverApproximationResult()); |
1334 | + verificationResult.isSolvedUsingStateEquation()); |
1335 | value.setNameMapping(composedModel.value2()); |
1336 | } |
1337 | else if (((verificationResult.getQueryResult().queryType() == QueryType.EF || verificationResult.getQueryResult().queryType() == QueryType.EG) && !verificationResult.getQueryResult().isQuerySatisfied()) |
1338 | @@ -447,7 +450,7 @@ |
1339 | verificationResult.getSecondaryTrace(), |
1340 | verificationResult.verificationTime(), |
1341 | verificationResult.stats(), |
1342 | - verificationResult.isOverApproximationResult()); |
1343 | + verificationResult.isSolvedUsingStateEquation()); |
1344 | value.setNameMapping(composedModel.value2()); |
1345 | } |
1346 | else { |
1347 | @@ -463,7 +466,7 @@ |
1348 | verificationResult.getSecondaryTrace(), |
1349 | verificationResult.verificationTime(), |
1350 | verificationResult.stats(), |
1351 | - verificationResult.isOverApproximationResult()); |
1352 | + verificationResult.isSolvedUsingStateEquation()); |
1353 | value.setNameMapping(composedModel.value2()); |
1354 | |
1355 | } |
1356 | @@ -482,7 +485,7 @@ |
1357 | verificationResult.getSecondaryTrace(), |
1358 | verificationResult.verificationTime(), |
1359 | verificationResult.stats(), |
1360 | - verificationResult.isOverApproximationResult()); |
1361 | + verificationResult.isSolvedUsingStateEquation()); |
1362 | value.setNameMapping(composedModel.value2()); |
1363 | } |
1364 | else { |
1365 | @@ -499,10 +502,11 @@ |
1366 | verificationResult.getSecondaryTrace(), |
1367 | verificationResult.verificationTime(), |
1368 | verificationResult.stats(), |
1369 | - verificationResult.isOverApproximationResult()); |
1370 | + verificationResult.isSolvedUsingStateEquation()); |
1371 | value.setNameMapping(composedModel.value2()); |
1372 | |
1373 | - } else if ((verificationResult.getQueryResult().queryType() == QueryType.EF || verificationResult.getQueryResult().queryType() == QueryType.EG) && verificationResult.getQueryResult().isQuerySatisfied() |
1374 | + } |
1375 | + else if ((verificationResult.getQueryResult().queryType() == QueryType.EF || verificationResult.getQueryResult().queryType() == QueryType.EG) && verificationResult.getQueryResult().isQuerySatisfied() |
1376 | || ((verificationResult.getQueryResult().queryType() == QueryType.AG || verificationResult.getQueryResult().queryType() == QueryType.AF) && ! verificationResult.getQueryResult().isQuerySatisfied())) { |
1377 | // ((EF OR EG) AND satisfied) OR ((AG OR AF) and not satisfied) -> Check for deadlock |
1378 | |
1379 | @@ -516,7 +520,7 @@ |
1380 | decomposeTrace(approxResult.getSecondaryTrace(), composedModel.value2(), model.network()), |
1381 | approxResult.verificationTime(), |
1382 | approxResult.stats(), |
1383 | - approxResult.isOverApproximationResult()); |
1384 | + approxResult.isSolvedUsingStateEquation()); |
1385 | valueNetwork.setNameMapping(composedModel.value2()); |
1386 | |
1387 | OverApproximation overaprx = new OverApproximation(); |
1388 | @@ -531,9 +535,7 @@ |
1389 | //run model checker again for trace TAPN |
1390 | MemoryMonitor.cumulateMemory(); |
1391 | verificationResult = modelChecker.verify(options, transformedOriginalModel, clonedQuery); |
1392 | - if (verificationBase.isCancelled()) { |
1393 | - verificationBase.firePropertyChange("state", StateValue.PENDING, StateValue.DONE); |
1394 | - } |
1395 | + |
1396 | if (verificationResult.error()) { |
1397 | options.setTraceOption(oldTraceOption); |
1398 | return new VerificationResult<TimedArcPetriNetTrace>( |
1399 | @@ -562,7 +564,7 @@ |
1400 | verificationResult.getSecondaryTrace(), |
1401 | verificationResult.verificationTime() + approxResult.verificationTime(), |
1402 | verificationResult.stats(), |
1403 | - verificationResult.isOverApproximationResult()); |
1404 | + verificationResult.isSolvedUsingStateEquation()); |
1405 | value.setNameMapping(composedModel.value2()); |
1406 | } |
1407 | else { |
1408 | @@ -576,19 +578,20 @@ |
1409 | verificationResult.getSecondaryTrace(), |
1410 | verificationResult.verificationTime(), |
1411 | verificationResult.stats(), |
1412 | - verificationResult.isOverApproximationResult()); |
1413 | + verificationResult.isSolvedUsingStateEquation()); |
1414 | value.setNameMapping(composedModel.value2()); |
1415 | } |
1416 | } |
1417 | } |
1418 | - } else { |
1419 | + } |
1420 | + else { |
1421 | value = new VerificationResult<TimedArcPetriNetTrace>( |
1422 | verificationResult.getQueryResult(), |
1423 | verificationResult.getTrace(), |
1424 | verificationResult.getSecondaryTrace(), |
1425 | verificationResult.verificationTime(), |
1426 | verificationResult.stats(), |
1427 | - verificationResult.isOverApproximationResult()); |
1428 | + verificationResult.isSolvedUsingStateEquation()); |
1429 | value.setNameMapping(composedModel.value2()); |
1430 | } |
1431 | |
1432 | |
1433 | === modified file 'src/dk/aau/cs/approximation/OverApproximation.java' |
1434 | --- src/dk/aau/cs/approximation/OverApproximation.java 2014-06-06 22:33:37 +0000 |
1435 | +++ src/dk/aau/cs/approximation/OverApproximation.java 2020-04-28 09:05:34 +0000 |
1436 | @@ -227,7 +227,7 @@ |
1437 | TCTLNotNode notNode = new TCTLNotNode(pBlock); |
1438 | |
1439 | if(((TCTLAGNode) topNode).getProperty() instanceof TCTLOrListNode){ |
1440 | - ((TCTLOrListNode) ((TCTLAGNode) topNode).getProperty()).addDisjunct(notNode);; |
1441 | + ((TCTLOrListNode) ((TCTLAGNode) topNode).getProperty()).addDisjunct(notNode); |
1442 | } |
1443 | else{ |
1444 | TCTLOrListNode orList = new TCTLOrListNode((((TCTLAGNode) topNode).getProperty()), notNode); |
1445 | @@ -250,7 +250,7 @@ |
1446 | TCTLNotNode notNode = new TCTLNotNode(pBlock); |
1447 | |
1448 | if(((TCTLAFNode) topNode).getProperty() instanceof TCTLOrListNode){ |
1449 | - ((TCTLOrListNode) ((TCTLAFNode) topNode).getProperty()).addDisjunct(notNode);; |
1450 | + ((TCTLOrListNode) ((TCTLAFNode) topNode).getProperty()).addDisjunct(notNode); |
1451 | } |
1452 | else{ |
1453 | TCTLOrListNode orList = new TCTLOrListNode((((TCTLAFNode) topNode).getProperty()), notNode); |
1454 | |
1455 | === modified file 'src/dk/aau/cs/approximation/UnderApproximation.java' |
1456 | --- src/dk/aau/cs/approximation/UnderApproximation.java 2014-06-05 12:13:00 +0000 |
1457 | +++ src/dk/aau/cs/approximation/UnderApproximation.java 2020-04-28 09:05:34 +0000 |
1458 | @@ -95,14 +95,14 @@ |
1459 | |
1460 | for (Arc arc1 : guiModel.getArcs()){ |
1461 | if (arc1.getTarget() instanceof Place && arc1.getSource() == guiTransition) //If arc1 is an output arc |
1462 | - { |
1463 | - arc1.delete(); |
1464 | + { |
1465 | + guiModel.removePetriNetObject(arc1); |
1466 | } |
1467 | else if (arc1.getTarget() instanceof Transition && arc1.getTarget() == guiTransition){ //Else if arc1 is an input arc |
1468 | - arc1.delete(); |
1469 | + guiModel.removePetriNetObject(arc1); |
1470 | } |
1471 | } |
1472 | - guiTransition.delete(); |
1473 | + guiModel.removePetriNetObject(guiTransition); |
1474 | } |
1475 | |
1476 | private void deleteArcsFromTransition(TimedTransition transitionToDelete) { |
1477 | |
1478 | === modified file 'src/dk/aau/cs/gui/BatchProcessingDialog.java' |
1479 | --- src/dk/aau/cs/gui/BatchProcessingDialog.java 2019-02-12 13:57:23 +0000 |
1480 | +++ src/dk/aau/cs/gui/BatchProcessingDialog.java 2020-04-28 09:05:34 +0000 |
1481 | @@ -40,7 +40,6 @@ |
1482 | import javax.swing.JSeparator; |
1483 | import javax.swing.JSplitPane; |
1484 | import javax.swing.JTable; |
1485 | -import javax.swing.ListCellRenderer; |
1486 | import javax.swing.ListSelectionModel; |
1487 | import javax.swing.SwingConstants; |
1488 | import javax.swing.SwingWorker.StateValue; |
1489 | @@ -49,8 +48,6 @@ |
1490 | import javax.swing.border.Border; |
1491 | import javax.swing.event.ChangeEvent; |
1492 | import javax.swing.event.ChangeListener; |
1493 | -import javax.swing.event.ListSelectionEvent; |
1494 | -import javax.swing.event.ListSelectionListener; |
1495 | import javax.swing.event.TableModelEvent; |
1496 | import javax.swing.event.TableModelListener; |
1497 | import javax.swing.table.TableCellRenderer; |
1498 | @@ -60,7 +57,7 @@ |
1499 | import pipe.dataLayer.TAPNQuery; |
1500 | import pipe.dataLayer.TAPNQuery.SearchOption; |
1501 | import pipe.gui.CreateGui; |
1502 | -import pipe.gui.widgets.CustomJSpinner; |
1503 | +import net.tapaal.swinghelpers.CustomJSpinner; |
1504 | import pipe.gui.widgets.EscapableDialog; |
1505 | import pipe.gui.widgets.filebrowser.FileBrowser; |
1506 | import pipe.gui.widgets.QueryPane; |
1507 | @@ -217,8 +214,8 @@ |
1508 | private JButton addFilesButton; |
1509 | private JButton clearFilesButton; |
1510 | private JButton removeFileButton; |
1511 | - private JList fileList; |
1512 | - private DefaultListModel listModel; |
1513 | + private JList<File> fileList; |
1514 | + private DefaultListModel<File> listModel; |
1515 | |
1516 | private JLabel statusLabel; |
1517 | private JLabel fileStatusLabel; |
1518 | @@ -230,29 +227,25 @@ |
1519 | private JLabel memory; |
1520 | private long startTimeMs = 0; |
1521 | |
1522 | - private JComboBox searchOption; |
1523 | + private JComboBox<String> searchOption; |
1524 | private JButton exportButton; |
1525 | private JButton closeButton; |
1526 | - private JComboBox queryPropertyOption; |
1527 | + private JComboBox<String> queryPropertyOption; |
1528 | private JPanel verificationOptionsPanel; |
1529 | private CustomJSpinner numberOfExtraTokensInNet; |
1530 | private JCheckBox keepQueryCapacity; |
1531 | - private JComboBox symmetryOption; |
1532 | - private JComboBox stubbornReductionOption; |
1533 | + private JComboBox<String> symmetryOption; |
1534 | + private JComboBox<String> stubbornReductionOption; |
1535 | private JCheckBox noTimeoutCheckbox; |
1536 | private JCheckBox noOOMCheckbox; |
1537 | private CustomJSpinner timeoutValue; |
1538 | private CustomJSpinner oomValue; |
1539 | - private JComboBox approximationMethodOption; |
1540 | + private JComboBox<String> approximationMethodOption; |
1541 | private CustomJSpinner approximationDenominator; |
1542 | private JCheckBox approximationDenominatorCheckbox; |
1543 | - private JList ListOfQueries; |
1544 | + private JList<TAPNQuery> ListOfQueries; |
1545 | |
1546 | - private Timer timeoutTimer = new Timer(30000, new ActionListener() { |
1547 | - public void actionPerformed(ActionEvent e) { |
1548 | - timeoutCurrentVerificationTask(); |
1549 | - } |
1550 | - }); |
1551 | + private Timer timeoutTimer = new Timer(30000, e -> timeoutCurrentVerificationTask()); |
1552 | |
1553 | private BatchProcessingResultsTableModel tableModel; |
1554 | |
1555 | @@ -328,7 +321,7 @@ |
1556 | BatchProcessing was called from QueryPane |
1557 | (should maybe be boolean) |
1558 | */ |
1559 | - public static void showBatchProcessingDialog(JList ListOfQueries){ |
1560 | + public static void showBatchProcessingDialog(JList<TAPNQuery> ListOfQueries){ |
1561 | if(ListOfQueries.getModel().getSize() != 0) { |
1562 | batchProcessingDialog = null; |
1563 | } |
1564 | @@ -344,7 +337,7 @@ |
1565 | batchProcessingDialog.setVisible(true); |
1566 | } |
1567 | |
1568 | - private BatchProcessingDialog(Frame frame, String title, boolean modal, JList ListOfQueries) { |
1569 | + private BatchProcessingDialog(Frame frame, String title, boolean modal, JList<TAPNQuery> ListOfQueries) { |
1570 | super(frame, title, modal); |
1571 | |
1572 | addWindowListener(new WindowAdapter() { |
1573 | @@ -390,10 +383,7 @@ |
1574 | } |
1575 | |
1576 | private boolean isQueryListEmpty() { |
1577 | - if(ListOfQueries.getModel().getSize() == 0) |
1578 | - return true; |
1579 | - else |
1580 | - return false; |
1581 | + return ListOfQueries.getModel().getSize() == 0; |
1582 | } |
1583 | |
1584 | private void initFileListPanel() { |
1585 | @@ -413,15 +403,12 @@ |
1586 | } |
1587 | }); |
1588 | |
1589 | - fileList.addListSelectionListener(new ListSelectionListener() { |
1590 | - |
1591 | - public void valueChanged(ListSelectionEvent e) { |
1592 | - if (!(e.getValueIsAdjusting())) { |
1593 | - if (fileList.getSelectedIndex() == -1) { |
1594 | - removeFileButton.setEnabled(false); |
1595 | - } else { |
1596 | - removeFileButton.setEnabled(true); |
1597 | - } |
1598 | + fileList.addListSelectionListener(e -> { |
1599 | + if (!(e.getValueIsAdjusting())) { |
1600 | + if (fileList.getSelectedIndex() == -1) { |
1601 | + removeFileButton.setEnabled(false); |
1602 | + } else { |
1603 | + removeFileButton.setEnabled(true); |
1604 | } |
1605 | } |
1606 | }); |
1607 | @@ -446,11 +433,7 @@ |
1608 | |
1609 | addFilesButton = new JButton("Add models"); |
1610 | addFilesButton.setToolTipText(TOOL_TIP_AddFilesButton); |
1611 | - addFilesButton.addActionListener(new ActionListener() { |
1612 | - public void actionPerformed(ActionEvent arg0) { |
1613 | - addFiles(); |
1614 | - } |
1615 | - }); |
1616 | + addFilesButton.addActionListener(arg0 -> addFiles()); |
1617 | |
1618 | gbc = new GridBagConstraints(); |
1619 | gbc.anchor = GridBagConstraints.NORTHWEST; |
1620 | @@ -463,12 +446,7 @@ |
1621 | removeFileButton = new JButton("Remove models"); |
1622 | removeFileButton.setToolTipText(TOOL_TIP_RemoveFilesButton); |
1623 | removeFileButton.setEnabled(false); |
1624 | - removeFileButton.addActionListener(new ActionListener() { |
1625 | - |
1626 | - public void actionPerformed(ActionEvent arg0) { |
1627 | - removeSelectedFiles(); |
1628 | - } |
1629 | - }); |
1630 | + removeFileButton.addActionListener(arg0 -> removeSelectedFiles()); |
1631 | gbc = new GridBagConstraints(); |
1632 | gbc.gridx = 1; |
1633 | gbc.gridy = 0; |
1634 | @@ -479,12 +457,9 @@ |
1635 | clearFilesButton = new JButton("Clear"); |
1636 | clearFilesButton.setToolTipText(TOOL_TIP_ClearFilesButton); |
1637 | clearFilesButton.setEnabled(false); |
1638 | - clearFilesButton.addActionListener(new ActionListener() { |
1639 | - |
1640 | - public void actionPerformed(ActionEvent e) { |
1641 | - clearFiles(); |
1642 | - enableButtons(); |
1643 | - } |
1644 | + clearFilesButton.addActionListener(e -> { |
1645 | + clearFiles(); |
1646 | + enableButtons(); |
1647 | }); |
1648 | |
1649 | gbc = new GridBagConstraints(); |
1650 | @@ -892,14 +867,14 @@ |
1651 | } |
1652 | |
1653 | private SearchOption getSearchOption() { |
1654 | - if (((String) searchOption.getSelectedItem()).equals(name_DFS)) |
1655 | + if (searchOption.getSelectedItem().equals(name_DFS)) |
1656 | return SearchOption.DFS; |
1657 | - else if (((String) searchOption.getSelectedItem()).equals(name_Random)) |
1658 | + else if (searchOption.getSelectedItem().equals(name_Random)) |
1659 | return SearchOption.RANDOM; |
1660 | - else if (((String) searchOption.getSelectedItem()) |
1661 | + else if (searchOption.getSelectedItem() |
1662 | .equals(name_HEURISTIC)) |
1663 | return SearchOption.HEURISTIC; |
1664 | - else if (((String) searchOption.getSelectedItem()).equals(name_BFS)) |
1665 | + else if (searchOption.getSelectedItem().equals(name_BFS)) |
1666 | return SearchOption.BFS; |
1667 | else |
1668 | return SearchOption.BatchProcessingKeepQueryOption; |
1669 | @@ -957,28 +932,31 @@ |
1670 | |
1671 | private QueryPropertyOption getQueryPropertyOption() { |
1672 | String propertyOptionString = (String) queryPropertyOption.getSelectedItem(); |
1673 | - if (propertyOptionString.equals(name_SEARCHWHOLESTATESPACE)) |
1674 | - return QueryPropertyOption.SearchWholeStateSpace; |
1675 | - else if (propertyOptionString.equals(name_EXISTDEADLOCK)) |
1676 | - return QueryPropertyOption.ExistDeadlock; |
1677 | - else if (propertyOptionString.equals(name_STRONGSOUNDNESS)) |
1678 | - return QueryPropertyOption.StrongSoundness; |
1679 | - else if (propertyOptionString.equals(name_SOUNDNESS)) |
1680 | - return QueryPropertyOption.Soundness; |
1681 | - else |
1682 | - return QueryPropertyOption.KeepQueryOption; |
1683 | + switch (propertyOptionString) { |
1684 | + case name_SEARCHWHOLESTATESPACE: |
1685 | + return QueryPropertyOption.SearchWholeStateSpace; |
1686 | + case name_EXISTDEADLOCK: |
1687 | + return QueryPropertyOption.ExistDeadlock; |
1688 | + case name_STRONGSOUNDNESS: |
1689 | + return QueryPropertyOption.StrongSoundness; |
1690 | + case name_SOUNDNESS: |
1691 | + return QueryPropertyOption.Soundness; |
1692 | + default: |
1693 | + return QueryPropertyOption.KeepQueryOption; |
1694 | + } |
1695 | } |
1696 | |
1697 | private ApproximationMethodOption getApproximationMethodOption() { |
1698 | String ApproximationMethodOptionString = (String) approximationMethodOption.getSelectedItem(); |
1699 | - if(ApproximationMethodOptionString.equals(name_OVER_APPROXIMATION)) { |
1700 | - return ApproximationMethodOption.OverApproximation; |
1701 | - } else if (ApproximationMethodOptionString.equals(name_UNDER_APPROXIMATION)) { |
1702 | - return ApproximationMethodOption.UnderApproximation; |
1703 | - } else if (ApproximationMethodOptionString.equals(name_NONE_APPROXIMATION)) { |
1704 | - return ApproximationMethodOption.None; |
1705 | - } else { |
1706 | - return ApproximationMethodOption.KeepQueryOption; |
1707 | + switch (ApproximationMethodOptionString) { |
1708 | + case name_OVER_APPROXIMATION: |
1709 | + return ApproximationMethodOption.OverApproximation; |
1710 | + case name_UNDER_APPROXIMATION: |
1711 | + return ApproximationMethodOption.UnderApproximation; |
1712 | + case name_NONE_APPROXIMATION: |
1713 | + return ApproximationMethodOption.None; |
1714 | + default: |
1715 | + return ApproximationMethodOption.KeepQueryOption; |
1716 | } |
1717 | } |
1718 | |
1719 | @@ -1034,21 +1012,21 @@ |
1720 | } |
1721 | |
1722 | private void exportResults() { |
1723 | - String filename = FileBrowser.constructor("CSV file", "csv", lastPath) |
1724 | - .saveFile("results"); |
1725 | + String filename = FileBrowser.constructor("CSV file", "csv", lastPath).saveFile("results"); |
1726 | + |
1727 | if (filename != null) { |
1728 | File exportFile = new File(filename); |
1729 | lastPath = exportFile.getParent(); |
1730 | BatchProcessingResultsExporter exporter = new BatchProcessingResultsExporter(); |
1731 | try { |
1732 | - exporter.exportToCSV(tableModel.getResults(), |
1733 | - exportFile); |
1734 | + exporter.exportToCSV(tableModel.getResults(), exportFile); |
1735 | } catch (Exception e1) { |
1736 | JOptionPane.showMessageDialog( |
1737 | CreateGui.getApp(), |
1738 | "An error occurred while trying to export the results. Please try again", |
1739 | "Error Exporting Results", |
1740 | - JOptionPane.ERROR_MESSAGE); |
1741 | + JOptionPane.ERROR_MESSAGE |
1742 | + ); |
1743 | e1.printStackTrace(); |
1744 | } |
1745 | } |
1746 | @@ -1063,11 +1041,8 @@ |
1747 | |
1748 | closeButton = new JButton("Close"); |
1749 | closeButton.setToolTipText(TOOL_TIP_CloseButton); |
1750 | - closeButton.addActionListener(new ActionListener() { |
1751 | - public void actionPerformed(ActionEvent e) { |
1752 | - exit(); |
1753 | - } |
1754 | - }); |
1755 | + closeButton.addActionListener(e -> exit()); |
1756 | + |
1757 | gbc = new GridBagConstraints(); |
1758 | gbc.gridx = 1; |
1759 | gbc.gridy = 1; |
1760 | @@ -1084,7 +1059,7 @@ |
1761 | Integer.MAX_VALUE); // disable tooltips disappearing |
1762 | ToolTipManager.sharedInstance().setInitialDelay(200); |
1763 | return new MultiLineAutoWrappingToolTip(); |
1764 | - }; |
1765 | + } |
1766 | }; |
1767 | ResultTableCellRenderer renderer = new ResultTableCellRenderer(true); |
1768 | table.getColumnModel().getColumn(0).setMinWidth(70); |
1769 | @@ -1097,12 +1072,9 @@ |
1770 | table.getColumn("Verification Time").setCellRenderer(renderer); |
1771 | table.getColumn("Memory Usage").setCellRenderer(renderer); |
1772 | |
1773 | - tableModel.addTableModelListener(new TableModelListener() { |
1774 | - public void tableChanged(TableModelEvent e) { |
1775 | - if (e.getType() == TableModelEvent.INSERT) { |
1776 | - table.scrollRectToVisible(table.getCellRect(e.getLastRow(), |
1777 | - e.getLastRow(), true)); |
1778 | - } |
1779 | + tableModel.addTableModelListener(e -> { |
1780 | + if (e.getType() == TableModelEvent.INSERT) { |
1781 | + table.scrollRectToVisible(table.getCellRect(e.getLastRow(), e.getLastRow(), true)); |
1782 | } |
1783 | }); |
1784 | |
1785 | @@ -1116,10 +1088,8 @@ |
1786 | table.setRowSorter(sorter); |
1787 | |
1788 | JScrollPane scrollPane = new JScrollPane(table); |
1789 | - scrollPane |
1790 | - .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
1791 | - scrollPane |
1792 | - .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
1793 | + scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
1794 | + scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
1795 | Dimension scrollPanePrefDims = new Dimension(850, 250); |
1796 | //Set the minimum size to 150 lets than the preferred, to be consistat with theh minimum size of the window |
1797 | Dimension scrollPaneMinDims = new Dimension(850, 250-150); |
1798 | @@ -1277,15 +1247,13 @@ |
1799 | cancelButton.setPreferredSize(new java.awt.Dimension(85, 25)); |
1800 | |
1801 | cancelButton.setEnabled(false); |
1802 | - cancelButton.addActionListener(new ActionListener() { |
1803 | + cancelButton.addActionListener(e -> { |
1804 | + terminateBatchProcessing(); |
1805 | + fileStatusLabel.setText(""); |
1806 | + statusLabel.setText("Batch processing cancelled"); |
1807 | + enableButtons(); |
1808 | + }); |
1809 | |
1810 | - public void actionPerformed(ActionEvent e) { |
1811 | - terminateBatchProcessing(); |
1812 | - fileStatusLabel.setText(""); |
1813 | - statusLabel.setText("Batch processing cancelled"); |
1814 | - enableButtons(); |
1815 | - } |
1816 | - }); |
1817 | gbc = new GridBagConstraints(); |
1818 | gbc.gridx = 4; |
1819 | gbc.gridy = 2; |
1820 | @@ -1300,12 +1268,8 @@ |
1821 | skipFileButton.setPreferredSize(new java.awt.Dimension(85, 25)); |
1822 | |
1823 | skipFileButton.setEnabled(false); |
1824 | - skipFileButton.addActionListener(new ActionListener() { |
1825 | + skipFileButton.addActionListener(e -> skipCurrentFile()); |
1826 | |
1827 | - public void actionPerformed(ActionEvent e) { |
1828 | - skipCurrentFile(); |
1829 | - } |
1830 | - }); |
1831 | gbc = new GridBagConstraints(); |
1832 | gbc.gridx = 4; |
1833 | gbc.gridy = 1; |
1834 | @@ -1333,7 +1297,7 @@ |
1835 | |
1836 | public void propertyChange(PropertyChangeEvent evt) { |
1837 | if (evt.getPropertyName().equals("state")) { |
1838 | - if ((StateValue) evt.getNewValue() == StateValue.DONE) { |
1839 | + if (evt.getNewValue() == StateValue.DONE) { |
1840 | enableButtons(); |
1841 | cancelButton.setEnabled(false); |
1842 | skipFileButton.setEnabled(false); |
1843 | @@ -1341,7 +1305,7 @@ |
1844 | timer.stop(); |
1845 | stopMemoryTimer(); |
1846 | timeoutTimer.stop(); |
1847 | - } else if ((StateValue) evt.getNewValue() == StateValue.STARTED) { |
1848 | + } else if (evt.getNewValue() == StateValue.STARTED) { |
1849 | disableButtonsDuringProcessing(); |
1850 | cancelButton.setEnabled(true); |
1851 | skipFileButton.setEnabled(true); |
1852 | @@ -1371,13 +1335,14 @@ |
1853 | startTimeMs = System.currentTimeMillis(); |
1854 | } |
1855 | |
1856 | - public void fireVerificationTaskComplete( |
1857 | - VerificationTaskCompleteEvent e) { |
1858 | - if (timer.isRunning()) |
1859 | + public void fireVerificationTaskComplete(VerificationTaskCompleteEvent e) { |
1860 | + if (timer.isRunning()) { |
1861 | timer.stop(); |
1862 | + } |
1863 | stopMemoryTimer(); |
1864 | - if (timeoutTimer.isRunning()) |
1865 | + if (timeoutTimer.isRunning()) { |
1866 | timeoutTimer.stop(); |
1867 | + } |
1868 | int tasksCompleted = e.verificationTasksCompleted(); |
1869 | progressLabel.setText(e.verificationTasksCompleted() |
1870 | + " verification task" |
1871 | @@ -1490,8 +1455,7 @@ |
1872 | |
1873 | // Custom cell renderer for the Query Column of the result table display the |
1874 | // property of the query |
1875 | - private class ResultTableCellRenderer extends JLabel implements |
1876 | - TableCellRenderer { |
1877 | + private class ResultTableCellRenderer extends JLabel implements TableCellRenderer { |
1878 | private static final long serialVersionUID = 3054497986242852099L; |
1879 | Border unselectedBorder = null; |
1880 | Border selectedBorder = null; |
1881 | @@ -1501,9 +1465,7 @@ |
1882 | this.isBordered = isBordered; |
1883 | } |
1884 | |
1885 | - public Component getTableCellRendererComponent(JTable table, |
1886 | - Object value, boolean isSelected, boolean hasFocus, int row, |
1887 | - int column) { |
1888 | + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
1889 | if (isBordered) { |
1890 | if (isSelected) { |
1891 | setBackground(table.getSelectionBackground()); |
1892 | @@ -1542,8 +1504,7 @@ |
1893 | } |
1894 | setForeground(table.getForeground()); |
1895 | if (unselectedBorder == null) { |
1896 | - unselectedBorder = BorderFactory.createMatteBorder(2, |
1897 | - 5, 2, 5, table.getBackground()); |
1898 | + unselectedBorder = BorderFactory.createMatteBorder(2, 5, 2, 5, table.getBackground()); |
1899 | } |
1900 | setBorder(unselectedBorder); |
1901 | } |
1902 | @@ -1559,8 +1520,7 @@ |
1903 | |
1904 | setToolTipText(generateTooltipTextFromQuery(newQuery)); |
1905 | setText(newQuery.getName()); |
1906 | - } else if (table.getColumnName(column).equals( |
1907 | - "Verification Time") |
1908 | + } else if (table.getColumnName(column).equals("Verification Time") |
1909 | || table.getColumnName(column).equals("Method") |
1910 | || table.getColumnName(column).equals("Memory Usage")) { |
1911 | setText(value.toString()); |
1912 | @@ -1579,8 +1539,7 @@ |
1913 | setToolTipText(result != null ? generateMemoryToolTipText(result) |
1914 | : value.toString()); |
1915 | else |
1916 | - setToolTipText(result != null ? generateReductionString(result |
1917 | - .query()) : value.toString()); |
1918 | + setToolTipText(result != null ? generateReductionString(result.query()) : value.toString()); |
1919 | } else { |
1920 | setToolTipText(value.toString()); |
1921 | setText(value.toString()); |
1922 | @@ -1593,8 +1552,7 @@ |
1923 | return this; |
1924 | } |
1925 | |
1926 | - private String generateStatsToolTipText( |
1927 | - BatchProcessingVerificationResult result) { |
1928 | + private String generateStatsToolTipText(BatchProcessingVerificationResult result) { |
1929 | StringBuilder s = new StringBuilder(); |
1930 | s.append("Verification Time: "); |
1931 | s.append((result.verificationTimeInMs() / 1000.0)); |
1932 | @@ -1608,8 +1566,7 @@ |
1933 | return s.toString(); |
1934 | } |
1935 | |
1936 | - private String generateMemoryToolTipText( |
1937 | - BatchProcessingVerificationResult result) { |
1938 | + private String generateMemoryToolTipText(BatchProcessingVerificationResult result) { |
1939 | StringBuilder s = new StringBuilder(); |
1940 | s.append("Peak memory usage (estimate): "); |
1941 | s.append(result.verificationMemory()); |
1942 | @@ -1759,11 +1716,9 @@ |
1943 | |
1944 | chooseReductionOptions = new JButton(STATUS_TEXT_DONT_OVERRIDE); |
1945 | chooseReductionOptions.setToolTipText(TOOL_TIP_ReductionOption); |
1946 | - chooseReductionOptions.addActionListener(new ActionListener() { |
1947 | - public void actionPerformed(ActionEvent arg0) { |
1948 | - //reductionOptionDialog.setOverride(true); |
1949 | - reductionOptionDialog.setVisible(true); |
1950 | - } |
1951 | + chooseReductionOptions.addActionListener(arg0 -> { |
1952 | + //reductionOptionDialog.setOverride(true); |
1953 | + reductionOptionDialog.setVisible(true); |
1954 | }); |
1955 | this.add(chooseReductionOptions); |
1956 | |
1957 | |
1958 | === modified file 'src/dk/aau/cs/gui/Context.java' |
1959 | --- src/dk/aau/cs/gui/Context.java 2011-09-23 21:23:31 +0000 |
1960 | +++ src/dk/aau/cs/gui/Context.java 2020-04-28 09:05:34 +0000 |
1961 | @@ -19,7 +19,7 @@ |
1962 | currentTab = tab; |
1963 | network = tab.network(); |
1964 | selectedTemplate = tab.currentTemplate(); |
1965 | - undoManager = tab.drawingSurface().getUndoManager(); |
1966 | + undoManager = tab.getUndoManager(); |
1967 | } |
1968 | |
1969 | public TimedArcPetriNetNetwork network(){ |
1970 | |
1971 | === modified file 'src/dk/aau/cs/gui/DeleteSharedPlaceOrTransition.java' |
1972 | --- src/dk/aau/cs/gui/DeleteSharedPlaceOrTransition.java 2019-03-14 19:41:23 +0000 |
1973 | +++ src/dk/aau/cs/gui/DeleteSharedPlaceOrTransition.java 2020-04-28 09:05:34 +0000 |
1974 | @@ -33,7 +33,7 @@ |
1975 | import pipe.dataLayer.TAPNQuery; |
1976 | import pipe.dataLayer.Template; |
1977 | import pipe.gui.CreateGui; |
1978 | -import pipe.gui.DrawingSurfaceImpl; |
1979 | +import pipe.gui.canvas.DrawingSurfaceImpl; |
1980 | import pipe.gui.graphicElements.Arc; |
1981 | import pipe.gui.graphicElements.tapn.TimedInhibitorArcComponent; |
1982 | import pipe.gui.graphicElements.tapn.TimedInputArcComponent; |
1983 | @@ -68,7 +68,7 @@ |
1984 | this.list = list; |
1985 | this.sharedPlacesAndTransitionsPanel = sharedPlacesAndTransitionsPanel; |
1986 | this.tab = tab; |
1987 | - undoManager = tab.drawingSurface().getUndoManager(); |
1988 | + undoManager = tab.getUndoManager(); |
1989 | this.sharedPlacesListModel = sharedPlacesListModel; |
1990 | this.sharedTransitionsListModel = sharedTransitionsListModel; |
1991 | this.nameGenerator = nameGenerator; |
1992 | @@ -139,9 +139,9 @@ |
1993 | |
1994 | private void deleteSharedPlace(boolean deleteFromTemplates, SharedPlace placeToRemove, Collection<TAPNQuery> affectedQueries) { |
1995 | SharedPlace sharedPlace = placeToRemove; |
1996 | - if(affectedQueries.size() > 0 && messageShown == false){ |
1997 | + if(affectedQueries.size() > 0 && !messageShown){ |
1998 | messageShown = true; |
1999 | - StringBuffer buffer = new StringBuffer("The following queries contains the shared place and will also be deleted:"); |
2000 | + StringBuilder buffer = new StringBuilder("The following queries contains the shared place and will also be deleted:"); |
2001 | buffer.append(System.getProperty("line.separator")); |
2002 | buffer.append(System.getProperty("line.separator")); |
2003 | |
2004 | @@ -170,7 +170,7 @@ |
2005 | deleteArc(arc, template); |
2006 | } |
2007 | |
2008 | - Command cmd = new DeleteTimedPlaceCommand(place, template.model(), template.guiModel(), tab.drawingSurface()); |
2009 | + Command cmd = new DeleteTimedPlaceCommand(place, template.model(), template.guiModel()); |
2010 | cmd.redo(); |
2011 | undoManager.addEdit(cmd); |
2012 | } |
2013 | @@ -240,14 +240,14 @@ |
2014 | |
2015 | private Command createDeleteArcCommand(Template template, Arc arc, DrawingSurfaceImpl drawingSurface) { |
2016 | if(arc instanceof TimedInhibitorArcComponent){ |
2017 | - return new DeleteTimedInhibitorArcCommand((TimedInhibitorArcComponent)arc, template.model(), template.guiModel(), drawingSurface); |
2018 | + return new DeleteTimedInhibitorArcCommand((TimedInhibitorArcComponent)arc, template.model(), template.guiModel()); |
2019 | }else if(arc instanceof TimedTransportArcComponent){ |
2020 | TimedTransportArcComponent component = (TimedTransportArcComponent)arc; |
2021 | - return new DeleteTransportArcCommand(component, component.underlyingTransportArc(), template.model(), template.guiModel(), drawingSurface); |
2022 | + return new DeleteTransportArcCommand(component, component.underlyingTransportArc(), template.model(), template.guiModel()); |
2023 | }else if(arc instanceof TimedInputArcComponent){ |
2024 | - return new DeleteTimedInputArcCommand((TimedInputArcComponent)arc, template.model(), template.guiModel(), drawingSurface); |
2025 | + return new DeleteTimedInputArcCommand((TimedInputArcComponent)arc, template.model(), template.guiModel()); |
2026 | }else{ |
2027 | - return new DeleteTimedOutputArcCommand((TimedOutputArcComponent)arc, template.model(), template.guiModel(), drawingSurface); |
2028 | + return new DeleteTimedOutputArcCommand((TimedOutputArcComponent)arc, template.model(), template.guiModel()); |
2029 | } |
2030 | } |
2031 | |
2032 | @@ -261,7 +261,7 @@ |
2033 | SharedTransition sharedTransition = transitionToBeRemoved; |
2034 | if(affectedQueries.size() > 0 && !messageShown){ |
2035 | messageShown = true; |
2036 | - StringBuffer buffer = new StringBuffer("The following queries contains the shared transition and will also be deleted:"); |
2037 | + StringBuilder buffer = new StringBuilder("The following queries contains the shared transition and will also be deleted:"); |
2038 | buffer.append(System.getProperty("line.separator")); |
2039 | buffer.append(System.getProperty("line.separator")); |
2040 | |
2041 | @@ -290,8 +290,9 @@ |
2042 | deleteArc(arc, template); |
2043 | } |
2044 | |
2045 | - undoManager.addEdit(new DeleteTimedTransitionCommand(transition, transition.underlyingTransition().model(), template.guiModel(), tab.drawingSurface())); |
2046 | - transition.delete(); |
2047 | + Command c = new DeleteTimedTransitionCommand(transition, transition.underlyingTransition().model(), template.guiModel()); |
2048 | + undoManager.addEdit(c); |
2049 | + c.redo(); |
2050 | } |
2051 | } |
2052 | tab.drawingSurface().repaint(); |
2053 | |
2054 | === modified file 'src/dk/aau/cs/gui/NameGenerator.java' |
2055 | --- src/dk/aau/cs/gui/NameGenerator.java 2011-03-31 16:38:41 +0000 |
2056 | +++ src/dk/aau/cs/gui/NameGenerator.java 2020-04-28 09:05:34 +0000 |
2057 | @@ -4,7 +4,6 @@ |
2058 | import java.util.regex.Matcher; |
2059 | import java.util.regex.Pattern; |
2060 | |
2061 | -import pipe.dataLayer.Template; |
2062 | import dk.aau.cs.model.tapn.SharedPlace; |
2063 | import dk.aau.cs.model.tapn.SharedTransition; |
2064 | import dk.aau.cs.model.tapn.TimedArcPetriNet; |
2065 | @@ -46,12 +45,6 @@ |
2066 | return TEMPLATE_NAME_PREFIX + (++tapnId); |
2067 | } |
2068 | |
2069 | - public void setupNameGeneratorFromTemplates(Iterable<Template> templates) { |
2070 | - for(Template tapn : templates) { |
2071 | - setupTemplate(tapn.model()); |
2072 | - } |
2073 | - } |
2074 | - |
2075 | private void setupTemplate(TimedArcPetriNet tapn) { |
2076 | Pattern templatePattern = Pattern.compile("^TAPN(\\d+)$", Pattern.CASE_INSENSITIVE); |
2077 | |
2078 | |
2079 | === modified file 'src/dk/aau/cs/gui/SharedPlaceNamePanel.java' |
2080 | --- src/dk/aau/cs/gui/SharedPlaceNamePanel.java 2012-02-28 19:31:43 +0000 |
2081 | +++ src/dk/aau/cs/gui/SharedPlaceNamePanel.java 2020-04-28 09:05:34 +0000 |
2082 | @@ -1,6 +1,5 @@ |
2083 | package dk.aau.cs.gui; |
2084 | |
2085 | -import java.awt.BorderLayout; |
2086 | import java.awt.Dimension; |
2087 | import java.awt.GridBagConstraints; |
2088 | import java.awt.GridBagLayout; |
2089 | @@ -84,11 +83,9 @@ |
2090 | nameField = new JTextField(initialText); |
2091 | nameField.setMinimumSize(new Dimension(330, 25)); |
2092 | nameField.setPreferredSize(new Dimension(330, 25)); |
2093 | - nameField.addActionListener(new ActionListener() { |
2094 | - public void actionPerformed(ActionEvent e) { |
2095 | - okButton.requestFocusInWindow(); |
2096 | - okButton.doClick(); |
2097 | - } |
2098 | + nameField.addActionListener(e -> { |
2099 | + okButton.requestFocusInWindow(); |
2100 | + okButton.doClick(); |
2101 | }); |
2102 | gbc = new GridBagConstraints(); |
2103 | gbc.gridy = 1; |
2104 | @@ -204,11 +201,7 @@ |
2105 | gbc.gridwidth = java.awt.GridBagConstraints.RELATIVE; |
2106 | gbc.anchor = GridBagConstraints.EAST; |
2107 | |
2108 | - cancelButton.addActionListener(new ActionListener() { |
2109 | - public void actionPerformed(ActionEvent e) { |
2110 | - exit(); |
2111 | - } |
2112 | - }); |
2113 | + cancelButton.addActionListener(e -> exit()); |
2114 | |
2115 | buttonPanel.add(cancelButton,gbc); |
2116 | buttonPanel.add(okButton,gbcOk); |
2117 | |
2118 | === modified file 'src/dk/aau/cs/gui/SharedPlacesAndTransitionsPanel.java' |
2119 | --- src/dk/aau/cs/gui/SharedPlacesAndTransitionsPanel.java 2019-03-02 11:14:31 +0000 |
2120 | +++ src/dk/aau/cs/gui/SharedPlacesAndTransitionsPanel.java 2020-04-28 09:05:34 +0000 |
2121 | @@ -4,8 +4,6 @@ |
2122 | import java.awt.Dimension; |
2123 | import java.awt.GridBagConstraints; |
2124 | import java.awt.GridBagLayout; |
2125 | -import java.awt.event.ActionEvent; |
2126 | -import java.awt.event.ActionListener; |
2127 | import java.awt.event.ComponentEvent; |
2128 | import java.awt.event.ComponentListener; |
2129 | import java.awt.event.MouseAdapter; |
2130 | @@ -19,7 +17,6 @@ |
2131 | import javax.swing.JButton; |
2132 | import javax.swing.JComboBox; |
2133 | import javax.swing.JList; |
2134 | -import javax.swing.JOptionPane; |
2135 | import javax.swing.JPanel; |
2136 | import javax.swing.JScrollPane; |
2137 | import javax.swing.event.ListDataEvent; |
2138 | @@ -32,7 +29,6 @@ |
2139 | import pipe.gui.widgets.EscapableDialog; |
2140 | |
2141 | import dk.aau.cs.gui.components.NonsearchableJList; |
2142 | -import dk.aau.cs.gui.undo.AddSharedPlaceCommand; |
2143 | import dk.aau.cs.gui.undo.Command; |
2144 | import dk.aau.cs.gui.undo.SortSharedPlacesCommand; |
2145 | import dk.aau.cs.gui.undo.SortSharedTransitionsCommand; |
2146 | @@ -40,7 +36,6 @@ |
2147 | import dk.aau.cs.model.tapn.SharedTransition; |
2148 | import dk.aau.cs.model.tapn.TimedArcPetriNetNetwork; |
2149 | import dk.aau.cs.util.Require; |
2150 | -import dk.aau.cs.util.RequireException; |
2151 | |
2152 | public class SharedPlacesAndTransitionsPanel extends JPanel { |
2153 | private static final String TRANSITION_IS_USED_MESSAGE = "<html>The shared transition is used in one or more components.<br/>TAPAAL will unshare all transitions under this name,<br/>but leave the transitions in the components.</html>"; |
2154 | @@ -84,7 +79,7 @@ |
2155 | public SharedPlacesAndTransitionsPanel(TabContent tab){ |
2156 | Require.that(tab != null, "tab cannot be null"); |
2157 | |
2158 | - undoManager = tab.drawingSurface().getUndoManager(); |
2159 | + undoManager = tab.getUndoManager(); |
2160 | nameGenerator = tab.drawingSurface().getNameGenerator(); |
2161 | this.tab = tab; |
2162 | |
2163 | @@ -198,18 +193,16 @@ |
2164 | moveUpButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Up.png"))); |
2165 | moveUpButton.setEnabled(false); |
2166 | moveUpButton.setToolTipText(toolTipMoveUp); |
2167 | - moveUpButton.addActionListener(new ActionListener() { |
2168 | - public void actionPerformed(ActionEvent e) { |
2169 | - int index = list.getSelectedIndex(); |
2170 | - |
2171 | - if(index > 0) { |
2172 | - if(isDisplayingTransitions()) |
2173 | - sharedTransitionsListModel.swap(index, index-1); |
2174 | - else |
2175 | - sharedPlacesListModel.swap(index, index-1); |
2176 | - list.setSelectedIndex(index-1); |
2177 | - list.ensureIndexIsVisible(index-1); |
2178 | - } |
2179 | + moveUpButton.addActionListener(e -> { |
2180 | + int index = list.getSelectedIndex(); |
2181 | + |
2182 | + if(index > 0) { |
2183 | + if(isDisplayingTransitions()) |
2184 | + sharedTransitionsListModel.swap(index, index-1); |
2185 | + else |
2186 | + sharedPlacesListModel.swap(index, index-1); |
2187 | + list.setSelectedIndex(index-1); |
2188 | + list.ensureIndexIsVisible(index-1); |
2189 | } |
2190 | }); |
2191 | |
2192 | @@ -222,23 +215,21 @@ |
2193 | moveDownButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Down.png"))); |
2194 | moveDownButton.setEnabled(false); |
2195 | moveDownButton.setToolTipText(toolTipMoveDown); |
2196 | - moveDownButton.addActionListener(new ActionListener() { |
2197 | - public void actionPerformed(ActionEvent e) { |
2198 | - int index = list.getSelectedIndex(); |
2199 | - |
2200 | - if(isDisplayingTransitions()) { |
2201 | - if(index < sharedTransitionsListModel.getSize() - 1) { |
2202 | - sharedTransitionsListModel.swap(index, index+1); |
2203 | - list.setSelectedIndex(index+1); |
2204 | - list.ensureIndexIsVisible(index+1); |
2205 | - |
2206 | - } |
2207 | - } else { |
2208 | - if(index < sharedPlacesListModel.getSize() - 1) { |
2209 | - sharedPlacesListModel.swap(index, index+1); |
2210 | - list.setSelectedIndex(index+1); |
2211 | - list.ensureIndexIsVisible(index+1); |
2212 | - } |
2213 | + moveDownButton.addActionListener(e -> { |
2214 | + int index = list.getSelectedIndex(); |
2215 | + |
2216 | + if(isDisplayingTransitions()) { |
2217 | + if(index < sharedTransitionsListModel.getSize() - 1) { |
2218 | + sharedTransitionsListModel.swap(index, index+1); |
2219 | + list.setSelectedIndex(index+1); |
2220 | + list.ensureIndexIsVisible(index+1); |
2221 | + |
2222 | + } |
2223 | + } else { |
2224 | + if(index < sharedPlacesListModel.getSize() - 1) { |
2225 | + sharedPlacesListModel.swap(index, index+1); |
2226 | + list.setSelectedIndex(index+1); |
2227 | + list.ensureIndexIsVisible(index+1); |
2228 | } |
2229 | } |
2230 | }); |
2231 | @@ -253,17 +244,15 @@ |
2232 | sortButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Sort.png"))); |
2233 | sortButton.setToolTipText(toolTipSortPlaces); |
2234 | sortButton.setEnabled(false); |
2235 | - sortButton.addActionListener(new ActionListener() { |
2236 | - public void actionPerformed(ActionEvent e) { |
2237 | - if(isDisplayingTransitions()){ |
2238 | - Command c = new SortSharedTransitionsCommand(sharedTransitionsListModel); |
2239 | - undoManager.addNewEdit(c); |
2240 | - c.redo(); |
2241 | - } else { |
2242 | - Command c = new SortSharedPlacesCommand(sharedPlacesListModel); |
2243 | - undoManager.addNewEdit(c); |
2244 | - c.redo(); |
2245 | - } |
2246 | + sortButton.addActionListener(e -> { |
2247 | + if(isDisplayingTransitions()){ |
2248 | + Command c = new SortSharedTransitionsCommand(sharedTransitionsListModel); |
2249 | + undoManager.addNewEdit(c); |
2250 | + c.redo(); |
2251 | + } else { |
2252 | + Command c = new SortSharedPlacesCommand(sharedPlacesListModel); |
2253 | + undoManager.addNewEdit(c); |
2254 | + c.redo(); |
2255 | } |
2256 | }); |
2257 | sortButton.addMouseListener(new MouseAdapter() { |
2258 | @@ -286,35 +275,33 @@ |
2259 | |
2260 | placesTransitionsComboBox = new JComboBox(new String[]{ PLACES, TRANSITIONS }); |
2261 | placesTransitionsComboBox.setToolTipText(toolTipChangeBetweenPlacesAndTransitions); |
2262 | - placesTransitionsComboBox.addActionListener(new ActionListener(){ |
2263 | - public void actionPerformed(ActionEvent e) { |
2264 | - JComboBox source = (JComboBox)e.getSource(); |
2265 | - String selectedItem = (String)source.getSelectedItem(); |
2266 | - if(selectedItem.equals(PLACES)){ |
2267 | - list.setModel(sharedPlacesListModel); |
2268 | - renameButton.setToolTipText(toolTipRenamePlace); |
2269 | - addButton.setToolTipText(toolTipNewPlace); |
2270 | - removeButton.setToolTipText(toolTipRemovePlace); |
2271 | - }else if(selectedItem.equals(TRANSITIONS)){ |
2272 | - list.setModel(sharedTransitionsListModel); |
2273 | - renameButton.setToolTipText(toolTipRenameTransition); |
2274 | - addButton.setToolTipText(toolTipNewTransition); |
2275 | - removeButton.setToolTipText(toolTipRemoveTransition); |
2276 | - } |
2277 | - |
2278 | - if(list.getModel().getSize() > 0) { |
2279 | - list.setSelectedIndex(0); |
2280 | - list.ensureIndexIsVisible(0); |
2281 | - } else { |
2282 | - moveDownButton.setEnabled(false); |
2283 | - moveUpButton.setEnabled(false); |
2284 | - sortButton.setEnabled(false); |
2285 | - } |
2286 | - if (list.getModel().getSize() <= 0){ |
2287 | - renameButton.setEnabled(false); |
2288 | - removeButton.setEnabled(false); |
2289 | - } |
2290 | - } |
2291 | + placesTransitionsComboBox.addActionListener(e -> { |
2292 | + JComboBox source = (JComboBox)e.getSource(); |
2293 | + String selectedItem = (String)source.getSelectedItem(); |
2294 | + if(selectedItem.equals(PLACES)){ |
2295 | + list.setModel(sharedPlacesListModel); |
2296 | + renameButton.setToolTipText(toolTipRenamePlace); |
2297 | + addButton.setToolTipText(toolTipNewPlace); |
2298 | + removeButton.setToolTipText(toolTipRemovePlace); |
2299 | + }else if(selectedItem.equals(TRANSITIONS)){ |
2300 | + list.setModel(sharedTransitionsListModel); |
2301 | + renameButton.setToolTipText(toolTipRenameTransition); |
2302 | + addButton.setToolTipText(toolTipNewTransition); |
2303 | + removeButton.setToolTipText(toolTipRemoveTransition); |
2304 | + } |
2305 | + |
2306 | + if(list.getModel().getSize() > 0) { |
2307 | + list.setSelectedIndex(0); |
2308 | + list.ensureIndexIsVisible(0); |
2309 | + } else { |
2310 | + moveDownButton.setEnabled(false); |
2311 | + moveUpButton.setEnabled(false); |
2312 | + sortButton.setEnabled(false); |
2313 | + } |
2314 | + if (list.getModel().getSize() <= 0){ |
2315 | + renameButton.setEnabled(false); |
2316 | + removeButton.setEnabled(false); |
2317 | + } |
2318 | }); |
2319 | placesTransitionsComboBox.setSelectedIndex(0); // Sets up the proper list model |
2320 | |
2321 | @@ -343,14 +330,12 @@ |
2322 | else { |
2323 | renameButton.setToolTipText(toolTipRenamePlace); |
2324 | } |
2325 | - renameButton.addActionListener(new ActionListener(){ |
2326 | - public void actionPerformed(ActionEvent arg0) { |
2327 | - if(isDisplayingTransitions()){ |
2328 | - showSharedTransitionNameDialog((SharedTransition)list.getSelectedValue()); |
2329 | - }else{ |
2330 | - showSharedPlaceNameDialog((SharedPlace)list.getSelectedValue()); |
2331 | - } |
2332 | - } |
2333 | + renameButton.addActionListener(arg0 -> { |
2334 | + if(isDisplayingTransitions()){ |
2335 | + showSharedTransitionNameDialog((SharedTransition)list.getSelectedValue()); |
2336 | + }else{ |
2337 | + showSharedPlaceNameDialog((SharedPlace)list.getSelectedValue()); |
2338 | + } |
2339 | }); |
2340 | removeButton.setEnabled(false); |
2341 | if (isDisplayingTransitions()){ |
2342 | @@ -367,14 +352,12 @@ |
2343 | else { |
2344 | addButton.setToolTipText(toolTipNewPlace); |
2345 | } |
2346 | - addButton.addActionListener(new ActionListener(){ |
2347 | - public void actionPerformed(ActionEvent arg0) { |
2348 | - if(isDisplayingTransitions()){ |
2349 | - showSharedTransitionNameDialog(null); |
2350 | - }else{ |
2351 | - showSharedPlaceNameDialog(null); |
2352 | - } |
2353 | - } |
2354 | + addButton.addActionListener(arg0 -> { |
2355 | + if(isDisplayingTransitions()){ |
2356 | + showSharedTransitionNameDialog(null); |
2357 | + }else{ |
2358 | + showSharedPlaceNameDialog(null); |
2359 | + } |
2360 | }); |
2361 | |
2362 | buttonPanel.add(renameButton); |
2363 | |
2364 | === modified file 'src/dk/aau/cs/gui/SharedTransitionNamePanel.java' |
2365 | --- src/dk/aau/cs/gui/SharedTransitionNamePanel.java 2017-03-12 00:33:00 +0000 |
2366 | +++ src/dk/aau/cs/gui/SharedTransitionNamePanel.java 2020-04-28 09:05:34 +0000 |
2367 | @@ -1,6 +1,5 @@ |
2368 | package dk.aau.cs.gui; |
2369 | |
2370 | -import java.awt.BorderLayout; |
2371 | import java.awt.Dimension; |
2372 | import java.awt.GridBagConstraints; |
2373 | import java.awt.GridBagLayout; |
2374 | @@ -90,11 +89,9 @@ |
2375 | nameField = new JTextField(initialText); |
2376 | nameField.setMinimumSize(new Dimension(330, 25)); |
2377 | nameField.setPreferredSize(new Dimension(330, 25)); |
2378 | - nameField.addActionListener(new ActionListener() { |
2379 | - public void actionPerformed(ActionEvent e) { |
2380 | - okButton.requestFocusInWindow(); |
2381 | - okButton.doClick(); |
2382 | - } |
2383 | + nameField.addActionListener(e -> { |
2384 | + okButton.requestFocusInWindow(); |
2385 | + okButton.doClick(); |
2386 | }); |
2387 | gbc = new GridBagConstraints(); |
2388 | gbc.gridy = 1; |
2389 | @@ -206,11 +203,7 @@ |
2390 | gbc.gridwidth = java.awt.GridBagConstraints.RELATIVE; |
2391 | gbc.anchor = GridBagConstraints.EAST; |
2392 | |
2393 | - cancelButton.addActionListener(new ActionListener() { |
2394 | - public void actionPerformed(ActionEvent e) { |
2395 | - exit(); |
2396 | - } |
2397 | - }); |
2398 | + cancelButton.addActionListener(e -> exit()); |
2399 | |
2400 | buttonPanel.add(cancelButton,gbc); |
2401 | buttonPanel.add(okButton,gbcOk); |
2402 | |
2403 | === modified file 'src/dk/aau/cs/gui/TabComponent.java' |
2404 | --- src/dk/aau/cs/gui/TabComponent.java 2018-05-23 15:13:04 +0000 |
2405 | +++ src/dk/aau/cs/gui/TabComponent.java 2020-04-28 09:05:34 +0000 |
2406 | @@ -38,8 +38,6 @@ |
2407 | import java.awt.FlowLayout; |
2408 | import java.awt.Graphics; |
2409 | import java.awt.Graphics2D; |
2410 | -import java.awt.event.ActionEvent; |
2411 | -import java.awt.event.ActionListener; |
2412 | import java.awt.event.MouseAdapter; |
2413 | import java.awt.event.MouseEvent; |
2414 | import java.awt.event.MouseListener; |
2415 | @@ -52,7 +50,6 @@ |
2416 | import javax.swing.JTabbedPane; |
2417 | |
2418 | import pipe.gui.CreateGui; |
2419 | -import pipe.gui.GuiFrame.GUIMode; |
2420 | import dk.aau.cs.util.Require; |
2421 | |
2422 | /** |
2423 | @@ -61,7 +58,7 @@ |
2424 | * button for closing the tab. |
2425 | * |
2426 | */ |
2427 | -public class TabComponent extends JPanel { |
2428 | +public abstract class TabComponent extends JPanel { |
2429 | /** |
2430 | * |
2431 | */ |
2432 | @@ -113,11 +110,9 @@ |
2433 | setBorderPainted(false); |
2434 | addMouseListener(buttonMouseListener); |
2435 | setRolloverEnabled(true); |
2436 | - addActionListener(new ActionListener(){ |
2437 | - public void actionPerformed(ActionEvent arg0) { |
2438 | - int index = pane.indexOfTabComponent(TabComponent.this); |
2439 | - CreateGui.getApp().closeTab(index); |
2440 | - } |
2441 | + addActionListener(arg0 -> { |
2442 | + int index = pane.indexOfTabComponent(TabComponent.this); |
2443 | + closeTab((TabContent) pane.getComponentAt(index)); |
2444 | }); |
2445 | } |
2446 | |
2447 | @@ -143,6 +138,8 @@ |
2448 | |
2449 | } |
2450 | |
2451 | + protected abstract void closeTab(TabContent tab); |
2452 | + |
2453 | private static final MouseListener buttonMouseListener = new MouseAdapter() { |
2454 | @Override |
2455 | public void mouseEntered(MouseEvent e) { |
2456 | |
2457 | === modified file 'src/dk/aau/cs/gui/TabContent.java' |
2458 | --- src/dk/aau/cs/gui/TabContent.java 2020-04-12 09:12:50 +0000 |
2459 | +++ src/dk/aau/cs/gui/TabContent.java 2020-04-28 09:05:34 +0000 |
2460 | @@ -1,59 +1,192 @@ |
2461 | package dk.aau.cs.gui; |
2462 | |
2463 | -import java.awt.Component; |
2464 | -import java.awt.Dimension; |
2465 | -import java.awt.GridBagConstraints; |
2466 | -import java.awt.GridBagLayout; |
2467 | +import java.awt.*; |
2468 | import java.awt.event.MouseAdapter; |
2469 | import java.awt.event.MouseEvent; |
2470 | -import java.io.File; |
2471 | -import java.util.ArrayList; |
2472 | -import java.util.Collection; |
2473 | -import java.util.HashMap; |
2474 | +import java.io.*; |
2475 | +import java.math.BigDecimal; |
2476 | +import java.util.*; |
2477 | +import java.util.List; |
2478 | |
2479 | -import javax.swing.BorderFactory; |
2480 | -import javax.swing.JButton; |
2481 | -import javax.swing.JLabel; |
2482 | -import javax.swing.JPanel; |
2483 | -import javax.swing.JScrollPane; |
2484 | -import javax.swing.JSplitPane; |
2485 | -import javax.swing.SwingUtilities; |
2486 | +import javax.swing.*; |
2487 | import javax.swing.border.BevelBorder; |
2488 | import javax.swing.border.EmptyBorder; |
2489 | |
2490 | +import dk.aau.cs.debug.Logger; |
2491 | +import dk.aau.cs.gui.components.StatisticsPanel; |
2492 | +import dk.aau.cs.gui.undo.Command; |
2493 | +import dk.aau.cs.gui.undo.DeleteQueriesCommand; |
2494 | +import dk.aau.cs.io.*; |
2495 | +import dk.aau.cs.io.queries.SUMOQueryLoader; |
2496 | +import dk.aau.cs.io.queries.XMLQueryLoader; |
2497 | +import dk.aau.cs.model.tapn.*; |
2498 | +import net.tapaal.gui.DrawingSurfaceManager.AbstractDrawingSurfaceManager; |
2499 | +import net.tapaal.helpers.Reference.MutableReference; |
2500 | +import net.tapaal.helpers.Reference.Reference; |
2501 | import org.jdesktop.swingx.MultiSplitLayout.Divider; |
2502 | import org.jdesktop.swingx.MultiSplitLayout.Leaf; |
2503 | import org.jdesktop.swingx.MultiSplitLayout.Split; |
2504 | |
2505 | -import pipe.dataLayer.DataLayer; |
2506 | -import pipe.dataLayer.NetType; |
2507 | +import pipe.dataLayer.*; |
2508 | import pipe.dataLayer.TAPNQuery; |
2509 | -import pipe.dataLayer.Template; |
2510 | -import pipe.gui.AnimationController; |
2511 | -import pipe.gui.AnimationHistoryComponent; |
2512 | -import pipe.gui.Animator; |
2513 | -import pipe.gui.DelayEnabledTransitionControl; |
2514 | -import pipe.gui.CreateGui; |
2515 | -import pipe.gui.DrawingSurfaceImpl; |
2516 | -import pipe.gui.Zoomer; |
2517 | +import pipe.gui.*; |
2518 | +import pipe.gui.canvas.DrawingSurfaceImpl; |
2519 | +import pipe.gui.graphicElements.*; |
2520 | +import pipe.gui.graphicElements.tapn.TimedPlaceComponent; |
2521 | +import pipe.gui.graphicElements.tapn.TimedTransitionComponent; |
2522 | +import pipe.gui.handler.PlaceTransitionObjectHandler; |
2523 | +import pipe.gui.undo.ChangeSpacingEdit; |
2524 | +import pipe.gui.undo.UndoManager; |
2525 | import pipe.gui.widgets.ConstantsPane; |
2526 | -import pipe.gui.widgets.JSplitPaneFix; |
2527 | +import net.tapaal.swinghelpers.JSplitPaneFix; |
2528 | import pipe.gui.widgets.QueryPane; |
2529 | import pipe.gui.widgets.WorkflowDialog; |
2530 | import dk.aau.cs.gui.components.BugHandledJXMultisplitPane; |
2531 | import dk.aau.cs.gui.components.TransitionFireingComponent; |
2532 | -import dk.aau.cs.model.tapn.Constant; |
2533 | -import dk.aau.cs.model.tapn.TimedArcPetriNet; |
2534 | -import dk.aau.cs.model.tapn.TimedArcPetriNetNetwork; |
2535 | import dk.aau.cs.util.Require; |
2536 | +import pipe.gui.widgets.filebrowser.FileBrowser; |
2537 | |
2538 | -public class TabContent extends JSplitPane { |
2539 | +public class TabContent extends JSplitPane implements TabContentActions{ |
2540 | private static final long serialVersionUID = -648006317150905097L; |
2541 | |
2542 | + //Model and state |
2543 | private TimedArcPetriNetNetwork tapnNetwork = new TimedArcPetriNetNetwork(); |
2544 | private HashMap<TimedArcPetriNet, DataLayer> guiModels = new HashMap<TimedArcPetriNet, DataLayer>(); |
2545 | private HashMap<TimedArcPetriNet, Zoomer> zoomLevels = new HashMap<TimedArcPetriNet, Zoomer>(); |
2546 | + |
2547 | + |
2548 | + private UndoManager undoManager = new UndoManager(); |
2549 | + |
2550 | + /** |
2551 | + * Creates a new tab with the selected file, or a new file if filename==null |
2552 | + * @throws Exception |
2553 | + */ |
2554 | + public static TabContent createNewTabFromInputStream(InputStream file, String name) throws Exception { |
2555 | + TabContent tab = new TabContent(NetType.TAPN); |
2556 | + tab.setInitialName(name); |
2557 | + |
2558 | + try { |
2559 | + ModelLoader loader = new ModelLoader(); |
2560 | + LoadedModel loadedModel = loader.load(file); |
2561 | + |
2562 | + tab.setNetwork(loadedModel.network(), loadedModel.templates()); |
2563 | + tab.setQueries(loadedModel.queries()); |
2564 | + tab.setConstants(loadedModel.network().constants()); |
2565 | + |
2566 | + tab.selectFirstElements(); |
2567 | + |
2568 | + tab.setFile(null); |
2569 | + } catch (Exception e) { |
2570 | + throw new Exception("TAPAAL encountered an error while loading the file: " + name + "\n\nPossible explanations:\n - " + e.toString()); |
2571 | + } |
2572 | + |
2573 | + return tab; |
2574 | + } |
2575 | + |
2576 | + public static TabContent createNewEmptyTab(String name, NetType netType){ |
2577 | + TabContent tab = new TabContent(NetType.TAPN); |
2578 | + tab.setInitialName(name); |
2579 | + |
2580 | + //Set Default Template |
2581 | + String templateName = tab.drawingSurface().getNameGenerator().getNewTemplateName(); |
2582 | + Template template = new Template(new TimedArcPetriNet(templateName), new DataLayer(), new Zoomer()); |
2583 | + tab.addTemplate(template, false); |
2584 | + |
2585 | + return tab; |
2586 | + } |
2587 | + |
2588 | + /** |
2589 | + * Creates a new tab with the selected file, or a new file if filename==null |
2590 | + * @throws Exception |
2591 | + */ |
2592 | + |
2593 | + public static TabContent createNewTabFromPNMLFile(File file) throws Exception { |
2594 | + TabContent tab = new TabContent(NetType.TAPN); |
2595 | + |
2596 | + String name = null; |
2597 | + |
2598 | + if (file != null) { |
2599 | + name = file.getName().replaceAll(".pnml", ".tapn"); |
2600 | + } |
2601 | + tab.setInitialName(name); |
2602 | + |
2603 | + if (file != null) { |
2604 | + try { |
2605 | + |
2606 | + LoadedModel loadedModel; |
2607 | + |
2608 | + PNMLoader loader = new PNMLoader(); |
2609 | + loadedModel = loader.load(file); |
2610 | + |
2611 | + |
2612 | + tab.setNetwork(loadedModel.network(), loadedModel.templates()); |
2613 | + tab.setQueries(loadedModel.queries()); |
2614 | + tab.setConstants(loadedModel.network().constants()); |
2615 | + |
2616 | + tab.selectFirstElements(); |
2617 | + |
2618 | + tab.setMode(Pipe.ElementType.SELECT); |
2619 | + |
2620 | + |
2621 | + } catch (Exception e) { |
2622 | + throw new Exception("TAPAAL encountered an error while loading the file: " + file.getName() + "\n\nPossible explanations:\n - " + e.toString()); |
2623 | + } |
2624 | + } |
2625 | + |
2626 | + //appView.updatePreferredSize(); //XXX 2018-05-23 kyrke seems not to be needed |
2627 | + name = name.replace(".pnml",".tapn"); // rename .pnml input file to .tapn |
2628 | + return tab; |
2629 | + } |
2630 | + |
2631 | + /** |
2632 | + * Creates a new tab with the selected file, or a new file if filename==null |
2633 | + * @throws FileNotFoundException |
2634 | + */ |
2635 | + //XXX should properly be in controller? |
2636 | + public static TabContent createNewTabFromFile(File file) throws Exception { |
2637 | + try { |
2638 | + String name = file.getName(); |
2639 | + boolean showFileEndingChangedMessage = false; |
2640 | + |
2641 | + if(name.toLowerCase().endsWith(".xml")){ |
2642 | + name = name.substring(0, name.lastIndexOf('.')) + ".tapn"; |
2643 | + showFileEndingChangedMessage = true; |
2644 | + } |
2645 | + |
2646 | + InputStream stream = new FileInputStream(file); |
2647 | + TabContent tab = createNewTabFromInputStream(stream, name); |
2648 | + if (tab != null && !showFileEndingChangedMessage) tab.setFile(file); |
2649 | + |
2650 | + showFileEndingChangedMessage(showFileEndingChangedMessage); |
2651 | + |
2652 | + return tab; |
2653 | + }catch (FileNotFoundException e) { |
2654 | + throw new FileNotFoundException("TAPAAL encountered an error while loading the file: " + file.getName() + "\n\nFile not found:\n - " + e.toString()); |
2655 | + } |
2656 | + } |
2657 | + |
2658 | + private static void showFileEndingChangedMessage(boolean showMessage) { |
2659 | + if(showMessage) { |
2660 | + //We thread this so it does not block the EDT |
2661 | + new Thread(new Runnable() { |
2662 | + @Override |
2663 | + public void run() { |
2664 | + CreateGui.getAppGui().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
2665 | + new MessengerImpl().displayInfoMessage("We have changed the ending of TAPAAL files from .xml to .tapn and the opened file was automatically renamed to end with .tapn.\n" |
2666 | + + "Once you save the .tapn model, we recommend that you manually delete the .xml file.", "FILE CHANGED"); |
2667 | + } |
2668 | + }).start(); |
2669 | + } |
2670 | + } |
2671 | + |
2672 | + public UndoManager getUndoManager() { |
2673 | + return undoManager; |
2674 | + } |
2675 | + |
2676 | + //GUI |
2677 | + |
2678 | private HashMap<TimedArcPetriNet, Boolean> hasPositionalInfos = new HashMap<TimedArcPetriNet, Boolean>(); |
2679 | + |
2680 | private JScrollPane drawingSurfaceScroller; |
2681 | private JScrollPane editorSplitPaneScroller; |
2682 | private JScrollPane animatorSplitPaneScroller; |
2683 | @@ -77,11 +210,11 @@ |
2684 | private static final String sharedPTName = "sharedPT"; |
2685 | |
2686 | // / Animation |
2687 | - private AnimationHistoryComponent animBox; |
2688 | + private AnimationHistoryComponent<String> animBox; |
2689 | private AnimationController animControlerBox; |
2690 | private JScrollPane animationHistoryScrollPane; |
2691 | private JScrollPane animationControllerScrollPane; |
2692 | - private AnimationHistoryComponent abstractAnimationPane = null; |
2693 | + private AnimationHistoryComponent<String> abstractAnimationPane = null; |
2694 | private JPanel animationControlsPanel; |
2695 | private TransitionFireingComponent transitionFireing; |
2696 | |
2697 | @@ -104,7 +237,7 @@ |
2698 | hasPositionalInfos.put(net, new Boolean(false)); |
2699 | } |
2700 | |
2701 | - drawingSurface = new DrawingSurfaceImpl(new DataLayer()); |
2702 | + drawingSurface = new DrawingSurfaceImpl(new DataLayer(), this, managerRef); |
2703 | drawingSurfaceScroller = new JScrollPane(drawingSurface); |
2704 | // make it less bad on XP |
2705 | drawingSurfaceScroller.setBorder(new BevelBorder(BevelBorder.LOWERED)); |
2706 | @@ -137,7 +270,9 @@ |
2707 | this.setContinuousLayout(true); |
2708 | this.setOneTouchExpandable(true); |
2709 | this.setBorder(null); // avoid multiple borders |
2710 | - this.setDividerSize(8); |
2711 | + this.setDividerSize(8); |
2712 | + //XXX must be after the animationcontroller is created |
2713 | + animationModeController = new CanvasAnimationController(getAnimator(), getAnimationController()); |
2714 | } |
2715 | |
2716 | public SharedPlacesAndTransitionsPanel getSharedPlacesAndTransitionsPanel(){ |
2717 | @@ -272,12 +407,37 @@ |
2718 | this.drawingSurface = drawingSurface; |
2719 | } |
2720 | |
2721 | + |
2722 | + //XXX this is a temp solution while refactoring |
2723 | + // to keep the name of the net when the when a file is not set. |
2724 | + String initialName; |
2725 | + public void setInitialName(String name) { |
2726 | + if (name == null || name.isEmpty()) { |
2727 | + name = "New Petri net " + (CreateGui.getApp().getNameCounter()) + ".tapn"; |
2728 | + CreateGui.getApp().incrementNameCounter(); |
2729 | + } else if (!name.toLowerCase().endsWith(".tapn")){ |
2730 | + name = name + ".tapn"; |
2731 | + } |
2732 | + this.initialName = name; |
2733 | + |
2734 | + safeApp.ifPresent(tab -> tab.updatedTabName(this)); |
2735 | + } |
2736 | + public String getTabTitle() { |
2737 | + if (getFile()!=null) { |
2738 | + return getFile().getName(); |
2739 | + } else { |
2740 | + return initialName; |
2741 | + } |
2742 | + } |
2743 | + |
2744 | + @Override |
2745 | public File getFile() { |
2746 | return appFile; |
2747 | } |
2748 | |
2749 | public void setFile(File file) { |
2750 | appFile = file; |
2751 | + safeApp.ifPresent(tab -> tab.updatedTabName(this)); |
2752 | } |
2753 | |
2754 | /** Creates a new animationHistory text area, and returns a reference to it */ |
2755 | @@ -296,15 +456,13 @@ |
2756 | for (int i = 0; i < Math.abs(steps); i++) { |
2757 | animBox.stepBackwards(); |
2758 | anim.stepBack(); |
2759 | - CreateGui.getCurrentTab().getAnimationController() |
2760 | - .setAnimationButtonsEnabled(); |
2761 | + getAnimationController().setAnimationButtonsEnabled(); |
2762 | } |
2763 | } else { |
2764 | for (int i = 0; i < Math.abs(steps); i++) { |
2765 | animBox.stepForward(); |
2766 | anim.stepForward(); |
2767 | - CreateGui.getCurrentTab().getAnimationController() |
2768 | - .setAnimationButtonsEnabled(); |
2769 | + getAnimationController().setAnimationButtonsEnabled(); |
2770 | } |
2771 | } |
2772 | |
2773 | @@ -325,12 +483,15 @@ |
2774 | } |
2775 | |
2776 | private void createAnimatorSplitPane(NetType netType) { |
2777 | - if (animBox == null) |
2778 | - createAnimationHistory(); |
2779 | - if (animControlerBox == null) |
2780 | - createAnimationController(netType); |
2781 | - if (transitionFireing == null) |
2782 | - createTransitionFireing(); |
2783 | + if (animBox == null) { |
2784 | + createAnimationHistory(); |
2785 | + } |
2786 | + if (animControlerBox == null) { |
2787 | + createAnimationController(netType); |
2788 | + } |
2789 | + if (transitionFireing == null) { |
2790 | + createTransitionFireing(); |
2791 | + } |
2792 | |
2793 | boolean floatingDividers = false; |
2794 | if(simulatorModelRoot == null){ |
2795 | @@ -342,14 +503,20 @@ |
2796 | enabledTransitionsListLeaf.setWeight(0.25); |
2797 | animControlLeaf.setWeight(0.5); |
2798 | |
2799 | - simulatorModelRoot = new Split(templateExplorerLeaf, new Divider(), |
2800 | - enabledTransitionsListLeaf, new Divider(), animControlLeaf); |
2801 | + simulatorModelRoot = new Split( |
2802 | + templateExplorerLeaf, |
2803 | + new Divider(), |
2804 | + enabledTransitionsListLeaf, |
2805 | + new Divider(), |
2806 | + animControlLeaf |
2807 | + ); |
2808 | simulatorModelRoot.setRowLayout(false); |
2809 | floatingDividers = true; |
2810 | } |
2811 | animatorSplitPane = new BugHandledJXMultisplitPane(); |
2812 | - |
2813 | animatorSplitPane.getMultiSplitLayout().setFloatingDividers(floatingDividers); |
2814 | + animatorSplitPane.getMultiSplitLayout().setLayoutByWeight(false); |
2815 | + |
2816 | animatorSplitPane.setSize(simulatorModelRoot.getBounds().width, simulatorModelRoot.getBounds().height); |
2817 | |
2818 | animatorSplitPane.getMultiSplitLayout().setModel(simulatorModelRoot); |
2819 | @@ -371,16 +538,29 @@ |
2820 | gbc.weighty = 1.0; |
2821 | animationControlsPanel.add(animationHistoryScrollPane, gbc); |
2822 | |
2823 | - animationControlsPanel.setPreferredSize(new Dimension( |
2824 | + animationControlsPanel.setPreferredSize( |
2825 | + new Dimension( |
2826 | animationControlsPanel.getPreferredSize().width, |
2827 | - animationControlsPanel.getMinimumSize().height)); |
2828 | - transitionFireing.setPreferredSize(new Dimension( |
2829 | + animationControlsPanel.getMinimumSize().height |
2830 | + ) |
2831 | + ); |
2832 | + transitionFireing.setPreferredSize( |
2833 | + new Dimension( |
2834 | transitionFireing.getPreferredSize().width, |
2835 | - transitionFireing.getMinimumSize().height)); |
2836 | + transitionFireing.getMinimumSize().height |
2837 | + ) |
2838 | + ); |
2839 | + |
2840 | + JButton dummy = new JButton("AnimatorDummy"); |
2841 | + dummy.setMinimumSize(templateExplorer.getMinimumSize()); |
2842 | + dummy.setPreferredSize(templateExplorer.getPreferredSize()); |
2843 | + animatorSplitPane.add(new JPanel(), templateExplorerName); |
2844 | + |
2845 | animatorSplitPane.add(animationControlsPanel, animControlName); |
2846 | animatorSplitPane.add(transitionFireing, transitionFireingName); |
2847 | |
2848 | animatorSplitPaneScroller = createLeftScrollPane(animatorSplitPane); |
2849 | + animatorSplitPane.repaint(); |
2850 | } |
2851 | |
2852 | public void switchToAnimationComponents(boolean showEnabledTransitions) { |
2853 | @@ -390,7 +570,7 @@ |
2854 | if(dummy != null){ |
2855 | animatorSplitPane.remove(dummy); |
2856 | } |
2857 | - |
2858 | + |
2859 | //Add the templateExplorer |
2860 | animatorSplitPane.add(templateExplorer, templateExplorerName); |
2861 | |
2862 | @@ -425,15 +605,15 @@ |
2863 | dummy = new JButton("AnimatorDummy"); |
2864 | dummy.setMinimumSize(templateExplorer.getMinimumSize()); |
2865 | dummy.setPreferredSize(templateExplorer.getPreferredSize()); |
2866 | - animatorSplitPane.add(new JPanel(), templateExplorerName); |
2867 | + animatorSplitPane.add(dummy, templateExplorerName); |
2868 | } |
2869 | |
2870 | templateExplorer.switchToEditorMode(); |
2871 | this.setLeftComponent(editorSplitPaneScroller); |
2872 | - drawingSurface.repaintAll(); |
2873 | + //drawingSurface.repaintAll(); |
2874 | } |
2875 | |
2876 | - public AnimationHistoryComponent getUntimedAnimationHistory() { |
2877 | + public AnimationHistoryComponent<String> getUntimedAnimationHistory() { |
2878 | return abstractAnimationPane; |
2879 | } |
2880 | |
2881 | @@ -449,15 +629,18 @@ |
2882 | animationControlsPanel.remove(animationHistoryScrollPane); |
2883 | abstractAnimationPane = new AnimationHistoryComponent(); |
2884 | |
2885 | - JScrollPane untimedAnimationHistoryScrollPane = new JScrollPane( |
2886 | - abstractAnimationPane); |
2887 | - untimedAnimationHistoryScrollPane.setBorder(BorderFactory |
2888 | - .createCompoundBorder( |
2889 | + JScrollPane untimedAnimationHistoryScrollPane = new JScrollPane(abstractAnimationPane); |
2890 | + untimedAnimationHistoryScrollPane.setBorder( |
2891 | + BorderFactory.createCompoundBorder( |
2892 | BorderFactory.createTitledBorder("Untimed Trace"), |
2893 | - BorderFactory.createEmptyBorder(3, 3, 3, 3))); |
2894 | + BorderFactory.createEmptyBorder(3, 3, 3, 3) |
2895 | + ) |
2896 | + ); |
2897 | animationHistorySplitter = new JSplitPaneFix( |
2898 | - JSplitPane.HORIZONTAL_SPLIT, animationHistoryScrollPane, |
2899 | - untimedAnimationHistoryScrollPane); |
2900 | + JSplitPane.HORIZONTAL_SPLIT, |
2901 | + animationHistoryScrollPane, |
2902 | + untimedAnimationHistoryScrollPane |
2903 | + ); |
2904 | |
2905 | animationHistorySplitter.setContinuousLayout(true); |
2906 | animationHistorySplitter.setOneTouchExpandable(true); |
2907 | @@ -496,7 +679,7 @@ |
2908 | animControlerBox.requestFocus(true); |
2909 | } |
2910 | |
2911 | - public AnimationHistoryComponent getAnimationHistory() { |
2912 | + public AnimationHistoryComponent<String> getAnimationHistory() { |
2913 | return animBox; |
2914 | } |
2915 | |
2916 | @@ -543,8 +726,9 @@ |
2917 | public int numberOfActiveTemplates() { |
2918 | int count = 0; |
2919 | for (TimedArcPetriNet net : tapnNetwork.activeTemplates()) { |
2920 | - if (net.isActive()) |
2921 | - count++; |
2922 | + if (net.isActive()) { |
2923 | + count++; |
2924 | + } |
2925 | } |
2926 | return count; |
2927 | } |
2928 | @@ -586,11 +770,6 @@ |
2929 | return templateExplorer.selectedModel(); |
2930 | } |
2931 | |
2932 | - public void setCurrentTemplate(Template template) { |
2933 | - drawingSurface.setModel(template.guiModel(), template.model(), |
2934 | - template.zoomer()); |
2935 | - } |
2936 | - |
2937 | public Iterable<TAPNQuery> queries() { |
2938 | return queries.getQueries(); |
2939 | } |
2940 | @@ -611,12 +790,7 @@ |
2941 | tapnNetwork.setConstants(constants); |
2942 | } |
2943 | |
2944 | - public void setupNameGeneratorsFromTemplates(Iterable<Template> templates) { |
2945 | - drawingSurface.setupNameGeneratorsFromTemplates(templates); |
2946 | - } |
2947 | - |
2948 | - public void setNetwork(TimedArcPetriNetNetwork network, |
2949 | - Collection<Template> templates) { |
2950 | + public void setNetwork(TimedArcPetriNetNetwork network, Collection<Template> templates) { |
2951 | Require.that(network != null, "network cannot be null"); |
2952 | tapnNetwork = network; |
2953 | |
2954 | @@ -666,10 +840,10 @@ |
2955 | |
2956 | public void showComponents(boolean enable) { |
2957 | if (enable != templateExplorer.isVisible()) { |
2958 | - editorSplitPane.getMultiSplitLayout().displayNode( |
2959 | - templateExplorerName, enable); |
2960 | - editorSplitPane.getMultiSplitLayout().displayNode(sharedPTName, |
2961 | - enable); |
2962 | + |
2963 | + editorSplitPane.getMultiSplitLayout().displayNode(templateExplorerName, enable); |
2964 | + editorSplitPane.getMultiSplitLayout().displayNode(sharedPTName, enable); |
2965 | + |
2966 | if (animatorSplitPane != null) { |
2967 | animatorSplitPane.getMultiSplitLayout().displayNode( |
2968 | templateExplorerName, enable); |
2969 | @@ -680,25 +854,30 @@ |
2970 | |
2971 | public void showQueries(boolean enable) { |
2972 | if (enable != queries.isVisible()) { |
2973 | - editorSplitPane.getMultiSplitLayout().displayNode(queriesName, |
2974 | - enable); |
2975 | + editorSplitPane.getMultiSplitLayout().displayNode(queriesName, enable); |
2976 | makeSureEditorPanelIsVisible(queries); |
2977 | this.repaint(); |
2978 | } |
2979 | } |
2980 | |
2981 | - public void showConstantsPanel(boolean enable) { |
2982 | + //XXX not sure about this |
2983 | + @Override |
2984 | + public void repaintAll() { |
2985 | + drawingSurface().repaintAll(); |
2986 | + } |
2987 | + |
2988 | + public void showConstantsPanel(boolean enable) { |
2989 | if (enable != constantsPanel.isVisible()) { |
2990 | - editorSplitPane.getMultiSplitLayout().displayNode(constantsName, |
2991 | - enable); |
2992 | + editorSplitPane.getMultiSplitLayout().displayNode(constantsName, enable); |
2993 | makeSureEditorPanelIsVisible(constantsPanel); |
2994 | } |
2995 | } |
2996 | |
2997 | public void showEnabledTransitionsList(boolean enable) { |
2998 | - if (transitionFireing != null && !(enable && transitionFireing.isVisible())) { |
2999 | - animatorSplitPane.getMultiSplitLayout().displayNode( |
3000 | - transitionFireingName, enable); |
3001 | + //displayNode fires and relayout, so we check of value is changed |
3002 | + // else elements will be set to default size. |
3003 | + if (transitionFireing.isVisible() != enable) { |
3004 | + animatorSplitPane.getMultiSplitLayout().displayNode(transitionFireingName, enable); |
3005 | } |
3006 | } |
3007 | |
3008 | @@ -718,11 +897,41 @@ |
3009 | public boolean isQueryPossible() { |
3010 | return queries.isQueryPossible(); |
3011 | } |
3012 | - |
3013 | + |
3014 | + @Override |
3015 | public void verifySelectedQuery() { |
3016 | queries.verifySelectedQuery(); |
3017 | } |
3018 | - |
3019 | + |
3020 | + @Override |
3021 | + public void previousComponent() { |
3022 | + getTemplateExplorer().selectPrevious(); |
3023 | + } |
3024 | + |
3025 | + @Override |
3026 | + public void nextComponent() { |
3027 | + getTemplateExplorer().selectNext(); |
3028 | + } |
3029 | + |
3030 | + @Override |
3031 | + public void exportTrace() { |
3032 | + TraceImportExport.exportTrace(); |
3033 | + } |
3034 | + |
3035 | + @Override |
3036 | + public void importTrace() { |
3037 | + TraceImportExport.importTrace(); |
3038 | + } |
3039 | + |
3040 | + @Override |
3041 | + public void zoomTo(int newZoomLevel) { |
3042 | + boolean didZoom = drawingSurface().getZoomController().setZoom(newZoomLevel); |
3043 | + if (didZoom) { |
3044 | + app.ifPresent(GuiFrameActions::updateZoomCombo); |
3045 | + drawingSurface().zoomToMidPoint(); //Do Zoom |
3046 | + } |
3047 | + } |
3048 | + |
3049 | public void editSelectedQuery(){ |
3050 | queries.showEditDialog(); |
3051 | } |
3052 | @@ -776,4 +985,550 @@ |
3053 | public void setWorkflowDialog(WorkflowDialog dialog) { |
3054 | this.workflowDialog = dialog; |
3055 | } |
3056 | + |
3057 | + private boolean netChanged = false; |
3058 | + @Override |
3059 | + public boolean getNetChanged() { |
3060 | + return netChanged; |
3061 | + } |
3062 | + |
3063 | + public void setNetChanged(boolean _netChanged) { |
3064 | + netChanged = _netChanged; |
3065 | + } |
3066 | + |
3067 | + public void changeToTemplate(Template tapn) { |
3068 | + Require.notNull(tapn, "Can't change to a Template that is null"); |
3069 | + |
3070 | + drawingSurface.setModel(tapn.guiModel(), tapn.model(), tapn.zoomer()); |
3071 | + |
3072 | + //If the template is currently selected |
3073 | + //XXX: kyrke - 2019-07-06, templ solution while refactoring, there is properly a better way |
3074 | + if (CreateGui.getCurrentTab() == this) { |
3075 | + |
3076 | + app.ifPresent(GuiFrameActions::updateZoomCombo); |
3077 | + |
3078 | + //XXX: moved from drawingsurface, temp while refactoring, there is a better way |
3079 | + drawingSurface.getSelectionObject().clearSelection(); |
3080 | + |
3081 | + } |
3082 | + } |
3083 | + |
3084 | + |
3085 | + //Animation mode stuff, moved from view |
3086 | + //XXX: kyrke -2019-07-06, temp solution while refactoring there is properly a better place |
3087 | + private boolean animationmode = false; |
3088 | + public void setAnimationMode(boolean on) { |
3089 | + if (animationmode != on) { |
3090 | + toggleAnimationMode(); |
3091 | + } |
3092 | + } |
3093 | + @Override |
3094 | + public void toggleAnimationMode() { |
3095 | + |
3096 | + if (!animationmode) { |
3097 | + if (numberOfActiveTemplates() > 0) { |
3098 | + CreateGui.getApp().setGUIMode(GuiFrame.GUIMode.animation); |
3099 | + |
3100 | + setManager(animationModeController); |
3101 | + |
3102 | + drawingSurface().repaintAll(); |
3103 | + |
3104 | + rememberSelectedTemplate(); |
3105 | + if (currentTemplate().isActive()){ |
3106 | + setSelectedTemplateWasActive(); |
3107 | + } |
3108 | + |
3109 | + getAnimator().reset(false); |
3110 | + getAnimator().storeModel(); |
3111 | + getAnimator().highlightEnabledTransitions(); |
3112 | + getAnimator().reportBlockingPlaces(); |
3113 | + getAnimator().setFiringmode("Random"); |
3114 | + |
3115 | + // Set a light blue backgound color for animation mode |
3116 | + drawingSurface().setBackground(Pipe.ANIMATION_BACKGROUND_COLOR); |
3117 | + getAnimationController().requestFocusInWindow(); |
3118 | + |
3119 | + if (templateWasActiveBeforeSimulationMode()) { |
3120 | + restoreSelectedTemplate(); |
3121 | + resetSelectedTemplateWasActive(); |
3122 | + } |
3123 | + else { |
3124 | + selectFirstActiveTemplate(); |
3125 | + } |
3126 | + drawingSurface().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
3127 | + |
3128 | + animationmode = true; //XXX: Must be called after setGuiMode as guiMode uses last state, |
3129 | + } else { |
3130 | + JOptionPane.showMessageDialog(CreateGui.getApp(), |
3131 | + "You need at least one active template to enter simulation mode", |
3132 | + "Simulation Mode Error", JOptionPane.ERROR_MESSAGE); |
3133 | + animationmode = false; |
3134 | + CreateGui.getApp().setGUIMode(GuiFrame.GUIMode.draw); |
3135 | + } |
3136 | + } else { |
3137 | + drawingSurface().getSelectionObject().clearSelection(); |
3138 | + CreateGui.getApp().setGUIMode(GuiFrame.GUIMode.draw); |
3139 | + setManager(notingManager); |
3140 | + |
3141 | + drawingSurface().setBackground(Pipe.ELEMENT_FILL_COLOUR); |
3142 | + setMode(Pipe.ElementType.SELECT); |
3143 | + |
3144 | + restoreSelectedTemplate(); |
3145 | + |
3146 | + // Undo/Redo is enabled based on undo/redo manager |
3147 | + getUndoManager().setUndoRedoStatus(); |
3148 | + animationmode = false; |
3149 | + } |
3150 | + animControlerBox.setAnimationButtonsEnabled(); //Update stepBack/Forward |
3151 | + } |
3152 | + |
3153 | + //XXX temp while refactoring, kyrke - 2019-07-25 |
3154 | + @Override |
3155 | + public void setMode(Pipe.ElementType mode) { |
3156 | + |
3157 | + app.ifPresent(o->o.updateMode(mode)); |
3158 | + |
3159 | + //Disable selection and deselect current selection |
3160 | + drawingSurface().getSelectionObject().clearSelection(); |
3161 | + |
3162 | + //If pending arc draw, remove it |
3163 | + if (drawingSurface().createArc != null) { |
3164 | + PlaceTransitionObjectHandler.cleanupArc(drawingSurface().createArc, drawingSurface()); |
3165 | + } |
3166 | + |
3167 | + if (mode == Pipe.ElementType.SELECT) { |
3168 | + drawingSurface().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
3169 | + } else if (mode == Pipe.ElementType.DRAG) { |
3170 | + drawingSurface().setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); |
3171 | + } else { |
3172 | + drawingSurface().setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); |
3173 | + } |
3174 | + } |
3175 | + |
3176 | + @Override |
3177 | + public void showStatistics() { |
3178 | + StatisticsPanel.showStatisticsPanel(drawingSurface().getModel().getStatistics()); |
3179 | + } |
3180 | + |
3181 | + @Override |
3182 | + public void importSUMOQueries() { |
3183 | + File[] files = FileBrowser.constructor("Import SUMO", "txt", FileBrowser.userPath).openFiles(); |
3184 | + for(File f : files){ |
3185 | + if(f.exists() && f.isFile() && f.canRead()){ |
3186 | + FileBrowser.userPath = f.getParent(); |
3187 | + SUMOQueryLoader.importQueries(f, network()); |
3188 | + } |
3189 | + } |
3190 | + } |
3191 | + |
3192 | + @Override |
3193 | + public void importXMLQueries() { |
3194 | + File[] files = FileBrowser.constructor("Import XML queries", "xml", FileBrowser.userPath).openFiles(); |
3195 | + for(File f : files){ |
3196 | + if(f.exists() && f.isFile() && f.canRead()){ |
3197 | + FileBrowser.userPath = f.getParent(); |
3198 | + XMLQueryLoader.importQueries(f, network()); |
3199 | + } |
3200 | + } |
3201 | + } |
3202 | + |
3203 | + @Override |
3204 | + public void workflowAnalyse() { |
3205 | + //XXX prop. should take this as argument, insted of using static accessors //kyrke 2019-11-05 |
3206 | + WorkflowDialog.showDialog(); |
3207 | + } |
3208 | + |
3209 | + public boolean isInAnimationMode() { |
3210 | + return animationmode; |
3211 | + } |
3212 | + |
3213 | + public Animator getAnimator() { |
3214 | + return animator; |
3215 | + } |
3216 | + |
3217 | + private Animator animator = new Animator(this); |
3218 | + |
3219 | + /* GUI Model / Actions helpers */ |
3220 | + //XXX: Should be moved to animationController or similar |
3221 | + /** |
3222 | + * Updates the mouseOver label showing token ages in animationmode |
3223 | + * when a "animation" action is happening. "live updates" any mouseOver label |
3224 | + */ |
3225 | + private void updateMouseOverInformation() { |
3226 | + // update mouseOverView |
3227 | + for (pipe.gui.graphicElements.Place p : getModel().getPlaces()) { |
3228 | + if (((TimedPlaceComponent) p).isAgeOfTokensShown()) { |
3229 | + ((TimedPlaceComponent) p).showAgeOfTokens(true); |
3230 | + } |
3231 | + } |
3232 | + |
3233 | + } |
3234 | + |
3235 | + /* GUI Model / Actions */ |
3236 | + |
3237 | + Optional<GuiFrameActions> app = Optional.empty(); |
3238 | + MutableReference<SafeGuiFrameActions> safeApp = new MutableReference<>(); |
3239 | + @Override |
3240 | + public void setApp(GuiFrameActions newApp) { |
3241 | + this.app = Optional.ofNullable(newApp); |
3242 | + undoManager.setApp(newApp); |
3243 | + |
3244 | + //XXX |
3245 | + if (isInAnimationMode()) { |
3246 | + app.ifPresent(o->o.setGUIMode(GuiFrame.GUIMode.animation)); |
3247 | + animControlerBox.setAnimationButtonsEnabled(); //Update stepBack/Forward |
3248 | + } else { |
3249 | + app.ifPresent(o->o.setGUIMode(GuiFrame.GUIMode.draw)); |
3250 | + app.ifPresent(o->setMode(Pipe.ElementType.SELECT)); |
3251 | + } |
3252 | + |
3253 | + } |
3254 | + |
3255 | + @Override |
3256 | + public void setSafeGuiFrameActions(SafeGuiFrameActions ref) { |
3257 | + safeApp.setReference(ref); |
3258 | + } |
3259 | + |
3260 | + @Override |
3261 | + public void zoomOut() { |
3262 | + boolean didZoom = drawingSurface().getZoomController().zoomOut(); |
3263 | + if (didZoom) { |
3264 | + app.ifPresent(GuiFrameActions::updateZoomCombo); |
3265 | + drawingSurface().zoomToMidPoint(); //Do Zoom |
3266 | + } |
3267 | + } |
3268 | + |
3269 | + @Override |
3270 | + public void zoomIn() { |
3271 | + boolean didZoom = drawingSurface().getZoomController().zoomIn(); |
3272 | + if (didZoom) { |
3273 | + app.ifPresent(GuiFrameActions::updateZoomCombo); |
3274 | + drawingSurface().zoomToMidPoint(); //Do Zoom |
3275 | + } |
3276 | + } |
3277 | + |
3278 | + @Override |
3279 | + public void selectAll() { |
3280 | + drawingSurface().getSelectionObject().selectAll(); |
3281 | + } |
3282 | + |
3283 | + @Override |
3284 | + public void deleteSelection() { |
3285 | + // check if queries need to be removed |
3286 | + ArrayList<PetriNetObject> selection = drawingSurface().getSelectionObject().getSelection(); |
3287 | + Iterable<TAPNQuery> queries = queries(); |
3288 | + HashSet<TAPNQuery> queriesToDelete = new HashSet<TAPNQuery>(); |
3289 | + |
3290 | + boolean queriesAffected = false; |
3291 | + for (PetriNetObject pn : selection) { |
3292 | + if (pn instanceof TimedPlaceComponent) { |
3293 | + TimedPlaceComponent place = (TimedPlaceComponent)pn; |
3294 | + if(!place.underlyingPlace().isShared()){ |
3295 | + for (TAPNQuery q : queries) { |
3296 | + if (q.getProperty().containsAtomicPropositionWithSpecificPlaceInTemplate(((LocalTimedPlace)place.underlyingPlace()).model().name(),place.underlyingPlace().name())) { |
3297 | + queriesAffected = true; |
3298 | + queriesToDelete.add(q); |
3299 | + } |
3300 | + } |
3301 | + } |
3302 | + } else if (pn instanceof TimedTransitionComponent){ |
3303 | + TimedTransitionComponent transition = (TimedTransitionComponent)pn; |
3304 | + if(!transition.underlyingTransition().isShared()){ |
3305 | + for (TAPNQuery q : queries) { |
3306 | + if (q.getProperty().containsAtomicPropositionWithSpecificTransitionInTemplate((transition.underlyingTransition()).model().name(),transition.underlyingTransition().name())) { |
3307 | + queriesAffected = true; |
3308 | + queriesToDelete.add(q); |
3309 | + } |
3310 | + } |
3311 | + } |
3312 | + } |
3313 | + } |
3314 | + StringBuilder s = new StringBuilder(); |
3315 | + s.append("The following queries are associated with the currently selected objects:\n\n"); |
3316 | + for (TAPNQuery q : queriesToDelete) { |
3317 | + s.append(q.getName()); |
3318 | + s.append('\n'); |
3319 | + } |
3320 | + s.append("\nAre you sure you want to remove the current selection and all associated queries?"); |
3321 | + |
3322 | + int choice = queriesAffected ? JOptionPane.showConfirmDialog( |
3323 | + CreateGui.getApp(), s.toString(), "Warning", |
3324 | + JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) |
3325 | + : JOptionPane.YES_OPTION; |
3326 | + |
3327 | + if (choice == JOptionPane.YES_OPTION) { |
3328 | + getUndoManager().newEdit(); // new "transaction"" |
3329 | + if (queriesAffected) { |
3330 | + TabContent currentTab = this; |
3331 | + for (TAPNQuery q : queriesToDelete) { |
3332 | + Command cmd = new DeleteQueriesCommand(currentTab, Arrays.asList(q)); |
3333 | + cmd.redo(); |
3334 | + getUndoManager().addEdit(cmd); |
3335 | + } |
3336 | + } |
3337 | + |
3338 | + drawingSurface().deleteSelection(drawingSurface().getSelectionObject().getSelection()); |
3339 | + //getCurrentTab().drawingSurface().repaint(); |
3340 | + network().buildConstraints(); |
3341 | + } |
3342 | + |
3343 | + |
3344 | + } |
3345 | + |
3346 | + @Override |
3347 | + public void stepBackwards() { |
3348 | + getAnimationHistory().stepBackwards(); |
3349 | + getAnimator().stepBack(); |
3350 | + updateMouseOverInformation(); |
3351 | + getAnimationController().setAnimationButtonsEnabled(); |
3352 | + } |
3353 | + |
3354 | + @Override |
3355 | + public void stepForward() { |
3356 | + getAnimationHistory().stepForward(); |
3357 | + getAnimator().stepForward(); |
3358 | + updateMouseOverInformation(); |
3359 | + getAnimationController().setAnimationButtonsEnabled(); |
3360 | + } |
3361 | + |
3362 | + @Override |
3363 | + public void timeDelay() { |
3364 | + getAnimator().letTimePass(BigDecimal.ONE); |
3365 | + getAnimationController().setAnimationButtonsEnabled(); |
3366 | + updateMouseOverInformation(); |
3367 | + } |
3368 | + |
3369 | + @Override |
3370 | + public void delayAndFire() { |
3371 | + getTransitionFireingComponent().fireSelectedTransition(); |
3372 | + getAnimationController().setAnimationButtonsEnabled(); |
3373 | + updateMouseOverInformation(); |
3374 | + } |
3375 | + |
3376 | + @Override |
3377 | + public void undo() { |
3378 | + |
3379 | + if (!isInAnimationMode()) { |
3380 | + |
3381 | + //If arc is being drawn delete it |
3382 | + |
3383 | + if (drawingSurface().createArc == null) { |
3384 | + getUndoManager().undo(); |
3385 | + network().buildConstraints(); |
3386 | + |
3387 | + } else { |
3388 | + |
3389 | + PlaceTransitionObjectHandler.cleanupArc(drawingSurface().createArc, drawingSurface()); |
3390 | + |
3391 | + } |
3392 | + } |
3393 | + |
3394 | + |
3395 | + } |
3396 | + |
3397 | + @Override |
3398 | + public void redo() { |
3399 | + |
3400 | + if (!isInAnimationMode()) { |
3401 | + |
3402 | + //If arc is being drawn delete it |
3403 | + |
3404 | + if (drawingSurface().createArc == null) { |
3405 | + getUndoManager().redo(); |
3406 | + network().buildConstraints(); |
3407 | + |
3408 | + } else { |
3409 | + |
3410 | + PlaceTransitionObjectHandler.cleanupArc(drawingSurface().createArc, drawingSurface()); |
3411 | + |
3412 | + } |
3413 | + } |
3414 | + } |
3415 | + |
3416 | + final AbstractDrawingSurfaceManager notingManager = new AbstractDrawingSurfaceManager(){ |
3417 | + @Override |
3418 | + public void registerEvents() { |
3419 | + //No-thing manager |
3420 | + } |
3421 | + }; |
3422 | + final AbstractDrawingSurfaceManager animationModeController; |
3423 | + |
3424 | + //Writes a tapaal net to a file, with the posibility to overwrite the quires |
3425 | + public void writeNetToFile(File outFile, List<TAPNQuery> queriesOverwrite) { |
3426 | + try { |
3427 | + NetworkMarking currentMarking = null; |
3428 | + if(isInAnimationMode()){ |
3429 | + currentMarking = network().marking(); |
3430 | + network().setMarking(getAnimator().getInitialMarking()); |
3431 | + } |
3432 | + |
3433 | + NetWriter tapnWriter = new TimedArcPetriNetNetworkWriter( |
3434 | + network(), |
3435 | + allTemplates(), |
3436 | + queriesOverwrite, |
3437 | + network().constants() |
3438 | + ); |
3439 | + |
3440 | + tapnWriter.savePNML(outFile); |
3441 | + |
3442 | + if(isInAnimationMode()){ |
3443 | + network().setMarking(currentMarking); |
3444 | + } |
3445 | + } catch (Exception e) { |
3446 | + Logger.log(e); |
3447 | + e.printStackTrace(); |
3448 | + JOptionPane.showMessageDialog(CreateGui.getApp(), e.toString(), |
3449 | + "File Output Error", JOptionPane.ERROR_MESSAGE); |
3450 | + } |
3451 | + } |
3452 | + |
3453 | + public void writeNetToFile(File outFile) { |
3454 | + writeNetToFile(outFile, (List<TAPNQuery>) queries()); |
3455 | + } |
3456 | + |
3457 | + @Override |
3458 | + public void saveNet(File outFile) { |
3459 | + try { |
3460 | + writeNetToFile(outFile); |
3461 | + |
3462 | + setFile(outFile); |
3463 | + |
3464 | + setNetChanged(false); |
3465 | + getUndoManager().clear(); |
3466 | + |
3467 | + } catch (Exception e) { |
3468 | + e.printStackTrace(); |
3469 | + JOptionPane.showMessageDialog(CreateGui.getApp(), e.toString(), "File Output Error", JOptionPane.ERROR_MESSAGE); |
3470 | + } |
3471 | + } |
3472 | + |
3473 | + @Override |
3474 | + public void increaseSpacing() { |
3475 | + double factor = 1.25; |
3476 | + changeSpacing(factor); |
3477 | + getUndoManager().addNewEdit(new ChangeSpacingEdit(factor, this)); |
3478 | + } |
3479 | + |
3480 | + @Override |
3481 | + public void decreaseSpacing() { |
3482 | + double factor = 0.8; |
3483 | + changeSpacing(factor); |
3484 | + getUndoManager().addNewEdit(new ChangeSpacingEdit(factor, this)); |
3485 | + } |
3486 | + |
3487 | + public void changeSpacing(double factor){ |
3488 | + for(PetriNetObject obj : this.currentTemplate().guiModel().getPetriNetObjects()){ |
3489 | + if(obj instanceof PlaceTransitionObject){ |
3490 | + obj.translate((int) (obj.getLocation().x*factor-obj.getLocation().x), (int) (obj.getLocation().y*factor-obj.getLocation().y)); |
3491 | + |
3492 | + if(obj instanceof Transition){ |
3493 | + for(Arc arc : ((PlaceTransitionObject) obj).getPreset()){ |
3494 | + for(ArcPathPoint point : arc.getArcPath().getArcPathPoints()){ |
3495 | + point.setPointLocation((float) Math.max(point.getPoint().x*factor, point.getWidth()), (float) Math.max(point.getPoint().y*factor, point.getHeight())); |
3496 | + } |
3497 | + } |
3498 | + for(Arc arc : ((PlaceTransitionObject) obj).getPostset()){ |
3499 | + for(ArcPathPoint point : arc.getArcPath().getArcPathPoints()){ |
3500 | + point.setPointLocation((float) Math.max(point.getPoint().x*factor, point.getWidth()), (float) Math.max(point.getPoint().y*factor, point.getHeight())); |
3501 | + } |
3502 | + } |
3503 | + } |
3504 | + |
3505 | + ((PlaceTransitionObject) obj).update(true); |
3506 | + }else{ |
3507 | + obj.setLocation((int) (obj.getLocation().x*factor), (int) (obj.getLocation().y*factor)); |
3508 | + } |
3509 | + } |
3510 | + |
3511 | + this.currentTemplate().guiModel().repaintAll(true); |
3512 | + drawingSurface().updatePreferredSize(); |
3513 | + } |
3514 | + |
3515 | + public TabContent duplicateTab() { |
3516 | + NetWriter tapnWriter = new TimedArcPetriNetNetworkWriter( |
3517 | + network(), |
3518 | + allTemplates(), |
3519 | + queries(), |
3520 | + network().constants() |
3521 | + ); |
3522 | + |
3523 | + try { |
3524 | + ByteArrayOutputStream outputStream = tapnWriter.savePNML(); |
3525 | + String composedName = getTabTitle(); |
3526 | + composedName = composedName.replace(".tapn", ""); |
3527 | + composedName += "-untimed"; |
3528 | + return createNewTabFromInputStream(new ByteArrayInputStream(outputStream.toByteArray()), composedName); |
3529 | + } catch (Exception e1) { |
3530 | + e1.printStackTrace(); |
3531 | + System.console().printf(e1.getMessage()); |
3532 | + } |
3533 | + return null; |
3534 | + } |
3535 | + |
3536 | + class CanvasAnimationController extends AbstractDrawingSurfaceManager { |
3537 | + |
3538 | + private final Animator animator; |
3539 | + private final AnimationController animationController; |
3540 | + |
3541 | + public CanvasAnimationController(Animator animator, AnimationController animationController) { |
3542 | + this.animator = animator; |
3543 | + this.animationController = animationController; |
3544 | + } |
3545 | + |
3546 | + @Override |
3547 | + public void registerEvents() { |
3548 | + registerEvent( |
3549 | + e -> e.a == MouseAction.clicked && e.pno instanceof TimedTransitionComponent && SwingUtilities.isLeftMouseButton(e.e), |
3550 | + e -> transitionLeftClicked((TimedTransitionComponent)e.pno) |
3551 | + ); |
3552 | + registerEvent( |
3553 | + e->e.a == MouseAction.entered && e.pno instanceof PlaceTransitionObject, |
3554 | + e->mouseEnterPTO((PlaceTransitionObject)e.pno) |
3555 | + ); |
3556 | + registerEvent( |
3557 | + e->e.a == MouseAction.exited && e.pno instanceof PlaceTransitionObject, |
3558 | + e->mouseExitPTO((PlaceTransitionObject)e.pno) |
3559 | + ); |
3560 | + } |
3561 | + |
3562 | + void transitionLeftClicked(TimedTransitionComponent t) { |
3563 | + TimedTransition transition = t.underlyingTransition(); |
3564 | + |
3565 | + if (transition.isDEnabled()) { |
3566 | + animator.dFireTransition(transition); |
3567 | + animationController.setAnimationButtonsEnabled(); |
3568 | + } |
3569 | + } |
3570 | + |
3571 | + void mouseEnterPTO(PlaceTransitionObject pto) { |
3572 | + if (pto instanceof TimedPlaceComponent) { |
3573 | + ((TimedPlaceComponent) pto).showAgeOfTokens(true); |
3574 | + } else if (pto instanceof TimedTransitionComponent) { |
3575 | + ((TimedTransitionComponent) pto).showDInterval(true); |
3576 | + } |
3577 | + } |
3578 | + void mouseExitPTO(PlaceTransitionObject pto) { |
3579 | + if (pto instanceof TimedPlaceComponent) { |
3580 | + ((TimedPlaceComponent) pto).showAgeOfTokens(false); |
3581 | + } else if (pto instanceof TimedTransitionComponent) { |
3582 | + ((TimedTransitionComponent) pto).showDInterval(false); |
3583 | + } |
3584 | + } |
3585 | + } |
3586 | + |
3587 | + |
3588 | + MutableReference<AbstractDrawingSurfaceManager> managerRef = new MutableReference<>(notingManager); |
3589 | + private void setManager(AbstractDrawingSurfaceManager newManager) { |
3590 | + //De-register old manager |
3591 | + managerRef.get().deregisterManager(); |
3592 | + managerRef.setReference(newManager); |
3593 | + managerRef.get().registerManager(); |
3594 | + } |
3595 | + |
3596 | + //XXX: A quick function made while refactoring to test if the tab is currently |
3597 | + // the tab selected, and is allowed to change gui the gui. Should be controlled an other way |
3598 | + // /kyrke 2019-11-10 |
3599 | + public boolean isTabInFocus(){ |
3600 | + return app.isPresent(); |
3601 | + } |
3602 | } |
3603 | |
3604 | === added file 'src/dk/aau/cs/gui/TabContentActions.java' |
3605 | --- src/dk/aau/cs/gui/TabContentActions.java 1970-01-01 00:00:00 +0000 |
3606 | +++ src/dk/aau/cs/gui/TabContentActions.java 2020-04-28 09:05:34 +0000 |
3607 | @@ -0,0 +1,87 @@ |
3608 | +package dk.aau.cs.gui; |
3609 | + |
3610 | +import pipe.gui.GuiFrameActions; |
3611 | +import pipe.gui.Pipe; |
3612 | +import pipe.gui.SafeGuiFrameActions; |
3613 | + |
3614 | +import java.io.File; |
3615 | + |
3616 | +public interface TabContentActions { |
3617 | + |
3618 | + //public interface UndoRedo { |
3619 | + void undo(); |
3620 | + |
3621 | + void redo(); |
3622 | + //} |
3623 | + |
3624 | + void setApp(GuiFrameActions app); |
3625 | + |
3626 | + void setSafeGuiFrameActions(SafeGuiFrameActions ref); |
3627 | + |
3628 | + void zoomOut(); |
3629 | + |
3630 | + void zoomIn(); |
3631 | + |
3632 | + void selectAll(); |
3633 | + |
3634 | + void deleteSelection(); |
3635 | + |
3636 | + //public interface Animation {} |
3637 | + void stepBackwards(); |
3638 | + |
3639 | + void stepForward(); |
3640 | + |
3641 | + void timeDelay(); |
3642 | + |
3643 | + void delayAndFire(); |
3644 | + |
3645 | + boolean getNetChanged(); |
3646 | + |
3647 | + void toggleAnimationMode(); |
3648 | + |
3649 | + void setMode(Pipe.ElementType mode); |
3650 | + |
3651 | + void showStatistics(); |
3652 | + |
3653 | + void importSUMOQueries(); |
3654 | + |
3655 | + void importXMLQueries(); |
3656 | + |
3657 | + void workflowAnalyse(); |
3658 | + |
3659 | + File getFile(); |
3660 | + |
3661 | + void verifySelectedQuery(); |
3662 | + |
3663 | + void previousComponent(); |
3664 | + |
3665 | + void nextComponent(); |
3666 | + |
3667 | + void exportTrace(); |
3668 | + |
3669 | + void importTrace(); |
3670 | + |
3671 | + void zoomTo(int newZoomLevel); |
3672 | + |
3673 | + String getTabTitle(); |
3674 | + |
3675 | + void saveNet(File outFile); |
3676 | + |
3677 | + void increaseSpacing(); |
3678 | + |
3679 | + void decreaseSpacing(); |
3680 | + |
3681 | + void showQueries(boolean showDelayEnabledTransitions); |
3682 | + |
3683 | + void repaintAll(); |
3684 | + |
3685 | + void showConstantsPanel(boolean showDelayEnabledTransitions); |
3686 | + |
3687 | + void showComponents(boolean showDelayEnabledTransitions); |
3688 | + |
3689 | + void showEnabledTransitionsList(boolean showDelayEnabledTransitions); |
3690 | + |
3691 | + void showDelayEnabledTransitions(boolean showDelayEnabledTransitions); |
3692 | + |
3693 | + void setResizeingDefault(); |
3694 | +} |
3695 | |
3696 | === modified file 'src/dk/aau/cs/gui/TabTransformer.java' |
3697 | --- src/dk/aau/cs/gui/TabTransformer.java 2018-10-18 15:02:41 +0000 |
3698 | +++ src/dk/aau/cs/gui/TabTransformer.java 2020-04-28 09:05:34 +0000 |
3699 | @@ -45,7 +45,7 @@ |
3700 | TimedTransition destination = template.model().getTransitionByName(arc.getTarget().getName()); |
3701 | |
3702 | TimedInputArc addedArc = new TimedInputArc(source, destination, TimeInterval.ZERO_INF, arc.getWeight()); |
3703 | - template.model().add(addedArc); |
3704 | + |
3705 | |
3706 | // GUI |
3707 | DataLayer guiModel = template.guiModel(); |
3708 | @@ -73,53 +73,68 @@ |
3709 | newArc.setArcPath(newArcPath); |
3710 | newArc.updateArcPosition(); |
3711 | guiModel.addPetriNetObject(newArc); |
3712 | - guiSource.addConnectFrom(newArc); |
3713 | - guiTarget.addConnectTo(newArc); |
3714 | - |
3715 | - } |
3716 | - // Output arc |
3717 | - else if(arc.getSource() instanceof Transition){ |
3718 | - TimedPlace destination = template.model().getPlaceByName(arc.getTarget().getName()); |
3719 | - TimedTransition source = template.model().getTransitionByName(arc.getSource().getName()); |
3720 | - |
3721 | - TimedOutputArc addedArc = new TimedOutputArc(source, destination, arc.getWeight()); |
3722 | + |
3723 | + //Change the partner |
3724 | + |
3725 | + TimedOutputArcComponent arc2 = convertPartner(arc.getConnectedTo(), template, guiModel); |
3726 | + removeTransportArc(arc, guiModel); |
3727 | + |
3728 | + //Add arc to model and GUI |
3729 | template.model().add(addedArc); |
3730 | - |
3731 | - // GUI |
3732 | - DataLayer guiModel = template.guiModel(); |
3733 | - Place guiTarget = guiModel.getPlaceByName(arc.getTarget().getName()); |
3734 | - Transition guiSource = guiModel.getTransitionByName(arc.getSource().getName()); |
3735 | - Arc newArc = new TimedOutputArcComponent( |
3736 | - 0d, |
3737 | - 0d, |
3738 | - 0d, |
3739 | - 0d, |
3740 | - guiSource, |
3741 | - guiTarget, |
3742 | - arc.getWeight().value(), |
3743 | - arc.getSource().getName() + "_to_" + arc.getTarget().getName(), |
3744 | - false |
3745 | - ); |
3746 | - |
3747 | - // Build ArcPath |
3748 | - Place oldGuiTarget = guiModel.getPlaceByName(arc.getTarget().getName()); |
3749 | - Transition oldGuiSource = guiModel.getTransitionByName(arc.getSource().getName()); |
3750 | - ArcPath newArcPath = createArcPath(guiModel, oldGuiSource, oldGuiTarget, newArc); |
3751 | - |
3752 | - // Set arcPath, guiModel and connectors |
3753 | - ((TimedOutputArcComponent) newArc).setUnderlyingArc(addedArc); |
3754 | - newArc.setArcPath(newArcPath); |
3755 | - newArc.updateArcPosition(); |
3756 | - guiModel.addPetriNetObject(newArc); |
3757 | - guiSource.addConnectFrom(newArc); |
3758 | - guiTarget.addConnectTo(newArc); |
3759 | - |
3760 | - // Delete the transport arc |
3761 | - arc.delete(); |
3762 | + template.model().add(arc2.underlyingArc()); |
3763 | + |
3764 | } |
3765 | + |
3766 | } |
3767 | } |
3768 | } |
3769 | + static void removeTransportArc(TimedTransportArcComponent arc, DataLayer guiModel){ |
3770 | + // Delete the transport arc |
3771 | + arc.underlyingTransportArc().delete(); |
3772 | + TimedTransportArcComponent partner = arc.getConnectedTo(); |
3773 | + |
3774 | + guiModel.removePetriNetObject(arc); |
3775 | + guiModel.removePetriNetObject(partner); |
3776 | + } |
3777 | + static TimedOutputArcComponent convertPartner(TimedTransportArcComponent arc, Template template, DataLayer guiModel) { |
3778 | + //Add new arc |
3779 | + |
3780 | + TimedPlace destination = template.model().getPlaceByName(arc.getTarget().getName()); |
3781 | + TimedTransition source = template.model().getTransitionByName(arc.getSource().getName()); |
3782 | + |
3783 | + TimedOutputArc addedArc = new TimedOutputArc(source, destination, arc.getWeight()); |
3784 | + //template.model().add(addedArc); |
3785 | + |
3786 | + // GUI |
3787 | + |
3788 | + Place guiTarget = guiModel.getPlaceByName(arc.getTarget().getName()); |
3789 | + Transition guiSource = guiModel.getTransitionByName(arc.getSource().getName()); |
3790 | + TimedOutputArcComponent newArc = new TimedOutputArcComponent( |
3791 | + 0d, |
3792 | + 0d, |
3793 | + 0d, |
3794 | + 0d, |
3795 | + guiSource, |
3796 | + guiTarget, |
3797 | + arc.getWeight().value(), |
3798 | + arc.getSource().getName() + "_to_" + arc.getTarget().getName(), |
3799 | + false |
3800 | + ); |
3801 | + |
3802 | + // Build ArcPath |
3803 | + Place oldGuiTarget = guiModel.getPlaceByName(arc.getTarget().getName()); |
3804 | + Transition oldGuiSource = guiModel.getTransitionByName(arc.getSource().getName()); |
3805 | + ArcPath newArcPath = createArcPath(guiModel, oldGuiSource, oldGuiTarget, newArc); |
3806 | + |
3807 | + // Set arcPath, guiModel and connectors |
3808 | + newArc.setUnderlyingArc(addedArc); |
3809 | + newArc.setArcPath(newArcPath); |
3810 | + newArc.updateArcPosition(); |
3811 | + guiModel.addPetriNetObject(newArc); |
3812 | + |
3813 | + return newArc; |
3814 | + |
3815 | + } |
3816 | |
3817 | private static ArcPath createArcPath(DataLayer currentGuiModel, PlaceTransitionObject source, PlaceTransitionObject target, Arc arc) { |
3818 | Arc guiArc = currentGuiModel.getArcByEndpoints(source, target); |
3819 | @@ -128,6 +143,7 @@ |
3820 | |
3821 | // Build ArcPath |
3822 | ArcPath newArcPath = new ArcPath(arc); |
3823 | + newArcPath.purgePathPoints(); |
3824 | for(int k = 0; k < arcPathPointsNum; k++) { |
3825 | ArcPathPoint point = arcPath.getArcPathPoint(k); |
3826 | newArcPath.addPoint( |
3827 | |
3828 | === modified file 'src/dk/aau/cs/gui/TemplateExplorer.java' |
3829 | --- src/dk/aau/cs/gui/TemplateExplorer.java 2019-01-24 20:01:38 +0000 |
3830 | +++ src/dk/aau/cs/gui/TemplateExplorer.java 2020-04-28 09:05:34 +0000 |
3831 | @@ -10,16 +10,10 @@ |
3832 | import java.awt.event.ActionListener; |
3833 | import java.awt.event.ComponentEvent; |
3834 | import java.awt.event.ComponentListener; |
3835 | -import java.awt.event.InputMethodEvent; |
3836 | -import java.awt.event.InputMethodListener; |
3837 | import java.awt.event.KeyEvent; |
3838 | -import java.awt.event.KeyListener; |
3839 | import java.awt.event.MouseAdapter; |
3840 | import java.awt.event.MouseEvent; |
3841 | import java.util.ArrayList; |
3842 | -import java.util.Arrays; |
3843 | -import java.util.Collection; |
3844 | -import java.util.Comparator; |
3845 | import java.util.HashSet; |
3846 | import java.util.regex.Pattern; |
3847 | |
3848 | @@ -54,7 +48,7 @@ |
3849 | import pipe.gui.undo.ToggleTemplateActivationCommand; |
3850 | import pipe.gui.undo.UndoManager; |
3851 | import pipe.gui.widgets.EscapableDialog; |
3852 | -import pipe.gui.widgets.RequestFocusListener; |
3853 | +import net.tapaal.swinghelpers.RequestFocusListener; |
3854 | import dk.aau.cs.TCTL.visitors.BooleanResult; |
3855 | import dk.aau.cs.TCTL.visitors.ContainsPlaceWithDisabledTemplateVisitor; |
3856 | import dk.aau.cs.gui.components.NonsearchableJList; |
3857 | @@ -66,7 +60,6 @@ |
3858 | import dk.aau.cs.model.tapn.TimedPlace; |
3859 | import dk.aau.cs.model.tapn.TimedTransition; |
3860 | import dk.aau.cs.util.Require; |
3861 | -import dk.aau.cs.util.StringComparator; |
3862 | import dk.aau.cs.util.Tuple; |
3863 | |
3864 | public class TemplateExplorer extends JPanel { |
3865 | @@ -75,8 +68,8 @@ |
3866 | // Template explorer panel items |
3867 | private JPanel templatePanel; |
3868 | private JScrollPane scrollpane; |
3869 | - private JList templateList; |
3870 | - private DefaultListModel listModel; |
3871 | + private JList<Template> templateList; |
3872 | + private DefaultListModel<Template> listModel; |
3873 | |
3874 | // Template button panel items |
3875 | private JPanel buttonPanel; |
3876 | @@ -109,7 +102,7 @@ |
3877 | |
3878 | public TemplateExplorer(TabContent parent, boolean hideButtons) { |
3879 | this.parent = parent; |
3880 | - undoManager = parent.drawingSurface().getUndoManager(); |
3881 | + undoManager = parent.getUndoManager(); |
3882 | init(hideButtons); |
3883 | } |
3884 | |
3885 | @@ -199,7 +192,7 @@ |
3886 | |
3887 | listModel.addListDataListener(new ListDataListener() { |
3888 | public void contentsChanged(ListDataEvent arg0) { |
3889 | - if (CreateGui.getCurrentTab().numberOfActiveTemplates() > 1) { |
3890 | + if (parent.numberOfActiveTemplates() > 1) { |
3891 | removeTemplateButton.setEnabled(false); |
3892 | } else { |
3893 | removeTemplateButton.setEnabled(true); |
3894 | @@ -253,7 +246,7 @@ |
3895 | |
3896 | if(index > 0) { |
3897 | parent.swapTemplates(index, index-1); |
3898 | - Object o = listModel.getElementAt(index); |
3899 | + Template o = listModel.getElementAt(index); |
3900 | listModel.setElementAt(listModel.getElementAt(index-1), index); |
3901 | listModel.setElementAt(o, index-1); |
3902 | templateList.ensureIndexIsVisible(index+1); |
3903 | @@ -277,7 +270,7 @@ |
3904 | |
3905 | if(index < parent.network().allTemplates().size() - 1) { |
3906 | parent.swapTemplates(index, index+1); |
3907 | - Object o = listModel.getElementAt(index); |
3908 | + Template o = listModel.getElementAt(index); |
3909 | listModel.setElementAt(listModel.getElementAt(index+1), index); |
3910 | listModel.setElementAt(o, index+1); |
3911 | templateList.ensureIndexIsVisible(index+1); |
3912 | @@ -296,12 +289,10 @@ |
3913 | sortButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Sort.png"))); |
3914 | sortButton.setToolTipText(toolTipSortComponents); |
3915 | sortButton.setEnabled(false); |
3916 | - sortButton.addActionListener(new ActionListener() { |
3917 | - public void actionPerformed(ActionEvent e) { |
3918 | - Command command = new SortTemplatesCommand(parent, TemplateExplorer.this, templateList, listModel); |
3919 | - undoManager.addNewEdit(command); |
3920 | - command.redo(); |
3921 | - } |
3922 | + sortButton.addActionListener(e -> { |
3923 | + Command command = new SortTemplatesCommand(parent, TemplateExplorer.this, templateList, listModel); |
3924 | + undoManager.addNewEdit(command); |
3925 | + command.redo(); |
3926 | }); |
3927 | |
3928 | gbc = new GridBagConstraints(); |
3929 | @@ -321,11 +312,7 @@ |
3930 | newTemplateButton.setPreferredSize(dimension); |
3931 | newTemplateButton.setToolTipText(toolTipNewComponent); |
3932 | |
3933 | - newTemplateButton.addActionListener(new ActionListener() { |
3934 | - public void actionPerformed(ActionEvent arg0) { |
3935 | - ShowNewTemplateDialog(""); |
3936 | - } |
3937 | - }); |
3938 | + newTemplateButton.addActionListener(arg0 -> ShowNewTemplateDialog("")); |
3939 | |
3940 | GridBagConstraints gbc = new GridBagConstraints(); |
3941 | gbc.gridx = 1; |
3942 | @@ -543,14 +530,13 @@ |
3943 | } |
3944 | else { |
3945 | template = createNewTemplate(templateName); |
3946 | + |
3947 | + int index = listModel.size(); |
3948 | + undoManager.addNewEdit(new AddTemplateCommand(TemplateExplorer.this, template, index)); |
3949 | + parent.addTemplate(template); |
3950 | } |
3951 | } |
3952 | - if (template != null) { |
3953 | - int index = listModel.size(); |
3954 | - undoManager.addNewEdit(new AddTemplateCommand(TemplateExplorer.this, template, index)); |
3955 | - parent.addTemplate(template); |
3956 | - parent.drawingSurface().setModel(template.guiModel(), template.model(), template.zoomer()); |
3957 | - } |
3958 | + |
3959 | exit(); |
3960 | } |
3961 | |
3962 | @@ -569,13 +555,11 @@ |
3963 | nameTextField.setPreferredSize(size); |
3964 | nameTextField.setText(nameToShow); |
3965 | nameTextField.addAncestorListener(new RequestFocusListener()); |
3966 | - nameTextField.addActionListener(new ActionListener() { |
3967 | - |
3968 | - public void actionPerformed(ActionEvent e) { |
3969 | - okButton.requestFocusInWindow(); |
3970 | - okButton.doClick(); |
3971 | - } |
3972 | + nameTextField.addActionListener(e -> { |
3973 | + okButton.requestFocusInWindow(); |
3974 | + okButton.doClick(); |
3975 | }); |
3976 | + |
3977 | GridBagConstraints gbc = new GridBagConstraints(); |
3978 | gbc.gridx = 0; |
3979 | gbc.gridy = 1; |
3980 | @@ -682,12 +666,9 @@ |
3981 | nameTextField.setPreferredSize(size); |
3982 | nameTextField.setText(oldname); |
3983 | nameTextField.addAncestorListener(new RequestFocusListener()); |
3984 | - nameTextField.addActionListener(new ActionListener() { |
3985 | - |
3986 | - public void actionPerformed(ActionEvent e) { |
3987 | - okButton.requestFocusInWindow(); |
3988 | - okButton.doClick(); |
3989 | - } |
3990 | + nameTextField.addActionListener(e -> { |
3991 | + okButton.requestFocusInWindow(); |
3992 | + okButton.doClick(); |
3993 | }); |
3994 | GridBagConstraints gbc = new GridBagConstraints(); |
3995 | gbc.gridx = 0; |
3996 | @@ -737,18 +718,9 @@ |
3997 | gbc.anchor = GridBagConstraints.EAST; |
3998 | buttonContainer.add(cancelButton,gbc); |
3999 | |
4000 | - okButton.addActionListener(new ActionListener() { |
4001 | - |
4002 | - public void actionPerformed(ActionEvent e) { |
4003 | - onOKRenameTemplate(); |
4004 | - } |
4005 | - }); |
4006 | + okButton.addActionListener(e -> onOKRenameTemplate()); |
4007 | |
4008 | - cancelButton.addActionListener(new ActionListener() { |
4009 | - public void actionPerformed(ActionEvent e) { |
4010 | - exit(); |
4011 | - } |
4012 | - }); |
4013 | + cancelButton.addActionListener(e -> exit()); |
4014 | |
4015 | gbc = new GridBagConstraints(); |
4016 | gbc.insets = new Insets(0, 8, 5, 8); |
4017 | @@ -804,10 +776,10 @@ |
4018 | |
4019 | public void openSelectedTemplate() { |
4020 | Template tapn = selectedModel(); |
4021 | - if (tapn != null) { |
4022 | - parent.drawingSurface().setModel(tapn.guiModel(), tapn.model(), tapn.zoomer()); |
4023 | + if (tapn != null && parent.isTabInFocus()) { |
4024 | + parent.changeToTemplate(tapn); |
4025 | } |
4026 | - parent.drawingSurface().repaintAll(); |
4027 | + //parent.drawingSurface().repaintAll(); |
4028 | } |
4029 | |
4030 | public Template selectedModel() { |
4031 | @@ -935,7 +907,7 @@ |
4032 | if (!selectedModel().isActive()){ |
4033 | removeTemplateButton.setEnabled(true); |
4034 | }else { |
4035 | - if (CreateGui.getCurrentTab().numberOfActiveTemplates() <= 1) { |
4036 | + if (parent.numberOfActiveTemplates() <= 1) { |
4037 | removeTemplateButton.setEnabled(false); |
4038 | } else { |
4039 | removeTemplateButton.setEnabled(true); |
4040 | @@ -991,7 +963,7 @@ |
4041 | sortButton.setEnabled(false); |
4042 | } else { |
4043 | if (buttonPanel != null) { |
4044 | - if (CreateGui.getCurrentTab().numberOfActiveTemplates() > 1){ |
4045 | + if (parent.numberOfActiveTemplates() > 1){ |
4046 | removeTemplateButton.setEnabled(true); |
4047 | }else{ |
4048 | if (selectedModel().isActive()){ |
4049 | |
4050 | === modified file 'src/dk/aau/cs/gui/components/BatchProcessingResultsTableModel.java' |
4051 | --- src/dk/aau/cs/gui/components/BatchProcessingResultsTableModel.java 2017-09-26 14:12:18 +0000 |
4052 | +++ src/dk/aau/cs/gui/components/BatchProcessingResultsTableModel.java 2020-04-28 09:05:34 +0000 |
4053 | @@ -3,7 +3,6 @@ |
4054 | import java.util.ArrayList; |
4055 | import java.util.List; |
4056 | |
4057 | -import javax.management.Query; |
4058 | import javax.swing.table.AbstractTableModel; |
4059 | |
4060 | import dk.aau.cs.translations.ReductionOption; |
4061 | |
4062 | === modified file 'src/dk/aau/cs/gui/components/EnabledTransitionsList.java' |
4063 | --- src/dk/aau/cs/gui/components/EnabledTransitionsList.java 2016-11-14 09:58:40 +0000 |
4064 | +++ src/dk/aau/cs/gui/components/EnabledTransitionsList.java 2020-04-28 09:05:34 +0000 |
4065 | @@ -26,6 +26,7 @@ |
4066 | |
4067 | import pipe.dataLayer.Template; |
4068 | import pipe.gui.CreateGui; |
4069 | +import pipe.gui.GuiFrame; |
4070 | import pipe.gui.graphicElements.Transition; |
4071 | import pipe.gui.graphicElements.tapn.TimedTransitionComponent; |
4072 | //TODO clean up!!! |
4073 | @@ -39,14 +40,14 @@ |
4074 | initPanel(); |
4075 | } |
4076 | |
4077 | - DefaultListModel transitions; |
4078 | - JList transitionsList; |
4079 | + DefaultListModel<TransitionListItem> transitions; |
4080 | + JList<TransitionListItem> transitionsList; |
4081 | JScrollPane scrollPane; |
4082 | TransitionListItem lastSelected; |
4083 | |
4084 | public void initPanel(){ |
4085 | - transitions = new DefaultListModel(); |
4086 | - transitionsList = new JList(transitions); |
4087 | + transitions = new DefaultListModel<>(); |
4088 | + transitionsList = new JList<>(transitions); |
4089 | transitionsList.setCellRenderer(new EnabledTransitionListCellRenderer()); |
4090 | |
4091 | transitionsList.addMouseListener(new MouseAdapter() { |
4092 | @@ -54,11 +55,16 @@ |
4093 | public void mouseClicked(MouseEvent e) { |
4094 | if(e.getClickCount() == 2){ |
4095 | fireSelectedTransition(); |
4096 | - CreateGui.getApp().setRandomAnimationMode(false); |
4097 | + GuiFrame guiFrame = CreateGui.getApp(); |
4098 | + guiFrame.stepforwardAction.setEnabled(guiFrame.getCurrentTab().getAnimationHistory().isStepForwardAllowed()); |
4099 | + guiFrame.stepbackwardAction.setEnabled(guiFrame.getCurrentTab().getAnimationHistory().isStepBackAllowed()); |
4100 | + |
4101 | + guiFrame.getCurrentTab().getAnimationController().setAnimationButtonsEnabled(); |
4102 | + |
4103 | } |
4104 | |
4105 | if(e.getClickCount() == 1){ |
4106 | - TransitionListItem highlightedItem = (TransitionListItem)transitionsList.getSelectedValue(); |
4107 | + TransitionListItem highlightedItem = transitionsList.getSelectedValue(); |
4108 | if(highlightedItem != null){ |
4109 | highlightedItem.getTransition().blink(); |
4110 | } |
4111 | @@ -72,7 +78,7 @@ |
4112 | } |
4113 | |
4114 | public void startReInit(){ |
4115 | - lastSelected = (TransitionListItem)transitionsList.getSelectedValue(); |
4116 | + lastSelected = transitionsList.getSelectedValue(); |
4117 | transitions.clear(); |
4118 | } |
4119 | |
4120 | @@ -84,11 +90,11 @@ |
4121 | //Trick to make the "splitter" appear |
4122 | //transitions.addElement(new SplitterListItem()); |
4123 | //sort the transitions |
4124 | - Object[] temp = (Object[])transitions.toArray(); |
4125 | + Object[] temp = transitions.toArray(); |
4126 | Arrays.sort(temp); |
4127 | transitions.clear(); |
4128 | for(Object item : temp){ |
4129 | - transitions.addElement(item); |
4130 | + transitions.addElement((TransitionListItem)item); |
4131 | } |
4132 | |
4133 | if(transitions.contains(lastSelected)){ |
4134 | @@ -171,9 +177,8 @@ |
4135 | } else { |
4136 | transitionName = getTemplate() + "." + transitionName; |
4137 | } |
4138 | - String result = interval + transitionName; |
4139 | |
4140 | - return result; |
4141 | + return interval + transitionName; |
4142 | } |
4143 | |
4144 | public String toString(){ |
4145 | |
4146 | === modified file 'src/dk/aau/cs/gui/components/ExportBatchResultTableModel.java' |
4147 | --- src/dk/aau/cs/gui/components/ExportBatchResultTableModel.java 2018-05-07 14:36:57 +0000 |
4148 | +++ src/dk/aau/cs/gui/components/ExportBatchResultTableModel.java 2020-04-28 09:05:34 +0000 |
4149 | @@ -4,7 +4,6 @@ |
4150 | import javax.swing.table.AbstractTableModel; |
4151 | |
4152 | import dk.aau.cs.util.Require; |
4153 | -import dk.aau.cs.verification.batchProcessing.BatchProcessingVerificationResult; |
4154 | |
4155 | |
4156 | public class ExportBatchResultTableModel extends AbstractTableModel { |
4157 | |
4158 | === removed file 'src/dk/aau/cs/gui/components/MultiSplitPane.java' |
4159 | === modified file 'src/dk/aau/cs/gui/components/NonsearchableJComboBox.java' |
4160 | --- src/dk/aau/cs/gui/components/NonsearchableJComboBox.java 2012-02-10 09:45:16 +0000 |
4161 | +++ src/dk/aau/cs/gui/components/NonsearchableJComboBox.java 2020-04-28 09:05:34 +0000 |
4162 | @@ -12,7 +12,7 @@ |
4163 | //As the javax.swing.plaf.basic.BasicComboBoxUI.Handler class is a private nested class, in the javax.swing.plaf.basic.BasicComboBoxUI class, |
4164 | //it's not possible to use "instanceof" to do the test. |
4165 | //Therefore the toString of the keylistener is used. |
4166 | -public class NonsearchableJComboBox extends JComboBox { |
4167 | +public class NonsearchableJComboBox<E> extends JComboBox<E> { |
4168 | |
4169 | private static final long serialVersionUID = -5796892375680580143L; |
4170 | |
4171 | @@ -26,12 +26,12 @@ |
4172 | removeKeyListener(); |
4173 | } |
4174 | |
4175 | - public NonsearchableJComboBox(Object[] items) { |
4176 | + public NonsearchableJComboBox(E[] items) { |
4177 | super(items); |
4178 | removeKeyListener(); |
4179 | } |
4180 | |
4181 | - public NonsearchableJComboBox(Vector<?> items) { |
4182 | + public NonsearchableJComboBox(Vector<E> items) { |
4183 | super(items); |
4184 | removeKeyListener(); |
4185 | } |
4186 | |
4187 | === modified file 'src/dk/aau/cs/gui/components/NonsearchableJList.java' |
4188 | --- src/dk/aau/cs/gui/components/NonsearchableJList.java 2012-01-27 13:37:15 +0000 |
4189 | +++ src/dk/aau/cs/gui/components/NonsearchableJList.java 2020-04-28 09:05:34 +0000 |
4190 | @@ -12,7 +12,7 @@ |
4191 | //As the javax.swing.plaf.basic.BasicListUI.Handler class is a private nested class, in the javax.swing.plaf.basic.BasicListUI class, |
4192 | //it's not possible to use "instanceof" to do the test. |
4193 | //Therefore the toString of the keylistener is used. |
4194 | -public class NonsearchableJList extends JList{ |
4195 | +public class NonsearchableJList<E> extends JList<E>{ |
4196 | private static final long serialVersionUID = 2706313217985326989L; |
4197 | |
4198 | public NonsearchableJList() { |
4199 | @@ -25,12 +25,12 @@ |
4200 | removeKeyListener(); |
4201 | } |
4202 | |
4203 | - public NonsearchableJList(Object[] listData){ |
4204 | + public NonsearchableJList(E[] listData){ |
4205 | super (listData); |
4206 | removeKeyListener(); |
4207 | } |
4208 | |
4209 | - public NonsearchableJList(Vector<?> listData){ |
4210 | + public NonsearchableJList(Vector<E> listData){ |
4211 | super (listData); |
4212 | removeKeyListener(); |
4213 | } |
4214 | |
4215 | === modified file 'src/dk/aau/cs/gui/components/StatisticsPanel.java' |
4216 | --- src/dk/aau/cs/gui/components/StatisticsPanel.java 2018-11-02 13:14:18 +0000 |
4217 | +++ src/dk/aau/cs/gui/components/StatisticsPanel.java 2020-04-28 09:05:34 +0000 |
4218 | @@ -142,20 +142,21 @@ |
4219 | TabContent tab = CreateGui.getCurrentTab(); |
4220 | Iterable<Template> templates = tab.allTemplates(); |
4221 | |
4222 | - UndoManager undoManager = CreateGui.getDrawingSurface().getUndoManager(); |
4223 | + UndoManager undoManager = CreateGui.getCurrentTab().getUndoManager(); |
4224 | boolean first = true; |
4225 | for(Template template : templates){ |
4226 | List<TimedTransition> orphans = template.model().getOrphanTransitions(); |
4227 | for(TimedTransition trans : orphans){ |
4228 | TimedTransitionComponent t = (TimedTransitionComponent)template.guiModel().getTransitionByName(trans.name()); |
4229 | - Command cmd = new DeleteTimedTransitionCommand(t, t.underlyingTransition().model(), template.guiModel(), tab.drawingSurface()); |
4230 | - t.delete(); |
4231 | + Command cmd = new DeleteTimedTransitionCommand(t, t.underlyingTransition().model(), template.guiModel()); |
4232 | + |
4233 | if(first){ |
4234 | undoManager.addNewEdit(cmd); |
4235 | first = false; |
4236 | } else { |
4237 | undoManager.addEdit(cmd); |
4238 | } |
4239 | + cmd.redo(); |
4240 | } |
4241 | } |
4242 | |
4243 | |
4244 | === modified file 'src/dk/aau/cs/gui/components/TransitionFireingComponent.java' |
4245 | --- src/dk/aau/cs/gui/components/TransitionFireingComponent.java 2016-11-14 09:58:40 +0000 |
4246 | +++ src/dk/aau/cs/gui/components/TransitionFireingComponent.java 2020-04-28 09:05:34 +0000 |
4247 | @@ -3,8 +3,6 @@ |
4248 | import java.awt.Dimension; |
4249 | import java.awt.GridBagConstraints; |
4250 | import java.awt.GridBagLayout; |
4251 | -import java.awt.event.ActionEvent; |
4252 | -import java.awt.event.ActionListener; |
4253 | import java.awt.event.KeyAdapter; |
4254 | import java.awt.event.KeyEvent; |
4255 | |
4256 | @@ -42,21 +40,15 @@ |
4257 | |
4258 | settingsButton = new JButton("Settings"); |
4259 | settingsButton.setPreferredSize(new Dimension(0, settingsButton.getPreferredSize().height)); //Make the two buttons equal in size |
4260 | - settingsButton.addActionListener(new ActionListener() { |
4261 | - public void actionPerformed(ActionEvent e) { |
4262 | - AnimationSettings.showAnimationSettings(); |
4263 | - } |
4264 | - }); |
4265 | + settingsButton.addActionListener(e -> AnimationSettings.showAnimationSettings()); |
4266 | |
4267 | fireButton = new JButton("Delay & Fire"); |
4268 | fireButton.setPreferredSize(new Dimension(0, fireButton.getPreferredSize().height)); //Make the two buttons equal in size |
4269 | - fireButton.addActionListener(new ActionListener() { |
4270 | - public void actionPerformed(ActionEvent e) { |
4271 | - if(SimulationControl.getInstance().randomSimulation() && CreateGui.getApp().isShowingDelayEnabledTransitions()){ |
4272 | - SimulationControl.startSimulation(); |
4273 | - } else { |
4274 | - fireSelectedTransition(); |
4275 | - } |
4276 | + fireButton.addActionListener(e -> { |
4277 | + if(SimulationControl.getInstance().randomSimulation() && CreateGui.getApp().isShowingDelayEnabledTransitions()){ |
4278 | + SimulationControl.startSimulation(); |
4279 | + } else { |
4280 | + fireSelectedTransition(); |
4281 | } |
4282 | }); |
4283 | fireButton.addKeyListener(new KeyAdapter() { |
4284 | |
4285 | === modified file 'src/dk/aau/cs/gui/smartDraw/SmartDrawDialog.java' |
4286 | --- src/dk/aau/cs/gui/smartDraw/SmartDrawDialog.java 2019-11-29 16:42:51 +0000 |
4287 | +++ src/dk/aau/cs/gui/smartDraw/SmartDrawDialog.java 2020-04-28 09:05:34 +0000 |
4288 | @@ -7,11 +7,9 @@ |
4289 | import java.awt.GridBagLayout; |
4290 | import java.awt.Insets; |
4291 | import java.awt.Window; |
4292 | -import java.awt.GraphicsDevice.WindowTranslucency; |
4293 | import java.awt.event.ActionEvent; |
4294 | import java.awt.event.ActionListener; |
4295 | import java.awt.event.MouseListener; |
4296 | -import java.time.LocalDateTime; |
4297 | import java.util.ArrayList; |
4298 | import java.util.Arrays; |
4299 | import java.util.Iterator; |
4300 | @@ -32,15 +30,14 @@ |
4301 | import javax.swing.JSpinner; |
4302 | import javax.swing.JTextPane; |
4303 | import javax.swing.SwingConstants; |
4304 | -import javax.swing.SwingUtilities; |
4305 | import javax.swing.Timer; |
4306 | import javax.swing.border.TitledBorder; |
4307 | import javax.swing.event.ChangeEvent; |
4308 | import javax.swing.event.ChangeListener; |
4309 | + |
4310 | +import net.tapaal.swinghelpers.CustomJSpinner; |
4311 | import pipe.gui.CreateGui; |
4312 | import pipe.gui.graphicElements.PetriNetObject; |
4313 | -import pipe.gui.graphicElements.PlaceTransitionObject; |
4314 | -import pipe.gui.widgets.CustomJSpinner; |
4315 | |
4316 | public class SmartDrawDialog extends JDialog { |
4317 | private static final long serialVersionUID = 6116530047981607501L; |
4318 | @@ -221,8 +218,7 @@ |
4319 | |
4320 | @Override |
4321 | public void fireStatusChanged(int objectsPlaced) { |
4322 | - progressLabel.setText("Objects placed: " + objectsPlaced +"/" + CreateGui.getDrawingSurface().getPlaceTransitionObjects().size()); |
4323 | - |
4324 | + progressLabel.setText("Objects placed: " + objectsPlaced +"/" + CreateGui.getDrawingSurface().getGuiModel().getPlaceTransitionObjects().size()); |
4325 | } |
4326 | |
4327 | @Override |
4328 | @@ -688,7 +684,7 @@ |
4329 | |
4330 | static private String[] getObjectNames() { |
4331 | ArrayList<String> names = new ArrayList<String>(); |
4332 | - for(PetriNetObject object : CreateGui.getDrawingSurface().getPlaceTransitionObjects()) { |
4333 | + for(PetriNetObject object : CreateGui.getDrawingSurface().getGuiModel().getPlaceTransitionObjects()) { |
4334 | names.add(object.getName()); |
4335 | } |
4336 | return Arrays.copyOf(names.toArray(), names.toArray().length, String[].class); |
4337 | @@ -698,8 +694,8 @@ |
4338 | loadingDialogFrame = new JDialog(CreateGui.getApp(), "Working...", true); |
4339 | loadingDialogFrame.setLayout(new GridBagLayout()); |
4340 | loadingDialogFrame.setType(Window.Type.POPUP); |
4341 | - ImageIcon loadingGIF = new ImageIcon(CreateGui.imgPath + "ajax-loader.gif"); |
4342 | - |
4343 | + ImageIcon loadingGIF = new ImageIcon(Thread.currentThread().getContextClassLoader().getResource(CreateGui.imgPath + "ajax-loader.gif")); |
4344 | + |
4345 | JLabel workingLabel = new JLabel("<html><div style='text-align: center;'>Currently doing layout...<br/>This may take several minutes depending on the size of the net...</div></html>", SwingConstants.CENTER); |
4346 | GridBagConstraints gbc = new GridBagConstraints(); |
4347 | gbc.gridx = 0; |
4348 | @@ -746,7 +742,7 @@ |
4349 | @Override |
4350 | public void actionPerformed(ActionEvent e) { |
4351 | cancelWorker(); |
4352 | - CreateGui.getDrawingSurface().getUndoManager().undo(); |
4353 | + CreateGui.getCurrentTab().getUndoManager().undo(); |
4354 | CreateGui.getDrawingSurface().repaintAll(); |
4355 | loadingDialogFrame.setVisible(false); |
4356 | //smartDrawDialog.setVisible(true); |
4357 | @@ -889,7 +885,7 @@ |
4358 | } |
4359 | |
4360 | private void enableButtons() { |
4361 | - if(CreateGui.getDrawingSurface().getPlaceTransitionObjects().size() > 0) { |
4362 | + if(CreateGui.getDrawingSurface().getGuiModel().getPlaceTransitionObjects().size() > 0) { |
4363 | drawButton.setEnabled(true); |
4364 | drawButton.setToolTipText("Smart draw with the current options"); |
4365 | if(!(randomStartObjectCheckBox.isSelected())) |
4366 | |
4367 | === modified file 'src/dk/aau/cs/gui/smartDraw/SmartDrawWorker.java' |
4368 | --- src/dk/aau/cs/gui/smartDraw/SmartDrawWorker.java 2019-09-09 14:52:47 +0000 |
4369 | +++ src/dk/aau/cs/gui/smartDraw/SmartDrawWorker.java 2020-04-28 09:05:34 +0000 |
4370 | @@ -1,7 +1,6 @@ |
4371 | package dk.aau.cs.gui.smartDraw; |
4372 | |
4373 | import java.awt.Point; |
4374 | -import java.time.LocalDateTime; |
4375 | import java.util.ArrayList; |
4376 | import java.util.Iterator; |
4377 | import java.util.List; |
4378 | @@ -14,13 +13,8 @@ |
4379 | import dk.aau.cs.gui.undo.MovePlaceTransitionObject; |
4380 | import dk.aau.cs.util.Require; |
4381 | import pipe.gui.CreateGui; |
4382 | -import pipe.gui.DrawingSurfaceImpl; |
4383 | -import pipe.gui.graphicElements.Arc; |
4384 | -import pipe.gui.graphicElements.ArcPathPoint; |
4385 | -import pipe.gui.graphicElements.PetriNetObject; |
4386 | -import pipe.gui.graphicElements.Place; |
4387 | -import pipe.gui.graphicElements.PlaceTransitionObject; |
4388 | -import pipe.gui.graphicElements.Transition; |
4389 | +import pipe.gui.canvas.DrawingSurfaceImpl; |
4390 | +import pipe.gui.graphicElements.*; |
4391 | import pipe.gui.undo.DeleteArcPathPointEdit; |
4392 | import pipe.gui.undo.TransitionRotationEdit; |
4393 | |
4394 | @@ -38,7 +32,7 @@ |
4395 | ArrayList<PlaceTransitionObject> objectsPlaced = new ArrayList<PlaceTransitionObject>(); |
4396 | ArrayList<PlaceTransitionObject> placeTransitionObjects = new ArrayList<PlaceTransitionObject>(); |
4397 | ArrayList<Point> pointsReserved = new ArrayList<Point>(); |
4398 | - pipe.gui.undo.UndoManager undoManager = CreateGui.getDrawingSurface().getUndoManager(); |
4399 | + pipe.gui.undo.UndoManager undoManager = CreateGui.getCurrentTab().getUndoManager(); |
4400 | |
4401 | //weights |
4402 | int diagonalWeight; |
4403 | @@ -74,7 +68,7 @@ |
4404 | |
4405 | private void processStartingObject(String startingObject) { |
4406 | if(!(startingObject.equals("Random"))) |
4407 | - this.startingObject = drawingSurface.getPlaceTransitionObjectByName(startingObject); |
4408 | + this.startingObject = drawingSurface.getGuiModel().getPlaceTransitionObjectByName(startingObject); |
4409 | else { |
4410 | try { |
4411 | this.startingObject = placeTransitionObjects.get(new Random().nextInt(placeTransitionObjects.size()-1)); |
4412 | @@ -312,7 +306,7 @@ |
4413 | |
4414 | //newObject --- S ---> T |
4415 | else if((distancePointSource + distanceTargetSource) == distanceTargetPoint) { |
4416 | - for(PetriNetObject pNetObject : drawingSurface.getPNObjects()) { |
4417 | + for(PetriNetObject pNetObject : drawingSurface.getGuiModel().getPNObjects()) { |
4418 | if(pNetObject instanceof Arc) { |
4419 | Arc arc = (Arc)pNetObject; |
4420 | if((arc.getSource() == objectToPlace && arc.getTarget() == placedArc.getTarget()) |
4421 | @@ -325,7 +319,7 @@ |
4422 | |
4423 | //newObject --- T ---> S |
4424 | else if((distanceTargetSource + distanceTargetPoint == distancePointSource)) { |
4425 | - for(PetriNetObject pNetObject : drawingSurface.getPNObjects()) { |
4426 | + for(PetriNetObject pNetObject : drawingSurface.getGuiModel().getPNObjects()) { |
4427 | if(pNetObject instanceof Arc) { |
4428 | Arc arc = (Arc)pNetObject; |
4429 | if((arc.getSource() == objectToPlace && arc.getTarget() == placedArc.getSource()) |
4430 | @@ -389,7 +383,7 @@ |
4431 | |
4432 | private void removeArcPathPoints() { |
4433 | ArrayList<ArcPathPoint> toRemove = new ArrayList<ArcPathPoint>(); |
4434 | - for(PetriNetObject object : CreateGui.getDrawingSurface().getPNObjects()) { |
4435 | + for(PetriNetObject object : CreateGui.getDrawingSurface().getGuiModel().getPNObjects()) { |
4436 | if(object instanceof ArcPathPoint) { |
4437 | ArcPathPoint arcPathPoint = (ArcPathPoint)object; |
4438 | if(!(arcPathPoint.isEndPoint())) { |
4439 | @@ -399,7 +393,7 @@ |
4440 | |
4441 | } |
4442 | for(ArcPathPoint p : toRemove) { |
4443 | - Command command = new DeleteArcPathPointEdit(p.getArcPath().getArc(), p, p.getIndex()); |
4444 | + Command command = new DeleteArcPathPointEdit(p.getArcPath().getArc(), p, p.getIndex(), CreateGui.getModel()); |
4445 | command.redo(); |
4446 | undoManager.addEdit(command); |
4447 | } |
4448 | @@ -460,7 +454,7 @@ |
4449 | |
4450 | private void getPlaceTransitionObjects() { |
4451 | placeTransitionObjects = new ArrayList<PlaceTransitionObject>(); |
4452 | - for(PetriNetObject object : drawingSurface.getPlaceTransitionObjects()) { |
4453 | + for(PetriNetObject object : drawingSurface.getGuiModel().getPlaceTransitionObjects()) { |
4454 | if(object instanceof PlaceTransitionObject) { |
4455 | PlaceTransitionObject ptObject = (PlaceTransitionObject) object; |
4456 | placeTransitionObjects.add(ptObject); |
4457 | @@ -468,17 +462,17 @@ |
4458 | } |
4459 | } |
4460 | public void resetLabelsToDefault() { |
4461 | - for(PetriNetObject pNetObject : drawingSurface.getPNObjects()) { |
4462 | + for(PetriNetObject pNetObject : drawingSurface.getGuiModel().getPNObjects()) { |
4463 | if(pNetObject instanceof PlaceTransitionObject) { |
4464 | Command cmd = new UpdateNameLabelOffsetCommand(pipe.gui.Pipe.DEFAULT_OFFSET_X, pipe.gui.Pipe.DEFAULT_OFFSET_Y, ((PlaceTransitionObject) pNetObject).getNameOffsetX(), |
4465 | - ((PlaceTransitionObject) pNetObject).getNameOffsetY(), pNetObject); |
4466 | + ((PlaceTransitionObject) pNetObject).getNameOffsetY(), (PetriNetObjectWithLabel) pNetObject); |
4467 | cmd.redo(); |
4468 | undoManager.addEdit(cmd); |
4469 | |
4470 | } |
4471 | else if(pNetObject instanceof Arc) { |
4472 | Command cmd = new UpdateNameLabelOffsetCommand(0, 0, ((Arc) pNetObject).getNameOffsetX(), |
4473 | - ((Arc) pNetObject).getNameOffsetY(), pNetObject); |
4474 | + ((Arc) pNetObject).getNameOffsetY(), (PetriNetObjectWithLabel)pNetObject); |
4475 | cmd.redo(); |
4476 | undoManager.addEdit(cmd); |
4477 | } |
4478 | @@ -514,7 +508,7 @@ |
4479 | |
4480 | @Override |
4481 | protected void done(){ |
4482 | - if(objectsPlaced.size() == drawingSurface.getPlaceTransitionObjects().size()) { |
4483 | + if(objectsPlaced.size() == drawingSurface.getGuiModel().getPlaceTransitionObjects().size()) { |
4484 | setTransitionsToUpright(); |
4485 | doOffsetForLoops(); |
4486 | CreateGui.getModel().repaintAll(true); |
4487 | |
4488 | === modified file 'src/dk/aau/cs/gui/undo/MakePlaceNewSharedCommand.java' |
4489 | --- src/dk/aau/cs/gui/undo/MakePlaceNewSharedCommand.java 2019-01-31 17:18:34 +0000 |
4490 | +++ src/dk/aau/cs/gui/undo/MakePlaceNewSharedCommand.java 2020-04-28 09:05:34 +0000 |
4491 | @@ -18,7 +18,6 @@ |
4492 | import dk.aau.cs.model.tapn.TimedToken; |
4493 | import dk.aau.cs.model.tapn.TransportArc; |
4494 | import dk.aau.cs.util.Require; |
4495 | -import dk.aau.cs.util.RequireException; |
4496 | |
4497 | public class MakePlaceNewSharedCommand extends Command { |
4498 | private final String newSharedName; |
4499 | |
4500 | === modified file 'src/dk/aau/cs/gui/undo/MakePlaceNewSharedMultiCommand.java' |
4501 | --- src/dk/aau/cs/gui/undo/MakePlaceNewSharedMultiCommand.java 2020-04-12 15:06:23 +0000 |
4502 | +++ src/dk/aau/cs/gui/undo/MakePlaceNewSharedMultiCommand.java 2020-04-28 09:05:34 +0000 |
4503 | @@ -1,36 +1,16 @@ |
4504 | package dk.aau.cs.gui.undo; |
4505 | |
4506 | -import java.util.ArrayList; |
4507 | -import java.util.HashMap; |
4508 | -import java.util.Hashtable; |
4509 | -import java.util.List; |
4510 | -import java.util.Map.Entry; |
4511 | - |
4512 | -import javax.swing.undo.UndoManager; |
4513 | - |
4514 | -import pipe.dataLayer.DataLayer; |
4515 | +import dk.aau.cs.gui.Context; |
4516 | +import dk.aau.cs.model.tapn.SharedPlace; |
4517 | +import dk.aau.cs.util.Require; |
4518 | import pipe.dataLayer.TAPNQuery; |
4519 | import pipe.dataLayer.Template; |
4520 | -import pipe.gui.CreateGui; |
4521 | -import pipe.gui.GuiFrame; |
4522 | import pipe.gui.graphicElements.Place; |
4523 | import pipe.gui.graphicElements.tapn.TimedPlaceComponent; |
4524 | -import dk.aau.cs.TCTL.visitors.BooleanResult; |
4525 | -import dk.aau.cs.TCTL.visitors.MakePlaceSharedVisitor; |
4526 | -import dk.aau.cs.gui.Context; |
4527 | -import dk.aau.cs.gui.NameGenerator; |
4528 | -import dk.aau.cs.gui.SharedPlacesAndTransitionsPanel; |
4529 | -import dk.aau.cs.gui.TabContent; |
4530 | -import dk.aau.cs.model.tapn.LocalTimedPlace; |
4531 | -import dk.aau.cs.model.tapn.SharedPlace; |
4532 | -import dk.aau.cs.model.tapn.TimedArcPetriNet; |
4533 | -import dk.aau.cs.model.tapn.TimedInhibitorArc; |
4534 | -import dk.aau.cs.model.tapn.TimedInputArc; |
4535 | -import dk.aau.cs.model.tapn.TimedOutputArc; |
4536 | -import dk.aau.cs.model.tapn.TimedPlace; |
4537 | -import dk.aau.cs.model.tapn.TimedToken; |
4538 | -import dk.aau.cs.model.tapn.TransportArc; |
4539 | -import dk.aau.cs.util.Require; |
4540 | + |
4541 | +import java.util.ArrayList; |
4542 | +import java.util.Hashtable; |
4543 | +import java.util.List; |
4544 | |
4545 | public class MakePlaceNewSharedMultiCommand extends Command { |
4546 | |
4547 | @@ -55,22 +35,23 @@ |
4548 | @Override |
4549 | public void redo() { |
4550 | SharedPlace sharedPlace = null; |
4551 | - int i = 0; |
4552 | + boolean first = true; |
4553 | for(Template template : context.tabContent().allTemplates()) { |
4554 | TimedPlaceComponent component = (TimedPlaceComponent)template.guiModel().getPlaceByName(place.getName()); |
4555 | - //We make a new shared place with the first place |
4556 | - if(component != null && i < 1) { |
4557 | - command = new MakePlaceNewSharedCommand(template.model(), newSharedName, component.underlyingPlace(), component, context.tabContent(), true); |
4558 | - command.redo(); |
4559 | - sharedPlace = (SharedPlace)component.underlyingPlace(); |
4560 | - commands.add(command); |
4561 | - i++; |
4562 | - //For the rest we make them shared with the recently made place |
4563 | - } else if (component != null && i >= 1){ |
4564 | - command = new MakePlaceSharedCommand(context.activeModel(), sharedPlace, component.underlyingPlace(), component, context.tabContent(), true); |
4565 | - command.redo(); |
4566 | - commands.add(command); |
4567 | - } |
4568 | + |
4569 | + if (component != null) { |
4570 | + if (first) { //We make a new shared place with the first place |
4571 | + command = new MakePlaceNewSharedCommand(template.model(), newSharedName, component.underlyingPlace(), component, context.tabContent(), true); |
4572 | + command.redo(); |
4573 | + sharedPlace = (SharedPlace) component.underlyingPlace(); |
4574 | + commands.add(command); |
4575 | + first = false; |
4576 | + } else { //For the rest we make them shared with the recently made place |
4577 | + command = new MakePlaceSharedCommand(context.activeModel(), sharedPlace, component.underlyingPlace(), component, context.tabContent(), true); |
4578 | + command.redo(); |
4579 | + commands.add(command); |
4580 | + } |
4581 | + } |
4582 | } |
4583 | } |
4584 | |
4585 | |
4586 | === modified file 'src/dk/aau/cs/gui/undo/MakeTransitionNewSharedCommand.java' |
4587 | --- src/dk/aau/cs/gui/undo/MakeTransitionNewSharedCommand.java 2019-01-31 17:18:34 +0000 |
4588 | +++ src/dk/aau/cs/gui/undo/MakeTransitionNewSharedCommand.java 2020-04-28 09:05:34 +0000 |
4589 | @@ -1,14 +1,10 @@ |
4590 | package dk.aau.cs.gui.undo; |
4591 | |
4592 | -import javax.swing.JOptionPane; |
4593 | - |
4594 | import dk.aau.cs.gui.SharedPlacesAndTransitionsPanel; |
4595 | -import dk.aau.cs.gui.SharedTransitionNamePanel; |
4596 | import dk.aau.cs.gui.TabContent; |
4597 | import dk.aau.cs.model.tapn.SharedTransition; |
4598 | import dk.aau.cs.model.tapn.TimedArcPetriNet; |
4599 | import dk.aau.cs.model.tapn.TimedTransition; |
4600 | -import dk.aau.cs.util.RequireException; |
4601 | |
4602 | public class MakeTransitionNewSharedCommand extends Command { |
4603 | private SharedTransition sharedTransition; |
4604 | |
4605 | === modified file 'src/dk/aau/cs/gui/undo/MakeTransitionNewSharedMultiCommand.java' |
4606 | --- src/dk/aau/cs/gui/undo/MakeTransitionNewSharedMultiCommand.java 2020-04-10 11:04:05 +0000 |
4607 | +++ src/dk/aau/cs/gui/undo/MakeTransitionNewSharedMultiCommand.java 2020-04-28 09:05:34 +0000 |
4608 | @@ -1,33 +1,14 @@ |
4609 | package dk.aau.cs.gui.undo; |
4610 | |
4611 | -import java.util.ArrayList; |
4612 | -import java.util.HashMap; |
4613 | -import java.util.Hashtable; |
4614 | -import java.util.List; |
4615 | -import java.util.Map.Entry; |
4616 | -import javax.swing.undo.UndoManager; |
4617 | -import pipe.dataLayer.DataLayer; |
4618 | -import pipe.dataLayer.TAPNQuery; |
4619 | +import dk.aau.cs.gui.Context; |
4620 | +import dk.aau.cs.model.tapn.SharedTransition; |
4621 | +import dk.aau.cs.util.Require; |
4622 | import pipe.dataLayer.Template; |
4623 | -import pipe.gui.CreateGui; |
4624 | -import pipe.gui.GuiFrame; |
4625 | import pipe.gui.graphicElements.Transition; |
4626 | import pipe.gui.graphicElements.tapn.TimedTransitionComponent; |
4627 | -import dk.aau.cs.TCTL.visitors.BooleanResult; |
4628 | -import dk.aau.cs.gui.Context; |
4629 | -import dk.aau.cs.gui.NameGenerator; |
4630 | -import dk.aau.cs.gui.SharedPlacesAndTransitionsPanel; |
4631 | -import dk.aau.cs.gui.TabContent; |
4632 | -import dk.aau.cs.model.tapn.SharedPlace; |
4633 | -import dk.aau.cs.model.tapn.SharedTransition; |
4634 | -import dk.aau.cs.model.tapn.TimedArcPetriNet; |
4635 | -import dk.aau.cs.model.tapn.TimedInhibitorArc; |
4636 | -import dk.aau.cs.model.tapn.TimedInputArc; |
4637 | -import dk.aau.cs.model.tapn.TimedOutputArc; |
4638 | -import dk.aau.cs.model.tapn.TimedPlace; |
4639 | -import dk.aau.cs.model.tapn.TimedToken; |
4640 | -import dk.aau.cs.model.tapn.TransportArc; |
4641 | -import dk.aau.cs.util.Require; |
4642 | + |
4643 | +import java.util.ArrayList; |
4644 | +import java.util.List; |
4645 | |
4646 | public class MakeTransitionNewSharedMultiCommand extends Command { |
4647 | private final String newSharedName; |
4648 | @@ -51,22 +32,23 @@ |
4649 | @Override |
4650 | public void redo() { |
4651 | SharedTransition sharedTransition = null; |
4652 | - int i = 0; |
4653 | + boolean first = true; |
4654 | for(Template template : context.tabContent().allTemplates()) { |
4655 | TimedTransitionComponent component = (TimedTransitionComponent)template.guiModel().getTransitionByName(transition.getName()); |
4656 | - //We make a new shared transition with the first transition |
4657 | - if(component != null && i < 1) { |
4658 | - command = new MakeTransitionNewSharedCommand(template.model(), newSharedName, component.underlyingTransition(), context.tabContent(), true); |
4659 | - command.redo(); |
4660 | - sharedTransition = component.underlyingTransition().sharedTransition(); |
4661 | - commands.add(command); |
4662 | - i++; |
4663 | - //For the rest we make them shared with the recently made transition |
4664 | - } else if (component != null && i >= 1){ |
4665 | - command = new MakeTransitionSharedCommand(context.activeModel(), sharedTransition, component.underlyingTransition(), context.tabContent()); |
4666 | - command.redo(); |
4667 | - commands.add(command); |
4668 | - } |
4669 | + |
4670 | + if (component != null) { //We make a new shared transition with the first transition |
4671 | + if (first) { |
4672 | + command = new MakeTransitionNewSharedCommand(template.model(), newSharedName, component.underlyingTransition(), context.tabContent(), true); |
4673 | + command.redo(); |
4674 | + sharedTransition = component.underlyingTransition().sharedTransition(); |
4675 | + commands.add(command); |
4676 | + first = false; |
4677 | + } else { //For the rest we make them shared with the recently made transition |
4678 | + command = new MakeTransitionSharedCommand(context.activeModel(), sharedTransition, component.underlyingTransition(), context.tabContent()); |
4679 | + command.redo(); |
4680 | + commands.add(command); |
4681 | + } |
4682 | + } |
4683 | } |
4684 | } |
4685 | |
4686 | |
4687 | === modified file 'src/dk/aau/cs/gui/undo/MovePlaceTransitionObject.java' |
4688 | --- src/dk/aau/cs/gui/undo/MovePlaceTransitionObject.java 2019-08-15 09:32:19 +0000 |
4689 | +++ src/dk/aau/cs/gui/undo/MovePlaceTransitionObject.java 2020-04-28 09:05:34 +0000 |
4690 | @@ -1,13 +1,9 @@ |
4691 | package dk.aau.cs.gui.undo; |
4692 | |
4693 | import java.awt.Point; |
4694 | -import java.util.Iterator; |
4695 | |
4696 | import pipe.gui.CreateGui; |
4697 | -import pipe.gui.graphicElements.Arc; |
4698 | -import pipe.gui.graphicElements.Place; |
4699 | import pipe.gui.graphicElements.PlaceTransitionObject; |
4700 | -import pipe.gui.graphicElements.Transition; |
4701 | |
4702 | public class MovePlaceTransitionObject extends Command { |
4703 | |
4704 | |
4705 | === modified file 'src/dk/aau/cs/gui/undo/SortSharedTransitionsCommand.java' |
4706 | --- src/dk/aau/cs/gui/undo/SortSharedTransitionsCommand.java 2012-01-27 13:27:31 +0000 |
4707 | +++ src/dk/aau/cs/gui/undo/SortSharedTransitionsCommand.java 2020-04-28 09:05:34 +0000 |
4708 | @@ -1,8 +1,6 @@ |
4709 | package dk.aau.cs.gui.undo; |
4710 | |
4711 | -import dk.aau.cs.gui.SharedPlacesAndTransitionsPanel.SharedPlacesListModel; |
4712 | import dk.aau.cs.gui.SharedPlacesAndTransitionsPanel.SharedTransitionsListModel; |
4713 | -import dk.aau.cs.model.tapn.SharedPlace; |
4714 | import dk.aau.cs.model.tapn.SharedTransition; |
4715 | |
4716 | public class SortSharedTransitionsCommand extends Command { |
4717 | |
4718 | === modified file 'src/dk/aau/cs/gui/undo/SortTemplatesCommand.java' |
4719 | --- src/dk/aau/cs/gui/undo/SortTemplatesCommand.java 2012-01-27 13:27:31 +0000 |
4720 | +++ src/dk/aau/cs/gui/undo/SortTemplatesCommand.java 2020-04-28 09:05:34 +0000 |
4721 | @@ -1,24 +1,21 @@ |
4722 | package dk.aau.cs.gui.undo; |
4723 | |
4724 | -import java.util.Collections; |
4725 | -import java.util.List; |
4726 | - |
4727 | import javax.swing.DefaultListModel; |
4728 | import javax.swing.JList; |
4729 | |
4730 | -import dk.aau.cs.gui.TabComponent; |
4731 | import dk.aau.cs.gui.TabContent; |
4732 | import dk.aau.cs.gui.TemplateExplorer; |
4733 | import dk.aau.cs.model.tapn.TimedArcPetriNet; |
4734 | +import pipe.dataLayer.Template; |
4735 | |
4736 | public class SortTemplatesCommand extends Command{ |
4737 | TimedArcPetriNet[] oldOrder; |
4738 | TabContent tabContent; |
4739 | TemplateExplorer templateExplorer; |
4740 | - JList templateList; |
4741 | - DefaultListModel listModel; |
4742 | + JList<Template> templateList; |
4743 | + DefaultListModel<Template> listModel; |
4744 | |
4745 | - public SortTemplatesCommand(TabContent tabContent, TemplateExplorer templateExplorer, JList templateList, DefaultListModel listModel) { |
4746 | + public SortTemplatesCommand(TabContent tabContent, TemplateExplorer templateExplorer, JList<Template> templateList, DefaultListModel<Template> listModel) { |
4747 | this.templateList = templateList; |
4748 | this.tabContent = tabContent; |
4749 | this.templateExplorer = templateExplorer; |
4750 | @@ -27,7 +24,7 @@ |
4751 | |
4752 | @Override |
4753 | public void undo() { |
4754 | - Object selectedValue = templateList.getSelectedValue(); |
4755 | + Template selectedValue = templateList.getSelectedValue(); |
4756 | tabContent.undoSort(oldOrder); |
4757 | templateExplorer.updateTemplateList(); |
4758 | templateList.setSelectedValue(selectedValue, true); |
4759 | @@ -35,7 +32,7 @@ |
4760 | |
4761 | @Override |
4762 | public void redo() { |
4763 | - Object selectedValue = templateList.getSelectedValue(); |
4764 | + Template selectedValue = templateList.getSelectedValue(); |
4765 | oldOrder = tabContent.sortTemplates(); |
4766 | templateExplorer.updateTemplateList(); |
4767 | templateList.setSelectedValue(selectedValue, true); |
4768 | |
4769 | === modified file 'src/dk/aau/cs/gui/undo/ToggleTransitionUrgent.java' |
4770 | --- src/dk/aau/cs/gui/undo/ToggleTransitionUrgent.java 2013-11-11 13:19:24 +0000 |
4771 | +++ src/dk/aau/cs/gui/undo/ToggleTransitionUrgent.java 2020-04-28 09:05:34 +0000 |
4772 | @@ -15,13 +15,11 @@ |
4773 | @Override |
4774 | public void redo() { |
4775 | transition.setUrgent(!oldValue); |
4776 | - CreateGui.getCurrentTab().repaint(); |
4777 | } |
4778 | |
4779 | @Override |
4780 | public void undo() { |
4781 | transition.setUrgent(oldValue); |
4782 | - CreateGui.getCurrentTab().repaint(); |
4783 | } |
4784 | |
4785 | } |
4786 | |
4787 | === modified file 'src/dk/aau/cs/gui/undo/UpdateNameLabelOffsetCommand.java' |
4788 | --- src/dk/aau/cs/gui/undo/UpdateNameLabelOffsetCommand.java 2019-08-21 12:33:46 +0000 |
4789 | +++ src/dk/aau/cs/gui/undo/UpdateNameLabelOffsetCommand.java 2020-04-28 09:05:34 +0000 |
4790 | @@ -1,12 +1,13 @@ |
4791 | package dk.aau.cs.gui.undo; |
4792 | |
4793 | import pipe.gui.graphicElements.PetriNetObject; |
4794 | +import pipe.gui.graphicElements.PetriNetObjectWithLabel; |
4795 | |
4796 | public class UpdateNameLabelOffsetCommand extends Command { |
4797 | double newXOffset, newYOffset, oldXOffset, oldYOffset; |
4798 | - PetriNetObject obj; |
4799 | + PetriNetObjectWithLabel obj; |
4800 | |
4801 | - public UpdateNameLabelOffsetCommand(double newXOffset, double newYOffset, double oldXOffset, double oldYOffset, PetriNetObject obj) { |
4802 | + public UpdateNameLabelOffsetCommand(double newXOffset, double newYOffset, double oldXOffset, double oldYOffset, PetriNetObjectWithLabel obj) { |
4803 | this.obj = obj; |
4804 | this.newXOffset = newXOffset; |
4805 | this.newYOffset = newYOffset; |
4806 | |
4807 | === modified file 'src/dk/aau/cs/io/LoadedModel.java' |
4808 | --- src/dk/aau/cs/io/LoadedModel.java 2011-03-19 15:50:02 +0000 |
4809 | +++ src/dk/aau/cs/io/LoadedModel.java 2020-04-28 09:05:34 +0000 |
4810 | @@ -1,6 +1,3 @@ |
4811 | -/** |
4812 | - * |
4813 | - */ |
4814 | package dk.aau.cs.io; |
4815 | |
4816 | import java.util.Collection; |
4817 | |
4818 | === modified file 'src/dk/aau/cs/io/ModelLoader.java' |
4819 | --- src/dk/aau/cs/io/ModelLoader.java 2019-11-04 20:28:00 +0000 |
4820 | +++ src/dk/aau/cs/io/ModelLoader.java 2020-04-28 09:05:34 +0000 |
4821 | @@ -7,7 +7,6 @@ |
4822 | import java.io.InputStream; |
4823 | |
4824 | import dk.aau.cs.TCTL.Parsing.ParseException; |
4825 | -import pipe.gui.DrawingSurfaceImpl; |
4826 | |
4827 | public class ModelLoader { |
4828 | |
4829 | @@ -17,13 +16,11 @@ |
4830 | public LoadedModel load(File file) throws Exception{ |
4831 | TapnXmlLoader newFormatLoader = new TapnXmlLoader(); |
4832 | try{ |
4833 | - LoadedModel loadedModel = newFormatLoader.load(file); |
4834 | - return loadedModel; |
4835 | + return newFormatLoader.load(file); |
4836 | }catch(Throwable e1){ |
4837 | try { |
4838 | TapnLegacyXmlLoader oldFormatLoader = new TapnLegacyXmlLoader(); |
4839 | - LoadedModel loadedModel = oldFormatLoader.load(file); |
4840 | - return loadedModel; |
4841 | + return oldFormatLoader.load(file); |
4842 | } catch(Throwable e2) { |
4843 | throw new ParseException(e1.getMessage()); |
4844 | } |
4845 | @@ -44,13 +41,17 @@ |
4846 | System.out.println(e.getMessage()); |
4847 | } |
4848 | try{ |
4849 | + |
4850 | LoadedModel loadedModel = newFormatLoader.load(new ByteArrayInputStream(baos.toByteArray())); |
4851 | return loadedModel; |
4852 | + |
4853 | }catch(Throwable e1){ |
4854 | try { |
4855 | TapnLegacyXmlLoader oldFormatLoader = new TapnLegacyXmlLoader(); |
4856 | + |
4857 | LoadedModel loadedModel = oldFormatLoader.load(new ByteArrayInputStream(baos.toByteArray())); |
4858 | return loadedModel; |
4859 | + |
4860 | } catch(Throwable e2) { |
4861 | throw new ParseException(e1.getMessage()); |
4862 | } |
4863 | |
4864 | === modified file 'src/dk/aau/cs/io/PNMLWriter.java' |
4865 | --- src/dk/aau/cs/io/PNMLWriter.java 2019-11-29 19:12:55 +0000 |
4866 | +++ src/dk/aau/cs/io/PNMLWriter.java 2020-04-28 09:05:34 +0000 |
4867 | @@ -129,22 +129,22 @@ |
4868 | |
4869 | private void appendPlaces(Document document, DataLayer guiModel, Element NET) { |
4870 | Place[] places = guiModel.getPlaces(); |
4871 | - for (int i = 0; i < places.length; i++) { |
4872 | - NET.appendChild(createPlaceElement((TimedPlaceComponent) places[i], guiModel, document)); |
4873 | + for (Place place : places) { |
4874 | + NET.appendChild(createPlaceElement((TimedPlaceComponent) place, guiModel, document)); |
4875 | } |
4876 | } |
4877 | |
4878 | private void appendTransitions(Document document, DataLayer guiModel, Element NET) { |
4879 | Transition[] transitions = guiModel.getTransitions(); |
4880 | - for (int i = 0; i < transitions.length; i++) { |
4881 | - NET.appendChild(createTransitionElement((TimedTransitionComponent)transitions[i], document)); |
4882 | + for (Transition transition : transitions) { |
4883 | + NET.appendChild(createTransitionElement((TimedTransitionComponent) transition, document)); |
4884 | } |
4885 | } |
4886 | |
4887 | private void appendArcs(Document document, DataLayer guiModel, Element NET) { |
4888 | Arc[] arcs = guiModel.getArcs(); |
4889 | - for (int i = 0; i < arcs.length; i++) { |
4890 | - NET.appendChild(createArcElement(arcs[i], guiModel, document)); |
4891 | + for (Arc arc : arcs) { |
4892 | + NET.appendChild(createArcElement(arc, guiModel, document)); |
4893 | } |
4894 | } |
4895 | |
4896 | @@ -228,12 +228,12 @@ |
4897 | arcElement.setAttribute("source", (arc.getSource().getId() != null ? arc.getSource().getId() : "")); |
4898 | arcElement.setAttribute("target", (arc.getTarget().getId() != null ? arc.getTarget().getId() : "")); |
4899 | |
4900 | - if (arc instanceof TimedOutputArcComponent && ((TimedOutputArcComponent)arc).getWeight().value() > 1 ) { |
4901 | + if (arc instanceof TimedOutputArcComponent && arc.getWeight().value() > 1 ) { |
4902 | Element inscription = document.createElement("inscription"); |
4903 | arcElement.appendChild(inscription); |
4904 | Element text = document.createElement("text"); |
4905 | inscription.appendChild(text); |
4906 | - text.setTextContent(((TimedOutputArcComponent)arc).getWeight().nameForSaving(false)+""); |
4907 | + text.setTextContent(arc.getWeight().nameForSaving(false)+""); |
4908 | } |
4909 | |
4910 | if(arc instanceof TimedInhibitorArcComponent){ |
4911 | |
4912 | === modified file 'src/dk/aau/cs/io/PNMLoader.java' |
4913 | --- src/dk/aau/cs/io/PNMLoader.java 2020-01-12 10:11:08 +0000 |
4914 | +++ src/dk/aau/cs/io/PNMLoader.java 2020-04-28 09:05:34 +0000 |
4915 | @@ -23,7 +23,6 @@ |
4916 | |
4917 | import dk.aau.cs.gui.NameGenerator; |
4918 | import dk.aau.cs.model.tapn.Bound; |
4919 | -import dk.aau.cs.model.tapn.IntBound; |
4920 | import dk.aau.cs.model.tapn.IntWeight; |
4921 | import dk.aau.cs.model.tapn.LocalTimedPlace; |
4922 | import dk.aau.cs.model.tapn.TimeInterval; |
4923 | @@ -41,12 +40,9 @@ |
4924 | import pipe.dataLayer.DataLayer; |
4925 | import pipe.dataLayer.TAPNQuery; |
4926 | import pipe.dataLayer.Template; |
4927 | -import pipe.gui.CreateGui; |
4928 | -import pipe.gui.DrawingSurfaceImpl; |
4929 | import pipe.gui.Pipe; |
4930 | import pipe.gui.Zoomer; |
4931 | import pipe.gui.graphicElements.Arc; |
4932 | -import pipe.gui.graphicElements.PetriNetObject; |
4933 | import pipe.gui.graphicElements.PlaceTransitionObject; |
4934 | import pipe.gui.graphicElements.tapn.TimedInhibitorArcComponent; |
4935 | import pipe.gui.graphicElements.tapn.TimedInputArcComponent; |
4936 | @@ -92,11 +88,7 @@ |
4937 | try { |
4938 | DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); |
4939 | return builder.parse(file); |
4940 | - } catch (ParserConfigurationException e) { |
4941 | - return null; |
4942 | - } catch (SAXException e) { |
4943 | - return null; |
4944 | - } catch (IOException e) { |
4945 | + } catch (ParserConfigurationException | IOException | SAXException e) { |
4946 | return null; |
4947 | } |
4948 | } |
4949 | @@ -329,8 +321,8 @@ |
4950 | String arcTempX = position.getAttribute("x"); |
4951 | String arcTempY = position.getAttribute("y"); |
4952 | |
4953 | - float arcPointX = Float.valueOf(arcTempX).floatValue(); |
4954 | - float arcPointY = Float.valueOf(arcTempY).floatValue(); |
4955 | + float arcPointX = Float.valueOf(arcTempX); |
4956 | + float arcPointY = Float.valueOf(arcTempY); |
4957 | arcPointX += Pipe.ARC_CONTROL_POINT_CONSTANT + 1; |
4958 | arcPointY += Pipe.ARC_CONTROL_POINT_CONSTANT + 1; |
4959 | |
4960 | @@ -372,8 +364,8 @@ |
4961 | String x = offset.getAttribute("x"); |
4962 | String y = offset.getAttribute("y"); |
4963 | |
4964 | - int xd = Math.round(Float.valueOf(x).floatValue()); |
4965 | - int yd = Math.round(Float.valueOf(y).floatValue()); |
4966 | + int xd = Math.round(Float.valueOf(x)); |
4967 | + int yd = Math.round(Float.valueOf(y)); |
4968 | |
4969 | return new Point(xd, yd); |
4970 | } |
4971 | @@ -438,9 +430,6 @@ |
4972 | arc.setUnderlyingArc(inputArc); |
4973 | |
4974 | template.guiModel().addPetriNetObject(arc); |
4975 | - |
4976 | - source.addConnectFrom(arc); |
4977 | - target.addConnectTo(arc); |
4978 | } |
4979 | |
4980 | template.model().add(inputArc); |
4981 | @@ -471,8 +460,6 @@ |
4982 | |
4983 | template.guiModel().addPetriNetObject(arc); |
4984 | |
4985 | - source.addConnectFrom(arc); |
4986 | - target.addConnectTo(arc); |
4987 | } |
4988 | |
4989 | template.model().add(outputArc); |
4990 | @@ -494,8 +481,6 @@ |
4991 | template.guiModel().addPetriNetObject(tempArc); |
4992 | template.model().add(inhibArc); |
4993 | |
4994 | - source.addConnectFrom(tempArc); |
4995 | - target.addConnectTo(tempArc); |
4996 | return tempArc; |
4997 | } |
4998 | |
4999 | |
5000 | === modified file 'src/dk/aau/cs/io/ResourceManager.java' |
1) Preferences not being loaded correctly - Fixed