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
=== modified file 'src/dk/aau/cs/gui/TabContent.java'
--- src/dk/aau/cs/gui/TabContent.java 2012-03-04 12:49:10 +0000
+++ src/dk/aau/cs/gui/TabContent.java 2012-03-08 07:33:20 +0000
@@ -69,9 +69,14 @@
69 protected JSplitPane animationHistorySplitter;69 protected JSplitPane animationHistorySplitter;
70 protected SharedPlacesAndTransitionsPanel sharedPTPanel;70 protected SharedPlacesAndTransitionsPanel sharedPTPanel;
71 71
72 // protected JSplitPane outerSplitPane;
73 // protected JSplitPane topSplitPane;
72 protected JSplitPane animatorOuterSplitPane;74 protected JSplitPane animatorOuterSplitPane;
73 protected JSplitPane animatorTopSplitPane;75 protected JSplitPane animatorTopSplitPane;
7476
77 private Integer selectedTemplate = 0;
78 private Boolean selectedTemplateWasActive = false;
79
75 public TabContent() { 80 public TabContent() {
76 for (TimedArcPetriNet net: tapnNetwork.allTemplates()){81 for (TimedArcPetriNet net: tapnNetwork.allTemplates()){
77 guiModels.put(net, new DataLayer());82 guiModels.put(net, new DataLayer());
@@ -126,6 +131,30 @@
126 gbc.weighty = 1.0;131 gbc.weighty = 1.0;
127 editorLeftPane.add(editorOuterSplitPane, gbc);132 editorLeftPane.add(editorOuterSplitPane, gbc);
128 }133 }
134
135 public void selectFirstActiveTemplate(){
136 templateExplorer.selectFirst();
137 }
138
139 public Boolean templateWasActiveBeforeSimulationMode() {
140 return selectedTemplateWasActive;
141 }
142
143 public void resetSelectedTemplateWasActive() {
144 selectedTemplateWasActive = false;
145 }
146
147 public void setSelectedTemplateWasActive() {
148 selectedTemplateWasActive = true;
149 }
150
151 public void rememberSelectedTemplate() {
152 selectedTemplate = templateExplorer.indexOfSelectedTemplate();
153 }
154
155 public void restoreSelectedTemplate() {
156 templateExplorer.restoreSelectedTemplate(selectedTemplate);
157 }
129158
130 public void updateConstantsList() {159 public void updateConstantsList() {
131 constantsPanel.showConstants();160 constantsPanel.showConstants();
@@ -402,7 +431,6 @@
402431
403 public void setQueries(Iterable<TAPNQuery> queries) {432 public void setQueries(Iterable<TAPNQuery> queries) {
404 this.queries.setQueries(queries);433 this.queries.setQueries(queries);
405
406 }434 }
407435
408 public void removeQuery(TAPNQuery queryToRemove) {436 public void removeQuery(TAPNQuery queryToRemove) {
409437
=== modified file 'src/dk/aau/cs/gui/TemplateExplorer.java'
--- src/dk/aau/cs/gui/TemplateExplorer.java 2012-02-28 19:51:27 +0000
+++ src/dk/aau/cs/gui/TemplateExplorer.java 2012-03-08 07:33:20 +0000
@@ -109,6 +109,14 @@
109 undoManager = parent.drawingSurface().getUndoManager();109 undoManager = parent.drawingSurface().getUndoManager();
110 init(hideButtons);110 init(hideButtons);
111 }111 }
112
113 public Integer indexOfSelectedTemplate() {
114 return new Integer(templateList.getSelectedIndex());
115 }
116
117 public void restoreSelectedTemplate(Integer value) {
118 templateList.setSelectedIndex(value);
119 }
112120
113 private void init(boolean hideButtons) {121 private void init(boolean hideButtons) {
114 setLayout(new BorderLayout());122 setLayout(new BorderLayout());
115123
=== modified file 'src/pipe/gui/GuiFrame.java'
--- src/pipe/gui/GuiFrame.java 2012-03-01 11:17:06 +0000
+++ src/pipe/gui/GuiFrame.java 2012-03-08 07:33:20 +0000
@@ -1539,9 +1539,20 @@
1539 1539
1540 if (!appView.isInAnimationMode()) {1540 if (!appView.isInAnimationMode()) {
1541 if (CreateGui.getCurrentTab().numberOfActiveTemplates() > 0) {1541 if (CreateGui.getCurrentTab().numberOfActiveTemplates() > 0) {
1542 CreateGui.getCurrentTab().rememberSelectedTemplate();
1543 if (CreateGui.getCurrentTab().currentTemplate().isActive()){
1544 CreateGui.getCurrentTab().setSelectedTemplateWasActive();
1545 }
1542 restoreMode();1546 restoreMode();
1543 PetriNetObject.ignoreSelection(true);1547 PetriNetObject.ignoreSelection(true);
1544 setAnimationMode(!appView.isInAnimationMode());1548 setAnimationMode(!appView.isInAnimationMode());
1549 if (CreateGui.getCurrentTab().templateWasActiveBeforeSimulationMode()) {
1550 CreateGui.getCurrentTab().restoreSelectedTemplate();
1551 CreateGui.getCurrentTab().resetSelectedTemplateWasActive();
1552 }
1553 else {
1554 CreateGui.getCurrentTab().selectFirstActiveTemplate();
1555 }
1545 } else {1556 } else {
1546 JOptionPane.showMessageDialog(GuiFrame.this, 1557 JOptionPane.showMessageDialog(GuiFrame.this,
1547 "You need at least one active template to enter simulation mode",1558 "You need at least one active template to enter simulation mode",
@@ -1553,7 +1564,7 @@
1553 PetriNetObject.ignoreSelection(false);1564 PetriNetObject.ignoreSelection(false);
1554 appView.getSelectionObject().clearSelection();1565 appView.getSelectionObject().clearSelection();
1555 setAnimationMode(!appView.isInAnimationMode());1566 setAnimationMode(!appView.isInAnimationMode());
15561567 CreateGui.getCurrentTab().restoreSelectedTemplate();
1557 }1568 }
1558 } catch (Exception e) {1569 } catch (Exception e) {
1559 System.err.println(e);1570 System.err.println(e);
@@ -1576,9 +1587,7 @@
1576 a.dispose();1587 a.dispose();
1577 if(getGUIMode().equals(GUIMode.draw)){1588 if(getGUIMode().equals(GUIMode.draw)){
1578 activateSelectAction();1589 activateSelectAction();
1579 }1590 }
1580
1581 CreateGui.getCurrentTab().selectFirstElements();
1582 1591
1583 break;1592 break;
15841593

Subscribers

People subscribed via source and target branches