Merge lp:~danilovesky/workcraft/trunk-bug-1321714 into lp:workcraft
- trunk-bug-1321714
- Merge into trunk
Proposed by
Danil Sokolov
Status: | Merged |
---|---|
Merged at revision: | 520 |
Proposed branch: | lp:~danilovesky/workcraft/trunk-bug-1321714 |
Merge into: | lp:workcraft |
Diff against target: |
568 lines (+121/-83) 19 files modified
CircuitPlugin/src/org/workcraft/plugins/circuit/VisualCircuitComponent.java (+6/-0) GraphPlugin/src/org/workcraft/plugins/graph/ToolsProvider.java (+0/-3) SONPlugin/src/org/workcraft/plugins/son/SONToolProvider.java (+0/-3) WorkcraftCore/src/org/workcraft/Framework.java (+6/-10) WorkcraftCore/src/org/workcraft/dom/AbstractGroup.java (+50/-41) WorkcraftCore/src/org/workcraft/dom/DefaultHangingConnectionRemover.java (+1/-1) WorkcraftCore/src/org/workcraft/dom/math/MathConnection.java (+2/-1) WorkcraftCore/src/org/workcraft/dom/math/MathGroup.java (+13/-9) WorkcraftCore/src/org/workcraft/dom/visual/AbstractVisualModel.java (+1/-5) WorkcraftCore/src/org/workcraft/dom/visual/VisualGroup.java (+4/-0) WorkcraftCore/src/org/workcraft/dom/visual/VisualPage.java (+4/-0) WorkcraftCore/src/org/workcraft/dom/visual/connections/Polyline.java (+5/-1) WorkcraftCore/src/org/workcraft/dom/visual/connections/VisualConnection.java (+6/-0) WorkcraftCore/src/org/workcraft/gui/graph/tools/PageGeneratorTool.java (+1/-3) WorkcraftCore/src/org/workcraft/observation/ObservableHierarchy.java (+1/-0) WorkcraftCore/src/org/workcraft/observation/ObservableHierarchyImpl.java (+4/-0) WorkcraftCore/src/org/workcraft/workspace/WorkspaceEntry.java (+6/-6) XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualXmasComponent.java (+6/-0) XmasPlugin/src/org/workcraft/plugins/xmas/components/XmasComponent.java (+5/-0) |
To merge this branch: | bzr merge lp:~danilovesky/workcraft/trunk-bug-1321714 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Danil Sokolov | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
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/VisualCircuitComponent.java' | |||
2 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/VisualCircuitComponent.java 2014-07-08 11:51:21 +0000 | |||
3 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/VisualCircuitComponent.java 2014-07-16 10:33:39 +0000 | |||
4 | @@ -631,5 +631,11 @@ | |||
5 | 631 | public void removeObserver(HierarchyObserver obs) { | 631 | public void removeObserver(HierarchyObserver obs) { |
6 | 632 | groupImpl.removeObserver(obs); | 632 | groupImpl.removeObserver(obs); |
7 | 633 | } | 633 | } |
8 | 634 | |||
9 | 635 | @Override | ||
10 | 636 | public void removeAllObservers() { | ||
11 | 637 | groupImpl.removeAllObservers(); | ||
12 | 638 | } | ||
13 | 639 | |||
14 | 634 | 640 | ||
15 | 635 | } | 641 | } |
16 | 636 | 642 | ||
17 | === modified file 'GraphPlugin/src/org/workcraft/plugins/graph/ToolsProvider.java' | |||
18 | --- GraphPlugin/src/org/workcraft/plugins/graph/ToolsProvider.java 2014-02-27 09:22:57 +0000 | |||
19 | +++ GraphPlugin/src/org/workcraft/plugins/graph/ToolsProvider.java 2014-07-16 10:33:39 +0000 | |||
20 | @@ -2,14 +2,12 @@ | |||
21 | 2 | 2 | ||
22 | 3 | import java.util.ArrayList; | 3 | import java.util.ArrayList; |
23 | 4 | 4 | ||
24 | 5 | import org.workcraft.dom.math.PageNode; | ||
25 | 6 | import org.workcraft.gui.graph.tools.CommentGeneratorTool; | 5 | import org.workcraft.gui.graph.tools.CommentGeneratorTool; |
26 | 7 | import org.workcraft.gui.graph.tools.ConnectionTool; | 6 | import org.workcraft.gui.graph.tools.ConnectionTool; |
27 | 8 | import org.workcraft.gui.graph.tools.CustomToolsProvider; | 7 | import org.workcraft.gui.graph.tools.CustomToolsProvider; |
28 | 9 | import org.workcraft.gui.graph.tools.DefaultNodeGenerator; | 8 | import org.workcraft.gui.graph.tools.DefaultNodeGenerator; |
29 | 10 | import org.workcraft.gui.graph.tools.GraphEditorTool; | 9 | import org.workcraft.gui.graph.tools.GraphEditorTool; |
30 | 11 | import org.workcraft.gui.graph.tools.NodeGeneratorTool; | 10 | import org.workcraft.gui.graph.tools.NodeGeneratorTool; |
31 | 12 | import org.workcraft.gui.graph.tools.PageGeneratorTool; | ||
32 | 13 | import org.workcraft.gui.graph.tools.SelectionTool; | 11 | import org.workcraft.gui.graph.tools.SelectionTool; |
33 | 14 | 12 | ||
34 | 15 | public class ToolsProvider implements CustomToolsProvider { | 13 | public class ToolsProvider implements CustomToolsProvider { |
35 | @@ -20,7 +18,6 @@ | |||
36 | 20 | 18 | ||
37 | 21 | result.add(new SelectionTool()); | 19 | result.add(new SelectionTool()); |
38 | 22 | result.add(new CommentGeneratorTool()); | 20 | result.add(new CommentGeneratorTool()); |
39 | 23 | result.add(new PageGeneratorTool(new DefaultNodeGenerator(PageNode.class))); | ||
40 | 24 | result.add(new ConnectionTool(true, false)); | 21 | result.add(new ConnectionTool(true, false)); |
41 | 25 | result.add(new NodeGeneratorTool(new DefaultNodeGenerator(Vertex.class))); | 22 | result.add(new NodeGeneratorTool(new DefaultNodeGenerator(Vertex.class))); |
42 | 26 | return result; | 23 | return result; |
43 | 27 | 24 | ||
44 | === modified file 'SONPlugin/src/org/workcraft/plugins/son/SONToolProvider.java' | |||
45 | --- SONPlugin/src/org/workcraft/plugins/son/SONToolProvider.java 2014-04-30 08:14:53 +0000 | |||
46 | +++ SONPlugin/src/org/workcraft/plugins/son/SONToolProvider.java 2014-07-16 10:33:39 +0000 | |||
47 | @@ -2,13 +2,11 @@ | |||
48 | 2 | 2 | ||
49 | 3 | import java.util.ArrayList; | 3 | import java.util.ArrayList; |
50 | 4 | 4 | ||
51 | 5 | import org.workcraft.dom.math.PageNode; | ||
52 | 6 | import org.workcraft.gui.graph.tools.CommentGeneratorTool; | 5 | import org.workcraft.gui.graph.tools.CommentGeneratorTool; |
53 | 7 | import org.workcraft.gui.graph.tools.CustomToolsProvider; | 6 | import org.workcraft.gui.graph.tools.CustomToolsProvider; |
54 | 8 | import org.workcraft.gui.graph.tools.DefaultNodeGenerator; | 7 | import org.workcraft.gui.graph.tools.DefaultNodeGenerator; |
55 | 9 | import org.workcraft.gui.graph.tools.GraphEditorTool; | 8 | import org.workcraft.gui.graph.tools.GraphEditorTool; |
56 | 10 | import org.workcraft.gui.graph.tools.NodeGeneratorTool; | 9 | import org.workcraft.gui.graph.tools.NodeGeneratorTool; |
57 | 11 | import org.workcraft.gui.graph.tools.PageGeneratorTool; | ||
58 | 12 | import org.workcraft.plugins.son.elements.ChannelPlace; | 10 | import org.workcraft.plugins.son.elements.ChannelPlace; |
59 | 13 | import org.workcraft.plugins.son.elements.Condition; | 11 | import org.workcraft.plugins.son.elements.Condition; |
60 | 14 | import org.workcraft.plugins.son.elements.Event; | 12 | import org.workcraft.plugins.son.elements.Event; |
61 | @@ -23,7 +21,6 @@ | |||
62 | 23 | ArrayList<GraphEditorTool> result = new ArrayList<GraphEditorTool>(); | 21 | ArrayList<GraphEditorTool> result = new ArrayList<GraphEditorTool>(); |
63 | 24 | GraphEditorTool channelPlaceTool = new NodeGeneratorTool(new DefaultNodeGenerator(ChannelPlace.class)); | 22 | GraphEditorTool channelPlaceTool = new NodeGeneratorTool(new DefaultNodeGenerator(ChannelPlace.class)); |
64 | 25 | result.add(new SelectionTool(channelPlaceTool)); | 23 | result.add(new SelectionTool(channelPlaceTool)); |
65 | 26 | result.add(new PageGeneratorTool(new DefaultNodeGenerator(PageNode.class))); | ||
66 | 27 | result.add(new CommentGeneratorTool()); | 24 | result.add(new CommentGeneratorTool()); |
67 | 28 | result.add(new SONConnectionTool()); | 25 | result.add(new SONConnectionTool()); |
68 | 29 | result.add(new NodeGeneratorTool(new DefaultNodeGenerator(Condition.class))); | 26 | result.add(new NodeGeneratorTool(new DefaultNodeGenerator(Condition.class))); |
69 | 30 | 27 | ||
70 | === modified file 'WorkcraftCore/src/org/workcraft/Framework.java' | |||
71 | --- WorkcraftCore/src/org/workcraft/Framework.java 2014-06-25 19:35:02 +0000 | |||
72 | +++ WorkcraftCore/src/org/workcraft/Framework.java 2014-07-16 10:33:39 +0000 | |||
73 | @@ -69,11 +69,9 @@ | |||
74 | 69 | import org.workcraft.gui.propertyeditor.SettingsPage; | 69 | import org.workcraft.gui.propertyeditor.SettingsPage; |
75 | 70 | import org.workcraft.interop.Importer; | 70 | import org.workcraft.interop.Importer; |
76 | 71 | import org.workcraft.plugins.PluginInfo; | 71 | import org.workcraft.plugins.PluginInfo; |
77 | 72 | import org.workcraft.plugins.serialisation.XMLDualModelDeserialiser; | ||
78 | 73 | import org.workcraft.plugins.serialisation.XMLModelDeserialiser; | 72 | import org.workcraft.plugins.serialisation.XMLModelDeserialiser; |
79 | 74 | import org.workcraft.plugins.serialisation.XMLModelSerialiser; | 73 | import org.workcraft.plugins.serialisation.XMLModelSerialiser; |
80 | 75 | import org.workcraft.serialisation.DeserialisationResult; | 74 | import org.workcraft.serialisation.DeserialisationResult; |
81 | 76 | import org.workcraft.serialisation.DualDeserialisationResult; | ||
82 | 77 | import org.workcraft.serialisation.ModelSerialiser; | 75 | import org.workcraft.serialisation.ModelSerialiser; |
83 | 78 | import org.workcraft.serialisation.ReferenceProducer; | 76 | import org.workcraft.serialisation.ReferenceProducer; |
84 | 79 | import org.workcraft.serialisation.References; | 77 | import org.workcraft.serialisation.References; |
85 | @@ -663,28 +661,26 @@ | |||
86 | 663 | } | 661 | } |
87 | 664 | 662 | ||
88 | 665 | public ModelEntry load(InputStream is1, InputStream is2) throws DeserialisationException { | 663 | public ModelEntry load(InputStream is1, InputStream is2) throws DeserialisationException { |
89 | 666 | |||
90 | 667 | ModelEntry me1 = load(is1); | 664 | ModelEntry me1 = load(is1); |
91 | 668 | ModelEntry me2 = load(is2); | 665 | ModelEntry me2 = load(is2); |
92 | 669 | 666 | ||
93 | 670 | VisualModel vmodel1 = me1.getVisualModel(); | 667 | VisualModel vmodel1 = me1.getVisualModel(); |
94 | 671 | VisualModel vmodel2 = me2.getVisualModel(); | 668 | VisualModel vmodel2 = me2.getVisualModel(); |
95 | 672 | 669 | ||
99 | 673 | if (!me1.getDescriptor().getDisplayName().equals( | 670 | if (!me1.getDescriptor().getDisplayName().equals(me2.getDescriptor().getDisplayName())) { |
100 | 674 | me2.getDescriptor().getDisplayName())) { | 671 | throw new DeserialisationException("Incompatible models cannot be merged"); |
98 | 675 | throw new DeserialisationException("incompatible models cannot be merged"); | ||
101 | 676 | } | 672 | } |
102 | 677 | 673 | ||
103 | 678 | |||
104 | 679 | Collection<Node> children = new HashSet<Node>(vmodel2.getRoot().getChildren()); | 674 | Collection<Node> children = new HashSet<Node>(vmodel2.getRoot().getChildren()); |
105 | 680 | 675 | ||
106 | 681 | vmodel1.selectNone(); | 676 | vmodel1.selectNone(); |
107 | 682 | vmodel1.reparent(vmodel1.getCurrentLevel(), vmodel2, vmodel2.getRoot(), null); | 677 | vmodel1.reparent(vmodel1.getCurrentLevel(), vmodel2, vmodel2.getRoot(), null); |
108 | 683 | vmodel1.select(children); | 678 | vmodel1.select(children); |
109 | 684 | 679 | ||
113 | 685 | return me1; | 680 | // FIXME: dirty hack to avoid any hanging observers (serialise and deserialise the model) |
114 | 686 | 681 | Memento memo = save(me1); | |
115 | 687 | 682 | ModelEntry me3 = load(memo); | |
116 | 683 | return me3; | ||
117 | 688 | } | 684 | } |
118 | 689 | 685 | ||
119 | 690 | // old implementation for reference | 686 | // old implementation for reference |
120 | 691 | 687 | ||
121 | === modified file 'WorkcraftCore/src/org/workcraft/dom/AbstractGroup.java' | |||
122 | --- WorkcraftCore/src/org/workcraft/dom/AbstractGroup.java 2014-06-29 17:47:02 +0000 | |||
123 | +++ WorkcraftCore/src/org/workcraft/dom/AbstractGroup.java 2014-07-16 10:33:39 +0000 | |||
124 | @@ -65,35 +65,38 @@ | |||
125 | 65 | 65 | ||
126 | 66 | protected void postAdd(Node node, boolean notify) { | 66 | protected void postAdd(Node node, boolean notify) { |
127 | 67 | node.setParent(groupRef); | 67 | node.setParent(groupRef); |
130 | 68 | 68 | if (notify) { | |
129 | 69 | if (notify) | ||
131 | 70 | observableHierarchyImpl.sendNotification (new NodesAddedEvent(groupRef, node)); | 69 | observableHierarchyImpl.sendNotification (new NodesAddedEvent(groupRef, node)); |
132 | 70 | } | ||
133 | 71 | } | 71 | } |
134 | 72 | 72 | ||
135 | 73 | protected void preAdd(Node node, boolean notify) { | 73 | protected void preAdd(Node node, boolean notify) { |
137 | 74 | if (node.getParent() == this) | 74 | if (node.getParent() == this) { |
138 | 75 | return; | 75 | return; |
141 | 76 | 76 | } | |
142 | 77 | if (node.getParent() != null && node.getParent() != groupRef) | 77 | if ((node.getParent() != null) && (node.getParent() != groupRef)) { |
143 | 78 | throw new RuntimeException("Cannot attach someone else's node. Please detach from the old parent first."); | 78 | throw new RuntimeException("Cannot attach someone else's node. Please detach from the old parent first."); |
146 | 79 | 79 | } | |
147 | 80 | if (notify) | 80 | if (notify) { |
148 | 81 | observableHierarchyImpl.sendNotification (new NodesAddingEvent(groupRef, node)); | 81 | observableHierarchyImpl.sendNotification (new NodesAddingEvent(groupRef, node)); |
149 | 82 | } | ||
150 | 82 | } | 83 | } |
151 | 83 | 84 | ||
152 | 84 | protected void removeInternal(Node node, boolean notify) { | 85 | protected void removeInternal(Node node, boolean notify) { |
154 | 85 | if (notify) | 86 | if (notify) { |
155 | 86 | observableHierarchyImpl.sendNotification(new NodesDeletingEvent(groupRef, node)); | 87 | observableHierarchyImpl.sendNotification(new NodesDeletingEvent(groupRef, node)); |
161 | 87 | 88 | } | |
162 | 88 | if (node.getParent() != groupRef) | 89 | if (node.getParent() != groupRef) { |
163 | 89 | throw new RuntimeException | 90 | throw new RuntimeException( |
164 | 90 | ("Failed to remove a node frome a group because it is not a child of that group ("+node+", parent is " + node.getParent() +", expected " + groupRef + ")"); | 91 | "Failed to remove a node frome a group because it is not a child of that group (" |
165 | 91 | 92 | + node + ", parent is " + node.getParent() + ", expected " + groupRef + ")"); | |
166 | 93 | } | ||
167 | 92 | removeInternal(node); | 94 | removeInternal(node); |
168 | 93 | node.setParent(null); | 95 | node.setParent(null); |
169 | 94 | 96 | ||
171 | 95 | if (notify) | 97 | if (notify) { |
172 | 96 | observableHierarchyImpl.sendNotification (new NodesDeletedEvent(groupRef, node)); | 98 | observableHierarchyImpl.sendNotification (new NodesDeletedEvent(groupRef, node)); |
173 | 99 | } | ||
174 | 97 | } | 100 | } |
175 | 98 | 101 | ||
176 | 99 | public void addObserver(HierarchyObserver obs) { | 102 | public void addObserver(HierarchyObserver obs) { |
177 | @@ -103,6 +106,10 @@ | |||
178 | 103 | public void removeObserver(HierarchyObserver obs) { | 106 | public void removeObserver(HierarchyObserver obs) { |
179 | 104 | observableHierarchyImpl.removeObserver(obs); | 107 | observableHierarchyImpl.removeObserver(obs); |
180 | 105 | } | 108 | } |
181 | 109 | |||
182 | 110 | public void removeAllObservers() { | ||
183 | 111 | observableHierarchyImpl.removeAllObservers(); | ||
184 | 112 | } | ||
185 | 106 | 113 | ||
186 | 107 | @Override | 114 | @Override |
187 | 108 | public void add(Node node) { | 115 | public void add(Node node) { |
188 | @@ -112,10 +119,9 @@ | |||
189 | 112 | @Override | 119 | @Override |
190 | 113 | public void add(Collection<Node> nodes) { | 120 | public void add(Collection<Node> nodes) { |
191 | 114 | observableHierarchyImpl.sendNotification (new NodesAddingEvent(groupRef, nodes)); | 121 | observableHierarchyImpl.sendNotification (new NodesAddingEvent(groupRef, nodes)); |
194 | 115 | 122 | for (Node node : nodes) { | |
193 | 116 | for (Node node : nodes) | ||
195 | 117 | addInternal(node, false); | 123 | addInternal(node, false); |
197 | 118 | 124 | } | |
198 | 119 | observableHierarchyImpl.sendNotification (new NodesAddedEvent(groupRef, nodes)); | 125 | observableHierarchyImpl.sendNotification (new NodesAddedEvent(groupRef, nodes)); |
199 | 120 | } | 126 | } |
200 | 121 | 127 | ||
201 | @@ -127,40 +133,42 @@ | |||
202 | 127 | @Override | 133 | @Override |
203 | 128 | public void remove(Collection<Node> nodes) { | 134 | public void remove(Collection<Node> nodes) { |
204 | 129 | LinkedList<Node> nodesToRemove = new LinkedList<Node>(nodes); | 135 | LinkedList<Node> nodesToRemove = new LinkedList<Node>(nodes); |
205 | 130 | |||
206 | 131 | observableHierarchyImpl.sendNotification(new NodesDeletingEvent(groupRef, nodesToRemove)); | 136 | observableHierarchyImpl.sendNotification(new NodesDeletingEvent(groupRef, nodesToRemove)); |
209 | 132 | 137 | for (Node node : nodesToRemove) { | |
208 | 133 | for (Node node : nodesToRemove) | ||
210 | 134 | removeInternal(node, false); | 138 | removeInternal(node, false); |
212 | 135 | 139 | } | |
213 | 136 | observableHierarchyImpl.sendNotification (new NodesDeletedEvent(groupRef, nodesToRemove)); | 140 | observableHierarchyImpl.sendNotification (new NodesDeletedEvent(groupRef, nodesToRemove)); |
214 | 137 | } | 141 | } |
215 | 138 | |||
216 | 139 | |||
217 | 140 | |||
218 | 141 | 142 | ||
219 | 142 | @Override | 143 | @Override |
220 | 143 | public void reparent(Collection<Node> nodes, Container newParent) { | 144 | public void reparent(Collection<Node> nodes, Container newParent) { |
221 | 144 | observableHierarchyImpl.sendNotification(new NodesReparentingEvent(groupRef, newParent, nodes)); | 145 | observableHierarchyImpl.sendNotification(new NodesReparentingEvent(groupRef, newParent, nodes)); |
230 | 145 | 146 | for (Node node: nodes) { | |
223 | 146 | //HashSet<Node> newModelNodes= new HashSet<Node>(); | ||
224 | 147 | boolean differentModels = false; | ||
225 | 148 | |||
226 | 149 | for (Node node : nodes) { | ||
227 | 150 | |||
228 | 151 | if (Hierarchy.getTopParent(newParent)!=Hierarchy.getTopParent(node)) differentModels = true; | ||
229 | 152 | |||
231 | 153 | removeInternal(node, false); | 147 | removeInternal(node, false); |
240 | 154 | 148 | } | |
241 | 155 | } | 149 | if (!isSameModel(nodes, newParent)) { |
242 | 156 | 150 | // If the model is not the same, then remove all node listeners | |
243 | 157 | if (differentModels) | 151 | for (Node node: nodes) { |
244 | 158 | newParent.add(nodes); | 152 | if (node instanceof ObservableHierarchy) { |
245 | 159 | else | 153 | ((ObservableHierarchy) node).removeAllObservers(); |
246 | 160 | newParent.reparent(nodes); | 154 | } |
247 | 161 | 155 | } | |
248 | 156 | } | ||
249 | 157 | newParent.add(nodes); | ||
250 | 162 | observableHierarchyImpl.sendNotification(new NodesReparentedEvent(groupRef, newParent, nodes)); | 158 | observableHierarchyImpl.sendNotification(new NodesReparentedEvent(groupRef, newParent, nodes)); |
251 | 163 | } | 159 | } |
252 | 160 | |||
253 | 161 | private boolean isSameModel(Collection<Node> nodes, Container newParent) { | ||
254 | 162 | Node newRoot = Hierarchy.getTopParent(newParent); | ||
255 | 163 | boolean sameModel = true; | ||
256 | 164 | for (Node node : nodes) { | ||
257 | 165 | if (newRoot != Hierarchy.getTopParent(node)) { | ||
258 | 166 | sameModel = false; | ||
259 | 167 | break; | ||
260 | 168 | } | ||
261 | 169 | } | ||
262 | 170 | return sameModel; | ||
263 | 171 | } | ||
264 | 164 | 172 | ||
265 | 165 | @Override | 173 | @Override |
266 | 166 | public void reparent (Collection<Node> nodes) { | 174 | public void reparent (Collection<Node> nodes) { |
267 | @@ -173,5 +181,6 @@ | |||
268 | 173 | public abstract Collection<Node> getChildren(); | 181 | public abstract Collection<Node> getChildren(); |
269 | 174 | 182 | ||
270 | 175 | protected abstract void addInternal(Node node); | 183 | protected abstract void addInternal(Node node); |
271 | 184 | |||
272 | 176 | protected abstract void removeInternal (Node node); | 185 | protected abstract void removeInternal (Node node); |
273 | 177 | } | ||
274 | 178 | \ No newline at end of file | 186 | \ No newline at end of file |
275 | 187 | } | ||
276 | 179 | 188 | ||
277 | === modified file 'WorkcraftCore/src/org/workcraft/dom/DefaultHangingConnectionRemover.java' | |||
278 | --- WorkcraftCore/src/org/workcraft/dom/DefaultHangingConnectionRemover.java 2013-10-31 11:44:01 +0000 | |||
279 | +++ WorkcraftCore/src/org/workcraft/dom/DefaultHangingConnectionRemover.java 2014-07-16 10:33:39 +0000 | |||
280 | @@ -53,7 +53,7 @@ | |||
281 | 53 | 53 | ||
282 | 54 | for (Node node : e.getAffectedNodes()) | 54 | for (Node node : e.getAffectedNodes()) |
283 | 55 | findHangingConnections(node, hangingConnections, hanging); | 55 | findHangingConnections(node, hangingConnections, hanging); |
285 | 56 | 56 | ||
286 | 57 | for (Connection con : hangingConnections) | 57 | for (Connection con : hangingConnections) |
287 | 58 | if (con.getParent() instanceof Container) | 58 | if (con.getParent() instanceof Container) |
288 | 59 | ((Container)con.getParent()).remove(con); | 59 | ((Container)con.getParent()).remove(con); |
289 | 60 | 60 | ||
290 | === modified file 'WorkcraftCore/src/org/workcraft/dom/math/MathConnection.java' | |||
291 | --- WorkcraftCore/src/org/workcraft/dom/math/MathConnection.java 2013-09-10 09:54:55 +0000 | |||
292 | +++ WorkcraftCore/src/org/workcraft/dom/math/MathConnection.java 2014-07-16 10:33:39 +0000 | |||
293 | @@ -23,6 +23,7 @@ | |||
294 | 23 | 23 | ||
295 | 24 | import org.workcraft.annotations.VisualClass; | 24 | import org.workcraft.annotations.VisualClass; |
296 | 25 | import org.workcraft.dom.Connection; | 25 | import org.workcraft.dom.Connection; |
297 | 26 | import org.workcraft.dom.Node; | ||
298 | 26 | 27 | ||
299 | 27 | @VisualClass(org.workcraft.dom.visual.connections.VisualConnection.class) | 28 | @VisualClass(org.workcraft.dom.visual.connections.VisualConnection.class) |
300 | 28 | public class MathConnection extends MathNode implements Connection { | 29 | public class MathConnection extends MathNode implements Connection { |
301 | @@ -36,7 +37,7 @@ | |||
302 | 36 | super(); | 37 | super(); |
303 | 37 | setDependencies(first, second); | 38 | setDependencies(first, second); |
304 | 38 | } | 39 | } |
306 | 39 | 40 | ||
307 | 40 | final public MathNode getFirst() { | 41 | final public MathNode getFirst() { |
308 | 41 | return first; | 42 | return first; |
309 | 42 | } | 43 | } |
310 | 43 | 44 | ||
311 | === modified file 'WorkcraftCore/src/org/workcraft/dom/math/MathGroup.java' | |||
312 | --- WorkcraftCore/src/org/workcraft/dom/math/MathGroup.java 2014-04-28 18:05:39 +0000 | |||
313 | +++ WorkcraftCore/src/org/workcraft/dom/math/MathGroup.java 2014-07-16 10:33:39 +0000 | |||
314 | @@ -22,17 +22,16 @@ | |||
315 | 22 | package org.workcraft.dom.math; | 22 | package org.workcraft.dom.math; |
316 | 23 | 23 | ||
317 | 24 | import java.util.ArrayList; | 24 | import java.util.ArrayList; |
323 | 25 | import java.util.Collection; | 25 | import java.util.Collection; |
324 | 26 | 26 | ||
325 | 27 | import org.workcraft.dom.Container; | 27 | import org.workcraft.dom.Container; |
326 | 28 | import org.workcraft.dom.DefaultGroupImpl; | 28 | import org.workcraft.dom.DefaultGroupImpl; |
327 | 29 | import org.workcraft.dom.Node; | 29 | import org.workcraft.dom.Node; |
328 | 30 | import org.workcraft.dom.hierarchy.NamespaceProvider; | 30 | import org.workcraft.dom.hierarchy.NamespaceProvider; |
329 | 31 | import org.workcraft.dom.references.HierarchicalUniqueNameReferenceManager; | 31 | import org.workcraft.dom.references.HierarchicalUniqueNameReferenceManager; |
330 | 32 | import org.workcraft.dom.references.ReferenceManager; | 32 | import org.workcraft.dom.references.ReferenceManager; |
334 | 33 | import org.workcraft.dom.visual.TransformHelper; | 33 | import org.workcraft.observation.HierarchyObserver; |
335 | 34 | import org.workcraft.observation.HierarchyObserver; | 34 | import org.workcraft.observation.ObservableHierarchy; |
333 | 35 | import org.workcraft.observation.ObservableHierarchy; | ||
336 | 36 | import org.workcraft.util.Hierarchy; | 35 | import org.workcraft.util.Hierarchy; |
337 | 37 | 36 | ||
338 | 38 | public class MathGroup extends MathNode implements NamespaceProvider, ObservableHierarchy, Container { | 37 | public class MathGroup extends MathNode implements NamespaceProvider, ObservableHierarchy, Container { |
339 | @@ -66,7 +65,12 @@ | |||
340 | 66 | @Override | 65 | @Override |
341 | 67 | public void removeObserver(HierarchyObserver obs) { | 66 | public void removeObserver(HierarchyObserver obs) { |
342 | 68 | groupImpl.removeObserver(obs); | 67 | groupImpl.removeObserver(obs); |
344 | 69 | } | 68 | } |
345 | 69 | |||
346 | 70 | @Override | ||
347 | 71 | public void removeAllObservers() { | ||
348 | 72 | groupImpl.removeAllObservers(); | ||
349 | 73 | } | ||
350 | 70 | 74 | ||
351 | 71 | @Override | 75 | @Override |
352 | 72 | public void setParent(Node parent) { | 76 | public void setParent(Node parent) { |
353 | 73 | 77 | ||
354 | === modified file 'WorkcraftCore/src/org/workcraft/dom/visual/AbstractVisualModel.java' | |||
355 | --- WorkcraftCore/src/org/workcraft/dom/visual/AbstractVisualModel.java 2014-07-11 09:28:08 +0000 | |||
356 | +++ WorkcraftCore/src/org/workcraft/dom/visual/AbstractVisualModel.java 2014-07-16 10:33:39 +0000 | |||
357 | @@ -627,11 +627,7 @@ | |||
358 | 627 | 627 | ||
359 | 628 | Collection<Node> children = new HashSet<Node>(); | 628 | Collection<Node> children = new HashSet<Node>(); |
360 | 629 | 629 | ||
366 | 630 | if (sourceChildren==null) { | 630 | children.addAll(sourceChildren); |
362 | 631 | children.addAll(sourceRoot.getChildren()); | ||
363 | 632 | } else { | ||
364 | 633 | children.addAll(sourceChildren); | ||
365 | 634 | } | ||
367 | 635 | 631 | ||
368 | 636 | sourceRoot.reparent(children, targetContainer); | 632 | sourceRoot.reparent(children, targetContainer); |
369 | 637 | 633 | ||
370 | 638 | 634 | ||
371 | === modified file 'WorkcraftCore/src/org/workcraft/dom/visual/VisualGroup.java' | |||
372 | --- WorkcraftCore/src/org/workcraft/dom/visual/VisualGroup.java 2014-06-29 17:47:02 +0000 | |||
373 | +++ WorkcraftCore/src/org/workcraft/dom/visual/VisualGroup.java 2014-07-16 10:33:39 +0000 | |||
374 | @@ -223,6 +223,10 @@ | |||
375 | 223 | groupImpl.removeObserver(obs); | 223 | groupImpl.removeObserver(obs); |
376 | 224 | } | 224 | } |
377 | 225 | 225 | ||
378 | 226 | @Override | ||
379 | 227 | public void removeAllObservers() { | ||
380 | 228 | groupImpl.removeAllObservers(); | ||
381 | 229 | } | ||
382 | 226 | 230 | ||
383 | 227 | @Override | 231 | @Override |
384 | 228 | public void setParent(Node parent) { | 232 | public void setParent(Node parent) { |
385 | 229 | 233 | ||
386 | === modified file 'WorkcraftCore/src/org/workcraft/dom/visual/VisualPage.java' | |||
387 | --- WorkcraftCore/src/org/workcraft/dom/visual/VisualPage.java 2014-06-26 08:11:52 +0000 | |||
388 | +++ WorkcraftCore/src/org/workcraft/dom/visual/VisualPage.java 2014-07-16 10:33:39 +0000 | |||
389 | @@ -170,6 +170,10 @@ | |||
390 | 170 | groupImpl.removeObserver(obs); | 170 | groupImpl.removeObserver(obs); |
391 | 171 | } | 171 | } |
392 | 172 | 172 | ||
393 | 173 | @Override | ||
394 | 174 | public void removeAllObservers() { | ||
395 | 175 | groupImpl.removeAllObservers(); | ||
396 | 176 | } | ||
397 | 173 | 177 | ||
398 | 174 | @Override | 178 | @Override |
399 | 175 | public void setParent(Node parent) { | 179 | public void setParent(Node parent) { |
400 | 176 | 180 | ||
401 | === modified file 'WorkcraftCore/src/org/workcraft/dom/visual/connections/Polyline.java' | |||
402 | --- WorkcraftCore/src/org/workcraft/dom/visual/connections/Polyline.java 2013-10-21 17:36:57 +0000 | |||
403 | +++ WorkcraftCore/src/org/workcraft/dom/visual/connections/Polyline.java 2014-07-16 10:33:39 +0000 | |||
404 | @@ -276,7 +276,11 @@ | |||
405 | 276 | 276 | ||
406 | 277 | public void removeObserver(HierarchyObserver obs) { | 277 | public void removeObserver(HierarchyObserver obs) { |
407 | 278 | groupImpl.removeObserver(obs); | 278 | groupImpl.removeObserver(obs); |
409 | 279 | } | 279 | } |
410 | 280 | |||
411 | 281 | public void removeAllObservers() { | ||
412 | 282 | groupImpl.removeAllObservers(); | ||
413 | 283 | } | ||
414 | 280 | 284 | ||
415 | 281 | public void reparent(Collection<Node> nodes, Container newParent) { | 285 | public void reparent(Collection<Node> nodes, Container newParent) { |
416 | 282 | groupImpl.reparent(nodes, newParent); | 286 | groupImpl.reparent(nodes, newParent); |
417 | 283 | 287 | ||
418 | === modified file 'WorkcraftCore/src/org/workcraft/dom/visual/connections/VisualConnection.java' | |||
419 | --- WorkcraftCore/src/org/workcraft/dom/visual/connections/VisualConnection.java 2014-06-05 11:46:41 +0000 | |||
420 | +++ WorkcraftCore/src/org/workcraft/dom/visual/connections/VisualConnection.java 2014-07-16 10:33:39 +0000 | |||
421 | @@ -457,6 +457,12 @@ | |||
422 | 457 | public void removeObserver(HierarchyObserver obs) { | 457 | public void removeObserver(HierarchyObserver obs) { |
423 | 458 | observableHierarchyImpl.removeObserver(obs); | 458 | observableHierarchyImpl.removeObserver(obs); |
424 | 459 | } | 459 | } |
425 | 460 | |||
426 | 461 | public void removeAllObservers() { | ||
427 | 462 | observableHierarchyImpl.removeAllObservers(); | ||
428 | 463 | } | ||
429 | 464 | |||
430 | 465 | |||
431 | 460 | @Override | 466 | @Override |
432 | 461 | public Point2D getFirstCenter() { | 467 | public Point2D getFirstCenter() { |
433 | 462 | return componentsTransformObserver.getFirstCenter(); | 468 | return componentsTransformObserver.getFirstCenter(); |
434 | 463 | 469 | ||
435 | === modified file 'WorkcraftCore/src/org/workcraft/gui/graph/tools/PageGeneratorTool.java' | |||
436 | --- WorkcraftCore/src/org/workcraft/gui/graph/tools/PageGeneratorTool.java 2014-02-27 09:22:57 +0000 | |||
437 | +++ WorkcraftCore/src/org/workcraft/gui/graph/tools/PageGeneratorTool.java 2014-07-16 10:33:39 +0000 | |||
438 | @@ -1,6 +1,5 @@ | |||
439 | 1 | package org.workcraft.gui.graph.tools; | 1 | package org.workcraft.gui.graph.tools; |
440 | 2 | 2 | ||
441 | 3 | import org.workcraft.dom.math.CommentNode; | ||
442 | 4 | import org.workcraft.dom.math.MathNode; | 3 | import org.workcraft.dom.math.MathNode; |
443 | 5 | import org.workcraft.dom.math.PageNode; | 4 | import org.workcraft.dom.math.PageNode; |
444 | 6 | import org.workcraft.exceptions.NodeCreationException; | 5 | import org.workcraft.exceptions.NodeCreationException; |
445 | @@ -11,8 +10,7 @@ | |||
446 | 11 | super(new DefaultNodeGenerator(PageNode.class) | 10 | super(new DefaultNodeGenerator(PageNode.class) |
447 | 12 | { | 11 | { |
448 | 13 | @Override | 12 | @Override |
451 | 14 | protected MathNode createMathNode() | 13 | protected MathNode createMathNode() throws NodeCreationException { |
450 | 15 | throws NodeCreationException { | ||
452 | 16 | MathNode node = super.createMathNode(); | 14 | MathNode node = super.createMathNode(); |
453 | 17 | return node; | 15 | return node; |
454 | 18 | } | 16 | } |
455 | 19 | 17 | ||
456 | === modified file 'WorkcraftCore/src/org/workcraft/observation/ObservableHierarchy.java' | |||
457 | --- WorkcraftCore/src/org/workcraft/observation/ObservableHierarchy.java 2009-09-22 21:01:45 +0000 | |||
458 | +++ WorkcraftCore/src/org/workcraft/observation/ObservableHierarchy.java 2014-07-16 10:33:39 +0000 | |||
459 | @@ -24,4 +24,5 @@ | |||
460 | 24 | public interface ObservableHierarchy { | 24 | public interface ObservableHierarchy { |
461 | 25 | public void addObserver (HierarchyObserver obs); | 25 | public void addObserver (HierarchyObserver obs); |
462 | 26 | public void removeObserver (HierarchyObserver obs); | 26 | public void removeObserver (HierarchyObserver obs); |
463 | 27 | public void removeAllObservers(); | ||
464 | 27 | } | 28 | } |
465 | 28 | 29 | ||
466 | === modified file 'WorkcraftCore/src/org/workcraft/observation/ObservableHierarchyImpl.java' | |||
467 | --- WorkcraftCore/src/org/workcraft/observation/ObservableHierarchyImpl.java 2009-09-22 21:01:45 +0000 | |||
468 | +++ WorkcraftCore/src/org/workcraft/observation/ObservableHierarchyImpl.java 2014-07-16 10:33:39 +0000 | |||
469 | @@ -34,6 +34,10 @@ | |||
470 | 34 | observers.remove(obs); | 34 | observers.remove(obs); |
471 | 35 | } | 35 | } |
472 | 36 | 36 | ||
473 | 37 | public void removeAllObservers() { | ||
474 | 38 | observers.clear(); | ||
475 | 39 | } | ||
476 | 40 | |||
477 | 37 | public void sendNotification (HierarchyEvent e) { | 41 | public void sendNotification (HierarchyEvent e) { |
478 | 38 | for (HierarchyObserver obs : observers) | 42 | for (HierarchyObserver obs : observers) |
479 | 39 | obs.notify(e); | 43 | obs.notify(e); |
480 | 40 | 44 | ||
481 | === modified file 'WorkcraftCore/src/org/workcraft/workspace/WorkspaceEntry.java' | |||
482 | --- WorkcraftCore/src/org/workcraft/workspace/WorkspaceEntry.java 2014-06-17 18:47:40 +0000 | |||
483 | +++ WorkcraftCore/src/org/workcraft/workspace/WorkspaceEntry.java 2014-07-16 10:33:39 +0000 | |||
484 | @@ -29,11 +29,12 @@ | |||
485 | 29 | import java.io.IOException; | 29 | import java.io.IOException; |
486 | 30 | import java.io.InputStreamReader; | 30 | import java.io.InputStreamReader; |
487 | 31 | import java.util.Collection; | 31 | import java.util.Collection; |
488 | 32 | import java.util.HashMap; | ||
489 | 33 | import java.util.HashSet; | 32 | import java.util.HashSet; |
490 | 34 | import java.util.zip.ZipEntry; | 33 | import java.util.zip.ZipEntry; |
491 | 35 | import java.util.zip.ZipInputStream; | 34 | import java.util.zip.ZipInputStream; |
492 | 36 | 35 | ||
493 | 36 | import javax.swing.JOptionPane; | ||
494 | 37 | |||
495 | 37 | import org.workcraft.Framework; | 38 | import org.workcraft.Framework; |
496 | 38 | import org.workcraft.dom.Container; | 39 | import org.workcraft.dom.Container; |
497 | 39 | import org.workcraft.dom.Node; | 40 | import org.workcraft.dom.Node; |
498 | @@ -48,7 +49,6 @@ | |||
499 | 48 | import org.workcraft.observation.StateEvent; | 49 | import org.workcraft.observation.StateEvent; |
500 | 49 | import org.workcraft.observation.StateObserver; | 50 | import org.workcraft.observation.StateObserver; |
501 | 50 | import org.workcraft.plugins.shared.CommonEditorSettings; | 51 | import org.workcraft.plugins.shared.CommonEditorSettings; |
502 | 51 | import org.workcraft.plugins.shared.CommonVisualSettings; | ||
503 | 52 | import org.workcraft.util.Hierarchy; | 52 | import org.workcraft.util.Hierarchy; |
504 | 53 | 53 | ||
505 | 54 | public class WorkspaceEntry implements ObservableState { | 54 | public class WorkspaceEntry implements ObservableState { |
506 | @@ -211,9 +211,7 @@ | |||
507 | 211 | Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); | 211 | Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); |
508 | 212 | String str = unzipInputStream(new ZipInputStream(capturedMemento.getStream())); | 212 | String str = unzipInputStream(new ZipInputStream(capturedMemento.getStream())); |
509 | 213 | clipboard.setContents(new StringSelection(str), null); | 213 | clipboard.setContents(new StringSelection(str), null); |
510 | 214 | |||
511 | 215 | } | 214 | } |
512 | 216 | |||
513 | 217 | } | 215 | } |
514 | 218 | 216 | ||
515 | 219 | public void cancelMemento() { | 217 | public void cancelMemento() { |
516 | @@ -278,7 +276,8 @@ | |||
517 | 278 | setModelEntry(result); | 276 | setModelEntry(result); |
518 | 279 | setChanged(true); | 277 | setChanged(true); |
519 | 280 | } catch (DeserialisationException e) { | 278 | } catch (DeserialisationException e) { |
521 | 281 | e.printStackTrace(); | 279 | JOptionPane.showMessageDialog(framework.getMainWindow(), e.getMessage(), |
522 | 280 | "Model insertion failed", JOptionPane.ERROR_MESSAGE); | ||
523 | 282 | } | 281 | } |
524 | 283 | } | 282 | } |
525 | 284 | 283 | ||
526 | @@ -356,7 +355,8 @@ | |||
527 | 356 | setChanged(true); | 355 | setChanged(true); |
528 | 357 | VisualModelTransformer.translateSelection(result.getVisualModel(), 1.0, 1.0); | 356 | VisualModelTransformer.translateSelection(result.getVisualModel(), 1.0, 1.0); |
529 | 358 | } catch (DeserialisationException e) { | 357 | } catch (DeserialisationException e) { |
531 | 359 | e.printStackTrace(); | 358 | JOptionPane.showMessageDialog(framework.getMainWindow(), e.getMessage(), |
532 | 359 | "Clipboard paste failed", JOptionPane.ERROR_MESSAGE); | ||
533 | 360 | } | 360 | } |
534 | 361 | } | 361 | } |
535 | 362 | } | 362 | } |
536 | 363 | 363 | ||
537 | === modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualXmasComponent.java' | |||
538 | --- XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualXmasComponent.java 2014-01-07 16:03:24 +0000 | |||
539 | +++ XmasPlugin/src/org/workcraft/plugins/xmas/components/VisualXmasComponent.java 2014-07-16 10:33:39 +0000 | |||
540 | @@ -213,6 +213,12 @@ | |||
541 | 213 | groupImpl.removeObserver(obs); | 213 | groupImpl.removeObserver(obs); |
542 | 214 | } | 214 | } |
543 | 215 | 215 | ||
544 | 216 | @Override | ||
545 | 217 | public void removeAllObservers() { | ||
546 | 218 | groupImpl.removeAllObservers(); | ||
547 | 219 | } | ||
548 | 220 | |||
549 | 221 | |||
550 | 216 | abstract public Shape getShape(); | 222 | abstract public Shape getShape(); |
551 | 217 | 223 | ||
552 | 218 | @Override | 224 | @Override |
553 | 219 | 225 | ||
554 | === modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/components/XmasComponent.java' | |||
555 | --- XmasPlugin/src/org/workcraft/plugins/xmas/components/XmasComponent.java 2013-11-05 18:01:19 +0000 | |||
556 | +++ XmasPlugin/src/org/workcraft/plugins/xmas/components/XmasComponent.java 2014-07-16 10:33:39 +0000 | |||
557 | @@ -52,6 +52,11 @@ | |||
558 | 52 | public void removeObserver(HierarchyObserver obs) { | 52 | public void removeObserver(HierarchyObserver obs) { |
559 | 53 | groupImpl.removeObserver(obs); | 53 | groupImpl.removeObserver(obs); |
560 | 54 | } | 54 | } |
561 | 55 | |||
562 | 56 | public void removeAllObservers() { | ||
563 | 57 | groupImpl.removeAllObservers(); | ||
564 | 58 | } | ||
565 | 59 | |||
566 | 55 | 60 | ||
567 | 56 | @Override | 61 | @Override |
568 | 57 | public void add(Node node) { | 62 | public void add(Node node) { |