Merge lp:~danilovesky/workcraft/trunk-menu-tools into lp:workcraft
- trunk-menu-tools
- Merge into trunk
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 |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Danil Sokolov | Approve | ||
Review via email: mp+263173@code.launchpad.net |
Commit message
Description of the change
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
1 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/Circuit.java' |
2 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/Circuit.java 2015-05-27 12:14:35 +0000 |
3 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/Circuit.java 2015-06-26 22:23:53 +0000 |
4 | @@ -32,6 +32,7 @@ |
5 | import org.workcraft.dom.math.MathNode; |
6 | import org.workcraft.exceptions.InvalidConnectionException; |
7 | import org.workcraft.gui.propertyeditor.ModelProperties; |
8 | +import org.workcraft.gui.propertyeditor.NamePropertyDescriptor; |
9 | import org.workcraft.plugins.circuit.Contact.IOType; |
10 | import org.workcraft.plugins.circuit.references.CircuitReferenceManager; |
11 | import org.workcraft.serialisation.References; |
12 | @@ -88,7 +89,7 @@ |
13 | ModelProperties properties = super.getProperties(node); |
14 | if (node != null) { |
15 | if (node instanceof Joint) { |
16 | - properties.removeByName("Name"); |
17 | + properties.removeByName(NamePropertyDescriptor.PROPERTY_NAME); |
18 | } |
19 | } |
20 | return properties; |
21 | |
22 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/CircuitComponent.java' |
23 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/CircuitComponent.java 2015-05-20 16:27:35 +0000 |
24 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/CircuitComponent.java 2015-06-26 22:23:53 +0000 |
25 | @@ -44,6 +44,10 @@ |
26 | @VisualClass(org.workcraft.plugins.circuit.VisualCircuitComponent.class) |
27 | public class CircuitComponent extends MathGroup implements Container, ObservableHierarchy { |
28 | |
29 | + public static final String PROPERTY_NAME = "Name"; |
30 | + public static final String PROPERTY_IS_ENVIRONMENT = "Treat as environment"; |
31 | + public static final String PROPERTY_IS_ZERO_DELAY = "Zero delay"; |
32 | + |
33 | private final class CircuitHierarchySupervisor extends HierarchySupervisor { |
34 | @Override |
35 | public void handleEvent(HierarchyEvent e) { |
36 | @@ -79,7 +83,7 @@ |
37 | |
38 | public void setIsEnvironment(boolean value) { |
39 | this.isEnvironment = value; |
40 | - sendNotification(new PropertyChangedEvent(this, "is environment")); |
41 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_IS_ENVIRONMENT)); |
42 | } |
43 | |
44 | public boolean getIsEnvironment() { |
45 | @@ -88,7 +92,7 @@ |
46 | |
47 | public void setIsZeroDelay(boolean value) { |
48 | this.isZeroDelay = value; |
49 | - sendNotification(new PropertyChangedEvent(this, "is zero delay")); |
50 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_IS_ZERO_DELAY)); |
51 | } |
52 | |
53 | public boolean getIsZeroDelay() { |
54 | @@ -194,7 +198,7 @@ |
55 | |
56 | public void setName(String name) { |
57 | this.name = name; |
58 | - sendNotification(new PropertyChangedEvent(this, "name")); |
59 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_NAME)); |
60 | } |
61 | |
62 | public String getName() { |
63 | |
64 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/Contact.java' |
65 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/Contact.java 2015-05-15 14:41:05 +0000 |
66 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/Contact.java 2015-06-26 22:23:53 +0000 |
67 | @@ -30,10 +30,10 @@ |
68 | @VisualClass(org.workcraft.plugins.circuit.VisualContact.class) |
69 | public class Contact extends MathNode implements BooleanVariable { |
70 | |
71 | - public static final String PROPERTY_INIT_TO_ONE = "init to one"; |
72 | - public static final String PROPERTY_IO_TYPE = "IO type"; |
73 | - |
74 | - public static final String PROPERTY_NAME = "name"; |
75 | + public static final String PROPERTY_INIT_TO_ONE = "Init to one"; |
76 | + public static final String PROPERTY_IO_TYPE = "I/O type"; |
77 | + public static final String PROPERTY_NAME = "Name"; |
78 | + |
79 | public enum IOType { |
80 | INPUT("Input"), |
81 | OUTPUT("Output"); |
82 | |
83 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/Environment.java' |
84 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/Environment.java 2015-02-09 10:46:28 +0000 |
85 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/Environment.java 2015-06-26 22:23:53 +0000 |
86 | @@ -6,6 +6,8 @@ |
87 | import org.workcraft.observation.PropertyChangedEvent; |
88 | |
89 | public class Environment extends MathNode { |
90 | + public static final String PROPERTY_FILE = "file"; |
91 | + public static final String PROPERTY_BASE = "base"; |
92 | private File file; |
93 | private File base; |
94 | |
95 | @@ -19,7 +21,7 @@ |
96 | |
97 | public void setFile(File file) { |
98 | this.file = file; |
99 | - sendNotification(new PropertyChangedEvent(this, "file")); |
100 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_FILE)); |
101 | } |
102 | |
103 | public File getBase() { |
104 | @@ -28,7 +30,7 @@ |
105 | |
106 | public void setBase(File base) { |
107 | this.base = base; |
108 | - sendNotification(new PropertyChangedEvent(this, "base")); |
109 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_BASE)); |
110 | } |
111 | |
112 | } |
113 | |
114 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/FunctionContact.java' |
115 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/FunctionContact.java 2014-09-05 14:09:00 +0000 |
116 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/FunctionContact.java 2015-06-26 22:23:53 +0000 |
117 | @@ -27,6 +27,9 @@ |
118 | |
119 | @VisualClass(org.workcraft.plugins.circuit.VisualFunctionContact.class) |
120 | public class FunctionContact extends Contact { |
121 | + public static final String PROPERTY_SET_FUNCTION = "Set function"; |
122 | + public static final String PROPERTY_RESET_FUNCTION = "Reset function"; |
123 | + |
124 | private BooleanFormula setFunction = null; |
125 | private BooleanFormula resetFunction = null; |
126 | |
127 | @@ -44,7 +47,7 @@ |
128 | |
129 | public void setSetFunction(BooleanFormula setFunction) { |
130 | this.setFunction = setFunction; |
131 | - sendNotification(new PropertyChangedEvent(this, "setFunction")); |
132 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_SET_FUNCTION)); |
133 | } |
134 | |
135 | public BooleanFormula getResetFunction() { |
136 | @@ -53,7 +56,7 @@ |
137 | |
138 | public void setResetFunction(BooleanFormula resetFunction) { |
139 | this.resetFunction = resetFunction; |
140 | - sendNotification(new PropertyChangedEvent(this, "resetFunction")); |
141 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_RESET_FUNCTION)); |
142 | } |
143 | |
144 | } |
145 | |
146 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/VisualCircuitComponent.java' |
147 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/VisualCircuitComponent.java 2015-05-22 17:42:39 +0000 |
148 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/VisualCircuitComponent.java 2015-06-26 22:23:53 +0000 |
149 | @@ -74,6 +74,8 @@ |
150 | @SVGIcon("images/icons/svg/circuit-component.svg") |
151 | public class VisualCircuitComponent extends VisualComponent implements |
152 | Container, CustomTouchable, StateObserver, ObservableHierarchy { |
153 | + public static final String PROPERTY_RENDER_TYPE = "Render type"; |
154 | + |
155 | private Color inputColor = VisualContact.inputColor; |
156 | private Color outputColor = VisualContact.outputColor; |
157 | |
158 | @@ -97,7 +99,7 @@ |
159 | |
160 | private void addPropertyDeclarations() { |
161 | addPropertyDeclaration(new PropertyDeclaration<VisualCircuitComponent, Boolean>( |
162 | - this, "Treat as environment", Boolean.class) { |
163 | + this, CircuitComponent.PROPERTY_IS_ENVIRONMENT, Boolean.class) { |
164 | protected void setter(VisualCircuitComponent object, Boolean value) { |
165 | object.setIsEnvironment(value); |
166 | } |
167 | @@ -108,7 +110,7 @@ |
168 | }); |
169 | //TODO: Complete support for zero-delay buffers and inverters. |
170 | // addPropertyDeclaration(new PropertyDeclaration<VisualCircuitComponent, Boolean>( |
171 | -// this, "Zero delay", Boolean.class) { |
172 | +// this, CircuitComponent.PROPERTY_IS_ZERO_DELAY, Boolean.class) { |
173 | // protected void setter(VisualCircuitComponent object, Boolean value) { |
174 | // object.setIsZeroDelay(value); |
175 | // } |
176 | @@ -119,7 +121,7 @@ |
177 | // }); |
178 | |
179 | addPropertyDeclaration(new PropertyDeclaration<VisualCircuitComponent, RenderType>( |
180 | - this, "Render type", RenderType.class) { |
181 | + this, PROPERTY_RENDER_TYPE, RenderType.class) { |
182 | protected void setter(VisualCircuitComponent object, RenderType value) { |
183 | object.setRenderType(value); |
184 | } |
185 | @@ -197,7 +199,7 @@ |
186 | this.renderType = renderType; |
187 | setContactsDefaultPosition(); |
188 | invalidateBoundingBox(); |
189 | - sendNotification(new PropertyChangedEvent(this, "render type")); |
190 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_RENDER_TYPE)); |
191 | } |
192 | } |
193 | |
194 | @@ -795,11 +797,11 @@ |
195 | if (e instanceof PropertyChangedEvent) { |
196 | PropertyChangedEvent pc = (PropertyChangedEvent) e; |
197 | String propertyName = pc.getPropertyName(); |
198 | - if (propertyName.equals("name") |
199 | - || propertyName.equals("IOtype") |
200 | - || propertyName.equals("direction") |
201 | - || propertyName.equals("setFunction") |
202 | - || propertyName.equals("resetFunction")) { |
203 | + if (propertyName.equals(Contact.PROPERTY_NAME) |
204 | + || propertyName.equals(Contact.PROPERTY_IO_TYPE) |
205 | + || propertyName.equals(VisualContact.PROPERTY_DIRECTION) |
206 | + || propertyName.equals(FunctionContact.PROPERTY_SET_FUNCTION) |
207 | + || propertyName.equals(FunctionContact.PROPERTY_RESET_FUNCTION)) { |
208 | |
209 | for (Node node : getChildren()) { |
210 | if (node instanceof VisualFunctionContact) { |
211 | |
212 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContact.java' |
213 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContact.java 2015-04-23 18:20:32 +0000 |
214 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContact.java 2015-06-26 22:23:53 +0000 |
215 | @@ -50,6 +50,8 @@ |
216 | |
217 | public class VisualContact extends VisualComponent implements StateObserver { |
218 | |
219 | + public static final String PROPERTY_DIRECTION = "Direction"; |
220 | + |
221 | public enum Direction { |
222 | WEST("West"), |
223 | NORTH("North"), |
224 | @@ -151,7 +153,7 @@ |
225 | |
226 | private void addPropertyDeclarations() { |
227 | addPropertyDeclaration(new PropertyDeclaration<VisualContact, Direction>( |
228 | - this, "Direction", Direction.class) { |
229 | + this, PROPERTY_DIRECTION, Direction.class) { |
230 | protected void setter(VisualContact object, Direction value) { |
231 | object.setDirection(value); |
232 | } |
233 | @@ -161,7 +163,7 @@ |
234 | }); |
235 | |
236 | addPropertyDeclaration(new PropertyDeclaration<VisualContact, IOType>( |
237 | - this, "I/O type", IOType.class, true, true, false) { |
238 | + this, Contact.PROPERTY_IO_TYPE, IOType.class, true, true, false) { |
239 | protected void setter(VisualContact object, IOType value) { |
240 | object.getReferencedContact().setIOType(value); |
241 | } |
242 | @@ -171,7 +173,7 @@ |
243 | }); |
244 | |
245 | addPropertyDeclaration(new PropertyDeclaration<VisualContact, Boolean>( |
246 | - this, "Init to one", Boolean.class) { |
247 | + this, Contact.PROPERTY_INIT_TO_ONE, Boolean.class) { |
248 | protected void setter(VisualContact object, Boolean value) { |
249 | object.getReferencedContact().setInitToOne(value); |
250 | } |
251 | @@ -322,7 +324,7 @@ |
252 | if (value != direction) { |
253 | sendNotification(new TransformChangingEvent(this)); |
254 | this.direction = value; |
255 | - sendNotification(new PropertyChangedEvent(this, "direction")); |
256 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_DIRECTION)); |
257 | sendNotification(new TransformChangedEvent(this)); |
258 | } |
259 | } |
260 | |
261 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContactFormulaProperties.java' |
262 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContactFormulaProperties.java 2015-04-13 18:41:37 +0000 |
263 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/VisualContactFormulaProperties.java 2015-06-26 22:23:53 +0000 |
264 | @@ -50,7 +50,7 @@ |
265 | @Override |
266 | public void setValue(Object value) throws InvocationTargetException { |
267 | String setFunction = (String)value; |
268 | - if (!setFunction.equals("")) { |
269 | + if (!setFunction.isEmpty()) { |
270 | contact.setSetFunction(parseFormula(contact, setFunction)); |
271 | } else { |
272 | contact.setSetFunction(null); |
273 | @@ -100,7 +100,7 @@ |
274 | @Override |
275 | public void setValue(Object value) throws InvocationTargetException { |
276 | String setFunction = (String)value; |
277 | - if (!setFunction.equals("")) { |
278 | + if (!setFunction.isEmpty()) { |
279 | contact.setResetFunction(parseFormula(contact, setFunction)); |
280 | } else { |
281 | contact.setResetFunction(null); |
282 | |
283 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionComponent.java' |
284 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionComponent.java 2015-05-23 21:39:28 +0000 |
285 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionComponent.java 2015-06-26 22:23:53 +0000 |
286 | @@ -165,7 +165,7 @@ |
287 | super.notify(e); |
288 | if (e instanceof PropertyChangedEvent) { |
289 | PropertyChangedEvent pc = (PropertyChangedEvent)e; |
290 | - if (pc.getPropertyName().equals("direction")) { |
291 | + if (pc.getPropertyName().equals(VisualContact.PROPERTY_DIRECTION)) { |
292 | if ((getMainContact() == pc.getSender()) && (getRenderingResult() != null)) { |
293 | setContactsDefaultPosition(); |
294 | } |
295 | |
296 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionContact.java' |
297 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionContact.java 2015-02-18 16:25:29 +0000 |
298 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/VisualFunctionContact.java 2015-06-26 22:23:53 +0000 |
299 | @@ -326,10 +326,11 @@ |
300 | public void notify(StateEvent e) { |
301 | if (e instanceof PropertyChangedEvent) { |
302 | PropertyChangedEvent pc = (PropertyChangedEvent)e; |
303 | - if (pc.getPropertyName().equals("setFunction") || pc.getPropertyName().equals("resetFunction")) { |
304 | + String propertyName = pc.getPropertyName(); |
305 | + if (propertyName.equals(FunctionContact.PROPERTY_SET_FUNCTION) || propertyName.equals(FunctionContact.PROPERTY_RESET_FUNCTION)) { |
306 | invalidateRenderedFormula(); |
307 | } |
308 | - if (pc.getPropertyName().equals("name")) { |
309 | + if (propertyName.equals(Contact.PROPERTY_NAME)) { |
310 | for (VisualFunctionContact vc : getAllContacts()) { |
311 | vc.invalidateRenderedFormula(); |
312 | } |
313 | |
314 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/references/CircuitReferenceManager.java' |
315 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/references/CircuitReferenceManager.java 2014-09-27 20:09:17 +0000 |
316 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/references/CircuitReferenceManager.java 2015-06-26 22:23:53 +0000 |
317 | @@ -35,17 +35,16 @@ |
318 | public void setName(Node node, String name) { |
319 | // support for the older models |
320 | if (Identifier.isNumber(name) && node instanceof Contact) { |
321 | - String n = ((Contact)node).getName(); |
322 | - if ((n != null) && !n.equals("")) { |
323 | - name = n; |
324 | + String nodeName = ((Contact)node).getName(); |
325 | + if ((nodeName != null) && !nodeName.isEmpty()) { |
326 | + name = nodeName; |
327 | } |
328 | } else if (Identifier.isNumber(name) && node instanceof CircuitComponent) { |
329 | - String n = ((CircuitComponent)node).getName(); |
330 | - if ((n != null) && !n.equals("")) { |
331 | - name = n; |
332 | + String nodeName = ((CircuitComponent)node).getName(); |
333 | + if ((nodeName != null) && !nodeName.isEmpty()) { |
334 | + name = nodeName; |
335 | } |
336 | } else if (Identifier.isNumber(name)) { |
337 | - // name="_"+name; |
338 | name = getPrefix(node) + name; |
339 | } |
340 | if (node instanceof Contact) { |
341 | |
342 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/CircuitConnectionDeserializer.java' |
343 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/CircuitConnectionDeserializer.java 2010-10-26 23:44:40 +0000 |
344 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/CircuitConnectionDeserializer.java 2015-06-26 22:23:53 +0000 |
345 | @@ -23,16 +23,6 @@ |
346 | ReferenceResolver internalReferenceResolver, |
347 | ReferenceResolver externalReferenceResolver, |
348 | NodeFinaliser nodeFinaliser) throws DeserialisationException { |
349 | - |
350 | - /* VisualCircuitConnection vc = (VisualCircuitConnection) instance; |
351 | - |
352 | - vc.setVisualConnectionDependencies( |
353 | - (VisualComponent)externalReferenceResolver.getObject(element.getAttribute("first")), |
354 | - (VisualComponent)externalReferenceResolver.getObject(element.getAttribute("second")), |
355 | - new Polyline(vc), |
356 | - (CircuitConnection)externalReferenceResolver.getObject(element.getAttribute("ref")) |
357 | - );*/ |
358 | - |
359 | } |
360 | |
361 | @Override |
362 | |
363 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/CircuitConnectionSerializer.java' |
364 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/CircuitConnectionSerializer.java 2010-10-26 23:44:40 +0000 |
365 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/CircuitConnectionSerializer.java 2015-06-26 22:23:53 +0000 |
366 | @@ -14,11 +14,6 @@ |
367 | ReferenceProducer internalReferences, |
368 | ReferenceProducer externalReferences, NodeSerialiser nodeSerialiser) |
369 | throws SerialisationException { |
370 | - |
371 | -/* VisualCircuitConnection vc = (VisualCircuitConnection) object; |
372 | - element.setAttribute("first", internalReferences.getReference(vc.getFirst())); |
373 | - element.setAttribute("second", internalReferences.getReference(vc.getSecond())); |
374 | - */ |
375 | } |
376 | |
377 | @Override |
378 | |
379 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/FunctionSerialiser.java' |
380 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/FunctionSerialiser.java 2010-10-26 23:44:40 +0000 |
381 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/FunctionSerialiser.java 2015-06-26 22:23:53 +0000 |
382 | @@ -35,8 +35,7 @@ |
383 | public static final String SET_FUNCTION_ATTRIBUTE_NAME = "setFunction"; |
384 | |
385 | @Override |
386 | - public String getClassName() |
387 | - { |
388 | + public String getClassName() { |
389 | return org.workcraft.plugins.circuit.FunctionContact.class.getName(); |
390 | } |
391 | |
392 | @@ -47,7 +46,11 @@ |
393 | throws SerialisationException { |
394 | FunctionContact function = (FunctionContact) object; |
395 | |
396 | - BooleanFormulaSerialiser.writeFormulaAttribute(element, internalReferences, function.getSetFunction(), SET_FUNCTION_ATTRIBUTE_NAME); |
397 | - BooleanFormulaSerialiser.writeFormulaAttribute(element, internalReferences, function.getResetFunction(), RESET_FUNCTION_ATTRIBUTE_NAME); |
398 | + BooleanFormulaSerialiser.writeFormulaAttribute(element, internalReferences, |
399 | + function.getSetFunction(), SET_FUNCTION_ATTRIBUTE_NAME); |
400 | + |
401 | + BooleanFormulaSerialiser.writeFormulaAttribute(element, internalReferences, |
402 | + function.getResetFunction(), RESET_FUNCTION_ATTRIBUTE_NAME); |
403 | } |
404 | -} |
405 | \ No newline at end of file |
406 | + |
407 | +} |
408 | |
409 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/stg/CircuitStgUtils.java' |
410 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/stg/CircuitStgUtils.java 2015-04-28 17:37:41 +0000 |
411 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/stg/CircuitStgUtils.java 2015-06-26 22:23:53 +0000 |
412 | @@ -17,11 +17,16 @@ |
413 | import org.workcraft.tasks.Result; |
414 | import org.workcraft.tasks.Result.Outcome; |
415 | import org.workcraft.util.Export; |
416 | +import org.workcraft.util.Export.ExportTask; |
417 | import org.workcraft.util.FileUtils; |
418 | -import org.workcraft.util.Export.ExportTask; |
419 | import org.workcraft.workspace.WorkspaceEntry; |
420 | |
421 | public class CircuitStgUtils { |
422 | + public static final String TEMP_DIRECTORY_PREFIX = "workcraft-"; |
423 | + public static final String DEVICE_FILE_NAME = "device"; |
424 | + public static final String ENVIRONMENT_FILE_NAME = "environment"; |
425 | + public static final String SYSTEM_FILE_NAME = "system"; |
426 | + public static final String ASTG_FILE_EXT = ".g"; |
427 | |
428 | public static CircuitToStgConverter createCircuitToStgConverter(VisualCircuit circuit) { |
429 | CircuitToStgConverter generator = new CircuitToStgConverter(circuit); |
430 | @@ -39,7 +44,7 @@ |
431 | public static VisualSTG composeDevStgWithEvnFile(VisualSTG devStg, File envFile) { |
432 | VisualSTG resultStg = null; |
433 | Framework framework = Framework.getInstance(); |
434 | - File workingDirectory = FileUtils.createTempDirectory("workcraft-"); |
435 | + File workingDirectory = FileUtils.createTempDirectory(TEMP_DIRECTORY_PREFIX); |
436 | try { |
437 | File devStgFile = exportDevStg(devStg, workingDirectory); |
438 | File envStgFile = exportEnvStg(envFile, workingDirectory); |
439 | @@ -62,7 +67,7 @@ |
440 | Framework framework = Framework.getInstance(); |
441 | if ((devStgFile != null) && (envStgFile != null)) { |
442 | // Generating .g for the whole system (circuit and environment) |
443 | - stgFile = new File(workingDirectory, "system.g"); |
444 | + stgFile = new File(workingDirectory, SYSTEM_FILE_NAME + ASTG_FILE_EXT); |
445 | PcompTask pcompTask = new PcompTask(new File[]{devStgFile, envStgFile}, |
446 | ConversionMode.OUTPUT, true, false, workingDirectory); |
447 | |
448 | @@ -81,12 +86,12 @@ |
449 | private static File exportEnvStg(File envFile, File workingDirectory) throws DeserialisationException, IOException { |
450 | Framework framework = Framework.getInstance(); |
451 | File envStgFile = null; |
452 | - if (envFile.getName().endsWith(".g")) { |
453 | + if (envFile.getName().endsWith(ASTG_FILE_EXT)) { |
454 | envStgFile = envFile; |
455 | } else { |
456 | STG envStg = (STG)framework.loadFile(envFile).getMathModel(); |
457 | Exporter envStgExporter = Export.chooseBestExporter(framework.getPluginManager(), envStg, Format.STG); |
458 | - envStgFile = new File(workingDirectory, "env.g"); |
459 | + envStgFile = new File(workingDirectory, ENVIRONMENT_FILE_NAME + ASTG_FILE_EXT); |
460 | ExportTask envExportTask = new ExportTask(envStgExporter, envStg, envStgFile.getCanonicalPath()); |
461 | Result<? extends Object> envExportResult = framework.getTaskManager().execute( |
462 | envExportTask, "Exporting environment .g", null); |
463 | @@ -103,14 +108,13 @@ |
464 | STG devStg = (STG)visualStg.getMathModel(); |
465 | Exporter devStgExporter = Export.chooseBestExporter(framework.getPluginManager(), devStg, Format.STG); |
466 | if (devStgExporter == null) { |
467 | - throw new RuntimeException ("Exporter not available: model class " + devStg.getClass().getName() + " to format STG."); |
468 | + throw new RuntimeException("Exporter not available: model class " + devStg.getClass().getName() + " to .g format."); |
469 | } |
470 | |
471 | - String devStgName = "dev.g"; |
472 | - File devStgFile = new File(workingDirectory, devStgName); |
473 | + File devStgFile = new File(workingDirectory, DEVICE_FILE_NAME + ASTG_FILE_EXT); |
474 | ExportTask devExportTask = new ExportTask(devStgExporter, devStg, devStgFile.getCanonicalPath()); |
475 | Result<? extends Object> devExportResult = framework.getTaskManager().execute( |
476 | - devExportTask, "Exporting circuit .g", null); |
477 | + devExportTask, "Exporting device .g", null); |
478 | if (devExportResult.getOutcome() != Outcome.FINISHED) { |
479 | devStgFile = null; |
480 | } |
481 | |
482 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitTask.java' |
483 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitTask.java 2015-04-30 23:14:48 +0000 |
484 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/tasks/CheckCircuitTask.java 2015-06-26 22:23:53 +0000 |
485 | @@ -12,6 +12,7 @@ |
486 | import org.workcraft.Framework; |
487 | import org.workcraft.interop.Exporter; |
488 | import org.workcraft.plugins.circuit.VisualCircuit; |
489 | +import org.workcraft.plugins.circuit.stg.CircuitStgUtils; |
490 | import org.workcraft.plugins.circuit.stg.CircuitToStgConverter; |
491 | import org.workcraft.plugins.mpsat.MpsatMode; |
492 | import org.workcraft.plugins.mpsat.MpsatResultParser; |
493 | @@ -77,20 +78,20 @@ |
494 | File envFile = visualCircuit.getEnvironmentFile(); |
495 | boolean hasEnvironment = ((envFile != null) && envFile.exists()); |
496 | |
497 | - String prefix = "workcraft-" + title + "-"; // Prefix must be at least 3 symbols long. |
498 | + String prefix = CircuitStgUtils.TEMP_DIRECTORY_PREFIX + title + "-"; // Prefix must be at least 3 symbols long. |
499 | workingDirectory = FileUtils.createTempDirectory(prefix); |
500 | |
501 | CircuitToStgConverter generator = new CircuitToStgConverter(visualCircuit); |
502 | STG devStg = (STG)generator.getStg().getMathModel(); |
503 | Exporter devStgExporter = Export.chooseBestExporter(framework.getPluginManager(), devStg, Format.STG); |
504 | if (devStgExporter == null) { |
505 | - throw new RuntimeException ("Exporter not available: model class " + devStg.getClass().getName() + " to format STG."); |
506 | + throw new RuntimeException("Exporter not available: model class " + devStg.getClass().getName() + " to .g format."); |
507 | } |
508 | SubtaskMonitor<Object> subtaskMonitor = new SubtaskMonitor<Object>(monitor); |
509 | monitor.progressUpdate(0.10); |
510 | |
511 | // Generating .g for the circuit |
512 | - String devStgName = (hasEnvironment ? "dev.g" : "system.g"); |
513 | + String devStgName = (hasEnvironment ? CircuitStgUtils.DEVICE_FILE_NAME : CircuitStgUtils.SYSTEM_FILE_NAME) + CircuitStgUtils.ASTG_FILE_EXT; |
514 | File devStgFile = new File(workingDirectory, devStgName); |
515 | ExportTask devExportTask = new ExportTask(devStgExporter, devStg, devStgFile.getCanonicalPath()); |
516 | Result<? extends Object> devExportResult = framework.getTaskManager().execute( |
517 | @@ -114,12 +115,12 @@ |
518 | stg = devStg; |
519 | } else { |
520 | File envStgFile = null; |
521 | - if (envFile.getName().endsWith(".g")) { |
522 | + if (envFile.getName().endsWith(CircuitStgUtils.ASTG_FILE_EXT)) { |
523 | envStgFile = envFile; |
524 | } else { |
525 | STG envStg = (STG)framework.loadFile(envFile).getMathModel(); |
526 | Exporter envStgExporter = Export.chooseBestExporter(framework.getPluginManager(), envStg, Format.STG); |
527 | - envStgFile = new File(workingDirectory, "env.g"); |
528 | + envStgFile = new File(workingDirectory, CircuitStgUtils.ENVIRONMENT_FILE_NAME + CircuitStgUtils.ASTG_FILE_EXT); |
529 | ExportTask envExportTask = new ExportTask(envStgExporter, envStg, envStgFile.getCanonicalPath()); |
530 | Result<? extends Object> envExportResult = framework.getTaskManager().execute( |
531 | envExportTask, "Exporting environment .g", subtaskMonitor); |
532 | @@ -135,7 +136,7 @@ |
533 | monitor.progressUpdate(0.25); |
534 | |
535 | // Generating .g for the whole system (circuit and environment) |
536 | - stgFile = new File(workingDirectory, "system.g"); |
537 | + stgFile = new File(workingDirectory, CircuitStgUtils.SYSTEM_FILE_NAME + CircuitStgUtils.ASTG_FILE_EXT); |
538 | PcompTask pcompTask = new PcompTask(new File[]{devStgFile, envStgFile}, ConversionMode.OUTPUT, true, false, workingDirectory); |
539 | pcompResult = framework.getTaskManager().execute( |
540 | pcompTask, "Running pcomp", subtaskMonitor); |
541 | @@ -155,7 +156,7 @@ |
542 | monitor.progressUpdate(0.30); |
543 | |
544 | // Generate unfolding |
545 | - File unfoldingFile = new File(workingDirectory, "system" + MpsatUtilitySettings.getUnfoldingExtension(true)); |
546 | + File unfoldingFile = new File(workingDirectory, CircuitStgUtils.SYSTEM_FILE_NAME + MpsatUtilitySettings.getUnfoldingExtension(true)); |
547 | PunfTask punfTask = new PunfTask(stgFile.getCanonicalPath(), unfoldingFile.getCanonicalPath(), true); |
548 | Result<? extends ExternalProcessResult> punfResult = framework.getTaskManager().execute( |
549 | punfTask, "Unfolding .g", subtaskMonitor); |
550 | |
551 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitTool.java' |
552 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitTool.java 2015-04-23 12:19:54 +0000 |
553 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/tools/CheckCircuitTool.java 2015-06-26 22:23:53 +0000 |
554 | @@ -15,7 +15,7 @@ |
555 | |
556 | @Override |
557 | public String getSection() { |
558 | - return "Verification"; |
559 | + return "!Verification"; |
560 | } |
561 | |
562 | @Override |
563 | |
564 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/Arc.java' |
565 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/Arc.java 2010-04-13 15:52:01 +0000 |
566 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/Arc.java 2015-06-26 22:23:53 +0000 |
567 | @@ -26,28 +26,25 @@ |
568 | import org.workcraft.plugins.cpog.optimisation.BooleanFormula; |
569 | import org.workcraft.plugins.cpog.optimisation.expressions.One; |
570 | |
571 | -public class Arc extends MathConnection |
572 | -{ |
573 | +public class Arc extends MathConnection { |
574 | + public static final String PROPERTY_CONDITION = "Condition"; |
575 | + |
576 | private BooleanFormula condition; |
577 | |
578 | - public Arc() |
579 | - { |
580 | + public Arc() { |
581 | } |
582 | |
583 | - public Arc(Vertex first, Vertex second) |
584 | - { |
585 | + public Arc(Vertex first, Vertex second) { |
586 | super(first, second); |
587 | condition = One.instance(); |
588 | } |
589 | |
590 | - public void setCondition(BooleanFormula condition) |
591 | - { |
592 | + public void setCondition(BooleanFormula condition) { |
593 | this.condition = condition; |
594 | - sendNotification(new PropertyChangedEvent(this, "condition")); |
595 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_CONDITION)); |
596 | } |
597 | |
598 | - public BooleanFormula getCondition() |
599 | - { |
600 | + public BooleanFormula getCondition() { |
601 | return condition; |
602 | } |
603 | } |
604 | |
605 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/RhoClause.java' |
606 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/RhoClause.java 2014-09-19 16:15:28 +0000 |
607 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/RhoClause.java 2015-06-26 22:23:53 +0000 |
608 | @@ -28,13 +28,14 @@ |
609 | import org.workcraft.plugins.cpog.optimisation.expressions.BooleanOperations; |
610 | |
611 | @VisualClass(org.workcraft.plugins.cpog.VisualRhoClause.class) |
612 | -public class RhoClause extends MathNode |
613 | -{ |
614 | +public class RhoClause extends MathNode { |
615 | + public static final String PROPERTY_FORMULA = "Formula"; |
616 | + |
617 | private BooleanFormula formula = BooleanOperations.ONE; |
618 | |
619 | public void setFormula(BooleanFormula formula) { |
620 | this.formula = formula; |
621 | - sendNotification(new PropertyChangedEvent(this, "formula")); |
622 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_FORMULA)); |
623 | } |
624 | |
625 | public BooleanFormula getFormula() { |
626 | |
627 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/Variable.java' |
628 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/Variable.java 2014-09-19 16:15:28 +0000 |
629 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/Variable.java 2015-06-26 22:23:53 +0000 |
630 | @@ -28,16 +28,17 @@ |
631 | import org.workcraft.plugins.cpog.optimisation.expressions.BooleanVisitor; |
632 | |
633 | @VisualClass(org.workcraft.plugins.cpog.VisualVariable.class) |
634 | -public class Variable extends MathNode implements Comparable<Variable>, BooleanVariable |
635 | -{ |
636 | +public class Variable extends MathNode implements Comparable<Variable>, BooleanVariable { |
637 | |
638 | + public static final String PROPERTY_STATE = "State"; |
639 | + |
640 | private VariableState state = VariableState.UNDEFINED; |
641 | |
642 | private String label = ""; |
643 | |
644 | public void setState(VariableState state) { |
645 | this.state = state; |
646 | - sendNotification(new PropertyChangedEvent(this, "state")); |
647 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_STATE)); |
648 | } |
649 | |
650 | public VariableState getState() { |
651 | |
652 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/Vertex.java' |
653 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/Vertex.java 2014-09-19 16:15:28 +0000 |
654 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/Vertex.java 2015-06-26 22:23:53 +0000 |
655 | @@ -28,13 +28,14 @@ |
656 | import org.workcraft.plugins.cpog.optimisation.expressions.One; |
657 | |
658 | @VisualClass(org.workcraft.plugins.cpog.VisualVertex.class) |
659 | -public class Vertex extends MathNode |
660 | -{ |
661 | +public class Vertex extends MathNode { |
662 | + public static final String PROPERTY_CONDITION = "Condition"; |
663 | + |
664 | private BooleanFormula condition = One.instance(); |
665 | |
666 | public void setCondition(BooleanFormula condition) { |
667 | this.condition = condition; |
668 | - sendNotification(new PropertyChangedEvent(this, "condition")); |
669 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_CONDITION)); |
670 | } |
671 | |
672 | public BooleanFormula getCondition() { |
673 | |
674 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/VisualArc.java' |
675 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/VisualArc.java 2014-10-28 16:22:12 +0000 |
676 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/VisualArc.java 2015-06-26 22:23:53 +0000 |
677 | @@ -49,8 +49,8 @@ |
678 | import org.workcraft.plugins.cpog.optimisation.expressions.Zero; |
679 | import org.workcraft.util.Geometry; |
680 | |
681 | -public class VisualArc extends VisualConnection |
682 | -{ |
683 | +public class VisualArc extends VisualConnection { |
684 | + public static final String PROPERTY_CONDITION = "condition"; |
685 | private static Font labelFont; |
686 | private Rectangle2D labelBB = null; |
687 | |
688 | @@ -68,14 +68,12 @@ |
689 | } |
690 | } |
691 | |
692 | - public VisualArc(Arc mathConnection) |
693 | - { |
694 | + public VisualArc(Arc mathConnection) { |
695 | super(); |
696 | this.mathConnection = mathConnection; |
697 | } |
698 | |
699 | - public VisualArc(Arc mathConnection, VisualVertex first, VisualVertex second) |
700 | - { |
701 | + public VisualArc(Arc mathConnection, VisualVertex first, VisualVertex second) { |
702 | super(mathConnection, first, second); |
703 | this.mathConnection = mathConnection; |
704 | } |
705 | @@ -86,8 +84,7 @@ |
706 | } |
707 | |
708 | @Override |
709 | - public Stroke getStroke() |
710 | - { |
711 | + public Stroke getStroke() { |
712 | BooleanFormula value = evaluate(); |
713 | |
714 | if (value == Zero.instance()) |
715 | @@ -98,8 +95,7 @@ |
716 | } |
717 | |
718 | @Override |
719 | - public Color getDrawColor() |
720 | - { |
721 | + public Color getDrawColor() { |
722 | BooleanFormula value = evaluate(); |
723 | |
724 | if (value == Zero.instance() || value == One.instance()) return super.getDrawColor(); |
725 | @@ -107,20 +103,17 @@ |
726 | return Color.LIGHT_GRAY; |
727 | } |
728 | |
729 | - private BooleanFormula evaluate() |
730 | - { |
731 | + private BooleanFormula evaluate() { |
732 | BooleanFormula condition = getCondition(); |
733 | |
734 | condition = BooleanOperations.and(condition, ((VisualVertex) getFirst()).evaluate()); |
735 | condition = BooleanOperations.and(condition, ((VisualVertex) getSecond()).evaluate()); |
736 | |
737 | return condition.accept( |
738 | - new BooleanReplacer(new HashMap<BooleanVariable, BooleanFormula>()) |
739 | - { |
740 | + new BooleanReplacer(new HashMap<BooleanVariable, BooleanFormula>()) { |
741 | @Override |
742 | public BooleanFormula visit(BooleanVariable node) { |
743 | - switch(((Variable)node).getState()) |
744 | - { |
745 | + switch(((Variable)node).getState()) { |
746 | case TRUE: |
747 | return One.instance(); |
748 | case FALSE: |
749 | @@ -133,15 +126,13 @@ |
750 | ); |
751 | } |
752 | |
753 | - public void setCondition(BooleanFormula condition) |
754 | - { |
755 | + public void setCondition(BooleanFormula condition) { |
756 | mathConnection.setCondition(condition); |
757 | - sendNotification(new PropertyChangedEvent(this, "condition")); |
758 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_CONDITION)); |
759 | } |
760 | |
761 | @Override |
762 | - public void draw(DrawRequest r) |
763 | - { |
764 | + public void draw(DrawRequest r) { |
765 | labelBB = null; |
766 | |
767 | if (getCondition() == One.instance()) return; |
768 | @@ -158,8 +149,7 @@ |
769 | Point2D d = graphic.getDerivativeAt(0.5); |
770 | Point2D dd = graphic.getSecondDerivativeAt(0.5); |
771 | |
772 | - if (d.getX() < 0) |
773 | - { |
774 | + if (d.getX() < 0) { |
775 | d = Geometry.multiply(d, -1); |
776 | //dd = Geometry.multiply(dd, -1); |
777 | } |
778 | @@ -180,21 +170,19 @@ |
779 | } |
780 | |
781 | @Override |
782 | - public Rectangle2D getBoundingBox() |
783 | - { |
784 | + public Rectangle2D getBoundingBox() { |
785 | return BoundingBoxHelper.union(super.getBoundingBox(), labelBB); |
786 | } |
787 | |
788 | - public Rectangle2D getLabelBoundingBox() |
789 | - { |
790 | + public Rectangle2D getLabelBoundingBox() { |
791 | return labelBB; |
792 | } |
793 | |
794 | @Override |
795 | - public boolean hitTest(Point2D pointInParentSpace) |
796 | - { |
797 | + public boolean hitTest(Point2D pointInParentSpace) { |
798 | if (labelBB != null && labelBB.contains(pointInParentSpace)) return true; |
799 | |
800 | return super.hitTest(pointInParentSpace); |
801 | } |
802 | + |
803 | } |
804 | |
805 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/VisualScenario.java' |
806 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/VisualScenario.java 2015-02-26 11:59:35 +0000 |
807 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/VisualScenario.java 2015-06-26 22:23:53 +0000 |
808 | @@ -27,6 +27,9 @@ |
809 | |
810 | public class VisualScenario extends VisualGroup |
811 | { |
812 | + public static final String PROPERTY_ENCODING = "Encoding"; |
813 | + public static final String PROPERTY_LABEL = "Label"; |
814 | + |
815 | private static final class ReverseComparator implements Comparator<Variable> |
816 | { |
817 | @Override |
818 | @@ -65,7 +68,7 @@ |
819 | |
820 | public VisualScenario() { |
821 | addPropertyDeclaration(new PropertyDeclaration<VisualScenario, String>( |
822 | - this, "Label", String.class) { |
823 | + this, PROPERTY_LABEL, String.class) { |
824 | public void setter(VisualScenario object, String value) { |
825 | object.setLabel(value); |
826 | } |
827 | @@ -75,7 +78,7 @@ |
828 | }); |
829 | |
830 | addPropertyDeclaration(new PropertyDeclaration<VisualScenario, Encoding>( |
831 | - this, "Encoding", Encoding.class) { |
832 | + this, PROPERTY_ENCODING, Encoding.class) { |
833 | public void setter(VisualScenario object, Encoding value) { |
834 | object.setEncoding(value); |
835 | } |
836 | @@ -276,7 +279,7 @@ |
837 | |
838 | public void setLabel(String label) { |
839 | this.label = label; |
840 | - sendNotification(new PropertyChangedEvent(this, "label")); |
841 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_LABEL)); |
842 | } |
843 | |
844 | public String getLabel() { |
845 | @@ -285,7 +288,7 @@ |
846 | |
847 | public void setEncoding(Encoding encoding) { |
848 | this.encoding = encoding; |
849 | - sendNotification(new PropertyChangedEvent(this, "encoding")); |
850 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_ENCODING)); |
851 | } |
852 | |
853 | public Encoding getEncoding() { |
854 | |
855 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/VisualScenarioPage.java' |
856 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/VisualScenarioPage.java 2015-04-02 17:28:13 +0000 |
857 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/VisualScenarioPage.java 2015-06-26 22:23:53 +0000 |
858 | @@ -7,12 +7,14 @@ |
859 | |
860 | public class VisualScenarioPage extends VisualPage { |
861 | |
862 | + public static final String PROPERTY_ENCODING = "Encoding"; |
863 | + |
864 | public VisualScenarioPage(MathNode refNode) { |
865 | super(refNode); |
866 | // TODO Auto-generated constructor stub |
867 | |
868 | addPropertyDeclaration(new PropertyDeclaration<VisualScenarioPage, Encoding>( |
869 | - this, "Encoding", Encoding.class) { |
870 | + this, PROPERTY_ENCODING, Encoding.class) { |
871 | public void setter(VisualScenarioPage object, Encoding value) { |
872 | object.setEncoding(value); |
873 | } |
874 | @@ -26,7 +28,7 @@ |
875 | |
876 | public void setEncoding(Encoding encoding) { |
877 | this.encoding = encoding; |
878 | - sendNotification(new PropertyChangedEvent(this, "encoding")); |
879 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_ENCODING)); |
880 | } |
881 | |
882 | public Encoding getEncoding() { |
883 | |
884 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/VisualVariable.java' |
885 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/VisualVariable.java 2015-02-26 11:59:35 +0000 |
886 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/VisualVariable.java 2015-06-26 22:23:53 +0000 |
887 | @@ -50,6 +50,7 @@ |
888 | @DisplayName("Variable") |
889 | @SVGIcon("images/icons/svg/variable.svg") |
890 | public class VisualVariable extends VisualComponent { |
891 | + public static final String PROPERTY_LABEL = "Label"; |
892 | private static Font variableFont; |
893 | private static Font valueFont; |
894 | |
895 | @@ -82,7 +83,7 @@ |
896 | public VisualVariable(Variable variable) { |
897 | super(variable); |
898 | addPropertyDeclaration(new PropertyDeclaration<VisualVariable, VariableState>( |
899 | - this, "State", VariableState.class) { |
900 | + this, Variable.PROPERTY_STATE, VariableState.class) { |
901 | public void setter(VisualVariable object, VariableState value) { |
902 | object.setState(value); |
903 | } |
904 | @@ -155,7 +156,7 @@ |
905 | @Override |
906 | public void setLabel(String label) { |
907 | getMathVariable().setLabel(label); |
908 | - sendNotification(new PropertyChangedEvent(this, "label")); |
909 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_LABEL)); |
910 | } |
911 | |
912 | @Override |
913 | |
914 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/VisualVertex.java' |
915 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/VisualVertex.java 2014-10-27 16:09:36 +0000 |
916 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/VisualVertex.java 2015-06-26 22:23:53 +0000 |
917 | @@ -55,6 +55,7 @@ |
918 | @DisplayName("Vertex") |
919 | @SVGIcon("images/icons/svg/vertex.svg") |
920 | public class VisualVertex extends VisualComponent implements CpogFormulaVariable { |
921 | + public static final String PROPERTY_CONDITION = "Condition"; |
922 | public static Font conditionFont; |
923 | private RenderedFormula conditionRenderedFormula = new RenderedFormula("", One.instance(), conditionFont, getLabelPositioning(), getLabelOffset()); |
924 | |
925 | @@ -132,7 +133,7 @@ |
926 | |
927 | public void setCondition(BooleanFormula condition) { |
928 | getMathVertex().setCondition(condition); |
929 | - sendNotification(new PropertyChangedEvent(this, "condition")); |
930 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_CONDITION)); |
931 | } |
932 | |
933 | public BooleanFormula evaluate() { |
934 | |
935 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/gui/ScencoConfigurationDialog.java' |
936 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/gui/ScencoConfigurationDialog.java 2015-05-15 18:05:13 +0000 |
937 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/gui/ScencoConfigurationDialog.java 2015-06-26 22:23:53 +0000 |
938 | @@ -507,15 +507,16 @@ |
939 | Object[][] data = new Object[m][3]; |
940 | for(int i=0; i<m; i++){ |
941 | String name; |
942 | - if(scenarios.get(i).getLabel().equals("")){ |
943 | + if(scenarios.get(i).getLabel().isEmpty()) { |
944 | name = "CPOG " + i; |
945 | - } |
946 | - else{ |
947 | + } else{ |
948 | name = scenarios.get(i).getLabel(); |
949 | } |
950 | data[i][0] = name; |
951 | data[i][1] = ""; |
952 | - for(int j=0; j < Integer.valueOf(bitsText.getText()); j++) data[i][1] = data[i][1] + "X"; |
953 | + for (int j = 0; j < Integer.valueOf(bitsText.getText()); j++) { |
954 | + data[i][1] = data[i][1] + "X"; |
955 | + } |
956 | } |
957 | encodingTable = new JTable(data, columnNames); |
958 | MyTableCellRenderer renderer = new MyTableCellRenderer(); |
959 | |
960 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/serialisation/BooleanFunctionDeserialiser.java' |
961 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/serialisation/BooleanFunctionDeserialiser.java 2014-07-11 09:35:42 +0000 |
962 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/serialisation/BooleanFunctionDeserialiser.java 2015-06-26 22:23:53 +0000 |
963 | @@ -87,8 +87,9 @@ |
964 | |
965 | BooleanFormula formula=null; |
966 | try { |
967 | - if (!string.equals("")) |
968 | + if (!string.isEmpty()) { |
969 | formula = BooleanParser.parse(string, new VariableResolver(internalReferenceResolver)); |
970 | + } |
971 | } catch (ParseException e) { |
972 | throw new DeserialisationException(e); |
973 | } |
974 | |
975 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/tasks/ScencoTask.java' |
976 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/tasks/ScencoTask.java 2015-05-15 18:05:13 +0000 |
977 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/tasks/ScencoTask.java 2015-06-26 22:23:53 +0000 |
978 | @@ -445,7 +445,7 @@ |
979 | System.out.println("Op-code selected for graphs:"); |
980 | for(int i=0; i<m; i++){ |
981 | String name; |
982 | - if (scenarios.get(i).getLabel().equals("")) { |
983 | + if (scenarios.get(i).getLabel().isEmpty()) { |
984 | name = "CPOG " + i; |
985 | } else { |
986 | name = scenarios.get(i).getLabel(); |
987 | @@ -832,11 +832,10 @@ |
988 | |
989 | } |
990 | String empty = ""; |
991 | - for(int i=0; i<settings.getBits(); i++) empty += 'X'; |
992 | - if(enc[k].equals("") || enc[k].equals(empty)){ |
993 | + for (int i=0; i<settings.getBits(); i++) empty += 'X'; |
994 | + if (enc[k].isEmpty() || enc[k].equals(empty)){ |
995 | Output1.println("/"); |
996 | - } |
997 | - else{ |
998 | + } else { |
999 | Output1.println(enc[k]); |
1000 | } |
1001 | } |
1002 | |
1003 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/BinaryRegister.java' |
1004 | --- DfsPlugin/src/org/workcraft/plugins/dfs/BinaryRegister.java 2015-01-09 12:41:39 +0000 |
1005 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/BinaryRegister.java 2015-06-26 22:23:53 +0000 |
1006 | @@ -4,6 +4,8 @@ |
1007 | |
1008 | public class BinaryRegister extends MathDelayNode { |
1009 | |
1010 | + public static final String PROPERTY_MARKING = "Marking"; |
1011 | + |
1012 | public enum Marking { |
1013 | EMPTY("empty"), |
1014 | FALSE_TOKEN("false"), |
1015 | @@ -29,7 +31,7 @@ |
1016 | |
1017 | public void setMarking(Marking value) { |
1018 | this.marking = value; |
1019 | - sendNotification(new PropertyChangedEvent(this, "marking")); |
1020 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_MARKING)); |
1021 | } |
1022 | |
1023 | public boolean isFalseMarked() { |
1024 | |
1025 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/ControlConnection.java' |
1026 | --- DfsPlugin/src/org/workcraft/plugins/dfs/ControlConnection.java 2013-09-10 09:54:55 +0000 |
1027 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/ControlConnection.java 2015-06-26 22:23:53 +0000 |
1028 | @@ -7,6 +7,7 @@ |
1029 | |
1030 | @VisualClass(org.workcraft.plugins.dfs.VisualControlConnection.class) |
1031 | public class ControlConnection extends MathConnection { |
1032 | + public static final String PROPERTY_INVERTING = "Inverting"; |
1033 | private boolean inverting = false; |
1034 | |
1035 | public ControlConnection() { |
1036 | @@ -22,7 +23,7 @@ |
1037 | |
1038 | public void setInverting(boolean value) { |
1039 | this.inverting = value; |
1040 | - sendNotification(new PropertyChangedEvent(this, "inverting")); |
1041 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_INVERTING)); |
1042 | } |
1043 | |
1044 | } |
1045 | |
1046 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/ControlRegister.java' |
1047 | --- DfsPlugin/src/org/workcraft/plugins/dfs/ControlRegister.java 2015-01-09 12:41:39 +0000 |
1048 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/ControlRegister.java 2015-06-26 22:23:53 +0000 |
1049 | @@ -5,7 +5,9 @@ |
1050 | |
1051 | @VisualClass(org.workcraft.plugins.dfs.VisualControlRegister.class) |
1052 | public class ControlRegister extends BinaryRegister { |
1053 | - |
1054 | + public static final String PROPERTY_PROBABILITY = "Probability"; |
1055 | + public static final String PROPERTY_SYNCHRONISATION_TYPE = "Synchronisation type"; |
1056 | + |
1057 | private SynchronisationType synchronisationType = SynchronisationType.PLAIN; |
1058 | private double probability = 1.0; |
1059 | |
1060 | @@ -32,7 +34,7 @@ |
1061 | |
1062 | public void setSynchronisationType(SynchronisationType value) { |
1063 | this.synchronisationType = value; |
1064 | - sendNotification(new PropertyChangedEvent(this, "synchronisation type")); |
1065 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_SYNCHRONISATION_TYPE)); |
1066 | } |
1067 | |
1068 | public double getProbability() { |
1069 | @@ -41,7 +43,7 @@ |
1070 | |
1071 | public void setProbability(double value) { |
1072 | this.probability = value; |
1073 | - sendNotification(new PropertyChangedEvent(this, "probability")); |
1074 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_PROBABILITY)); |
1075 | } |
1076 | |
1077 | } |
1078 | |
1079 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/CounterflowLogic.java' |
1080 | --- DfsPlugin/src/org/workcraft/plugins/dfs/CounterflowLogic.java 2013-11-13 10:32:32 +0000 |
1081 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/CounterflowLogic.java 2015-06-26 22:23:53 +0000 |
1082 | @@ -5,6 +5,10 @@ |
1083 | |
1084 | @VisualClass(org.workcraft.plugins.dfs.VisualCounterflowLogic.class) |
1085 | public class CounterflowLogic extends MathDelayNode { |
1086 | + public static final String PROPERTY_FORWARD_COMPUTED = "Forward computed"; |
1087 | + public static final String PROPERTY_BACKWARD_COMPUTED = "Backward computed"; |
1088 | + public static final String PROPERTY_FORWARD_EARLY_EVALUATION = "Forward early evaluation"; |
1089 | + public static final String PROPERTY_BACKWARD_EARLY_EVALUATION = "Backward early evaluation"; |
1090 | private boolean forwardComputed = false; |
1091 | private boolean backwardComputed = false; |
1092 | private boolean forwardEarlyEvaluation = false; |
1093 | @@ -16,7 +20,7 @@ |
1094 | |
1095 | public void setForwardComputed(boolean value) { |
1096 | this.forwardComputed = value; |
1097 | - sendNotification(new PropertyChangedEvent(this, "forward computed")); |
1098 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_FORWARD_COMPUTED)); |
1099 | } |
1100 | |
1101 | public boolean isBackwardComputed() { |
1102 | @@ -25,7 +29,7 @@ |
1103 | |
1104 | public void setBackwardComputed(boolean value) { |
1105 | this.backwardComputed = value; |
1106 | - sendNotification(new PropertyChangedEvent(this, "backward computed")); |
1107 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_BACKWARD_COMPUTED)); |
1108 | } |
1109 | |
1110 | public boolean isForwardEarlyEvaluation() { |
1111 | @@ -34,7 +38,7 @@ |
1112 | |
1113 | public void setForwardEarlyEvaluation(boolean value) { |
1114 | this.forwardEarlyEvaluation = value; |
1115 | - sendNotification(new PropertyChangedEvent(this, "forward early evaluation")); |
1116 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_FORWARD_EARLY_EVALUATION)); |
1117 | } |
1118 | |
1119 | public boolean isBackwardEarlyEvaluation() { |
1120 | @@ -43,6 +47,6 @@ |
1121 | |
1122 | public void setBackwardEarlyEvaluation(boolean value) { |
1123 | this.backwardEarlyEvaluation = value; |
1124 | - sendNotification(new PropertyChangedEvent(this, "backward early evaluation")); |
1125 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_BACKWARD_EARLY_EVALUATION)); |
1126 | } |
1127 | } |
1128 | |
1129 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/CounterflowRegister.java' |
1130 | --- DfsPlugin/src/org/workcraft/plugins/dfs/CounterflowRegister.java 2013-11-13 10:32:32 +0000 |
1131 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/CounterflowRegister.java 2015-06-26 22:23:53 +0000 |
1132 | @@ -5,6 +5,8 @@ |
1133 | |
1134 | @VisualClass(org.workcraft.plugins.dfs.VisualCounterflowRegister.class) |
1135 | public class CounterflowRegister extends MathDelayNode { |
1136 | + public static final String PROPERTY_AND_MARKED = "And-marked"; |
1137 | + public static final String PROPERTY_OR_MARKED = "Or-marked"; |
1138 | private boolean orMarked = false; |
1139 | private boolean andMarked = false; |
1140 | |
1141 | @@ -14,7 +16,7 @@ |
1142 | |
1143 | public void setOrMarked(boolean orMarked) { |
1144 | this.orMarked = orMarked; |
1145 | - sendNotification(new PropertyChangedEvent(this, "or-marked")); |
1146 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_OR_MARKED)); |
1147 | } |
1148 | |
1149 | public boolean isAndMarked() { |
1150 | @@ -23,7 +25,7 @@ |
1151 | |
1152 | public void setAndMarked(boolean andMarked) { |
1153 | this.andMarked = andMarked; |
1154 | - sendNotification(new PropertyChangedEvent(this, "and-marked")); |
1155 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_AND_MARKED)); |
1156 | } |
1157 | |
1158 | } |
1159 | |
1160 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/Logic.java' |
1161 | --- DfsPlugin/src/org/workcraft/plugins/dfs/Logic.java 2013-11-13 10:32:32 +0000 |
1162 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/Logic.java 2015-06-26 22:23:53 +0000 |
1163 | @@ -26,6 +26,9 @@ |
1164 | |
1165 | @VisualClass(org.workcraft.plugins.dfs.VisualLogic.class) |
1166 | public class Logic extends MathDelayNode { |
1167 | + public static final String PROPERTY_EARLY_EVALUATION = "Early evaluation"; |
1168 | + public static final String PROPERTY_COMPUTED = "Computed"; |
1169 | + |
1170 | private boolean computed = false; |
1171 | private boolean earlyEvaluation = false; |
1172 | |
1173 | @@ -35,7 +38,7 @@ |
1174 | |
1175 | public void setComputed(boolean value) { |
1176 | this.computed = value; |
1177 | - sendNotification(new PropertyChangedEvent(this, "computed")); |
1178 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_COMPUTED)); |
1179 | } |
1180 | |
1181 | public boolean isEarlyEvaluation() { |
1182 | @@ -44,7 +47,7 @@ |
1183 | |
1184 | public void setEarlyEvaluation(boolean value) { |
1185 | this.earlyEvaluation = value; |
1186 | - sendNotification(new PropertyChangedEvent(this, "early evaluation")); |
1187 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_EARLY_EVALUATION)); |
1188 | } |
1189 | |
1190 | } |
1191 | |
1192 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/MathDelayNode.java' |
1193 | --- DfsPlugin/src/org/workcraft/plugins/dfs/MathDelayNode.java 2013-12-16 12:01:22 +0000 |
1194 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/MathDelayNode.java 2015-06-26 22:23:53 +0000 |
1195 | @@ -22,8 +22,11 @@ |
1196 | package org.workcraft.plugins.dfs; |
1197 | |
1198 | import org.workcraft.dom.math.MathNode; |
1199 | +import org.workcraft.observation.PropertyChangedEvent; |
1200 | |
1201 | public class MathDelayNode extends MathNode { |
1202 | + public static final String PROPERTY_DELAY = "Delay"; |
1203 | + |
1204 | private double delay = 0.0; |
1205 | |
1206 | public double getDelay() { |
1207 | @@ -32,6 +35,7 @@ |
1208 | |
1209 | public void setDelay(double value) { |
1210 | this.delay = value; |
1211 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_DELAY)); |
1212 | } |
1213 | |
1214 | } |
1215 | |
1216 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/Register.java' |
1217 | --- DfsPlugin/src/org/workcraft/plugins/dfs/Register.java 2013-11-13 10:32:32 +0000 |
1218 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/Register.java 2015-06-26 22:23:53 +0000 |
1219 | @@ -25,6 +25,8 @@ |
1220 | |
1221 | @VisualClass(org.workcraft.plugins.dfs.VisualRegister.class) |
1222 | public class Register extends MathDelayNode { |
1223 | + public static final String PROPERTY_MARKED = "Marked"; |
1224 | + |
1225 | private boolean marked = false; |
1226 | |
1227 | public boolean isMarked() { |
1228 | @@ -33,7 +35,7 @@ |
1229 | |
1230 | public void setMarked(boolean marked) { |
1231 | this.marked = marked; |
1232 | - sendNotification(new PropertyChangedEvent(this, "marked")); |
1233 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_MARKED)); |
1234 | } |
1235 | |
1236 | } |
1237 | |
1238 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualAbstractRegister.java' |
1239 | --- DfsPlugin/src/org/workcraft/plugins/dfs/VisualAbstractRegister.java 2015-01-20 15:37:33 +0000 |
1240 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualAbstractRegister.java 2015-06-26 22:23:53 +0000 |
1241 | @@ -4,9 +4,11 @@ |
1242 | |
1243 | import org.workcraft.dom.visual.Stylable; |
1244 | import org.workcraft.gui.propertyeditor.PropertyDeclaration; |
1245 | +import org.workcraft.observation.PropertyChangedEvent; |
1246 | import org.workcraft.plugins.shared.CommonVisualSettings; |
1247 | |
1248 | public abstract class VisualAbstractRegister extends VisualDelayComponent { |
1249 | + public static final String PROPERTY_TOKEN_COLOR = "Token color"; |
1250 | protected Color tokenColor = CommonVisualSettings.getBorderColor(); |
1251 | |
1252 | public VisualAbstractRegister(MathDelayNode ref) { |
1253 | @@ -16,7 +18,7 @@ |
1254 | |
1255 | private void addPropertyDeclarations() { |
1256 | addPropertyDeclaration(new PropertyDeclaration<VisualAbstractRegister, Color>( |
1257 | - this, "Token color", Color.class) { |
1258 | + this, PROPERTY_TOKEN_COLOR, Color.class) { |
1259 | public void setter(VisualAbstractRegister object, Color value) { |
1260 | object.setTokenColor(value); |
1261 | } |
1262 | @@ -32,6 +34,7 @@ |
1263 | |
1264 | public void setTokenColor(Color tokenColor) { |
1265 | this.tokenColor = tokenColor; |
1266 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_TOKEN_COLOR)); |
1267 | } |
1268 | |
1269 | @Override |
1270 | |
1271 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualBinaryRegister.java' |
1272 | --- DfsPlugin/src/org/workcraft/plugins/dfs/VisualBinaryRegister.java 2015-01-20 15:37:33 +0000 |
1273 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualBinaryRegister.java 2015-06-26 22:23:53 +0000 |
1274 | @@ -13,7 +13,7 @@ |
1275 | |
1276 | private void addPropertyDeclarations() { |
1277 | addPropertyDeclaration(new PropertyDeclaration<VisualBinaryRegister, Marking>( |
1278 | - this, "Marking", Marking.class) { |
1279 | + this, BinaryRegister.PROPERTY_MARKING, Marking.class) { |
1280 | public void setter(VisualBinaryRegister object, Marking value) { |
1281 | object.getReferencedBinaryRegister().setMarking(value); |
1282 | } |
1283 | |
1284 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualControlConnection.java' |
1285 | --- DfsPlugin/src/org/workcraft/plugins/dfs/VisualControlConnection.java 2015-01-20 15:37:33 +0000 |
1286 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualControlConnection.java 2015-06-26 22:23:53 +0000 |
1287 | @@ -24,7 +24,7 @@ |
1288 | private void addPropertyDeclarations() { |
1289 | super.initialise(); |
1290 | addPropertyDeclaration(new PropertyDeclaration<VisualControlConnection, Boolean>( |
1291 | - this, "Inverting", Boolean.class) { |
1292 | + this, ControlConnection.PROPERTY_INVERTING, Boolean.class) { |
1293 | public void setter(VisualControlConnection object, Boolean value) { |
1294 | ControlConnection ref = getReferencedControlConnection(); |
1295 | // check if ref is not null to trick the order of node creation in deserialiser |
1296 | |
1297 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualControlRegister.java' |
1298 | --- DfsPlugin/src/org/workcraft/plugins/dfs/VisualControlRegister.java 2015-01-09 12:41:39 +0000 |
1299 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualControlRegister.java 2015-06-26 22:23:53 +0000 |
1300 | @@ -32,7 +32,7 @@ |
1301 | |
1302 | private void addPropertyDeclarations() { |
1303 | addPropertyDeclaration(new PropertyDeclaration<VisualControlRegister, Double>( |
1304 | - this, "Probability", Double.class) { |
1305 | + this, ControlRegister.PROPERTY_PROBABILITY, Double.class) { |
1306 | public void setter(VisualControlRegister object, Double value) { |
1307 | object.getReferencedControlRegister().setProbability(value); |
1308 | } |
1309 | @@ -42,7 +42,7 @@ |
1310 | }); |
1311 | |
1312 | addPropertyDeclaration(new PropertyDeclaration<VisualControlRegister, SynchronisationType>( |
1313 | - this, "Synchronisation type", SynchronisationType.class) { |
1314 | + this, ControlRegister.PROPERTY_SYNCHRONISATION_TYPE, SynchronisationType.class) { |
1315 | public void setter(VisualControlRegister object, SynchronisationType value) { |
1316 | object.getReferencedControlRegister().setSynchronisationType(value); |
1317 | } |
1318 | |
1319 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualCounterflowLogic.java' |
1320 | --- DfsPlugin/src/org/workcraft/plugins/dfs/VisualCounterflowLogic.java 2015-01-20 15:37:33 +0000 |
1321 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualCounterflowLogic.java 2015-06-26 22:23:53 +0000 |
1322 | @@ -30,7 +30,7 @@ |
1323 | |
1324 | private void addPropertyDeclarations() { |
1325 | addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowLogic, Boolean>( |
1326 | - this, "Forward Computed", Boolean.class) { |
1327 | + this, CounterflowLogic.PROPERTY_FORWARD_COMPUTED, Boolean.class) { |
1328 | public void setter(VisualCounterflowLogic object, Boolean value) { |
1329 | object.getReferencedCounterflowLogic().setForwardComputed(value); |
1330 | } |
1331 | @@ -40,7 +40,7 @@ |
1332 | }); |
1333 | |
1334 | addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowLogic, Boolean>( |
1335 | - this, "Backward Computed", Boolean.class) { |
1336 | + this, CounterflowLogic.PROPERTY_BACKWARD_COMPUTED, Boolean.class) { |
1337 | public void setter(VisualCounterflowLogic object, Boolean value) { |
1338 | object.getReferencedCounterflowLogic().setBackwardComputed(value); |
1339 | } |
1340 | @@ -51,7 +51,7 @@ |
1341 | |
1342 | |
1343 | addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowLogic, Boolean>( |
1344 | - this, "Forward Early Evaluation", Boolean.class) { |
1345 | + this, CounterflowLogic.PROPERTY_FORWARD_EARLY_EVALUATION, Boolean.class) { |
1346 | public void setter(VisualCounterflowLogic object, Boolean value) { |
1347 | object.getReferencedCounterflowLogic().setForwardEarlyEvaluation(value); |
1348 | } |
1349 | @@ -61,7 +61,7 @@ |
1350 | }); |
1351 | |
1352 | addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowLogic, Boolean>( |
1353 | - this, "Backward Early Evaluation", Boolean.class) { |
1354 | + this, CounterflowLogic.PROPERTY_BACKWARD_EARLY_EVALUATION, Boolean.class) { |
1355 | public void setter(VisualCounterflowLogic object, Boolean value) { |
1356 | object.getReferencedCounterflowLogic().setBackwardEarlyEvaluation(value); |
1357 | } |
1358 | |
1359 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualCounterflowRegister.java' |
1360 | --- DfsPlugin/src/org/workcraft/plugins/dfs/VisualCounterflowRegister.java 2015-01-20 15:37:33 +0000 |
1361 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualCounterflowRegister.java 2015-06-26 22:23:53 +0000 |
1362 | @@ -30,7 +30,7 @@ |
1363 | |
1364 | private void addPropertyDeclarations() { |
1365 | addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowRegister, Boolean>( |
1366 | - this, "Or-marked", Boolean.class) { |
1367 | + this, CounterflowRegister.PROPERTY_OR_MARKED, Boolean.class) { |
1368 | public void setter(VisualCounterflowRegister object, Boolean value) { |
1369 | object.getReferencedCounterflowRegister().setOrMarked(value); |
1370 | } |
1371 | @@ -40,7 +40,7 @@ |
1372 | }); |
1373 | |
1374 | addPropertyDeclaration(new PropertyDeclaration<VisualCounterflowRegister, Boolean>( |
1375 | - this, "And-marked", Boolean.class) { |
1376 | + this, CounterflowRegister.PROPERTY_AND_MARKED, Boolean.class) { |
1377 | public void setter(VisualCounterflowRegister object, Boolean value) { |
1378 | object.getReferencedCounterflowRegister().setAndMarked(value); |
1379 | } |
1380 | |
1381 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualDelayComponent.java' |
1382 | --- DfsPlugin/src/org/workcraft/plugins/dfs/VisualDelayComponent.java 2015-01-20 15:37:33 +0000 |
1383 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualDelayComponent.java 2015-06-26 22:23:53 +0000 |
1384 | @@ -17,7 +17,7 @@ |
1385 | |
1386 | private void addPropertyDeclarations() { |
1387 | addPropertyDeclaration(new PropertyDeclaration<VisualDelayComponent, Double>( |
1388 | - this, "Delay", Double.class) { |
1389 | + this, MathDelayNode.PROPERTY_DELAY, Double.class) { |
1390 | public void setter(VisualDelayComponent object, Double value) { |
1391 | object.getReferencedDelayComponent().setDelay(value); |
1392 | } |
1393 | |
1394 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualLogic.java' |
1395 | --- DfsPlugin/src/org/workcraft/plugins/dfs/VisualLogic.java 2015-01-20 15:37:33 +0000 |
1396 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualLogic.java 2015-06-26 22:23:53 +0000 |
1397 | @@ -29,7 +29,7 @@ |
1398 | |
1399 | private void addPropertyDeclarations() { |
1400 | addPropertyDeclaration(new PropertyDeclaration<VisualLogic, Boolean>( |
1401 | - this, "Computed", Boolean.class) { |
1402 | + this, Logic.PROPERTY_COMPUTED, Boolean.class) { |
1403 | public void setter(VisualLogic object, Boolean value) { |
1404 | object.getReferencedLogic().setComputed(value); |
1405 | } |
1406 | @@ -39,7 +39,7 @@ |
1407 | }); |
1408 | |
1409 | addPropertyDeclaration(new PropertyDeclaration<VisualLogic, Boolean>( |
1410 | - this, "Early Evaluation", Boolean.class) { |
1411 | + this, Logic.PROPERTY_EARLY_EVALUATION, Boolean.class) { |
1412 | public void setter(VisualLogic object, Boolean value) { |
1413 | object.getReferencedLogic().setEarlyEvaluation(value); |
1414 | } |
1415 | |
1416 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/VisualRegister.java' |
1417 | --- DfsPlugin/src/org/workcraft/plugins/dfs/VisualRegister.java 2015-01-20 15:37:33 +0000 |
1418 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/VisualRegister.java 2015-06-26 22:23:53 +0000 |
1419 | @@ -55,7 +55,7 @@ |
1420 | |
1421 | private void addPropertyDeclarations() { |
1422 | addPropertyDeclaration(new PropertyDeclaration<VisualRegister, Boolean>( |
1423 | - this, "Marked", Boolean.class) { |
1424 | + this, Register.PROPERTY_MARKED, Boolean.class) { |
1425 | public void setter(VisualRegister object, Boolean value) { |
1426 | object.getReferencedRegister().setMarked(value); |
1427 | } |
1428 | |
1429 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowDeadlockTool.java' |
1430 | --- DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowDeadlockTool.java 2015-04-23 12:19:54 +0000 |
1431 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowDeadlockTool.java 2015-06-26 22:23:53 +0000 |
1432 | @@ -16,7 +16,7 @@ |
1433 | |
1434 | @Override |
1435 | public String getSection() { |
1436 | - return "Verification"; |
1437 | + return "!Verification"; |
1438 | } |
1439 | |
1440 | @Override |
1441 | |
1442 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowHazardTool.java' |
1443 | --- DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowHazardTool.java 2015-04-23 12:19:54 +0000 |
1444 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowHazardTool.java 2015-06-26 22:23:53 +0000 |
1445 | @@ -15,7 +15,7 @@ |
1446 | |
1447 | @Override |
1448 | public String getSection() { |
1449 | - return "Verification"; |
1450 | + return "!Verification"; |
1451 | } |
1452 | |
1453 | @Override |
1454 | |
1455 | === modified file 'DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowTool.java' |
1456 | --- DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowTool.java 2015-04-23 12:19:54 +0000 |
1457 | +++ DfsPlugin/src/org/workcraft/plugins/dfs/tools/CheckDataflowTool.java 2015-06-26 22:23:53 +0000 |
1458 | @@ -15,7 +15,7 @@ |
1459 | |
1460 | @Override |
1461 | public String getSection() { |
1462 | - return "Verification"; |
1463 | + return "!Verification"; |
1464 | } |
1465 | |
1466 | @Override |
1467 | |
1468 | === modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/Event.java' |
1469 | --- FsmPlugin/src/org/workcraft/plugins/fsm/Event.java 2015-01-08 23:08:14 +0000 |
1470 | +++ FsmPlugin/src/org/workcraft/plugins/fsm/Event.java 2015-06-26 22:23:53 +0000 |
1471 | @@ -8,6 +8,7 @@ |
1472 | @DisplayName("Event") |
1473 | @VisualClass(org.workcraft.plugins.fsm.VisualEvent.class) |
1474 | public class Event extends MathConnection { |
1475 | + public static final String PROPERTY_SYMBOL = "Symbol"; |
1476 | |
1477 | private Symbol symbol; |
1478 | |
1479 | @@ -25,7 +26,7 @@ |
1480 | |
1481 | public void setSymbol(Symbol symbol) { |
1482 | this.symbol = symbol; |
1483 | - sendNotification(new PropertyChangedEvent(this, "symbol")); |
1484 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_SYMBOL)); |
1485 | } |
1486 | |
1487 | } |
1488 | |
1489 | === modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/Fsm.java' |
1490 | --- FsmPlugin/src/org/workcraft/plugins/fsm/Fsm.java 2015-05-27 12:14:35 +0000 |
1491 | +++ FsmPlugin/src/org/workcraft/plugins/fsm/Fsm.java 2015-06-26 22:23:53 +0000 |
1492 | @@ -1,6 +1,7 @@ |
1493 | package org.workcraft.plugins.fsm; |
1494 | |
1495 | import java.util.Collection; |
1496 | +import java.util.LinkedList; |
1497 | |
1498 | import org.workcraft.annotations.VisualClass; |
1499 | import org.workcraft.dom.Container; |
1500 | @@ -12,6 +13,7 @@ |
1501 | import org.workcraft.dom.references.ReferenceManager; |
1502 | import org.workcraft.exceptions.ArgumentException; |
1503 | import org.workcraft.gui.propertyeditor.ModelProperties; |
1504 | +import org.workcraft.gui.propertyeditor.PropertyDescriptor; |
1505 | import org.workcraft.plugins.fsm.propertydescriptors.EventSymbolPropertyDescriptor; |
1506 | import org.workcraft.plugins.fsm.propertydescriptors.SymbolPropertyDescriptor; |
1507 | import org.workcraft.serialisation.References; |
1508 | @@ -152,9 +154,11 @@ |
1509 | public ModelProperties getProperties(Node node) { |
1510 | ModelProperties properties = super.getProperties(node); |
1511 | if (node == null) { |
1512 | + LinkedList<PropertyDescriptor> symbolDescriptors = new LinkedList<>(); |
1513 | for (final Symbol symbol: getSymbols()) { |
1514 | - properties.add(new SymbolPropertyDescriptor(this, symbol)); |
1515 | + symbolDescriptors.add(new SymbolPropertyDescriptor(this, symbol)); |
1516 | } |
1517 | + properties.addSorted(symbolDescriptors); |
1518 | } else if (node instanceof Event) { |
1519 | Event event = (Event) node; |
1520 | properties.add(new EventSymbolPropertyDescriptor(this, event)); |
1521 | |
1522 | === modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/InitialStateSupervisor.java' |
1523 | --- FsmPlugin/src/org/workcraft/plugins/fsm/InitialStateSupervisor.java 2015-04-23 12:19:54 +0000 |
1524 | +++ FsmPlugin/src/org/workcraft/plugins/fsm/InitialStateSupervisor.java 2015-06-26 22:23:53 +0000 |
1525 | @@ -21,7 +21,7 @@ |
1526 | if (e instanceof PropertyChangedEvent) { |
1527 | PropertyChangedEvent pce = (PropertyChangedEvent)e; |
1528 | Object sender = e.getSender(); |
1529 | - if ((sender instanceof State) && pce.getPropertyName().equals("initial")) { |
1530 | + if ((sender instanceof State) && pce.getPropertyName().equals(State.PROPERTY_INITIAL)) { |
1531 | // Update all the states on a change of the initial property |
1532 | handleInitialStateChange((State)sender); |
1533 | } |
1534 | |
1535 | === modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/State.java' |
1536 | --- FsmPlugin/src/org/workcraft/plugins/fsm/State.java 2014-12-13 22:56:43 +0000 |
1537 | +++ FsmPlugin/src/org/workcraft/plugins/fsm/State.java 2015-06-26 22:23:53 +0000 |
1538 | @@ -8,6 +8,9 @@ |
1539 | @DisplayName("State") |
1540 | @VisualClass(org.workcraft.plugins.fsm.VisualState.class) |
1541 | public class State extends MathNode { |
1542 | + public static final String PROPERTY_INITIAL = "Initial"; |
1543 | + public static final String PROPERTY_FINAL = "Final"; |
1544 | + |
1545 | private boolean initialState = false; |
1546 | private boolean finalState = false; |
1547 | |
1548 | @@ -17,7 +20,7 @@ |
1549 | |
1550 | public void setInitial(boolean value) { |
1551 | if (setInitialQuiet(value)) { |
1552 | - sendNotification(new PropertyChangedEvent(this, "initial")); |
1553 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_INITIAL)); |
1554 | } |
1555 | } |
1556 | |
1557 | @@ -36,7 +39,7 @@ |
1558 | public void setFinal(boolean value) { |
1559 | if (finalState != value) { |
1560 | finalState = value; |
1561 | - sendNotification(new PropertyChangedEvent(this, "final")); |
1562 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_FINAL)); |
1563 | } |
1564 | } |
1565 | |
1566 | |
1567 | === modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/SymbolConsistencySupervisor.java' |
1568 | --- FsmPlugin/src/org/workcraft/plugins/fsm/SymbolConsistencySupervisor.java 2015-01-15 18:02:07 +0000 |
1569 | +++ FsmPlugin/src/org/workcraft/plugins/fsm/SymbolConsistencySupervisor.java 2015-06-26 22:23:53 +0000 |
1570 | @@ -21,7 +21,7 @@ |
1571 | if (e instanceof PropertyChangedEvent) { |
1572 | PropertyChangedEvent pce = (PropertyChangedEvent)e; |
1573 | Object sender = e.getSender(); |
1574 | - if ((sender instanceof Event) && pce.getPropertyName().equals("symbol")) { |
1575 | + if ((sender instanceof Event) && pce.getPropertyName().equals(Event.PROPERTY_SYMBOL)) { |
1576 | // Update the collection of symbols on a change of event symbol property |
1577 | handleEventSymbolChange((Event)sender); |
1578 | } |
1579 | |
1580 | === modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/VisualEvent.java' |
1581 | --- FsmPlugin/src/org/workcraft/plugins/fsm/VisualEvent.java 2015-04-13 18:41:37 +0000 |
1582 | +++ FsmPlugin/src/org/workcraft/plugins/fsm/VisualEvent.java 2015-06-26 22:23:53 +0000 |
1583 | @@ -16,10 +16,13 @@ |
1584 | import org.workcraft.gui.Coloriser; |
1585 | import org.workcraft.gui.graph.tools.Decoration; |
1586 | import org.workcraft.gui.propertyeditor.PropertyDeclaration; |
1587 | +import org.workcraft.observation.PropertyChangedEvent; |
1588 | import org.workcraft.plugins.shared.CommonVisualSettings; |
1589 | import org.workcraft.util.Geometry; |
1590 | |
1591 | public class VisualEvent extends VisualConnection { |
1592 | + public static final String PROPERTY_LABEL_COLOR = "Label color"; |
1593 | + |
1594 | // Epsilon symbol in UTF-8 encoding (avoid inserting UTF symbols directly in the source code). |
1595 | public static final char EPSILON_SYMBOL = 0x03B5; |
1596 | |
1597 | @@ -43,7 +46,7 @@ |
1598 | |
1599 | private void addPropertyDeclarations() { |
1600 | addPropertyDeclaration(new PropertyDeclaration<VisualEvent, Color>( |
1601 | - this, "Label color", Color.class) { |
1602 | + this, PROPERTY_LABEL_COLOR, Color.class) { |
1603 | protected void setter(VisualEvent object, Color value) { |
1604 | object.setLabelColor(value); |
1605 | } |
1606 | @@ -144,6 +147,7 @@ |
1607 | |
1608 | public void setLabelColor(Color symbolColor) { |
1609 | this.labelColor = symbolColor; |
1610 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_LABEL_COLOR)); |
1611 | } |
1612 | |
1613 | } |
1614 | |
1615 | === modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/VisualState.java' |
1616 | --- FsmPlugin/src/org/workcraft/plugins/fsm/VisualState.java 2015-04-13 18:41:37 +0000 |
1617 | +++ FsmPlugin/src/org/workcraft/plugins/fsm/VisualState.java 2015-06-26 22:23:53 +0000 |
1618 | @@ -32,7 +32,7 @@ |
1619 | |
1620 | private void addPropertyDeclarations() { |
1621 | addPropertyDeclaration(new PropertyDeclaration<VisualState, Boolean>( |
1622 | - this, "Initial", Boolean.class, true, false, false) { |
1623 | + this, State.PROPERTY_INITIAL, Boolean.class, true, false, false) { |
1624 | public void setter(VisualState object, Boolean value) { |
1625 | object.getReferencedState().setInitial(value); |
1626 | } |
1627 | @@ -42,7 +42,7 @@ |
1628 | }); |
1629 | |
1630 | addPropertyDeclaration(new PropertyDeclaration<VisualState, Boolean>( |
1631 | - this, "Final", Boolean.class, true, true, true) { |
1632 | + this, State.PROPERTY_FINAL, Boolean.class, true, true, true) { |
1633 | public void setter(VisualState object, Boolean value) { |
1634 | object.getReferencedState().setFinal(value); |
1635 | } |
1636 | |
1637 | === modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/propertydescriptors/EventSymbolPropertyDescriptor.java' |
1638 | --- FsmPlugin/src/org/workcraft/plugins/fsm/propertydescriptors/EventSymbolPropertyDescriptor.java 2015-04-13 18:41:37 +0000 |
1639 | +++ FsmPlugin/src/org/workcraft/plugins/fsm/propertydescriptors/EventSymbolPropertyDescriptor.java 2015-06-26 22:23:53 +0000 |
1640 | @@ -25,7 +25,7 @@ |
1641 | |
1642 | @Override |
1643 | public String getName() { |
1644 | - return "Symbol"; |
1645 | + return Event.PROPERTY_SYMBOL; |
1646 | } |
1647 | |
1648 | @Override |
1649 | |
1650 | === modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/propertydescriptors/SymbolPropertyDescriptor.java' |
1651 | --- FsmPlugin/src/org/workcraft/plugins/fsm/propertydescriptors/SymbolPropertyDescriptor.java 2015-04-13 18:41:37 +0000 |
1652 | +++ FsmPlugin/src/org/workcraft/plugins/fsm/propertydescriptors/SymbolPropertyDescriptor.java 2015-06-26 22:23:53 +0000 |
1653 | @@ -62,7 +62,7 @@ |
1654 | if (node == null) { |
1655 | fsm.setName(symbol, name); |
1656 | for (Event event: fsm.getEvents(symbol)) { |
1657 | - event.sendNotification(new PropertyChangedEvent(event, "symbol")); |
1658 | + event.sendNotification(new PropertyChangedEvent(event, Event.PROPERTY_SYMBOL)); |
1659 | } |
1660 | } else if (node instanceof Symbol) { |
1661 | } else { |
1662 | |
1663 | === modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/tools/DeadlockCheckerTool.java' |
1664 | --- FsmPlugin/src/org/workcraft/plugins/fsm/tools/DeadlockCheckerTool.java 2015-01-26 12:46:03 +0000 |
1665 | +++ FsmPlugin/src/org/workcraft/plugins/fsm/tools/DeadlockCheckerTool.java 2015-06-26 22:23:53 +0000 |
1666 | @@ -22,7 +22,7 @@ |
1667 | |
1668 | @Override |
1669 | public String getSection() { |
1670 | - return "Verification"; |
1671 | + return "!Verification"; |
1672 | } |
1673 | |
1674 | @Override |
1675 | |
1676 | === modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/tools/DeterminismCheckerTool.java' |
1677 | --- FsmPlugin/src/org/workcraft/plugins/fsm/tools/DeterminismCheckerTool.java 2015-01-26 12:46:03 +0000 |
1678 | +++ FsmPlugin/src/org/workcraft/plugins/fsm/tools/DeterminismCheckerTool.java 2015-06-26 22:23:53 +0000 |
1679 | @@ -21,7 +21,7 @@ |
1680 | |
1681 | @Override |
1682 | public String getSection() { |
1683 | - return "Verification"; |
1684 | + return "!Verification"; |
1685 | } |
1686 | |
1687 | @Override |
1688 | |
1689 | === modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/tools/ReachabilityCheckerTool.java' |
1690 | --- FsmPlugin/src/org/workcraft/plugins/fsm/tools/ReachabilityCheckerTool.java 2015-01-26 12:46:03 +0000 |
1691 | +++ FsmPlugin/src/org/workcraft/plugins/fsm/tools/ReachabilityCheckerTool.java 2015-06-26 22:23:53 +0000 |
1692 | @@ -22,7 +22,7 @@ |
1693 | |
1694 | @Override |
1695 | public String getSection() { |
1696 | - return "Verification"; |
1697 | + return "!Verification"; |
1698 | } |
1699 | |
1700 | @Override |
1701 | |
1702 | === modified file 'FsmPlugin/src/org/workcraft/plugins/fsm/tools/ReversibilityCheckerTool.java' |
1703 | --- FsmPlugin/src/org/workcraft/plugins/fsm/tools/ReversibilityCheckerTool.java 2015-01-26 12:46:03 +0000 |
1704 | +++ FsmPlugin/src/org/workcraft/plugins/fsm/tools/ReversibilityCheckerTool.java 2015-06-26 22:23:53 +0000 |
1705 | @@ -22,7 +22,7 @@ |
1706 | |
1707 | @Override |
1708 | public String getSection() { |
1709 | - return "Verification"; |
1710 | + return "!Verification"; |
1711 | } |
1712 | |
1713 | @Override |
1714 | |
1715 | === modified file 'FstPlugin/src/org/workcraft/plugins/fst/Fst.java' |
1716 | --- FstPlugin/src/org/workcraft/plugins/fst/Fst.java 2015-04-13 18:41:37 +0000 |
1717 | +++ FstPlugin/src/org/workcraft/plugins/fst/Fst.java 2015-06-26 22:23:53 +0000 |
1718 | @@ -1,6 +1,7 @@ |
1719 | package org.workcraft.plugins.fst; |
1720 | |
1721 | import java.util.Collection; |
1722 | +import java.util.LinkedList; |
1723 | |
1724 | import org.workcraft.annotations.VisualClass; |
1725 | import org.workcraft.dom.Container; |
1726 | @@ -8,6 +9,7 @@ |
1727 | import org.workcraft.dom.references.HierarchicalUniqueNameReferenceManager; |
1728 | import org.workcraft.exceptions.ArgumentException; |
1729 | import org.workcraft.gui.propertyeditor.ModelProperties; |
1730 | +import org.workcraft.gui.propertyeditor.PropertyDescriptor; |
1731 | import org.workcraft.observation.PropertyChangedEvent; |
1732 | import org.workcraft.observation.StateEvent; |
1733 | import org.workcraft.observation.StateSupervisor; |
1734 | @@ -33,9 +35,9 @@ |
1735 | if (e instanceof PropertyChangedEvent) { |
1736 | PropertyChangedEvent pce = (PropertyChangedEvent)e; |
1737 | Object sender = e.getSender(); |
1738 | - if ((sender instanceof Signal) && pce.getPropertyName().equals("type")) { |
1739 | + if ((sender instanceof Signal) && pce.getPropertyName().equals(Signal.PROPERTY_TYPE)) { |
1740 | for (Event event: getEvents((Signal)sender)) { |
1741 | - event.sendNotification(new PropertyChangedEvent(event, "type")); |
1742 | + event.sendNotification(new PropertyChangedEvent(event, Signal.PROPERTY_TYPE)); |
1743 | } |
1744 | } |
1745 | } |
1746 | @@ -123,19 +125,22 @@ |
1747 | public ModelProperties getProperties(Node node) { |
1748 | ModelProperties properties = super.getProperties(node); |
1749 | if (node == null) { |
1750 | + LinkedList<PropertyDescriptor> signalDescriptors= new LinkedList<>(); |
1751 | for (final Signal signal: getSignals()) { |
1752 | - properties.add(new SignalTypePropertyDescriptor(this, signal)); |
1753 | + signalDescriptors.add(new SignalTypePropertyDescriptor(this, signal)); |
1754 | } |
1755 | - properties.sortByPropertyName(); |
1756 | + properties.addSorted(signalDescriptors); |
1757 | } else if (node instanceof SignalEvent) { |
1758 | + LinkedList<PropertyDescriptor> eventDescriptors= new LinkedList<>(); |
1759 | SignalEvent signalEvent = (SignalEvent) node; |
1760 | - properties.add(new EventSignalPropertyDescriptor(this, signalEvent)); |
1761 | + eventDescriptors.add(new EventSignalPropertyDescriptor(this, signalEvent)); |
1762 | Signal signal = signalEvent.getSignal(); |
1763 | - properties.add(new TypePropertyDescriptor(signal)); |
1764 | + eventDescriptors.add(new TypePropertyDescriptor(signal)); |
1765 | if (signal.hasDirection()) { |
1766 | - properties.add(new DirectionPropertyDescriptor(signalEvent)); |
1767 | + eventDescriptors.add(new DirectionPropertyDescriptor(signalEvent)); |
1768 | } |
1769 | - properties.removeByName("Symbol"); |
1770 | + properties.addSorted(eventDescriptors); |
1771 | + properties.removeByName(Event.PROPERTY_SYMBOL); |
1772 | } |
1773 | return properties; |
1774 | } |
1775 | |
1776 | === modified file 'FstPlugin/src/org/workcraft/plugins/fst/Signal.java' |
1777 | --- FstPlugin/src/org/workcraft/plugins/fst/Signal.java 2015-01-12 22:09:40 +0000 |
1778 | +++ FstPlugin/src/org/workcraft/plugins/fst/Signal.java 2015-06-26 22:23:53 +0000 |
1779 | @@ -6,6 +6,8 @@ |
1780 | |
1781 | public class Signal extends Symbol { |
1782 | |
1783 | + public static final String PROPERTY_TYPE = "Type"; |
1784 | + |
1785 | public enum Type { |
1786 | INPUT("input"), |
1787 | OUTPUT("output"), |
1788 | @@ -44,7 +46,7 @@ |
1789 | |
1790 | public void setType(Type type) { |
1791 | this.type = type; |
1792 | - sendNotification(new PropertyChangedEvent(this, "type")); |
1793 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_TYPE)); |
1794 | } |
1795 | |
1796 | public boolean hasDirection() { |
1797 | |
1798 | === modified file 'FstPlugin/src/org/workcraft/plugins/fst/SignalEvent.java' |
1799 | --- FstPlugin/src/org/workcraft/plugins/fst/SignalEvent.java 2015-01-12 22:09:40 +0000 |
1800 | +++ FstPlugin/src/org/workcraft/plugins/fst/SignalEvent.java 2015-06-26 22:23:53 +0000 |
1801 | @@ -11,6 +11,8 @@ |
1802 | @VisualClass(org.workcraft.plugins.fst.VisualSignalEvent.class) |
1803 | public class SignalEvent extends Event { |
1804 | |
1805 | + public static final String PROPERTY_DIRECTION = "Direction"; |
1806 | + |
1807 | public enum Direction { |
1808 | PLUS("+"), |
1809 | MINUS("-"), |
1810 | @@ -52,7 +54,7 @@ |
1811 | |
1812 | public void setDirection(Direction direction) { |
1813 | this.direction = direction; |
1814 | - sendNotification(new PropertyChangedEvent(this, "direction")); |
1815 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_DIRECTION)); |
1816 | } |
1817 | |
1818 | public Signal getSignal() { |
1819 | |
1820 | === modified file 'FstPlugin/src/org/workcraft/plugins/fst/propertydescriptors/DirectionPropertyDescriptor.java' |
1821 | --- FstPlugin/src/org/workcraft/plugins/fst/propertydescriptors/DirectionPropertyDescriptor.java 2015-04-13 18:41:37 +0000 |
1822 | +++ FstPlugin/src/org/workcraft/plugins/fst/propertydescriptors/DirectionPropertyDescriptor.java 2015-06-26 22:23:53 +0000 |
1823 | @@ -18,7 +18,7 @@ |
1824 | |
1825 | @Override |
1826 | public String getName() { |
1827 | - return "Direction"; |
1828 | + return SignalEvent.PROPERTY_DIRECTION; |
1829 | } |
1830 | |
1831 | @Override |
1832 | |
1833 | === modified file 'FstPlugin/src/org/workcraft/plugins/fst/propertydescriptors/TypePropertyDescriptor.java' |
1834 | --- FstPlugin/src/org/workcraft/plugins/fst/propertydescriptors/TypePropertyDescriptor.java 2015-04-13 18:41:37 +0000 |
1835 | +++ FstPlugin/src/org/workcraft/plugins/fst/propertydescriptors/TypePropertyDescriptor.java 2015-06-26 22:23:53 +0000 |
1836 | @@ -9,6 +9,7 @@ |
1837 | import org.workcraft.plugins.fst.Signal.Type; |
1838 | |
1839 | public class TypePropertyDescriptor implements PropertyDescriptor { |
1840 | + |
1841 | private final Signal signal; |
1842 | |
1843 | public TypePropertyDescriptor(Signal signal) { |
1844 | @@ -17,7 +18,7 @@ |
1845 | |
1846 | @Override |
1847 | public String getName() { |
1848 | - return "Signal type"; |
1849 | + return Signal.PROPERTY_TYPE; |
1850 | } |
1851 | |
1852 | @Override |
1853 | |
1854 | === modified file 'FstPlugin/src/org/workcraft/plugins/fst/tools/FstSimulationTool.java' |
1855 | --- FstPlugin/src/org/workcraft/plugins/fst/tools/FstSimulationTool.java 2015-05-27 12:14:35 +0000 |
1856 | +++ FstPlugin/src/org/workcraft/plugins/fst/tools/FstSimulationTool.java 2015-06-26 22:23:53 +0000 |
1857 | @@ -37,7 +37,7 @@ |
1858 | @Override |
1859 | public void activated(final GraphEditor editor) { |
1860 | super.activated(editor); |
1861 | - setStatePaneVisibility(false); |
1862 | + setStatePaneVisibility(true); |
1863 | } |
1864 | |
1865 | @Override |
1866 | |
1867 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/AbstractMpsatChecker.java' |
1868 | --- MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/AbstractMpsatChecker.java 2015-04-23 12:19:54 +0000 |
1869 | +++ MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/AbstractMpsatChecker.java 2015-06-26 22:23:53 +0000 |
1870 | @@ -11,7 +11,7 @@ |
1871 | |
1872 | @Override |
1873 | public final String getSection() { |
1874 | - return "Verification"; |
1875 | + return "!Verification"; |
1876 | } |
1877 | |
1878 | @Override |
1879 | |
1880 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatConformationChecker.java' |
1881 | --- MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatConformationChecker.java 2015-04-23 12:19:54 +0000 |
1882 | +++ MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatConformationChecker.java 2015-06-26 22:23:53 +0000 |
1883 | @@ -16,7 +16,7 @@ |
1884 | |
1885 | @Override |
1886 | public String getSection() { |
1887 | - return "Verification"; |
1888 | + return "!Verification"; |
1889 | } |
1890 | |
1891 | @Override |
1892 | |
1893 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatCustomPropertyChecker.java' |
1894 | --- MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatCustomPropertyChecker.java 2015-04-30 23:14:48 +0000 |
1895 | +++ MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatCustomPropertyChecker.java 2015-06-26 22:23:53 +0000 |
1896 | @@ -20,7 +20,7 @@ |
1897 | |
1898 | @Override |
1899 | public String getSection() { |
1900 | - return "Verification"; |
1901 | + return "!Verification"; |
1902 | } |
1903 | |
1904 | @Override |
1905 | |
1906 | === modified file 'MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatSynthesis.java' |
1907 | --- MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatSynthesis.java 2015-04-28 22:14:55 +0000 |
1908 | +++ MpsatPlugin/src/org/workcraft/plugins/mpsat/tools/MpsatSynthesis.java 2015-06-26 22:23:53 +0000 |
1909 | @@ -20,7 +20,7 @@ |
1910 | |
1911 | @Override |
1912 | public String getSection() { |
1913 | - return "Synthesis"; |
1914 | + return "!Synthesis"; |
1915 | } |
1916 | |
1917 | @Override |
1918 | |
1919 | === modified file 'PetriNetPlugin/src/org/workcraft/plugins/petri/Place.java' |
1920 | --- PetriNetPlugin/src/org/workcraft/plugins/petri/Place.java 2013-07-25 12:29:40 +0000 |
1921 | +++ PetriNetPlugin/src/org/workcraft/plugins/petri/Place.java 2015-06-26 22:23:53 +0000 |
1922 | @@ -28,6 +28,9 @@ |
1923 | |
1924 | @VisualClass(org.workcraft.plugins.petri.VisualPlace.class) |
1925 | public class Place extends MathNode { |
1926 | + public static final String PROPERTY_CAPACITY = "Capacity"; |
1927 | + public static final String PROPERTY_TOKENS = "Tokens"; |
1928 | + |
1929 | protected int tokens = 0; |
1930 | protected int capacity = 1; |
1931 | |
1932 | @@ -43,7 +46,7 @@ |
1933 | capacity = tokens; |
1934 | } |
1935 | this.tokens = tokens; |
1936 | - sendNotification( new PropertyChangedEvent(this, "tokens") ); |
1937 | + sendNotification( new PropertyChangedEvent(this, PROPERTY_TOKENS) ); |
1938 | } |
1939 | |
1940 | public int getCapacity() { |
1941 | @@ -58,6 +61,6 @@ |
1942 | throw new ArgumentException("The place capacity "+ capacity + " is too small for the current number of tokens " + tokens + " ."); |
1943 | } |
1944 | this.capacity = capacity; |
1945 | - sendNotification ( new PropertyChangedEvent (this, "capacity")); |
1946 | + sendNotification ( new PropertyChangedEvent (this, PROPERTY_CAPACITY)); |
1947 | } |
1948 | } |
1949 | |
1950 | === modified file 'PetriNetPlugin/src/org/workcraft/plugins/petri/VisualPlace.java' |
1951 | --- PetriNetPlugin/src/org/workcraft/plugins/petri/VisualPlace.java 2014-12-18 16:28:25 +0000 |
1952 | +++ PetriNetPlugin/src/org/workcraft/plugins/petri/VisualPlace.java 2015-06-26 22:23:53 +0000 |
1953 | @@ -48,6 +48,7 @@ |
1954 | @Hotkey(KeyEvent.VK_P) |
1955 | @SVGIcon("images/icons/svg/place.svg") |
1956 | public class VisualPlace extends VisualComponent { |
1957 | + public static final String PROPERTY_TOKEN_COLOR = "Token color"; |
1958 | protected static double singleTokenSize = CommonVisualSettings.getBaseSize() / 1.9; |
1959 | protected static double multipleTokenSeparation = CommonVisualSettings.getStrokeWidth() / 8; |
1960 | protected Color tokenColor = CommonVisualSettings.getBorderColor(); |
1961 | @@ -59,7 +60,7 @@ |
1962 | |
1963 | private void addPropertyDeclarations() { |
1964 | addPropertyDeclaration(new PropertyDeclaration<VisualPlace, Integer>( |
1965 | - this, "Tokens", Integer.class) { |
1966 | + this, Place.PROPERTY_TOKENS, Integer.class) { |
1967 | public void setter(VisualPlace object, Integer value) { |
1968 | object.getReferencedPlace().setTokens(value); |
1969 | } |
1970 | @@ -69,7 +70,7 @@ |
1971 | }); |
1972 | |
1973 | addPropertyDeclaration(new PropertyDeclaration<VisualPlace, Color>( |
1974 | - this, "Token color", Color.class) { |
1975 | + this, PROPERTY_TOKEN_COLOR, Color.class) { |
1976 | public void setter(VisualPlace object, Color value) { |
1977 | object.setTokenColor(value); |
1978 | } |
1979 | @@ -79,7 +80,7 @@ |
1980 | }); |
1981 | |
1982 | addPropertyDeclaration(new PropertyDeclaration<VisualPlace, Integer>( |
1983 | - this, "Capacity", Integer.class) { |
1984 | + this, Place.PROPERTY_CAPACITY, Integer.class) { |
1985 | public void setter(VisualPlace object, Integer value) { |
1986 | object.getReferencedPlace().setCapacity(value); |
1987 | } |
1988 | @@ -185,7 +186,7 @@ |
1989 | |
1990 | public void setTokenColor(Color tokenColor) { |
1991 | this.tokenColor = tokenColor; |
1992 | - sendNotification(new PropertyChangedEvent(this, "token color")); |
1993 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_TOKEN_COLOR)); |
1994 | } |
1995 | |
1996 | @Override |
1997 | |
1998 | === modified file 'PetriNetPlugin/src/org/workcraft/plugins/petri/tools/PetriNetSimulationTool.java' |
1999 | --- PetriNetPlugin/src/org/workcraft/plugins/petri/tools/PetriNetSimulationTool.java 2015-05-27 12:14:35 +0000 |
2000 | +++ PetriNetPlugin/src/org/workcraft/plugins/petri/tools/PetriNetSimulationTool.java 2015-06-26 22:23:53 +0000 |
2001 | @@ -67,6 +67,7 @@ |
2002 | import org.workcraft.dom.Container; |
2003 | import org.workcraft.dom.Node; |
2004 | import org.workcraft.dom.math.MathModel; |
2005 | +import org.workcraft.dom.visual.FontHelper; |
2006 | import org.workcraft.dom.visual.HitMan; |
2007 | import org.workcraft.dom.visual.VisualGroup; |
2008 | import org.workcraft.dom.visual.VisualModel; |
2009 | @@ -82,6 +83,7 @@ |
2010 | import org.workcraft.gui.graph.tools.Decorator; |
2011 | import org.workcraft.gui.graph.tools.GraphEditor; |
2012 | import org.workcraft.gui.layouts.WrapLayout; |
2013 | +import org.workcraft.gui.propertyeditor.PropertyEditorTable; |
2014 | import org.workcraft.plugins.petri.PetriNetModel; |
2015 | import org.workcraft.plugins.petri.Place; |
2016 | import org.workcraft.plugins.petri.Transition; |
2017 | @@ -177,6 +179,7 @@ |
2018 | |
2019 | traceTable = new JTable(new TraceTableModel()); |
2020 | traceTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
2021 | + traceTable.setRowHeight(FontHelper.getFontSizeInPixels(traceTable.getFont())); |
2022 | traceTable.setDefaultRenderer(Object.class, new TraceTableCellRendererImplementation()); |
2023 | |
2024 | tracePane = new JScrollPane(); |
2025 | @@ -687,10 +690,10 @@ |
2026 | private final class TraceTableCellRendererImplementation implements TableCellRenderer { |
2027 | private final JLabel label = new JLabel() { |
2028 | @Override |
2029 | - public void paint( Graphics g ) { |
2030 | - g.setColor( getBackground() ); |
2031 | - g.fillRect( 0, 0, getWidth() - 1, getHeight() - 1 ); |
2032 | - super.paint( g ); |
2033 | + public void paint(Graphics g) { |
2034 | + g.setColor(getBackground()); |
2035 | + g.fillRect(0, 0, getWidth() - 1, getHeight() - 1); |
2036 | + super.paint(g); |
2037 | } |
2038 | }; |
2039 | |
2040 | @@ -700,7 +703,8 @@ |
2041 | return row == mainTrace.getPosition(); |
2042 | } |
2043 | } else { |
2044 | - if (!branchTrace.isEmpty() && (row >= mainTrace.getPosition()) && (row < mainTrace.getPosition() + branchTrace.size())) { |
2045 | + if (!branchTrace.isEmpty() && (row >= mainTrace.getPosition()) |
2046 | + && (row < mainTrace.getPosition() + branchTrace.size())) { |
2047 | return (row == mainTrace.getPosition() + branchTrace.getPosition()); |
2048 | } |
2049 | } |
2050 | @@ -711,13 +715,15 @@ |
2051 | public Component getTableCellRendererComponent(JTable table, Object value, |
2052 | boolean isSelected, boolean hasFocus, int row, int column) { |
2053 | JLabel result = null; |
2054 | + label.setBorder(PropertyEditorTable.BORDER_RENDER); |
2055 | if ((net != null) && (value instanceof String)) { |
2056 | label.setText((String) value); |
2057 | - label.setForeground(Color.BLACK); |
2058 | if (isActive(row, column)) { |
2059 | - label.setBackground(Color.YELLOW); |
2060 | + label.setForeground(table.getSelectionForeground()); |
2061 | + label.setBackground(table.getSelectionBackground()); |
2062 | } else { |
2063 | - label.setBackground(Color.WHITE); |
2064 | + label.setForeground(table.getForeground()); |
2065 | + label.setBackground(table.getBackground()); |
2066 | } |
2067 | result = label; |
2068 | } |
2069 | |
2070 | === modified file 'PetrifyPlugin/src/org/workcraft/plugins/petrify/tools/PetrifySynthesis.java' |
2071 | --- PetrifyPlugin/src/org/workcraft/plugins/petrify/tools/PetrifySynthesis.java 2015-04-28 22:14:55 +0000 |
2072 | +++ PetrifyPlugin/src/org/workcraft/plugins/petrify/tools/PetrifySynthesis.java 2015-06-26 22:23:53 +0000 |
2073 | @@ -20,7 +20,7 @@ |
2074 | |
2075 | @Override |
2076 | public String getSection() { |
2077 | - return "Synthesis"; |
2078 | + return "!Synthesis"; |
2079 | } |
2080 | |
2081 | @Override |
2082 | @@ -30,7 +30,7 @@ |
2083 | |
2084 | @Override |
2085 | public void run(WorkspaceEntry we) { |
2086 | - // call petrify asynchronous (w/o blocking the GUI) |
2087 | + // Call Petrify asynchronously (without blocking the GUI) |
2088 | try { |
2089 | File instgFile = getInputSTG(WorkspaceUtils.getAs(we, STGModel.class)); |
2090 | File eqnFile = File.createTempFile("petrifyEquations", ".eqn"); |
2091 | |
2092 | === modified file 'PolicyNetPlugin/src/org/workcraft/plugins/policy/Bundle.java' |
2093 | --- PolicyNetPlugin/src/org/workcraft/plugins/policy/Bundle.java 2013-10-31 11:44:01 +0000 |
2094 | +++ PolicyNetPlugin/src/org/workcraft/plugins/policy/Bundle.java 2015-06-26 22:23:53 +0000 |
2095 | @@ -9,21 +9,26 @@ |
2096 | import org.workcraft.observation.PropertyChangedEvent; |
2097 | |
2098 | public class Bundle extends MathNode { |
2099 | + public static final String PROPERTY_ADDED = "added"; |
2100 | + public static final String PROPERTY_REMOVED = "removed"; |
2101 | + public static final String PROPERTY_BUNDLED = "bundled"; |
2102 | + public static final String PROPERTY_UNBUNDLED = "unbundled"; |
2103 | + |
2104 | private final Set<BundledTransition> transitions = new HashSet<BundledTransition>(); |
2105 | |
2106 | public void add(BundledTransition transition) { |
2107 | if (transition != null) { |
2108 | transitions.add(transition); |
2109 | - sendNotification(new PropertyChangedEvent(this, "added")); |
2110 | - transition.sendNotification(new PropertyChangedEvent(this, "bundled")); |
2111 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_ADDED)); |
2112 | + transition.sendNotification(new PropertyChangedEvent(this, PROPERTY_BUNDLED)); |
2113 | } |
2114 | } |
2115 | |
2116 | public void remove(BundledTransition transition) { |
2117 | if (contains(transition)) { |
2118 | transitions.remove(transition); |
2119 | - sendNotification(new PropertyChangedEvent(this, "removed")); |
2120 | - transition.sendNotification(new PropertyChangedEvent(this, "unbundled")); |
2121 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_REMOVED)); |
2122 | + transition.sendNotification(new PropertyChangedEvent(this, PROPERTY_UNBUNDLED)); |
2123 | } |
2124 | } |
2125 | |
2126 | |
2127 | === modified file 'PolicyNetPlugin/src/org/workcraft/plugins/policy/VisualBundle.java' |
2128 | --- PolicyNetPlugin/src/org/workcraft/plugins/policy/VisualBundle.java 2014-01-28 17:11:19 +0000 |
2129 | +++ PolicyNetPlugin/src/org/workcraft/plugins/policy/VisualBundle.java 2015-06-26 22:23:53 +0000 |
2130 | @@ -48,6 +48,8 @@ |
2131 | |
2132 | @DisplayName ("Bundle") |
2133 | public class VisualBundle extends VisualNode implements Drawable, DependentNode { |
2134 | + public static final String PROPERTY_COLOR = "color"; |
2135 | + |
2136 | private Bundle bundle; |
2137 | protected double strokeWidth = CommonVisualSettings.getStrokeWidth(); |
2138 | private Color color = CieColorUtils.getLabColor(0.7f, (float)Math.random(), (float)Math.random()); |
2139 | @@ -142,7 +144,7 @@ |
2140 | |
2141 | public void setColor(Color value) { |
2142 | this.color = value; |
2143 | - sendNotification(new PropertyChangedEvent(this, "color")); |
2144 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_COLOR)); |
2145 | } |
2146 | |
2147 | public Color getColor() { |
2148 | |
2149 | === modified file 'PolicyNetPlugin/src/org/workcraft/plugins/policy/tools/CheckDeadlockTool.java' |
2150 | --- PolicyNetPlugin/src/org/workcraft/plugins/policy/tools/CheckDeadlockTool.java 2015-04-23 12:19:54 +0000 |
2151 | +++ PolicyNetPlugin/src/org/workcraft/plugins/policy/tools/CheckDeadlockTool.java 2015-06-26 22:23:53 +0000 |
2152 | @@ -16,7 +16,7 @@ |
2153 | |
2154 | @Override |
2155 | public String getSection() { |
2156 | - return "Verification"; |
2157 | + return "!Verification"; |
2158 | } |
2159 | |
2160 | @Override |
2161 | |
2162 | === modified file 'SONPlugin/src/org/workcraft/plugins/son/gui/OutputArea.java' |
2163 | --- SONPlugin/src/org/workcraft/plugins/son/gui/OutputArea.java 2014-11-24 18:55:08 +0000 |
2164 | +++ SONPlugin/src/org/workcraft/plugins/son/gui/OutputArea.java 2015-06-26 22:23:53 +0000 |
2165 | @@ -80,7 +80,7 @@ |
2166 | myfile=new File(myfile.getAbsolutePath().concat(".txt")); |
2167 | } |
2168 | } |
2169 | - if(myfile==null || myfile.getName().equals("")) |
2170 | + if(myfile==null || myfile.getName().isEmpty()) |
2171 | { |
2172 | JOptionPane.showMessageDialog(this,"Please enter a file name!","Error",JOptionPane.ERROR_MESSAGE); |
2173 | return; |
2174 | |
2175 | === modified file 'STGPlugin/src/org/workcraft/plugins/stg/DummyTransition.java' |
2176 | --- STGPlugin/src/org/workcraft/plugins/stg/DummyTransition.java 2014-11-07 18:09:40 +0000 |
2177 | +++ STGPlugin/src/org/workcraft/plugins/stg/DummyTransition.java 2015-06-26 22:23:53 +0000 |
2178 | @@ -29,12 +29,13 @@ |
2179 | @DisplayName("Dummy transition") |
2180 | @VisualClass(org.workcraft.plugins.stg.VisualDummyTransition.class) |
2181 | public class DummyTransition extends NamedTransition { |
2182 | + public static final String PROPERTY_NAME = "Name"; |
2183 | private String name; |
2184 | |
2185 | @NoAutoSerialisation |
2186 | public void setName(String name) { |
2187 | this.name = name; |
2188 | - sendNotification(new PropertyChangedEvent(this, "name")); |
2189 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_NAME)); |
2190 | } |
2191 | |
2192 | @NoAutoSerialisation |
2193 | |
2194 | === modified file 'STGPlugin/src/org/workcraft/plugins/stg/SignalTransition.java' |
2195 | --- STGPlugin/src/org/workcraft/plugins/stg/SignalTransition.java 2015-01-09 12:41:39 +0000 |
2196 | +++ STGPlugin/src/org/workcraft/plugins/stg/SignalTransition.java 2015-06-26 22:23:53 +0000 |
2197 | @@ -31,6 +31,10 @@ |
2198 | @VisualClass(org.workcraft.plugins.stg.VisualSignalTransition.class) |
2199 | public class SignalTransition extends NamedTransition |
2200 | { |
2201 | + public static final String PROPERTY_SIGNAL_TYPE = "Signal type"; |
2202 | + public static final String PROPERTY_SIGNAL_NAME = "Signal name"; |
2203 | + public static final String PROPERTY_DIRECTION = "Direction"; |
2204 | + |
2205 | public enum Type { |
2206 | INPUT("input"), |
2207 | OUTPUT("output"), |
2208 | @@ -85,7 +89,7 @@ |
2209 | public void setSignalType(Type type) { |
2210 | if (this.type != type) { |
2211 | this.type = type; |
2212 | - sendNotification(new PropertyChangedEvent(this, "signalType")); |
2213 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_SIGNAL_TYPE)); |
2214 | } |
2215 | } |
2216 | |
2217 | @@ -96,7 +100,7 @@ |
2218 | public void setDirection(Direction direction) { |
2219 | if (this.direction != direction) { |
2220 | this.direction = direction; |
2221 | - sendNotification(new PropertyChangedEvent(this, "direction")); |
2222 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_DIRECTION)); |
2223 | } |
2224 | } |
2225 | |
2226 | @@ -108,7 +112,7 @@ |
2227 | @NoAutoSerialisation |
2228 | public void setSignalName(String signalName) { |
2229 | this.signalName = signalName; |
2230 | - sendNotification(new PropertyChangedEvent(this, "signalName")); |
2231 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_SIGNAL_NAME)); |
2232 | } |
2233 | |
2234 | @NoAutoSerialisation |
2235 | |
2236 | === modified file 'STGPlugin/src/org/workcraft/plugins/stg/SignalTypeConsistencySupervisor.java' |
2237 | --- STGPlugin/src/org/workcraft/plugins/stg/SignalTypeConsistencySupervisor.java 2015-01-15 18:02:07 +0000 |
2238 | +++ STGPlugin/src/org/workcraft/plugins/stg/SignalTypeConsistencySupervisor.java 2015-06-26 22:23:53 +0000 |
2239 | @@ -42,18 +42,19 @@ |
2240 | public void handleEvent(StateEvent e) { |
2241 | if (e instanceof PropertyChangedEvent) { |
2242 | PropertyChangedEvent pce = (PropertyChangedEvent)e; |
2243 | - if (pce.getPropertyName().equals("signalType") || pce.getPropertyName().equals("signalName")) { |
2244 | + String propertyName = pce.getPropertyName(); |
2245 | + if (propertyName.equals(SignalTransition.PROPERTY_SIGNAL_TYPE) || propertyName.equals(SignalTransition.PROPERTY_SIGNAL_NAME)) { |
2246 | SignalTransition t = (SignalTransition)e.getSender(); |
2247 | String signalName = t.getSignalName(); |
2248 | Container container = (Container)t.getParent(); |
2249 | SignalTransition.Type signalType = t.getSignalType(); |
2250 | final Collection<SignalTransition> transitions = stg.getSignalTransitions(signalName, container); |
2251 | - if (pce.getPropertyName().equals("signalType")) { |
2252 | + if (propertyName.equals(SignalTransition.PROPERTY_SIGNAL_TYPE)) { |
2253 | for (SignalTransition tt : transitions) { |
2254 | tt.setSignalType(signalType); |
2255 | } |
2256 | } |
2257 | - if (pce.getPropertyName().equals("signalName")) { |
2258 | + if (propertyName.equals(SignalTransition.PROPERTY_SIGNAL_NAME)) { |
2259 | for (SignalTransition tt : transitions) { |
2260 | if (tt == t) continue; |
2261 | t.setSignalType(tt.getSignalType()); |
2262 | |
2263 | === modified file 'STGPlugin/src/org/workcraft/plugins/stg/VisualImplicitPlaceArc.java' |
2264 | --- STGPlugin/src/org/workcraft/plugins/stg/VisualImplicitPlaceArc.java 2014-12-16 18:20:48 +0000 |
2265 | +++ STGPlugin/src/org/workcraft/plugins/stg/VisualImplicitPlaceArc.java 2015-06-26 22:23:53 +0000 |
2266 | @@ -78,7 +78,7 @@ |
2267 | |
2268 | private void addPropertyDeclarations() { |
2269 | addPropertyDeclaration(new PropertyDeclaration<VisualImplicitPlaceArc, Integer>( |
2270 | - this, "Tokens", Integer.class) { |
2271 | + this, Place.PROPERTY_TOKENS, Integer.class) { |
2272 | public void setter(VisualImplicitPlaceArc object, Integer value) { |
2273 | object.getImplicitPlace().setTokens(value); |
2274 | } |
2275 | @@ -88,7 +88,7 @@ |
2276 | }); |
2277 | |
2278 | addPropertyDeclaration(new PropertyDeclaration<VisualImplicitPlaceArc, Integer>( |
2279 | - this, "Capacity", Integer.class) { |
2280 | + this, Place.PROPERTY_CAPACITY, Integer.class) { |
2281 | public void setter(VisualImplicitPlaceArc object, Integer value) { |
2282 | object.getImplicitPlace().setCapacity(value); |
2283 | } |
2284 | @@ -98,7 +98,7 @@ |
2285 | }); |
2286 | |
2287 | addPropertyDeclaration(new PropertyDeclaration<VisualImplicitPlaceArc, Color>( |
2288 | - this, "Token color", Color.class) { |
2289 | + this, VisualPlace.PROPERTY_TOKEN_COLOR, Color.class) { |
2290 | public void setter(VisualImplicitPlaceArc object, Color value) { |
2291 | object.setTokenColor(value); |
2292 | } |
2293 | @@ -182,7 +182,7 @@ |
2294 | |
2295 | public void setTokenColor(Color tokenColor) { |
2296 | this.tokenColor = tokenColor; |
2297 | - sendNotification(new PropertyChangedEvent(this, "token color")); |
2298 | + sendNotification(new PropertyChangedEvent(this, VisualPlace.PROPERTY_TOKEN_COLOR)); |
2299 | } |
2300 | |
2301 | @Override |
2302 | |
2303 | === modified file 'STGPlugin/src/org/workcraft/plugins/stg/VisualSTG.java' |
2304 | --- STGPlugin/src/org/workcraft/plugins/stg/VisualSTG.java 2015-05-06 21:13:09 +0000 |
2305 | +++ STGPlugin/src/org/workcraft/plugins/stg/VisualSTG.java 2015-06-26 22:23:53 +0000 |
2306 | @@ -47,6 +47,7 @@ |
2307 | import org.workcraft.exceptions.InvalidConnectionException; |
2308 | import org.workcraft.exceptions.NodeCreationException; |
2309 | import org.workcraft.gui.propertyeditor.ModelProperties; |
2310 | +import org.workcraft.gui.propertyeditor.PropertyDescriptor; |
2311 | import org.workcraft.plugins.petri.Place; |
2312 | import org.workcraft.plugins.petri.Transition; |
2313 | import org.workcraft.plugins.petri.VisualPlace; |
2314 | @@ -335,12 +336,14 @@ |
2315 | ModelProperties properties = super.getProperties(node); |
2316 | if (node == null) { |
2317 | for (Type type : Type.values()) { |
2318 | + LinkedList<PropertyDescriptor> typeDescriptors = new LinkedList<>(); |
2319 | Container container = NamespaceHelper.getMathContainer(this, getCurrentLevel()); |
2320 | for (final String signalName : stg.getSignalNames(type, container)) { |
2321 | if (stg.getSignalTransitions(signalName, container).isEmpty()) continue; |
2322 | - properties.add(new SignalNamePropertyDescriptor(stg, signalName, container)); |
2323 | - properties.add(new SignalTypePropertyDescriptor(stg, signalName, container)); |
2324 | + typeDescriptors.add(new SignalNamePropertyDescriptor(stg, signalName, container)); |
2325 | + typeDescriptors.add(new SignalTypePropertyDescriptor(stg, signalName, container)); |
2326 | } |
2327 | + properties.addSorted(typeDescriptors); |
2328 | } |
2329 | } |
2330 | return properties; |
2331 | |
2332 | === modified file 'STGPlugin/src/org/workcraft/plugins/stg/propertydescriptors/DirectionPropertyDescriptor.java' |
2333 | --- STGPlugin/src/org/workcraft/plugins/stg/propertydescriptors/DirectionPropertyDescriptor.java 2015-04-13 18:41:37 +0000 |
2334 | +++ STGPlugin/src/org/workcraft/plugins/stg/propertydescriptors/DirectionPropertyDescriptor.java 2015-06-26 22:23:53 +0000 |
2335 | @@ -7,6 +7,7 @@ |
2336 | import org.workcraft.dom.Node; |
2337 | import org.workcraft.gui.propertyeditor.PropertyDescriptor; |
2338 | import org.workcraft.plugins.stg.STG; |
2339 | +import org.workcraft.plugins.stg.SignalTransition; |
2340 | import org.workcraft.plugins.stg.SignalTransition.Direction; |
2341 | |
2342 | public class DirectionPropertyDescriptor implements PropertyDescriptor { |
2343 | @@ -20,7 +21,7 @@ |
2344 | |
2345 | @Override |
2346 | public String getName() { |
2347 | - return "Direction"; |
2348 | + return SignalTransition.PROPERTY_DIRECTION; |
2349 | } |
2350 | |
2351 | @Override |
2352 | |
2353 | === modified file 'STGPlugin/src/org/workcraft/plugins/stg/propertydescriptors/TypePropertyDescriptor.java' |
2354 | --- STGPlugin/src/org/workcraft/plugins/stg/propertydescriptors/TypePropertyDescriptor.java 2015-04-13 18:41:37 +0000 |
2355 | +++ STGPlugin/src/org/workcraft/plugins/stg/propertydescriptors/TypePropertyDescriptor.java 2015-06-26 22:23:53 +0000 |
2356 | @@ -10,6 +10,8 @@ |
2357 | import org.workcraft.plugins.stg.SignalTransition.Type; |
2358 | |
2359 | public class TypePropertyDescriptor implements PropertyDescriptor { |
2360 | + public static final String PROPERTY_SIGNAL_TYPE = "Signal type"; |
2361 | + |
2362 | private final STG stg; |
2363 | private final SignalTransition transition; |
2364 | |
2365 | @@ -20,7 +22,7 @@ |
2366 | |
2367 | @Override |
2368 | public String getName() { |
2369 | - return "Signal type"; |
2370 | + return PROPERTY_SIGNAL_TYPE; |
2371 | } |
2372 | |
2373 | @Override |
2374 | |
2375 | === modified file 'STGPlugin/src/org/workcraft/plugins/stg/tools/StgSimulationTool.java' |
2376 | --- STGPlugin/src/org/workcraft/plugins/stg/tools/StgSimulationTool.java 2015-05-27 12:14:35 +0000 |
2377 | +++ STGPlugin/src/org/workcraft/plugins/stg/tools/StgSimulationTool.java 2015-06-26 22:23:53 +0000 |
2378 | @@ -18,9 +18,11 @@ |
2379 | import org.workcraft.dom.Connection; |
2380 | import org.workcraft.dom.Node; |
2381 | import org.workcraft.dom.hierarchy.NamespaceHelper; |
2382 | +import org.workcraft.dom.visual.FontHelper; |
2383 | import org.workcraft.dom.visual.connections.VisualConnection; |
2384 | import org.workcraft.gui.Coloriser; |
2385 | import org.workcraft.gui.graph.tools.GraphEditor; |
2386 | +import org.workcraft.gui.propertyeditor.PropertyEditorTable; |
2387 | import org.workcraft.plugins.petri.Transition; |
2388 | import org.workcraft.plugins.petri.VisualPlace; |
2389 | import org.workcraft.plugins.petri.VisualTransition; |
2390 | @@ -73,7 +75,7 @@ |
2391 | } |
2392 | |
2393 | private final class StateTableCellRendererImplementation implements TableCellRenderer { |
2394 | - JLabel label = new JLabel() { |
2395 | + final JLabel label = new JLabel() { |
2396 | @Override |
2397 | public void paint(Graphics g) { |
2398 | g.setColor(getBackground()); |
2399 | @@ -86,21 +88,25 @@ |
2400 | public Component getTableCellRendererComponent(JTable table, Object value, |
2401 | boolean isSelected, boolean hasFocus, int row, int column) { |
2402 | JLabel result = null; |
2403 | + label.setBorder(PropertyEditorTable.BORDER_RENDER); |
2404 | + label.setBackground(table.getBackground()); |
2405 | if ((net != null) && (value instanceof SignalState)) { |
2406 | SignalState st = (SignalState)value; |
2407 | if (column == 0) { |
2408 | label.setText(st.name); |
2409 | label.setForeground(st.color); |
2410 | - label.setFont(label.getFont().deriveFont(Font.PLAIN)); |
2411 | + Font plainFont = table.getFont().deriveFont(Font.PLAIN); |
2412 | + label.setFont(plainFont); |
2413 | } else { |
2414 | if (st.value < 0) { |
2415 | label.setText("?"); |
2416 | } else { |
2417 | label.setText(Integer.toString(st.value)); |
2418 | } |
2419 | - label.setForeground(Color.BLACK); |
2420 | + label.setForeground(table.getForeground()); |
2421 | if (st.excited) { |
2422 | - label.setFont(label.getFont().deriveFont(Font.BOLD)); |
2423 | + Font boldFont = table.getFont().deriveFont(Font.BOLD); |
2424 | + label.setFont(boldFont); |
2425 | } |
2426 | } |
2427 | result = label; |
2428 | @@ -138,18 +144,19 @@ |
2429 | public Component getTableCellRendererComponent(JTable table, Object value, |
2430 | boolean isSelected, boolean hasFocus, int row, int column) { |
2431 | JLabel result = null; |
2432 | + label.setBorder(PropertyEditorTable.BORDER_RENDER); |
2433 | if ((net != null) && (value instanceof String)) { |
2434 | - label.setText((String) value); |
2435 | - Node node = net.getNodeByReference((String) value); |
2436 | + label.setText(value.toString()); |
2437 | + Node node = net.getNodeByReference(value.toString()); |
2438 | if (node instanceof SignalTransition) { |
2439 | SignalTransition st = (SignalTransition)node; |
2440 | Color color = getTypeColor(st.getSignalType()); |
2441 | label.setForeground(color); |
2442 | } |
2443 | if (isActive(row, column)) { |
2444 | - label.setBackground(Color.YELLOW); |
2445 | + label.setBackground(table.getSelectionBackground()); |
2446 | } else { |
2447 | - label.setBackground(Color.WHITE); |
2448 | + label.setBackground(table.getBackground()); |
2449 | } |
2450 | result = label; |
2451 | } |
2452 | @@ -161,13 +168,11 @@ |
2453 | public void createInterfacePanel(final GraphEditor editor) { |
2454 | super.createInterfacePanel(editor); |
2455 | stateMap = new HashMap<String, SignalState>(); |
2456 | - |
2457 | stateTable = new JTable(new StateTableModel()); |
2458 | stateTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
2459 | + stateTable.setRowHeight(FontHelper.getFontSizeInPixels(stateTable.getFont())); |
2460 | stateTable.setDefaultRenderer(Object.class, new StateTableCellRendererImplementation()); |
2461 | - |
2462 | statePane.setViewportView(stateTable); |
2463 | - |
2464 | traceTable.setDefaultRenderer(Object.class, new TraceTableCellRendererImplementation()); |
2465 | } |
2466 | |
2467 | @@ -240,8 +245,9 @@ |
2468 | public void activated(final GraphEditor editor) { |
2469 | super.activated(editor); |
2470 | initialiseStateMap(); |
2471 | + setStatePaneVisibility(true); |
2472 | } |
2473 | - |
2474 | + |
2475 | public String getTraceLabelByReference(String ref) { |
2476 | String result = null; |
2477 | if (ref != null) { |
2478 | |
2479 | === modified file 'WorkcraftCore/src/org/workcraft/dom/hierarchy/NamespaceHelper.java' |
2480 | --- WorkcraftCore/src/org/workcraft/dom/hierarchy/NamespaceHelper.java 2015-05-14 18:00:15 +0000 |
2481 | +++ WorkcraftCore/src/org/workcraft/dom/hierarchy/NamespaceHelper.java 2015-06-26 22:23:53 +0000 |
2482 | @@ -45,7 +45,7 @@ |
2483 | |
2484 | String head = getReferenceHead(reference); |
2485 | String tail = getReferenceTail(reference); |
2486 | - if (tail.equals("")) { |
2487 | + if (tail.isEmpty()) { |
2488 | return ret+head; |
2489 | } |
2490 | return ret + head + hierarchicalToFlatName(tail, flatSeparator, false); |
2491 | @@ -63,7 +63,7 @@ |
2492 | } |
2493 | |
2494 | public static void splitReference(String reference, LinkedList<String> path) { |
2495 | - if (reference.equals("")) return; |
2496 | + if (reference.isEmpty()) return; |
2497 | |
2498 | Matcher matcher = hPattern.matcher(reference); |
2499 | if (matcher.find()) { |
2500 | @@ -127,7 +127,7 @@ |
2501 | public static String getReferenceName(String reference) { |
2502 | String head = getReferenceHead(reference); |
2503 | String tail = getReferenceTail(reference); |
2504 | - if (tail.equals("")) { |
2505 | + if (tail.isEmpty()) { |
2506 | return head; |
2507 | } |
2508 | return getReferenceName(tail); |
2509 | |
2510 | === modified file 'WorkcraftCore/src/org/workcraft/dom/references/HierarchicalUniqueNameReferenceManager.java' |
2511 | --- WorkcraftCore/src/org/workcraft/dom/references/HierarchicalUniqueNameReferenceManager.java 2015-05-14 18:00:15 +0000 |
2512 | +++ WorkcraftCore/src/org/workcraft/dom/references/HierarchicalUniqueNameReferenceManager.java 2015-06-26 22:23:53 +0000 |
2513 | @@ -136,7 +136,7 @@ |
2514 | if (provider==null) { |
2515 | provider = topProvider; |
2516 | } |
2517 | - if (reference.equals("") || reference.equals(NamespaceHelper.hierarchySeparator)) { |
2518 | + if (reference.isEmpty() || reference.equals(NamespaceHelper.hierarchySeparator)) { |
2519 | return provider; |
2520 | } |
2521 | String head = NamespaceHelper.getReferenceHead(reference); |
2522 | @@ -163,7 +163,7 @@ |
2523 | do { |
2524 | component = getNamespaceProvider(node); |
2525 | if (component != null) { |
2526 | - if (!result.equals("")) { |
2527 | + if (!result.isEmpty()) { |
2528 | result = NamespaceHelper.hierarchySeparator + result; |
2529 | } |
2530 | String name = getNameManager(component).getName(node); |
2531 | |
2532 | === added file 'WorkcraftCore/src/org/workcraft/dom/visual/FontHelper.java' |
2533 | --- WorkcraftCore/src/org/workcraft/dom/visual/FontHelper.java 1970-01-01 00:00:00 +0000 |
2534 | +++ WorkcraftCore/src/org/workcraft/dom/visual/FontHelper.java 2015-06-26 22:23:53 +0000 |
2535 | @@ -0,0 +1,13 @@ |
2536 | +package org.workcraft.dom.visual; |
2537 | + |
2538 | +import java.awt.Font; |
2539 | +import java.awt.Toolkit; |
2540 | + |
2541 | +public class FontHelper { |
2542 | + |
2543 | + public static int getFontSizeInPixels(Font font) { |
2544 | + int screenDpi = Toolkit.getDefaultToolkit().getScreenResolution(); |
2545 | + return (int)Math.round(font.getSize2D() * screenDpi / 72.0); |
2546 | + } |
2547 | + |
2548 | +} |
2549 | |
2550 | === modified file 'WorkcraftCore/src/org/workcraft/dom/visual/VisualComponent.java' |
2551 | --- WorkcraftCore/src/org/workcraft/dom/visual/VisualComponent.java 2015-02-27 18:31:36 +0000 |
2552 | +++ WorkcraftCore/src/org/workcraft/dom/visual/VisualComponent.java 2015-06-26 22:23:53 +0000 |
2553 | @@ -43,6 +43,14 @@ |
2554 | import org.workcraft.plugins.shared.CommonVisualSettings; |
2555 | |
2556 | public abstract class VisualComponent extends VisualTransformableNode implements Drawable, DependentNode { |
2557 | + public static final String PROPERTY_LABEL = "Label"; |
2558 | + public static final String PROPERTY_LABEL_POSITIONING = "Label positioning"; |
2559 | + public static final String PROPERTY_LABEL_COLOR = "Label color"; |
2560 | + public static final String PROPERTY_NAME_POSITIONING = "Name positioning"; |
2561 | + public static final String PROPERTY_NAME_COLOR = "Name color"; |
2562 | + public static final String PROPERTY_FOREGROUND_COLOR = "Foreground color"; |
2563 | + public static final String PROPERTY_FILL_COLOR = "Fill color"; |
2564 | + |
2565 | public static final Font labelFont = new Font("Sans-serif", Font.PLAIN, 1).deriveFont(0.5f); |
2566 | public static final Font nameFont = new Font("Sans-serif", Font.ITALIC, 1).deriveFont(0.5f); |
2567 | |
2568 | @@ -90,7 +98,7 @@ |
2569 | |
2570 | private void addColorPropertyDeclarations() { |
2571 | addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Color>( |
2572 | - this, "Foreground color", Color.class) { |
2573 | + this, PROPERTY_FOREGROUND_COLOR, Color.class) { |
2574 | protected void setter(VisualComponent object, Color value) { |
2575 | object.setForegroundColor(value); |
2576 | } |
2577 | @@ -100,7 +108,7 @@ |
2578 | }); |
2579 | |
2580 | addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Color>( |
2581 | - this, "Fill color", Color.class) { |
2582 | + this, PROPERTY_FILL_COLOR, Color.class) { |
2583 | protected void setter(VisualComponent object, Color value) { |
2584 | object.setFillColor(value); |
2585 | } |
2586 | @@ -112,7 +120,7 @@ |
2587 | |
2588 | private void addLabelPropertyDeclarations() { |
2589 | addPropertyDeclaration(new PropertyDeclaration<VisualComponent, String>( |
2590 | - this, "Label", String.class) { |
2591 | + this, PROPERTY_LABEL, String.class) { |
2592 | protected void setter(VisualComponent object, String value) { |
2593 | object.setLabel(value); |
2594 | } |
2595 | @@ -122,7 +130,7 @@ |
2596 | }); |
2597 | |
2598 | addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Positioning>( |
2599 | - this, "Label positioning", Positioning.class) { |
2600 | + this, PROPERTY_LABEL_POSITIONING, Positioning.class) { |
2601 | protected void setter(VisualComponent object, Positioning value) { |
2602 | object.setLabelPositioning(value); |
2603 | } |
2604 | @@ -132,7 +140,7 @@ |
2605 | }); |
2606 | |
2607 | addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Color>( |
2608 | - this, "Label color", Color.class) { |
2609 | + this, PROPERTY_LABEL_COLOR, Color.class) { |
2610 | protected void setter(VisualComponent object, Color value) { |
2611 | object.setLabelColor(value); |
2612 | } |
2613 | @@ -144,7 +152,7 @@ |
2614 | |
2615 | private void addNamePropertyDeclarations() { |
2616 | addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Positioning>( |
2617 | - this, "Name positioning", Positioning.class) { |
2618 | + this, PROPERTY_NAME_POSITIONING, Positioning.class) { |
2619 | protected void setter(VisualComponent object, Positioning value) { |
2620 | object.setNamePositioning(value); |
2621 | } |
2622 | @@ -154,7 +162,7 @@ |
2623 | }); |
2624 | |
2625 | addPropertyDeclaration(new PropertyDeclaration<VisualComponent, Color>( |
2626 | - this, "Name color", Color.class) { |
2627 | + this, PROPERTY_NAME_COLOR, Color.class) { |
2628 | protected void setter(VisualComponent object, Color value) { |
2629 | object.setNameColor(value); |
2630 | } |
2631 | @@ -170,7 +178,7 @@ |
2632 | |
2633 | public void setLabel(String label) { |
2634 | this.label = label; |
2635 | - sendNotification(new PropertyChangedEvent(this, "label")); |
2636 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_LABEL)); |
2637 | } |
2638 | |
2639 | public Positioning getLabelPositioning() { |
2640 | @@ -179,7 +187,7 @@ |
2641 | |
2642 | public void setLabelPositioning(Positioning value) { |
2643 | labelPositioning = value; |
2644 | - sendNotification(new PropertyChangedEvent(this, "label positioning")); |
2645 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_LABEL_POSITIONING)); |
2646 | } |
2647 | |
2648 | public Color getLabelColor() { |
2649 | @@ -188,7 +196,7 @@ |
2650 | |
2651 | public void setLabelColor(Color value) { |
2652 | labelColor = value; |
2653 | - sendNotification(new PropertyChangedEvent(this, "label color")); |
2654 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_LABEL_COLOR)); |
2655 | } |
2656 | |
2657 | public Positioning getNamePositioning() { |
2658 | @@ -197,7 +205,7 @@ |
2659 | |
2660 | public void setNamePositioning(Positioning value) { |
2661 | namePositioning = value; |
2662 | - sendNotification(new PropertyChangedEvent(this, "reference positioning")); |
2663 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_NAME_POSITIONING)); |
2664 | } |
2665 | |
2666 | public Color getNameColor() { |
2667 | @@ -206,7 +214,7 @@ |
2668 | |
2669 | public void setNameColor(Color value) { |
2670 | nameColor = value; |
2671 | - sendNotification(new PropertyChangedEvent(this, "reference color")); |
2672 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_NAME_COLOR)); |
2673 | } |
2674 | |
2675 | public Color getForegroundColor() { |
2676 | @@ -215,7 +223,7 @@ |
2677 | |
2678 | public void setForegroundColor(Color value) { |
2679 | foregroundColor = value; |
2680 | - sendNotification(new PropertyChangedEvent(this, "foreground color")); |
2681 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_FOREGROUND_COLOR)); |
2682 | } |
2683 | |
2684 | public Color getFillColor() { |
2685 | @@ -224,7 +232,7 @@ |
2686 | |
2687 | public void setFillColor(Color value) { |
2688 | fillColor = value; |
2689 | - sendNotification(new PropertyChangedEvent(this, "fill color")); |
2690 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_FILL_COLOR)); |
2691 | } |
2692 | |
2693 | public MathNode getReferencedComponent() { |
2694 | |
2695 | === modified file 'WorkcraftCore/src/org/workcraft/dom/visual/VisualGroup.java' |
2696 | --- WorkcraftCore/src/org/workcraft/dom/visual/VisualGroup.java 2015-06-03 16:22:58 +0000 |
2697 | +++ WorkcraftCore/src/org/workcraft/dom/visual/VisualGroup.java 2015-06-26 22:23:53 +0000 |
2698 | @@ -48,9 +48,7 @@ |
2699 | |
2700 | |
2701 | public class VisualGroup extends VisualTransformableNode implements Drawable, Collapsible, Container, ObservableHierarchy { |
2702 | - public static final int HIT_COMPONENT = 1; |
2703 | - public static final int HIT_CONNECTION = 2; |
2704 | - public static final int HIT_GROUP = 3; |
2705 | + public static final String PROPERTY_IS_COLLAPSED = "Is collapsed"; |
2706 | |
2707 | protected double size = CommonVisualSettings.getBaseSize(); |
2708 | protected final double margin = 0.20; |
2709 | @@ -67,7 +65,7 @@ |
2710 | |
2711 | private void addPropertyDeclarations() { |
2712 | addPropertyDeclaration(new PropertyDeclaration<VisualGroup, Boolean>( |
2713 | - this, "Is collapsed", Boolean.class) { |
2714 | + this, PROPERTY_IS_COLLAPSED, Boolean.class) { |
2715 | |
2716 | @Override |
2717 | protected void setter(VisualGroup object, Boolean value) { |
2718 | |
2719 | === modified file 'WorkcraftCore/src/org/workcraft/dom/visual/VisualPage.java' |
2720 | --- WorkcraftCore/src/org/workcraft/dom/visual/VisualPage.java 2015-05-22 17:42:39 +0000 |
2721 | +++ WorkcraftCore/src/org/workcraft/dom/visual/VisualPage.java 2015-06-26 22:23:53 +0000 |
2722 | @@ -30,6 +30,9 @@ |
2723 | @DisplayName("Page") |
2724 | @SVGIcon("images/icons/svg/selection-page.svg") |
2725 | public class VisualPage extends VisualComponent implements Drawable, Collapsible, Container, ObservableHierarchy { |
2726 | + public static final String PROPERTY_IS_COLLAPSED = "Is collapsed"; |
2727 | + public static final String PROPERTY_REFERENCED_MODEL = "Referenced model"; |
2728 | + |
2729 | private boolean isCurrentLevelInside = false; |
2730 | private boolean isCollapsed = false; |
2731 | private boolean isExcited = false; |
2732 | @@ -56,7 +59,7 @@ |
2733 | |
2734 | private void addPropertyDeclarations() { |
2735 | addPropertyDeclaration(new PropertyDeclaration<VisualPage, Boolean>( |
2736 | - this, "Is collapsed", Boolean.class) { |
2737 | + this, PROPERTY_IS_COLLAPSED, Boolean.class) { |
2738 | |
2739 | @Override |
2740 | protected void setter(VisualPage object, Boolean value) { |
2741 | @@ -69,7 +72,7 @@ |
2742 | }); |
2743 | |
2744 | addPropertyDeclaration(new PropertyDeclaration<VisualPage, String>( |
2745 | - this, "Referenced model", String.class) { |
2746 | + this, PROPERTY_REFERENCED_MODEL, String.class) { |
2747 | |
2748 | @Override |
2749 | protected void setter(VisualPage object, String value) { |
2750 | |
2751 | === modified file 'WorkcraftCore/src/org/workcraft/dom/visual/connections/VisualConnection.java' |
2752 | --- WorkcraftCore/src/org/workcraft/dom/visual/connections/VisualConnection.java 2015-04-13 18:41:37 +0000 |
2753 | +++ WorkcraftCore/src/org/workcraft/dom/visual/connections/VisualConnection.java 2015-06-26 22:23:53 +0000 |
2754 | @@ -61,6 +61,13 @@ |
2755 | public class VisualConnection extends VisualNode implements Node, Drawable, Shapable, DependentNode, |
2756 | Connection, VisualConnectionProperties, ObservableHierarchy { |
2757 | |
2758 | + public static final String PROPERTY_CONNECTION_TYPE = "Connection type"; |
2759 | + public static final String PROPERTY_COLOR = "Color"; |
2760 | + public static final String PROPERTY_LINE_WIDTH = "Line width"; |
2761 | + public static final String PROPERTY_ARROW_LENGTH = "Arrow length"; |
2762 | + public static final String PROPERTY_ARROW_WIDTH = "Arrow width"; |
2763 | + public static final String PROPERTY_SCALE_MODE = "Scale mode"; |
2764 | + |
2765 | public enum ConnectionType { |
2766 | POLYLINE("Polyline"), |
2767 | BEZIER("Bezier"); |
2768 | @@ -151,7 +158,7 @@ |
2769 | |
2770 | private void addPropertyDeclarations() { |
2771 | addPropertyDeclaration(new PropertyDeclaration<VisualConnection, Double>( |
2772 | - this, "Line width", Double.class, true, true, true) { |
2773 | + this, PROPERTY_LINE_WIDTH, Double.class, true, true, true) { |
2774 | @Override |
2775 | public void setter(VisualConnection object, Double value) { |
2776 | object.setLineWidth(value); |
2777 | @@ -163,7 +170,7 @@ |
2778 | }); |
2779 | |
2780 | addPropertyDeclaration(new PropertyDeclaration<VisualConnection, Double>( |
2781 | - this, "Arrow width", Double.class, true, true, true) { |
2782 | + this, PROPERTY_ARROW_WIDTH, Double.class, true, true, true) { |
2783 | @Override |
2784 | public void setter(VisualConnection object, Double value) { |
2785 | object.setArrowWidth(value); |
2786 | @@ -175,7 +182,7 @@ |
2787 | }); |
2788 | |
2789 | addPropertyDeclaration(new PropertyDeclaration<VisualConnection, Double>( |
2790 | - this, "Arrow length", Double.class, true, true, true) { |
2791 | + this, PROPERTY_ARROW_LENGTH, Double.class, true, true, true) { |
2792 | @Override |
2793 | public void setter(VisualConnection object, Double value) { |
2794 | object.setArrowLength(value); |
2795 | @@ -196,7 +203,7 @@ |
2796 | }); |
2797 | |
2798 | addPropertyDeclaration(new PropertyDeclaration<VisualConnection, ConnectionType>( |
2799 | - this, "Connection type", ConnectionType.class, true, true, false) { |
2800 | + this, PROPERTY_CONNECTION_TYPE, ConnectionType.class, true, true, false) { |
2801 | protected void setter(VisualConnection object, ConnectionType value) { |
2802 | object.setConnectionType(value); |
2803 | for (ControlPoint cp: object.getGraphic().getControlPoints()) { |
2804 | @@ -211,7 +218,7 @@ |
2805 | }); |
2806 | |
2807 | addPropertyDeclaration(new PropertyDeclaration<VisualConnection, ScaleMode>( |
2808 | - this, "Scale mode", ScaleMode.class, true, true, true) { |
2809 | + this, PROPERTY_SCALE_MODE, ScaleMode.class, true, true, true) { |
2810 | protected void setter(VisualConnection object, ScaleMode value) { |
2811 | object.setScaleMode(value); |
2812 | } |
2813 | @@ -221,7 +228,7 @@ |
2814 | }); |
2815 | |
2816 | addPropertyDeclaration(new PropertyDeclaration<VisualConnection, Color>( |
2817 | - this, "Color", Color.class, true, true, true) { |
2818 | + this, PROPERTY_COLOR, Color.class, true, true, true) { |
2819 | protected void setter(VisualConnection object, Color value) { |
2820 | object.setColor(value); |
2821 | } |
2822 | @@ -296,9 +303,9 @@ |
2823 | children.add(graphic); |
2824 | observableHierarchyImpl.sendNotification(new NodesAddedEvent(this, getGraphic())); |
2825 | graphic.invalidate(); |
2826 | - observableStateImpl.sendNotification(new PropertyChangedEvent(this, "connectionType")); |
2827 | + observableStateImpl.sendNotification(new PropertyChangedEvent(this, PROPERTY_CONNECTION_TYPE)); |
2828 | } |
2829 | - sendNotification(new PropertyChangedEvent(this, "connection type")); |
2830 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_CONNECTION_TYPE)); |
2831 | } |
2832 | |
2833 | public Color getColor() { |
2834 | @@ -307,7 +314,7 @@ |
2835 | |
2836 | public void setColor(Color color) { |
2837 | this.color = color; |
2838 | - sendNotification(new PropertyChangedEvent(this, "color")); |
2839 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_COLOR)); |
2840 | } |
2841 | |
2842 | @Override |
2843 | @@ -327,7 +334,7 @@ |
2844 | this.lineWidth = lineWidth; |
2845 | |
2846 | invalidate(); |
2847 | - sendNotification(new PropertyChangedEvent(this, "line width")); |
2848 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_LINE_WIDTH)); |
2849 | } |
2850 | |
2851 | @Override |
2852 | @@ -354,7 +361,7 @@ |
2853 | if (value < 0.0) value = 0.0; |
2854 | this.arrowWidth = value; |
2855 | invalidate(); |
2856 | - sendNotification(new PropertyChangedEvent(this, "arrow width")); |
2857 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_ARROW_WIDTH)); |
2858 | |
2859 | } |
2860 | |
2861 | @@ -369,7 +376,7 @@ |
2862 | if (value < 0.0) value = 0.0; |
2863 | this.arrowLength = value; |
2864 | invalidate(); |
2865 | - sendNotification(new PropertyChangedEvent(this, "arrow length")); |
2866 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_ARROW_LENGTH)); |
2867 | } |
2868 | |
2869 | public void invalidate() { |
2870 | @@ -518,7 +525,7 @@ |
2871 | |
2872 | public void setScaleMode(ScaleMode scaleMode) { |
2873 | this.scaleMode = scaleMode; |
2874 | - sendNotification(new PropertyChangedEvent(this, "scale mode")); |
2875 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_SCALE_MODE)); |
2876 | } |
2877 | |
2878 | @Override |
2879 | |
2880 | === modified file 'WorkcraftCore/src/org/workcraft/gui/DockableWindow.java' |
2881 | --- WorkcraftCore/src/org/workcraft/gui/DockableWindow.java 2014-09-05 14:09:00 +0000 |
2882 | +++ WorkcraftCore/src/org/workcraft/gui/DockableWindow.java 2015-06-26 22:23:53 +0000 |
2883 | @@ -134,8 +134,9 @@ |
2884 | for (Object d : port.getDockables()) { |
2885 | DockableWindow dockable = (DockableWindow)d; |
2886 | boolean inTab = dockable.getComponent().getParent() instanceof JTabbedPane; |
2887 | + DockableWindowContentPanel contentPanel = dockable.getContentPanel(); |
2888 | if (inTab && !dockable.isMaximized()) { |
2889 | - dockable.getContentPanel().setHeaderVisible(false); |
2890 | + contentPanel.setHeaderVisible(false); |
2891 | JTabbedPane tabbedPane = (JTabbedPane)dockable.getComponent().getParent(); |
2892 | for (int i=0; i<tabbedPane.getComponentCount(); i++) { |
2893 | if (dockable.getComponent() == tabbedPane.getComponentAt(i)) { |
2894 | @@ -144,17 +145,24 @@ |
2895 | } |
2896 | } |
2897 | } else { |
2898 | - dockable.getContentPanel().setHeaderVisible(true); |
2899 | + contentPanel.setHeaderVisible(true); |
2900 | } |
2901 | } |
2902 | } |
2903 | |
2904 | + public void setTitle(String title) { |
2905 | + if ( !getTitle().equals(title) ) { |
2906 | + getContentPanel().setTitle(title); |
2907 | + setTabText(title); |
2908 | + } |
2909 | + } |
2910 | + |
2911 | public String getTitle() { |
2912 | - return panel.getTitle(); |
2913 | + return getContentPanel().getTitle(); |
2914 | } |
2915 | |
2916 | public int getID() { |
2917 | - return panel.getID(); |
2918 | + return getContentPanel().getID(); |
2919 | } |
2920 | |
2921 | private static void processTabEvents(DockingPort port) { |
2922 | |
2923 | === modified file 'WorkcraftCore/src/org/workcraft/gui/DockableWindowContentPanel.java' |
2924 | --- WorkcraftCore/src/org/workcraft/gui/DockableWindowContentPanel.java 2014-12-12 18:43:40 +0000 |
2925 | +++ WorkcraftCore/src/org/workcraft/gui/DockableWindowContentPanel.java 2015-06-26 22:23:53 +0000 |
2926 | @@ -33,6 +33,7 @@ |
2927 | import javax.swing.JLabel; |
2928 | import javax.swing.JPanel; |
2929 | import javax.swing.UIManager; |
2930 | +import javax.swing.border.Border; |
2931 | |
2932 | import org.workcraft.Framework; |
2933 | import org.workcraft.exceptions.NotSupportedException; |
2934 | @@ -83,6 +84,7 @@ |
2935 | } |
2936 | |
2937 | class DockableViewHeader extends JPanel { |
2938 | + private final Border BORDER_TITLE = BorderFactory.createEmptyBorder(1, 3, 1, 1); |
2939 | private ActionButton btnMin, btnMax, btnClose; |
2940 | private JLabel titleLabel = null; |
2941 | private JPanel buttonPanel = null; |
2942 | @@ -148,10 +150,11 @@ |
2943 | buttonPanel.setPreferredSize(new Dimension((UIManager.getIcon("InternalFrame.closeIcon").getIconWidth()+4) * icons,UIManager.getIcon("InternalFrame.closeIcon").getIconHeight()+4)); |
2944 | } |
2945 | |
2946 | - titleLabel = new JLabel(" "+ title); |
2947 | + titleLabel = new JLabel(title); |
2948 | titleLabel.setOpaque(false); |
2949 | titleLabel.setForeground(UIManager.getColor("InternalFrame.activeTitleForeground")); |
2950 | titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD)); |
2951 | + titleLabel.setBorder(BORDER_TITLE); |
2952 | add(titleLabel, BorderLayout.WEST); |
2953 | |
2954 | setMaximized(false); |
2955 | @@ -177,6 +180,7 @@ |
2956 | |
2957 | public void setTitle(String title) { |
2958 | titleLabel.setText(title); |
2959 | + titleLabel.repaint(); |
2960 | } |
2961 | } |
2962 | |
2963 | |
2964 | === renamed file 'WorkcraftCore/src/org/workcraft/gui/LAF.java' => 'WorkcraftCore/src/org/workcraft/gui/LookAndFeelHelper.java' |
2965 | --- WorkcraftCore/src/org/workcraft/gui/LAF.java 2009-09-22 21:01:45 +0000 |
2966 | +++ WorkcraftCore/src/org/workcraft/gui/LookAndFeelHelper.java 2015-06-26 22:23:53 +0000 |
2967 | @@ -21,23 +21,40 @@ |
2968 | |
2969 | package org.workcraft.gui; |
2970 | |
2971 | -import javax.swing.UIManager; |
2972 | -import javax.swing.UnsupportedLookAndFeelException; |
2973 | - |
2974 | -import org.jvnet.substance.SubstanceLookAndFeel; |
2975 | -import org.jvnet.substance.api.SubstanceConstants.TabContentPaneBorderKind; |
2976 | - |
2977 | - |
2978 | -public class LAF { |
2979 | - public static String currentLAF = UIManager.getLookAndFeel().getClass().getName(); |
2980 | - |
2981 | - public static String getCurrentLAF() { |
2982 | - return currentLAF; |
2983 | - } |
2984 | - |
2985 | - public static void setLAF(String LAF) { |
2986 | - try { |
2987 | - UIManager.setLookAndFeel(LAF); |
2988 | +import java.util.Collections; |
2989 | +import java.util.LinkedHashMap; |
2990 | +import java.util.Map; |
2991 | + |
2992 | +import javax.swing.UIManager; |
2993 | +import javax.swing.UnsupportedLookAndFeelException; |
2994 | + |
2995 | +import org.jvnet.substance.SubstanceLookAndFeel; |
2996 | +import org.jvnet.substance.api.SubstanceConstants.TabContentPaneBorderKind; |
2997 | + |
2998 | +public class LookAndFeelHelper { |
2999 | + |
3000 | + private static Map<String, String> lafMap; |
3001 | + |
3002 | + public static Map<String, String> getLafMap() { |
3003 | + if (lafMap == null) { |
3004 | + lafMap = new LinkedHashMap<>(); |
3005 | + lafMap.put("Metal (default)", "javax.swing.plaf.metal.MetalLookAndFeel"); |
3006 | + lafMap.put("Windows", "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); |
3007 | + lafMap.put("Substance: Moderate", "org.jvnet.substance.skin.SubstanceModerateLookAndFeel"); |
3008 | + lafMap.put("Substance: Mist Silver", "org.jvnet.substance.skin.SubstanceMistSilverLookAndFeel"); |
3009 | + lafMap.put("Substance: Raven", "org.jvnet.substance.skin.SubstanceRavenLookAndFeel"); |
3010 | + lafMap.put("Substance: Business", "org.jvnet.substance.skin.SubstanceBusinessLookAndFeel"); |
3011 | + lafMap.put("Substance: Creme", "org.jvnet.substance.skin.SubstanceCremeCoffeeLookAndFeel"); |
3012 | + } |
3013 | + return Collections.unmodifiableMap(lafMap); |
3014 | + } |
3015 | + |
3016 | + public static void setLookAndFeel(String laf) { |
3017 | + if (laf == null) { |
3018 | + laf = UIManager.getSystemLookAndFeelClassName(); |
3019 | + } |
3020 | + try { |
3021 | + UIManager.setLookAndFeel(laf); |
3022 | } catch (ClassNotFoundException e) { |
3023 | e.printStackTrace(); |
3024 | } catch (InstantiationException e) { |
3025 | @@ -47,16 +64,10 @@ |
3026 | } catch (UnsupportedLookAndFeelException e) { |
3027 | e.printStackTrace(); |
3028 | } |
3029 | - |
3030 | - currentLAF = LAF; |
3031 | - } |
3032 | - |
3033 | - public static void setDefaultLAF() { |
3034 | - setLAF(UIManager.getCrossPlatformLookAndFeelClassName()); |
3035 | - } |
3036 | - |
3037 | - public static void setSubstanceLAF(String LAF) { |
3038 | - setLAF(LAF); |
3039 | + } |
3040 | + |
3041 | + public static void setSubstance(String laf) { |
3042 | + setLookAndFeel(laf); |
3043 | UIManager.put(SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND, TabContentPaneBorderKind.SINGLE_FULL); |
3044 | } |
3045 | } |
3046 | |
3047 | === modified file 'WorkcraftCore/src/org/workcraft/gui/MainMenu.java' |
3048 | --- WorkcraftCore/src/org/workcraft/gui/MainMenu.java 2015-02-11 10:58:21 +0000 |
3049 | +++ WorkcraftCore/src/org/workcraft/gui/MainMenu.java 2015-06-26 22:23:53 +0000 |
3050 | @@ -29,6 +29,7 @@ |
3051 | import java.util.Collection; |
3052 | import java.util.Collections; |
3053 | import java.util.HashMap; |
3054 | +import java.util.LinkedList; |
3055 | import java.util.List; |
3056 | |
3057 | import javax.swing.JLabel; |
3058 | @@ -119,34 +120,15 @@ |
3059 | final private JMenu mnExport = new JMenu("Export"); |
3060 | final private JMenu mnRecent = new JMenu("Open recent"); |
3061 | final private JMenu mnWindows = new JMenu("Windows"); |
3062 | - final private JMenu mnTools = new JMenu("Tools"); |
3063 | - final private HashMap <Integer, ActionCheckBoxMenuItem> windowItems = new HashMap<Integer, ActionCheckBoxMenuItem>(); |
3064 | + final private HashMap <Integer, ActionCheckBoxMenuItem> windowItems = new HashMap<Integer, ActionCheckBoxMenuItem>(); |
3065 | + final private LinkedList<JMenu> mnToolsList = new LinkedList<>(); |
3066 | + final private JMenu mnHelp = new JMenu("Help"); |
3067 | |
3068 | - private String[] lafCaptions = new String[] { |
3069 | - "Java default", |
3070 | - "Windows", |
3071 | - "Substance: Moderate", |
3072 | - "Substance: Mist Silver", |
3073 | - "Substance: Raven", |
3074 | - "Substance: Business", |
3075 | - "Substance: Creme" |
3076 | - }; |
3077 | - private String[] lafClasses = new String[] { |
3078 | - "javax.swing.plaf.metal.MetalLookAndFeel", |
3079 | - "com.sun.java.swing.plaf.windows.WindowsLookAndFeel", |
3080 | - "org.jvnet.substance.skin.SubstanceModerateLookAndFeel", |
3081 | - "org.jvnet.substance.skin.SubstanceMistSilverLookAndFeel", |
3082 | - "org.jvnet.substance.skin.SubstanceRavenLookAndFeel", |
3083 | - "org.jvnet.substance.skin.SubstanceBusinessLookAndFeel", |
3084 | - "org.jvnet.substance.skin.SubstanceCremeCoffeeLookAndFeel" |
3085 | - }; |
3086 | - |
3087 | MainMenu(final MainWindow mainWindow) { |
3088 | this.mainWindow = mainWindow; |
3089 | addFileMenu(mainWindow); |
3090 | addEditMenu(mainWindow); |
3091 | addViewMenu(mainWindow); |
3092 | - add(mnTools); |
3093 | addHelpMenu(mainWindow); |
3094 | } |
3095 | |
3096 | @@ -225,7 +207,7 @@ |
3097 | mnFile.add(miImport); |
3098 | mnFile.add(mnExport); |
3099 | |
3100 | - // FIXME: Workspace functionality is not working yet. |
3101 | +// FIXME: Workspace functionality is not working yet. |
3102 | // mnFile.addSeparator(); |
3103 | // mnFile.add(miNewWorkspace); |
3104 | // mnFile.add(miOpenWorkspace); |
3105 | @@ -362,29 +344,28 @@ |
3106 | miPanCenter.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.CTRL_MASK)); |
3107 | miPanCenter.addScriptedActionListener(mainWindow.getDefaultActionListener()); |
3108 | |
3109 | - JMenu mnLAF = new JMenu("Look and Feel"); |
3110 | - for (int i = 0; i < lafClasses.length; i++) { |
3111 | - JMenuItem miLAFItem = new JMenuItem(); |
3112 | - miLAFItem.setText(lafCaptions[i]); |
3113 | - final String lafClass = lafClasses[i]; |
3114 | - miLAFItem.addActionListener(new ActionListener() { |
3115 | - public void actionPerformed(ActionEvent e) { |
3116 | - try { |
3117 | - mainWindow.setLAF(lafClass); |
3118 | - } catch (OperationCancelledException e1) { |
3119 | - } |
3120 | - } |
3121 | - }); |
3122 | - mnLAF.add(miLAFItem); |
3123 | - } |
3124 | - |
3125 | - /* ScriptedActionMenuItem miSaveLayout = new ScriptedActionMenuItem(MainWindow.Actions.SAVE_UI_LAYOUT); |
3126 | - miSaveLayout.addScriptedActionListener(mainWindow.getDefaultActionListener()); |
3127 | - mnView.add(miSaveLayout); |
3128 | - |
3129 | - ScriptedActionMenuItem miLoadLayout = new ScriptedActionMenuItem(MainWindow.Actions.LOAD_UI_LAYOUT); |
3130 | - miLoadLayout.addScriptedActionListener(mainWindow.getDefaultActionListener()); |
3131 | - mnView.add(miLoadLayout);*/ |
3132 | +// FIXME: Only the default Look and Feel works good, the others cause some problems. |
3133 | +// JMenu mnLookAndFeel = new JMenu("Look and Feel"); |
3134 | +// for (final Entry<String, String> laf: LookAndFeelHelper.getLafMap().entrySet()) { |
3135 | +// JMenuItem miLAFItem = new JMenuItem(); |
3136 | +// miLAFItem.setText(laf.getKey()); |
3137 | +// miLAFItem.addActionListener(new ActionListener() { |
3138 | +// public void actionPerformed(ActionEvent e) { |
3139 | +// try { |
3140 | +// mainWindow.setLookAndFeel(laf.getValue()); |
3141 | +// } catch (OperationCancelledException e1) { |
3142 | +// } |
3143 | +// } |
3144 | +// }); |
3145 | +// mnLookAndFeel.add(miLAFItem); |
3146 | +// } |
3147 | + |
3148 | +// FIXME: Save-load of the layout is not functional yet. |
3149 | +// ScriptedActionMenuItem miSaveLayout = new ScriptedActionMenuItem(MainWindow.Actions.SAVE_UI_LAYOUT); |
3150 | +// miSaveLayout.addScriptedActionListener(mainWindow.getDefaultActionListener()); |
3151 | +// |
3152 | +// ScriptedActionMenuItem miLoadLayout = new ScriptedActionMenuItem(MainWindow.Actions.LOAD_UI_LAYOUT); |
3153 | +// miLoadLayout.addScriptedActionListener(mainWindow.getDefaultActionListener()); |
3154 | |
3155 | ActionMenuItem miResetLayout = new ActionMenuItem(MainWindowActions.RESET_GUI_ACTION); |
3156 | miResetLayout.addScriptedActionListener(mainWindow.getDefaultActionListener()); |
3157 | @@ -401,15 +382,17 @@ |
3158 | mnView.add(miPanDown); |
3159 | mnView.addSeparator(); |
3160 | mnView.add(mnWindows); |
3161 | - mnView.add(mnLAF); |
3162 | +// mnView.add(mnLookAndFeel); |
3163 | +// mnView.addSeparator(); |
3164 | mnView.add(miResetLayout); |
3165 | - |
3166 | +// mnView.add(miSaveLayout); |
3167 | +// mnView.add(miLoadLayout); |
3168 | |
3169 | add(mnView); |
3170 | } |
3171 | |
3172 | private void addHelpMenu(final MainWindow mainWindow) { |
3173 | - JMenu mnHelp = new JMenu(); |
3174 | + //JMenu mnHelp = new JMenu(); |
3175 | mnHelp.setText("Help"); |
3176 | |
3177 | ActionMenuItem miOverview = new ActionMenuItem(MainWindowActions.HELP_OVERVIEW_ACTION); |
3178 | @@ -439,16 +422,11 @@ |
3179 | mnHelp.add(miQuestion); |
3180 | mnHelp.addSeparator(); |
3181 | mnHelp.add(miAbout); |
3182 | - |
3183 | + |
3184 | + //add(Box.createHorizontalGlue()); |
3185 | add(mnHelp); |
3186 | } |
3187 | |
3188 | - final public void setMenuForWorkspaceEntry(final WorkspaceEntry we) { |
3189 | - we.updateActionState(); |
3190 | - setToolsMenu(we); |
3191 | - setExportMenu(we); |
3192 | - } |
3193 | - |
3194 | private void setExportMenu(final WorkspaceEntry we) { |
3195 | mnExport.removeAll(); |
3196 | mnExport.setEnabled(false); |
3197 | @@ -481,36 +459,19 @@ |
3198 | haveNonVisual = true; |
3199 | } |
3200 | } |
3201 | - } |
3202 | - |
3203 | - private void setToolsMenu(final WorkspaceEntry we) { |
3204 | - mnTools.setVisible(true); |
3205 | - mnTools.removeAll(); |
3206 | - |
3207 | - ListMap<String, Pair<String, Tool>> tools = Tools.getTools(we); |
3208 | - List<String> sections = Tools.getSections(tools); |
3209 | - |
3210 | - for (String section : sections) { |
3211 | - JMenu target = mnTools; |
3212 | - if (!section.isEmpty()) { |
3213 | - JMenu sectionMenu = new JMenu (section); |
3214 | - mnTools.add(sectionMenu); |
3215 | - target = sectionMenu; |
3216 | - } |
3217 | - for (Pair<String, Tool> tool : Tools.getSectionTools(section, tools)) { |
3218 | - ActionMenuItem miTool = new ActionMenuItem(new ToolAction(tool)); |
3219 | - miTool.addScriptedActionListener(mainWindow.getDefaultActionListener()); |
3220 | - target.add(miTool); |
3221 | - } |
3222 | - } |
3223 | - } |
3224 | - |
3225 | - final public void registerUtilityWindow(DockableWindow window) { |
3226 | - ActionCheckBoxMenuItem miWindowItem = new ActionCheckBoxMenuItem(new ToggleWindowAction(window)); |
3227 | - miWindowItem.addScriptedActionListener(mainWindow.getDefaultActionListener()); |
3228 | - miWindowItem.setSelected(!window.isClosed()); |
3229 | - windowItems.put (window.getID(), miWindowItem); |
3230 | - mnWindows.add(miWindowItem); |
3231 | + revalidate(); |
3232 | + } |
3233 | + |
3234 | + public void setExportMenuState(boolean enable) { |
3235 | + mnExport.setEnabled(enable); |
3236 | + } |
3237 | + |
3238 | + final public void registerUtilityWindow(DockableWindow window) { |
3239 | + ActionCheckBoxMenuItem miWindowItem = new ActionCheckBoxMenuItem(new ToggleWindowAction(window)); |
3240 | + miWindowItem.addScriptedActionListener(mainWindow.getDefaultActionListener()); |
3241 | + miWindowItem.setSelected(!window.isClosed()); |
3242 | + windowItems.put(window.getID(), miWindowItem); |
3243 | + mnWindows.add(miWindowItem); |
3244 | } |
3245 | |
3246 | final public void setRecentMenu(ArrayList<String> entries) { |
3247 | @@ -547,35 +508,76 @@ |
3248 | } |
3249 | }); |
3250 | mnRecent.add(miClear); |
3251 | - } |
3252 | - |
3253 | - final public void utilityWindowClosed (int ID) { |
3254 | - ActionCheckBoxMenuItem mi = windowItems.get(ID); |
3255 | - if (mi!=null) |
3256 | - mi.setSelected(false); |
3257 | - } |
3258 | - |
3259 | - final public void utilityWindowDisplayed (int ID) { |
3260 | - ActionCheckBoxMenuItem mi = windowItems.get(ID); |
3261 | - if (mi!=null) |
3262 | - mi.setSelected(true); |
3263 | - } |
3264 | - |
3265 | - public void reset() { |
3266 | - mnTools.setVisible(false); |
3267 | - mnTools.removeAll(); |
3268 | - } |
3269 | - |
3270 | - public JMenu getRecentMenu() { |
3271 | - return mnRecent; |
3272 | - } |
3273 | - |
3274 | - public JMenu getExportMenu() { |
3275 | - return mnExport; |
3276 | - } |
3277 | - |
3278 | - public JMenu getToolsMenu() { |
3279 | - return mnTools; |
3280 | + } |
3281 | + |
3282 | + final public void utilityWindowClosed (int ID) { |
3283 | + ActionCheckBoxMenuItem mi = windowItems.get(ID); |
3284 | + if (mi!=null) |
3285 | + mi.setSelected(false); |
3286 | + } |
3287 | + |
3288 | + final public void utilityWindowDisplayed (int ID) { |
3289 | + ActionCheckBoxMenuItem mi = windowItems.get(ID); |
3290 | + if (mi!=null) |
3291 | + mi.setSelected(true); |
3292 | + } |
3293 | + |
3294 | + private void createToolsMenu(final WorkspaceEntry we) { |
3295 | + removeToolsMenu(); |
3296 | + |
3297 | + ListMap<String, Pair<String, Tool>> tools = Tools.getTools(we); |
3298 | + List<String> sections = Tools.getSections(tools); |
3299 | + |
3300 | + JMenu mnTools = new JMenu("Tools"); |
3301 | + mnToolsList.clear(); |
3302 | + for (String section : sections) { |
3303 | + JMenu mnSection = mnTools; |
3304 | + if (!section.isEmpty()) { |
3305 | + mnSection = new JMenu(section); |
3306 | + boolean promote = section.startsWith("!"); |
3307 | + if (promote) { |
3308 | + mnSection.setText(section.substring(1)); |
3309 | + mnToolsList.add(mnSection); |
3310 | + } else { |
3311 | + mnTools.add(mnSection); |
3312 | + mnToolsList.addFirst(mnTools); |
3313 | + } |
3314 | + } |
3315 | + for (Pair<String, Tool> tool : Tools.getSectionTools(section, tools)) { |
3316 | + ActionMenuItem miTool = new ActionMenuItem(new ToolAction(tool)); |
3317 | + miTool.addScriptedActionListener(mainWindow.getDefaultActionListener()); |
3318 | + mnSection.add(miTool); |
3319 | + } |
3320 | + } |
3321 | + addToolsMenu(); |
3322 | + } |
3323 | + |
3324 | + private void addToolsMenu() { |
3325 | + for (JMenu mnTools: mnToolsList) { |
3326 | + add(mnTools); |
3327 | + } |
3328 | + remove(mnHelp); |
3329 | + add(mnHelp); |
3330 | + revalidate(); |
3331 | + } |
3332 | + |
3333 | + public void removeToolsMenu() { |
3334 | + for (JMenu mnTools: mnToolsList) { |
3335 | + remove(mnTools); |
3336 | + } |
3337 | + revalidate(); |
3338 | + } |
3339 | + |
3340 | + public void updateToolsMenuState(boolean enable) { |
3341 | + for (JMenu mnTool: mnToolsList) { |
3342 | + mnTool.setEnabled(enable); |
3343 | + } |
3344 | + } |
3345 | + |
3346 | + public void setMenuForWorkspaceEntry(final WorkspaceEntry we) { |
3347 | + we.updateActionState(); |
3348 | + createToolsMenu(we); |
3349 | + setExportMenu(we); |
3350 | } |
3351 | |
3352 | } |
3353 | |
3354 | === modified file 'WorkcraftCore/src/org/workcraft/gui/MainWindow.java' |
3355 | --- WorkcraftCore/src/org/workcraft/gui/MainWindow.java 2015-04-28 11:37:35 +0000 |
3356 | +++ WorkcraftCore/src/org/workcraft/gui/MainWindow.java 2015-06-26 22:23:53 +0000 |
3357 | @@ -114,6 +114,16 @@ |
3358 | |
3359 | @SuppressWarnings("serial") |
3360 | public class MainWindow extends JFrame { |
3361 | + public static final String TITLE_OUTPUT = "Output"; |
3362 | + public static final String TITLE_PROBLEMS = "Problems"; |
3363 | + public static final String TITLE_JAVASCRIPT = "Javascript"; |
3364 | + public static final String TITLE_TASKS = "Tasks"; |
3365 | + public static final String TITLE_WORKSPACE = "Workspace"; |
3366 | + public static final String TITLE_PROPERTY_EDITOR = "Property editor"; |
3367 | + public static final String TITLE_TOOL_CONTROLS = "Tool controls"; |
3368 | + public static final String TITLE_EDITOR_TOOLS = "Editor tools"; |
3369 | + public static final String TITLE_PLACEHOLDER = ""; |
3370 | + |
3371 | private static final String UILAYOUT_PATH = "./config/uilayout.xml"; |
3372 | private static final int VIEWPORT_MARGIN = 30; |
3373 | |
3374 | @@ -182,14 +192,13 @@ |
3375 | }); |
3376 | } |
3377 | |
3378 | - public void setLAF(String laf) throws OperationCancelledException { |
3379 | - if (JOptionPane.showConfirmDialog(this, |
3380 | + public void setLookAndFeel(String laf) throws OperationCancelledException { |
3381 | + int dialogResult = JOptionPane.showConfirmDialog(this, |
3382 | "Changing Look and Feel requires GUI restart.\n\n" |
3383 | + "This will cause the visual editor windows to be closed.\n\nProceed?", |
3384 | - "Confirm", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { |
3385 | - if (laf == null) |
3386 | - laf = UIManager.getSystemLookAndFeelClassName(); |
3387 | + "Confirm", JOptionPane.YES_NO_OPTION); |
3388 | |
3389 | + if (dialogResult == JOptionPane.YES_OPTION) { |
3390 | final Framework framework = Framework.getInstance(); |
3391 | framework.setConfigVar("gui.lookandfeel", laf); |
3392 | framework.restartGUI(); |
3393 | @@ -201,9 +210,9 @@ |
3394 | } |
3395 | |
3396 | private DockableWindow createDockableWindow(JComponent component, |
3397 | - String name, Dockable neighbour, int options) { |
3398 | - return createDockableWindow(component, name, neighbour, options, |
3399 | - DockingConstants.CENTER_REGION, name); |
3400 | + String title, Dockable neighbour, int options) { |
3401 | + return createDockableWindow(component, title, neighbour, options, |
3402 | + DockingConstants.CENTER_REGION, title); |
3403 | } |
3404 | |
3405 | private DockableWindow createDockableWindow(JComponent component, |
3406 | @@ -374,10 +383,8 @@ |
3407 | |
3408 | final Framework framework = Framework.getInstance(); |
3409 | String laf = framework.getConfigVar("gui.lookandfeel"); |
3410 | - if (laf == null) { |
3411 | - laf = UIManager.getCrossPlatformLookAndFeelClassName(); |
3412 | - } |
3413 | - LAF.setLAF(laf); |
3414 | + SilverOceanTheme.enable(); |
3415 | + LookAndFeelHelper.setLookAndFeel(laf); |
3416 | SwingUtilities.updateComponentTreeUI(this); |
3417 | |
3418 | content = new JPanel(new BorderLayout(0, 0)); |
3419 | @@ -426,49 +433,49 @@ |
3420 | float xSplit = 0.88f; |
3421 | float ySplit = 0.82f; |
3422 | outputDockable = createDockableWindow( |
3423 | - outputWindow, "Output", |
3424 | + outputWindow, TITLE_OUTPUT, |
3425 | DockableWindowContentPanel.CLOSE_BUTTON, |
3426 | DockingManager.SOUTH_REGION, ySplit); |
3427 | |
3428 | erroDockable = createDockableWindow( |
3429 | - errorWindow, "Problems", outputDockable, |
3430 | + errorWindow, TITLE_PROBLEMS, outputDockable, |
3431 | DockableWindowContentPanel.CLOSE_BUTTON); |
3432 | |
3433 | javaScriptDockable = createDockableWindow( |
3434 | - javaScriptWindow, "Javascript", outputDockable, |
3435 | + javaScriptWindow, TITLE_JAVASCRIPT, outputDockable, |
3436 | + DockableWindowContentPanel.CLOSE_BUTTON); |
3437 | + |
3438 | + tasksDockable = createDockableWindow( |
3439 | + new TaskManagerWindow(), TITLE_TASKS, outputDockable, |
3440 | DockableWindowContentPanel.CLOSE_BUTTON); |
3441 | |
3442 | workspaceDockable = createDockableWindow( |
3443 | - workspaceWindow, "Workspace", |
3444 | + workspaceWindow, TITLE_WORKSPACE, |
3445 | DockableWindowContentPanel.CLOSE_BUTTON, |
3446 | DockingManager.EAST_REGION, xSplit); |
3447 | |
3448 | propertyEditorDockable = createDockableWindow( |
3449 | - propertyEditorWindow, "Property editor", workspaceDockable, |
3450 | + propertyEditorWindow, TITLE_PROPERTY_EDITOR, workspaceDockable, |
3451 | DockableWindowContentPanel.CLOSE_BUTTON, |
3452 | DockingManager.NORTH_REGION, ySplit); |
3453 | |
3454 | toolControlsDockable = createDockableWindow( |
3455 | - editorToolsWindow, "Tool controls", propertyEditorDockable, |
3456 | + editorToolsWindow, TITLE_TOOL_CONTROLS, propertyEditorDockable, |
3457 | DockableWindowContentPanel.CLOSE_BUTTON, |
3458 | DockingManager.SOUTH_REGION, 0.4f); |
3459 | |
3460 | editorToolsDockable = createDockableWindow( |
3461 | - toolControlsWindow, "Editor tools", toolControlsDockable, |
3462 | + toolControlsWindow, TITLE_EDITOR_TOOLS, toolControlsDockable, |
3463 | DockableWindowContentPanel.HEADER | DockableWindowContentPanel.CLOSE_BUTTON, |
3464 | DockingManager.SOUTH_REGION, 0.82f); |
3465 | |
3466 | documentPlaceholder = createDockableWindow( |
3467 | - new DocumentPlaceholder(), "", null, outputDockable, |
3468 | + new DocumentPlaceholder(), TITLE_PLACEHOLDER, null, outputDockable, |
3469 | 0, DockingManager.NORTH_REGION, ySplit, "DocumentPlaceholder"); |
3470 | |
3471 | DockingManager.display(outputDockable); |
3472 | EffectsManager.setPreview(new AlphaPreview(Color.BLACK, Color.GRAY, 0.5f)); |
3473 | |
3474 | - tasksDockable = createDockableWindow( |
3475 | - new TaskManagerWindow(), "Tasks", outputDockable, |
3476 | - DockableWindowContentPanel.CLOSE_BUTTON); |
3477 | - |
3478 | setVisible(true); |
3479 | loadDockingLayout(); |
3480 | |
3481 | @@ -492,7 +499,7 @@ |
3482 | // createGlyphVector is called for the first time |
3483 | Font font = new Font("Sans-serif", Font.PLAIN, 1); |
3484 | font.createGlyphVector(new FontRenderContext( |
3485 | - new AffineTransform(), true, true), ""); |
3486 | + new AffineTransform(), true, true), TITLE_PLACEHOLDER); |
3487 | |
3488 | // force svg rendering classes to load |
3489 | GUI.createIconFromSVG("images/icons/svg/place.svg"); |
3490 | @@ -503,7 +510,7 @@ |
3491 | } |
3492 | |
3493 | private void setWorkActionsEnableness(boolean enable) { |
3494 | - getMainMenu().getExportMenu().setEnabled(enable); |
3495 | + getMainMenu().setExportMenuState(enable); |
3496 | MainWindowActions.MERGE_WORK_ACTION.setEnabled(enable); |
3497 | MainWindowActions.CLOSE_ACTIVE_EDITOR_ACTION.setEnabled(enable); |
3498 | MainWindowActions.CLOSE_ALL_EDITORS_ACTION.setEnabled(enable); |
3499 | @@ -588,8 +595,9 @@ |
3500 | |
3501 | if (editorInFocus == editor) { |
3502 | toolControlsWindow.setContent(null); |
3503 | - mainMenu.reset(); |
3504 | + mainMenu.removeToolsMenu(); |
3505 | editorInFocus = null; |
3506 | + setDockableTitle(getPropertyEditor(), TITLE_PROPERTY_EDITOR); |
3507 | } |
3508 | |
3509 | editorWindows.remove(we, dockableWindow); |
3510 | @@ -841,11 +849,7 @@ |
3511 | |
3512 | toolControlsWindow.setContent(sender.getToolBox()); |
3513 | editorToolsWindow.setContent(sender.getToolBox().getControlPanel()); |
3514 | - |
3515 | mainMenu.setMenuForWorkspaceEntry(editorInFocus.getWorkspaceEntry()); |
3516 | - |
3517 | - mainMenu.revalidate(); |
3518 | - mainMenu.repaint(); |
3519 | sender.updatePropertyView(); |
3520 | |
3521 | framework.deleteJavaScriptProperty("visualModel", framework.getJavaScriptGlobalScope()); |
3522 | @@ -1045,7 +1049,7 @@ |
3523 | JOptionPane.showMessageDialog(this, e.getMessage(), "Model export failed", JOptionPane.ERROR_MESSAGE); |
3524 | } |
3525 | we.setChanged(false); |
3526 | - refreshTitle(we); |
3527 | + refreshWorkspaceEntryTitle(we, true); |
3528 | lastSavePath = we.getFile().getParent(); |
3529 | pushRecentFile(we.getFile().getPath(), true); |
3530 | } |
3531 | @@ -1058,7 +1062,7 @@ |
3532 | } |
3533 | |
3534 | private String getFileNameForCurrentWork() { |
3535 | - String fileName = ""; |
3536 | + String fileName = TITLE_PLACEHOLDER; |
3537 | if (editorInFocus != null) { |
3538 | WorkspaceEntry we = editorInFocus.getWorkspaceEntry(); |
3539 | if (we != null) { |
3540 | @@ -1098,7 +1102,7 @@ |
3541 | throw new RuntimeException("Cannot save workspace entry - it does not have an associated Workcraft model."); |
3542 | } |
3543 | we.setChanged(false); |
3544 | - refreshTitle(we); |
3545 | + refreshWorkspaceEntryTitle(we, true); |
3546 | lastSavePath = we.getFile().getParent(); |
3547 | pushRecentFile(we.getFile().getPath(), true); |
3548 | } catch (SerialisationException e) { |
3549 | @@ -1168,7 +1172,7 @@ |
3550 | } |
3551 | |
3552 | private String getTitle(WorkspaceEntry we, VisualModel model) { |
3553 | - String prefix = (we.isChanged() ? "*" : ""); |
3554 | + String prefix = (we.isChanged() ? "*" : TITLE_PLACEHOLDER); |
3555 | String suffix = null; |
3556 | switch (CommonEditorSettings.getTitleStyle()) { |
3557 | case LONG: |
3558 | @@ -1178,25 +1182,34 @@ |
3559 | suffix = " [" + model.getShortName() + "]"; |
3560 | break; |
3561 | default: |
3562 | - suffix = ""; |
3563 | + suffix = TITLE_PLACEHOLDER; |
3564 | break; |
3565 | } |
3566 | return (prefix + we.getTitle() + suffix); |
3567 | } |
3568 | - |
3569 | - public void refreshTitle(WorkspaceEntry we) { |
3570 | + |
3571 | + public void refreshWorkspaceEntryTitle(WorkspaceEntry we, boolean updateHeaders) { |
3572 | for (DockableWindow w : editorWindows.get(we)) { |
3573 | final GraphEditorPanel editor = getCurrentEditor(); |
3574 | String title = getTitle(we, editor.getModel()); |
3575 | - w.getContentPanel().setTitle(title); |
3576 | - w.setTabText(title); |
3577 | - } |
3578 | - DockableWindow.updateHeaders(rootDockingPort,getDefaultActionListener()); |
3579 | + w.setTitle(title); |
3580 | + } |
3581 | + if (updateHeaders) { |
3582 | + DockableWindow.updateHeaders(rootDockingPort, getDefaultActionListener()); |
3583 | + } |
3584 | } |
3585 | |
3586 | - public void refreshAllTitles() { |
3587 | + public void refreshWorkspaceEntryTitles() { |
3588 | for (WorkspaceEntry we : editorWindows.keySet()) { |
3589 | - refreshTitle(we); |
3590 | + refreshWorkspaceEntryTitle(we, false); |
3591 | + } |
3592 | + DockableWindow.updateHeaders(rootDockingPort, getDefaultActionListener()); |
3593 | + } |
3594 | + |
3595 | + public void setDockableTitle(DockableWindow dockable, String title) { |
3596 | + if (dockable != null) { |
3597 | + dockable.setTitle(title); |
3598 | + DockableWindow.updateHeaders(rootDockingPort, getDefaultActionListener()); |
3599 | } |
3600 | } |
3601 | |
3602 | @@ -1221,7 +1234,8 @@ |
3603 | public void closeActiveEditor() throws OperationCancelledException { |
3604 | for (WorkspaceEntry k : editorWindows.keySet()) { |
3605 | for (DockableWindow w : editorWindows.get(k)) { |
3606 | - if (w.getContentPanel().getContent() == editorInFocus) { |
3607 | + DockableWindowContentPanel contentPanel = w.getContentPanel(); |
3608 | + if ((contentPanel != null) && (contentPanel.getContent() == editorInFocus)) { |
3609 | closeDockableWindow(w); |
3610 | return; |
3611 | } |
3612 | @@ -1323,7 +1337,7 @@ |
3613 | dlg.setModal(true); |
3614 | dlg.setResizable(true); |
3615 | dlg.setVisible(true); |
3616 | - refreshAllTitles(); |
3617 | + refreshWorkspaceEntryTitles(); |
3618 | } |
3619 | |
3620 | public void resetLayout() { |
3621 | |
3622 | === modified file 'WorkcraftCore/src/org/workcraft/gui/MainWindowActions.java' |
3623 | --- WorkcraftCore/src/org/workcraft/gui/MainWindowActions.java 2015-01-26 22:10:33 +0000 |
3624 | +++ WorkcraftCore/src/org/workcraft/gui/MainWindowActions.java 2015-06-26 22:23:53 +0000 |
3625 | @@ -39,7 +39,10 @@ |
3626 | public static final Action SAVE_WORK_ACTION = new Action() { |
3627 | @Override public void run() { |
3628 | final Framework f = Framework.getInstance(); |
3629 | - try { f.getMainWindow().saveWork(); } catch (OperationCancelledException e) { } |
3630 | + try { |
3631 | + f.getMainWindow().saveWork(); |
3632 | + } catch (OperationCancelledException e) { |
3633 | + } |
3634 | } |
3635 | @Override public String getText() { |
3636 | return "Save work"; |
3637 | @@ -48,7 +51,10 @@ |
3638 | public static final Action SAVE_WORK_AS_ACTION = new Action() { |
3639 | @Override public void run() { |
3640 | final Framework f = Framework.getInstance(); |
3641 | - try { f.getMainWindow().saveWorkAs(); } catch (OperationCancelledException e) { } |
3642 | + try { |
3643 | + f.getMainWindow().saveWorkAs(); |
3644 | + } catch (OperationCancelledException e) { |
3645 | + } |
3646 | } |
3647 | public String getText() { |
3648 | return "Save work as..."; |
3649 | @@ -57,7 +63,10 @@ |
3650 | public static final Action CLOSE_ACTIVE_EDITOR_ACTION = new Action() { |
3651 | @Override public void run() { |
3652 | final Framework f = Framework.getInstance(); |
3653 | - try { f.getMainWindow().closeActiveEditor(); } catch (OperationCancelledException e) { } |
3654 | + try { |
3655 | + f.getMainWindow().closeActiveEditor(); |
3656 | + } catch (OperationCancelledException e) { |
3657 | + } |
3658 | } |
3659 | public String getText() { |
3660 | return "Close active work"; |
3661 | @@ -67,7 +76,10 @@ |
3662 | public static final Action CLOSE_ALL_EDITORS_ACTION = new Action() { |
3663 | @Override public void run() { |
3664 | final Framework f = Framework.getInstance(); |
3665 | - try { f.getMainWindow().closeEditorWindows(); } catch (OperationCancelledException e) { } |
3666 | + try { |
3667 | + f.getMainWindow().closeEditorWindows(); |
3668 | + } catch (OperationCancelledException e) { |
3669 | + } |
3670 | } |
3671 | public String getText() { |
3672 | return "Close all works"; |
3673 | |
3674 | === modified file 'WorkcraftCore/src/org/workcraft/gui/PropertyEditorWindow.java' |
3675 | --- WorkcraftCore/src/org/workcraft/gui/PropertyEditorWindow.java 2015-04-14 13:26:34 +0000 |
3676 | +++ WorkcraftCore/src/org/workcraft/gui/PropertyEditorWindow.java 2015-06-26 22:23:53 +0000 |
3677 | @@ -34,7 +34,7 @@ |
3678 | private PropertyEditorTable propertyTable; |
3679 | private JScrollPane scrollProperties; |
3680 | |
3681 | - public PropertyEditorWindow () { |
3682 | + public PropertyEditorWindow() { |
3683 | propertyTable = new PropertyEditorTable(); |
3684 | |
3685 | scrollProperties = new JScrollPane(); |
3686 | @@ -45,19 +45,19 @@ |
3687 | validate(); |
3688 | } |
3689 | |
3690 | - public Properties getObject () { |
3691 | + public Properties getObject() { |
3692 | return propertyTable.getObject(); |
3693 | } |
3694 | |
3695 | - public void setObject (Properties o) { |
3696 | + public void setObject(Properties o) { |
3697 | removeAll(); |
3698 | - propertyTable.setObject(o); |
3699 | + propertyTable.setObject(o); |
3700 | add(scrollProperties, BorderLayout.CENTER); |
3701 | validate(); |
3702 | repaint(); |
3703 | } |
3704 | |
3705 | - public void clearObject () { |
3706 | + public void clearObject() { |
3707 | if (propertyTable.getObject() != null) { |
3708 | removeAll(); |
3709 | propertyTable.clearObject(); |
3710 | |
3711 | === added file 'WorkcraftCore/src/org/workcraft/gui/SilverOceanTheme.java' |
3712 | --- WorkcraftCore/src/org/workcraft/gui/SilverOceanTheme.java 1970-01-01 00:00:00 +0000 |
3713 | +++ WorkcraftCore/src/org/workcraft/gui/SilverOceanTheme.java 2015-06-26 22:23:53 +0000 |
3714 | @@ -0,0 +1,132 @@ |
3715 | +package org.workcraft.gui; |
3716 | + |
3717 | +import java.awt.Font; |
3718 | +import java.awt.Toolkit; |
3719 | +import java.io.Serializable; |
3720 | +import java.util.Arrays; |
3721 | +import java.util.List; |
3722 | + |
3723 | +import javax.swing.BorderFactory; |
3724 | +import javax.swing.UIDefaults; |
3725 | +import javax.swing.plaf.BorderUIResource; |
3726 | +import javax.swing.plaf.ColorUIResource; |
3727 | +import javax.swing.plaf.FontUIResource; |
3728 | +import javax.swing.plaf.metal.MetalLookAndFeel; |
3729 | +import javax.swing.plaf.metal.OceanTheme; |
3730 | + |
3731 | +public class SilverOceanTheme extends OceanTheme { |
3732 | + |
3733 | + private static final double FONT_SIZE = 11.0; |
3734 | + private static final String FONT_NAME = "Verdana"; |
3735 | + |
3736 | + public static void enable() { |
3737 | + MetalLookAndFeel.setCurrentTheme(new SilverOceanTheme()); |
3738 | + } |
3739 | + |
3740 | + @Override |
3741 | + public FontUIResource getControlTextFont() { |
3742 | + int screenDpi = Toolkit.getDefaultToolkit().getScreenResolution(); |
3743 | + int fontSizeInPixels = (int)Math.round(FONT_SIZE * screenDpi / 72.0); |
3744 | + return new FontUIResource(FONT_NAME, Font.PLAIN, fontSizeInPixels); |
3745 | + } |
3746 | + |
3747 | + @Override |
3748 | + public FontUIResource getMenuTextFont() { |
3749 | + return getControlTextFont(); |
3750 | + } |
3751 | + |
3752 | + @Override |
3753 | + public FontUIResource getSubTextFont() { |
3754 | + return getControlTextFont(); |
3755 | + } |
3756 | + |
3757 | + @Override |
3758 | + public FontUIResource getSystemTextFont() { |
3759 | + return getControlTextFont(); |
3760 | + } |
3761 | + |
3762 | + @Override |
3763 | + public FontUIResource getUserTextFont() { |
3764 | + return getControlTextFont(); |
3765 | + } |
3766 | + |
3767 | + @Override |
3768 | + public FontUIResource getWindowTitleFont() { |
3769 | + return new FontUIResource(getControlTextFont().deriveFont(Font.BOLD)); |
3770 | + } |
3771 | + |
3772 | + @Override |
3773 | + protected ColorUIResource getSecondary1() { |
3774 | + return new ColorUIResource(0x999999); |
3775 | + } |
3776 | + |
3777 | + @Override |
3778 | + protected ColorUIResource getSecondary2() { |
3779 | + return new ColorUIResource(0xcccccc); |
3780 | + } |
3781 | + |
3782 | + @Override |
3783 | + protected ColorUIResource getSecondary3() { |
3784 | + return new ColorUIResource(0xeeeeee); |
3785 | + } |
3786 | + |
3787 | + @Override |
3788 | + protected ColorUIResource getPrimary1() { |
3789 | + return new ColorUIResource(0x999999); |
3790 | + } |
3791 | + |
3792 | + @Override |
3793 | + protected ColorUIResource getPrimary2() { |
3794 | + return new ColorUIResource(0xbbccdd); |
3795 | + } |
3796 | + |
3797 | + @Override |
3798 | + protected ColorUIResource getPrimary3() { |
3799 | + return new ColorUIResource(0xbbccdd); |
3800 | + } |
3801 | + |
3802 | + @Override |
3803 | + public void addCustomEntriesToTable(UIDefaults table) { |
3804 | + super.addCustomEntriesToTable(table); |
3805 | + |
3806 | + List<Serializable> buttonGradient = Arrays.asList(1.0, 0.0, getSecondary3(), getSecondary2(), getSecondary2()); |
3807 | + BorderUIResource menuItemBorder = new BorderUIResource(BorderFactory.createEmptyBorder(3, 6, 3, 6)); |
3808 | + |
3809 | + Object[] uiDefaults = { |
3810 | + "Button.gradient", buttonGradient, |
3811 | + "CheckBox.gradient", buttonGradient, |
3812 | + "CheckBoxMenuItem.gradient", buttonGradient, |
3813 | + "InternalFrame.activeTitleGradient", buttonGradient, |
3814 | + "RadioButton.gradient", buttonGradient, |
3815 | + "RadioButtonMenuItem.gradient", buttonGradient, |
3816 | + "ScrollBar.gradient", buttonGradient, |
3817 | + "Slider.focusGradient", buttonGradient, |
3818 | + "Slider.gradient", buttonGradient, |
3819 | + "ToggleButton.gradient", buttonGradient, |
3820 | + |
3821 | + "TabbedPane.selected", getPrimary2(), |
3822 | + "TabbedPane.contentAreaColor", getPrimary2(), |
3823 | + |
3824 | +// "OptionPane.errorIcon", new IconUIResource(ImageLoader.loadIcon("ix")), |
3825 | +// "OptionPane.informationIcon", new IconUIResource(ImageLoader.loadIcon("ii")), |
3826 | +// "OptionPane.questionIcon", new IconUIResource(ImageLoader.loadIcon("iq")), |
3827 | +// "OptionPane.warningIcon", new IconUIResource(ImageLoader.loadIcon("iw")), |
3828 | + |
3829 | + "Menu.border", new BorderUIResource(BorderFactory.createEmptyBorder(3, 2, 3, 2)), |
3830 | + "MenuItem.border", menuItemBorder, |
3831 | + "CheckBoxMenuItem.border", menuItemBorder, |
3832 | + "RadioButtonMenuItem.border", menuItemBorder, |
3833 | + |
3834 | + "ComboBox.background", getWhite(), |
3835 | +// "CheckBox.background", white, |
3836 | +// "OptionPane.background", white, |
3837 | +// "Panel.background", white, |
3838 | +// "Slider.background", white, |
3839 | + |
3840 | +// "TextField.background", new ColorUIResource(0xf4f4f4), |
3841 | + "TextField.border", BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(getPrimary1()), BorderFactory.createEmptyBorder(4, 4, 4, 4)), |
3842 | + }; |
3843 | + table.putDefaults(uiDefaults); |
3844 | + } |
3845 | + |
3846 | +} |
3847 | |
3848 | === modified file 'WorkcraftCore/src/org/workcraft/gui/graph/GraphEditorPanel.java' |
3849 | --- WorkcraftCore/src/org/workcraft/gui/graph/GraphEditorPanel.java 2015-04-23 22:59:53 +0000 |
3850 | +++ WorkcraftCore/src/org/workcraft/gui/graph/GraphEditorPanel.java 2015-06-26 22:23:53 +0000 |
3851 | @@ -38,7 +38,6 @@ |
3852 | import java.awt.event.KeyEvent; |
3853 | import java.awt.geom.AffineTransform; |
3854 | import java.awt.geom.Point2D; |
3855 | -import java.io.OutputStream; |
3856 | import java.lang.reflect.InvocationTargetException; |
3857 | import java.util.ArrayList; |
3858 | import java.util.Collection; |
3859 | @@ -82,7 +81,11 @@ |
3860 | |
3861 | public class GraphEditorPanel extends JPanel implements StateObserver, GraphEditor { |
3862 | |
3863 | - public OutputStream backup; |
3864 | + |
3865 | + public static final String TITLE_SUFFIX_TEMPLATE = "template"; |
3866 | + public static final String TITLE_SUFFIX_MODEL = "model"; |
3867 | + public static final String TITLE_SUFFIX_SINGLE_ELEMENT = "single element"; |
3868 | + public static final String TITLE_SUFFIX_SELECTED_ELEMENTS = " selected elements"; |
3869 | |
3870 | class Resizer implements ComponentListener { |
3871 | |
3872 | @@ -533,8 +536,7 @@ |
3873 | |
3874 | public void updatePropertyView() { |
3875 | ModelProperties properties; |
3876 | - String titlePrefix = "Property editor"; |
3877 | - String titleSuffix = ""; |
3878 | + String titleSuffix = null; |
3879 | VisualNode templateNode = getModel().getTemplateNode(); |
3880 | if (templateNode != null) { |
3881 | properties = getNodeProperties(templateNode); |
3882 | @@ -543,36 +545,35 @@ |
3883 | properties.remove(pd); |
3884 | } |
3885 | } |
3886 | - titlePrefix += " [template]"; |
3887 | + titleSuffix = TITLE_SUFFIX_TEMPLATE; |
3888 | } else { |
3889 | Collection<Node> selection = getModel().getSelection(); |
3890 | if (selection.size() == 0) { |
3891 | properties = getModelProperties(); |
3892 | - titleSuffix += " [model]"; |
3893 | + titleSuffix = TITLE_SUFFIX_MODEL; |
3894 | } else if (selection.size() == 1) { |
3895 | Node node = selection.iterator().next(); |
3896 | properties = getNodeProperties(node); |
3897 | - titleSuffix += " [single element]"; |
3898 | + titleSuffix = TITLE_SUFFIX_SINGLE_ELEMENT; |
3899 | } else { |
3900 | properties = getSelectionProperties(selection); |
3901 | int nodeCount = selection.size(); |
3902 | - titleSuffix += " [" + nodeCount + " selected elements]"; |
3903 | + titleSuffix = nodeCount + " " + TITLE_SUFFIX_SELECTED_ELEMENTS; |
3904 | } |
3905 | } |
3906 | |
3907 | final PropertyEditorWindow propertyEditorWindow = mainWindow.getPropertyView(); |
3908 | if(properties.getDescriptors().isEmpty()) { |
3909 | propertyEditorWindow.clearObject(); |
3910 | - titleSuffix = ""; |
3911 | } else { |
3912 | propertyEditorWindow.setObject(propertiesWrapper(properties)); |
3913 | } |
3914 | |
3915 | - final DockableWindow propertyEditorDockable = mainWindow.getPropertyEditor(); |
3916 | - String title = titlePrefix + titleSuffix; |
3917 | - propertyEditorDockable.getContentPanel().setTitle(title); |
3918 | - propertyEditorDockable.setTabText(title); |
3919 | - |
3920 | + String title = MainWindow.TITLE_PROPERTY_EDITOR; |
3921 | + if (titleSuffix != null) { |
3922 | + title += " [" + titleSuffix + "]"; |
3923 | + } |
3924 | + mainWindow.setDockableTitle(mainWindow.getPropertyEditor(), title); |
3925 | updatePropertyViewRequested = false; |
3926 | } |
3927 | |
3928 | |
3929 | === modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/BooleanCellEditor.java' |
3930 | --- WorkcraftCore/src/org/workcraft/gui/propertyeditor/BooleanCellEditor.java 2013-10-07 09:51:12 +0000 |
3931 | +++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/BooleanCellEditor.java 2015-06-26 22:23:53 +0000 |
3932 | @@ -21,26 +21,26 @@ |
3933 | |
3934 | package org.workcraft.gui.propertyeditor; |
3935 | |
3936 | -import java.awt.Component; |
3937 | -import java.awt.event.ItemEvent; |
3938 | -import java.awt.event.ItemListener; |
3939 | - |
3940 | -import javax.swing.AbstractCellEditor; |
3941 | -import javax.swing.JCheckBox; |
3942 | -import javax.swing.JTable; |
3943 | -import javax.swing.table.TableCellEditor; |
3944 | +import java.awt.Component; |
3945 | +import java.awt.event.ItemEvent; |
3946 | +import java.awt.event.ItemListener; |
3947 | + |
3948 | +import javax.swing.AbstractCellEditor; |
3949 | +import javax.swing.JCheckBox; |
3950 | +import javax.swing.JTable; |
3951 | +import javax.swing.table.TableCellEditor; |
3952 | |
3953 | |
3954 | @SuppressWarnings("serial") |
3955 | -public class BooleanCellEditor extends AbstractCellEditor implements |
3956 | - TableCellEditor, ItemListener{ |
3957 | +public class BooleanCellEditor extends AbstractCellEditor implements TableCellEditor, ItemListener{ |
3958 | |
3959 | private JCheckBox checkBox; |
3960 | |
3961 | public BooleanCellEditor() { |
3962 | checkBox = new JCheckBox(); |
3963 | checkBox.setFocusable(false); |
3964 | - checkBox.addItemListener(this); |
3965 | + checkBox.addItemListener(this); |
3966 | + checkBox.setBorderPainted(false); |
3967 | } |
3968 | |
3969 | public Component getTableCellEditorComponent( |
3970 | @@ -49,6 +49,7 @@ |
3971 | checkBox.setSelected((Boolean)value); |
3972 | } |
3973 | checkBox.setOpaque(value == null); |
3974 | + checkBox.setFont(table.getFont()); |
3975 | return checkBox; |
3976 | } |
3977 | |
3978 | |
3979 | === modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/ChoiceCellEditor.java' |
3980 | --- WorkcraftCore/src/org/workcraft/gui/propertyeditor/ChoiceCellEditor.java 2013-10-07 09:51:12 +0000 |
3981 | +++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/ChoiceCellEditor.java 2015-06-26 22:23:53 +0000 |
3982 | @@ -26,6 +26,7 @@ |
3983 | import java.awt.event.ItemListener; |
3984 | |
3985 | import javax.swing.AbstractCellEditor; |
3986 | +import javax.swing.BorderFactory; |
3987 | import javax.swing.JComboBox; |
3988 | import javax.swing.JTable; |
3989 | import javax.swing.table.TableCellEditor; |
3990 | @@ -40,7 +41,8 @@ |
3991 | comboBox = new JComboBox(); |
3992 | comboBox.setEditable(false); |
3993 | comboBox.setFocusable(false); |
3994 | - comboBox.addItemListener(this); |
3995 | + comboBox.addItemListener(this); |
3996 | + comboBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
3997 | |
3998 | int declCount = decl.getChoice().size(); |
3999 | wrappers = new ChoiceWrapper[declCount]; |
4000 | @@ -76,6 +78,7 @@ |
4001 | } |
4002 | } |
4003 | comboBox.setOpaque(value == null); |
4004 | + comboBox.setFont(table.getFont()); |
4005 | return comboBox; |
4006 | } |
4007 | |
4008 | |
4009 | === modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/ColorCellEditor.java' |
4010 | --- WorkcraftCore/src/org/workcraft/gui/propertyeditor/ColorCellEditor.java 2014-04-09 22:33:19 +0000 |
4011 | +++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/ColorCellEditor.java 2015-06-26 22:23:53 +0000 |
4012 | @@ -52,12 +52,12 @@ |
4013 | static JColorChooser chooser = null; |
4014 | static JDialog dialog = null; |
4015 | |
4016 | - protected static final String EDIT = "edit"; |
4017 | + protected static final String TAG_EDIT = "edit"; |
4018 | |
4019 | public ColorCellEditor() { |
4020 | |
4021 | button = new JButton(); |
4022 | - button.setActionCommand(EDIT); |
4023 | + button.setActionCommand(TAG_EDIT); |
4024 | button.addActionListener(this); |
4025 | button.setBorderPainted(false); |
4026 | button.setFocusable(false); |
4027 | @@ -78,7 +78,7 @@ |
4028 | |
4029 | @Override |
4030 | public void actionPerformed(ActionEvent e) { |
4031 | - if (EDIT.equals(e.getActionCommand())) { |
4032 | + if (TAG_EDIT.equals(e.getActionCommand())) { |
4033 | // The user has clicked the cell, so bring up the dialog. |
4034 | approx.target = this; |
4035 | button.setBackground(color); |
4036 | @@ -86,7 +86,7 @@ |
4037 | dialog.setVisible(true); |
4038 | fireEditingStopped(); //Make the renderer reappear. |
4039 | } else { |
4040 | - //User pressed dialog's "OK" button. |
4041 | + // User pressed dialog's "OK" button. |
4042 | color = chooser.getColor(); |
4043 | } |
4044 | } |
4045 | |
4046 | === modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/ColorCellRenderer.java' |
4047 | --- WorkcraftCore/src/org/workcraft/gui/propertyeditor/ColorCellRenderer.java 2014-04-09 22:33:19 +0000 |
4048 | +++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/ColorCellRenderer.java 2015-06-26 22:23:53 +0000 |
4049 | @@ -21,21 +21,17 @@ |
4050 | |
4051 | package org.workcraft.gui.propertyeditor; |
4052 | |
4053 | -import java.awt.Color; |
4054 | -import java.awt.Component; |
4055 | - |
4056 | -import javax.swing.BorderFactory; |
4057 | -import javax.swing.JLabel; |
4058 | -import javax.swing.JTable; |
4059 | -import javax.swing.border.Border; |
4060 | -import javax.swing.table.TableCellRenderer; |
4061 | +import java.awt.Color; |
4062 | +import java.awt.Component; |
4063 | + |
4064 | +import javax.swing.JLabel; |
4065 | +import javax.swing.JTable; |
4066 | +import javax.swing.table.TableCellRenderer; |
4067 | |
4068 | @SuppressWarnings("serial") |
4069 | public class ColorCellRenderer extends JLabel implements TableCellRenderer { |
4070 | - Border unselectedBorder = null; |
4071 | - Border selectedBorder = null; |
4072 | - |
4073 | - public ColorCellRenderer() { |
4074 | + |
4075 | + public ColorCellRenderer() { |
4076 | setOpaque(true); //MUST do this for background to show up. |
4077 | setFocusable(false); |
4078 | } |
4079 | @@ -43,22 +39,10 @@ |
4080 | @Override |
4081 | public Component getTableCellRendererComponent(JTable table, Object value, |
4082 | boolean isSelected, boolean hasFocus, int row, int column) { |
4083 | + setBorder(PropertyEditorTable.BORDER_RENDER); |
4084 | if (value != null) { |
4085 | setBackground((Color)value); |
4086 | - if (isSelected) { |
4087 | - if (selectedBorder == null) { |
4088 | - selectedBorder = BorderFactory.createMatteBorder( |
4089 | - 2, 5, 2, 5, table.getSelectionBackground()); |
4090 | - } |
4091 | - setBorder(selectedBorder); |
4092 | - } else { |
4093 | - if (unselectedBorder == null) { |
4094 | - unselectedBorder = BorderFactory.createMatteBorder( |
4095 | - 2, 5, 2, 5, table.getBackground()); |
4096 | - } |
4097 | - setBorder(unselectedBorder); |
4098 | - } |
4099 | - } |
4100 | + } |
4101 | return this; |
4102 | } |
4103 | -} |
4104 | \ No newline at end of file |
4105 | +} |
4106 | |
4107 | === modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/DefaultCellRenderer.java' |
4108 | --- WorkcraftCore/src/org/workcraft/gui/propertyeditor/DefaultCellRenderer.java 2013-10-07 09:51:12 +0000 |
4109 | +++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/DefaultCellRenderer.java 2015-06-26 22:23:53 +0000 |
4110 | @@ -13,12 +13,15 @@ |
4111 | public Component getTableCellRendererComponent(JTable table, Object value, |
4112 | boolean isSelected, boolean hasFocus, int row, int column) { |
4113 | if (value != null) { |
4114 | - setText((String)value); |
4115 | + String text = value.toString(); |
4116 | + setText(text); |
4117 | + setFont(table.getFont()); |
4118 | + setOpaque(text.isEmpty()); |
4119 | } else { |
4120 | setText(""); |
4121 | + setOpaque(true); |
4122 | } |
4123 | - setFont(table.getFont()); |
4124 | - setOpaque(value == null || value.equals("")); |
4125 | + setBorder(PropertyEditorTable.BORDER_RENDER); |
4126 | return this; |
4127 | } |
4128 | |
4129 | |
4130 | === modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/FileCellEditor.java' |
4131 | --- WorkcraftCore/src/org/workcraft/gui/propertyeditor/FileCellEditor.java 2015-02-09 10:46:28 +0000 |
4132 | +++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/FileCellEditor.java 2015-06-26 22:23:53 +0000 |
4133 | @@ -18,8 +18,8 @@ |
4134 | @SuppressWarnings("serial") |
4135 | public class FileCellEditor extends AbstractCellEditor implements TableCellEditor, ActionListener { |
4136 | |
4137 | - protected static final String EDIT = "edit"; |
4138 | - protected static final String CLEAR = "clear"; |
4139 | + protected static final String TAG_EDIT = "edit"; |
4140 | + protected static final String TAG_CLEAR = "clear"; |
4141 | |
4142 | final private JPanel panel; |
4143 | final private JButton chooseButton; |
4144 | @@ -28,7 +28,7 @@ |
4145 | |
4146 | public FileCellEditor() { |
4147 | chooseButton = new JButton(); |
4148 | - chooseButton.setActionCommand(EDIT); |
4149 | + chooseButton.setActionCommand(TAG_EDIT); |
4150 | chooseButton.addActionListener(this); |
4151 | chooseButton.setOpaque(true); |
4152 | chooseButton.setBorderPainted(false); |
4153 | @@ -37,7 +37,7 @@ |
4154 | chooseButton.setHorizontalAlignment(SwingConstants.LEFT); |
4155 | |
4156 | clearButton = new JButton("x"); |
4157 | - clearButton.setActionCommand(CLEAR); |
4158 | + clearButton.setActionCommand(TAG_CLEAR); |
4159 | clearButton.addActionListener(this); |
4160 | clearButton.setFocusable(false); |
4161 | clearButton.setMargin(new Insets(1, 1, 1, 1)); |
4162 | @@ -50,7 +50,7 @@ |
4163 | |
4164 | @Override |
4165 | public void actionPerformed(ActionEvent e) { |
4166 | - if (EDIT.equals(e.getActionCommand())) { |
4167 | + if (TAG_EDIT.equals(e.getActionCommand())) { |
4168 | JFileChooser fc = new JFileChooser(); |
4169 | fc.setDialogType(JFileChooser.OPEN_DIALOG); |
4170 | fc.setMultiSelectionEnabled(false); |
4171 | @@ -59,7 +59,7 @@ |
4172 | if (fc.showDialog(null, "Open") == JFileChooser.APPROVE_OPTION) { |
4173 | file = fc.getSelectedFile(); |
4174 | } |
4175 | - } else if (CLEAR.equals(e.getActionCommand())) { |
4176 | + } else if (TAG_CLEAR.equals(e.getActionCommand())) { |
4177 | file = null; |
4178 | } |
4179 | fireEditingStopped(); |
4180 | @@ -74,6 +74,7 @@ |
4181 | public Component getTableCellEditorComponent( |
4182 | JTable table, Object value, boolean isSelected, int row, int column) { |
4183 | file = (File)value; |
4184 | + panel.setFont(table.getFont()); |
4185 | return panel; |
4186 | } |
4187 | |
4188 | |
4189 | === modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/GenericCellEditor.java' |
4190 | --- WorkcraftCore/src/org/workcraft/gui/propertyeditor/GenericCellEditor.java 2014-07-30 19:51:21 +0000 |
4191 | +++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/GenericCellEditor.java 2015-06-26 22:23:53 +0000 |
4192 | @@ -37,6 +37,7 @@ |
4193 | public GenericCellEditor() { |
4194 | textField = new JTextField(); |
4195 | textField.setFocusable(true); |
4196 | + textField.setBorder(PropertyEditorTable.BORDER_EDIT); |
4197 | textField.addFocusListener(new FocusAdapter() { |
4198 | @Override |
4199 | public void focusLost(FocusEvent e) { |
4200 | @@ -50,8 +51,9 @@ |
4201 | } |
4202 | |
4203 | public Component getTableCellEditorComponent(JTable table, Object value, |
4204 | - boolean isSelected, int row, int column) { |
4205 | - textField.setText(value.toString()); |
4206 | + boolean isSelected, int row, int column) { |
4207 | + textField.setText(value.toString()); |
4208 | + textField.setFont(table.getFont()); |
4209 | return textField; |
4210 | } |
4211 | } |
4212 | |
4213 | === modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/ModelProperties.java' |
4214 | --- WorkcraftCore/src/org/workcraft/gui/propertyeditor/ModelProperties.java 2015-01-12 22:28:11 +0000 |
4215 | +++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/ModelProperties.java 2015-06-26 22:23:53 +0000 |
4216 | @@ -54,6 +54,19 @@ |
4217 | propertyDescriptors.addAll(descriptors); |
4218 | } |
4219 | } |
4220 | + |
4221 | + public void addSorted(final Collection<PropertyDescriptor> descriptors) { |
4222 | + if (descriptors != null) { |
4223 | + LinkedList<PropertyDescriptor> sortedDescriptors = new LinkedList<PropertyDescriptor>(descriptors); |
4224 | + Collections.sort(sortedDescriptors, new Comparator<PropertyDescriptor>() { |
4225 | + @Override |
4226 | + public int compare(PropertyDescriptor o1, PropertyDescriptor o2) { |
4227 | + return (o1.getName().compareTo(o2.getName())); |
4228 | + } |
4229 | + }); |
4230 | + propertyDescriptors.addAll(sortedDescriptors); |
4231 | + } |
4232 | + } |
4233 | |
4234 | public void remove(final PropertyDescriptor descriptor) { |
4235 | if (descriptor != null) { |
4236 | @@ -75,14 +88,5 @@ |
4237 | public Collection<PropertyDescriptor> getDescriptors() { |
4238 | return Collections.unmodifiableList(propertyDescriptors); |
4239 | } |
4240 | - |
4241 | - public void sortByPropertyName() { |
4242 | - Collections.sort(propertyDescriptors, new Comparator<PropertyDescriptor>() { |
4243 | - @Override |
4244 | - public int compare(PropertyDescriptor o1, PropertyDescriptor o2) { |
4245 | - return (o1.getName().compareTo(o2.getName())); |
4246 | - } |
4247 | - }); |
4248 | - } |
4249 | |
4250 | } |
4251 | |
4252 | === modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/NamePropertyDescriptor.java' |
4253 | --- WorkcraftCore/src/org/workcraft/gui/propertyeditor/NamePropertyDescriptor.java 2015-04-13 18:41:37 +0000 |
4254 | +++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/NamePropertyDescriptor.java 2015-06-26 22:23:53 +0000 |
4255 | @@ -9,6 +9,8 @@ |
4256 | import org.workcraft.observation.PropertyChangedEvent; |
4257 | |
4258 | public class NamePropertyDescriptor implements PropertyDescriptor { |
4259 | + public static final String PROPERTY_NAME = "Name"; |
4260 | + |
4261 | private final AbstractModel model; |
4262 | private final Node node; |
4263 | |
4264 | @@ -26,7 +28,7 @@ |
4265 | public void setValue(Object value) throws InvocationTargetException { |
4266 | model.setName(node, (String)value); |
4267 | if (node instanceof ObservableState) { |
4268 | - ((ObservableState)node).sendNotification(new PropertyChangedEvent(node, "name")); |
4269 | + ((ObservableState)node).sendNotification(new PropertyChangedEvent(node, PROPERTY_NAME)); |
4270 | } |
4271 | } |
4272 | |
4273 | @@ -37,7 +39,7 @@ |
4274 | |
4275 | @Override |
4276 | public String getName() { |
4277 | - return "Name"; |
4278 | + return PROPERTY_NAME; |
4279 | } |
4280 | |
4281 | @Override |
4282 | |
4283 | === modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/PropertyEditorTable.java' |
4284 | --- WorkcraftCore/src/org/workcraft/gui/propertyeditor/PropertyEditorTable.java 2015-05-22 17:42:39 +0000 |
4285 | +++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/PropertyEditorTable.java 2015-06-26 22:23:53 +0000 |
4286 | @@ -22,21 +22,33 @@ |
4287 | package org.workcraft.gui.propertyeditor; |
4288 | |
4289 | import java.awt.Color; |
4290 | +import java.awt.Component; |
4291 | +import java.awt.Font; |
4292 | +import java.awt.Graphics; |
4293 | +import java.lang.reflect.InvocationTargetException; |
4294 | import java.net.URI; |
4295 | import java.util.HashMap; |
4296 | |
4297 | +import javax.swing.BorderFactory; |
4298 | +import javax.swing.JLabel; |
4299 | import javax.swing.JOptionPane; |
4300 | import javax.swing.JTable; |
4301 | +import javax.swing.border.Border; |
4302 | import javax.swing.event.ChangeEvent; |
4303 | import javax.swing.table.DefaultTableCellRenderer; |
4304 | import javax.swing.table.TableCellEditor; |
4305 | import javax.swing.table.TableCellRenderer; |
4306 | |
4307 | import org.workcraft.Framework; |
4308 | +import org.workcraft.PluginManager; |
4309 | +import org.workcraft.dom.visual.FontHelper; |
4310 | import org.workcraft.plugins.PluginInfo; |
4311 | |
4312 | @SuppressWarnings("serial") |
4313 | public class PropertyEditorTable extends JTable implements PropertyEditor { |
4314 | + public static final Border BORDER_RENDER = BorderFactory.createEmptyBorder(1, 3, 1, 1); |
4315 | + public static final Border BORDER_EDIT = BorderFactory.createEmptyBorder(0, 3, 1, 1); |
4316 | + |
4317 | HashMap<Class<?>, PropertyClass> propertyClasses; |
4318 | TableCellRenderer cellRenderers[]; |
4319 | TableCellEditor cellEditors[]; |
4320 | @@ -46,11 +58,12 @@ |
4321 | super(); |
4322 | |
4323 | model = new PropertyEditorTableModel(); |
4324 | - setModel(model); |
4325 | - |
4326 | + setModel(model); |
4327 | + |
4328 | setTableHeader(null); |
4329 | setFocusable(false); |
4330 | - |
4331 | + setRowHeight(FontHelper.getFontSizeInPixels(getFont())); |
4332 | + |
4333 | propertyClasses = new HashMap<Class<?>, PropertyClass>(); |
4334 | propertyClasses.put(int.class, new IntegerProperty()); |
4335 | propertyClasses.put(Integer.class, new IntegerProperty()); |
4336 | @@ -63,7 +76,8 @@ |
4337 | propertyClasses.put(URI.class, new FileProperty()); |
4338 | |
4339 | final Framework framework = Framework.getInstance(); |
4340 | - for(PluginInfo<? extends PropertyClassProvider> plugin : framework.getPluginManager().getPlugins(PropertyClassProvider.class)) { |
4341 | + PluginManager pluginManager = framework.getPluginManager(); |
4342 | + for(PluginInfo<? extends PropertyClassProvider> plugin : pluginManager.getPlugins(PropertyClassProvider.class)) { |
4343 | PropertyClassProvider instance = plugin.newInstance(); |
4344 | propertyClasses.put(instance.getPropertyType(), instance.getPropertyGui()); |
4345 | } |
4346 | @@ -71,18 +85,46 @@ |
4347 | |
4348 | @Override |
4349 | public TableCellEditor getCellEditor(int row, int col) { |
4350 | - if (col == 0) |
4351 | + if (col == 0) { |
4352 | return super.getCellEditor(row, col); |
4353 | - else |
4354 | - return cellEditors[row]; |
4355 | + } else { |
4356 | + return cellEditors[row]; |
4357 | + } |
4358 | } |
4359 | |
4360 | @Override |
4361 | - public TableCellRenderer getCellRenderer(int row, int col) { |
4362 | - if (col == 0) |
4363 | - return super.getCellRenderer(row, col); |
4364 | - else |
4365 | - return cellRenderers[row]; |
4366 | + public TableCellRenderer getCellRenderer(int row, int col) { |
4367 | + if (col > 0) { |
4368 | + return cellRenderers[row]; |
4369 | + } else { |
4370 | + return new TableCellRenderer() { |
4371 | + private final JLabel label = new JLabel() { |
4372 | + @Override |
4373 | + public void paint( Graphics g ) { |
4374 | + g.setColor(getBackground()); |
4375 | + g.fillRect(0, 0, getWidth() - 1, getHeight() - 1); |
4376 | + super.paint(g); |
4377 | + } |
4378 | + }; |
4379 | + |
4380 | + @Override |
4381 | + public Component getTableCellRendererComponent(JTable table, Object value, |
4382 | + boolean isSelected, boolean hasFocus, int row, int column) { |
4383 | + label.setText(value.toString()); |
4384 | + label.setBorder(BORDER_RENDER); |
4385 | + PropertyDescriptor descriptor = model.getRowDeclaration(row); |
4386 | + try { |
4387 | + if (descriptor.getValue() == null) { |
4388 | + Font boldFont = label.getFont().deriveFont(Font.BOLD); |
4389 | + label.setFont(boldFont); |
4390 | + } |
4391 | + } catch (InvocationTargetException e) { |
4392 | + } |
4393 | + //label.setEnabled(false); |
4394 | + return label; |
4395 | + } |
4396 | + }; |
4397 | + } |
4398 | } |
4399 | |
4400 | @Override |
4401 | @@ -93,11 +135,8 @@ |
4402 | @Override |
4403 | public void setObject(Properties o) { |
4404 | model.setObject(o); |
4405 | - |
4406 | cellRenderers = new TableCellRenderer[model.getRowCount()]; |
4407 | cellEditors = new TableCellEditor[model.getRowCount()]; |
4408 | - |
4409 | - |
4410 | for (int i = 0; i < model.getRowCount(); i++) { |
4411 | PropertyDescriptor decl = model.getRowDeclaration(i); |
4412 | |
4413 | @@ -105,21 +144,19 @@ |
4414 | if (decl.getChoice() != null) { |
4415 | model.setRowClass(i, null); |
4416 | cellRenderers[i] = new DefaultCellRenderer(); |
4417 | - ChoiceCellEditor ce = new ChoiceCellEditor(decl); |
4418 | - cellEditors[i] = ce; |
4419 | + cellEditors[i] = new ChoiceCellEditor(decl); |
4420 | } else { |
4421 | // otherwise, try to get a corresponding PropertyClass object, that knows how to edit a property of this class |
4422 | PropertyClass cls = propertyClasses.get(decl.getType()); |
4423 | model.setRowClass(i, cls); |
4424 | - if (cls == null) { |
4425 | + if (cls != null) { |
4426 | + cellRenderers[i] = cls.getCellRenderer(); |
4427 | + cellEditors[i] = cls.getCellEditor(); |
4428 | + } else { |
4429 | // no PropertyClass exists for this class, fall back to read-only mode using Object.toString() |
4430 | System.err.println("Data class \"" + decl.getType().getName() + "\" is not supported by the Property Editor."); |
4431 | - |
4432 | - cellRenderers[i] = new DefaultTableCellRenderer(); |
4433 | + cellRenderers[i] = new DefaultTableCellRenderer(); |
4434 | cellEditors[i] = null; |
4435 | - } else { |
4436 | - cellRenderers[i] = cls.getCellRenderer(); |
4437 | - cellEditors[i] = cls.getCellEditor(); |
4438 | } |
4439 | } |
4440 | } |
4441 | |
4442 | === modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/PropertyEditorTableModel.java' |
4443 | --- WorkcraftCore/src/org/workcraft/gui/propertyeditor/PropertyEditorTableModel.java 2015-02-09 10:46:28 +0000 |
4444 | +++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/PropertyEditorTableModel.java 2015-06-26 22:23:53 +0000 |
4445 | @@ -66,25 +66,28 @@ |
4446 | } |
4447 | |
4448 | public int getColumnCount() { |
4449 | - if (object == null) |
4450 | + if (object == null) { |
4451 | return 0; |
4452 | - else |
4453 | - return 2; |
4454 | + } else { |
4455 | + return 2; |
4456 | + } |
4457 | } |
4458 | |
4459 | public int getRowCount() { |
4460 | - if (object == null) |
4461 | + if (object == null) { |
4462 | return 0; |
4463 | - else |
4464 | - return declarations.length; |
4465 | + } else { |
4466 | + return declarations.length; |
4467 | + } |
4468 | } |
4469 | |
4470 | @Override |
4471 | public boolean isCellEditable(int row, int col) { |
4472 | - if (col == 0) |
4473 | + if (col == 0) { |
4474 | return false; |
4475 | - else |
4476 | - return (declarations[row].isWritable()); |
4477 | + } else { |
4478 | + return (declarations[row].isWritable()); |
4479 | + } |
4480 | } |
4481 | |
4482 | public PropertyDescriptor getRowDeclaration(int i) { |
4483 | @@ -92,26 +95,27 @@ |
4484 | } |
4485 | |
4486 | public Object getValueAt(int row, int col) { |
4487 | - if (col ==0 ) |
4488 | + if (col == 0) { |
4489 | return declarations[row].getName(); |
4490 | - else try { |
4491 | - Object value = declarations[row].getValue(); |
4492 | - if (rowClasses[row] != null) |
4493 | - return rowClasses[row].toCellRendererValue(value); |
4494 | - else |
4495 | - { |
4496 | - Map<? extends Object, String> choice = declarations[row].getChoice(); |
4497 | - if(choice != null) |
4498 | - return choice.get(value); |
4499 | - else |
4500 | - return value.toString(); |
4501 | + } else { |
4502 | + try { |
4503 | + Object value = declarations[row].getValue(); |
4504 | + if (rowClasses[row] != null) { |
4505 | + return rowClasses[row].toCellRendererValue(value); |
4506 | + } else { |
4507 | + Map<? extends Object, String> choice = declarations[row].getChoice(); |
4508 | + if(choice != null) { |
4509 | + return choice.get(value); |
4510 | + } else { |
4511 | + return value.toString(); |
4512 | + } |
4513 | + } |
4514 | + } catch (Throwable e) { |
4515 | + return "#EXCEPTION"; |
4516 | } |
4517 | - } catch (Throwable e) { |
4518 | - e.printStackTrace(); |
4519 | - return "#EXCEPTION"; |
4520 | } |
4521 | - } |
4522 | - |
4523 | + } |
4524 | + |
4525 | @Override |
4526 | public void setValueAt(Object value, int row, int col) { |
4527 | PropertyDescriptor desc = declarations[row]; |
4528 | @@ -128,4 +132,5 @@ |
4529 | public Properties getObject() { |
4530 | return object; |
4531 | } |
4532 | -} |
4533 | \ No newline at end of file |
4534 | + |
4535 | +} |
4536 | |
4537 | === modified file 'WorkcraftCore/src/org/workcraft/gui/propertyeditor/StringProperty.java' |
4538 | --- WorkcraftCore/src/org/workcraft/gui/propertyeditor/StringProperty.java 2014-04-09 22:33:19 +0000 |
4539 | +++ WorkcraftCore/src/org/workcraft/gui/propertyeditor/StringProperty.java 2015-06-26 22:23:53 +0000 |
4540 | @@ -45,7 +45,7 @@ |
4541 | public Object toCellRendererValue(Object value) { |
4542 | String result = ""; |
4543 | if (value != null) { |
4544 | - result = "" + value; |
4545 | + result = value.toString(); |
4546 | } |
4547 | return result; |
4548 | } |
4549 | |
4550 | === modified file 'WorkcraftCore/src/org/workcraft/gui/trees/TreeWindow.java' |
4551 | --- WorkcraftCore/src/org/workcraft/gui/trees/TreeWindow.java 2015-02-10 15:21:12 +0000 |
4552 | +++ WorkcraftCore/src/org/workcraft/gui/trees/TreeWindow.java 2015-06-26 22:23:53 +0000 |
4553 | @@ -220,8 +220,9 @@ |
4554 | |
4555 | String name = decorator.getName(node); |
4556 | boolean tricky = name.startsWith("!"); |
4557 | - if (tricky) |
4558 | + if (tricky) { |
4559 | name = name.substring(1); |
4560 | + } |
4561 | Component res = super.getTreeCellRendererComponent(tree, name, sel, expanded, leaf, row, hasFocus); |
4562 | |
4563 | |
4564 | |
4565 | === modified file 'WorkcraftCore/src/org/workcraft/gui/workspace/WorkspacePopupProvider.java' |
4566 | --- WorkcraftCore/src/org/workcraft/gui/workspace/WorkspacePopupProvider.java 2015-01-20 18:45:18 +0000 |
4567 | +++ WorkcraftCore/src/org/workcraft/gui/workspace/WorkspacePopupProvider.java 2015-06-26 22:23:53 +0000 |
4568 | @@ -197,34 +197,29 @@ |
4569 | ListMap<String, Pair<String, Tool>> applicableTools = Tools.getTools(openFile); |
4570 | List<String> sections = Tools.getSections(applicableTools); |
4571 | |
4572 | - if (!sections.isEmpty()) |
4573 | + if (!sections.isEmpty()) { |
4574 | popup.addSeparator(); |
4575 | - |
4576 | + } |
4577 | for (String section : sections) { |
4578 | - JMenu m = new JMenu(section); |
4579 | - |
4580 | + String menuName = (section.startsWith("!") ? section.substring(1) : section); |
4581 | + JMenu menu = new JMenu(menuName); |
4582 | for (Pair<String, Tool> tool : Tools.getSectionTools(section, applicableTools)) { |
4583 | - JMenuItem mi = new JMenuItem(tool.getFirst()); |
4584 | - tools.put(mi, tool.getSecond()); |
4585 | - |
4586 | - mi.addActionListener(new ActionListener() { |
4587 | + JMenuItem item = new JMenuItem(tool.getFirst()); |
4588 | + tools.put(item, tool.getSecond()); |
4589 | + item.addActionListener(new ActionListener() { |
4590 | public void actionPerformed(ActionEvent e) { |
4591 | Tools.run(openFile, tools.get(e.getSource())); |
4592 | } |
4593 | }); |
4594 | - |
4595 | - m.add(mi); |
4596 | + menu.add(item); |
4597 | } |
4598 | - |
4599 | - popup.add(m); |
4600 | + popup.add(menu); |
4601 | } |
4602 | } |
4603 | - |
4604 | popup.addSeparator(); |
4605 | |
4606 | JMenuItem miRemove = new JMenuItem("Delete"); |
4607 | - miRemove.addActionListener(new ActionListener() |
4608 | - { |
4609 | + miRemove.addActionListener(new ActionListener() { |
4610 | public void actionPerformed(ActionEvent e) { |
4611 | try { |
4612 | workspace.delete(path); |
4613 | @@ -235,9 +230,11 @@ |
4614 | } |
4615 | |
4616 | popup.addSeparator(); |
4617 | - if(path.isEmpty()) |
4618 | - for (Component c : wsWindow.createMenu().getMenuComponents()) |
4619 | + if (path.isEmpty()) { |
4620 | + for (Component c : wsWindow.createMenu().getMenuComponents()) { |
4621 | popup.add(c); |
4622 | + } |
4623 | + } |
4624 | return popup; |
4625 | } |
4626 | } |
4627 | \ No newline at end of file |
4628 | |
4629 | === modified file 'WorkcraftCore/src/org/workcraft/serialisation/xml/XMLDeserialiserState.java' |
4630 | --- WorkcraftCore/src/org/workcraft/serialisation/xml/XMLDeserialiserState.java 2014-07-04 19:54:50 +0000 |
4631 | +++ WorkcraftCore/src/org/workcraft/serialisation/xml/XMLDeserialiserState.java 2015-06-26 22:23:53 +0000 |
4632 | @@ -77,7 +77,7 @@ |
4633 | |
4634 | @Override |
4635 | public Object getObject(String reference) { |
4636 | - if (reference.equals("")) return null; |
4637 | + if (reference.isEmpty()) return null; |
4638 | |
4639 | return internalReferenceMap.getValue(reference); |
4640 | } |
4641 | |
4642 | === modified file 'WorkcraftCore/src/org/workcraft/util/Tools.java' |
4643 | --- WorkcraftCore/src/org/workcraft/util/Tools.java 2015-02-11 10:58:21 +0000 |
4644 | +++ WorkcraftCore/src/org/workcraft/util/Tools.java 2015-06-26 22:23:53 +0000 |
4645 | @@ -41,13 +41,13 @@ |
4646 | } |
4647 | } |
4648 | |
4649 | - public static List<String> getSections (ListMap<String, Pair<String, Tool>> tools) { |
4650 | + public static List<String> getSections(ListMap<String, Pair<String, Tool>> tools) { |
4651 | LinkedList<String> list = new LinkedList<String>(tools.keySet()); |
4652 | Collections.sort(list); |
4653 | return list; |
4654 | } |
4655 | |
4656 | - public static List<Pair<String,Tool>> getSectionTools (String section, ListMap<String, Pair<String, Tool>> tools) { |
4657 | + public static List<Pair<String,Tool>> getSectionTools(String section, ListMap<String, Pair<String, Tool>> tools) { |
4658 | List<Pair<String,Tool>> sectionTools = new ArrayList<Pair<String, Tool>>(tools.get(section)); |
4659 | |
4660 | Collections.sort(sectionTools, new Comparator<Pair<String,Tool>>() { |
4661 | |
4662 | === modified file 'WorkcraftCore/src/org/workcraft/workspace/WorkspaceEntry.java' |
4663 | --- WorkcraftCore/src/org/workcraft/workspace/WorkspaceEntry.java 2015-05-19 18:01:37 +0000 |
4664 | +++ WorkcraftCore/src/org/workcraft/workspace/WorkspaceEntry.java 2015-06-26 22:23:53 +0000 |
4665 | @@ -75,7 +75,7 @@ |
4666 | } |
4667 | workspace.fireEntryChanged(this); |
4668 | final Framework framework = Framework.getInstance(); |
4669 | - framework.getMainWindow().refreshTitle(this); |
4670 | + framework.getMainWindow().refreshWorkspaceEntryTitle(this, true); |
4671 | } |
4672 | } |
4673 | |
4674 | @@ -199,7 +199,7 @@ |
4675 | MainWindowActions.EDIT_SELECT_NONE_ACTION.setEnabled(canModify && canSelect); |
4676 | MainWindow mainWindow = Framework.getInstance().getMainWindow(); |
4677 | if (mainWindow != null) { |
4678 | - mainWindow.getMainMenu().getToolsMenu().setEnabled(canModify); |
4679 | + mainWindow.getMainMenu().updateToolsMenuState(canModify); |
4680 | } |
4681 | } |
4682 | |
4683 | |
4684 | === modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/components/QueueComponent.java' |
4685 | --- XmasPlugin/src/org/workcraft/plugins/xmas/components/QueueComponent.java 2013-11-05 18:01:19 +0000 |
4686 | +++ XmasPlugin/src/org/workcraft/plugins/xmas/components/QueueComponent.java 2015-06-26 22:23:53 +0000 |
4687 | @@ -26,12 +26,13 @@ |
4688 | |
4689 | @VisualClass(org.workcraft.plugins.xmas.components.VisualQueueComponent.class) |
4690 | public class QueueComponent extends XmasComponent { |
4691 | - |
4692 | + public static final String PROPERTY_CAPACITY = "Capacity"; |
4693 | + |
4694 | public int capacity = 0; |
4695 | |
4696 | public void setCapacity(int capacity) { |
4697 | this.capacity = capacity; |
4698 | - sendNotification(new PropertyChangedEvent(this, "capacity")); |
4699 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_CAPACITY)); |
4700 | } |
4701 | |
4702 | public int getCapacity() { |
4703 | |
4704 | === modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualQueueComponent.java' |
4705 | --- XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualQueueComponent.java 2015-04-13 18:41:37 +0000 |
4706 | +++ XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualQueueComponent.java 2015-06-26 22:23:53 +0000 |
4707 | @@ -41,6 +41,8 @@ |
4708 | @Hotkey(KeyEvent.VK_Q) |
4709 | @SVGIcon("images/icons/svg/xmas-queue.svg") |
4710 | public class VisualQueueComponent extends VisualXmasComponent { |
4711 | + public static final String PROPERTY_FOREGROUND_COLOR = "Foreground color"; |
4712 | + |
4713 | public Color color = new Color(0, 0, 0, 255); |
4714 | |
4715 | public VisualQueueComponent(QueueComponent component) { |
4716 | @@ -55,7 +57,7 @@ |
4717 | |
4718 | private void addPropertyDeclarations() { |
4719 | addPropertyDeclaration(new PropertyDeclaration<VisualQueueComponent, Integer>( |
4720 | - this, "Capacity", Integer.class) { |
4721 | + this, QueueComponent.PROPERTY_CAPACITY, Integer.class) { |
4722 | public void setter(VisualQueueComponent object, Integer value) { |
4723 | object.getReferencedQueueComponent().setCapacity(value); |
4724 | } |
4725 | @@ -98,7 +100,7 @@ |
4726 | public void setColorRed() { |
4727 | this.color = new Color(255, 0, 0, 255); |
4728 | this.setForegroundColor(new Color(255, 0, 0, 255)); |
4729 | - sendNotification(new PropertyChangedEvent(this, "foregroundColor")); |
4730 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_FOREGROUND_COLOR)); |
4731 | } |
4732 | |
4733 | @Override |
4734 | |
4735 | === modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualSourceComponent.java' |
4736 | --- XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualSourceComponent.java 2013-11-05 18:01:19 +0000 |
4737 | +++ XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualSourceComponent.java 2015-06-26 22:23:53 +0000 |
4738 | @@ -37,6 +37,8 @@ |
4739 | @Hotkey(KeyEvent.VK_I) |
4740 | @SVGIcon("images/icons/svg/xmas-source.svg") |
4741 | public class VisualSourceComponent extends VisualXmasComponent { |
4742 | + public static final String PROPERTY_FOREGROUND_COLOR = "Foreground color"; |
4743 | + |
4744 | public Color color = new Color(0, 255, 0, 255); |
4745 | |
4746 | public VisualSourceComponent(SourceComponent component) { |
4747 | @@ -49,7 +51,7 @@ |
4748 | public void setColorRed() { |
4749 | this.color = new Color(255, 0, 0, 255); |
4750 | this.setForegroundColor(new Color(255, 0, 0, 255)); |
4751 | - sendNotification(new PropertyChangedEvent(this, "foregroundColor")); |
4752 | + sendNotification(new PropertyChangedEvent(this, PROPERTY_FOREGROUND_COLOR)); |
4753 | } |
4754 | |
4755 | @Override |
4756 | |
4757 | === modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualXmasContact.java' |
4758 | --- XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualXmasContact.java 2015-04-13 18:41:37 +0000 |
4759 | +++ XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualXmasContact.java 2015-06-26 22:23:53 +0000 |
4760 | @@ -41,6 +41,8 @@ |
4761 | |
4762 | |
4763 | public class VisualXmasContact extends VisualComponent implements StateObserver { |
4764 | + public static final String IO_TYPE_PROPERTY_NAME = "IOtype"; |
4765 | + |
4766 | private double size = 0.4; |
4767 | |
4768 | public VisualXmasContact(XmasContact contact) { |
4769 | @@ -70,7 +72,7 @@ |
4770 | |
4771 | public void setIOType(XmasContact.IOType type) { |
4772 | getReferencedContact().setIOType(type); |
4773 | - sendNotification(new PropertyChangedEvent(this, "IOtype")); |
4774 | + sendNotification(new PropertyChangedEvent(this, IO_TYPE_PROPERTY_NAME)); |
4775 | } |
4776 | |
4777 | public XmasContact.IOType getIOType() { |