Merge lp:~tapaal-contributor/tapaal/bug894337 into lp:tapaal

Proposed by Mathias Andersen
Status: Merged
Approved by: Kenneth Yrke Jørgensen
Approved revision: 682
Merged at revision: 679
Proposed branch: lp:~tapaal-contributor/tapaal/bug894337
Merge into: lp:tapaal
Diff against target: 120 lines (+50/-5)
3 files modified
src/dk/aau/cs/gui/TabContent.java (+29/-1)
src/dk/aau/cs/gui/TemplateExplorer.java (+8/-0)
src/pipe/gui/GuiFrame.java (+13/-4)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/bug894337
Reviewer Review Type Date Requested Status
Kenneth Yrke Jørgensen Approve
Jiri Srba Approve
Review via email: mp+96423@code.launchpad.net

Commit message

Selected components, constants, shared items, queries and now remembered when going to simulator and back.

Description of the change

When you return from simulation mode the previous selection of queries, constants and components will now be remembered.

When you enter simulation mode the currently selected component from the editor will also be selected in the simulator. If the currently selected component in the editor is not active the first active component in the list will be selected in the simulator.

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) :
review: Approve
Revision history for this message
Kenneth Yrke Jørgensen (yrke) :
review: Approve (code)
Revision history for this message
TAPAAL Janitor (tapaal) wrote :

Attempt to merge into lp:tapaal failed due to conflicts:

text conflict in src/dk/aau/cs/gui/TabContent.java

Revision history for this message
TAPAAL Janitor (tapaal) wrote :

Attempt to merge into lp:tapaal failed due to conflicts:

text conflict in src/dk/aau/cs/gui/TabContent.java

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

The conflict has been resolved. I guess we can merge it now?

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/dk/aau/cs/gui/TabContent.java'
2--- src/dk/aau/cs/gui/TabContent.java 2012-03-04 12:49:10 +0000
3+++ src/dk/aau/cs/gui/TabContent.java 2012-03-08 07:33:20 +0000
4@@ -69,9 +69,14 @@
5 protected JSplitPane animationHistorySplitter;
6 protected SharedPlacesAndTransitionsPanel sharedPTPanel;
7
8+ // protected JSplitPane outerSplitPane;
9+ // protected JSplitPane topSplitPane;
10 protected JSplitPane animatorOuterSplitPane;
11 protected JSplitPane animatorTopSplitPane;
12
13+ private Integer selectedTemplate = 0;
14+ private Boolean selectedTemplateWasActive = false;
15+
16 public TabContent() {
17 for (TimedArcPetriNet net: tapnNetwork.allTemplates()){
18 guiModels.put(net, new DataLayer());
19@@ -126,6 +131,30 @@
20 gbc.weighty = 1.0;
21 editorLeftPane.add(editorOuterSplitPane, gbc);
22 }
23+
24+ public void selectFirstActiveTemplate(){
25+ templateExplorer.selectFirst();
26+ }
27+
28+ public Boolean templateWasActiveBeforeSimulationMode() {
29+ return selectedTemplateWasActive;
30+ }
31+
32+ public void resetSelectedTemplateWasActive() {
33+ selectedTemplateWasActive = false;
34+ }
35+
36+ public void setSelectedTemplateWasActive() {
37+ selectedTemplateWasActive = true;
38+ }
39+
40+ public void rememberSelectedTemplate() {
41+ selectedTemplate = templateExplorer.indexOfSelectedTemplate();
42+ }
43+
44+ public void restoreSelectedTemplate() {
45+ templateExplorer.restoreSelectedTemplate(selectedTemplate);
46+ }
47
48 public void updateConstantsList() {
49 constantsPanel.showConstants();
50@@ -402,7 +431,6 @@
51
52 public void setQueries(Iterable<TAPNQuery> queries) {
53 this.queries.setQueries(queries);
54-
55 }
56
57 public void removeQuery(TAPNQuery queryToRemove) {
58
59=== modified file 'src/dk/aau/cs/gui/TemplateExplorer.java'
60--- src/dk/aau/cs/gui/TemplateExplorer.java 2012-02-28 19:51:27 +0000
61+++ src/dk/aau/cs/gui/TemplateExplorer.java 2012-03-08 07:33:20 +0000
62@@ -109,6 +109,14 @@
63 undoManager = parent.drawingSurface().getUndoManager();
64 init(hideButtons);
65 }
66+
67+ public Integer indexOfSelectedTemplate() {
68+ return new Integer(templateList.getSelectedIndex());
69+ }
70+
71+ public void restoreSelectedTemplate(Integer value) {
72+ templateList.setSelectedIndex(value);
73+ }
74
75 private void init(boolean hideButtons) {
76 setLayout(new BorderLayout());
77
78=== modified file 'src/pipe/gui/GuiFrame.java'
79--- src/pipe/gui/GuiFrame.java 2012-03-01 11:17:06 +0000
80+++ src/pipe/gui/GuiFrame.java 2012-03-08 07:33:20 +0000
81@@ -1539,9 +1539,20 @@
82
83 if (!appView.isInAnimationMode()) {
84 if (CreateGui.getCurrentTab().numberOfActiveTemplates() > 0) {
85+ CreateGui.getCurrentTab().rememberSelectedTemplate();
86+ if (CreateGui.getCurrentTab().currentTemplate().isActive()){
87+ CreateGui.getCurrentTab().setSelectedTemplateWasActive();
88+ }
89 restoreMode();
90 PetriNetObject.ignoreSelection(true);
91 setAnimationMode(!appView.isInAnimationMode());
92+ if (CreateGui.getCurrentTab().templateWasActiveBeforeSimulationMode()) {
93+ CreateGui.getCurrentTab().restoreSelectedTemplate();
94+ CreateGui.getCurrentTab().resetSelectedTemplateWasActive();
95+ }
96+ else {
97+ CreateGui.getCurrentTab().selectFirstActiveTemplate();
98+ }
99 } else {
100 JOptionPane.showMessageDialog(GuiFrame.this,
101 "You need at least one active template to enter simulation mode",
102@@ -1553,7 +1564,7 @@
103 PetriNetObject.ignoreSelection(false);
104 appView.getSelectionObject().clearSelection();
105 setAnimationMode(!appView.isInAnimationMode());
106-
107+ CreateGui.getCurrentTab().restoreSelectedTemplate();
108 }
109 } catch (Exception e) {
110 System.err.println(e);
111@@ -1576,9 +1587,7 @@
112 a.dispose();
113 if(getGUIMode().equals(GUIMode.draw)){
114 activateSelectAction();
115- }
116-
117- CreateGui.getCurrentTab().selectFirstElements();
118+ }
119
120 break;
121

Subscribers

People subscribed via source and target branches