Merge lp:~danilovesky/workcraft/trunk-menu-tools into lp:workcraft

Proposed by Danil Sokolov
Status: Merged
Merged at revision: 620
Proposed branch: lp:~danilovesky/workcraft/trunk-menu-tools
Merge into: lp:workcraft
Diff against target: 4777 lines (+998/-655)
125 files modified
CircuitPlugin/src/org/workcraft/plugins/circuit/Circuit.java (+2/-1)
CircuitPlugin/src/org/workcraft/plugins/circuit/CircuitComponent.java (+7/-3)
CircuitPlugin/src/org/workcraft/plugins/circuit/Contact.java (+4/-4)
CircuitPlugin/src/org/workcraft/plugins/circuit/Environment.java (+4/-2)
CircuitPlugin/src/org/workcraft/plugins/circuit/FunctionContact.java (+5/-2)
CircuitPlugin/src/org/workcraft/plugins/circuit/VisualCircuitComponent.java (+11/-9)
CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContact.java (+6/-4)
CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContactFormulaProperties.java (+2/-2)
CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionComponent.java (+1/-1)
CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionContact.java (+3/-2)
CircuitPlugin/src/org/workcraft/plugins/circuit/references/CircuitReferenceManager.java (+6/-7)
CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/CircuitConnectionDeserializer.java (+0/-10)
CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/CircuitConnectionSerializer.java (+0/-5)
CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/FunctionSerialiser.java (+8/-5)
CircuitPlugin/src/org/workcraft/plugins/circuit/stg/CircuitStgUtils.java (+13/-9)
CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitTask.java (+8/-7)
CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitTool.java (+1/-1)
CpogsPlugin/src/org/workcraft/plugins/cpog/Arc.java (+8/-11)
CpogsPlugin/src/org/workcraft/plugins/cpog/RhoClause.java (+4/-3)
CpogsPlugin/src/org/workcraft/plugins/cpog/Variable.java (+4/-3)
CpogsPlugin/src/org/workcraft/plugins/cpog/Vertex.java (+4/-3)
CpogsPlugin/src/org/workcraft/plugins/cpog/VisualArc.java (+17/-29)
CpogsPlugin/src/org/workcraft/plugins/cpog/VisualScenario.java (+7/-4)
CpogsPlugin/src/org/workcraft/plugins/cpog/VisualScenarioPage.java (+4/-2)
CpogsPlugin/src/org/workcraft/plugins/cpog/VisualVariable.java (+3/-2)
CpogsPlugin/src/org/workcraft/plugins/cpog/VisualVertex.java (+2/-1)
CpogsPlugin/src/org/workcraft/plugins/cpog/gui/ScencoConfigurationDialog.java (+5/-4)
CpogsPlugin/src/org/workcraft/plugins/cpog/serialisation/BooleanFunctionDeserialiser.java (+2/-1)
CpogsPlugin/src/org/workcraft/plugins/cpog/tasks/ScencoTask.java (+4/-5)
DfsPlugin/src/org/workcraft/plugins/dfs/BinaryRegister.java (+3/-1)
DfsPlugin/src/org/workcraft/plugins/dfs/ControlConnection.java (+2/-1)
DfsPlugin/src/org/workcraft/plugins/dfs/ControlRegister.java (+5/-3)
DfsPlugin/src/org/workcraft/plugins/dfs/CounterflowLogic.java (+8/-4)
DfsPlugin/src/org/workcraft/plugins/dfs/CounterflowRegister.java (+4/-2)
DfsPlugin/src/org/workcraft/plugins/dfs/Logic.java (+5/-2)
DfsPlugin/src/org/workcraft/plugins/dfs/MathDelayNode.java (+4/-0)
DfsPlugin/src/org/workcraft/plugins/dfs/Register.java (+3/-1)
DfsPlugin/src/org/workcraft/plugins/dfs/VisualAbstractRegister.java (+4/-1)
DfsPlugin/src/org/workcraft/plugins/dfs/VisualBinaryRegister.java (+1/-1)
DfsPlugin/src/org/workcraft/plugins/dfs/VisualControlConnection.java (+1/-1)
DfsPlugin/src/org/workcraft/plugins/dfs/VisualControlRegister.java (+2/-2)
DfsPlugin/src/org/workcraft/plugins/dfs/VisualCounterflowLogic.java (+4/-4)
DfsPlugin/src/org/workcraft/plugins/dfs/VisualCounterflowRegister.java (+2/-2)
DfsPlugin/src/org/workcraft/plugins/dfs/VisualDelayComponent.java (+1/-1)
DfsPlugin/src/org/workcraft/plugins/dfs/VisualLogic.java (+2/-2)
DfsPlugin/src/org/workcraft/plugins/dfs/VisualRegister.java (+1/-1)
DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowDeadlockTool.java (+1/-1)
DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowHazardTool.java (+1/-1)
DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowTool.java (+1/-1)
FsmPlugin/src/org/workcraft/plugins/fsm/Event.java (+2/-1)
FsmPlugin/src/org/workcraft/plugins/fsm/Fsm.java (+5/-1)
FsmPlugin/src/org/workcraft/plugins/fsm/InitialStateSupervisor.java (+1/-1)
FsmPlugin/src/org/workcraft/plugins/fsm/State.java (+5/-2)
FsmPlugin/src/org/workcraft/plugins/fsm/SymbolConsistencySupervisor.java (+1/-1)
FsmPlugin/src/org/workcraft/plugins/fsm/VisualEvent.java (+5/-1)
FsmPlugin/src/org/workcraft/plugins/fsm/VisualState.java (+2/-2)
FsmPlugin/src/org/workcraft/plugins/fsm/propertydescriptors/EventSymbolPropertyDescriptor.java (+1/-1)
FsmPlugin/src/org/workcraft/plugins/fsm/propertydescriptors/SymbolPropertyDescriptor.java (+1/-1)
FsmPlugin/src/org/workcraft/plugins/fsm/tools/DeadlockCheckerTool.java (+1/-1)
FsmPlugin/src/org/workcraft/plugins/fsm/tools/DeterminismCheckerTool.java (+1/-1)
FsmPlugin/src/org/workcraft/plugins/fsm/tools/ReachabilityCheckerTool.java (+1/-1)
FsmPlugin/src/org/workcraft/plugins/fsm/tools/ReversibilityCheckerTool.java (+1/-1)
FstPlugin/src/org/workcraft/plugins/fst/Fst.java (+13/-8)
FstPlugin/src/org/workcraft/plugins/fst/Signal.java (+3/-1)
FstPlugin/src/org/workcraft/plugins/fst/SignalEvent.java (+3/-1)
FstPlugin/src/org/workcraft/plugins/fst/propertydescriptors/DirectionPropertyDescriptor.java (+1/-1)
FstPlugin/src/org/workcraft/plugins/fst/propertydescriptors/TypePropertyDescriptor.java (+2/-1)
FstPlugin/src/org/workcraft/plugins/fst/tools/FstSimulationTool.java (+1/-1)
MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/AbstractMpsatChecker.java (+1/-1)
MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatConformationChecker.java (+1/-1)
MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatCustomPropertyChecker.java (+1/-1)
MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatSynthesis.java (+1/-1)
PetriNetPlugin/src/org/workcraft/plugins/petri/Place.java (+5/-2)
PetriNetPlugin/src/org/workcraft/plugins/petri/VisualPlace.java (+5/-4)
PetriNetPlugin/src/org/workcraft/plugins/petri/tools/PetriNetSimulationTool.java (+14/-8)
PetrifyPlugin/src/org/workcraft/plugins/petrify/tools/PetrifySynthesis.java (+2/-2)
PolicyNetPlugin/src/org/workcraft/plugins/policy/Bundle.java (+9/-4)
PolicyNetPlugin/src/org/workcraft/plugins/policy/VisualBundle.java (+3/-1)
PolicyNetPlugin/src/org/workcraft/plugins/policy/tools/CheckDeadlockTool.java (+1/-1)
SONPlugin/src/org/workcraft/plugins/son/gui/OutputArea.java (+1/-1)
STGPlugin/src/org/workcraft/plugins/stg/DummyTransition.java (+2/-1)
STGPlugin/src/org/workcraft/plugins/stg/SignalTransition.java (+7/-3)
STGPlugin/src/org/workcraft/plugins/stg/SignalTypeConsistencySupervisor.java (+4/-3)
STGPlugin/src/org/workcraft/plugins/stg/VisualImplicitPlaceArc.java (+4/-4)
STGPlugin/src/org/workcraft/plugins/stg/VisualSTG.java (+5/-2)
STGPlugin/src/org/workcraft/plugins/stg/propertydescriptors/DirectionPropertyDescriptor.java (+2/-1)
STGPlugin/src/org/workcraft/plugins/stg/propertydescriptors/TypePropertyDescriptor.java (+3/-1)
STGPlugin/src/org/workcraft/plugins/stg/tools/StgSimulationTool.java (+18/-12)
WorkcraftCore/src/org/workcraft/dom/hierarchy/NamespaceHelper.java (+3/-3)
WorkcraftCore/src/org/workcraft/dom/references/HierarchicalUniqueNameReferenceManager.java (+2/-2)
WorkcraftCore/src/org/workcraft/dom/visual/FontHelper.java (+13/-0)
WorkcraftCore/src/org/workcraft/dom/visual/VisualComponent.java (+22/-14)
WorkcraftCore/src/org/workcraft/dom/visual/VisualGroup.java (+2/-4)
WorkcraftCore/src/org/workcraft/dom/visual/VisualPage.java (+5/-2)
WorkcraftCore/src/org/workcraft/dom/visual/connections/VisualConnection.java (+20/-13)
WorkcraftCore/src/org/workcraft/gui/DockableWindow.java (+12/-4)
WorkcraftCore/src/org/workcraft/gui/DockableWindowContentPanel.java (+5/-1)
WorkcraftCore/src/org/workcraft/gui/LookAndFeelHelper.java (+38/-27)
WorkcraftCore/src/org/workcraft/gui/MainMenu.java (+117/-115)
WorkcraftCore/src/org/workcraft/gui/MainWindow.java (+60/-46)
WorkcraftCore/src/org/workcraft/gui/MainWindowActions.java (+16/-4)
WorkcraftCore/src/org/workcraft/gui/PropertyEditorWindow.java (+5/-5)
WorkcraftCore/src/org/workcraft/gui/SilverOceanTheme.java (+132/-0)
WorkcraftCore/src/org/workcraft/gui/graph/GraphEditorPanel.java (+15/-14)
WorkcraftCore/src/org/workcraft/gui/propertyeditor/BooleanCellEditor.java (+12/-11)
WorkcraftCore/src/org/workcraft/gui/propertyeditor/ChoiceCellEditor.java (+4/-1)
WorkcraftCore/src/org/workcraft/gui/propertyeditor/ColorCellEditor.java (+4/-4)
WorkcraftCore/src/org/workcraft/gui/propertyeditor/ColorCellRenderer.java (+11/-27)
WorkcraftCore/src/org/workcraft/gui/propertyeditor/DefaultCellRenderer.java (+6/-3)
WorkcraftCore/src/org/workcraft/gui/propertyeditor/FileCellEditor.java (+7/-6)
WorkcraftCore/src/org/workcraft/gui/propertyeditor/GenericCellEditor.java (+4/-2)
WorkcraftCore/src/org/workcraft/gui/propertyeditor/ModelProperties.java (+13/-9)
WorkcraftCore/src/org/workcraft/gui/propertyeditor/NamePropertyDescriptor.java (+4/-2)
WorkcraftCore/src/org/workcraft/gui/propertyeditor/PropertyEditorTable.java (+60/-23)
WorkcraftCore/src/org/workcraft/gui/propertyeditor/PropertyEditorTableModel.java (+32/-27)
WorkcraftCore/src/org/workcraft/gui/propertyeditor/StringProperty.java (+1/-1)
WorkcraftCore/src/org/workcraft/gui/trees/TreeWindow.java (+2/-1)
WorkcraftCore/src/org/workcraft/gui/workspace/WorkspacePopupProvider.java (+14/-17)
WorkcraftCore/src/org/workcraft/serialisation/xml/XMLDeserialiserState.java (+1/-1)
WorkcraftCore/src/org/workcraft/util/Tools.java (+2/-2)
WorkcraftCore/src/org/workcraft/workspace/WorkspaceEntry.java (+2/-2)
XmasPlugin/src/org/workcraft/plugins/xmas/components/QueueComponent.java (+3/-2)
XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualQueueComponent.java (+4/-2)
XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualSourceComponent.java (+3/-1)
XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualXmasContact.java (+3/-1)
To merge this branch: bzr merge lp:~danilovesky/workcraft/trunk-menu-tools
Reviewer Review Type Date Requested Status
Danil Sokolov Approve
Review via email: mp+263173@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Danil Sokolov (danilovesky) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/Circuit.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/Circuit.java 2015-05-27 12:14:35 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/Circuit.java 2015-06-26 22:23:53 +0000
@@ -32,6 +32,7 @@
32import org.workcraft.dom.math.MathNode;32import org.workcraft.dom.math.MathNode;
33import org.workcraft.exceptions.InvalidConnectionException;33import org.workcraft.exceptions.InvalidConnectionException;
34import org.workcraft.gui.propertyeditor.ModelProperties;34import org.workcraft.gui.propertyeditor.ModelProperties;
35import org.workcraft.gui.propertyeditor.NamePropertyDescriptor;
35import org.workcraft.plugins.circuit.Contact.IOType;36import org.workcraft.plugins.circuit.Contact.IOType;
36import org.workcraft.plugins.circuit.references.CircuitReferenceManager;37import org.workcraft.plugins.circuit.references.CircuitReferenceManager;
37import org.workcraft.serialisation.References;38import org.workcraft.serialisation.References;
@@ -88,7 +89,7 @@
88 ModelProperties properties = super.getProperties(node);89 ModelProperties properties = super.getProperties(node);
89 if (node != null) {90 if (node != null) {
90 if (node instanceof Joint) {91 if (node instanceof Joint) {
91 properties.removeByName("Name");92 properties.removeByName(NamePropertyDescriptor.PROPERTY_NAME);
92 }93 }
93 }94 }
94 return properties;95 return properties;
9596
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/CircuitComponent.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/CircuitComponent.java 2015-05-20 16:27:35 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/CircuitComponent.java 2015-06-26 22:23:53 +0000
@@ -44,6 +44,10 @@
44@VisualClass(org.workcraft.plugins.circuit.VisualCircuitComponent.class)44@VisualClass(org.workcraft.plugins.circuit.VisualCircuitComponent.class)
45public class CircuitComponent extends MathGroup implements Container, ObservableHierarchy {45public class CircuitComponent extends MathGroup implements Container, ObservableHierarchy {
46 46
47 public static final String PROPERTY_NAME = "Name";
48 public static final String PROPERTY_IS_ENVIRONMENT = "Treat as environment";
49 public static final String PROPERTY_IS_ZERO_DELAY = "Zero delay";
50
47 private final class CircuitHierarchySupervisor extends HierarchySupervisor {51 private final class CircuitHierarchySupervisor extends HierarchySupervisor {
48 @Override52 @Override
49 public void handleEvent(HierarchyEvent e) {53 public void handleEvent(HierarchyEvent e) {
@@ -79,7 +83,7 @@
79 83
80 public void setIsEnvironment(boolean value) {84 public void setIsEnvironment(boolean value) {
81 this.isEnvironment = value;85 this.isEnvironment = value;
82 sendNotification(new PropertyChangedEvent(this, "is environment"));86 sendNotification(new PropertyChangedEvent(this, PROPERTY_IS_ENVIRONMENT));
83 }87 }
8488
85 public boolean getIsEnvironment() {89 public boolean getIsEnvironment() {
@@ -88,7 +92,7 @@
8892
89 public void setIsZeroDelay(boolean value) {93 public void setIsZeroDelay(boolean value) {
90 this.isZeroDelay = value;94 this.isZeroDelay = value;
91 sendNotification(new PropertyChangedEvent(this, "is zero delay"));95 sendNotification(new PropertyChangedEvent(this, PROPERTY_IS_ZERO_DELAY));
92 }96 }
9397
94 public boolean getIsZeroDelay() {98 public boolean getIsZeroDelay() {
@@ -194,7 +198,7 @@
194198
195 public void setName(String name) {199 public void setName(String name) {
196 this.name = name;200 this.name = name;
197 sendNotification(new PropertyChangedEvent(this, "name"));201 sendNotification(new PropertyChangedEvent(this, PROPERTY_NAME));
198 }202 }
199203
200 public String getName() {204 public String getName() {
201205
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/Contact.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/Contact.java 2015-05-15 14:41:05 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/Contact.java 2015-06-26 22:23:53 +0000
@@ -30,10 +30,10 @@
30@VisualClass(org.workcraft.plugins.circuit.VisualContact.class)30@VisualClass(org.workcraft.plugins.circuit.VisualContact.class)
31public class Contact extends MathNode implements BooleanVariable {31public class Contact extends MathNode implements BooleanVariable {
32 32
33 public static final String PROPERTY_INIT_TO_ONE = "init to one";33 public static final String PROPERTY_INIT_TO_ONE = "Init to one";
34 public static final String PROPERTY_IO_TYPE = "IO type";34 public static final String PROPERTY_IO_TYPE = "I/O type";
3535 public static final String PROPERTY_NAME = "Name";
36 public static final String PROPERTY_NAME = "name";36
37 public enum IOType {37 public enum IOType {
38 INPUT("Input"),38 INPUT("Input"),
39 OUTPUT("Output");39 OUTPUT("Output");
4040
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/Environment.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/Environment.java 2015-02-09 10:46:28 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/Environment.java 2015-06-26 22:23:53 +0000
@@ -6,6 +6,8 @@
6import org.workcraft.observation.PropertyChangedEvent;6import org.workcraft.observation.PropertyChangedEvent;
77
8public class Environment extends MathNode {8public class Environment extends MathNode {
9 public static final String PROPERTY_FILE = "file";
10 public static final String PROPERTY_BASE = "base";
9 private File file;11 private File file;
10 private File base;12 private File base;
11 13
@@ -19,7 +21,7 @@
19 21
20 public void setFile(File file) {22 public void setFile(File file) {
21 this.file = file;23 this.file = file;
22 sendNotification(new PropertyChangedEvent(this, "file"));24 sendNotification(new PropertyChangedEvent(this, PROPERTY_FILE));
23 }25 }
2426
25 public File getBase() {27 public File getBase() {
@@ -28,7 +30,7 @@
2830
29 public void setBase(File base) {31 public void setBase(File base) {
30 this.base = base;32 this.base = base;
31 sendNotification(new PropertyChangedEvent(this, "base"));33 sendNotification(new PropertyChangedEvent(this, PROPERTY_BASE));
32 }34 }
33 35
34}36}
3537
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/FunctionContact.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/FunctionContact.java 2014-09-05 14:09:00 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/FunctionContact.java 2015-06-26 22:23:53 +0000
@@ -27,6 +27,9 @@
2727
28@VisualClass(org.workcraft.plugins.circuit.VisualFunctionContact.class)28@VisualClass(org.workcraft.plugins.circuit.VisualFunctionContact.class)
29public class FunctionContact extends Contact {29public class FunctionContact extends Contact {
30 public static final String PROPERTY_SET_FUNCTION = "Set function";
31 public static final String PROPERTY_RESET_FUNCTION = "Reset function";
32
30 private BooleanFormula setFunction = null;33 private BooleanFormula setFunction = null;
31 private BooleanFormula resetFunction = null;34 private BooleanFormula resetFunction = null;
32 35
@@ -44,7 +47,7 @@
44 47
45 public void setSetFunction(BooleanFormula setFunction) {48 public void setSetFunction(BooleanFormula setFunction) {
46 this.setFunction = setFunction;49 this.setFunction = setFunction;
47 sendNotification(new PropertyChangedEvent(this, "setFunction"));50 sendNotification(new PropertyChangedEvent(this, PROPERTY_SET_FUNCTION));
48 }51 }
49 52
50 public BooleanFormula getResetFunction() {53 public BooleanFormula getResetFunction() {
@@ -53,7 +56,7 @@
53 56
54 public void setResetFunction(BooleanFormula resetFunction) {57 public void setResetFunction(BooleanFormula resetFunction) {
55 this.resetFunction = resetFunction;58 this.resetFunction = resetFunction;
56 sendNotification(new PropertyChangedEvent(this, "resetFunction"));59 sendNotification(new PropertyChangedEvent(this, PROPERTY_RESET_FUNCTION));
57 }60 }
5861
59}62}
6063
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/VisualCircuitComponent.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/VisualCircuitComponent.java 2015-05-22 17:42:39 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/VisualCircuitComponent.java 2015-06-26 22:23:53 +0000
@@ -74,6 +74,8 @@
74@SVGIcon("images/icons/svg/circuit-component.svg")74@SVGIcon("images/icons/svg/circuit-component.svg")
75public class VisualCircuitComponent extends VisualComponent implements75public class VisualCircuitComponent extends VisualComponent implements
76 Container, CustomTouchable, StateObserver, ObservableHierarchy {76 Container, CustomTouchable, StateObserver, ObservableHierarchy {
77 public static final String PROPERTY_RENDER_TYPE = "Render type";
78
77 private Color inputColor = VisualContact.inputColor;79 private Color inputColor = VisualContact.inputColor;
78 private Color outputColor = VisualContact.outputColor;80 private Color outputColor = VisualContact.outputColor;
7981
@@ -97,7 +99,7 @@
9799
98 private void addPropertyDeclarations() {100 private void addPropertyDeclarations() {
99 addPropertyDeclaration(new PropertyDeclaration<VisualCircuitComponent, Boolean>(101 addPropertyDeclaration(new PropertyDeclaration<VisualCircuitComponent, Boolean>(
100 this, "Treat as environment", Boolean.class) {102 this, CircuitComponent.PROPERTY_IS_ENVIRONMENT, Boolean.class) {
101 protected void setter(VisualCircuitComponent object, Boolean value) {103 protected void setter(VisualCircuitComponent object, Boolean value) {
102 object.setIsEnvironment(value);104 object.setIsEnvironment(value);
103 }105 }
@@ -108,7 +110,7 @@
108 });110 });
109//TODO: Complete support for zero-delay buffers and inverters.111//TODO: Complete support for zero-delay buffers and inverters.
110// addPropertyDeclaration(new PropertyDeclaration<VisualCircuitComponent, Boolean>(112// addPropertyDeclaration(new PropertyDeclaration<VisualCircuitComponent, Boolean>(
111// this, "Zero delay", Boolean.class) {113// this, CircuitComponent.PROPERTY_IS_ZERO_DELAY, Boolean.class) {
112// protected void setter(VisualCircuitComponent object, Boolean value) {114// protected void setter(VisualCircuitComponent object, Boolean value) {
113// object.setIsZeroDelay(value);115// object.setIsZeroDelay(value);
114// }116// }
@@ -119,7 +121,7 @@
119// });121// });
120122
121 addPropertyDeclaration(new PropertyDeclaration<VisualCircuitComponent, RenderType>(123 addPropertyDeclaration(new PropertyDeclaration<VisualCircuitComponent, RenderType>(
122 this, "Render type", RenderType.class) {124 this, PROPERTY_RENDER_TYPE, RenderType.class) {
123 protected void setter(VisualCircuitComponent object, RenderType value) {125 protected void setter(VisualCircuitComponent object, RenderType value) {
124 object.setRenderType(value);126 object.setRenderType(value);
125 }127 }
@@ -197,7 +199,7 @@
197 this.renderType = renderType;199 this.renderType = renderType;
198 setContactsDefaultPosition();200 setContactsDefaultPosition();
199 invalidateBoundingBox();201 invalidateBoundingBox();
200 sendNotification(new PropertyChangedEvent(this, "render type"));202 sendNotification(new PropertyChangedEvent(this, PROPERTY_RENDER_TYPE));
201 }203 }
202 }204 }
203 205
@@ -795,11 +797,11 @@
795 if (e instanceof PropertyChangedEvent) {797 if (e instanceof PropertyChangedEvent) {
796 PropertyChangedEvent pc = (PropertyChangedEvent) e;798 PropertyChangedEvent pc = (PropertyChangedEvent) e;
797 String propertyName = pc.getPropertyName();799 String propertyName = pc.getPropertyName();
798 if (propertyName.equals("name")800 if (propertyName.equals(Contact.PROPERTY_NAME)
799 || propertyName.equals("IOtype")801 || propertyName.equals(Contact.PROPERTY_IO_TYPE)
800 || propertyName.equals("direction")802 || propertyName.equals(VisualContact.PROPERTY_DIRECTION)
801 || propertyName.equals("setFunction")803 || propertyName.equals(FunctionContact.PROPERTY_SET_FUNCTION)
802 || propertyName.equals("resetFunction")) {804 || propertyName.equals(FunctionContact.PROPERTY_RESET_FUNCTION)) {
803805
804 for (Node node : getChildren()) {806 for (Node node : getChildren()) {
805 if (node instanceof VisualFunctionContact) {807 if (node instanceof VisualFunctionContact) {
806808
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContact.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContact.java 2015-04-23 18:20:32 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContact.java 2015-06-26 22:23:53 +0000
@@ -50,6 +50,8 @@
5050
51public class VisualContact extends VisualComponent implements StateObserver {51public class VisualContact extends VisualComponent implements StateObserver {
5252
53 public static final String PROPERTY_DIRECTION = "Direction";
54
53 public enum Direction { 55 public enum Direction {
54 WEST("West"),56 WEST("West"),
55 NORTH("North"),57 NORTH("North"),
@@ -151,7 +153,7 @@
151 153
152 private void addPropertyDeclarations() {154 private void addPropertyDeclarations() {
153 addPropertyDeclaration(new PropertyDeclaration<VisualContact, Direction>(155 addPropertyDeclaration(new PropertyDeclaration<VisualContact, Direction>(
154 this, "Direction", Direction.class) {156 this, PROPERTY_DIRECTION, Direction.class) {
155 protected void setter(VisualContact object, Direction value) {157 protected void setter(VisualContact object, Direction value) {
156 object.setDirection(value);158 object.setDirection(value);
157 }159 }
@@ -161,7 +163,7 @@
161 });163 });
162164
163 addPropertyDeclaration(new PropertyDeclaration<VisualContact, IOType>(165 addPropertyDeclaration(new PropertyDeclaration<VisualContact, IOType>(
164 this, "I/O type", IOType.class, true, true, false) {166 this, Contact.PROPERTY_IO_TYPE, IOType.class, true, true, false) {
165 protected void setter(VisualContact object, IOType value) {167 protected void setter(VisualContact object, IOType value) {
166 object.getReferencedContact().setIOType(value);168 object.getReferencedContact().setIOType(value);
167 }169 }
@@ -171,7 +173,7 @@
171 });173 });
172174
173 addPropertyDeclaration(new PropertyDeclaration<VisualContact, Boolean>(175 addPropertyDeclaration(new PropertyDeclaration<VisualContact, Boolean>(
174 this, "Init to one", Boolean.class) {176 this, Contact.PROPERTY_INIT_TO_ONE, Boolean.class) {
175 protected void setter(VisualContact object, Boolean value) {177 protected void setter(VisualContact object, Boolean value) {
176 object.getReferencedContact().setInitToOne(value);178 object.getReferencedContact().setInitToOne(value);
177 }179 }
@@ -322,7 +324,7 @@
322 if (value != direction) {324 if (value != direction) {
323 sendNotification(new TransformChangingEvent(this));325 sendNotification(new TransformChangingEvent(this));
324 this.direction = value;326 this.direction = value;
325 sendNotification(new PropertyChangedEvent(this, "direction"));327 sendNotification(new PropertyChangedEvent(this, PROPERTY_DIRECTION));
326 sendNotification(new TransformChangedEvent(this));328 sendNotification(new TransformChangedEvent(this));
327 }329 }
328 } 330 }
329331
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContactFormulaProperties.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContactFormulaProperties.java 2015-04-13 18:41:37 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContactFormulaProperties.java 2015-06-26 22:23:53 +0000
@@ -50,7 +50,7 @@
50 @Override50 @Override
51 public void setValue(Object value) throws InvocationTargetException {51 public void setValue(Object value) throws InvocationTargetException {
52 String setFunction = (String)value;52 String setFunction = (String)value;
53 if (!setFunction.equals("")) {53 if (!setFunction.isEmpty()) {
54 contact.setSetFunction(parseFormula(contact, setFunction));54 contact.setSetFunction(parseFormula(contact, setFunction));
55 } else {55 } else {
56 contact.setSetFunction(null);56 contact.setSetFunction(null);
@@ -100,7 +100,7 @@
100 @Override100 @Override
101 public void setValue(Object value) throws InvocationTargetException {101 public void setValue(Object value) throws InvocationTargetException {
102 String setFunction = (String)value;102 String setFunction = (String)value;
103 if (!setFunction.equals("")) {103 if (!setFunction.isEmpty()) {
104 contact.setResetFunction(parseFormula(contact, setFunction));104 contact.setResetFunction(parseFormula(contact, setFunction));
105 } else {105 } else {
106 contact.setResetFunction(null);106 contact.setResetFunction(null);
107107
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionComponent.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionComponent.java 2015-05-23 21:39:28 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionComponent.java 2015-06-26 22:23:53 +0000
@@ -165,7 +165,7 @@
165 super.notify(e);165 super.notify(e);
166 if (e instanceof PropertyChangedEvent) {166 if (e instanceof PropertyChangedEvent) {
167 PropertyChangedEvent pc = (PropertyChangedEvent)e;167 PropertyChangedEvent pc = (PropertyChangedEvent)e;
168 if (pc.getPropertyName().equals("direction")) {168 if (pc.getPropertyName().equals(VisualContact.PROPERTY_DIRECTION)) {
169 if ((getMainContact() == pc.getSender()) && (getRenderingResult() != null)) {169 if ((getMainContact() == pc.getSender()) && (getRenderingResult() != null)) {
170 setContactsDefaultPosition();170 setContactsDefaultPosition();
171 }171 }
172172
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionContact.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionContact.java 2015-02-18 16:25:29 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionContact.java 2015-06-26 22:23:53 +0000
@@ -326,10 +326,11 @@
326 public void notify(StateEvent e) {326 public void notify(StateEvent e) {
327 if (e instanceof PropertyChangedEvent) {327 if (e instanceof PropertyChangedEvent) {
328 PropertyChangedEvent pc = (PropertyChangedEvent)e;328 PropertyChangedEvent pc = (PropertyChangedEvent)e;
329 if (pc.getPropertyName().equals("setFunction") || pc.getPropertyName().equals("resetFunction")) {329 String propertyName = pc.getPropertyName();
330 if (propertyName.equals(FunctionContact.PROPERTY_SET_FUNCTION) || propertyName.equals(FunctionContact.PROPERTY_RESET_FUNCTION)) {
330 invalidateRenderedFormula();331 invalidateRenderedFormula();
331 }332 }
332 if (pc.getPropertyName().equals("name")) {333 if (propertyName.equals(Contact.PROPERTY_NAME)) {
333 for (VisualFunctionContact vc : getAllContacts()) {334 for (VisualFunctionContact vc : getAllContacts()) {
334 vc.invalidateRenderedFormula();335 vc.invalidateRenderedFormula();
335 }336 }
336337
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/references/CircuitReferenceManager.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/references/CircuitReferenceManager.java 2014-09-27 20:09:17 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/references/CircuitReferenceManager.java 2015-06-26 22:23:53 +0000
@@ -35,17 +35,16 @@
35 public void setName(Node node, String name) {35 public void setName(Node node, String name) {
36 // support for the older models36 // support for the older models
37 if (Identifier.isNumber(name) && node instanceof Contact) {37 if (Identifier.isNumber(name) && node instanceof Contact) {
38 String n = ((Contact)node).getName();38 String nodeName = ((Contact)node).getName();
39 if ((n != null) && !n.equals("")) {39 if ((nodeName != null) && !nodeName.isEmpty()) {
40 name = n;40 name = nodeName;
41 }41 }
42 } else if (Identifier.isNumber(name) && node instanceof CircuitComponent) {42 } else if (Identifier.isNumber(name) && node instanceof CircuitComponent) {
43 String n = ((CircuitComponent)node).getName();43 String nodeName = ((CircuitComponent)node).getName();
44 if ((n != null) && !n.equals("")) {44 if ((nodeName != null) && !nodeName.isEmpty()) {
45 name = n;45 name = nodeName;
46 }46 }
47 } else if (Identifier.isNumber(name)) {47 } else if (Identifier.isNumber(name)) {
48 // name="_"+name;
49 name = getPrefix(node) + name;48 name = getPrefix(node) + name;
50 }49 }
51 if (node instanceof Contact) {50 if (node instanceof Contact) {
5251
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/CircuitConnectionDeserializer.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/CircuitConnectionDeserializer.java 2010-10-26 23:44:40 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/CircuitConnectionDeserializer.java 2015-06-26 22:23:53 +0000
@@ -23,16 +23,6 @@
23 ReferenceResolver internalReferenceResolver,23 ReferenceResolver internalReferenceResolver,
24 ReferenceResolver externalReferenceResolver,24 ReferenceResolver externalReferenceResolver,
25 NodeFinaliser nodeFinaliser) throws DeserialisationException {25 NodeFinaliser nodeFinaliser) throws DeserialisationException {
26
27 /* VisualCircuitConnection vc = (VisualCircuitConnection) instance;
28
29 vc.setVisualConnectionDependencies(
30 (VisualComponent)externalReferenceResolver.getObject(element.getAttribute("first")),
31 (VisualComponent)externalReferenceResolver.getObject(element.getAttribute("second")),
32 new Polyline(vc),
33 (CircuitConnection)externalReferenceResolver.getObject(element.getAttribute("ref"))
34 );*/
35
36 }26 }
3727
38 @Override28 @Override
3929
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/CircuitConnectionSerializer.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/CircuitConnectionSerializer.java 2010-10-26 23:44:40 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/CircuitConnectionSerializer.java 2015-06-26 22:23:53 +0000
@@ -14,11 +14,6 @@
14 ReferenceProducer internalReferences,14 ReferenceProducer internalReferences,
15 ReferenceProducer externalReferences, NodeSerialiser nodeSerialiser)15 ReferenceProducer externalReferences, NodeSerialiser nodeSerialiser)
16 throws SerialisationException {16 throws SerialisationException {
17
18/* VisualCircuitConnection vc = (VisualCircuitConnection) object;
19 element.setAttribute("first", internalReferences.getReference(vc.getFirst()));
20 element.setAttribute("second", internalReferences.getReference(vc.getSecond()));
21 */
22 }17 }
2318
24 @Override19 @Override
2520
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/FunctionSerialiser.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/FunctionSerialiser.java 2010-10-26 23:44:40 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/FunctionSerialiser.java 2015-06-26 22:23:53 +0000
@@ -35,8 +35,7 @@
35 public static final String SET_FUNCTION_ATTRIBUTE_NAME = "setFunction";35 public static final String SET_FUNCTION_ATTRIBUTE_NAME = "setFunction";
3636
37 @Override37 @Override
38 public String getClassName()38 public String getClassName() {
39 {
40 return org.workcraft.plugins.circuit.FunctionContact.class.getName();39 return org.workcraft.plugins.circuit.FunctionContact.class.getName();
41 }40 }
4241
@@ -47,7 +46,11 @@
47 throws SerialisationException {46 throws SerialisationException {
48 FunctionContact function = (FunctionContact) object;47 FunctionContact function = (FunctionContact) object;
49 48
50 BooleanFormulaSerialiser.writeFormulaAttribute(element, internalReferences, function.getSetFunction(), SET_FUNCTION_ATTRIBUTE_NAME);49 BooleanFormulaSerialiser.writeFormulaAttribute(element, internalReferences,
51 BooleanFormulaSerialiser.writeFormulaAttribute(element, internalReferences, function.getResetFunction(), RESET_FUNCTION_ATTRIBUTE_NAME);50 function.getSetFunction(), SET_FUNCTION_ATTRIBUTE_NAME);
51
52 BooleanFormulaSerialiser.writeFormulaAttribute(element, internalReferences,
53 function.getResetFunction(), RESET_FUNCTION_ATTRIBUTE_NAME);
52 }54 }
53}
54\ No newline at end of file55\ No newline at end of file
56
57}
5558
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/stg/CircuitStgUtils.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/stg/CircuitStgUtils.java 2015-04-28 17:37:41 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/stg/CircuitStgUtils.java 2015-06-26 22:23:53 +0000
@@ -17,11 +17,16 @@
17import org.workcraft.tasks.Result;17import org.workcraft.tasks.Result;
18import org.workcraft.tasks.Result.Outcome;18import org.workcraft.tasks.Result.Outcome;
19import org.workcraft.util.Export;19import org.workcraft.util.Export;
20import org.workcraft.util.Export.ExportTask;
20import org.workcraft.util.FileUtils;21import org.workcraft.util.FileUtils;
21import org.workcraft.util.Export.ExportTask;
22import org.workcraft.workspace.WorkspaceEntry;22import org.workcraft.workspace.WorkspaceEntry;
2323
24public class CircuitStgUtils {24public class CircuitStgUtils {
25 public static final String TEMP_DIRECTORY_PREFIX = "workcraft-";
26 public static final String DEVICE_FILE_NAME = "device";
27 public static final String ENVIRONMENT_FILE_NAME = "environment";
28 public static final String SYSTEM_FILE_NAME = "system";
29 public static final String ASTG_FILE_EXT = ".g";
25 30
26 public static CircuitToStgConverter createCircuitToStgConverter(VisualCircuit circuit) {31 public static CircuitToStgConverter createCircuitToStgConverter(VisualCircuit circuit) {
27 CircuitToStgConverter generator = new CircuitToStgConverter(circuit);32 CircuitToStgConverter generator = new CircuitToStgConverter(circuit);
@@ -39,7 +44,7 @@
39 public static VisualSTG composeDevStgWithEvnFile(VisualSTG devStg, File envFile) {44 public static VisualSTG composeDevStgWithEvnFile(VisualSTG devStg, File envFile) {
40 VisualSTG resultStg = null;45 VisualSTG resultStg = null;
41 Framework framework = Framework.getInstance();46 Framework framework = Framework.getInstance();
42 File workingDirectory = FileUtils.createTempDirectory("workcraft-");47 File workingDirectory = FileUtils.createTempDirectory(TEMP_DIRECTORY_PREFIX);
43 try {48 try {
44 File devStgFile = exportDevStg(devStg, workingDirectory);49 File devStgFile = exportDevStg(devStg, workingDirectory);
45 File envStgFile = exportEnvStg(envFile, workingDirectory);50 File envStgFile = exportEnvStg(envFile, workingDirectory);
@@ -62,7 +67,7 @@
62 Framework framework = Framework.getInstance();67 Framework framework = Framework.getInstance();
63 if ((devStgFile != null) && (envStgFile != null)) {68 if ((devStgFile != null) && (envStgFile != null)) {
64 // Generating .g for the whole system (circuit and environment)69 // Generating .g for the whole system (circuit and environment)
65 stgFile = new File(workingDirectory, "system.g");70 stgFile = new File(workingDirectory, SYSTEM_FILE_NAME + ASTG_FILE_EXT);
66 PcompTask pcompTask = new PcompTask(new File[]{devStgFile, envStgFile}, 71 PcompTask pcompTask = new PcompTask(new File[]{devStgFile, envStgFile},
67 ConversionMode.OUTPUT, true, false, workingDirectory);72 ConversionMode.OUTPUT, true, false, workingDirectory);
68 73
@@ -81,12 +86,12 @@
81 private static File exportEnvStg(File envFile, File workingDirectory) throws DeserialisationException, IOException {86 private static File exportEnvStg(File envFile, File workingDirectory) throws DeserialisationException, IOException {
82 Framework framework = Framework.getInstance();87 Framework framework = Framework.getInstance();
83 File envStgFile = null;88 File envStgFile = null;
84 if (envFile.getName().endsWith(".g")) {89 if (envFile.getName().endsWith(ASTG_FILE_EXT)) {
85 envStgFile = envFile;90 envStgFile = envFile;
86 } else {91 } else {
87 STG envStg = (STG)framework.loadFile(envFile).getMathModel();92 STG envStg = (STG)framework.loadFile(envFile).getMathModel();
88 Exporter envStgExporter = Export.chooseBestExporter(framework.getPluginManager(), envStg, Format.STG);93 Exporter envStgExporter = Export.chooseBestExporter(framework.getPluginManager(), envStg, Format.STG);
89 envStgFile = new File(workingDirectory, "env.g");94 envStgFile = new File(workingDirectory, ENVIRONMENT_FILE_NAME + ASTG_FILE_EXT);
90 ExportTask envExportTask = new ExportTask(envStgExporter, envStg, envStgFile.getCanonicalPath());95 ExportTask envExportTask = new ExportTask(envStgExporter, envStg, envStgFile.getCanonicalPath());
91 Result<? extends Object> envExportResult = framework.getTaskManager().execute(96 Result<? extends Object> envExportResult = framework.getTaskManager().execute(
92 envExportTask, "Exporting environment .g", null);97 envExportTask, "Exporting environment .g", null);
@@ -103,14 +108,13 @@
103 STG devStg = (STG)visualStg.getMathModel();108 STG devStg = (STG)visualStg.getMathModel();
104 Exporter devStgExporter = Export.chooseBestExporter(framework.getPluginManager(), devStg, Format.STG);109 Exporter devStgExporter = Export.chooseBestExporter(framework.getPluginManager(), devStg, Format.STG);
105 if (devStgExporter == null) {110 if (devStgExporter == null) {
106 throw new RuntimeException ("Exporter not available: model class " + devStg.getClass().getName() + " to format STG.");111 throw new RuntimeException("Exporter not available: model class " + devStg.getClass().getName() + " to .g format.");
107 }112 }
108113
109 String devStgName = "dev.g";114 File devStgFile = new File(workingDirectory, DEVICE_FILE_NAME + ASTG_FILE_EXT);
110 File devStgFile = new File(workingDirectory, devStgName);
111 ExportTask devExportTask = new ExportTask(devStgExporter, devStg, devStgFile.getCanonicalPath());115 ExportTask devExportTask = new ExportTask(devStgExporter, devStg, devStgFile.getCanonicalPath());
112 Result<? extends Object> devExportResult = framework.getTaskManager().execute(116 Result<? extends Object> devExportResult = framework.getTaskManager().execute(
113 devExportTask, "Exporting circuit .g", null);117 devExportTask, "Exporting device .g", null);
114 if (devExportResult.getOutcome() != Outcome.FINISHED) {118 if (devExportResult.getOutcome() != Outcome.FINISHED) {
115 devStgFile = null;119 devStgFile = null;
116 }120 }
117121
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitTask.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitTask.java 2015-04-30 23:14:48 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitTask.java 2015-06-26 22:23:53 +0000
@@ -12,6 +12,7 @@
12import org.workcraft.Framework;12import org.workcraft.Framework;
13import org.workcraft.interop.Exporter;13import org.workcraft.interop.Exporter;
14import org.workcraft.plugins.circuit.VisualCircuit;14import org.workcraft.plugins.circuit.VisualCircuit;
15import org.workcraft.plugins.circuit.stg.CircuitStgUtils;
15import org.workcraft.plugins.circuit.stg.CircuitToStgConverter;16import org.workcraft.plugins.circuit.stg.CircuitToStgConverter;
16import org.workcraft.plugins.mpsat.MpsatMode;17import org.workcraft.plugins.mpsat.MpsatMode;
17import org.workcraft.plugins.mpsat.MpsatResultParser;18import org.workcraft.plugins.mpsat.MpsatResultParser;
@@ -77,20 +78,20 @@
77 File envFile = visualCircuit.getEnvironmentFile(); 78 File envFile = visualCircuit.getEnvironmentFile();
78 boolean hasEnvironment = ((envFile != null) && envFile.exists()); 79 boolean hasEnvironment = ((envFile != null) && envFile.exists());
7980
80 String prefix = "workcraft-" + title + "-"; // Prefix must be at least 3 symbols long.81 String prefix = CircuitStgUtils.TEMP_DIRECTORY_PREFIX + title + "-"; // Prefix must be at least 3 symbols long.
81 workingDirectory = FileUtils.createTempDirectory(prefix);82 workingDirectory = FileUtils.createTempDirectory(prefix);
8283
83 CircuitToStgConverter generator = new CircuitToStgConverter(visualCircuit);84 CircuitToStgConverter generator = new CircuitToStgConverter(visualCircuit);
84 STG devStg = (STG)generator.getStg().getMathModel();85 STG devStg = (STG)generator.getStg().getMathModel();
85 Exporter devStgExporter = Export.chooseBestExporter(framework.getPluginManager(), devStg, Format.STG);86 Exporter devStgExporter = Export.chooseBestExporter(framework.getPluginManager(), devStg, Format.STG);
86 if (devStgExporter == null) {87 if (devStgExporter == null) {
87 throw new RuntimeException ("Exporter not available: model class " + devStg.getClass().getName() + " to format STG.");88 throw new RuntimeException("Exporter not available: model class " + devStg.getClass().getName() + " to .g format.");
88 }89 }
89 SubtaskMonitor<Object> subtaskMonitor = new SubtaskMonitor<Object>(monitor);90 SubtaskMonitor<Object> subtaskMonitor = new SubtaskMonitor<Object>(monitor);
90 monitor.progressUpdate(0.10);91 monitor.progressUpdate(0.10);
9192
92 // Generating .g for the circuit93 // Generating .g for the circuit
93 String devStgName = (hasEnvironment ? "dev.g" : "system.g");94 String devStgName = (hasEnvironment ? CircuitStgUtils.DEVICE_FILE_NAME : CircuitStgUtils.SYSTEM_FILE_NAME) + CircuitStgUtils.ASTG_FILE_EXT;
94 File devStgFile = new File(workingDirectory, devStgName);95 File devStgFile = new File(workingDirectory, devStgName);
95 ExportTask devExportTask = new ExportTask(devStgExporter, devStg, devStgFile.getCanonicalPath());96 ExportTask devExportTask = new ExportTask(devStgExporter, devStg, devStgFile.getCanonicalPath());
96 Result<? extends Object> devExportResult = framework.getTaskManager().execute(97 Result<? extends Object> devExportResult = framework.getTaskManager().execute(
@@ -114,12 +115,12 @@
114 stg = devStg;115 stg = devStg;
115 } else {116 } else {
116 File envStgFile = null;117 File envStgFile = null;
117 if (envFile.getName().endsWith(".g")) {118 if (envFile.getName().endsWith(CircuitStgUtils.ASTG_FILE_EXT)) {
118 envStgFile = envFile;119 envStgFile = envFile;
119 } else {120 } else {
120 STG envStg = (STG)framework.loadFile(envFile).getMathModel();121 STG envStg = (STG)framework.loadFile(envFile).getMathModel();
121 Exporter envStgExporter = Export.chooseBestExporter(framework.getPluginManager(), envStg, Format.STG);122 Exporter envStgExporter = Export.chooseBestExporter(framework.getPluginManager(), envStg, Format.STG);
122 envStgFile = new File(workingDirectory, "env.g");123 envStgFile = new File(workingDirectory, CircuitStgUtils.ENVIRONMENT_FILE_NAME + CircuitStgUtils.ASTG_FILE_EXT);
123 ExportTask envExportTask = new ExportTask(envStgExporter, envStg, envStgFile.getCanonicalPath());124 ExportTask envExportTask = new ExportTask(envStgExporter, envStg, envStgFile.getCanonicalPath());
124 Result<? extends Object> envExportResult = framework.getTaskManager().execute(125 Result<? extends Object> envExportResult = framework.getTaskManager().execute(
125 envExportTask, "Exporting environment .g", subtaskMonitor);126 envExportTask, "Exporting environment .g", subtaskMonitor);
@@ -135,7 +136,7 @@
135 monitor.progressUpdate(0.25);136 monitor.progressUpdate(0.25);
136137
137 // Generating .g for the whole system (circuit and environment)138 // Generating .g for the whole system (circuit and environment)
138 stgFile = new File(workingDirectory, "system.g");139 stgFile = new File(workingDirectory, CircuitStgUtils.SYSTEM_FILE_NAME + CircuitStgUtils.ASTG_FILE_EXT);
139 PcompTask pcompTask = new PcompTask(new File[]{devStgFile, envStgFile}, ConversionMode.OUTPUT, true, false, workingDirectory);140 PcompTask pcompTask = new PcompTask(new File[]{devStgFile, envStgFile}, ConversionMode.OUTPUT, true, false, workingDirectory);
140 pcompResult = framework.getTaskManager().execute(141 pcompResult = framework.getTaskManager().execute(
141 pcompTask, "Running pcomp", subtaskMonitor);142 pcompTask, "Running pcomp", subtaskMonitor);
@@ -155,7 +156,7 @@
155 monitor.progressUpdate(0.30);156 monitor.progressUpdate(0.30);
156157
157 // Generate unfolding158 // Generate unfolding
158 File unfoldingFile = new File(workingDirectory, "system" + MpsatUtilitySettings.getUnfoldingExtension(true));159 File unfoldingFile = new File(workingDirectory, CircuitStgUtils.SYSTEM_FILE_NAME + MpsatUtilitySettings.getUnfoldingExtension(true));
159 PunfTask punfTask = new PunfTask(stgFile.getCanonicalPath(), unfoldingFile.getCanonicalPath(), true);160 PunfTask punfTask = new PunfTask(stgFile.getCanonicalPath(), unfoldingFile.getCanonicalPath(), true);
160 Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute(161 Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute(
161 punfTask, "Unfolding .g", subtaskMonitor);162 punfTask, "Unfolding .g", subtaskMonitor);
162163
=== modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitTool.java'
--- CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitTool.java 2015-04-23 12:19:54 +0000
+++ CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitTool.java 2015-06-26 22:23:53 +0000
@@ -15,7 +15,7 @@
1515
16 @Override16 @Override
17 public String getSection() {17 public String getSection() {
18 return "Verification";18 return "!Verification";
19 }19 }
2020
21 @Override21 @Override
2222
=== modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/Arc.java'
--- CpogsPlugin/src/org/workcraft/plugins/cpog/Arc.java 2010-04-13 15:52:01 +0000
+++ CpogsPlugin/src/org/workcraft/plugins/cpog/Arc.java 2015-06-26 22:23:53 +0000
@@ -26,28 +26,25 @@
26import org.workcraft.plugins.cpog.optimisation.BooleanFormula;26import org.workcraft.plugins.cpog.optimisation.BooleanFormula;
27import org.workcraft.plugins.cpog.optimisation.expressions.One;27import org.workcraft.plugins.cpog.optimisation.expressions.One;
2828
29public class Arc extends MathConnection29public class Arc extends MathConnection {
30{30 public static final String PROPERTY_CONDITION = "Condition";
31
31 private BooleanFormula condition;32 private BooleanFormula condition;
3233
33 public Arc()34 public Arc() {
34 {
35 }35 }
36 36
37 public Arc(Vertex first, Vertex second)37 public Arc(Vertex first, Vertex second) {
38 {
39 super(first, second);38 super(first, second);
40 condition = One.instance();39 condition = One.instance();
41 }40 }
4241
43 public void setCondition(BooleanFormula condition)42 public void setCondition(BooleanFormula condition) {
44 {
45 this.condition = condition;43 this.condition = condition;
46 sendNotification(new PropertyChangedEvent(this, "condition"));44 sendNotification(new PropertyChangedEvent(this, PROPERTY_CONDITION));
47 } 45 }
48 46
49 public BooleanFormula getCondition()47 public BooleanFormula getCondition() {
50 {
51 return condition;48 return condition;
52 }49 }
53}50}
5451
=== modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/RhoClause.java'
--- CpogsPlugin/src/org/workcraft/plugins/cpog/RhoClause.java 2014-09-19 16:15:28 +0000
+++ CpogsPlugin/src/org/workcraft/plugins/cpog/RhoClause.java 2015-06-26 22:23:53 +0000
@@ -28,13 +28,14 @@
28import org.workcraft.plugins.cpog.optimisation.expressions.BooleanOperations;28import org.workcraft.plugins.cpog.optimisation.expressions.BooleanOperations;
2929
30@VisualClass(org.workcraft.plugins.cpog.VisualRhoClause.class)30@VisualClass(org.workcraft.plugins.cpog.VisualRhoClause.class)
31public class RhoClause extends MathNode31public class RhoClause extends MathNode {
32{32 public static final String PROPERTY_FORMULA = "Formula";
33
33 private BooleanFormula formula = BooleanOperations.ONE;34 private BooleanFormula formula = BooleanOperations.ONE;
34 35
35 public void setFormula(BooleanFormula formula) {36 public void setFormula(BooleanFormula formula) {
36 this.formula = formula;37 this.formula = formula;
37 sendNotification(new PropertyChangedEvent(this, "formula"));38 sendNotification(new PropertyChangedEvent(this, PROPERTY_FORMULA));
38 } 39 }
39 40
40 public BooleanFormula getFormula() {41 public BooleanFormula getFormula() {
4142
=== modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/Variable.java'
--- CpogsPlugin/src/org/workcraft/plugins/cpog/Variable.java 2014-09-19 16:15:28 +0000
+++ CpogsPlugin/src/org/workcraft/plugins/cpog/Variable.java 2015-06-26 22:23:53 +0000
@@ -28,16 +28,17 @@
28import org.workcraft.plugins.cpog.optimisation.expressions.BooleanVisitor;28import org.workcraft.plugins.cpog.optimisation.expressions.BooleanVisitor;
2929
30@VisualClass(org.workcraft.plugins.cpog.VisualVariable.class)30@VisualClass(org.workcraft.plugins.cpog.VisualVariable.class)
31public class Variable extends MathNode implements Comparable<Variable>, BooleanVariable31public class Variable extends MathNode implements Comparable<Variable>, BooleanVariable {
32{
33 32
33 public static final String PROPERTY_STATE = "State";
34
34 private VariableState state = VariableState.UNDEFINED;35 private VariableState state = VariableState.UNDEFINED;
35 36
36 private String label = "";37 private String label = "";
3738
38 public void setState(VariableState state) {39 public void setState(VariableState state) {
39 this.state = state;40 this.state = state;
40 sendNotification(new PropertyChangedEvent(this, "state"));41 sendNotification(new PropertyChangedEvent(this, PROPERTY_STATE));
41 }42 }
4243
43 public VariableState getState() {44 public VariableState getState() {
4445
=== modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/Vertex.java'
--- CpogsPlugin/src/org/workcraft/plugins/cpog/Vertex.java 2014-09-19 16:15:28 +0000
+++ CpogsPlugin/src/org/workcraft/plugins/cpog/Vertex.java 2015-06-26 22:23:53 +0000
@@ -28,13 +28,14 @@
28import org.workcraft.plugins.cpog.optimisation.expressions.One;28import org.workcraft.plugins.cpog.optimisation.expressions.One;
2929
30@VisualClass(org.workcraft.plugins.cpog.VisualVertex.class)30@VisualClass(org.workcraft.plugins.cpog.VisualVertex.class)
31public class Vertex extends MathNode31public class Vertex extends MathNode {
32{32 public static final String PROPERTY_CONDITION = "Condition";
33
33 private BooleanFormula condition = One.instance();34 private BooleanFormula condition = One.instance();
34 35
35 public void setCondition(BooleanFormula condition) {36 public void setCondition(BooleanFormula condition) {
36 this.condition = condition;37 this.condition = condition;
37 sendNotification(new PropertyChangedEvent(this, "condition"));38 sendNotification(new PropertyChangedEvent(this, PROPERTY_CONDITION));
38 } 39 }
39 40
40 public BooleanFormula getCondition() {41 public BooleanFormula getCondition() {
4142
=== modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/VisualArc.java'
--- CpogsPlugin/src/org/workcraft/plugins/cpog/VisualArc.java 2014-10-28 16:22:12 +0000
+++ CpogsPlugin/src/org/workcraft/plugins/cpog/VisualArc.java 2015-06-26 22:23:53 +0000
@@ -49,8 +49,8 @@
49import org.workcraft.plugins.cpog.optimisation.expressions.Zero;49import org.workcraft.plugins.cpog.optimisation.expressions.Zero;
50import org.workcraft.util.Geometry;50import org.workcraft.util.Geometry;
5151
52public class VisualArc extends VisualConnection52public class VisualArc extends VisualConnection {
53{53 public static final String PROPERTY_CONDITION = "condition";
54 private static Font labelFont;54 private static Font labelFont;
55 private Rectangle2D labelBB = null; 55 private Rectangle2D labelBB = null;
56 56
@@ -68,14 +68,12 @@
68 }68 }
69 }69 }
70 70
71 public VisualArc(Arc mathConnection)71 public VisualArc(Arc mathConnection) {
72 {
73 super();72 super();
74 this.mathConnection = mathConnection;73 this.mathConnection = mathConnection;
75 }74 }
76 75
77 public VisualArc(Arc mathConnection, VisualVertex first, VisualVertex second)76 public VisualArc(Arc mathConnection, VisualVertex first, VisualVertex second) {
78 {
79 super(mathConnection, first, second);77 super(mathConnection, first, second);
80 this.mathConnection = mathConnection;78 this.mathConnection = mathConnection;
81 }79 }
@@ -86,8 +84,7 @@
86 }84 }
87 85
88 @Override86 @Override
89 public Stroke getStroke()87 public Stroke getStroke() {
90 {
91 BooleanFormula value = evaluate();88 BooleanFormula value = evaluate();
92 89
93 if (value == Zero.instance()) 90 if (value == Zero.instance())
@@ -98,8 +95,7 @@
98 }95 }
99 96
100 @Override97 @Override
101 public Color getDrawColor()98 public Color getDrawColor() {
102 {
103 BooleanFormula value = evaluate();99 BooleanFormula value = evaluate();
104 100
105 if (value == Zero.instance() || value == One.instance()) return super.getDrawColor();101 if (value == Zero.instance() || value == One.instance()) return super.getDrawColor();
@@ -107,20 +103,17 @@
107 return Color.LIGHT_GRAY;103 return Color.LIGHT_GRAY;
108 }104 }
109105
110 private BooleanFormula evaluate()106 private BooleanFormula evaluate() {
111 {
112 BooleanFormula condition = getCondition();107 BooleanFormula condition = getCondition();
113 108
114 condition = BooleanOperations.and(condition, ((VisualVertex) getFirst()).evaluate());109 condition = BooleanOperations.and(condition, ((VisualVertex) getFirst()).evaluate());
115 condition = BooleanOperations.and(condition, ((VisualVertex) getSecond()).evaluate());110 condition = BooleanOperations.and(condition, ((VisualVertex) getSecond()).evaluate());
116 111
117 return condition.accept(112 return condition.accept(
118 new BooleanReplacer(new HashMap<BooleanVariable, BooleanFormula>())113 new BooleanReplacer(new HashMap<BooleanVariable, BooleanFormula>()) {
119 {
120 @Override114 @Override
121 public BooleanFormula visit(BooleanVariable node) {115 public BooleanFormula visit(BooleanVariable node) {
122 switch(((Variable)node).getState())116 switch(((Variable)node).getState()) {
123 {
124 case TRUE:117 case TRUE:
125 return One.instance();118 return One.instance();
126 case FALSE:119 case FALSE:
@@ -133,15 +126,13 @@
133 );126 );
134 }127 }
135128
136 public void setCondition(BooleanFormula condition)129 public void setCondition(BooleanFormula condition) {
137 {
138 mathConnection.setCondition(condition);130 mathConnection.setCondition(condition);
139 sendNotification(new PropertyChangedEvent(this, "condition")); 131 sendNotification(new PropertyChangedEvent(this, PROPERTY_CONDITION));
140 }132 }
141 133
142 @Override134 @Override
143 public void draw(DrawRequest r)135 public void draw(DrawRequest r) {
144 {
145 labelBB = null;136 labelBB = null;
146 137
147 if (getCondition() == One.instance()) return;138 if (getCondition() == One.instance()) return;
@@ -158,8 +149,7 @@
158 Point2D d = graphic.getDerivativeAt(0.5);149 Point2D d = graphic.getDerivativeAt(0.5);
159 Point2D dd = graphic.getSecondDerivativeAt(0.5);150 Point2D dd = graphic.getSecondDerivativeAt(0.5);
160 151
161 if (d.getX() < 0)152 if (d.getX() < 0) {
162 {
163 d = Geometry.multiply(d, -1);153 d = Geometry.multiply(d, -1);
164 //dd = Geometry.multiply(dd, -1);154 //dd = Geometry.multiply(dd, -1);
165 }155 }
@@ -180,21 +170,19 @@
180 }170 }
181 171
182 @Override172 @Override
183 public Rectangle2D getBoundingBox()173 public Rectangle2D getBoundingBox() {
184 {
185 return BoundingBoxHelper.union(super.getBoundingBox(), labelBB);174 return BoundingBoxHelper.union(super.getBoundingBox(), labelBB);
186 }175 }
187 176
188 public Rectangle2D getLabelBoundingBox()177 public Rectangle2D getLabelBoundingBox() {
189 {
190 return labelBB;178 return labelBB;
191 }179 }
192 180
193 @Override181 @Override
194 public boolean hitTest(Point2D pointInParentSpace)182 public boolean hitTest(Point2D pointInParentSpace) {
195 {
196 if (labelBB != null && labelBB.contains(pointInParentSpace)) return true;183 if (labelBB != null && labelBB.contains(pointInParentSpace)) return true;
197 184
198 return super.hitTest(pointInParentSpace);185 return super.hitTest(pointInParentSpace);
199 }186 }
187
200}188}
201189
=== modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/VisualScenario.java'
--- CpogsPlugin/src/org/workcraft/plugins/cpog/VisualScenario.java 2015-02-26 11:59:35 +0000
+++ CpogsPlugin/src/org/workcraft/plugins/cpog/VisualScenario.java 2015-06-26 22:23:53 +0000
@@ -27,6 +27,9 @@
2727
28public class VisualScenario extends VisualGroup28public class VisualScenario extends VisualGroup
29{29{
30 public static final String PROPERTY_ENCODING = "Encoding";
31 public static final String PROPERTY_LABEL = "Label";
32
30 private static final class ReverseComparator implements Comparator<Variable>33 private static final class ReverseComparator implements Comparator<Variable>
31 {34 {
32 @Override35 @Override
@@ -65,7 +68,7 @@
65 68
66 public VisualScenario() {69 public VisualScenario() {
67 addPropertyDeclaration(new PropertyDeclaration<VisualScenario, String>(70 addPropertyDeclaration(new PropertyDeclaration<VisualScenario, String>(
68 this, "Label", String.class) { 71 this, PROPERTY_LABEL, String.class) {
69 public void setter(VisualScenario object, String value) {72 public void setter(VisualScenario object, String value) {
70 object.setLabel(value);73 object.setLabel(value);
71 }74 }
@@ -75,7 +78,7 @@
75 });78 });
7679
77 addPropertyDeclaration(new PropertyDeclaration<VisualScenario, Encoding>(80 addPropertyDeclaration(new PropertyDeclaration<VisualScenario, Encoding>(
78 this, "Encoding", Encoding.class) { 81 this, PROPERTY_ENCODING, Encoding.class) {
79 public void setter(VisualScenario object, Encoding value) {82 public void setter(VisualScenario object, Encoding value) {
80 object.setEncoding(value);83 object.setEncoding(value);
81 }84 }
@@ -276,7 +279,7 @@
276279
277 public void setLabel(String label) {280 public void setLabel(String label) {
278 this.label = label;281 this.label = label;
279 sendNotification(new PropertyChangedEvent(this, "label"));282 sendNotification(new PropertyChangedEvent(this, PROPERTY_LABEL));
280 }283 }
281284
282 public String getLabel() {285 public String getLabel() {
@@ -285,7 +288,7 @@
285288
286 public void setEncoding(Encoding encoding) {289 public void setEncoding(Encoding encoding) {
287 this.encoding = encoding;290 this.encoding = encoding;
288 sendNotification(new PropertyChangedEvent(this, "encoding"));291 sendNotification(new PropertyChangedEvent(this, PROPERTY_ENCODING));
289 }292 }
290293
291 public Encoding getEncoding() {294 public Encoding getEncoding() {
292295
=== modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/VisualScenarioPage.java'
--- CpogsPlugin/src/org/workcraft/plugins/cpog/VisualScenarioPage.java 2015-04-02 17:28:13 +0000
+++ CpogsPlugin/src/org/workcraft/plugins/cpog/VisualScenarioPage.java 2015-06-26 22:23:53 +0000
@@ -7,12 +7,14 @@
77
8public class VisualScenarioPage extends VisualPage {8public class VisualScenarioPage extends VisualPage {
99
10 public static final String PROPERTY_ENCODING = "Encoding";
11
10 public VisualScenarioPage(MathNode refNode) {12 public VisualScenarioPage(MathNode refNode) {
11 super(refNode);13 super(refNode);
12 // TODO Auto-generated constructor stub14 // TODO Auto-generated constructor stub
1315
14 addPropertyDeclaration(new PropertyDeclaration<VisualScenarioPage, Encoding>(16 addPropertyDeclaration(new PropertyDeclaration<VisualScenarioPage, Encoding>(
15 this, "Encoding", Encoding.class) { 17 this, PROPERTY_ENCODING, Encoding.class) {
16 public void setter(VisualScenarioPage object, Encoding value) {18 public void setter(VisualScenarioPage object, Encoding value) {
17 object.setEncoding(value);19 object.setEncoding(value);
18 }20 }
@@ -26,7 +28,7 @@
26 28
27 public void setEncoding(Encoding encoding) {29 public void setEncoding(Encoding encoding) {
28 this.encoding = encoding;30 this.encoding = encoding;
29 sendNotification(new PropertyChangedEvent(this, "encoding"));31 sendNotification(new PropertyChangedEvent(this, PROPERTY_ENCODING));
30 }32 }
3133
32 public Encoding getEncoding() {34 public Encoding getEncoding() {
3335
=== modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/VisualVariable.java'
--- CpogsPlugin/src/org/workcraft/plugins/cpog/VisualVariable.java 2015-02-26 11:59:35 +0000
+++ CpogsPlugin/src/org/workcraft/plugins/cpog/VisualVariable.java 2015-06-26 22:23:53 +0000
@@ -50,6 +50,7 @@
50@DisplayName("Variable")50@DisplayName("Variable")
51@SVGIcon("images/icons/svg/variable.svg")51@SVGIcon("images/icons/svg/variable.svg")
52public class VisualVariable extends VisualComponent {52public class VisualVariable extends VisualComponent {
53 public static final String PROPERTY_LABEL = "Label";
53 private static Font variableFont;54 private static Font variableFont;
54 private static Font valueFont;55 private static Font valueFont;
55 56
@@ -82,7 +83,7 @@
82 public VisualVariable(Variable variable) {83 public VisualVariable(Variable variable) {
83 super(variable);84 super(variable);
84 addPropertyDeclaration(new PropertyDeclaration<VisualVariable, VariableState>(85 addPropertyDeclaration(new PropertyDeclaration<VisualVariable, VariableState>(
85 this, "State", VariableState.class) { 86 this, Variable.PROPERTY_STATE, VariableState.class) {
86 public void setter(VisualVariable object, VariableState value) {87 public void setter(VisualVariable object, VariableState value) {
87 object.setState(value);88 object.setState(value);
88 }89 }
@@ -155,7 +156,7 @@
155 @Override156 @Override
156 public void setLabel(String label) {157 public void setLabel(String label) {
157 getMathVariable().setLabel(label);158 getMathVariable().setLabel(label);
158 sendNotification(new PropertyChangedEvent(this, "label"));159 sendNotification(new PropertyChangedEvent(this, PROPERTY_LABEL));
159 }160 }
160 161
161 @Override162 @Override
162163
=== modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/VisualVertex.java'
--- CpogsPlugin/src/org/workcraft/plugins/cpog/VisualVertex.java 2014-10-27 16:09:36 +0000
+++ CpogsPlugin/src/org/workcraft/plugins/cpog/VisualVertex.java 2015-06-26 22:23:53 +0000
@@ -55,6 +55,7 @@
55@DisplayName("Vertex")55@DisplayName("Vertex")
56@SVGIcon("images/icons/svg/vertex.svg")56@SVGIcon("images/icons/svg/vertex.svg")
57public class VisualVertex extends VisualComponent implements CpogFormulaVariable {57public class VisualVertex extends VisualComponent implements CpogFormulaVariable {
58 public static final String PROPERTY_CONDITION = "Condition";
58 public static Font conditionFont;59 public static Font conditionFont;
59 private RenderedFormula conditionRenderedFormula = new RenderedFormula("", One.instance(), conditionFont, getLabelPositioning(), getLabelOffset());60 private RenderedFormula conditionRenderedFormula = new RenderedFormula("", One.instance(), conditionFont, getLabelPositioning(), getLabelOffset());
60 61
@@ -132,7 +133,7 @@
132133
133 public void setCondition(BooleanFormula condition) {134 public void setCondition(BooleanFormula condition) {
134 getMathVertex().setCondition(condition);135 getMathVertex().setCondition(condition);
135 sendNotification(new PropertyChangedEvent(this, "condition"));136 sendNotification(new PropertyChangedEvent(this, PROPERTY_CONDITION));
136 }137 }
137 138
138 public BooleanFormula evaluate() {139 public BooleanFormula evaluate() {
139140
=== modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/gui/ScencoConfigurationDialog.java'
--- CpogsPlugin/src/org/workcraft/plugins/cpog/gui/ScencoConfigurationDialog.java 2015-05-15 18:05:13 +0000
+++ CpogsPlugin/src/org/workcraft/plugins/cpog/gui/ScencoConfigurationDialog.java 2015-06-26 22:23:53 +0000
@@ -507,15 +507,16 @@
507 Object[][] data = new Object[m][3];507 Object[][] data = new Object[m][3];
508 for(int i=0; i<m; i++){508 for(int i=0; i<m; i++){
509 String name;509 String name;
510 if(scenarios.get(i).getLabel().equals("")){510 if(scenarios.get(i).getLabel().isEmpty()) {
511 name = "CPOG " + i;511 name = "CPOG " + i;
512 }512 } else{
513 else{
514 name = scenarios.get(i).getLabel();513 name = scenarios.get(i).getLabel();
515 }514 }
516 data[i][0] = name;515 data[i][0] = name;
517 data[i][1] = "";516 data[i][1] = "";
518 for(int j=0; j < Integer.valueOf(bitsText.getText()); j++) data[i][1] = data[i][1] + "X";517 for (int j = 0; j < Integer.valueOf(bitsText.getText()); j++) {
518 data[i][1] = data[i][1] + "X";
519 }
519 }520 }
520 encodingTable = new JTable(data, columnNames);521 encodingTable = new JTable(data, columnNames);
521 MyTableCellRenderer renderer = new MyTableCellRenderer();522 MyTableCellRenderer renderer = new MyTableCellRenderer();
522523
=== modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/serialisation/BooleanFunctionDeserialiser.java'
--- CpogsPlugin/src/org/workcraft/plugins/cpog/serialisation/BooleanFunctionDeserialiser.java 2014-07-11 09:35:42 +0000
+++ CpogsPlugin/src/org/workcraft/plugins/cpog/serialisation/BooleanFunctionDeserialiser.java 2015-06-26 22:23:53 +0000
@@ -87,8 +87,9 @@
87 87
88 BooleanFormula formula=null;88 BooleanFormula formula=null;
89 try {89 try {
90 if (!string.equals(""))90 if (!string.isEmpty()) {
91 formula = BooleanParser.parse(string, new VariableResolver(internalReferenceResolver));91 formula = BooleanParser.parse(string, new VariableResolver(internalReferenceResolver));
92 }
92 } catch (ParseException e) {93 } catch (ParseException e) {
93 throw new DeserialisationException(e);94 throw new DeserialisationException(e);
94 }95 }
9596
=== modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/tasks/ScencoTask.java'
--- CpogsPlugin/src/org/workcraft/plugins/cpog/tasks/ScencoTask.java 2015-05-15 18:05:13 +0000
+++ CpogsPlugin/src/org/workcraft/plugins/cpog/tasks/ScencoTask.java 2015-06-26 22:23:53 +0000
@@ -445,7 +445,7 @@
445 System.out.println("Op-code selected for graphs:");445 System.out.println("Op-code selected for graphs:");
446 for(int i=0; i<m; i++){446 for(int i=0; i<m; i++){
447 String name;447 String name;
448 if (scenarios.get(i).getLabel().equals("")) {448 if (scenarios.get(i).getLabel().isEmpty()) {
449 name = "CPOG " + i;449 name = "CPOG " + i;
450 } else {450 } else {
451 name = scenarios.get(i).getLabel();451 name = scenarios.get(i).getLabel();
@@ -832,11 +832,10 @@
832 832
833 }833 }
834 String empty = "";834 String empty = "";
835 for(int i=0; i<settings.getBits(); i++) empty += 'X';835 for (int i=0; i<settings.getBits(); i++) empty += 'X';
836 if(enc[k].equals("") || enc[k].equals(empty)){836 if (enc[k].isEmpty() || enc[k].equals(empty)){
837 Output1.println("/");837 Output1.println("/");
838 }838 } else {
839 else{
840 Output1.println(enc[k]);839 Output1.println(enc[k]);
841 }840 }
842 }841 }
843842
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/BinaryRegister.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/BinaryRegister.java 2015-01-09 12:41:39 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/BinaryRegister.java 2015-06-26 22:23:53 +0000
@@ -4,6 +4,8 @@
44
5public class BinaryRegister extends MathDelayNode {5public class BinaryRegister extends MathDelayNode {
66
7 public static final String PROPERTY_MARKING = "Marking";
8
7 public enum Marking {9 public enum Marking {
8 EMPTY("empty"),10 EMPTY("empty"),
9 FALSE_TOKEN("false"),11 FALSE_TOKEN("false"),
@@ -29,7 +31,7 @@
2931
30 public void setMarking(Marking value) {32 public void setMarking(Marking value) {
31 this.marking = value;33 this.marking = value;
32 sendNotification(new PropertyChangedEvent(this, "marking"));34 sendNotification(new PropertyChangedEvent(this, PROPERTY_MARKING));
33 }35 }
3436
35 public boolean isFalseMarked() {37 public boolean isFalseMarked() {
3638
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/ControlConnection.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/ControlConnection.java 2013-09-10 09:54:55 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/ControlConnection.java 2015-06-26 22:23:53 +0000
@@ -7,6 +7,7 @@
77
8@VisualClass(org.workcraft.plugins.dfs.VisualControlConnection.class)8@VisualClass(org.workcraft.plugins.dfs.VisualControlConnection.class)
9public class ControlConnection extends MathConnection {9public class ControlConnection extends MathConnection {
10 public static final String PROPERTY_INVERTING = "Inverting";
10 private boolean inverting = false;11 private boolean inverting = false;
11 12
12 public ControlConnection() {13 public ControlConnection() {
@@ -22,7 +23,7 @@
2223
23 public void setInverting(boolean value) {24 public void setInverting(boolean value) {
24 this.inverting = value;25 this.inverting = value;
25 sendNotification(new PropertyChangedEvent(this, "inverting"));26 sendNotification(new PropertyChangedEvent(this, PROPERTY_INVERTING));
26 }27 }
27 28
28}29}
2930
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/ControlRegister.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/ControlRegister.java 2015-01-09 12:41:39 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/ControlRegister.java 2015-06-26 22:23:53 +0000
@@ -5,7 +5,9 @@
55
6@VisualClass(org.workcraft.plugins.dfs.VisualControlRegister.class)6@VisualClass(org.workcraft.plugins.dfs.VisualControlRegister.class)
7public class ControlRegister extends BinaryRegister {7public class ControlRegister extends BinaryRegister {
88 public static final String PROPERTY_PROBABILITY = "Probability";
9 public static final String PROPERTY_SYNCHRONISATION_TYPE = "Synchronisation type";
10
9 private SynchronisationType synchronisationType = SynchronisationType.PLAIN;11 private SynchronisationType synchronisationType = SynchronisationType.PLAIN;
10 private double probability = 1.0;12 private double probability = 1.0;
1113
@@ -32,7 +34,7 @@
3234
33 public void setSynchronisationType(SynchronisationType value) {35 public void setSynchronisationType(SynchronisationType value) {
34 this.synchronisationType = value;36 this.synchronisationType = value;
35 sendNotification(new PropertyChangedEvent(this, "synchronisation type"));37 sendNotification(new PropertyChangedEvent(this, PROPERTY_SYNCHRONISATION_TYPE));
36 }38 }
37 39
38 public double getProbability() {40 public double getProbability() {
@@ -41,7 +43,7 @@
4143
42 public void setProbability(double value) {44 public void setProbability(double value) {
43 this.probability = value;45 this.probability = value;
44 sendNotification(new PropertyChangedEvent(this, "probability"));46 sendNotification(new PropertyChangedEvent(this, PROPERTY_PROBABILITY));
45 }47 }
4648
47}49}
4850
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/CounterflowLogic.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/CounterflowLogic.java 2013-11-13 10:32:32 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/CounterflowLogic.java 2015-06-26 22:23:53 +0000
@@ -5,6 +5,10 @@
55
6@VisualClass(org.workcraft.plugins.dfs.VisualCounterflowLogic.class)6@VisualClass(org.workcraft.plugins.dfs.VisualCounterflowLogic.class)
7public class CounterflowLogic extends MathDelayNode {7public class CounterflowLogic extends MathDelayNode {
8 public static final String PROPERTY_FORWARD_COMPUTED = "Forward computed";
9 public static final String PROPERTY_BACKWARD_COMPUTED = "Backward computed";
10 public static final String PROPERTY_FORWARD_EARLY_EVALUATION = "Forward early evaluation";
11 public static final String PROPERTY_BACKWARD_EARLY_EVALUATION = "Backward early evaluation";
8 private boolean forwardComputed = false;12 private boolean forwardComputed = false;
9 private boolean backwardComputed = false;13 private boolean backwardComputed = false;
10 private boolean forwardEarlyEvaluation = false;14 private boolean forwardEarlyEvaluation = false;
@@ -16,7 +20,7 @@
16 20
17 public void setForwardComputed(boolean value) {21 public void setForwardComputed(boolean value) {
18 this.forwardComputed = value;22 this.forwardComputed = value;
19 sendNotification(new PropertyChangedEvent(this, "forward computed"));23 sendNotification(new PropertyChangedEvent(this, PROPERTY_FORWARD_COMPUTED));
20 }24 }
2125
22 public boolean isBackwardComputed() {26 public boolean isBackwardComputed() {
@@ -25,7 +29,7 @@
2529
26 public void setBackwardComputed(boolean value) {30 public void setBackwardComputed(boolean value) {
27 this.backwardComputed = value;31 this.backwardComputed = value;
28 sendNotification(new PropertyChangedEvent(this, "backward computed"));32 sendNotification(new PropertyChangedEvent(this, PROPERTY_BACKWARD_COMPUTED));
29 }33 }
3034
31 public boolean isForwardEarlyEvaluation() {35 public boolean isForwardEarlyEvaluation() {
@@ -34,7 +38,7 @@
3438
35 public void setForwardEarlyEvaluation(boolean value) {39 public void setForwardEarlyEvaluation(boolean value) {
36 this.forwardEarlyEvaluation = value;40 this.forwardEarlyEvaluation = value;
37 sendNotification(new PropertyChangedEvent(this, "forward early evaluation"));41 sendNotification(new PropertyChangedEvent(this, PROPERTY_FORWARD_EARLY_EVALUATION));
38 }42 }
3943
40 public boolean isBackwardEarlyEvaluation() {44 public boolean isBackwardEarlyEvaluation() {
@@ -43,6 +47,6 @@
4347
44 public void setBackwardEarlyEvaluation(boolean value) {48 public void setBackwardEarlyEvaluation(boolean value) {
45 this.backwardEarlyEvaluation = value;49 this.backwardEarlyEvaluation = value;
46 sendNotification(new PropertyChangedEvent(this, "backward early evaluation"));50 sendNotification(new PropertyChangedEvent(this, PROPERTY_BACKWARD_EARLY_EVALUATION));
47 }51 }
48}52}
4953
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/CounterflowRegister.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/CounterflowRegister.java 2013-11-13 10:32:32 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/CounterflowRegister.java 2015-06-26 22:23:53 +0000
@@ -5,6 +5,8 @@
55
6@VisualClass(org.workcraft.plugins.dfs.VisualCounterflowRegister.class)6@VisualClass(org.workcraft.plugins.dfs.VisualCounterflowRegister.class)
7public class CounterflowRegister extends MathDelayNode {7public class CounterflowRegister extends MathDelayNode {
8 public static final String PROPERTY_AND_MARKED = "And-marked";
9 public static final String PROPERTY_OR_MARKED = "Or-marked";
8 private boolean orMarked = false;10 private boolean orMarked = false;
9 private boolean andMarked = false;11 private boolean andMarked = false;
10 12
@@ -14,7 +16,7 @@
1416
15 public void setOrMarked(boolean orMarked) {17 public void setOrMarked(boolean orMarked) {
16 this.orMarked = orMarked;18 this.orMarked = orMarked;
17 sendNotification(new PropertyChangedEvent(this, "or-marked"));19 sendNotification(new PropertyChangedEvent(this, PROPERTY_OR_MARKED));
18 }20 }
19 21
20 public boolean isAndMarked() {22 public boolean isAndMarked() {
@@ -23,7 +25,7 @@
23 25
24 public void setAndMarked(boolean andMarked) {26 public void setAndMarked(boolean andMarked) {
25 this.andMarked = andMarked;27 this.andMarked = andMarked;
26 sendNotification(new PropertyChangedEvent(this, "and-marked"));28 sendNotification(new PropertyChangedEvent(this, PROPERTY_AND_MARKED));
27 }29 }
2830
29}31}
3032
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/Logic.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/Logic.java 2013-11-13 10:32:32 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/Logic.java 2015-06-26 22:23:53 +0000
@@ -26,6 +26,9 @@
2626
27@VisualClass(org.workcraft.plugins.dfs.VisualLogic.class)27@VisualClass(org.workcraft.plugins.dfs.VisualLogic.class)
28public class Logic extends MathDelayNode {28public class Logic extends MathDelayNode {
29 public static final String PROPERTY_EARLY_EVALUATION = "Early evaluation";
30 public static final String PROPERTY_COMPUTED = "Computed";
31
29 private boolean computed = false;32 private boolean computed = false;
30 private boolean earlyEvaluation = false;33 private boolean earlyEvaluation = false;
3134
@@ -35,7 +38,7 @@
3538
36 public void setComputed(boolean value) {39 public void setComputed(boolean value) {
37 this.computed = value;40 this.computed = value;
38 sendNotification(new PropertyChangedEvent(this, "computed"));41 sendNotification(new PropertyChangedEvent(this, PROPERTY_COMPUTED));
39 }42 }
4043
41 public boolean isEarlyEvaluation() {44 public boolean isEarlyEvaluation() {
@@ -44,7 +47,7 @@
4447
45 public void setEarlyEvaluation(boolean value) {48 public void setEarlyEvaluation(boolean value) {
46 this.earlyEvaluation = value;49 this.earlyEvaluation = value;
47 sendNotification(new PropertyChangedEvent(this, "early evaluation"));50 sendNotification(new PropertyChangedEvent(this, PROPERTY_EARLY_EVALUATION));
48 }51 }
49 52
50}53}
5154
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/MathDelayNode.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/MathDelayNode.java 2013-12-16 12:01:22 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/MathDelayNode.java 2015-06-26 22:23:53 +0000
@@ -22,8 +22,11 @@
22package org.workcraft.plugins.dfs;22package org.workcraft.plugins.dfs;
2323
24import org.workcraft.dom.math.MathNode;24import org.workcraft.dom.math.MathNode;
25import org.workcraft.observation.PropertyChangedEvent;
2526
26public class MathDelayNode extends MathNode {27public class MathDelayNode extends MathNode {
28 public static final String PROPERTY_DELAY = "Delay";
29
27 private double delay = 0.0;30 private double delay = 0.0;
2831
29 public double getDelay() {32 public double getDelay() {
@@ -32,6 +35,7 @@
3235
33 public void setDelay(double value) {36 public void setDelay(double value) {
34 this.delay = value;37 this.delay = value;
38 sendNotification(new PropertyChangedEvent(this, PROPERTY_DELAY));
35 }39 }
36 40
37}41}
3842
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/Register.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/Register.java 2013-11-13 10:32:32 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/Register.java 2015-06-26 22:23:53 +0000
@@ -25,6 +25,8 @@
2525
26@VisualClass(org.workcraft.plugins.dfs.VisualRegister.class)26@VisualClass(org.workcraft.plugins.dfs.VisualRegister.class)
27public class Register extends MathDelayNode {27public class Register extends MathDelayNode {
28 public static final String PROPERTY_MARKED = "Marked";
29
28 private boolean marked = false;30 private boolean marked = false;
2931
30 public boolean isMarked() {32 public boolean isMarked() {
@@ -33,7 +35,7 @@
3335
34 public void setMarked(boolean marked) {36 public void setMarked(boolean marked) {
35 this.marked = marked;37 this.marked = marked;
36 sendNotification(new PropertyChangedEvent(this, "marked"));38 sendNotification(new PropertyChangedEvent(this, PROPERTY_MARKED));
37 }39 }
3840
39}41}
4042
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualAbstractRegister.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/VisualAbstractRegister.java 2015-01-20 15:37:33 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualAbstractRegister.java 2015-06-26 22:23:53 +0000
@@ -4,9 +4,11 @@
44
5import org.workcraft.dom.visual.Stylable;5import org.workcraft.dom.visual.Stylable;
6import org.workcraft.gui.propertyeditor.PropertyDeclaration;6import org.workcraft.gui.propertyeditor.PropertyDeclaration;
7import org.workcraft.observation.PropertyChangedEvent;
7import org.workcraft.plugins.shared.CommonVisualSettings;8import org.workcraft.plugins.shared.CommonVisualSettings;
89
9public abstract class VisualAbstractRegister extends VisualDelayComponent {10public abstract class VisualAbstractRegister extends VisualDelayComponent {
11 public static final String PROPERTY_TOKEN_COLOR = "Token color";
10 protected Color tokenColor = CommonVisualSettings.getBorderColor();12 protected Color tokenColor = CommonVisualSettings.getBorderColor();
11 13
12 public VisualAbstractRegister(MathDelayNode ref) {14 public VisualAbstractRegister(MathDelayNode ref) {
@@ -16,7 +18,7 @@
1618
17 private void addPropertyDeclarations() {19 private void addPropertyDeclarations() {
18 addPropertyDeclaration(new PropertyDeclaration<VisualAbstractRegister, Color>(20 addPropertyDeclaration(new PropertyDeclaration<VisualAbstractRegister, Color>(
19 this, "Token color", Color.class) {21 this, PROPERTY_TOKEN_COLOR, Color.class) {
20 public void setter(VisualAbstractRegister object, Color value) {22 public void setter(VisualAbstractRegister object, Color value) {
21 object.setTokenColor(value);23 object.setTokenColor(value);
22 }24 }
@@ -32,6 +34,7 @@
3234
33 public void setTokenColor(Color tokenColor) {35 public void setTokenColor(Color tokenColor) {
34 this.tokenColor = tokenColor;36 this.tokenColor = tokenColor;
37 sendNotification(new PropertyChangedEvent(this, PROPERTY_TOKEN_COLOR));
35 }38 }
36 39
37 @Override40 @Override
3841
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualBinaryRegister.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/VisualBinaryRegister.java 2015-01-20 15:37:33 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualBinaryRegister.java 2015-06-26 22:23:53 +0000
@@ -13,7 +13,7 @@
1313
14 private void addPropertyDeclarations() {14 private void addPropertyDeclarations() {
15 addPropertyDeclaration(new PropertyDeclaration<VisualBinaryRegister, Marking>(15 addPropertyDeclaration(new PropertyDeclaration<VisualBinaryRegister, Marking>(
16 this, "Marking", Marking.class) {16 this, BinaryRegister.PROPERTY_MARKING, Marking.class) {
17 public void setter(VisualBinaryRegister object, Marking value) {17 public void setter(VisualBinaryRegister object, Marking value) {
18 object.getReferencedBinaryRegister().setMarking(value);18 object.getReferencedBinaryRegister().setMarking(value);
19 }19 }
2020
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualControlConnection.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/VisualControlConnection.java 2015-01-20 15:37:33 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualControlConnection.java 2015-06-26 22:23:53 +0000
@@ -24,7 +24,7 @@
24 private void addPropertyDeclarations() {24 private void addPropertyDeclarations() {
25 super.initialise();25 super.initialise();
26 addPropertyDeclaration(new PropertyDeclaration<VisualControlConnection, Boolean>(26 addPropertyDeclaration(new PropertyDeclaration<VisualControlConnection, Boolean>(
27 this, "Inverting", Boolean.class) {27 this, ControlConnection.PROPERTY_INVERTING, Boolean.class) {
28 public void setter(VisualControlConnection object, Boolean value) {28 public void setter(VisualControlConnection object, Boolean value) {
29 ControlConnection ref = getReferencedControlConnection();29 ControlConnection ref = getReferencedControlConnection();
30 // check if ref is not null to trick the order of node creation in deserialiser30 // check if ref is not null to trick the order of node creation in deserialiser
3131
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualControlRegister.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/VisualControlRegister.java 2015-01-09 12:41:39 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualControlRegister.java 2015-06-26 22:23:53 +0000
@@ -32,7 +32,7 @@
3232
33 private void addPropertyDeclarations() {33 private void addPropertyDeclarations() {
34 addPropertyDeclaration(new PropertyDeclaration<VisualControlRegister, Double>(34 addPropertyDeclaration(new PropertyDeclaration<VisualControlRegister, Double>(
35 this, "Probability", Double.class) { 35 this, ControlRegister.PROPERTY_PROBABILITY, Double.class) {
36 public void setter(VisualControlRegister object, Double value) {36 public void setter(VisualControlRegister object, Double value) {
37 object.getReferencedControlRegister().setProbability(value);37 object.getReferencedControlRegister().setProbability(value);
38 }38 }
@@ -42,7 +42,7 @@
42 });42 });
4343
44 addPropertyDeclaration(new PropertyDeclaration<VisualControlRegister, SynchronisationType>(44 addPropertyDeclaration(new PropertyDeclaration<VisualControlRegister, SynchronisationType>(
45 this, "Synchronisation type", SynchronisationType.class) {45 this, ControlRegister.PROPERTY_SYNCHRONISATION_TYPE, SynchronisationType.class) {
46 public void setter(VisualControlRegister object, SynchronisationType value) {46 public void setter(VisualControlRegister object, SynchronisationType value) {
47 object.getReferencedControlRegister().setSynchronisationType(value);47 object.getReferencedControlRegister().setSynchronisationType(value);
48 }48 }
4949
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualCounterflowLogic.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/VisualCounterflowLogic.java 2015-01-20 15:37:33 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualCounterflowLogic.java 2015-06-26 22:23:53 +0000
@@ -30,7 +30,7 @@
3030
31 private void addPropertyDeclarations() {31 private void addPropertyDeclarations() {
32 addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowLogic, Boolean>(32 addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowLogic, Boolean>(
33 this, "Forward Computed", Boolean.class) { 33 this, CounterflowLogic.PROPERTY_FORWARD_COMPUTED, Boolean.class) {
34 public void setter(VisualCounterflowLogic object, Boolean value) {34 public void setter(VisualCounterflowLogic object, Boolean value) {
35 object.getReferencedCounterflowLogic().setForwardComputed(value);35 object.getReferencedCounterflowLogic().setForwardComputed(value);
36 }36 }
@@ -40,7 +40,7 @@
40 });40 });
4141
42 addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowLogic, Boolean>(42 addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowLogic, Boolean>(
43 this, "Backward Computed", Boolean.class) { 43 this, CounterflowLogic.PROPERTY_BACKWARD_COMPUTED, Boolean.class) {
44 public void setter(VisualCounterflowLogic object, Boolean value) {44 public void setter(VisualCounterflowLogic object, Boolean value) {
45 object.getReferencedCounterflowLogic().setBackwardComputed(value);45 object.getReferencedCounterflowLogic().setBackwardComputed(value);
46 }46 }
@@ -51,7 +51,7 @@
5151
5252
53 addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowLogic, Boolean>(53 addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowLogic, Boolean>(
54 this, "Forward Early Evaluation", Boolean.class) {54 this, CounterflowLogic.PROPERTY_FORWARD_EARLY_EVALUATION, Boolean.class) {
55 public void setter(VisualCounterflowLogic object, Boolean value) {55 public void setter(VisualCounterflowLogic object, Boolean value) {
56 object.getReferencedCounterflowLogic().setForwardEarlyEvaluation(value);56 object.getReferencedCounterflowLogic().setForwardEarlyEvaluation(value);
57 }57 }
@@ -61,7 +61,7 @@
61 });61 });
6262
63 addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowLogic, Boolean>(63 addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowLogic, Boolean>(
64 this, "Backward Early Evaluation", Boolean.class) { 64 this, CounterflowLogic.PROPERTY_BACKWARD_EARLY_EVALUATION, Boolean.class) {
65 public void setter(VisualCounterflowLogic object, Boolean value) {65 public void setter(VisualCounterflowLogic object, Boolean value) {
66 object.getReferencedCounterflowLogic().setBackwardEarlyEvaluation(value);66 object.getReferencedCounterflowLogic().setBackwardEarlyEvaluation(value);
67 }67 }
6868
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualCounterflowRegister.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/VisualCounterflowRegister.java 2015-01-20 15:37:33 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualCounterflowRegister.java 2015-06-26 22:23:53 +0000
@@ -30,7 +30,7 @@
3030
31 private void addPropertyDeclarations() {31 private void addPropertyDeclarations() {
32 addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowRegister, Boolean>(32 addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowRegister, Boolean>(
33 this, "Or-marked", Boolean.class) {33 this, CounterflowRegister.PROPERTY_OR_MARKED, Boolean.class) {
34 public void setter(VisualCounterflowRegister object, Boolean value) {34 public void setter(VisualCounterflowRegister object, Boolean value) {
35 object.getReferencedCounterflowRegister().setOrMarked(value);35 object.getReferencedCounterflowRegister().setOrMarked(value);
36 }36 }
@@ -40,7 +40,7 @@
40 });40 });
4141
42 addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowRegister, Boolean>(42 addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowRegister, Boolean>(
43 this, "And-marked", Boolean.class) {43 this, CounterflowRegister.PROPERTY_AND_MARKED, Boolean.class) {
44 public void setter(VisualCounterflowRegister object, Boolean value) {44 public void setter(VisualCounterflowRegister object, Boolean value) {
45 object.getReferencedCounterflowRegister().setAndMarked(value);45 object.getReferencedCounterflowRegister().setAndMarked(value);
46 }46 }
4747
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualDelayComponent.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/VisualDelayComponent.java 2015-01-20 15:37:33 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualDelayComponent.java 2015-06-26 22:23:53 +0000
@@ -17,7 +17,7 @@
1717
18 private void addPropertyDeclarations() {18 private void addPropertyDeclarations() {
19 addPropertyDeclaration(new PropertyDeclaration<VisualDelayComponent, Double>(19 addPropertyDeclaration(new PropertyDeclaration<VisualDelayComponent, Double>(
20 this, "Delay", Double.class) { 20 this, MathDelayNode.PROPERTY_DELAY, Double.class) {
21 public void setter(VisualDelayComponent object, Double value) {21 public void setter(VisualDelayComponent object, Double value) {
22 object.getReferencedDelayComponent().setDelay(value);22 object.getReferencedDelayComponent().setDelay(value);
23 }23 }
2424
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualLogic.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/VisualLogic.java 2015-01-20 15:37:33 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualLogic.java 2015-06-26 22:23:53 +0000
@@ -29,7 +29,7 @@
2929
30 private void addPropertyDeclarations() {30 private void addPropertyDeclarations() {
31 addPropertyDeclaration(new PropertyDeclaration<VisualLogic, Boolean>(31 addPropertyDeclaration(new PropertyDeclaration<VisualLogic, Boolean>(
32 this, "Computed", Boolean.class) { 32 this, Logic.PROPERTY_COMPUTED, Boolean.class) {
33 public void setter(VisualLogic object, Boolean value) {33 public void setter(VisualLogic object, Boolean value) {
34 object.getReferencedLogic().setComputed(value);34 object.getReferencedLogic().setComputed(value);
35 }35 }
@@ -39,7 +39,7 @@
39 });39 });
4040
41 addPropertyDeclaration(new PropertyDeclaration<VisualLogic, Boolean>(41 addPropertyDeclaration(new PropertyDeclaration<VisualLogic, Boolean>(
42 this, "Early Evaluation", Boolean.class) { 42 this, Logic.PROPERTY_EARLY_EVALUATION, Boolean.class) {
43 public void setter(VisualLogic object, Boolean value) {43 public void setter(VisualLogic object, Boolean value) {
44 object.getReferencedLogic().setEarlyEvaluation(value);44 object.getReferencedLogic().setEarlyEvaluation(value);
45 }45 }
4646
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualRegister.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/VisualRegister.java 2015-01-20 15:37:33 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualRegister.java 2015-06-26 22:23:53 +0000
@@ -55,7 +55,7 @@
5555
56 private void addPropertyDeclarations() {56 private void addPropertyDeclarations() {
57 addPropertyDeclaration(new PropertyDeclaration<VisualRegister, Boolean>(57 addPropertyDeclaration(new PropertyDeclaration<VisualRegister, Boolean>(
58 this, "Marked", Boolean.class) {58 this, Register.PROPERTY_MARKED, Boolean.class) {
59 public void setter(VisualRegister object, Boolean value) {59 public void setter(VisualRegister object, Boolean value) {
60 object.getReferencedRegister().setMarked(value);60 object.getReferencedRegister().setMarked(value);
61 }61 }
6262
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowDeadlockTool.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowDeadlockTool.java 2015-04-23 12:19:54 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowDeadlockTool.java 2015-06-26 22:23:53 +0000
@@ -16,7 +16,7 @@
1616
17 @Override17 @Override
18 public String getSection() {18 public String getSection() {
19 return "Verification";19 return "!Verification";
20 }20 }
2121
22 @Override22 @Override
2323
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowHazardTool.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowHazardTool.java 2015-04-23 12:19:54 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowHazardTool.java 2015-06-26 22:23:53 +0000
@@ -15,7 +15,7 @@
1515
16 @Override16 @Override
17 public String getSection() {17 public String getSection() {
18 return "Verification";18 return "!Verification";
19 }19 }
2020
21 @Override21 @Override
2222
=== modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowTool.java'
--- DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowTool.java 2015-04-23 12:19:54 +0000
+++ DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowTool.java 2015-06-26 22:23:53 +0000
@@ -15,7 +15,7 @@
1515
16 @Override16 @Override
17 public String getSection() {17 public String getSection() {
18 return "Verification";18 return "!Verification";
19 }19 }
2020
21 @Override21 @Override
2222
=== modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/Event.java'
--- FsmPlugin/src/org/workcraft/plugins/fsm/Event.java 2015-01-08 23:08:14 +0000
+++ FsmPlugin/src/org/workcraft/plugins/fsm/Event.java 2015-06-26 22:23:53 +0000
@@ -8,6 +8,7 @@
8@DisplayName("Event")8@DisplayName("Event")
9@VisualClass(org.workcraft.plugins.fsm.VisualEvent.class)9@VisualClass(org.workcraft.plugins.fsm.VisualEvent.class)
10public class Event extends MathConnection {10public class Event extends MathConnection {
11 public static final String PROPERTY_SYMBOL = "Symbol";
1112
12 private Symbol symbol;13 private Symbol symbol;
1314
@@ -25,7 +26,7 @@
2526
26 public void setSymbol(Symbol symbol) {27 public void setSymbol(Symbol symbol) {
27 this.symbol = symbol;28 this.symbol = symbol;
28 sendNotification(new PropertyChangedEvent(this, "symbol"));29 sendNotification(new PropertyChangedEvent(this, PROPERTY_SYMBOL));
29 }30 }
30 31
31}32}
3233
=== modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/Fsm.java'
--- FsmPlugin/src/org/workcraft/plugins/fsm/Fsm.java 2015-05-27 12:14:35 +0000
+++ FsmPlugin/src/org/workcraft/plugins/fsm/Fsm.java 2015-06-26 22:23:53 +0000
@@ -1,6 +1,7 @@
1package org.workcraft.plugins.fsm;1package org.workcraft.plugins.fsm;
22
3import java.util.Collection;3import java.util.Collection;
4import java.util.LinkedList;
45
5import org.workcraft.annotations.VisualClass;6import org.workcraft.annotations.VisualClass;
6import org.workcraft.dom.Container;7import org.workcraft.dom.Container;
@@ -12,6 +13,7 @@
12import org.workcraft.dom.references.ReferenceManager;13import org.workcraft.dom.references.ReferenceManager;
13import org.workcraft.exceptions.ArgumentException;14import org.workcraft.exceptions.ArgumentException;
14import org.workcraft.gui.propertyeditor.ModelProperties;15import org.workcraft.gui.propertyeditor.ModelProperties;
16import org.workcraft.gui.propertyeditor.PropertyDescriptor;
15import org.workcraft.plugins.fsm.propertydescriptors.EventSymbolPropertyDescriptor;17import org.workcraft.plugins.fsm.propertydescriptors.EventSymbolPropertyDescriptor;
16import org.workcraft.plugins.fsm.propertydescriptors.SymbolPropertyDescriptor;18import org.workcraft.plugins.fsm.propertydescriptors.SymbolPropertyDescriptor;
17import org.workcraft.serialisation.References;19import org.workcraft.serialisation.References;
@@ -152,9 +154,11 @@
152 public ModelProperties getProperties(Node node) {154 public ModelProperties getProperties(Node node) {
153 ModelProperties properties = super.getProperties(node);155 ModelProperties properties = super.getProperties(node);
154 if (node == null) {156 if (node == null) {
157 LinkedList<PropertyDescriptor> symbolDescriptors = new LinkedList<>();
155 for (final Symbol symbol: getSymbols()) {158 for (final Symbol symbol: getSymbols()) {
156 properties.add(new SymbolPropertyDescriptor(this, symbol));159 symbolDescriptors.add(new SymbolPropertyDescriptor(this, symbol));
157 }160 }
161 properties.addSorted(symbolDescriptors);
158 } else if (node instanceof Event) {162 } else if (node instanceof Event) {
159 Event event = (Event) node;163 Event event = (Event) node;
160 properties.add(new EventSymbolPropertyDescriptor(this, event));164 properties.add(new EventSymbolPropertyDescriptor(this, event));
161165
=== modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/InitialStateSupervisor.java'
--- FsmPlugin/src/org/workcraft/plugins/fsm/InitialStateSupervisor.java 2015-04-23 12:19:54 +0000
+++ FsmPlugin/src/org/workcraft/plugins/fsm/InitialStateSupervisor.java 2015-06-26 22:23:53 +0000
@@ -21,7 +21,7 @@
21 if (e instanceof PropertyChangedEvent) {21 if (e instanceof PropertyChangedEvent) {
22 PropertyChangedEvent pce = (PropertyChangedEvent)e;22 PropertyChangedEvent pce = (PropertyChangedEvent)e;
23 Object sender = e.getSender();23 Object sender = e.getSender();
24 if ((sender instanceof State) && pce.getPropertyName().equals("initial")) {24 if ((sender instanceof State) && pce.getPropertyName().equals(State.PROPERTY_INITIAL)) {
25 // Update all the states on a change of the initial property 25 // Update all the states on a change of the initial property
26 handleInitialStateChange((State)sender);26 handleInitialStateChange((State)sender);
27 }27 }
2828
=== modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/State.java'
--- FsmPlugin/src/org/workcraft/plugins/fsm/State.java 2014-12-13 22:56:43 +0000
+++ FsmPlugin/src/org/workcraft/plugins/fsm/State.java 2015-06-26 22:23:53 +0000
@@ -8,6 +8,9 @@
8@DisplayName("State")8@DisplayName("State")
9@VisualClass(org.workcraft.plugins.fsm.VisualState.class)9@VisualClass(org.workcraft.plugins.fsm.VisualState.class)
10public class State extends MathNode {10public class State extends MathNode {
11 public static final String PROPERTY_INITIAL = "Initial";
12 public static final String PROPERTY_FINAL = "Final";
13
11 private boolean initialState = false;14 private boolean initialState = false;
12 private boolean finalState = false;15 private boolean finalState = false;
1316
@@ -17,7 +20,7 @@
1720
18 public void setInitial(boolean value) {21 public void setInitial(boolean value) {
19 if (setInitialQuiet(value)) {22 if (setInitialQuiet(value)) {
20 sendNotification(new PropertyChangedEvent(this, "initial"));23 sendNotification(new PropertyChangedEvent(this, PROPERTY_INITIAL));
21 }24 }
22 }25 }
2326
@@ -36,7 +39,7 @@
36 public void setFinal(boolean value) {39 public void setFinal(boolean value) {
37 if (finalState != value) {40 if (finalState != value) {
38 finalState = value;41 finalState = value;
39 sendNotification(new PropertyChangedEvent(this, "final"));42 sendNotification(new PropertyChangedEvent(this, PROPERTY_FINAL));
40 }43 }
41 }44 }
4245
4346
=== modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/SymbolConsistencySupervisor.java'
--- FsmPlugin/src/org/workcraft/plugins/fsm/SymbolConsistencySupervisor.java 2015-01-15 18:02:07 +0000
+++ FsmPlugin/src/org/workcraft/plugins/fsm/SymbolConsistencySupervisor.java 2015-06-26 22:23:53 +0000
@@ -21,7 +21,7 @@
21 if (e instanceof PropertyChangedEvent) {21 if (e instanceof PropertyChangedEvent) {
22 PropertyChangedEvent pce = (PropertyChangedEvent)e;22 PropertyChangedEvent pce = (PropertyChangedEvent)e;
23 Object sender = e.getSender();23 Object sender = e.getSender();
24 if ((sender instanceof Event) && pce.getPropertyName().equals("symbol")) {24 if ((sender instanceof Event) && pce.getPropertyName().equals(Event.PROPERTY_SYMBOL)) {
25 // Update the collection of symbols on a change of event symbol property25 // Update the collection of symbols on a change of event symbol property
26 handleEventSymbolChange((Event)sender);26 handleEventSymbolChange((Event)sender);
27 }27 }
2828
=== modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/VisualEvent.java'
--- FsmPlugin/src/org/workcraft/plugins/fsm/VisualEvent.java 2015-04-13 18:41:37 +0000
+++ FsmPlugin/src/org/workcraft/plugins/fsm/VisualEvent.java 2015-06-26 22:23:53 +0000
@@ -16,10 +16,13 @@
16import org.workcraft.gui.Coloriser;16import org.workcraft.gui.Coloriser;
17import org.workcraft.gui.graph.tools.Decoration;17import org.workcraft.gui.graph.tools.Decoration;
18import org.workcraft.gui.propertyeditor.PropertyDeclaration;18import org.workcraft.gui.propertyeditor.PropertyDeclaration;
19import org.workcraft.observation.PropertyChangedEvent;
19import org.workcraft.plugins.shared.CommonVisualSettings;20import org.workcraft.plugins.shared.CommonVisualSettings;
20import org.workcraft.util.Geometry;21import org.workcraft.util.Geometry;
2122
22public class VisualEvent extends VisualConnection {23public class VisualEvent extends VisualConnection {
24 public static final String PROPERTY_LABEL_COLOR = "Label color";
25
23 // Epsilon symbol in UTF-8 encoding (avoid inserting UTF symbols directly in the source code). 26 // Epsilon symbol in UTF-8 encoding (avoid inserting UTF symbols directly in the source code).
24 public static final char EPSILON_SYMBOL = 0x03B5;27 public static final char EPSILON_SYMBOL = 0x03B5;
25 28
@@ -43,7 +46,7 @@
4346
44 private void addPropertyDeclarations() {47 private void addPropertyDeclarations() {
45 addPropertyDeclaration(new PropertyDeclaration<VisualEvent, Color>(48 addPropertyDeclaration(new PropertyDeclaration<VisualEvent, Color>(
46 this, "Label color", Color.class) {49 this, PROPERTY_LABEL_COLOR, Color.class) {
47 protected void setter(VisualEvent object, Color value) {50 protected void setter(VisualEvent object, Color value) {
48 object.setLabelColor(value);51 object.setLabelColor(value);
49 }52 }
@@ -144,6 +147,7 @@
144147
145 public void setLabelColor(Color symbolColor) {148 public void setLabelColor(Color symbolColor) {
146 this.labelColor = symbolColor;149 this.labelColor = symbolColor;
150 sendNotification(new PropertyChangedEvent(this, PROPERTY_LABEL_COLOR));
147 }151 }
148 152
149}153}
150154
=== modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/VisualState.java'
--- FsmPlugin/src/org/workcraft/plugins/fsm/VisualState.java 2015-04-13 18:41:37 +0000
+++ FsmPlugin/src/org/workcraft/plugins/fsm/VisualState.java 2015-06-26 22:23:53 +0000
@@ -32,7 +32,7 @@
3232
33 private void addPropertyDeclarations() {33 private void addPropertyDeclarations() {
34 addPropertyDeclaration(new PropertyDeclaration<VisualState, Boolean>(34 addPropertyDeclaration(new PropertyDeclaration<VisualState, Boolean>(
35 this, "Initial", Boolean.class, true, false, false) { 35 this, State.PROPERTY_INITIAL, Boolean.class, true, false, false) {
36 public void setter(VisualState object, Boolean value) {36 public void setter(VisualState object, Boolean value) {
37 object.getReferencedState().setInitial(value);37 object.getReferencedState().setInitial(value);
38 }38 }
@@ -42,7 +42,7 @@
42 });42 });
4343
44 addPropertyDeclaration(new PropertyDeclaration<VisualState, Boolean>(44 addPropertyDeclaration(new PropertyDeclaration<VisualState, Boolean>(
45 this, "Final", Boolean.class, true, true, true) { 45 this, State.PROPERTY_FINAL, Boolean.class, true, true, true) {
46 public void setter(VisualState object, Boolean value) {46 public void setter(VisualState object, Boolean value) {
47 object.getReferencedState().setFinal(value);47 object.getReferencedState().setFinal(value);
48 }48 }
4949
=== modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/propertydescriptors/EventSymbolPropertyDescriptor.java'
--- FsmPlugin/src/org/workcraft/plugins/fsm/propertydescriptors/EventSymbolPropertyDescriptor.java 2015-04-13 18:41:37 +0000
+++ FsmPlugin/src/org/workcraft/plugins/fsm/propertydescriptors/EventSymbolPropertyDescriptor.java 2015-06-26 22:23:53 +0000
@@ -25,7 +25,7 @@
2525
26 @Override26 @Override
27 public String getName() {27 public String getName() {
28 return "Symbol";28 return Event.PROPERTY_SYMBOL;
29 }29 }
3030
31 @Override31 @Override
3232
=== modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/propertydescriptors/SymbolPropertyDescriptor.java'
--- FsmPlugin/src/org/workcraft/plugins/fsm/propertydescriptors/SymbolPropertyDescriptor.java 2015-04-13 18:41:37 +0000
+++ FsmPlugin/src/org/workcraft/plugins/fsm/propertydescriptors/SymbolPropertyDescriptor.java 2015-06-26 22:23:53 +0000
@@ -62,7 +62,7 @@
62 if (node == null) {62 if (node == null) {
63 fsm.setName(symbol, name);63 fsm.setName(symbol, name);
64 for (Event event: fsm.getEvents(symbol)) {64 for (Event event: fsm.getEvents(symbol)) {
65 event.sendNotification(new PropertyChangedEvent(event, "symbol"));65 event.sendNotification(new PropertyChangedEvent(event, Event.PROPERTY_SYMBOL));
66 }66 }
67 } else if (node instanceof Symbol) {67 } else if (node instanceof Symbol) {
68 } else {68 } else {
6969
=== modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/tools/DeadlockCheckerTool.java'
--- FsmPlugin/src/org/workcraft/plugins/fsm/tools/DeadlockCheckerTool.java 2015-01-26 12:46:03 +0000
+++ FsmPlugin/src/org/workcraft/plugins/fsm/tools/DeadlockCheckerTool.java 2015-06-26 22:23:53 +0000
@@ -22,7 +22,7 @@
2222
23 @Override23 @Override
24 public String getSection() {24 public String getSection() {
25 return "Verification";25 return "!Verification";
26 }26 }
2727
28 @Override28 @Override
2929
=== modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/tools/DeterminismCheckerTool.java'
--- FsmPlugin/src/org/workcraft/plugins/fsm/tools/DeterminismCheckerTool.java 2015-01-26 12:46:03 +0000
+++ FsmPlugin/src/org/workcraft/plugins/fsm/tools/DeterminismCheckerTool.java 2015-06-26 22:23:53 +0000
@@ -21,7 +21,7 @@
2121
22 @Override22 @Override
23 public String getSection() {23 public String getSection() {
24 return "Verification";24 return "!Verification";
25 }25 }
2626
27 @Override27 @Override
2828
=== modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/tools/ReachabilityCheckerTool.java'
--- FsmPlugin/src/org/workcraft/plugins/fsm/tools/ReachabilityCheckerTool.java 2015-01-26 12:46:03 +0000
+++ FsmPlugin/src/org/workcraft/plugins/fsm/tools/ReachabilityCheckerTool.java 2015-06-26 22:23:53 +0000
@@ -22,7 +22,7 @@
2222
23 @Override23 @Override
24 public String getSection() {24 public String getSection() {
25 return "Verification";25 return "!Verification";
26 }26 }
2727
28 @Override28 @Override
2929
=== modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/tools/ReversibilityCheckerTool.java'
--- FsmPlugin/src/org/workcraft/plugins/fsm/tools/ReversibilityCheckerTool.java 2015-01-26 12:46:03 +0000
+++ FsmPlugin/src/org/workcraft/plugins/fsm/tools/ReversibilityCheckerTool.java 2015-06-26 22:23:53 +0000
@@ -22,7 +22,7 @@
2222
23 @Override23 @Override
24 public String getSection() {24 public String getSection() {
25 return "Verification";25 return "!Verification";
26 }26 }
2727
28 @Override28 @Override
2929
=== modified file 'FstPlugin/src/org/workcraft/plugins/fst/Fst.java'
--- FstPlugin/src/org/workcraft/plugins/fst/Fst.java 2015-04-13 18:41:37 +0000
+++ FstPlugin/src/org/workcraft/plugins/fst/Fst.java 2015-06-26 22:23:53 +0000
@@ -1,6 +1,7 @@
1package org.workcraft.plugins.fst;1package org.workcraft.plugins.fst;
22
3import java.util.Collection;3import java.util.Collection;
4import java.util.LinkedList;
45
5import org.workcraft.annotations.VisualClass;6import org.workcraft.annotations.VisualClass;
6import org.workcraft.dom.Container;7import org.workcraft.dom.Container;
@@ -8,6 +9,7 @@
8import org.workcraft.dom.references.HierarchicalUniqueNameReferenceManager;9import org.workcraft.dom.references.HierarchicalUniqueNameReferenceManager;
9import org.workcraft.exceptions.ArgumentException;10import org.workcraft.exceptions.ArgumentException;
10import org.workcraft.gui.propertyeditor.ModelProperties;11import org.workcraft.gui.propertyeditor.ModelProperties;
12import org.workcraft.gui.propertyeditor.PropertyDescriptor;
11import org.workcraft.observation.PropertyChangedEvent;13import org.workcraft.observation.PropertyChangedEvent;
12import org.workcraft.observation.StateEvent;14import org.workcraft.observation.StateEvent;
13import org.workcraft.observation.StateSupervisor;15import org.workcraft.observation.StateSupervisor;
@@ -33,9 +35,9 @@
33 if (e instanceof PropertyChangedEvent) {35 if (e instanceof PropertyChangedEvent) {
34 PropertyChangedEvent pce = (PropertyChangedEvent)e;36 PropertyChangedEvent pce = (PropertyChangedEvent)e;
35 Object sender = e.getSender();37 Object sender = e.getSender();
36 if ((sender instanceof Signal) && pce.getPropertyName().equals("type")) {38 if ((sender instanceof Signal) && pce.getPropertyName().equals(Signal.PROPERTY_TYPE)) {
37 for (Event event: getEvents((Signal)sender)) {39 for (Event event: getEvents((Signal)sender)) {
38 event.sendNotification(new PropertyChangedEvent(event, "type"));40 event.sendNotification(new PropertyChangedEvent(event, Signal.PROPERTY_TYPE));
39 }41 }
40 }42 }
41 }43 }
@@ -123,19 +125,22 @@
123 public ModelProperties getProperties(Node node) {125 public ModelProperties getProperties(Node node) {
124 ModelProperties properties = super.getProperties(node);126 ModelProperties properties = super.getProperties(node);
125 if (node == null) {127 if (node == null) {
128 LinkedList<PropertyDescriptor> signalDescriptors= new LinkedList<>();
126 for (final Signal signal: getSignals()) {129 for (final Signal signal: getSignals()) {
127 properties.add(new SignalTypePropertyDescriptor(this, signal));130 signalDescriptors.add(new SignalTypePropertyDescriptor(this, signal));
128 }131 }
129 properties.sortByPropertyName();132 properties.addSorted(signalDescriptors);
130 } else if (node instanceof SignalEvent) {133 } else if (node instanceof SignalEvent) {
134 LinkedList<PropertyDescriptor> eventDescriptors= new LinkedList<>();
131 SignalEvent signalEvent = (SignalEvent) node;135 SignalEvent signalEvent = (SignalEvent) node;
132 properties.add(new EventSignalPropertyDescriptor(this, signalEvent));136 eventDescriptors.add(new EventSignalPropertyDescriptor(this, signalEvent));
133 Signal signal = signalEvent.getSignal();137 Signal signal = signalEvent.getSignal();
134 properties.add(new TypePropertyDescriptor(signal));138 eventDescriptors.add(new TypePropertyDescriptor(signal));
135 if (signal.hasDirection()) {139 if (signal.hasDirection()) {
136 properties.add(new DirectionPropertyDescriptor(signalEvent));140 eventDescriptors.add(new DirectionPropertyDescriptor(signalEvent));
137 }141 }
138 properties.removeByName("Symbol");142 properties.addSorted(eventDescriptors);
143 properties.removeByName(Event.PROPERTY_SYMBOL);
139 }144 }
140 return properties;145 return properties;
141 }146 }
142147
=== modified file 'FstPlugin/src/org/workcraft/plugins/fst/Signal.java'
--- FstPlugin/src/org/workcraft/plugins/fst/Signal.java 2015-01-12 22:09:40 +0000
+++ FstPlugin/src/org/workcraft/plugins/fst/Signal.java 2015-06-26 22:23:53 +0000
@@ -6,6 +6,8 @@
66
7public class Signal extends Symbol {7public class Signal extends Symbol {
8 8
9 public static final String PROPERTY_TYPE = "Type";
10
9 public enum Type {11 public enum Type {
10 INPUT("input"),12 INPUT("input"),
11 OUTPUT("output"),13 OUTPUT("output"),
@@ -44,7 +46,7 @@
4446
45 public void setType(Type type) {47 public void setType(Type type) {
46 this.type = type;48 this.type = type;
47 sendNotification(new PropertyChangedEvent(this, "type"));49 sendNotification(new PropertyChangedEvent(this, PROPERTY_TYPE));
48 }50 }
49 51
50 public boolean hasDirection() {52 public boolean hasDirection() {
5153
=== modified file 'FstPlugin/src/org/workcraft/plugins/fst/SignalEvent.java'
--- FstPlugin/src/org/workcraft/plugins/fst/SignalEvent.java 2015-01-12 22:09:40 +0000
+++ FstPlugin/src/org/workcraft/plugins/fst/SignalEvent.java 2015-06-26 22:23:53 +0000
@@ -11,6 +11,8 @@
11@VisualClass(org.workcraft.plugins.fst.VisualSignalEvent.class)11@VisualClass(org.workcraft.plugins.fst.VisualSignalEvent.class)
12public class SignalEvent extends Event {12public class SignalEvent extends Event {
1313
14 public static final String PROPERTY_DIRECTION = "Direction";
15
14 public enum Direction {16 public enum Direction {
15 PLUS("+"),17 PLUS("+"),
16 MINUS("-"),18 MINUS("-"),
@@ -52,7 +54,7 @@
5254
53 public void setDirection(Direction direction) {55 public void setDirection(Direction direction) {
54 this.direction = direction;56 this.direction = direction;
55 sendNotification(new PropertyChangedEvent(this, "direction"));57 sendNotification(new PropertyChangedEvent(this, PROPERTY_DIRECTION));
56 }58 }
57 59
58 public Signal getSignal() {60 public Signal getSignal() {
5961
=== modified file 'FstPlugin/src/org/workcraft/plugins/fst/propertydescriptors/DirectionPropertyDescriptor.java'
--- FstPlugin/src/org/workcraft/plugins/fst/propertydescriptors/DirectionPropertyDescriptor.java 2015-04-13 18:41:37 +0000
+++ FstPlugin/src/org/workcraft/plugins/fst/propertydescriptors/DirectionPropertyDescriptor.java 2015-06-26 22:23:53 +0000
@@ -18,7 +18,7 @@
1818
19 @Override19 @Override
20 public String getName() {20 public String getName() {
21 return "Direction";21 return SignalEvent.PROPERTY_DIRECTION;
22 }22 }
2323
24 @Override24 @Override
2525
=== modified file 'FstPlugin/src/org/workcraft/plugins/fst/propertydescriptors/TypePropertyDescriptor.java'
--- FstPlugin/src/org/workcraft/plugins/fst/propertydescriptors/TypePropertyDescriptor.java 2015-04-13 18:41:37 +0000
+++ FstPlugin/src/org/workcraft/plugins/fst/propertydescriptors/TypePropertyDescriptor.java 2015-06-26 22:23:53 +0000
@@ -9,6 +9,7 @@
9import org.workcraft.plugins.fst.Signal.Type;9import org.workcraft.plugins.fst.Signal.Type;
1010
11public class TypePropertyDescriptor implements PropertyDescriptor {11public class TypePropertyDescriptor implements PropertyDescriptor {
12
12 private final Signal signal;13 private final Signal signal;
13 14
14 public TypePropertyDescriptor(Signal signal) {15 public TypePropertyDescriptor(Signal signal) {
@@ -17,7 +18,7 @@
1718
18 @Override19 @Override
19 public String getName() {20 public String getName() {
20 return "Signal type";21 return Signal.PROPERTY_TYPE;
21 }22 }
2223
23 @Override24 @Override
2425
=== modified file 'FstPlugin/src/org/workcraft/plugins/fst/tools/FstSimulationTool.java'
--- FstPlugin/src/org/workcraft/plugins/fst/tools/FstSimulationTool.java 2015-05-27 12:14:35 +0000
+++ FstPlugin/src/org/workcraft/plugins/fst/tools/FstSimulationTool.java 2015-06-26 22:23:53 +0000
@@ -37,7 +37,7 @@
37 @Override37 @Override
38 public void activated(final GraphEditor editor) {38 public void activated(final GraphEditor editor) {
39 super.activated(editor);39 super.activated(editor);
40 setStatePaneVisibility(false);40 setStatePaneVisibility(true);
41 }41 }
42 42
43 @Override43 @Override
4444
=== modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/AbstractMpsatChecker.java'
--- MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/AbstractMpsatChecker.java 2015-04-23 12:19:54 +0000
+++ MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/AbstractMpsatChecker.java 2015-06-26 22:23:53 +0000
@@ -11,7 +11,7 @@
11 11
12 @Override12 @Override
13 public final String getSection() {13 public final String getSection() {
14 return "Verification";14 return "!Verification";
15 }15 }
16 16
17 @Override17 @Override
1818
=== modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatConformationChecker.java'
--- MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatConformationChecker.java 2015-04-23 12:19:54 +0000
+++ MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatConformationChecker.java 2015-06-26 22:23:53 +0000
@@ -16,7 +16,7 @@
1616
17 @Override17 @Override
18 public String getSection() {18 public String getSection() {
19 return "Verification";19 return "!Verification";
20 }20 }
2121
22 @Override22 @Override
2323
=== modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatCustomPropertyChecker.java'
--- MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatCustomPropertyChecker.java 2015-04-30 23:14:48 +0000
+++ MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatCustomPropertyChecker.java 2015-06-26 22:23:53 +0000
@@ -20,7 +20,7 @@
2020
21 @Override21 @Override
22 public String getSection() {22 public String getSection() {
23 return "Verification";23 return "!Verification";
24 }24 }
2525
26 @Override26 @Override
2727
=== modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatSynthesis.java'
--- MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatSynthesis.java 2015-04-28 22:14:55 +0000
+++ MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatSynthesis.java 2015-06-26 22:23:53 +0000
@@ -20,7 +20,7 @@
2020
21 @Override21 @Override
22 public String getSection() {22 public String getSection() {
23 return "Synthesis";23 return "!Synthesis";
24 }24 }
2525
26 @Override26 @Override
2727
=== modified file 'PetriNetPlugin/src/org/workcraft/plugins/petri/Place.java'
--- PetriNetPlugin/src/org/workcraft/plugins/petri/Place.java 2013-07-25 12:29:40 +0000
+++ PetriNetPlugin/src/org/workcraft/plugins/petri/Place.java 2015-06-26 22:23:53 +0000
@@ -28,6 +28,9 @@
2828
29@VisualClass(org.workcraft.plugins.petri.VisualPlace.class)29@VisualClass(org.workcraft.plugins.petri.VisualPlace.class)
30public class Place extends MathNode {30public class Place extends MathNode {
31 public static final String PROPERTY_CAPACITY = "Capacity";
32 public static final String PROPERTY_TOKENS = "Tokens";
33
31 protected int tokens = 0;34 protected int tokens = 0;
32 protected int capacity = 1;35 protected int capacity = 1;
33 36
@@ -43,7 +46,7 @@
43 capacity = tokens;46 capacity = tokens;
44 }47 }
45 this.tokens = tokens;48 this.tokens = tokens;
46 sendNotification( new PropertyChangedEvent(this, "tokens") );49 sendNotification( new PropertyChangedEvent(this, PROPERTY_TOKENS) );
47 }50 }
4851
49 public int getCapacity() {52 public int getCapacity() {
@@ -58,6 +61,6 @@
58 throw new ArgumentException("The place capacity "+ capacity + " is too small for the current number of tokens " + tokens + " .");61 throw new ArgumentException("The place capacity "+ capacity + " is too small for the current number of tokens " + tokens + " .");
59 }62 }
60 this.capacity = capacity;63 this.capacity = capacity;
61 sendNotification ( new PropertyChangedEvent (this, "capacity"));64 sendNotification ( new PropertyChangedEvent (this, PROPERTY_CAPACITY));
62 }65 }
63}66}
6467
=== modified file 'PetriNetPlugin/src/org/workcraft/plugins/petri/VisualPlace.java'
--- PetriNetPlugin/src/org/workcraft/plugins/petri/VisualPlace.java 2014-12-18 16:28:25 +0000
+++ PetriNetPlugin/src/org/workcraft/plugins/petri/VisualPlace.java 2015-06-26 22:23:53 +0000
@@ -48,6 +48,7 @@
48@Hotkey(KeyEvent.VK_P)48@Hotkey(KeyEvent.VK_P)
49@SVGIcon("images/icons/svg/place.svg")49@SVGIcon("images/icons/svg/place.svg")
50public class VisualPlace extends VisualComponent {50public class VisualPlace extends VisualComponent {
51 public static final String PROPERTY_TOKEN_COLOR = "Token color";
51 protected static double singleTokenSize = CommonVisualSettings.getBaseSize() / 1.9;52 protected static double singleTokenSize = CommonVisualSettings.getBaseSize() / 1.9;
52 protected static double multipleTokenSeparation = CommonVisualSettings.getStrokeWidth() / 8;53 protected static double multipleTokenSeparation = CommonVisualSettings.getStrokeWidth() / 8;
53 protected Color tokenColor = CommonVisualSettings.getBorderColor();54 protected Color tokenColor = CommonVisualSettings.getBorderColor();
@@ -59,7 +60,7 @@
59 60
60 private void addPropertyDeclarations() {61 private void addPropertyDeclarations() {
61 addPropertyDeclaration(new PropertyDeclaration<VisualPlace, Integer>(62 addPropertyDeclaration(new PropertyDeclaration<VisualPlace, Integer>(
62 this, "Tokens", Integer.class) {63 this, Place.PROPERTY_TOKENS, Integer.class) {
63 public void setter(VisualPlace object, Integer value) {64 public void setter(VisualPlace object, Integer value) {
64 object.getReferencedPlace().setTokens(value);65 object.getReferencedPlace().setTokens(value);
65 }66 }
@@ -69,7 +70,7 @@
69 });70 });
7071
71 addPropertyDeclaration(new PropertyDeclaration<VisualPlace, Color>(72 addPropertyDeclaration(new PropertyDeclaration<VisualPlace, Color>(
72 this, "Token color", Color.class) {73 this, PROPERTY_TOKEN_COLOR, Color.class) {
73 public void setter(VisualPlace object, Color value) {74 public void setter(VisualPlace object, Color value) {
74 object.setTokenColor(value);75 object.setTokenColor(value);
75 }76 }
@@ -79,7 +80,7 @@
79 });80 });
80 81
81 addPropertyDeclaration(new PropertyDeclaration<VisualPlace, Integer>(82 addPropertyDeclaration(new PropertyDeclaration<VisualPlace, Integer>(
82 this, "Capacity", Integer.class) {83 this, Place.PROPERTY_CAPACITY, Integer.class) {
83 public void setter(VisualPlace object, Integer value) {84 public void setter(VisualPlace object, Integer value) {
84 object.getReferencedPlace().setCapacity(value);85 object.getReferencedPlace().setCapacity(value);
85 }86 }
@@ -185,7 +186,7 @@
185186
186 public void setTokenColor(Color tokenColor) {187 public void setTokenColor(Color tokenColor) {
187 this.tokenColor = tokenColor;188 this.tokenColor = tokenColor;
188 sendNotification(new PropertyChangedEvent(this, "token color"));189 sendNotification(new PropertyChangedEvent(this, PROPERTY_TOKEN_COLOR));
189 }190 }
190191
191 @Override192 @Override
192193
=== modified file 'PetriNetPlugin/src/org/workcraft/plugins/petri/tools/PetriNetSimulationTool.java'
--- PetriNetPlugin/src/org/workcraft/plugins/petri/tools/PetriNetSimulationTool.java 2015-05-27 12:14:35 +0000
+++ PetriNetPlugin/src/org/workcraft/plugins/petri/tools/PetriNetSimulationTool.java 2015-06-26 22:23:53 +0000
@@ -67,6 +67,7 @@
67import org.workcraft.dom.Container;67import org.workcraft.dom.Container;
68import org.workcraft.dom.Node;68import org.workcraft.dom.Node;
69import org.workcraft.dom.math.MathModel;69import org.workcraft.dom.math.MathModel;
70import org.workcraft.dom.visual.FontHelper;
70import org.workcraft.dom.visual.HitMan;71import org.workcraft.dom.visual.HitMan;
71import org.workcraft.dom.visual.VisualGroup;72import org.workcraft.dom.visual.VisualGroup;
72import org.workcraft.dom.visual.VisualModel;73import org.workcraft.dom.visual.VisualModel;
@@ -82,6 +83,7 @@
82import org.workcraft.gui.graph.tools.Decorator;83import org.workcraft.gui.graph.tools.Decorator;
83import org.workcraft.gui.graph.tools.GraphEditor;84import org.workcraft.gui.graph.tools.GraphEditor;
84import org.workcraft.gui.layouts.WrapLayout;85import org.workcraft.gui.layouts.WrapLayout;
86import org.workcraft.gui.propertyeditor.PropertyEditorTable;
85import org.workcraft.plugins.petri.PetriNetModel;87import org.workcraft.plugins.petri.PetriNetModel;
86import org.workcraft.plugins.petri.Place;88import org.workcraft.plugins.petri.Place;
87import org.workcraft.plugins.petri.Transition;89import org.workcraft.plugins.petri.Transition;
@@ -177,6 +179,7 @@
177179
178 traceTable = new JTable(new TraceTableModel());180 traceTable = new JTable(new TraceTableModel());
179 traceTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);181 traceTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
182 traceTable.setRowHeight(FontHelper.getFontSizeInPixels(traceTable.getFont()));
180 traceTable.setDefaultRenderer(Object.class, new TraceTableCellRendererImplementation());183 traceTable.setDefaultRenderer(Object.class, new TraceTableCellRendererImplementation());
181 184
182 tracePane = new JScrollPane();185 tracePane = new JScrollPane();
@@ -687,10 +690,10 @@
687 private final class TraceTableCellRendererImplementation implements TableCellRenderer {690 private final class TraceTableCellRendererImplementation implements TableCellRenderer {
688 private final JLabel label = new JLabel() {691 private final JLabel label = new JLabel() {
689 @Override692 @Override
690 public void paint( Graphics g ) {693 public void paint(Graphics g) {
691 g.setColor( getBackground() );694 g.setColor(getBackground());
692 g.fillRect( 0, 0, getWidth() - 1, getHeight() - 1 );695 g.fillRect(0, 0, getWidth() - 1, getHeight() - 1);
693 super.paint( g );696 super.paint(g);
694 }697 }
695 };698 };
696699
@@ -700,7 +703,8 @@
700 return row == mainTrace.getPosition();703 return row == mainTrace.getPosition();
701 }704 }
702 } else {705 } else {
703 if (!branchTrace.isEmpty() && (row >= mainTrace.getPosition()) && (row < mainTrace.getPosition() + branchTrace.size())) {706 if (!branchTrace.isEmpty() && (row >= mainTrace.getPosition())
707 && (row < mainTrace.getPosition() + branchTrace.size())) {
704 return (row == mainTrace.getPosition() + branchTrace.getPosition());708 return (row == mainTrace.getPosition() + branchTrace.getPosition());
705 }709 }
706 }710 }
@@ -711,13 +715,15 @@
711 public Component getTableCellRendererComponent(JTable table, Object value, 715 public Component getTableCellRendererComponent(JTable table, Object value,
712 boolean isSelected, boolean hasFocus, int row, int column) {716 boolean isSelected, boolean hasFocus, int row, int column) {
713 JLabel result = null;717 JLabel result = null;
718 label.setBorder(PropertyEditorTable.BORDER_RENDER);
714 if ((net != null) && (value instanceof String)) {719 if ((net != null) && (value instanceof String)) {
715 label.setText((String) value);720 label.setText((String) value);
716 label.setForeground(Color.BLACK);
717 if (isActive(row, column)) {721 if (isActive(row, column)) {
718 label.setBackground(Color.YELLOW);722 label.setForeground(table.getSelectionForeground());
723 label.setBackground(table.getSelectionBackground());
719 } else {724 } else {
720 label.setBackground(Color.WHITE);725 label.setForeground(table.getForeground());
726 label.setBackground(table.getBackground());
721 }727 }
722 result = label;728 result = label;
723 }729 }
724730
=== modified file 'PetrifyPlugin/src/org/workcraft/plugins/petrify/tools/PetrifySynthesis.java'
--- PetrifyPlugin/src/org/workcraft/plugins/petrify/tools/PetrifySynthesis.java 2015-04-28 22:14:55 +0000
+++ PetrifyPlugin/src/org/workcraft/plugins/petrify/tools/PetrifySynthesis.java 2015-06-26 22:23:53 +0000
@@ -20,7 +20,7 @@
2020
21 @Override21 @Override
22 public String getSection() {22 public String getSection() {
23 return "Synthesis";23 return "!Synthesis";
24 }24 }
2525
26 @Override26 @Override
@@ -30,7 +30,7 @@
3030
31 @Override31 @Override
32 public void run(WorkspaceEntry we) {32 public void run(WorkspaceEntry we) {
33 // call petrify asynchronous (w/o blocking the GUI) 33 // Call Petrify asynchronously (without blocking the GUI)
34 try {34 try {
35 File instgFile = getInputSTG(WorkspaceUtils.getAs(we, STGModel.class));35 File instgFile = getInputSTG(WorkspaceUtils.getAs(we, STGModel.class));
36 File eqnFile = File.createTempFile("petrifyEquations", ".eqn");36 File eqnFile = File.createTempFile("petrifyEquations", ".eqn");
3737
=== modified file 'PolicyNetPlugin/src/org/workcraft/plugins/policy/Bundle.java'
--- PolicyNetPlugin/src/org/workcraft/plugins/policy/Bundle.java 2013-10-31 11:44:01 +0000
+++ PolicyNetPlugin/src/org/workcraft/plugins/policy/Bundle.java 2015-06-26 22:23:53 +0000
@@ -9,21 +9,26 @@
9import org.workcraft.observation.PropertyChangedEvent;9import org.workcraft.observation.PropertyChangedEvent;
1010
11public class Bundle extends MathNode {11public class Bundle extends MathNode {
12 public static final String PROPERTY_ADDED = "added";
13 public static final String PROPERTY_REMOVED = "removed";
14 public static final String PROPERTY_BUNDLED = "bundled";
15 public static final String PROPERTY_UNBUNDLED = "unbundled";
16
12 private final Set<BundledTransition> transitions = new HashSet<BundledTransition>();17 private final Set<BundledTransition> transitions = new HashSet<BundledTransition>();
1318
14 public void add(BundledTransition transition) {19 public void add(BundledTransition transition) {
15 if (transition != null) {20 if (transition != null) {
16 transitions.add(transition);21 transitions.add(transition);
17 sendNotification(new PropertyChangedEvent(this, "added"));22 sendNotification(new PropertyChangedEvent(this, PROPERTY_ADDED));
18 transition.sendNotification(new PropertyChangedEvent(this, "bundled"));23 transition.sendNotification(new PropertyChangedEvent(this, PROPERTY_BUNDLED));
19 }24 }
20 }25 }
21 26
22 public void remove(BundledTransition transition) {27 public void remove(BundledTransition transition) {
23 if (contains(transition)) {28 if (contains(transition)) {
24 transitions.remove(transition);29 transitions.remove(transition);
25 sendNotification(new PropertyChangedEvent(this, "removed"));30 sendNotification(new PropertyChangedEvent(this, PROPERTY_REMOVED));
26 transition.sendNotification(new PropertyChangedEvent(this, "unbundled"));31 transition.sendNotification(new PropertyChangedEvent(this, PROPERTY_UNBUNDLED));
27 }32 }
28 }33 }
2934
3035
=== modified file 'PolicyNetPlugin/src/org/workcraft/plugins/policy/VisualBundle.java'
--- PolicyNetPlugin/src/org/workcraft/plugins/policy/VisualBundle.java 2014-01-28 17:11:19 +0000
+++ PolicyNetPlugin/src/org/workcraft/plugins/policy/VisualBundle.java 2015-06-26 22:23:53 +0000
@@ -48,6 +48,8 @@
4848
49@DisplayName ("Bundle")49@DisplayName ("Bundle")
50public class VisualBundle extends VisualNode implements Drawable, DependentNode {50public class VisualBundle extends VisualNode implements Drawable, DependentNode {
51 public static final String PROPERTY_COLOR = "color";
52
51 private Bundle bundle;53 private Bundle bundle;
52 protected double strokeWidth = CommonVisualSettings.getStrokeWidth();54 protected double strokeWidth = CommonVisualSettings.getStrokeWidth();
53 private Color color = CieColorUtils.getLabColor(0.7f, (float)Math.random(), (float)Math.random());55 private Color color = CieColorUtils.getLabColor(0.7f, (float)Math.random(), (float)Math.random());
@@ -142,7 +144,7 @@
142144
143 public void setColor(Color value) {145 public void setColor(Color value) {
144 this.color = value;146 this.color = value;
145 sendNotification(new PropertyChangedEvent(this, "color"));147 sendNotification(new PropertyChangedEvent(this, PROPERTY_COLOR));
146 }148 }
147149
148 public Color getColor() {150 public Color getColor() {
149151
=== modified file 'PolicyNetPlugin/src/org/workcraft/plugins/policy/tools/CheckDeadlockTool.java'
--- PolicyNetPlugin/src/org/workcraft/plugins/policy/tools/CheckDeadlockTool.java 2015-04-23 12:19:54 +0000
+++ PolicyNetPlugin/src/org/workcraft/plugins/policy/tools/CheckDeadlockTool.java 2015-06-26 22:23:53 +0000
@@ -16,7 +16,7 @@
1616
17 @Override17 @Override
18 public String getSection() {18 public String getSection() {
19 return "Verification";19 return "!Verification";
20 }20 }
2121
22 @Override22 @Override
2323
=== modified file 'SONPlugin/src/org/workcraft/plugins/son/gui/OutputArea.java'
--- SONPlugin/src/org/workcraft/plugins/son/gui/OutputArea.java 2014-11-24 18:55:08 +0000
+++ SONPlugin/src/org/workcraft/plugins/son/gui/OutputArea.java 2015-06-26 22:23:53 +0000
@@ -80,7 +80,7 @@
80 myfile=new File(myfile.getAbsolutePath().concat(".txt")); 80 myfile=new File(myfile.getAbsolutePath().concat(".txt"));
81 } 81 }
82 }82 }
83 if(myfile==null || myfile.getName().equals(""))83 if(myfile==null || myfile.getName().isEmpty())
84 {84 {
85 JOptionPane.showMessageDialog(this,"Please enter a file name!","Error",JOptionPane.ERROR_MESSAGE);85 JOptionPane.showMessageDialog(this,"Please enter a file name!","Error",JOptionPane.ERROR_MESSAGE);
86 return;86 return;
8787
=== modified file 'STGPlugin/src/org/workcraft/plugins/stg/DummyTransition.java'
--- STGPlugin/src/org/workcraft/plugins/stg/DummyTransition.java 2014-11-07 18:09:40 +0000
+++ STGPlugin/src/org/workcraft/plugins/stg/DummyTransition.java 2015-06-26 22:23:53 +0000
@@ -29,12 +29,13 @@
29@DisplayName("Dummy transition")29@DisplayName("Dummy transition")
30@VisualClass(org.workcraft.plugins.stg.VisualDummyTransition.class)30@VisualClass(org.workcraft.plugins.stg.VisualDummyTransition.class)
31public class DummyTransition extends NamedTransition {31public class DummyTransition extends NamedTransition {
32 public static final String PROPERTY_NAME = "Name";
32 private String name;33 private String name;
33 34
34 @NoAutoSerialisation35 @NoAutoSerialisation
35 public void setName(String name) {36 public void setName(String name) {
36 this.name = name;37 this.name = name;
37 sendNotification(new PropertyChangedEvent(this, "name"));38 sendNotification(new PropertyChangedEvent(this, PROPERTY_NAME));
38 }39 }
3940
40 @NoAutoSerialisation41 @NoAutoSerialisation
4142
=== modified file 'STGPlugin/src/org/workcraft/plugins/stg/SignalTransition.java'
--- STGPlugin/src/org/workcraft/plugins/stg/SignalTransition.java 2015-01-09 12:41:39 +0000
+++ STGPlugin/src/org/workcraft/plugins/stg/SignalTransition.java 2015-06-26 22:23:53 +0000
@@ -31,6 +31,10 @@
31@VisualClass(org.workcraft.plugins.stg.VisualSignalTransition.class)31@VisualClass(org.workcraft.plugins.stg.VisualSignalTransition.class)
32public class SignalTransition extends NamedTransition 32public class SignalTransition extends NamedTransition
33{33{
34 public static final String PROPERTY_SIGNAL_TYPE = "Signal type";
35 public static final String PROPERTY_SIGNAL_NAME = "Signal name";
36 public static final String PROPERTY_DIRECTION = "Direction";
37
34 public enum Type {38 public enum Type {
35 INPUT("input"),39 INPUT("input"),
36 OUTPUT("output"),40 OUTPUT("output"),
@@ -85,7 +89,7 @@
85 public void setSignalType(Type type) {89 public void setSignalType(Type type) {
86 if (this.type != type) {90 if (this.type != type) {
87 this.type = type;91 this.type = type;
88 sendNotification(new PropertyChangedEvent(this, "signalType"));92 sendNotification(new PropertyChangedEvent(this, PROPERTY_SIGNAL_TYPE));
89 }93 }
90 }94 }
9195
@@ -96,7 +100,7 @@
96 public void setDirection(Direction direction) {100 public void setDirection(Direction direction) {
97 if (this.direction != direction) {101 if (this.direction != direction) {
98 this.direction = direction;102 this.direction = direction;
99 sendNotification(new PropertyChangedEvent(this, "direction"));103 sendNotification(new PropertyChangedEvent(this, PROPERTY_DIRECTION));
100 }104 }
101 }105 }
102106
@@ -108,7 +112,7 @@
108 @NoAutoSerialisation112 @NoAutoSerialisation
109 public void setSignalName(String signalName) {113 public void setSignalName(String signalName) {
110 this.signalName = signalName;114 this.signalName = signalName;
111 sendNotification(new PropertyChangedEvent(this, "signalName"));115 sendNotification(new PropertyChangedEvent(this, PROPERTY_SIGNAL_NAME));
112 }116 }
113 117
114 @NoAutoSerialisation118 @NoAutoSerialisation
115119
=== modified file 'STGPlugin/src/org/workcraft/plugins/stg/SignalTypeConsistencySupervisor.java'
--- STGPlugin/src/org/workcraft/plugins/stg/SignalTypeConsistencySupervisor.java 2015-01-15 18:02:07 +0000
+++ STGPlugin/src/org/workcraft/plugins/stg/SignalTypeConsistencySupervisor.java 2015-06-26 22:23:53 +0000
@@ -42,18 +42,19 @@
42 public void handleEvent(StateEvent e) {42 public void handleEvent(StateEvent e) {
43 if (e instanceof PropertyChangedEvent) {43 if (e instanceof PropertyChangedEvent) {
44 PropertyChangedEvent pce = (PropertyChangedEvent)e;44 PropertyChangedEvent pce = (PropertyChangedEvent)e;
45 if (pce.getPropertyName().equals("signalType") || pce.getPropertyName().equals("signalName")) {45 String propertyName = pce.getPropertyName();
46 if (propertyName.equals(SignalTransition.PROPERTY_SIGNAL_TYPE) || propertyName.equals(SignalTransition.PROPERTY_SIGNAL_NAME)) {
46 SignalTransition t = (SignalTransition)e.getSender();47 SignalTransition t = (SignalTransition)e.getSender();
47 String signalName = t.getSignalName();48 String signalName = t.getSignalName();
48 Container container = (Container)t.getParent();49 Container container = (Container)t.getParent();
49 SignalTransition.Type signalType = t.getSignalType();50 SignalTransition.Type signalType = t.getSignalType();
50 final Collection<SignalTransition> transitions = stg.getSignalTransitions(signalName, container);51 final Collection<SignalTransition> transitions = stg.getSignalTransitions(signalName, container);
51 if (pce.getPropertyName().equals("signalType")) {52 if (propertyName.equals(SignalTransition.PROPERTY_SIGNAL_TYPE)) {
52 for (SignalTransition tt : transitions) {53 for (SignalTransition tt : transitions) {
53 tt.setSignalType(signalType);54 tt.setSignalType(signalType);
54 }55 }
55 }56 }
56 if (pce.getPropertyName().equals("signalName")) {57 if (propertyName.equals(SignalTransition.PROPERTY_SIGNAL_NAME)) {
57 for (SignalTransition tt : transitions) {58 for (SignalTransition tt : transitions) {
58 if (tt == t) continue;59 if (tt == t) continue;
59 t.setSignalType(tt.getSignalType());60 t.setSignalType(tt.getSignalType());
6061
=== modified file 'STGPlugin/src/org/workcraft/plugins/stg/VisualImplicitPlaceArc.java'
--- STGPlugin/src/org/workcraft/plugins/stg/VisualImplicitPlaceArc.java 2014-12-16 18:20:48 +0000
+++ STGPlugin/src/org/workcraft/plugins/stg/VisualImplicitPlaceArc.java 2015-06-26 22:23:53 +0000
@@ -78,7 +78,7 @@
78 78
79 private void addPropertyDeclarations() {79 private void addPropertyDeclarations() {
80 addPropertyDeclaration(new PropertyDeclaration<VisualImplicitPlaceArc, Integer>(80 addPropertyDeclaration(new PropertyDeclaration<VisualImplicitPlaceArc, Integer>(
81 this, "Tokens", Integer.class) {81 this, Place.PROPERTY_TOKENS, Integer.class) {
82 public void setter(VisualImplicitPlaceArc object, Integer value) {82 public void setter(VisualImplicitPlaceArc object, Integer value) {
83 object.getImplicitPlace().setTokens(value);83 object.getImplicitPlace().setTokens(value);
84 }84 }
@@ -88,7 +88,7 @@
88 });88 });
89 89
90 addPropertyDeclaration(new PropertyDeclaration<VisualImplicitPlaceArc, Integer>(90 addPropertyDeclaration(new PropertyDeclaration<VisualImplicitPlaceArc, Integer>(
91 this, "Capacity", Integer.class) {91 this, Place.PROPERTY_CAPACITY, Integer.class) {
92 public void setter(VisualImplicitPlaceArc object, Integer value) {92 public void setter(VisualImplicitPlaceArc object, Integer value) {
93 object.getImplicitPlace().setCapacity(value);93 object.getImplicitPlace().setCapacity(value);
94 }94 }
@@ -98,7 +98,7 @@
98 });98 });
99 99
100 addPropertyDeclaration(new PropertyDeclaration<VisualImplicitPlaceArc, Color>(100 addPropertyDeclaration(new PropertyDeclaration<VisualImplicitPlaceArc, Color>(
101 this, "Token color", Color.class) {101 this, VisualPlace.PROPERTY_TOKEN_COLOR, Color.class) {
102 public void setter(VisualImplicitPlaceArc object, Color value) {102 public void setter(VisualImplicitPlaceArc object, Color value) {
103 object.setTokenColor(value);103 object.setTokenColor(value);
104 }104 }
@@ -182,7 +182,7 @@
182182
183 public void setTokenColor(Color tokenColor) {183 public void setTokenColor(Color tokenColor) {
184 this.tokenColor = tokenColor;184 this.tokenColor = tokenColor;
185 sendNotification(new PropertyChangedEvent(this, "token color"));185 sendNotification(new PropertyChangedEvent(this, VisualPlace.PROPERTY_TOKEN_COLOR));
186 }186 }
187187
188 @Override188 @Override
189189
=== modified file 'STGPlugin/src/org/workcraft/plugins/stg/VisualSTG.java'
--- STGPlugin/src/org/workcraft/plugins/stg/VisualSTG.java 2015-05-06 21:13:09 +0000
+++ STGPlugin/src/org/workcraft/plugins/stg/VisualSTG.java 2015-06-26 22:23:53 +0000
@@ -47,6 +47,7 @@
47import org.workcraft.exceptions.InvalidConnectionException;47import org.workcraft.exceptions.InvalidConnectionException;
48import org.workcraft.exceptions.NodeCreationException;48import org.workcraft.exceptions.NodeCreationException;
49import org.workcraft.gui.propertyeditor.ModelProperties;49import org.workcraft.gui.propertyeditor.ModelProperties;
50import org.workcraft.gui.propertyeditor.PropertyDescriptor;
50import org.workcraft.plugins.petri.Place;51import org.workcraft.plugins.petri.Place;
51import org.workcraft.plugins.petri.Transition;52import org.workcraft.plugins.petri.Transition;
52import org.workcraft.plugins.petri.VisualPlace;53import org.workcraft.plugins.petri.VisualPlace;
@@ -335,12 +336,14 @@
335 ModelProperties properties = super.getProperties(node);336 ModelProperties properties = super.getProperties(node);
336 if (node == null) {337 if (node == null) {
337 for (Type type : Type.values()) {338 for (Type type : Type.values()) {
339 LinkedList<PropertyDescriptor> typeDescriptors = new LinkedList<>();
338 Container container = NamespaceHelper.getMathContainer(this, getCurrentLevel()); 340 Container container = NamespaceHelper.getMathContainer(this, getCurrentLevel());
339 for (final String signalName : stg.getSignalNames(type, container)) {341 for (final String signalName : stg.getSignalNames(type, container)) {
340 if (stg.getSignalTransitions(signalName, container).isEmpty()) continue;342 if (stg.getSignalTransitions(signalName, container).isEmpty()) continue;
341 properties.add(new SignalNamePropertyDescriptor(stg, signalName, container));343 typeDescriptors.add(new SignalNamePropertyDescriptor(stg, signalName, container));
342 properties.add(new SignalTypePropertyDescriptor(stg, signalName, container));344 typeDescriptors.add(new SignalTypePropertyDescriptor(stg, signalName, container));
343 }345 }
346 properties.addSorted(typeDescriptors);
344 }347 }
345 }348 }
346 return properties;349 return properties;
347350
=== modified file 'STGPlugin/src/org/workcraft/plugins/stg/propertydescriptors/DirectionPropertyDescriptor.java'
--- STGPlugin/src/org/workcraft/plugins/stg/propertydescriptors/DirectionPropertyDescriptor.java 2015-04-13 18:41:37 +0000
+++ STGPlugin/src/org/workcraft/plugins/stg/propertydescriptors/DirectionPropertyDescriptor.java 2015-06-26 22:23:53 +0000
@@ -7,6 +7,7 @@
7import org.workcraft.dom.Node;7import org.workcraft.dom.Node;
8import org.workcraft.gui.propertyeditor.PropertyDescriptor;8import org.workcraft.gui.propertyeditor.PropertyDescriptor;
9import org.workcraft.plugins.stg.STG;9import org.workcraft.plugins.stg.STG;
10import org.workcraft.plugins.stg.SignalTransition;
10import org.workcraft.plugins.stg.SignalTransition.Direction;11import org.workcraft.plugins.stg.SignalTransition.Direction;
1112
12public class DirectionPropertyDescriptor implements PropertyDescriptor {13public class DirectionPropertyDescriptor implements PropertyDescriptor {
@@ -20,7 +21,7 @@
2021
21 @Override22 @Override
22 public String getName() {23 public String getName() {
23 return "Direction";24 return SignalTransition.PROPERTY_DIRECTION;
24 }25 }
2526
26 @Override27 @Override
2728
=== modified file 'STGPlugin/src/org/workcraft/plugins/stg/propertydescriptors/TypePropertyDescriptor.java'
--- STGPlugin/src/org/workcraft/plugins/stg/propertydescriptors/TypePropertyDescriptor.java 2015-04-13 18:41:37 +0000
+++ STGPlugin/src/org/workcraft/plugins/stg/propertydescriptors/TypePropertyDescriptor.java 2015-06-26 22:23:53 +0000
@@ -10,6 +10,8 @@
10import org.workcraft.plugins.stg.SignalTransition.Type;10import org.workcraft.plugins.stg.SignalTransition.Type;
1111
12public class TypePropertyDescriptor implements PropertyDescriptor {12public class TypePropertyDescriptor implements PropertyDescriptor {
13 public static final String PROPERTY_SIGNAL_TYPE = "Signal type";
14
13 private final STG stg;15 private final STG stg;
14 private final SignalTransition transition;16 private final SignalTransition transition;
15 17
@@ -20,7 +22,7 @@
2022
21 @Override23 @Override
22 public String getName() {24 public String getName() {
23 return "Signal type";25 return PROPERTY_SIGNAL_TYPE;
24 }26 }
2527
26 @Override28 @Override
2729
=== modified file 'STGPlugin/src/org/workcraft/plugins/stg/tools/StgSimulationTool.java'
--- STGPlugin/src/org/workcraft/plugins/stg/tools/StgSimulationTool.java 2015-05-27 12:14:35 +0000
+++ STGPlugin/src/org/workcraft/plugins/stg/tools/StgSimulationTool.java 2015-06-26 22:23:53 +0000
@@ -18,9 +18,11 @@
18import org.workcraft.dom.Connection;18import org.workcraft.dom.Connection;
19import org.workcraft.dom.Node;19import org.workcraft.dom.Node;
20import org.workcraft.dom.hierarchy.NamespaceHelper;20import org.workcraft.dom.hierarchy.NamespaceHelper;
21import org.workcraft.dom.visual.FontHelper;
21import org.workcraft.dom.visual.connections.VisualConnection;22import org.workcraft.dom.visual.connections.VisualConnection;
22import org.workcraft.gui.Coloriser;23import org.workcraft.gui.Coloriser;
23import org.workcraft.gui.graph.tools.GraphEditor;24import org.workcraft.gui.graph.tools.GraphEditor;
25import org.workcraft.gui.propertyeditor.PropertyEditorTable;
24import org.workcraft.plugins.petri.Transition;26import org.workcraft.plugins.petri.Transition;
25import org.workcraft.plugins.petri.VisualPlace;27import org.workcraft.plugins.petri.VisualPlace;
26import org.workcraft.plugins.petri.VisualTransition;28import org.workcraft.plugins.petri.VisualTransition;
@@ -73,7 +75,7 @@
73 }75 }
7476
75 private final class StateTableCellRendererImplementation implements TableCellRenderer {77 private final class StateTableCellRendererImplementation implements TableCellRenderer {
76 JLabel label = new JLabel() {78 final JLabel label = new JLabel() {
77 @Override79 @Override
78 public void paint(Graphics g) {80 public void paint(Graphics g) {
79 g.setColor(getBackground());81 g.setColor(getBackground());
@@ -86,21 +88,25 @@
86 public Component getTableCellRendererComponent(JTable table, Object value, 88 public Component getTableCellRendererComponent(JTable table, Object value,
87 boolean isSelected, boolean hasFocus, int row, int column) {89 boolean isSelected, boolean hasFocus, int row, int column) {
88 JLabel result = null;90 JLabel result = null;
91 label.setBorder(PropertyEditorTable.BORDER_RENDER);
92 label.setBackground(table.getBackground());
89 if ((net != null) && (value instanceof SignalState)) {93 if ((net != null) && (value instanceof SignalState)) {
90 SignalState st = (SignalState)value;94 SignalState st = (SignalState)value;
91 if (column == 0) {95 if (column == 0) {
92 label.setText(st.name);96 label.setText(st.name);
93 label.setForeground(st.color);97 label.setForeground(st.color);
94 label.setFont(label.getFont().deriveFont(Font.PLAIN));98 Font plainFont = table.getFont().deriveFont(Font.PLAIN);
99 label.setFont(plainFont);
95 } else {100 } else {
96 if (st.value < 0) {101 if (st.value < 0) {
97 label.setText("?");102 label.setText("?");
98 } else {103 } else {
99 label.setText(Integer.toString(st.value));104 label.setText(Integer.toString(st.value));
100 }105 }
101 label.setForeground(Color.BLACK);106 label.setForeground(table.getForeground());
102 if (st.excited) {107 if (st.excited) {
103 label.setFont(label.getFont().deriveFont(Font.BOLD));108 Font boldFont = table.getFont().deriveFont(Font.BOLD);
109 label.setFont(boldFont);
104 }110 }
105 }111 }
106 result = label;112 result = label;
@@ -138,18 +144,19 @@
138 public Component getTableCellRendererComponent(JTable table, Object value, 144 public Component getTableCellRendererComponent(JTable table, Object value,
139 boolean isSelected, boolean hasFocus, int row, int column) {145 boolean isSelected, boolean hasFocus, int row, int column) {
140 JLabel result = null;146 JLabel result = null;
147 label.setBorder(PropertyEditorTable.BORDER_RENDER);
141 if ((net != null) && (value instanceof String)) {148 if ((net != null) && (value instanceof String)) {
142 label.setText((String) value);149 label.setText(value.toString());
143 Node node = net.getNodeByReference((String) value);150 Node node = net.getNodeByReference(value.toString());
144 if (node instanceof SignalTransition) {151 if (node instanceof SignalTransition) {
145 SignalTransition st = (SignalTransition)node;152 SignalTransition st = (SignalTransition)node;
146 Color color = getTypeColor(st.getSignalType());153 Color color = getTypeColor(st.getSignalType());
147 label.setForeground(color);154 label.setForeground(color);
148 }155 }
149 if (isActive(row, column)) {156 if (isActive(row, column)) {
150 label.setBackground(Color.YELLOW);157 label.setBackground(table.getSelectionBackground());
151 } else {158 } else {
152 label.setBackground(Color.WHITE);159 label.setBackground(table.getBackground());
153 }160 }
154 result = label;161 result = label;
155 }162 }
@@ -161,13 +168,11 @@
161 public void createInterfacePanel(final GraphEditor editor) {168 public void createInterfacePanel(final GraphEditor editor) {
162 super.createInterfacePanel(editor);169 super.createInterfacePanel(editor);
163 stateMap = new HashMap<String, SignalState>();170 stateMap = new HashMap<String, SignalState>();
164
165 stateTable = new JTable(new StateTableModel());171 stateTable = new JTable(new StateTableModel());
166 stateTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);172 stateTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
173 stateTable.setRowHeight(FontHelper.getFontSizeInPixels(stateTable.getFont()));
167 stateTable.setDefaultRenderer(Object.class, new StateTableCellRendererImplementation());174 stateTable.setDefaultRenderer(Object.class, new StateTableCellRendererImplementation());
168
169 statePane.setViewportView(stateTable);175 statePane.setViewportView(stateTable);
170
171 traceTable.setDefaultRenderer(Object.class, new TraceTableCellRendererImplementation());176 traceTable.setDefaultRenderer(Object.class, new TraceTableCellRendererImplementation());
172 }177 }
173 178
@@ -240,8 +245,9 @@
240 public void activated(final GraphEditor editor) {245 public void activated(final GraphEditor editor) {
241 super.activated(editor);246 super.activated(editor);
242 initialiseStateMap();247 initialiseStateMap();
248 setStatePaneVisibility(true);
243 }249 }
244 250
245 public String getTraceLabelByReference(String ref) {251 public String getTraceLabelByReference(String ref) {
246 String result = null;252 String result = null;
247 if (ref != null) {253 if (ref != null) {
248254
=== modified file 'WorkcraftCore/src/org/workcraft/dom/hierarchy/NamespaceHelper.java'
--- WorkcraftCore/src/org/workcraft/dom/hierarchy/NamespaceHelper.java 2015-05-14 18:00:15 +0000
+++ WorkcraftCore/src/org/workcraft/dom/hierarchy/NamespaceHelper.java 2015-06-26 22:23:53 +0000
@@ -45,7 +45,7 @@
45 45
46 String head = getReferenceHead(reference);46 String head = getReferenceHead(reference);
47 String tail = getReferenceTail(reference);47 String tail = getReferenceTail(reference);
48 if (tail.equals("")) { 48 if (tail.isEmpty()) {
49 return ret+head;49 return ret+head;
50 }50 }
51 return ret + head + hierarchicalToFlatName(tail, flatSeparator, false);51 return ret + head + hierarchicalToFlatName(tail, flatSeparator, false);
@@ -63,7 +63,7 @@
63 }63 }
64 64
65 public static void splitReference(String reference, LinkedList<String> path) {65 public static void splitReference(String reference, LinkedList<String> path) {
66 if (reference.equals("")) return;66 if (reference.isEmpty()) return;
67 67
68 Matcher matcher = hPattern.matcher(reference);68 Matcher matcher = hPattern.matcher(reference);
69 if (matcher.find()) {69 if (matcher.find()) {
@@ -127,7 +127,7 @@
127 public static String getReferenceName(String reference) {127 public static String getReferenceName(String reference) {
128 String head = getReferenceHead(reference);128 String head = getReferenceHead(reference);
129 String tail = getReferenceTail(reference);129 String tail = getReferenceTail(reference);
130 if (tail.equals("")) {130 if (tail.isEmpty()) {
131 return head;131 return head;
132 } 132 }
133 return getReferenceName(tail);133 return getReferenceName(tail);
134134
=== modified file 'WorkcraftCore/src/org/workcraft/dom/references/HierarchicalUniqueNameReferenceManager.java'
--- WorkcraftCore/src/org/workcraft/dom/references/HierarchicalUniqueNameReferenceManager.java 2015-05-14 18:00:15 +0000
+++ WorkcraftCore/src/org/workcraft/dom/references/HierarchicalUniqueNameReferenceManager.java 2015-06-26 22:23:53 +0000
@@ -136,7 +136,7 @@
136 if (provider==null) {136 if (provider==null) {
137 provider = topProvider;137 provider = topProvider;
138 }138 }
139 if (reference.equals("") || reference.equals(NamespaceHelper.hierarchySeparator)) { 139 if (reference.isEmpty() || reference.equals(NamespaceHelper.hierarchySeparator)) {
140 return provider;140 return provider;
141 }141 }
142 String head = NamespaceHelper.getReferenceHead(reference);142 String head = NamespaceHelper.getReferenceHead(reference);
@@ -163,7 +163,7 @@
163 do {163 do {
164 component = getNamespaceProvider(node);164 component = getNamespaceProvider(node);
165 if (component != null) {165 if (component != null) {
166 if (!result.equals("")) {166 if (!result.isEmpty()) {
167 result = NamespaceHelper.hierarchySeparator + result;167 result = NamespaceHelper.hierarchySeparator + result;
168 }168 }
169 String name = getNameManager(component).getName(node);169 String name = getNameManager(component).getName(node);
170170
=== added file 'WorkcraftCore/src/org/workcraft/dom/visual/FontHelper.java'
--- WorkcraftCore/src/org/workcraft/dom/visual/FontHelper.java 1970-01-01 00:00:00 +0000
+++ WorkcraftCore/src/org/workcraft/dom/visual/FontHelper.java 2015-06-26 22:23:53 +0000
@@ -0,0 +1,13 @@
1package org.workcraft.dom.visual;
2
3import java.awt.Font;
4import java.awt.Toolkit;
5
6public class FontHelper {
7
8 public static int getFontSizeInPixels(Font font) {
9 int screenDpi = Toolkit.getDefaultToolkit().getScreenResolution();
10 return (int)Math.round(font.getSize2D() * screenDpi / 72.0);
11 }
12
13}
014
=== modified file 'WorkcraftCore/src/org/workcraft/dom/visual/VisualComponent.java'
--- WorkcraftCore/src/org/workcraft/dom/visual/VisualComponent.java 2015-02-27 18:31:36 +0000
+++ WorkcraftCore/src/org/workcraft/dom/visual/VisualComponent.java 2015-06-26 22:23:53 +0000
@@ -43,6 +43,14 @@
43import org.workcraft.plugins.shared.CommonVisualSettings;43import org.workcraft.plugins.shared.CommonVisualSettings;
4444
45public abstract class VisualComponent extends VisualTransformableNode implements Drawable, DependentNode {45public abstract class VisualComponent extends VisualTransformableNode implements Drawable, DependentNode {
46 public static final String PROPERTY_LABEL = "Label";
47 public static final String PROPERTY_LABEL_POSITIONING = "Label positioning";
48 public static final String PROPERTY_LABEL_COLOR = "Label color";
49 public static final String PROPERTY_NAME_POSITIONING = "Name positioning";
50 public static final String PROPERTY_NAME_COLOR = "Name color";
51 public static final String PROPERTY_FOREGROUND_COLOR = "Foreground color";
52 public static final String PROPERTY_FILL_COLOR = "Fill color";
53
46 public static final Font labelFont = new Font("Sans-serif", Font.PLAIN, 1).deriveFont(0.5f);54 public static final Font labelFont = new Font("Sans-serif", Font.PLAIN, 1).deriveFont(0.5f);
47 public static final Font nameFont = new Font("Sans-serif", Font.ITALIC, 1).deriveFont(0.5f);55 public static final Font nameFont = new Font("Sans-serif", Font.ITALIC, 1).deriveFont(0.5f);
4856
@@ -90,7 +98,7 @@
90 98
91 private void addColorPropertyDeclarations() {99 private void addColorPropertyDeclarations() {
92 addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Color>(100 addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Color>(
93 this, "Foreground color", Color.class) {101 this, PROPERTY_FOREGROUND_COLOR, Color.class) {
94 protected void setter(VisualComponent object, Color value) {102 protected void setter(VisualComponent object, Color value) {
95 object.setForegroundColor(value);103 object.setForegroundColor(value);
96 }104 }
@@ -100,7 +108,7 @@
100 });108 });
101109
102 addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Color>(110 addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Color>(
103 this, "Fill color", Color.class) {111 this, PROPERTY_FILL_COLOR, Color.class) {
104 protected void setter(VisualComponent object, Color value) {112 protected void setter(VisualComponent object, Color value) {
105 object.setFillColor(value);113 object.setFillColor(value);
106 }114 }
@@ -112,7 +120,7 @@
112120
113 private void addLabelPropertyDeclarations() {121 private void addLabelPropertyDeclarations() {
114 addPropertyDeclaration(new PropertyDeclaration<VisualComponent, String>(122 addPropertyDeclaration(new PropertyDeclaration<VisualComponent, String>(
115 this, "Label", String.class) {123 this, PROPERTY_LABEL, String.class) {
116 protected void setter(VisualComponent object, String value) {124 protected void setter(VisualComponent object, String value) {
117 object.setLabel(value);125 object.setLabel(value);
118 }126 }
@@ -122,7 +130,7 @@
122 });130 });
123131
124 addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Positioning>(132 addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Positioning>(
125 this, "Label positioning", Positioning.class) {133 this, PROPERTY_LABEL_POSITIONING, Positioning.class) {
126 protected void setter(VisualComponent object, Positioning value) {134 protected void setter(VisualComponent object, Positioning value) {
127 object.setLabelPositioning(value);135 object.setLabelPositioning(value);
128 }136 }
@@ -132,7 +140,7 @@
132 });140 });
133141
134 addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Color>(142 addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Color>(
135 this, "Label color", Color.class) {143 this, PROPERTY_LABEL_COLOR, Color.class) {
136 protected void setter(VisualComponent object, Color value) {144 protected void setter(VisualComponent object, Color value) {
137 object.setLabelColor(value);145 object.setLabelColor(value);
138 }146 }
@@ -144,7 +152,7 @@
144152
145 private void addNamePropertyDeclarations() {153 private void addNamePropertyDeclarations() {
146 addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Positioning>(154 addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Positioning>(
147 this, "Name positioning", Positioning.class) {155 this, PROPERTY_NAME_POSITIONING, Positioning.class) {
148 protected void setter(VisualComponent object, Positioning value) {156 protected void setter(VisualComponent object, Positioning value) {
149 object.setNamePositioning(value);157 object.setNamePositioning(value);
150 }158 }
@@ -154,7 +162,7 @@
154 });162 });
155163
156 addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Color>(164 addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Color>(
157 this, "Name color", Color.class) {165 this, PROPERTY_NAME_COLOR, Color.class) {
158 protected void setter(VisualComponent object, Color value) {166 protected void setter(VisualComponent object, Color value) {
159 object.setNameColor(value);167 object.setNameColor(value);
160 }168 }
@@ -170,7 +178,7 @@
170178
171 public void setLabel(String label) {179 public void setLabel(String label) {
172 this.label = label;180 this.label = label;
173 sendNotification(new PropertyChangedEvent(this, "label"));181 sendNotification(new PropertyChangedEvent(this, PROPERTY_LABEL));
174 }182 }
175183
176 public Positioning getLabelPositioning() {184 public Positioning getLabelPositioning() {
@@ -179,7 +187,7 @@
179187
180 public void setLabelPositioning(Positioning value) {188 public void setLabelPositioning(Positioning value) {
181 labelPositioning = value;189 labelPositioning = value;
182 sendNotification(new PropertyChangedEvent(this, "label positioning"));190 sendNotification(new PropertyChangedEvent(this, PROPERTY_LABEL_POSITIONING));
183 }191 }
184192
185 public Color getLabelColor() {193 public Color getLabelColor() {
@@ -188,7 +196,7 @@
188196
189 public void setLabelColor(Color value) {197 public void setLabelColor(Color value) {
190 labelColor = value;198 labelColor = value;
191 sendNotification(new PropertyChangedEvent(this, "label color"));199 sendNotification(new PropertyChangedEvent(this, PROPERTY_LABEL_COLOR));
192 }200 }
193201
194 public Positioning getNamePositioning() {202 public Positioning getNamePositioning() {
@@ -197,7 +205,7 @@
197205
198 public void setNamePositioning(Positioning value) {206 public void setNamePositioning(Positioning value) {
199 namePositioning = value;207 namePositioning = value;
200 sendNotification(new PropertyChangedEvent(this, "reference positioning"));208 sendNotification(new PropertyChangedEvent(this, PROPERTY_NAME_POSITIONING));
201 }209 }
202210
203 public Color getNameColor() {211 public Color getNameColor() {
@@ -206,7 +214,7 @@
206214
207 public void setNameColor(Color value) {215 public void setNameColor(Color value) {
208 nameColor = value;216 nameColor = value;
209 sendNotification(new PropertyChangedEvent(this, "reference color"));217 sendNotification(new PropertyChangedEvent(this, PROPERTY_NAME_COLOR));
210 }218 }
211 219
212 public Color getForegroundColor() {220 public Color getForegroundColor() {
@@ -215,7 +223,7 @@
215223
216 public void setForegroundColor(Color value) {224 public void setForegroundColor(Color value) {
217 foregroundColor = value;225 foregroundColor = value;
218 sendNotification(new PropertyChangedEvent(this, "foreground color"));226 sendNotification(new PropertyChangedEvent(this, PROPERTY_FOREGROUND_COLOR));
219 }227 }
220228
221 public Color getFillColor() {229 public Color getFillColor() {
@@ -224,7 +232,7 @@
224232
225 public void setFillColor(Color value) {233 public void setFillColor(Color value) {
226 fillColor = value;234 fillColor = value;
227 sendNotification(new PropertyChangedEvent(this, "fill color"));235 sendNotification(new PropertyChangedEvent(this, PROPERTY_FILL_COLOR));
228 }236 }
229237
230 public MathNode getReferencedComponent() {238 public MathNode getReferencedComponent() {
231239
=== modified file 'WorkcraftCore/src/org/workcraft/dom/visual/VisualGroup.java'
--- WorkcraftCore/src/org/workcraft/dom/visual/VisualGroup.java 2015-06-03 16:22:58 +0000
+++ WorkcraftCore/src/org/workcraft/dom/visual/VisualGroup.java 2015-06-26 22:23:53 +0000
@@ -48,9 +48,7 @@
4848
4949
50public class VisualGroup extends VisualTransformableNode implements Drawable, Collapsible, Container, ObservableHierarchy {50public class VisualGroup extends VisualTransformableNode implements Drawable, Collapsible, Container, ObservableHierarchy {
51 public static final int HIT_COMPONENT = 1;51 public static final String PROPERTY_IS_COLLAPSED = "Is collapsed";
52 public static final int HIT_CONNECTION = 2;
53 public static final int HIT_GROUP = 3;
5452
55 protected double size = CommonVisualSettings.getBaseSize();53 protected double size = CommonVisualSettings.getBaseSize();
56 protected final double margin = 0.20;54 protected final double margin = 0.20;
@@ -67,7 +65,7 @@
67 65
68 private void addPropertyDeclarations() {66 private void addPropertyDeclarations() {
69 addPropertyDeclaration(new PropertyDeclaration<VisualGroup, Boolean>(67 addPropertyDeclaration(new PropertyDeclaration<VisualGroup, Boolean>(
70 this, "Is collapsed", Boolean.class) {68 this, PROPERTY_IS_COLLAPSED, Boolean.class) {
71 69
72 @Override70 @Override
73 protected void setter(VisualGroup object, Boolean value) {71 protected void setter(VisualGroup object, Boolean value) {
7472
=== modified file 'WorkcraftCore/src/org/workcraft/dom/visual/VisualPage.java'
--- WorkcraftCore/src/org/workcraft/dom/visual/VisualPage.java 2015-05-22 17:42:39 +0000
+++ WorkcraftCore/src/org/workcraft/dom/visual/VisualPage.java 2015-06-26 22:23:53 +0000
@@ -30,6 +30,9 @@
30@DisplayName("Page")30@DisplayName("Page")
31@SVGIcon("images/icons/svg/selection-page.svg")31@SVGIcon("images/icons/svg/selection-page.svg")
32public class VisualPage extends VisualComponent implements Drawable, Collapsible, Container, ObservableHierarchy {32public class VisualPage extends VisualComponent implements Drawable, Collapsible, Container, ObservableHierarchy {
33 public static final String PROPERTY_IS_COLLAPSED = "Is collapsed";
34 public static final String PROPERTY_REFERENCED_MODEL = "Referenced model";
35
33 private boolean isCurrentLevelInside = false;36 private boolean isCurrentLevelInside = false;
34 private boolean isCollapsed = false;37 private boolean isCollapsed = false;
35 private boolean isExcited = false;38 private boolean isExcited = false;
@@ -56,7 +59,7 @@
56 59
57 private void addPropertyDeclarations() {60 private void addPropertyDeclarations() {
58 addPropertyDeclaration(new PropertyDeclaration<VisualPage, Boolean>(61 addPropertyDeclaration(new PropertyDeclaration<VisualPage, Boolean>(
59 this, "Is collapsed", Boolean.class) {62 this, PROPERTY_IS_COLLAPSED, Boolean.class) {
60 63
61 @Override64 @Override
62 protected void setter(VisualPage object, Boolean value) {65 protected void setter(VisualPage object, Boolean value) {
@@ -69,7 +72,7 @@
69 });72 });
70 73
71 addPropertyDeclaration(new PropertyDeclaration<VisualPage, String>(74 addPropertyDeclaration(new PropertyDeclaration<VisualPage, String>(
72 this, "Referenced model", String.class) {75 this, PROPERTY_REFERENCED_MODEL, String.class) {
73 76
74 @Override77 @Override
75 protected void setter(VisualPage object, String value) {78 protected void setter(VisualPage object, String value) {
7679
=== modified file 'WorkcraftCore/src/org/workcraft/dom/visual/connections/VisualConnection.java'
--- WorkcraftCore/src/org/workcraft/dom/visual/connections/VisualConnection.java 2015-04-13 18:41:37 +0000
+++ WorkcraftCore/src/org/workcraft/dom/visual/connections/VisualConnection.java 2015-06-26 22:23:53 +0000
@@ -61,6 +61,13 @@
61public class VisualConnection extends VisualNode implements Node, Drawable, Shapable, DependentNode,61public class VisualConnection extends VisualNode implements Node, Drawable, Shapable, DependentNode,
62 Connection, VisualConnectionProperties, ObservableHierarchy {62 Connection, VisualConnectionProperties, ObservableHierarchy {
6363
64 public static final String PROPERTY_CONNECTION_TYPE = "Connection type";
65 public static final String PROPERTY_COLOR = "Color";
66 public static final String PROPERTY_LINE_WIDTH = "Line width";
67 public static final String PROPERTY_ARROW_LENGTH = "Arrow length";
68 public static final String PROPERTY_ARROW_WIDTH = "Arrow width";
69 public static final String PROPERTY_SCALE_MODE = "Scale mode";
70
64 public enum ConnectionType {71 public enum ConnectionType {
65 POLYLINE("Polyline"),72 POLYLINE("Polyline"),
66 BEZIER("Bezier");73 BEZIER("Bezier");
@@ -151,7 +158,7 @@
151158
152 private void addPropertyDeclarations() {159 private void addPropertyDeclarations() {
153 addPropertyDeclaration(new PropertyDeclaration<VisualConnection, Double>(160 addPropertyDeclaration(new PropertyDeclaration<VisualConnection, Double>(
154 this, "Line width", Double.class, true, true, true) {161 this, PROPERTY_LINE_WIDTH, Double.class, true, true, true) {
155 @Override162 @Override
156 public void setter(VisualConnection object, Double value) {163 public void setter(VisualConnection object, Double value) {
157 object.setLineWidth(value);164 object.setLineWidth(value);
@@ -163,7 +170,7 @@
163 });170 });
164171
165 addPropertyDeclaration(new PropertyDeclaration<VisualConnection, Double>(172 addPropertyDeclaration(new PropertyDeclaration<VisualConnection, Double>(
166 this, "Arrow width", Double.class, true, true, true) {173 this, PROPERTY_ARROW_WIDTH, Double.class, true, true, true) {
167 @Override174 @Override
168 public void setter(VisualConnection object, Double value) {175 public void setter(VisualConnection object, Double value) {
169 object.setArrowWidth(value);176 object.setArrowWidth(value);
@@ -175,7 +182,7 @@
175 });182 });
176183
177 addPropertyDeclaration(new PropertyDeclaration<VisualConnection, Double>(184 addPropertyDeclaration(new PropertyDeclaration<VisualConnection, Double>(
178 this, "Arrow length", Double.class, true, true, true) {185 this, PROPERTY_ARROW_LENGTH, Double.class, true, true, true) {
179 @Override186 @Override
180 public void setter(VisualConnection object, Double value) {187 public void setter(VisualConnection object, Double value) {
181 object.setArrowLength(value);188 object.setArrowLength(value);
@@ -196,7 +203,7 @@
196 });203 });
197 204
198 addPropertyDeclaration(new PropertyDeclaration<VisualConnection, ConnectionType>(205 addPropertyDeclaration(new PropertyDeclaration<VisualConnection, ConnectionType>(
199 this, "Connection type", ConnectionType.class, true, true, false) {206 this, PROPERTY_CONNECTION_TYPE, ConnectionType.class, true, true, false) {
200 protected void setter(VisualConnection object, ConnectionType value) {207 protected void setter(VisualConnection object, ConnectionType value) {
201 object.setConnectionType(value);208 object.setConnectionType(value);
202 for (ControlPoint cp: object.getGraphic().getControlPoints()) {209 for (ControlPoint cp: object.getGraphic().getControlPoints()) {
@@ -211,7 +218,7 @@
211 });218 });
212219
213 addPropertyDeclaration(new PropertyDeclaration<VisualConnection, ScaleMode>(220 addPropertyDeclaration(new PropertyDeclaration<VisualConnection, ScaleMode>(
214 this, "Scale mode", ScaleMode.class, true, true, true) {221 this, PROPERTY_SCALE_MODE, ScaleMode.class, true, true, true) {
215 protected void setter(VisualConnection object, ScaleMode value) {222 protected void setter(VisualConnection object, ScaleMode value) {
216 object.setScaleMode(value);223 object.setScaleMode(value);
217 }224 }
@@ -221,7 +228,7 @@
221 });228 });
222 229
223 addPropertyDeclaration(new PropertyDeclaration<VisualConnection, Color>(230 addPropertyDeclaration(new PropertyDeclaration<VisualConnection, Color>(
224 this, "Color", Color.class, true, true, true) {231 this, PROPERTY_COLOR, Color.class, true, true, true) {
225 protected void setter(VisualConnection object, Color value) {232 protected void setter(VisualConnection object, Color value) {
226 object.setColor(value);233 object.setColor(value);
227 }234 }
@@ -296,9 +303,9 @@
296 children.add(graphic);303 children.add(graphic);
297 observableHierarchyImpl.sendNotification(new NodesAddedEvent(this, getGraphic()));304 observableHierarchyImpl.sendNotification(new NodesAddedEvent(this, getGraphic()));
298 graphic.invalidate();305 graphic.invalidate();
299 observableStateImpl.sendNotification(new PropertyChangedEvent(this, "connectionType"));306 observableStateImpl.sendNotification(new PropertyChangedEvent(this, PROPERTY_CONNECTION_TYPE));
300 }307 }
301 sendNotification(new PropertyChangedEvent(this, "connection type"));308 sendNotification(new PropertyChangedEvent(this, PROPERTY_CONNECTION_TYPE));
302 }309 }
303 310
304 public Color getColor() {311 public Color getColor() {
@@ -307,7 +314,7 @@
307 314
308 public void setColor(Color color) {315 public void setColor(Color color) {
309 this.color = color;316 this.color = color;
310 sendNotification(new PropertyChangedEvent(this, "color"));317 sendNotification(new PropertyChangedEvent(this, PROPERTY_COLOR));
311 }318 }
312 319
313 @Override320 @Override
@@ -327,7 +334,7 @@
327 this.lineWidth = lineWidth;334 this.lineWidth = lineWidth;
328 335
329 invalidate();336 invalidate();
330 sendNotification(new PropertyChangedEvent(this, "line width"));337 sendNotification(new PropertyChangedEvent(this, PROPERTY_LINE_WIDTH));
331 }338 }
332339
333 @Override340 @Override
@@ -354,7 +361,7 @@
354 if (value < 0.0) value = 0.0;361 if (value < 0.0) value = 0.0;
355 this.arrowWidth = value;362 this.arrowWidth = value;
356 invalidate();363 invalidate();
357 sendNotification(new PropertyChangedEvent(this, "arrow width"));364 sendNotification(new PropertyChangedEvent(this, PROPERTY_ARROW_WIDTH));
358365
359 }366 }
360367
@@ -369,7 +376,7 @@
369 if (value < 0.0) value = 0.0;376 if (value < 0.0) value = 0.0;
370 this.arrowLength = value;377 this.arrowLength = value;
371 invalidate();378 invalidate();
372 sendNotification(new PropertyChangedEvent(this, "arrow length"));379 sendNotification(new PropertyChangedEvent(this, PROPERTY_ARROW_LENGTH));
373 }380 }
374381
375 public void invalidate() {382 public void invalidate() {
@@ -518,7 +525,7 @@
518 525
519 public void setScaleMode(ScaleMode scaleMode) {526 public void setScaleMode(ScaleMode scaleMode) {
520 this.scaleMode = scaleMode;527 this.scaleMode = scaleMode;
521 sendNotification(new PropertyChangedEvent(this, "scale mode"));528 sendNotification(new PropertyChangedEvent(this, PROPERTY_SCALE_MODE));
522 }529 }
523 530
524 @Override531 @Override
525532
=== modified file 'WorkcraftCore/src/org/workcraft/gui/DockableWindow.java'
--- WorkcraftCore/src/org/workcraft/gui/DockableWindow.java 2014-09-05 14:09:00 +0000
+++ WorkcraftCore/src/org/workcraft/gui/DockableWindow.java 2015-06-26 22:23:53 +0000
@@ -134,8 +134,9 @@
134 for (Object d : port.getDockables()) {134 for (Object d : port.getDockables()) {
135 DockableWindow dockable = (DockableWindow)d;135 DockableWindow dockable = (DockableWindow)d;
136 boolean inTab = dockable.getComponent().getParent() instanceof JTabbedPane;136 boolean inTab = dockable.getComponent().getParent() instanceof JTabbedPane;
137 DockableWindowContentPanel contentPanel = dockable.getContentPanel();
137 if (inTab && !dockable.isMaximized()) {138 if (inTab && !dockable.isMaximized()) {
138 dockable.getContentPanel().setHeaderVisible(false);139 contentPanel.setHeaderVisible(false);
139 JTabbedPane tabbedPane = (JTabbedPane)dockable.getComponent().getParent();140 JTabbedPane tabbedPane = (JTabbedPane)dockable.getComponent().getParent();
140 for (int i=0; i<tabbedPane.getComponentCount(); i++) {141 for (int i=0; i<tabbedPane.getComponentCount(); i++) {
141 if (dockable.getComponent() == tabbedPane.getComponentAt(i)) {142 if (dockable.getComponent() == tabbedPane.getComponentAt(i)) {
@@ -144,17 +145,24 @@
144 }145 }
145 }146 }
146 } else {147 } else {
147 dockable.getContentPanel().setHeaderVisible(true);148 contentPanel.setHeaderVisible(true);
148 }149 }
149 }150 }
150 }151 }
151 152
153 public void setTitle(String title) {
154 if ( !getTitle().equals(title) ) {
155 getContentPanel().setTitle(title);
156 setTabText(title);
157 }
158 }
159
152 public String getTitle() {160 public String getTitle() {
153 return panel.getTitle();161 return getContentPanel().getTitle();
154 }162 }
155163
156 public int getID() {164 public int getID() {
157 return panel.getID();165 return getContentPanel().getID();
158 }166 }
159 167
160 private static void processTabEvents(DockingPort port) {168 private static void processTabEvents(DockingPort port) {
161169
=== modified file 'WorkcraftCore/src/org/workcraft/gui/DockableWindowContentPanel.java'
--- WorkcraftCore/src/org/workcraft/gui/DockableWindowContentPanel.java 2014-12-12 18:43:40 +0000
+++ WorkcraftCore/src/org/workcraft/gui/DockableWindowContentPanel.java 2015-06-26 22:23:53 +0000
@@ -33,6 +33,7 @@
33import javax.swing.JLabel;33import javax.swing.JLabel;
34import javax.swing.JPanel;34import javax.swing.JPanel;
35import javax.swing.UIManager;35import javax.swing.UIManager;
36import javax.swing.border.Border;
3637
37import org.workcraft.Framework;38import org.workcraft.Framework;
38import org.workcraft.exceptions.NotSupportedException;39import org.workcraft.exceptions.NotSupportedException;
@@ -83,6 +84,7 @@
83 }84 }
8485
85 class DockableViewHeader extends JPanel {86 class DockableViewHeader extends JPanel {
87 private final Border BORDER_TITLE = BorderFactory.createEmptyBorder(1, 3, 1, 1);
86 private ActionButton btnMin, btnMax, btnClose;88 private ActionButton btnMin, btnMax, btnClose;
87 private JLabel titleLabel = null;89 private JLabel titleLabel = null;
88 private JPanel buttonPanel = null;90 private JPanel buttonPanel = null;
@@ -148,10 +150,11 @@
148 buttonPanel.setPreferredSize(new Dimension((UIManager.getIcon("InternalFrame.closeIcon").getIconWidth()+4) * icons,UIManager.getIcon("InternalFrame.closeIcon").getIconHeight()+4));150 buttonPanel.setPreferredSize(new Dimension((UIManager.getIcon("InternalFrame.closeIcon").getIconWidth()+4) * icons,UIManager.getIcon("InternalFrame.closeIcon").getIconHeight()+4));
149 }151 }
150152
151 titleLabel = new JLabel(" "+ title);153 titleLabel = new JLabel(title);
152 titleLabel.setOpaque(false);154 titleLabel.setOpaque(false);
153 titleLabel.setForeground(UIManager.getColor("InternalFrame.activeTitleForeground"));155 titleLabel.setForeground(UIManager.getColor("InternalFrame.activeTitleForeground"));
154 titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD));156 titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD));
157 titleLabel.setBorder(BORDER_TITLE);
155 add(titleLabel, BorderLayout.WEST);158 add(titleLabel, BorderLayout.WEST);
156159
157 setMaximized(false);160 setMaximized(false);
@@ -177,6 +180,7 @@
177 180
178 public void setTitle(String title) {181 public void setTitle(String title) {
179 titleLabel.setText(title);182 titleLabel.setText(title);
183 titleLabel.repaint();
180 }184 }
181 }185 }
182186
183187
=== renamed file 'WorkcraftCore/src/org/workcraft/gui/LAF.java' => 'WorkcraftCore/src/org/workcraft/gui/LookAndFeelHelper.java'
--- WorkcraftCore/src/org/workcraft/gui/LAF.java 2009-09-22 21:01:45 +0000
+++ WorkcraftCore/src/org/workcraft/gui/LookAndFeelHelper.java 2015-06-26 22:23:53 +0000
@@ -21,23 +21,40 @@
2121
22package org.workcraft.gui;22package org.workcraft.gui;
2323
24import javax.swing.UIManager;24import java.util.Collections;
25import javax.swing.UnsupportedLookAndFeelException;25import java.util.LinkedHashMap;
2626import java.util.Map;
27import org.jvnet.substance.SubstanceLookAndFeel;27
28import org.jvnet.substance.api.SubstanceConstants.TabContentPaneBorderKind;28import javax.swing.UIManager;
2929import javax.swing.UnsupportedLookAndFeelException;
3030
31public class LAF {31import org.jvnet.substance.SubstanceLookAndFeel;
32 public static String currentLAF = UIManager.getLookAndFeel().getClass().getName();32import org.jvnet.substance.api.SubstanceConstants.TabContentPaneBorderKind;
3333
34 public static String getCurrentLAF() {34public class LookAndFeelHelper {
35 return currentLAF;35
36 }36 private static Map<String, String> lafMap;
3737
38 public static void setLAF(String LAF) {38 public static Map<String, String> getLafMap() {
39 try {39 if (lafMap == null) {
40 UIManager.setLookAndFeel(LAF);40 lafMap = new LinkedHashMap<>();
41 lafMap.put("Metal (default)", "javax.swing.plaf.metal.MetalLookAndFeel");
42 lafMap.put("Windows", "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
43 lafMap.put("Substance: Moderate", "org.jvnet.substance.skin.SubstanceModerateLookAndFeel");
44 lafMap.put("Substance: Mist Silver", "org.jvnet.substance.skin.SubstanceMistSilverLookAndFeel");
45 lafMap.put("Substance: Raven", "org.jvnet.substance.skin.SubstanceRavenLookAndFeel");
46 lafMap.put("Substance: Business", "org.jvnet.substance.skin.SubstanceBusinessLookAndFeel");
47 lafMap.put("Substance: Creme", "org.jvnet.substance.skin.SubstanceCremeCoffeeLookAndFeel");
48 }
49 return Collections.unmodifiableMap(lafMap);
50 }
51
52 public static void setLookAndFeel(String laf) {
53 if (laf == null) {
54 laf = UIManager.getSystemLookAndFeelClassName();
55 }
56 try {
57 UIManager.setLookAndFeel(laf);
41 } catch (ClassNotFoundException e) {58 } catch (ClassNotFoundException e) {
42 e.printStackTrace();59 e.printStackTrace();
43 } catch (InstantiationException e) {60 } catch (InstantiationException e) {
@@ -47,16 +64,10 @@
47 } catch (UnsupportedLookAndFeelException e) {64 } catch (UnsupportedLookAndFeelException e) {
48 e.printStackTrace();65 e.printStackTrace();
49 }66 }
5067 }
51 currentLAF = LAF;68
52 }69 public static void setSubstance(String laf) {
5370 setLookAndFeel(laf);
54 public static void setDefaultLAF() {
55 setLAF(UIManager.getCrossPlatformLookAndFeelClassName());
56 }
57
58 public static void setSubstanceLAF(String LAF) {
59 setLAF(LAF);
60 UIManager.put(SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND, TabContentPaneBorderKind.SINGLE_FULL);71 UIManager.put(SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND, TabContentPaneBorderKind.SINGLE_FULL);
61 }72 }
62}73}
6374
=== modified file 'WorkcraftCore/src/org/workcraft/gui/MainMenu.java'
--- WorkcraftCore/src/org/workcraft/gui/MainMenu.java 2015-02-11 10:58:21 +0000
+++ WorkcraftCore/src/org/workcraft/gui/MainMenu.java 2015-06-26 22:23:53 +0000
@@ -29,6 +29,7 @@
29import java.util.Collection;29import java.util.Collection;
30import java.util.Collections;30import java.util.Collections;
31import java.util.HashMap;31import java.util.HashMap;
32import java.util.LinkedList;
32import java.util.List;33import java.util.List;
3334
34import javax.swing.JLabel;35import javax.swing.JLabel;
@@ -119,34 +120,15 @@
119 final private JMenu mnExport = new JMenu("Export");120 final private JMenu mnExport = new JMenu("Export");
120 final private JMenu mnRecent = new JMenu("Open recent");121 final private JMenu mnRecent = new JMenu("Open recent");
121 final private JMenu mnWindows = new JMenu("Windows");122 final private JMenu mnWindows = new JMenu("Windows");
122 final private JMenu mnTools = new JMenu("Tools");123 final private HashMap <Integer, ActionCheckBoxMenuItem> windowItems = new HashMap<Integer, ActionCheckBoxMenuItem>();
123 final private HashMap <Integer, ActionCheckBoxMenuItem> windowItems = new HashMap<Integer, ActionCheckBoxMenuItem>();124 final private LinkedList<JMenu> mnToolsList = new LinkedList<>();
125 final private JMenu mnHelp = new JMenu("Help");
124 126
125 private String[] lafCaptions = new String[] {
126 "Java default",
127 "Windows",
128 "Substance: Moderate",
129 "Substance: Mist Silver",
130 "Substance: Raven",
131 "Substance: Business",
132 "Substance: Creme"
133 };
134 private String[] lafClasses = new String[] {
135 "javax.swing.plaf.metal.MetalLookAndFeel",
136 "com.sun.java.swing.plaf.windows.WindowsLookAndFeel",
137 "org.jvnet.substance.skin.SubstanceModerateLookAndFeel",
138 "org.jvnet.substance.skin.SubstanceMistSilverLookAndFeel",
139 "org.jvnet.substance.skin.SubstanceRavenLookAndFeel",
140 "org.jvnet.substance.skin.SubstanceBusinessLookAndFeel",
141 "org.jvnet.substance.skin.SubstanceCremeCoffeeLookAndFeel"
142 };
143
144 MainMenu(final MainWindow mainWindow) {127 MainMenu(final MainWindow mainWindow) {
145 this.mainWindow = mainWindow;128 this.mainWindow = mainWindow;
146 addFileMenu(mainWindow);129 addFileMenu(mainWindow);
147 addEditMenu(mainWindow);130 addEditMenu(mainWindow);
148 addViewMenu(mainWindow);131 addViewMenu(mainWindow);
149 add(mnTools);
150 addHelpMenu(mainWindow);132 addHelpMenu(mainWindow);
151 }133 }
152134
@@ -225,7 +207,7 @@
225 mnFile.add(miImport);207 mnFile.add(miImport);
226 mnFile.add(mnExport);208 mnFile.add(mnExport);
227 209
228 // FIXME: Workspace functionality is not working yet.210// FIXME: Workspace functionality is not working yet.
229// mnFile.addSeparator();211// mnFile.addSeparator();
230// mnFile.add(miNewWorkspace);212// mnFile.add(miNewWorkspace);
231// mnFile.add(miOpenWorkspace);213// mnFile.add(miOpenWorkspace);
@@ -362,29 +344,28 @@
362 miPanCenter.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.CTRL_MASK));344 miPanCenter.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.CTRL_MASK));
363 miPanCenter.addScriptedActionListener(mainWindow.getDefaultActionListener());345 miPanCenter.addScriptedActionListener(mainWindow.getDefaultActionListener());
364346
365 JMenu mnLAF = new JMenu("Look and Feel");347// FIXME: Only the default Look and Feel works good, the others cause some problems.
366 for (int i = 0; i < lafClasses.length; i++) {348// JMenu mnLookAndFeel = new JMenu("Look and Feel");
367 JMenuItem miLAFItem = new JMenuItem();349// for (final Entry<String, String> laf: LookAndFeelHelper.getLafMap().entrySet()) {
368 miLAFItem.setText(lafCaptions[i]);350// JMenuItem miLAFItem = new JMenuItem();
369 final String lafClass = lafClasses[i];351// miLAFItem.setText(laf.getKey());
370 miLAFItem.addActionListener(new ActionListener() {352// miLAFItem.addActionListener(new ActionListener() {
371 public void actionPerformed(ActionEvent e) {353// public void actionPerformed(ActionEvent e) {
372 try {354// try {
373 mainWindow.setLAF(lafClass);355// mainWindow.setLookAndFeel(laf.getValue());
374 } catch (OperationCancelledException e1) {356// } catch (OperationCancelledException e1) {
375 }357// }
376 }358// }
377 });359// });
378 mnLAF.add(miLAFItem);360// mnLookAndFeel.add(miLAFItem);
379 }361// }
380362
381 /* ScriptedActionMenuItem miSaveLayout = new ScriptedActionMenuItem(MainWindow.Actions.SAVE_UI_LAYOUT);363// FIXME: Save-load of the layout is not functional yet.
382 miSaveLayout.addScriptedActionListener(mainWindow.getDefaultActionListener()); 364// ScriptedActionMenuItem miSaveLayout = new ScriptedActionMenuItem(MainWindow.Actions.SAVE_UI_LAYOUT);
383 mnView.add(miSaveLayout);365// miSaveLayout.addScriptedActionListener(mainWindow.getDefaultActionListener());
384366//
385 ScriptedActionMenuItem miLoadLayout = new ScriptedActionMenuItem(MainWindow.Actions.LOAD_UI_LAYOUT);367// ScriptedActionMenuItem miLoadLayout = new ScriptedActionMenuItem(MainWindow.Actions.LOAD_UI_LAYOUT);
386 miLoadLayout.addScriptedActionListener(mainWindow.getDefaultActionListener()); 368// miLoadLayout.addScriptedActionListener(mainWindow.getDefaultActionListener());
387 mnView.add(miLoadLayout);*/
388369
389 ActionMenuItem miResetLayout = new ActionMenuItem(MainWindowActions.RESET_GUI_ACTION);370 ActionMenuItem miResetLayout = new ActionMenuItem(MainWindowActions.RESET_GUI_ACTION);
390 miResetLayout.addScriptedActionListener(mainWindow.getDefaultActionListener());371 miResetLayout.addScriptedActionListener(mainWindow.getDefaultActionListener());
@@ -401,15 +382,17 @@
401 mnView.add(miPanDown);382 mnView.add(miPanDown);
402 mnView.addSeparator();383 mnView.addSeparator();
403 mnView.add(mnWindows);384 mnView.add(mnWindows);
404 mnView.add(mnLAF);385// mnView.add(mnLookAndFeel);
386// mnView.addSeparator();
405 mnView.add(miResetLayout);387 mnView.add(miResetLayout);
406 388// mnView.add(miSaveLayout);
389// mnView.add(miLoadLayout);
407 390
408 add(mnView);391 add(mnView);
409 }392 }
410393
411 private void addHelpMenu(final MainWindow mainWindow) {394 private void addHelpMenu(final MainWindow mainWindow) {
412 JMenu mnHelp = new JMenu();395 //JMenu mnHelp = new JMenu();
413 mnHelp.setText("Help");396 mnHelp.setText("Help");
414397
415 ActionMenuItem miOverview = new ActionMenuItem(MainWindowActions.HELP_OVERVIEW_ACTION);398 ActionMenuItem miOverview = new ActionMenuItem(MainWindowActions.HELP_OVERVIEW_ACTION);
@@ -439,16 +422,11 @@
439 mnHelp.add(miQuestion);422 mnHelp.add(miQuestion);
440 mnHelp.addSeparator();423 mnHelp.addSeparator();
441 mnHelp.add(miAbout);424 mnHelp.add(miAbout);
442 425
426 //add(Box.createHorizontalGlue());
443 add(mnHelp);427 add(mnHelp);
444 }428 }
445429
446 final public void setMenuForWorkspaceEntry(final WorkspaceEntry we) {
447 we.updateActionState();
448 setToolsMenu(we);
449 setExportMenu(we);
450 }
451
452 private void setExportMenu(final WorkspaceEntry we) {430 private void setExportMenu(final WorkspaceEntry we) {
453 mnExport.removeAll();431 mnExport.removeAll();
454 mnExport.setEnabled(false);432 mnExport.setEnabled(false);
@@ -481,36 +459,19 @@
481 haveNonVisual = true;459 haveNonVisual = true;
482 }460 }
483 }461 }
484 }462 revalidate();
485463 }
486 private void setToolsMenu(final WorkspaceEntry we) {464
487 mnTools.setVisible(true);465 public void setExportMenuState(boolean enable) {
488 mnTools.removeAll();466 mnExport.setEnabled(enable);
489467 }
490 ListMap<String, Pair<String, Tool>> tools = Tools.getTools(we);468
491 List<String> sections = Tools.getSections(tools);469 final public void registerUtilityWindow(DockableWindow window) {
492470 ActionCheckBoxMenuItem miWindowItem = new ActionCheckBoxMenuItem(new ToggleWindowAction(window));
493 for (String section : sections) {471 miWindowItem.addScriptedActionListener(mainWindow.getDefaultActionListener());
494 JMenu target = mnTools;472 miWindowItem.setSelected(!window.isClosed());
495 if (!section.isEmpty()) {473 windowItems.put(window.getID(), miWindowItem);
496 JMenu sectionMenu = new JMenu (section);474 mnWindows.add(miWindowItem);
497 mnTools.add(sectionMenu);
498 target = sectionMenu;
499 }
500 for (Pair<String, Tool> tool : Tools.getSectionTools(section, tools)) {
501 ActionMenuItem miTool = new ActionMenuItem(new ToolAction(tool));
502 miTool.addScriptedActionListener(mainWindow.getDefaultActionListener());
503 target.add(miTool);
504 }
505 }
506 }
507
508 final public void registerUtilityWindow(DockableWindow window) {
509 ActionCheckBoxMenuItem miWindowItem = new ActionCheckBoxMenuItem(new ToggleWindowAction(window));
510 miWindowItem.addScriptedActionListener(mainWindow.getDefaultActionListener());
511 miWindowItem.setSelected(!window.isClosed());
512 windowItems.put (window.getID(), miWindowItem);
513 mnWindows.add(miWindowItem);
514 }475 }
515 476
516 final public void setRecentMenu(ArrayList<String> entries) {477 final public void setRecentMenu(ArrayList<String> entries) {
@@ -547,35 +508,76 @@
547 }508 }
548 });509 });
549 mnRecent.add(miClear);510 mnRecent.add(miClear);
550 }511 }
551512
552 final public void utilityWindowClosed (int ID) {513 final public void utilityWindowClosed (int ID) {
553 ActionCheckBoxMenuItem mi = windowItems.get(ID);514 ActionCheckBoxMenuItem mi = windowItems.get(ID);
554 if (mi!=null)515 if (mi!=null)
555 mi.setSelected(false);516 mi.setSelected(false);
556 }517 }
557518
558 final public void utilityWindowDisplayed (int ID) {519 final public void utilityWindowDisplayed (int ID) {
559 ActionCheckBoxMenuItem mi = windowItems.get(ID);520 ActionCheckBoxMenuItem mi = windowItems.get(ID);
560 if (mi!=null)521 if (mi!=null)
561 mi.setSelected(true);522 mi.setSelected(true);
562 }523 }
563524
564 public void reset() {525 private void createToolsMenu(final WorkspaceEntry we) {
565 mnTools.setVisible(false);526 removeToolsMenu();
566 mnTools.removeAll();527
567 }528 ListMap<String, Pair<String, Tool>> tools = Tools.getTools(we);
568 529 List<String> sections = Tools.getSections(tools);
569 public JMenu getRecentMenu() {530
570 return mnRecent;531 JMenu mnTools = new JMenu("Tools");
571 }532 mnToolsList.clear();
572 533 for (String section : sections) {
573 public JMenu getExportMenu() {534 JMenu mnSection = mnTools;
574 return mnExport;535 if (!section.isEmpty()) {
575 }536 mnSection = new JMenu(section);
576 537 boolean promote = section.startsWith("!");
577 public JMenu getToolsMenu() {538 if (promote) {
578 return mnTools;539 mnSection.setText(section.substring(1));
540 mnToolsList.add(mnSection);
541 } else {
542 mnTools.add(mnSection);
543 mnToolsList.addFirst(mnTools);
544 }
545 }
546 for (Pair<String, Tool> tool : Tools.getSectionTools(section, tools)) {
547 ActionMenuItem miTool = new ActionMenuItem(new ToolAction(tool));
548 miTool.addScriptedActionListener(mainWindow.getDefaultActionListener());
549 mnSection.add(miTool);
550 }
551 }
552 addToolsMenu();
553 }
554
555 private void addToolsMenu() {
556 for (JMenu mnTools: mnToolsList) {
557 add(mnTools);
558 }
559 remove(mnHelp);
560 add(mnHelp);
561 revalidate();
562 }
563
564 public void removeToolsMenu() {
565 for (JMenu mnTools: mnToolsList) {
566 remove(mnTools);
567 }
568 revalidate();
569 }
570
571 public void updateToolsMenuState(boolean enable) {
572 for (JMenu mnTool: mnToolsList) {
573 mnTool.setEnabled(enable);
574 }
575 }
576
577 public void setMenuForWorkspaceEntry(final WorkspaceEntry we) {
578 we.updateActionState();
579 createToolsMenu(we);
580 setExportMenu(we);
579 }581 }
580582
581}583}
582584
=== modified file 'WorkcraftCore/src/org/workcraft/gui/MainWindow.java'
--- WorkcraftCore/src/org/workcraft/gui/MainWindow.java 2015-04-28 11:37:35 +0000
+++ WorkcraftCore/src/org/workcraft/gui/MainWindow.java 2015-06-26 22:23:53 +0000
@@ -114,6 +114,16 @@
114114
115@SuppressWarnings("serial")115@SuppressWarnings("serial")
116public class MainWindow extends JFrame {116public class MainWindow extends JFrame {
117 public static final String TITLE_OUTPUT = "Output";
118 public static final String TITLE_PROBLEMS = "Problems";
119 public static final String TITLE_JAVASCRIPT = "Javascript";
120 public static final String TITLE_TASKS = "Tasks";
121 public static final String TITLE_WORKSPACE = "Workspace";
122 public static final String TITLE_PROPERTY_EDITOR = "Property editor";
123 public static final String TITLE_TOOL_CONTROLS = "Tool controls";
124 public static final String TITLE_EDITOR_TOOLS = "Editor tools";
125 public static final String TITLE_PLACEHOLDER = "";
126
117 private static final String UILAYOUT_PATH = "./config/uilayout.xml";127 private static final String UILAYOUT_PATH = "./config/uilayout.xml";
118 private static final int VIEWPORT_MARGIN = 30;128 private static final int VIEWPORT_MARGIN = 30;
119129
@@ -182,14 +192,13 @@
182 });192 });
183 }193 }
184194
185 public void setLAF(String laf) throws OperationCancelledException {195 public void setLookAndFeel(String laf) throws OperationCancelledException {
186 if (JOptionPane.showConfirmDialog(this,196 int dialogResult = JOptionPane.showConfirmDialog(this,
187 "Changing Look and Feel requires GUI restart.\n\n"197 "Changing Look and Feel requires GUI restart.\n\n"
188 + "This will cause the visual editor windows to be closed.\n\nProceed?",198 + "This will cause the visual editor windows to be closed.\n\nProceed?",
189 "Confirm", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {199 "Confirm", JOptionPane.YES_NO_OPTION);
190 if (laf == null)
191 laf = UIManager.getSystemLookAndFeelClassName();
192200
201 if (dialogResult == JOptionPane.YES_OPTION) {
193 final Framework framework = Framework.getInstance();202 final Framework framework = Framework.getInstance();
194 framework.setConfigVar("gui.lookandfeel", laf);203 framework.setConfigVar("gui.lookandfeel", laf);
195 framework.restartGUI();204 framework.restartGUI();
@@ -201,9 +210,9 @@
201 }210 }
202211
203 private DockableWindow createDockableWindow(JComponent component,212 private DockableWindow createDockableWindow(JComponent component,
204 String name, Dockable neighbour, int options) {213 String title, Dockable neighbour, int options) {
205 return createDockableWindow(component, name, neighbour, options,214 return createDockableWindow(component, title, neighbour, options,
206 DockingConstants.CENTER_REGION, name);215 DockingConstants.CENTER_REGION, title);
207 }216 }
208217
209 private DockableWindow createDockableWindow(JComponent component,218 private DockableWindow createDockableWindow(JComponent component,
@@ -374,10 +383,8 @@
374383
375 final Framework framework = Framework.getInstance();384 final Framework framework = Framework.getInstance();
376 String laf = framework.getConfigVar("gui.lookandfeel");385 String laf = framework.getConfigVar("gui.lookandfeel");
377 if (laf == null) {386 SilverOceanTheme.enable();
378 laf = UIManager.getCrossPlatformLookAndFeelClassName();387 LookAndFeelHelper.setLookAndFeel(laf);
379 }
380 LAF.setLAF(laf);
381 SwingUtilities.updateComponentTreeUI(this);388 SwingUtilities.updateComponentTreeUI(this);
382389
383 content = new JPanel(new BorderLayout(0, 0));390 content = new JPanel(new BorderLayout(0, 0));
@@ -426,49 +433,49 @@
426 float xSplit = 0.88f;433 float xSplit = 0.88f;
427 float ySplit = 0.82f;434 float ySplit = 0.82f;
428 outputDockable = createDockableWindow(435 outputDockable = createDockableWindow(
429 outputWindow, "Output",436 outputWindow, TITLE_OUTPUT,
430 DockableWindowContentPanel.CLOSE_BUTTON,437 DockableWindowContentPanel.CLOSE_BUTTON,
431 DockingManager.SOUTH_REGION, ySplit);438 DockingManager.SOUTH_REGION, ySplit);
432 439
433 erroDockable = createDockableWindow(440 erroDockable = createDockableWindow(
434 errorWindow, "Problems", outputDockable, 441 errorWindow, TITLE_PROBLEMS, outputDockable,
435 DockableWindowContentPanel.CLOSE_BUTTON);442 DockableWindowContentPanel.CLOSE_BUTTON);
436 443
437 javaScriptDockable = createDockableWindow(444 javaScriptDockable = createDockableWindow(
438 javaScriptWindow, "Javascript", outputDockable, 445 javaScriptWindow, TITLE_JAVASCRIPT, outputDockable,
446 DockableWindowContentPanel.CLOSE_BUTTON);
447
448 tasksDockable = createDockableWindow(
449 new TaskManagerWindow(), TITLE_TASKS, outputDockable,
439 DockableWindowContentPanel.CLOSE_BUTTON);450 DockableWindowContentPanel.CLOSE_BUTTON);
440451
441 workspaceDockable = createDockableWindow(452 workspaceDockable = createDockableWindow(
442 workspaceWindow, "Workspace", 453 workspaceWindow, TITLE_WORKSPACE,
443 DockableWindowContentPanel.CLOSE_BUTTON,454 DockableWindowContentPanel.CLOSE_BUTTON,
444 DockingManager.EAST_REGION, xSplit);455 DockingManager.EAST_REGION, xSplit);
445456
446 propertyEditorDockable = createDockableWindow(457 propertyEditorDockable = createDockableWindow(
447 propertyEditorWindow, "Property editor", workspaceDockable,458 propertyEditorWindow, TITLE_PROPERTY_EDITOR, workspaceDockable,
448 DockableWindowContentPanel.CLOSE_BUTTON,459 DockableWindowContentPanel.CLOSE_BUTTON,
449 DockingManager.NORTH_REGION, ySplit);460 DockingManager.NORTH_REGION, ySplit);
450 461
451 toolControlsDockable = createDockableWindow(462 toolControlsDockable = createDockableWindow(
452 editorToolsWindow, "Tool controls", propertyEditorDockable,463 editorToolsWindow, TITLE_TOOL_CONTROLS, propertyEditorDockable,
453 DockableWindowContentPanel.CLOSE_BUTTON,464 DockableWindowContentPanel.CLOSE_BUTTON,
454 DockingManager.SOUTH_REGION, 0.4f);465 DockingManager.SOUTH_REGION, 0.4f);
455466
456 editorToolsDockable = createDockableWindow(467 editorToolsDockable = createDockableWindow(
457 toolControlsWindow, "Editor tools", toolControlsDockable,468 toolControlsWindow, TITLE_EDITOR_TOOLS, toolControlsDockable,
458 DockableWindowContentPanel.HEADER | DockableWindowContentPanel.CLOSE_BUTTON,469 DockableWindowContentPanel.HEADER | DockableWindowContentPanel.CLOSE_BUTTON,
459 DockingManager.SOUTH_REGION, 0.82f);470 DockingManager.SOUTH_REGION, 0.82f);
460471
461 documentPlaceholder = createDockableWindow(472 documentPlaceholder = createDockableWindow(
462 new DocumentPlaceholder(), "", null, outputDockable, 473 new DocumentPlaceholder(), TITLE_PLACEHOLDER, null, outputDockable,
463 0, DockingManager.NORTH_REGION, ySplit, "DocumentPlaceholder");474 0, DockingManager.NORTH_REGION, ySplit, "DocumentPlaceholder");
464475
465 DockingManager.display(outputDockable);476 DockingManager.display(outputDockable);
466 EffectsManager.setPreview(new AlphaPreview(Color.BLACK, Color.GRAY, 0.5f));477 EffectsManager.setPreview(new AlphaPreview(Color.BLACK, Color.GRAY, 0.5f));
467478
468 tasksDockable = createDockableWindow(
469 new TaskManagerWindow(), "Tasks", outputDockable,
470 DockableWindowContentPanel.CLOSE_BUTTON);
471
472 setVisible(true);479 setVisible(true);
473 loadDockingLayout();480 loadDockingLayout();
474481
@@ -492,7 +499,7 @@
492 // createGlyphVector is called for the first time499 // createGlyphVector is called for the first time
493 Font font = new Font("Sans-serif", Font.PLAIN, 1);500 Font font = new Font("Sans-serif", Font.PLAIN, 1);
494 font.createGlyphVector(new FontRenderContext(501 font.createGlyphVector(new FontRenderContext(
495 new AffineTransform(), true, true), "");502 new AffineTransform(), true, true), TITLE_PLACEHOLDER);
496503
497 // force svg rendering classes to load504 // force svg rendering classes to load
498 GUI.createIconFromSVG("images/icons/svg/place.svg");505 GUI.createIconFromSVG("images/icons/svg/place.svg");
@@ -503,7 +510,7 @@
503 }510 }
504511
505 private void setWorkActionsEnableness(boolean enable) {512 private void setWorkActionsEnableness(boolean enable) {
506 getMainMenu().getExportMenu().setEnabled(enable);513 getMainMenu().setExportMenuState(enable);
507 MainWindowActions.MERGE_WORK_ACTION.setEnabled(enable);514 MainWindowActions.MERGE_WORK_ACTION.setEnabled(enable);
508 MainWindowActions.CLOSE_ACTIVE_EDITOR_ACTION.setEnabled(enable);515 MainWindowActions.CLOSE_ACTIVE_EDITOR_ACTION.setEnabled(enable);
509 MainWindowActions.CLOSE_ALL_EDITORS_ACTION.setEnabled(enable);516 MainWindowActions.CLOSE_ALL_EDITORS_ACTION.setEnabled(enable);
@@ -588,8 +595,9 @@
588595
589 if (editorInFocus == editor) {596 if (editorInFocus == editor) {
590 toolControlsWindow.setContent(null);597 toolControlsWindow.setContent(null);
591 mainMenu.reset();598 mainMenu.removeToolsMenu();
592 editorInFocus = null;599 editorInFocus = null;
600 setDockableTitle(getPropertyEditor(), TITLE_PROPERTY_EDITOR);
593 }601 }
594602
595 editorWindows.remove(we, dockableWindow);603 editorWindows.remove(we, dockableWindow);
@@ -841,11 +849,7 @@
841849
842 toolControlsWindow.setContent(sender.getToolBox());850 toolControlsWindow.setContent(sender.getToolBox());
843 editorToolsWindow.setContent(sender.getToolBox().getControlPanel());851 editorToolsWindow.setContent(sender.getToolBox().getControlPanel());
844
845 mainMenu.setMenuForWorkspaceEntry(editorInFocus.getWorkspaceEntry());852 mainMenu.setMenuForWorkspaceEntry(editorInFocus.getWorkspaceEntry());
846
847 mainMenu.revalidate();
848 mainMenu.repaint();
849 sender.updatePropertyView();853 sender.updatePropertyView();
850854
851 framework.deleteJavaScriptProperty("visualModel", framework.getJavaScriptGlobalScope());855 framework.deleteJavaScriptProperty("visualModel", framework.getJavaScriptGlobalScope());
@@ -1045,7 +1049,7 @@
1045 JOptionPane.showMessageDialog(this, e.getMessage(), "Model export failed", JOptionPane.ERROR_MESSAGE);1049 JOptionPane.showMessageDialog(this, e.getMessage(), "Model export failed", JOptionPane.ERROR_MESSAGE);
1046 }1050 }
1047 we.setChanged(false);1051 we.setChanged(false);
1048 refreshTitle(we);1052 refreshWorkspaceEntryTitle(we, true);
1049 lastSavePath = we.getFile().getParent();1053 lastSavePath = we.getFile().getParent();
1050 pushRecentFile(we.getFile().getPath(), true);1054 pushRecentFile(we.getFile().getPath(), true);
1051 }1055 }
@@ -1058,7 +1062,7 @@
1058 }1062 }
10591063
1060 private String getFileNameForCurrentWork() {1064 private String getFileNameForCurrentWork() {
1061 String fileName = "";1065 String fileName = TITLE_PLACEHOLDER;
1062 if (editorInFocus != null) {1066 if (editorInFocus != null) {
1063 WorkspaceEntry we = editorInFocus.getWorkspaceEntry();1067 WorkspaceEntry we = editorInFocus.getWorkspaceEntry();
1064 if (we != null) {1068 if (we != null) {
@@ -1098,7 +1102,7 @@
1098 throw new RuntimeException("Cannot save workspace entry - it does not have an associated Workcraft model.");1102 throw new RuntimeException("Cannot save workspace entry - it does not have an associated Workcraft model.");
1099 }1103 }
1100 we.setChanged(false);1104 we.setChanged(false);
1101 refreshTitle(we);1105 refreshWorkspaceEntryTitle(we, true);
1102 lastSavePath = we.getFile().getParent();1106 lastSavePath = we.getFile().getParent();
1103 pushRecentFile(we.getFile().getPath(), true);1107 pushRecentFile(we.getFile().getPath(), true);
1104 } catch (SerialisationException e) {1108 } catch (SerialisationException e) {
@@ -1168,7 +1172,7 @@
1168 }1172 }
11691173
1170 private String getTitle(WorkspaceEntry we, VisualModel model) {1174 private String getTitle(WorkspaceEntry we, VisualModel model) {
1171 String prefix = (we.isChanged() ? "*" : "");1175 String prefix = (we.isChanged() ? "*" : TITLE_PLACEHOLDER);
1172 String suffix = null;1176 String suffix = null;
1173 switch (CommonEditorSettings.getTitleStyle()) {1177 switch (CommonEditorSettings.getTitleStyle()) {
1174 case LONG: 1178 case LONG:
@@ -1178,25 +1182,34 @@
1178 suffix = " [" + model.getShortName() + "]";1182 suffix = " [" + model.getShortName() + "]";
1179 break;1183 break;
1180 default: 1184 default:
1181 suffix = "";1185 suffix = TITLE_PLACEHOLDER;
1182 break;1186 break;
1183 }1187 }
1184 return (prefix + we.getTitle() + suffix);1188 return (prefix + we.getTitle() + suffix);
1185 }1189 }
11861190
1187 public void refreshTitle(WorkspaceEntry we) {1191 public void refreshWorkspaceEntryTitle(WorkspaceEntry we, boolean updateHeaders) {
1188 for (DockableWindow w : editorWindows.get(we)) {1192 for (DockableWindow w : editorWindows.get(we)) {
1189 final GraphEditorPanel editor = getCurrentEditor();1193 final GraphEditorPanel editor = getCurrentEditor();
1190 String title = getTitle(we, editor.getModel());1194 String title = getTitle(we, editor.getModel());
1191 w.getContentPanel().setTitle(title);1195 w.setTitle(title);
1192 w.setTabText(title);1196 }
1193 }1197 if (updateHeaders) {
1194 DockableWindow.updateHeaders(rootDockingPort,getDefaultActionListener());1198 DockableWindow.updateHeaders(rootDockingPort, getDefaultActionListener());
1199 }
1195 }1200 }
11961201
1197 public void refreshAllTitles() {1202 public void refreshWorkspaceEntryTitles() {
1198 for (WorkspaceEntry we : editorWindows.keySet()) {1203 for (WorkspaceEntry we : editorWindows.keySet()) {
1199 refreshTitle(we);1204 refreshWorkspaceEntryTitle(we, false);
1205 }
1206 DockableWindow.updateHeaders(rootDockingPort, getDefaultActionListener());
1207 }
1208
1209 public void setDockableTitle(DockableWindow dockable, String title) {
1210 if (dockable != null) {
1211 dockable.setTitle(title);
1212 DockableWindow.updateHeaders(rootDockingPort, getDefaultActionListener());
1200 }1213 }
1201 }1214 }
12021215
@@ -1221,7 +1234,8 @@
1221 public void closeActiveEditor() throws OperationCancelledException {1234 public void closeActiveEditor() throws OperationCancelledException {
1222 for (WorkspaceEntry k : editorWindows.keySet()) {1235 for (WorkspaceEntry k : editorWindows.keySet()) {
1223 for (DockableWindow w : editorWindows.get(k)) {1236 for (DockableWindow w : editorWindows.get(k)) {
1224 if (w.getContentPanel().getContent() == editorInFocus) {1237 DockableWindowContentPanel contentPanel = w.getContentPanel();
1238 if ((contentPanel != null) && (contentPanel.getContent() == editorInFocus)) {
1225 closeDockableWindow(w);1239 closeDockableWindow(w);
1226 return;1240 return;
1227 }1241 }
@@ -1323,7 +1337,7 @@
1323 dlg.setModal(true);1337 dlg.setModal(true);
1324 dlg.setResizable(true);1338 dlg.setResizable(true);
1325 dlg.setVisible(true);1339 dlg.setVisible(true);
1326 refreshAllTitles();1340 refreshWorkspaceEntryTitles();
1327 }1341 }
13281342
1329 public void resetLayout() {1343 public void resetLayout() {
13301344
=== modified file 'WorkcraftCore/src/org/workcraft/gui/MainWindowActions.java'
--- WorkcraftCore/src/org/workcraft/gui/MainWindowActions.java 2015-01-26 22:10:33 +0000
+++ WorkcraftCore/src/org/workcraft/gui/MainWindowActions.java 2015-06-26 22:23:53 +0000
@@ -39,7 +39,10 @@
39 public static final Action SAVE_WORK_ACTION = new Action() {39 public static final Action SAVE_WORK_ACTION = new Action() {
40 @Override public void run() {40 @Override public void run() {
41 final Framework f = Framework.getInstance();41 final Framework f = Framework.getInstance();
42 try { f.getMainWindow().saveWork(); } catch (OperationCancelledException e) { }42 try {
43 f.getMainWindow().saveWork();
44 } catch (OperationCancelledException e) {
45 }
43 }46 }
44 @Override public String getText() {47 @Override public String getText() {
45 return "Save work";48 return "Save work";
@@ -48,7 +51,10 @@
48 public static final Action SAVE_WORK_AS_ACTION = new Action() {51 public static final Action SAVE_WORK_AS_ACTION = new Action() {
49 @Override public void run() {52 @Override public void run() {
50 final Framework f = Framework.getInstance();53 final Framework f = Framework.getInstance();
51 try { f.getMainWindow().saveWorkAs(); } catch (OperationCancelledException e) { }54 try {
55 f.getMainWindow().saveWorkAs();
56 } catch (OperationCancelledException e) {
57 }
52 }58 }
53 public String getText() {59 public String getText() {
54 return "Save work as...";60 return "Save work as...";
@@ -57,7 +63,10 @@
57 public static final Action CLOSE_ACTIVE_EDITOR_ACTION = new Action() {63 public static final Action CLOSE_ACTIVE_EDITOR_ACTION = new Action() {
58 @Override public void run() {64 @Override public void run() {
59 final Framework f = Framework.getInstance();65 final Framework f = Framework.getInstance();
60 try { f.getMainWindow().closeActiveEditor(); } catch (OperationCancelledException e) { }66 try {
67 f.getMainWindow().closeActiveEditor();
68 } catch (OperationCancelledException e) {
69 }
61 }70 }
62 public String getText() {71 public String getText() {
63 return "Close active work";72 return "Close active work";
@@ -67,7 +76,10 @@
67 public static final Action CLOSE_ALL_EDITORS_ACTION = new Action() {76 public static final Action CLOSE_ALL_EDITORS_ACTION = new Action() {
68 @Override public void run() {77 @Override public void run() {
69 final Framework f = Framework.getInstance();78 final Framework f = Framework.getInstance();
70 try { f.getMainWindow().closeEditorWindows(); } catch (OperationCancelledException e) { }79 try {
80 f.getMainWindow().closeEditorWindows();
81 } catch (OperationCancelledException e) {
82 }
71 }83 }
72 public String getText() {84 public String getText() {
73 return "Close all works";85 return "Close all works";
7486
=== modified file 'WorkcraftCore/src/org/workcraft/gui/PropertyEditorWindow.java'
--- WorkcraftCore/src/org/workcraft/gui/PropertyEditorWindow.java 2015-04-14 13:26:34 +0000
+++ WorkcraftCore/src/org/workcraft/gui/PropertyEditorWindow.java 2015-06-26 22:23:53 +0000
@@ -34,7 +34,7 @@
34 private PropertyEditorTable propertyTable;34 private PropertyEditorTable propertyTable;
35 private JScrollPane scrollProperties;35 private JScrollPane scrollProperties;
3636
37 public PropertyEditorWindow () {37 public PropertyEditorWindow() {
38 propertyTable = new PropertyEditorTable();38 propertyTable = new PropertyEditorTable();
3939
40 scrollProperties = new JScrollPane();40 scrollProperties = new JScrollPane();
@@ -45,19 +45,19 @@
45 validate();45 validate();
46 }46 }
47 47
48 public Properties getObject () {48 public Properties getObject() {
49 return propertyTable.getObject();49 return propertyTable.getObject();
50 }50 }
5151
52 public void setObject (Properties o) {52 public void setObject(Properties o) {
53 removeAll();53 removeAll();
54 propertyTable.setObject(o);54 propertyTable.setObject(o);
55 add(scrollProperties, BorderLayout.CENTER);55 add(scrollProperties, BorderLayout.CENTER);
56 validate();56 validate();
57 repaint();57 repaint();
58 }58 }
5959
60 public void clearObject () {60 public void clearObject() {
61 if (propertyTable.getObject() != null) {61 if (propertyTable.getObject() != null) {
62 removeAll();62 removeAll();
63 propertyTable.clearObject();63 propertyTable.clearObject();
6464
=== added file 'WorkcraftCore/src/org/workcraft/gui/SilverOceanTheme.java'
--- WorkcraftCore/src/org/workcraft/gui/SilverOceanTheme.java 1970-01-01 00:00:00 +0000
+++ WorkcraftCore/src/org/workcraft/gui/SilverOceanTheme.java 2015-06-26 22:23:53 +0000
@@ -0,0 +1,132 @@
1package org.workcraft.gui;
2
3import java.awt.Font;
4import java.awt.Toolkit;
5import java.io.Serializable;
6import java.util.Arrays;
7import java.util.List;
8
9import javax.swing.BorderFactory;
10import javax.swing.UIDefaults;
11import javax.swing.plaf.BorderUIResource;
12import javax.swing.plaf.ColorUIResource;
13import javax.swing.plaf.FontUIResource;
14import javax.swing.plaf.metal.MetalLookAndFeel;
15import javax.swing.plaf.metal.OceanTheme;
16
17public class SilverOceanTheme extends OceanTheme {
18
19 private static final double FONT_SIZE = 11.0;
20 private static final String FONT_NAME = "Verdana";
21
22 public static void enable() {
23 MetalLookAndFeel.setCurrentTheme(new SilverOceanTheme());
24 }
25
26 @Override
27 public FontUIResource getControlTextFont() {
28 int screenDpi = Toolkit.getDefaultToolkit().getScreenResolution();
29 int fontSizeInPixels = (int)Math.round(FONT_SIZE * screenDpi / 72.0);
30 return new FontUIResource(FONT_NAME, Font.PLAIN, fontSizeInPixels);
31 }
32
33 @Override
34 public FontUIResource getMenuTextFont() {
35 return getControlTextFont();
36 }
37
38 @Override
39 public FontUIResource getSubTextFont() {
40 return getControlTextFont();
41 }
42
43 @Override
44 public FontUIResource getSystemTextFont() {
45 return getControlTextFont();
46 }
47
48 @Override
49 public FontUIResource getUserTextFont() {
50 return getControlTextFont();
51 }
52
53 @Override
54 public FontUIResource getWindowTitleFont() {
55 return new FontUIResource(getControlTextFont().deriveFont(Font.BOLD));
56 }
57
58 @Override
59 protected ColorUIResource getSecondary1() {
60 return new ColorUIResource(0x999999);
61 }
62
63 @Override
64 protected ColorUIResource getSecondary2() {
65 return new ColorUIResource(0xcccccc);
66 }
67
68 @Override
69 protected ColorUIResource getSecondary3() {
70 return new ColorUIResource(0xeeeeee);
71 }
72
73 @Override
74 protected ColorUIResource getPrimary1() {
75 return new ColorUIResource(0x999999);
76 }
77
78 @Override
79 protected ColorUIResource getPrimary2() {
80 return new ColorUIResource(0xbbccdd);
81 }
82
83 @Override
84 protected ColorUIResource getPrimary3() {
85 return new ColorUIResource(0xbbccdd);
86 }
87
88 @Override
89 public void addCustomEntriesToTable(UIDefaults table) {
90 super.addCustomEntriesToTable(table);
91
92 List<Serializable> buttonGradient = Arrays.asList(1.0, 0.0, getSecondary3(), getSecondary2(), getSecondary2());
93 BorderUIResource menuItemBorder = new BorderUIResource(BorderFactory.createEmptyBorder(3, 6, 3, 6));
94
95 Object[] uiDefaults = {
96 "Button.gradient", buttonGradient,
97 "CheckBox.gradient", buttonGradient,
98 "CheckBoxMenuItem.gradient", buttonGradient,
99 "InternalFrame.activeTitleGradient", buttonGradient,
100 "RadioButton.gradient", buttonGradient,
101 "RadioButtonMenuItem.gradient", buttonGradient,
102 "ScrollBar.gradient", buttonGradient,
103 "Slider.focusGradient", buttonGradient,
104 "Slider.gradient", buttonGradient,
105 "ToggleButton.gradient", buttonGradient,
106
107 "TabbedPane.selected", getPrimary2(),
108 "TabbedPane.contentAreaColor", getPrimary2(),
109
110// "OptionPane.errorIcon", new IconUIResource(ImageLoader.loadIcon("ix")),
111// "OptionPane.informationIcon", new IconUIResource(ImageLoader.loadIcon("ii")),
112// "OptionPane.questionIcon", new IconUIResource(ImageLoader.loadIcon("iq")),
113// "OptionPane.warningIcon", new IconUIResource(ImageLoader.loadIcon("iw")),
114
115 "Menu.border", new BorderUIResource(BorderFactory.createEmptyBorder(3, 2, 3, 2)),
116 "MenuItem.border", menuItemBorder,
117 "CheckBoxMenuItem.border", menuItemBorder,
118 "RadioButtonMenuItem.border", menuItemBorder,
119
120 "ComboBox.background", getWhite(),
121// "CheckBox.background", white,
122// "OptionPane.background", white,
123// "Panel.background", white,
124// "Slider.background", white,
125
126// "TextField.background", new ColorUIResource(0xf4f4f4),
127 "TextField.border", BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(getPrimary1()), BorderFactory.createEmptyBorder(4, 4, 4, 4)),
128 };
129 table.putDefaults(uiDefaults);
130 }
131
132}
0133
=== modified file 'WorkcraftCore/src/org/workcraft/gui/graph/GraphEditorPanel.java'
--- WorkcraftCore/src/org/workcraft/gui/graph/GraphEditorPanel.java 2015-04-23 22:59:53 +0000
+++ WorkcraftCore/src/org/workcraft/gui/graph/GraphEditorPanel.java 2015-06-26 22:23:53 +0000
@@ -38,7 +38,6 @@
38import java.awt.event.KeyEvent;38import java.awt.event.KeyEvent;
39import java.awt.geom.AffineTransform;39import java.awt.geom.AffineTransform;
40import java.awt.geom.Point2D;40import java.awt.geom.Point2D;
41import java.io.OutputStream;
42import java.lang.reflect.InvocationTargetException;41import java.lang.reflect.InvocationTargetException;
43import java.util.ArrayList;42import java.util.ArrayList;
44import java.util.Collection;43import java.util.Collection;
@@ -82,7 +81,11 @@
8281
83public class GraphEditorPanel extends JPanel implements StateObserver, GraphEditor {82public class GraphEditorPanel extends JPanel implements StateObserver, GraphEditor {
84 83
85 public OutputStream backup;84
85 public static final String TITLE_SUFFIX_TEMPLATE = "template";
86 public static final String TITLE_SUFFIX_MODEL = "model";
87 public static final String TITLE_SUFFIX_SINGLE_ELEMENT = "single element";
88 public static final String TITLE_SUFFIX_SELECTED_ELEMENTS = " selected elements";
8689
87 class Resizer implements ComponentListener {90 class Resizer implements ComponentListener {
8891
@@ -533,8 +536,7 @@
533 536
534 public void updatePropertyView() { 537 public void updatePropertyView() {
535 ModelProperties properties;538 ModelProperties properties;
536 String titlePrefix = "Property editor";539 String titleSuffix = null;
537 String titleSuffix = "";
538 VisualNode templateNode = getModel().getTemplateNode();540 VisualNode templateNode = getModel().getTemplateNode();
539 if (templateNode != null) {541 if (templateNode != null) {
540 properties = getNodeProperties(templateNode);542 properties = getNodeProperties(templateNode);
@@ -543,36 +545,35 @@
543 properties.remove(pd);545 properties.remove(pd);
544 }546 }
545 }547 }
546 titlePrefix += " [template]";548 titleSuffix = TITLE_SUFFIX_TEMPLATE;
547 } else {549 } else {
548 Collection<Node> selection = getModel().getSelection();550 Collection<Node> selection = getModel().getSelection();
549 if (selection.size() == 0) {551 if (selection.size() == 0) {
550 properties = getModelProperties();552 properties = getModelProperties();
551 titleSuffix += " [model]";553 titleSuffix = TITLE_SUFFIX_MODEL;
552 } else if (selection.size() == 1) {554 } else if (selection.size() == 1) {
553 Node node = selection.iterator().next();555 Node node = selection.iterator().next();
554 properties = getNodeProperties(node);556 properties = getNodeProperties(node);
555 titleSuffix += " [single element]";557 titleSuffix = TITLE_SUFFIX_SINGLE_ELEMENT;
556 } else {558 } else {
557 properties = getSelectionProperties(selection);559 properties = getSelectionProperties(selection);
558 int nodeCount = selection.size();560 int nodeCount = selection.size();
559 titleSuffix += " [" + nodeCount + " selected elements]";561 titleSuffix = nodeCount + " " + TITLE_SUFFIX_SELECTED_ELEMENTS;
560 }562 }
561 }563 }
562564
563 final PropertyEditorWindow propertyEditorWindow = mainWindow.getPropertyView();565 final PropertyEditorWindow propertyEditorWindow = mainWindow.getPropertyView();
564 if(properties.getDescriptors().isEmpty()) {566 if(properties.getDescriptors().isEmpty()) {
565 propertyEditorWindow.clearObject();567 propertyEditorWindow.clearObject();
566 titleSuffix = "";
567 } else {568 } else {
568 propertyEditorWindow.setObject(propertiesWrapper(properties));569 propertyEditorWindow.setObject(propertiesWrapper(properties));
569 }570 }
570 571
571 final DockableWindow propertyEditorDockable = mainWindow.getPropertyEditor();572 String title = MainWindow.TITLE_PROPERTY_EDITOR;
572 String title = titlePrefix + titleSuffix;573 if (titleSuffix != null) {
573 propertyEditorDockable.getContentPanel().setTitle(title);574 title += " [" + titleSuffix + "]";
574 propertyEditorDockable.setTabText(title);575 }
575576 mainWindow.setDockableTitle(mainWindow.getPropertyEditor(), title);
576 updatePropertyViewRequested = false;577 updatePropertyViewRequested = false;
577 }578 }
578579
579580
=== modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/BooleanCellEditor.java'
--- WorkcraftCore/src/org/workcraft/gui/propertyeditor/BooleanCellEditor.java 2013-10-07 09:51:12 +0000
+++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/BooleanCellEditor.java 2015-06-26 22:23:53 +0000
@@ -21,26 +21,26 @@
2121
22package org.workcraft.gui.propertyeditor;22package org.workcraft.gui.propertyeditor;
2323
24import java.awt.Component;24import java.awt.Component;
25import java.awt.event.ItemEvent;25import java.awt.event.ItemEvent;
26import java.awt.event.ItemListener;26import java.awt.event.ItemListener;
2727
28import javax.swing.AbstractCellEditor;28import javax.swing.AbstractCellEditor;
29import javax.swing.JCheckBox;29import javax.swing.JCheckBox;
30import javax.swing.JTable;30import javax.swing.JTable;
31import javax.swing.table.TableCellEditor;31import javax.swing.table.TableCellEditor;
3232
3333
34@SuppressWarnings("serial")34@SuppressWarnings("serial")
35public class BooleanCellEditor extends AbstractCellEditor implements35public class BooleanCellEditor extends AbstractCellEditor implements TableCellEditor, ItemListener{
36 TableCellEditor, ItemListener{
37 36
38 private JCheckBox checkBox;37 private JCheckBox checkBox;
39 38
40 public BooleanCellEditor() {39 public BooleanCellEditor() {
41 checkBox = new JCheckBox();40 checkBox = new JCheckBox();
42 checkBox.setFocusable(false);41 checkBox.setFocusable(false);
43 checkBox.addItemListener(this);42 checkBox.addItemListener(this);
43 checkBox.setBorderPainted(false);
44 }44 }
45 45
46 public Component getTableCellEditorComponent(46 public Component getTableCellEditorComponent(
@@ -49,6 +49,7 @@
49 checkBox.setSelected((Boolean)value);49 checkBox.setSelected((Boolean)value);
50 }50 }
51 checkBox.setOpaque(value == null);51 checkBox.setOpaque(value == null);
52 checkBox.setFont(table.getFont());
52 return checkBox;53 return checkBox;
53 }54 }
5455
5556
=== modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/ChoiceCellEditor.java'
--- WorkcraftCore/src/org/workcraft/gui/propertyeditor/ChoiceCellEditor.java 2013-10-07 09:51:12 +0000
+++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/ChoiceCellEditor.java 2015-06-26 22:23:53 +0000
@@ -26,6 +26,7 @@
26import java.awt.event.ItemListener;26import java.awt.event.ItemListener;
2727
28import javax.swing.AbstractCellEditor;28import javax.swing.AbstractCellEditor;
29import javax.swing.BorderFactory;
29import javax.swing.JComboBox;30import javax.swing.JComboBox;
30import javax.swing.JTable;31import javax.swing.JTable;
31import javax.swing.table.TableCellEditor;32import javax.swing.table.TableCellEditor;
@@ -40,7 +41,8 @@
40 comboBox = new JComboBox();41 comboBox = new JComboBox();
41 comboBox.setEditable(false);42 comboBox.setEditable(false);
42 comboBox.setFocusable(false);43 comboBox.setFocusable(false);
43 comboBox.addItemListener(this);44 comboBox.addItemListener(this);
45 comboBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
44 46
45 int declCount = decl.getChoice().size();47 int declCount = decl.getChoice().size();
46 wrappers = new ChoiceWrapper[declCount];48 wrappers = new ChoiceWrapper[declCount];
@@ -76,6 +78,7 @@
76 }78 }
77 }79 }
78 comboBox.setOpaque(value == null);80 comboBox.setOpaque(value == null);
81 comboBox.setFont(table.getFont());
79 return comboBox;82 return comboBox;
80 }83 }
8184
8285
=== modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/ColorCellEditor.java'
--- WorkcraftCore/src/org/workcraft/gui/propertyeditor/ColorCellEditor.java 2014-04-09 22:33:19 +0000
+++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/ColorCellEditor.java 2015-06-26 22:23:53 +0000
@@ -52,12 +52,12 @@
52 static JColorChooser chooser = null;52 static JColorChooser chooser = null;
53 static JDialog dialog = null;53 static JDialog dialog = null;
54 54
55 protected static final String EDIT = "edit";55 protected static final String TAG_EDIT = "edit";
5656
57 public ColorCellEditor() {57 public ColorCellEditor() {
5858
59 button = new JButton();59 button = new JButton();
60 button.setActionCommand(EDIT);60 button.setActionCommand(TAG_EDIT);
61 button.addActionListener(this);61 button.addActionListener(this);
62 button.setBorderPainted(false);62 button.setBorderPainted(false);
63 button.setFocusable(false);63 button.setFocusable(false);
@@ -78,7 +78,7 @@
7878
79 @Override79 @Override
80 public void actionPerformed(ActionEvent e) {80 public void actionPerformed(ActionEvent e) {
81 if (EDIT.equals(e.getActionCommand())) {81 if (TAG_EDIT.equals(e.getActionCommand())) {
82 // The user has clicked the cell, so bring up the dialog.82 // The user has clicked the cell, so bring up the dialog.
83 approx.target = this;83 approx.target = this;
84 button.setBackground(color);84 button.setBackground(color);
@@ -86,7 +86,7 @@
86 dialog.setVisible(true);86 dialog.setVisible(true);
87 fireEditingStopped(); //Make the renderer reappear.87 fireEditingStopped(); //Make the renderer reappear.
88 } else { 88 } else {
89 //User pressed dialog's "OK" button.89 // User pressed dialog's "OK" button.
90 color = chooser.getColor();90 color = chooser.getColor();
91 }91 }
92 }92 }
9393
=== modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/ColorCellRenderer.java'
--- WorkcraftCore/src/org/workcraft/gui/propertyeditor/ColorCellRenderer.java 2014-04-09 22:33:19 +0000
+++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/ColorCellRenderer.java 2015-06-26 22:23:53 +0000
@@ -21,21 +21,17 @@
2121
22package org.workcraft.gui.propertyeditor;22package org.workcraft.gui.propertyeditor;
2323
24import java.awt.Color;24import java.awt.Color;
25import java.awt.Component;25import java.awt.Component;
2626
27import javax.swing.BorderFactory;27import javax.swing.JLabel;
28import javax.swing.JLabel;28import javax.swing.JTable;
29import javax.swing.JTable;29import javax.swing.table.TableCellRenderer;
30import javax.swing.border.Border;
31import javax.swing.table.TableCellRenderer;
3230
33@SuppressWarnings("serial")31@SuppressWarnings("serial")
34public class ColorCellRenderer extends JLabel implements TableCellRenderer {32public class ColorCellRenderer extends JLabel implements TableCellRenderer {
35 Border unselectedBorder = null;33
36 Border selectedBorder = null;34 public ColorCellRenderer() {
37
38 public ColorCellRenderer() {
39 setOpaque(true); //MUST do this for background to show up.35 setOpaque(true); //MUST do this for background to show up.
40 setFocusable(false);36 setFocusable(false);
41 }37 }
@@ -43,22 +39,10 @@
43 @Override39 @Override
44 public Component getTableCellRendererComponent(JTable table, Object value,40 public Component getTableCellRendererComponent(JTable table, Object value,
45 boolean isSelected, boolean hasFocus, int row, int column) {41 boolean isSelected, boolean hasFocus, int row, int column) {
42 setBorder(PropertyEditorTable.BORDER_RENDER);
46 if (value != null) {43 if (value != null) {
47 setBackground((Color)value);44 setBackground((Color)value);
48 if (isSelected) {45 }
49 if (selectedBorder == null) {
50 selectedBorder = BorderFactory.createMatteBorder(
51 2, 5, 2, 5, table.getSelectionBackground());
52 }
53 setBorder(selectedBorder);
54 } else {
55 if (unselectedBorder == null) {
56 unselectedBorder = BorderFactory.createMatteBorder(
57 2, 5, 2, 5, table.getBackground());
58 }
59 setBorder(unselectedBorder);
60 }
61 }
62 return this;46 return this;
63 }47 }
64}
65\ No newline at end of file48\ No newline at end of file
49}
6650
=== modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/DefaultCellRenderer.java'
--- WorkcraftCore/src/org/workcraft/gui/propertyeditor/DefaultCellRenderer.java 2013-10-07 09:51:12 +0000
+++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/DefaultCellRenderer.java 2015-06-26 22:23:53 +0000
@@ -13,12 +13,15 @@
13 public Component getTableCellRendererComponent(JTable table, Object value,13 public Component getTableCellRendererComponent(JTable table, Object value,
14 boolean isSelected, boolean hasFocus, int row, int column) {14 boolean isSelected, boolean hasFocus, int row, int column) {
15 if (value != null) {15 if (value != null) {
16 setText((String)value);16 String text = value.toString();
17 setText(text);
18 setFont(table.getFont());
19 setOpaque(text.isEmpty());
17 } else {20 } else {
18 setText("");21 setText("");
22 setOpaque(true);
19 }23 }
20 setFont(table.getFont());24 setBorder(PropertyEditorTable.BORDER_RENDER);
21 setOpaque(value == null || value.equals(""));
22 return this;25 return this;
23 }26 }
2427
2528
=== modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/FileCellEditor.java'
--- WorkcraftCore/src/org/workcraft/gui/propertyeditor/FileCellEditor.java 2015-02-09 10:46:28 +0000
+++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/FileCellEditor.java 2015-06-26 22:23:53 +0000
@@ -18,8 +18,8 @@
18@SuppressWarnings("serial")18@SuppressWarnings("serial")
19public class FileCellEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {19public class FileCellEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
20 20
21 protected static final String EDIT = "edit";21 protected static final String TAG_EDIT = "edit";
22 protected static final String CLEAR = "clear";22 protected static final String TAG_CLEAR = "clear";
23 23
24 final private JPanel panel;24 final private JPanel panel;
25 final private JButton chooseButton;25 final private JButton chooseButton;
@@ -28,7 +28,7 @@
2828
29 public FileCellEditor() {29 public FileCellEditor() {
30 chooseButton = new JButton();30 chooseButton = new JButton();
31 chooseButton.setActionCommand(EDIT);31 chooseButton.setActionCommand(TAG_EDIT);
32 chooseButton.addActionListener(this);32 chooseButton.addActionListener(this);
33 chooseButton.setOpaque(true);33 chooseButton.setOpaque(true);
34 chooseButton.setBorderPainted(false);34 chooseButton.setBorderPainted(false);
@@ -37,7 +37,7 @@
37 chooseButton.setHorizontalAlignment(SwingConstants.LEFT);37 chooseButton.setHorizontalAlignment(SwingConstants.LEFT);
38 38
39 clearButton = new JButton("x");39 clearButton = new JButton("x");
40 clearButton.setActionCommand(CLEAR);40 clearButton.setActionCommand(TAG_CLEAR);
41 clearButton.addActionListener(this);41 clearButton.addActionListener(this);
42 clearButton.setFocusable(false);42 clearButton.setFocusable(false);
43 clearButton.setMargin(new Insets(1, 1, 1, 1));43 clearButton.setMargin(new Insets(1, 1, 1, 1));
@@ -50,7 +50,7 @@
5050
51 @Override51 @Override
52 public void actionPerformed(ActionEvent e) {52 public void actionPerformed(ActionEvent e) {
53 if (EDIT.equals(e.getActionCommand())) {53 if (TAG_EDIT.equals(e.getActionCommand())) {
54 JFileChooser fc = new JFileChooser();54 JFileChooser fc = new JFileChooser();
55 fc.setDialogType(JFileChooser.OPEN_DIALOG);55 fc.setDialogType(JFileChooser.OPEN_DIALOG);
56 fc.setMultiSelectionEnabled(false);56 fc.setMultiSelectionEnabled(false);
@@ -59,7 +59,7 @@
59 if (fc.showDialog(null, "Open") == JFileChooser.APPROVE_OPTION) {59 if (fc.showDialog(null, "Open") == JFileChooser.APPROVE_OPTION) {
60 file = fc.getSelectedFile();60 file = fc.getSelectedFile();
61 }61 }
62 } else if (CLEAR.equals(e.getActionCommand())) {62 } else if (TAG_CLEAR.equals(e.getActionCommand())) {
63 file = null;63 file = null;
64 }64 }
65 fireEditingStopped();65 fireEditingStopped();
@@ -74,6 +74,7 @@
74 public Component getTableCellEditorComponent(74 public Component getTableCellEditorComponent(
75 JTable table, Object value, boolean isSelected, int row, int column) {75 JTable table, Object value, boolean isSelected, int row, int column) {
76 file = (File)value;76 file = (File)value;
77 panel.setFont(table.getFont());
77 return panel;78 return panel;
78 }79 }
7980
8081
=== modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/GenericCellEditor.java'
--- WorkcraftCore/src/org/workcraft/gui/propertyeditor/GenericCellEditor.java 2014-07-30 19:51:21 +0000
+++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/GenericCellEditor.java 2015-06-26 22:23:53 +0000
@@ -37,6 +37,7 @@
37 public GenericCellEditor() {37 public GenericCellEditor() {
38 textField = new JTextField();38 textField = new JTextField();
39 textField.setFocusable(true);39 textField.setFocusable(true);
40 textField.setBorder(PropertyEditorTable.BORDER_EDIT);
40 textField.addFocusListener(new FocusAdapter() {41 textField.addFocusListener(new FocusAdapter() {
41 @Override42 @Override
42 public void focusLost(FocusEvent e) {43 public void focusLost(FocusEvent e) {
@@ -50,8 +51,9 @@
50 }51 }
5152
52 public Component getTableCellEditorComponent(JTable table, Object value,53 public Component getTableCellEditorComponent(JTable table, Object value,
53 boolean isSelected, int row, int column) {54 boolean isSelected, int row, int column) {
54 textField.setText(value.toString());55 textField.setText(value.toString());
56 textField.setFont(table.getFont());
55 return textField;57 return textField;
56 }58 }
57}59}
5860
=== modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/ModelProperties.java'
--- WorkcraftCore/src/org/workcraft/gui/propertyeditor/ModelProperties.java 2015-01-12 22:28:11 +0000
+++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/ModelProperties.java 2015-06-26 22:23:53 +0000
@@ -54,6 +54,19 @@
54 propertyDescriptors.addAll(descriptors);54 propertyDescriptors.addAll(descriptors);
55 }55 }
56 }56 }
57
58 public void addSorted(final Collection<PropertyDescriptor> descriptors) {
59 if (descriptors != null) {
60 LinkedList<PropertyDescriptor> sortedDescriptors = new LinkedList<PropertyDescriptor>(descriptors);
61 Collections.sort(sortedDescriptors, new Comparator<PropertyDescriptor>() {
62 @Override
63 public int compare(PropertyDescriptor o1, PropertyDescriptor o2) {
64 return (o1.getName().compareTo(o2.getName()));
65 }
66 });
67 propertyDescriptors.addAll(sortedDescriptors);
68 }
69 }
57 70
58 public void remove(final PropertyDescriptor descriptor) {71 public void remove(final PropertyDescriptor descriptor) {
59 if (descriptor != null) {72 if (descriptor != null) {
@@ -75,14 +88,5 @@
75 public Collection<PropertyDescriptor> getDescriptors() {88 public Collection<PropertyDescriptor> getDescriptors() {
76 return Collections.unmodifiableList(propertyDescriptors);89 return Collections.unmodifiableList(propertyDescriptors);
77 }90 }
78
79 public void sortByPropertyName() {
80 Collections.sort(propertyDescriptors, new Comparator<PropertyDescriptor>() {
81 @Override
82 public int compare(PropertyDescriptor o1, PropertyDescriptor o2) {
83 return (o1.getName().compareTo(o2.getName()));
84 }
85 });
86 }
8791
88}92}
8993
=== modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/NamePropertyDescriptor.java'
--- WorkcraftCore/src/org/workcraft/gui/propertyeditor/NamePropertyDescriptor.java 2015-04-13 18:41:37 +0000
+++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/NamePropertyDescriptor.java 2015-06-26 22:23:53 +0000
@@ -9,6 +9,8 @@
9import org.workcraft.observation.PropertyChangedEvent;9import org.workcraft.observation.PropertyChangedEvent;
1010
11public class NamePropertyDescriptor implements PropertyDescriptor {11public class NamePropertyDescriptor implements PropertyDescriptor {
12 public static final String PROPERTY_NAME = "Name";
13
12 private final AbstractModel model;14 private final AbstractModel model;
13 private final Node node;15 private final Node node;
1416
@@ -26,7 +28,7 @@
26 public void setValue(Object value) throws InvocationTargetException {28 public void setValue(Object value) throws InvocationTargetException {
27 model.setName(node, (String)value);29 model.setName(node, (String)value);
28 if (node instanceof ObservableState) {30 if (node instanceof ObservableState) {
29 ((ObservableState)node).sendNotification(new PropertyChangedEvent(node, "name"));31 ((ObservableState)node).sendNotification(new PropertyChangedEvent(node, PROPERTY_NAME));
30 }32 }
31 }33 }
3234
@@ -37,7 +39,7 @@
3739
38 @Override40 @Override
39 public String getName() {41 public String getName() {
40 return "Name";42 return PROPERTY_NAME;
41 }43 }
4244
43 @Override45 @Override
4446
=== modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/PropertyEditorTable.java'
--- WorkcraftCore/src/org/workcraft/gui/propertyeditor/PropertyEditorTable.java 2015-05-22 17:42:39 +0000
+++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/PropertyEditorTable.java 2015-06-26 22:23:53 +0000
@@ -22,21 +22,33 @@
22package org.workcraft.gui.propertyeditor;22package org.workcraft.gui.propertyeditor;
2323
24import java.awt.Color;24import java.awt.Color;
25import java.awt.Component;
26import java.awt.Font;
27import java.awt.Graphics;
28import java.lang.reflect.InvocationTargetException;
25import java.net.URI;29import java.net.URI;
26import java.util.HashMap;30import java.util.HashMap;
2731
32import javax.swing.BorderFactory;
33import javax.swing.JLabel;
28import javax.swing.JOptionPane;34import javax.swing.JOptionPane;
29import javax.swing.JTable;35import javax.swing.JTable;
36import javax.swing.border.Border;
30import javax.swing.event.ChangeEvent;37import javax.swing.event.ChangeEvent;
31import javax.swing.table.DefaultTableCellRenderer;38import javax.swing.table.DefaultTableCellRenderer;
32import javax.swing.table.TableCellEditor;39import javax.swing.table.TableCellEditor;
33import javax.swing.table.TableCellRenderer;40import javax.swing.table.TableCellRenderer;
3441
35import org.workcraft.Framework;42import org.workcraft.Framework;
43import org.workcraft.PluginManager;
44import org.workcraft.dom.visual.FontHelper;
36import org.workcraft.plugins.PluginInfo;45import org.workcraft.plugins.PluginInfo;
3746
38@SuppressWarnings("serial")47@SuppressWarnings("serial")
39public class PropertyEditorTable extends JTable implements PropertyEditor {48public class PropertyEditorTable extends JTable implements PropertyEditor {
49 public static final Border BORDER_RENDER = BorderFactory.createEmptyBorder(1, 3, 1, 1);
50 public static final Border BORDER_EDIT = BorderFactory.createEmptyBorder(0, 3, 1, 1);
51
40 HashMap<Class<?>, PropertyClass> propertyClasses;52 HashMap<Class<?>, PropertyClass> propertyClasses;
41 TableCellRenderer cellRenderers[];53 TableCellRenderer cellRenderers[];
42 TableCellEditor cellEditors[];54 TableCellEditor cellEditors[];
@@ -46,11 +58,12 @@
46 super();58 super();
4759
48 model = new PropertyEditorTableModel();60 model = new PropertyEditorTableModel();
49 setModel(model);61 setModel(model);
50 62
51 setTableHeader(null);63 setTableHeader(null);
52 setFocusable(false);64 setFocusable(false);
53 65 setRowHeight(FontHelper.getFontSizeInPixels(getFont()));
66
54 propertyClasses = new HashMap<Class<?>, PropertyClass>();67 propertyClasses = new HashMap<Class<?>, PropertyClass>();
55 propertyClasses.put(int.class, new IntegerProperty());68 propertyClasses.put(int.class, new IntegerProperty());
56 propertyClasses.put(Integer.class, new IntegerProperty());69 propertyClasses.put(Integer.class, new IntegerProperty());
@@ -63,7 +76,8 @@
63 propertyClasses.put(URI.class, new FileProperty());76 propertyClasses.put(URI.class, new FileProperty());
6477
65 final Framework framework = Framework.getInstance();78 final Framework framework = Framework.getInstance();
66 for(PluginInfo<? extends PropertyClassProvider> plugin : framework.getPluginManager().getPlugins(PropertyClassProvider.class)) {79 PluginManager pluginManager = framework.getPluginManager();
80 for(PluginInfo<? extends PropertyClassProvider> plugin : pluginManager.getPlugins(PropertyClassProvider.class)) {
67 PropertyClassProvider instance = plugin.newInstance();81 PropertyClassProvider instance = plugin.newInstance();
68 propertyClasses.put(instance.getPropertyType(), instance.getPropertyGui());82 propertyClasses.put(instance.getPropertyType(), instance.getPropertyGui());
69 }83 }
@@ -71,18 +85,46 @@
7185
72 @Override86 @Override
73 public TableCellEditor getCellEditor(int row, int col) {87 public TableCellEditor getCellEditor(int row, int col) {
74 if (col == 0)88 if (col == 0) {
75 return super.getCellEditor(row, col);89 return super.getCellEditor(row, col);
76 else90 } else {
77 return cellEditors[row];91 return cellEditors[row];
92 }
78 }93 }
7994
80 @Override95 @Override
81 public TableCellRenderer getCellRenderer(int row, int col) {96 public TableCellRenderer getCellRenderer(int row, int col) {
82 if (col == 0)97 if (col > 0) {
83 return super.getCellRenderer(row, col);98 return cellRenderers[row];
84 else99 } else {
85 return cellRenderers[row];100 return new TableCellRenderer() {
101 private final JLabel label = new JLabel() {
102 @Override
103 public void paint( Graphics g ) {
104 g.setColor(getBackground());
105 g.fillRect(0, 0, getWidth() - 1, getHeight() - 1);
106 super.paint(g);
107 }
108 };
109
110 @Override
111 public Component getTableCellRendererComponent(JTable table, Object value,
112 boolean isSelected, boolean hasFocus, int row, int column) {
113 label.setText(value.toString());
114 label.setBorder(BORDER_RENDER);
115 PropertyDescriptor descriptor = model.getRowDeclaration(row);
116 try {
117 if (descriptor.getValue() == null) {
118 Font boldFont = label.getFont().deriveFont(Font.BOLD);
119 label.setFont(boldFont);
120 }
121 } catch (InvocationTargetException e) {
122 }
123 //label.setEnabled(false);
124 return label;
125 }
126 };
127 }
86 }128 }
87129
88 @Override130 @Override
@@ -93,11 +135,8 @@
93 @Override135 @Override
94 public void setObject(Properties o) {136 public void setObject(Properties o) {
95 model.setObject(o);137 model.setObject(o);
96
97 cellRenderers = new TableCellRenderer[model.getRowCount()];138 cellRenderers = new TableCellRenderer[model.getRowCount()];
98 cellEditors = new TableCellEditor[model.getRowCount()];139 cellEditors = new TableCellEditor[model.getRowCount()];
99
100
101 for (int i = 0; i < model.getRowCount(); i++) {140 for (int i = 0; i < model.getRowCount(); i++) {
102 PropertyDescriptor decl = model.getRowDeclaration(i);141 PropertyDescriptor decl = model.getRowDeclaration(i);
103 142
@@ -105,21 +144,19 @@
105 if (decl.getChoice() != null) {144 if (decl.getChoice() != null) {
106 model.setRowClass(i, null);145 model.setRowClass(i, null);
107 cellRenderers[i] = new DefaultCellRenderer();146 cellRenderers[i] = new DefaultCellRenderer();
108 ChoiceCellEditor ce = new ChoiceCellEditor(decl);147 cellEditors[i] = new ChoiceCellEditor(decl);
109 cellEditors[i] = ce;
110 } else {148 } else {
111 // otherwise, try to get a corresponding PropertyClass object, that knows how to edit a property of this class149 // otherwise, try to get a corresponding PropertyClass object, that knows how to edit a property of this class
112 PropertyClass cls = propertyClasses.get(decl.getType());150 PropertyClass cls = propertyClasses.get(decl.getType());
113 model.setRowClass(i, cls);151 model.setRowClass(i, cls);
114 if (cls == null) {152 if (cls != null) {
153 cellRenderers[i] = cls.getCellRenderer();
154 cellEditors[i] = cls.getCellEditor();
155 } else {
115 // no PropertyClass exists for this class, fall back to read-only mode using Object.toString()156 // no PropertyClass exists for this class, fall back to read-only mode using Object.toString()
116 System.err.println("Data class \"" + decl.getType().getName() + "\" is not supported by the Property Editor.");157 System.err.println("Data class \"" + decl.getType().getName() + "\" is not supported by the Property Editor.");
117 158 cellRenderers[i] = new DefaultTableCellRenderer();
118 cellRenderers[i] = new DefaultTableCellRenderer();
119 cellEditors[i] = null;159 cellEditors[i] = null;
120 } else {
121 cellRenderers[i] = cls.getCellRenderer();
122 cellEditors[i] = cls.getCellEditor();
123 }160 }
124 }161 }
125 }162 }
126163
=== modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/PropertyEditorTableModel.java'
--- WorkcraftCore/src/org/workcraft/gui/propertyeditor/PropertyEditorTableModel.java 2015-02-09 10:46:28 +0000
+++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/PropertyEditorTableModel.java 2015-06-26 22:23:53 +0000
@@ -66,25 +66,28 @@
66 }66 }
6767
68 public int getColumnCount() {68 public int getColumnCount() {
69 if (object == null)69 if (object == null) {
70 return 0;70 return 0;
71 else71 } else {
72 return 2;72 return 2;
73 }
73 }74 }
7475
75 public int getRowCount() {76 public int getRowCount() {
76 if (object == null)77 if (object == null) {
77 return 0;78 return 0;
78 else79 } else {
79 return declarations.length;80 return declarations.length;
81 }
80 }82 }
8183
82 @Override84 @Override
83 public boolean isCellEditable(int row, int col) {85 public boolean isCellEditable(int row, int col) {
84 if (col == 0)86 if (col == 0) {
85 return false;87 return false;
86 else88 } else {
87 return (declarations[row].isWritable());89 return (declarations[row].isWritable());
90 }
88 }91 }
8992
90 public PropertyDescriptor getRowDeclaration(int i) {93 public PropertyDescriptor getRowDeclaration(int i) {
@@ -92,26 +95,27 @@
92 }95 }
9396
94 public Object getValueAt(int row, int col) {97 public Object getValueAt(int row, int col) {
95 if (col ==0 )98 if (col == 0) {
96 return declarations[row].getName();99 return declarations[row].getName();
97 else try {100 } else {
98 Object value = declarations[row].getValue();101 try {
99 if (rowClasses[row] != null)102 Object value = declarations[row].getValue();
100 return rowClasses[row].toCellRendererValue(value);103 if (rowClasses[row] != null) {
101 else104 return rowClasses[row].toCellRendererValue(value);
102 {105 } else {
103 Map<? extends Object, String> choice = declarations[row].getChoice();106 Map<? extends Object, String> choice = declarations[row].getChoice();
104 if(choice != null) 107 if(choice != null) {
105 return choice.get(value);108 return choice.get(value);
106 else109 } else {
107 return value.toString();110 return value.toString();
111 }
112 }
113 } catch (Throwable e) {
114 return "#EXCEPTION";
108 }115 }
109 } catch (Throwable e) {
110 e.printStackTrace();
111 return "#EXCEPTION";
112 }116 }
113 }117 }
114118
115 @Override119 @Override
116 public void setValueAt(Object value, int row, int col) {120 public void setValueAt(Object value, int row, int col) {
117 PropertyDescriptor desc = declarations[row]; 121 PropertyDescriptor desc = declarations[row];
@@ -128,4 +132,5 @@
128 public Properties getObject() {132 public Properties getObject() {
129 return object;133 return object;
130 }134 }
131}
132\ No newline at end of file135\ No newline at end of file
136
137}
133138
=== modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/StringProperty.java'
--- WorkcraftCore/src/org/workcraft/gui/propertyeditor/StringProperty.java 2014-04-09 22:33:19 +0000
+++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/StringProperty.java 2015-06-26 22:23:53 +0000
@@ -45,7 +45,7 @@
45 public Object toCellRendererValue(Object value) {45 public Object toCellRendererValue(Object value) {
46 String result = "";46 String result = "";
47 if (value != null) {47 if (value != null) {
48 result = "" + value;48 result = value.toString();
49 }49 }
50 return result;50 return result;
51 }51 }
5252
=== modified file 'WorkcraftCore/src/org/workcraft/gui/trees/TreeWindow.java'
--- WorkcraftCore/src/org/workcraft/gui/trees/TreeWindow.java 2015-02-10 15:21:12 +0000
+++ WorkcraftCore/src/org/workcraft/gui/trees/TreeWindow.java 2015-06-26 22:23:53 +0000
@@ -220,8 +220,9 @@
220220
221 String name = decorator.getName(node);221 String name = decorator.getName(node);
222 boolean tricky = name.startsWith("!");222 boolean tricky = name.startsWith("!");
223 if (tricky)223 if (tricky) {
224 name = name.substring(1);224 name = name.substring(1);
225 }
225 Component res = super.getTreeCellRendererComponent(tree, name, sel, expanded, leaf, row, hasFocus);226 Component res = super.getTreeCellRendererComponent(tree, name, sel, expanded, leaf, row, hasFocus);
226227
227228
228229
=== modified file 'WorkcraftCore/src/org/workcraft/gui/workspace/WorkspacePopupProvider.java'
--- WorkcraftCore/src/org/workcraft/gui/workspace/WorkspacePopupProvider.java 2015-01-20 18:45:18 +0000
+++ WorkcraftCore/src/org/workcraft/gui/workspace/WorkspacePopupProvider.java 2015-06-26 22:23:53 +0000
@@ -197,34 +197,29 @@
197 ListMap<String, Pair<String, Tool>> applicableTools = Tools.getTools(openFile);197 ListMap<String, Pair<String, Tool>> applicableTools = Tools.getTools(openFile);
198 List<String> sections = Tools.getSections(applicableTools);198 List<String> sections = Tools.getSections(applicableTools);
199199
200 if (!sections.isEmpty())200 if (!sections.isEmpty()) {
201 popup.addSeparator();201 popup.addSeparator();
202202 }
203 for (String section : sections) {203 for (String section : sections) {
204 JMenu m = new JMenu(section);204 String menuName = (section.startsWith("!") ? section.substring(1) : section);
205205 JMenu menu = new JMenu(menuName);
206 for (Pair<String, Tool> tool : Tools.getSectionTools(section, applicableTools)) {206 for (Pair<String, Tool> tool : Tools.getSectionTools(section, applicableTools)) {
207 JMenuItem mi = new JMenuItem(tool.getFirst());207 JMenuItem item = new JMenuItem(tool.getFirst());
208 tools.put(mi, tool.getSecond());208 tools.put(item, tool.getSecond());
209209 item.addActionListener(new ActionListener() {
210 mi.addActionListener(new ActionListener() {
211 public void actionPerformed(ActionEvent e) {210 public void actionPerformed(ActionEvent e) {
212 Tools.run(openFile, tools.get(e.getSource()));211 Tools.run(openFile, tools.get(e.getSource()));
213 }212 }
214 });213 });
215214 menu.add(item);
216 m.add(mi);
217 }215 }
218216 popup.add(menu);
219 popup.add(m);
220 }217 }
221 }218 }
222
223 popup.addSeparator();219 popup.addSeparator();
224220
225 JMenuItem miRemove = new JMenuItem("Delete");221 JMenuItem miRemove = new JMenuItem("Delete");
226 miRemove.addActionListener(new ActionListener() 222 miRemove.addActionListener(new ActionListener() {
227 {
228 public void actionPerformed(ActionEvent e) {223 public void actionPerformed(ActionEvent e) {
229 try {224 try {
230 workspace.delete(path);225 workspace.delete(path);
@@ -235,9 +230,11 @@
235 }230 }
236231
237 popup.addSeparator();232 popup.addSeparator();
238 if(path.isEmpty())233 if (path.isEmpty()) {
239 for (Component c : wsWindow.createMenu().getMenuComponents())234 for (Component c : wsWindow.createMenu().getMenuComponents()) {
240 popup.add(c);235 popup.add(c);
236 }
237 }
241 return popup;238 return popup;
242 }239 }
243}240}
244\ No newline at end of file241\ No newline at end of file
245242
=== modified file 'WorkcraftCore/src/org/workcraft/serialisation/xml/XMLDeserialiserState.java'
--- WorkcraftCore/src/org/workcraft/serialisation/xml/XMLDeserialiserState.java 2014-07-04 19:54:50 +0000
+++ WorkcraftCore/src/org/workcraft/serialisation/xml/XMLDeserialiserState.java 2015-06-26 22:23:53 +0000
@@ -77,7 +77,7 @@
77 77
78 @Override78 @Override
79 public Object getObject(String reference) {79 public Object getObject(String reference) {
80 if (reference.equals("")) return null;80 if (reference.isEmpty()) return null;
81 81
82 return internalReferenceMap.getValue(reference);82 return internalReferenceMap.getValue(reference);
83 }83 }
8484
=== modified file 'WorkcraftCore/src/org/workcraft/util/Tools.java'
--- WorkcraftCore/src/org/workcraft/util/Tools.java 2015-02-11 10:58:21 +0000
+++ WorkcraftCore/src/org/workcraft/util/Tools.java 2015-06-26 22:23:53 +0000
@@ -41,13 +41,13 @@
41 }41 }
42 }42 }
43 43
44 public static List<String> getSections (ListMap<String, Pair<String, Tool>> tools) {44 public static List<String> getSections(ListMap<String, Pair<String, Tool>> tools) {
45 LinkedList<String> list = new LinkedList<String>(tools.keySet());45 LinkedList<String> list = new LinkedList<String>(tools.keySet());
46 Collections.sort(list);46 Collections.sort(list);
47 return list;47 return list;
48 }48 }
49 49
50 public static List<Pair<String,Tool>> getSectionTools (String section, ListMap<String, Pair<String, Tool>> tools) {50 public static List<Pair<String,Tool>> getSectionTools(String section, ListMap<String, Pair<String, Tool>> tools) {
51 List<Pair<String,Tool>> sectionTools = new ArrayList<Pair<String, Tool>>(tools.get(section));51 List<Pair<String,Tool>> sectionTools = new ArrayList<Pair<String, Tool>>(tools.get(section));
5252
53 Collections.sort(sectionTools, new Comparator<Pair<String,Tool>>() {53 Collections.sort(sectionTools, new Comparator<Pair<String,Tool>>() {
5454
=== modified file 'WorkcraftCore/src/org/workcraft/workspace/WorkspaceEntry.java'
--- WorkcraftCore/src/org/workcraft/workspace/WorkspaceEntry.java 2015-05-19 18:01:37 +0000
+++ WorkcraftCore/src/org/workcraft/workspace/WorkspaceEntry.java 2015-06-26 22:23:53 +0000
@@ -75,7 +75,7 @@
75 }75 }
76 workspace.fireEntryChanged(this);76 workspace.fireEntryChanged(this);
77 final Framework framework = Framework.getInstance();77 final Framework framework = Framework.getInstance();
78 framework.getMainWindow().refreshTitle(this);78 framework.getMainWindow().refreshWorkspaceEntryTitle(this, true);
79 }79 }
80 }80 }
8181
@@ -199,7 +199,7 @@
199 MainWindowActions.EDIT_SELECT_NONE_ACTION.setEnabled(canModify && canSelect);199 MainWindowActions.EDIT_SELECT_NONE_ACTION.setEnabled(canModify && canSelect);
200 MainWindow mainWindow = Framework.getInstance().getMainWindow();200 MainWindow mainWindow = Framework.getInstance().getMainWindow();
201 if (mainWindow != null) {201 if (mainWindow != null) {
202 mainWindow.getMainMenu().getToolsMenu().setEnabled(canModify);202 mainWindow.getMainMenu().updateToolsMenuState(canModify);
203 }203 }
204 }204 }
205205
206206
=== modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/components/QueueComponent.java'
--- XmasPlugin/src/org/workcraft/plugins/xmas/components/QueueComponent.java 2013-11-05 18:01:19 +0000
+++ XmasPlugin/src/org/workcraft/plugins/xmas/components/QueueComponent.java 2015-06-26 22:23:53 +0000
@@ -26,12 +26,13 @@
2626
27@VisualClass(org.workcraft.plugins.xmas.components.VisualQueueComponent.class)27@VisualClass(org.workcraft.plugins.xmas.components.VisualQueueComponent.class)
28public class QueueComponent extends XmasComponent {28public class QueueComponent extends XmasComponent {
2929 public static final String PROPERTY_CAPACITY = "Capacity";
30
30 public int capacity = 0;31 public int capacity = 0;
31 32
32 public void setCapacity(int capacity) {33 public void setCapacity(int capacity) {
33 this.capacity = capacity;34 this.capacity = capacity;
34 sendNotification(new PropertyChangedEvent(this, "capacity"));35 sendNotification(new PropertyChangedEvent(this, PROPERTY_CAPACITY));
35 }36 }
3637
37 public int getCapacity() {38 public int getCapacity() {
3839
=== modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualQueueComponent.java'
--- XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualQueueComponent.java 2015-04-13 18:41:37 +0000
+++ XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualQueueComponent.java 2015-06-26 22:23:53 +0000
@@ -41,6 +41,8 @@
41@Hotkey(KeyEvent.VK_Q)41@Hotkey(KeyEvent.VK_Q)
42@SVGIcon("images/icons/svg/xmas-queue.svg")42@SVGIcon("images/icons/svg/xmas-queue.svg")
43public class VisualQueueComponent extends VisualXmasComponent {43public class VisualQueueComponent extends VisualXmasComponent {
44 public static final String PROPERTY_FOREGROUND_COLOR = "Foreground color";
45
44 public Color color = new Color(0, 0, 0, 255);46 public Color color = new Color(0, 0, 0, 255);
45 47
46 public VisualQueueComponent(QueueComponent component) {48 public VisualQueueComponent(QueueComponent component) {
@@ -55,7 +57,7 @@
55 57
56 private void addPropertyDeclarations() {58 private void addPropertyDeclarations() {
57 addPropertyDeclaration(new PropertyDeclaration<VisualQueueComponent, Integer>(59 addPropertyDeclaration(new PropertyDeclaration<VisualQueueComponent, Integer>(
58 this, "Capacity", Integer.class) {60 this, QueueComponent.PROPERTY_CAPACITY, Integer.class) {
59 public void setter(VisualQueueComponent object, Integer value) {61 public void setter(VisualQueueComponent object, Integer value) {
60 object.getReferencedQueueComponent().setCapacity(value);62 object.getReferencedQueueComponent().setCapacity(value);
61 }63 }
@@ -98,7 +100,7 @@
98 public void setColorRed() {100 public void setColorRed() {
99 this.color = new Color(255, 0, 0, 255);101 this.color = new Color(255, 0, 0, 255);
100 this.setForegroundColor(new Color(255, 0, 0, 255));102 this.setForegroundColor(new Color(255, 0, 0, 255));
101 sendNotification(new PropertyChangedEvent(this, "foregroundColor"));103 sendNotification(new PropertyChangedEvent(this, PROPERTY_FOREGROUND_COLOR));
102 }104 }
103 105
104 @Override106 @Override
105107
=== modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualSourceComponent.java'
--- XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualSourceComponent.java 2013-11-05 18:01:19 +0000
+++ XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualSourceComponent.java 2015-06-26 22:23:53 +0000
@@ -37,6 +37,8 @@
37@Hotkey(KeyEvent.VK_I)37@Hotkey(KeyEvent.VK_I)
38@SVGIcon("images/icons/svg/xmas-source.svg")38@SVGIcon("images/icons/svg/xmas-source.svg")
39public class VisualSourceComponent extends VisualXmasComponent {39public class VisualSourceComponent extends VisualXmasComponent {
40 public static final String PROPERTY_FOREGROUND_COLOR = "Foreground color";
41
40 public Color color = new Color(0, 255, 0, 255);42 public Color color = new Color(0, 255, 0, 255);
41 43
42 public VisualSourceComponent(SourceComponent component) {44 public VisualSourceComponent(SourceComponent component) {
@@ -49,7 +51,7 @@
49 public void setColorRed() {51 public void setColorRed() {
50 this.color = new Color(255, 0, 0, 255);52 this.color = new Color(255, 0, 0, 255);
51 this.setForegroundColor(new Color(255, 0, 0, 255));53 this.setForegroundColor(new Color(255, 0, 0, 255));
52 sendNotification(new PropertyChangedEvent(this, "foregroundColor"));54 sendNotification(new PropertyChangedEvent(this, PROPERTY_FOREGROUND_COLOR));
53 }55 }
54 56
55 @Override57 @Override
5658
=== modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualXmasContact.java'
--- XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualXmasContact.java 2015-04-13 18:41:37 +0000
+++ XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualXmasContact.java 2015-06-26 22:23:53 +0000
@@ -41,6 +41,8 @@
4141
4242
43public class VisualXmasContact extends VisualComponent implements StateObserver {43public class VisualXmasContact extends VisualComponent implements StateObserver {
44 public static final String IO_TYPE_PROPERTY_NAME = "IOtype";
45
44 private double size = 0.4;46 private double size = 0.4;
45 47
46 public VisualXmasContact(XmasContact contact) {48 public VisualXmasContact(XmasContact contact) {
@@ -70,7 +72,7 @@
7072
71 public void setIOType(XmasContact.IOType type) {73 public void setIOType(XmasContact.IOType type) {
72 getReferencedContact().setIOType(type);74 getReferencedContact().setIOType(type);
73 sendNotification(new PropertyChangedEvent(this, "IOtype"));75 sendNotification(new PropertyChangedEvent(this, IO_TYPE_PROPERTY_NAME));
74 }76 }
7577
76 public XmasContact.IOType getIOType() {78 public XmasContact.IOType getIOType() {

Subscribers

People subscribed via source and target branches