annotate java/src/uk/ac/qmul/eecs/ccmi/gui/DiagramModelUpdater.java @ 8:ea7885bd9bff tip

fixed bug : render solid line as dotted/dashed when moving the stylus from dotted/dashed to solid
author ccmi-guest
date Thu, 03 Jul 2014 16:12:20 +0100
parents d66dd5880081
children
rev   line source
fiore@0 1 /*
fiore@0 2 CCmI Editor - A Collaborative Cross-Modal Diagram Editing Tool
fiore@0 3
fiore@0 4 Copyright (C) 2011 Queen Mary University of London (http://ccmi.eecs.qmul.ac.uk/)
fiore@0 5
fiore@0 6 This program is free software: you can redistribute it and/or modify
fiore@0 7 it under the terms of the GNU General Public License as published by
fiore@0 8 the Free Software Foundation, either version 3 of the License, or
fiore@0 9 (at your option) any later version.
fiore@0 10
fiore@0 11 This program is distributed in the hope that it will be useful,
fiore@0 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
fiore@0 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fiore@0 14 GNU General Public License for more details.
fiore@0 15
fiore@0 16 You should have received a copy of the GNU General Public License
fiore@0 17 along with this program. If not, see <http://www.gnu.org/licenses/>.
fiore@0 18 */
fiore@0 19 package uk.ac.qmul.eecs.ccmi.gui;
fiore@0 20
fiore@0 21 import java.awt.geom.Point2D;
fiore@0 22 import java.util.Set;
fiore@0 23
fiore@0 24 import uk.ac.qmul.eecs.ccmi.diagrammodel.DiagramElement;
fiore@3 25 import uk.ac.qmul.eecs.ccmi.diagrammodel.DiagramTreeNode;
fiore@0 26 import uk.ac.qmul.eecs.ccmi.diagrammodel.NodeProperties;
fiore@3 27 import uk.ac.qmul.eecs.ccmi.network.AwarenessMessage;
fiore@3 28 import uk.ac.qmul.eecs.ccmi.network.DiagramEventActionSource;
fiore@3 29 import uk.ac.qmul.eecs.ccmi.network.NetDiagram;
fiore@0 30
fiore@0 31 /**
fiore@0 32 *
fiore@0 33 * The DiagramModelUpdater class is used to make changes to the diagram model. The reason why
fiore@0 34 * changes are not made directly to the model is allowing the network-local diagram interchangeability.
fiore@0 35 * A NetDiagram differs from a local
fiore@0 36 * diagram only by its DiagramModelUpdater implementation. The rest of the operations are
fiore@0 37 * performed through the delegate local diagram which is passed as argument to the constructor.
fiore@0 38 * In this way a local diagram can be easily turned into a network diagram and vice versa.
fiore@0 39 *
fiore@0 40 * @see NetDiagram
fiore@0 41 */
fiore@0 42 public interface DiagramModelUpdater {
fiore@0 43
fiore@3 44 /**
fiore@3 45 * Issues a lock request to the server for the specified tree node.
fiore@3 46 *
fiore@3 47 * @param treeNode the tree node the lock is being requested for
fiore@3 48 * @param lock the type of lock being requested
fiore@3 49 * @param actionSource The {@code DiagramEventActionSource} that's going to be piggybacked
fiore@3 50 * on the lock message, for awareness purposes
fiore@3 51 * @return {@code true} if the lock is successfully granted by the server
fiore@3 52 */
fiore@3 53 public boolean getLock(DiagramTreeNode treeNode, Lock lock, DiagramEventActionSource actionSource);
fiore@0 54
fiore@3 55 /**
fiore@3 56 * Releases a lock previously acquired by this client.
fiore@3 57 *
fiore@3 58 * @param treeNode the tree node the lock is being released for
fiore@3 59 * @param lock the type of lock being released
fiore@3 60 * @param actionSource The {@code DiagramEventActionSource} that's going to be piggybacked
fiore@3 61 * on the lock message, for awareness purposes.
fiore@3 62 *
fiore@3 63 * @see uk.ac.qmul.eecs.ccmi.network.AwarenessMessage
fiore@3 64 */
fiore@3 65 public void yieldLock(DiagramTreeNode treeNode, Lock lock ,DiagramEventActionSource actionSource);
fiore@0 66
fiore@3 67 /**
fiore@3 68 * Sends an awareness message to the server.
fiore@3 69 *
fiore@3 70 * @param awMsgName the type of awareness message being sent
fiore@3 71 * @param source the source of the action. Represents informations to be carried on this message.
fiore@3 72 *
fiore@3 73 * @see uk.ac.qmul.eecs.ccmi.network.AwarenessMessage
fiore@3 74 */
fiore@3 75 public void sendAwarenessMessage(AwarenessMessage.Name awMsgName, Object source);
fiore@0 76
fiore@3 77 /**
fiore@3 78 * Inserts a {@code DiagramElement} in the {@code CollectionModel} of the {@code Diagram} holding this
fiore@3 79 * model updater.
fiore@3 80 *
fiore@3 81 * @param element the element to insert
fiore@3 82 * @param source the source of the insertion action. it can be used by collection listeners.
fiore@3 83 */
fiore@3 84 public void insertInCollection(DiagramElement element,DiagramEventSource source);
fiore@3 85
fiore@3 86 /**
fiore@3 87 * Inserts a {@code DiagramElement} in the {@code TreeModel} of the {@code Diagram} holding this
fiore@3 88 * model updater.
fiore@3 89 *
fiore@3 90 * @param element the element to insert
fiore@3 91 */
fiore@0 92 public void insertInTree(DiagramElement element);
fiore@0 93
fiore@3 94 /**
fiore@3 95 * Removes an element from the {@code CollectionModel} of the {@code Diagram} holding this
fiore@3 96 * model updater.
fiore@3 97 *
fiore@3 98 * @param element the element to remove
fiore@3 99 * @param source the source of the insertion action. it can be used by collection listeners.
fiore@3 100 */
fiore@3 101 public void takeOutFromCollection(DiagramElement element,DiagramEventSource source);
fiore@0 102
fiore@3 103 /**
fiore@3 104 * Removes an element from the {@code TreeModel} of the {@code Diagram} holding this
fiore@3 105 * model updater.
fiore@3 106 *
fiore@3 107 * @param element the element to remove
fiore@3 108 */
fiore@0 109 public void takeOutFromTree(DiagramElement element);
fiore@0 110
fiore@3 111 /**
fiore@3 112 * Sets a new name for the element of the {@code Diagram} holding this
fiore@3 113 * model updater.
fiore@3 114 *
fiore@3 115 * @param element the element being renamed
fiore@3 116 * @param name the new name
fiore@3 117 * @param source the source of the removal action. it can be used by collection listeners.
fiore@3 118 */
fiore@3 119 public void setName(DiagramElement element, String name,DiagramEventSource source);
fiore@0 120
fiore@3 121 /**
fiore@3 122 * Sets to a new value a property of a node of the {@code Diagram} holding this
fiore@3 123 * model updater.
fiore@3 124 *
fiore@3 125 * @param node the node being set a new property
fiore@3 126 * @param type the type of the new property
fiore@3 127 * @param index the index of the property being set a new value
fiore@3 128 * @param value the new value for the property
fiore@3 129 * @param source source the source of the {@code setName} action. it can be used by collection listeners.
fiore@3 130 */
fiore@3 131 public void setProperty(Node node, String type, int index, String value,DiagramEventSource source);
fiore@0 132
fiore@3 133 /**
fiore@3 134 * Replace the whole {@code NodeProperties} object of a node of the {@code Diagram} holding this
fiore@3 135 * model updater with a new one.
fiore@3 136 *
fiore@3 137 * @param node the node being set a new {@code NodeProperties} instance
fiore@3 138 * @param properties the new {@code NodeProperties} instance
fiore@3 139 * @param source source the source of the {@code setProperty} action. it can be used by collection listeners.
fiore@3 140 */
fiore@3 141 public void setProperties(Node node, NodeProperties properties,DiagramEventSource source);
fiore@0 142
fiore@3 143 /**
fiore@3 144 * Clears the properties of a node of the {@code Diagram} holding this
fiore@3 145 * model updater.
fiore@3 146 *
fiore@3 147 * @param node the node whose properties are being cleared
fiore@3 148 * @param source the source of the {@code setProperties} action. it can be used by collection listeners.
fiore@3 149 *
fiore@3 150 * @see uk.ac.qmul.eecs.ccmi.diagrammodel.NodeProperties#clear()
fiore@3 151 */
fiore@3 152 public void clearProperties(Node node,DiagramEventSource source);
fiore@3 153
fiore@3 154 /**
fiore@3 155 * Set the notes for a tree node of the {@code Diagram} holding this
fiore@3 156 * model updater.
fiore@3 157 *
fiore@3 158 * @param treeNode the tree node whose notes are being set
fiore@3 159 * @param notes the new notes
fiore@3 160 * @param source the source of the {@code setNotes} action. it can be used by collection listeners.
fiore@3 161 */
fiore@3 162 public void setNotes(DiagramTreeNode treeNode, String notes,DiagramEventSource source);
fiore@0 163
fiore@3 164 /**
fiore@3 165 * Add a new property to a node's properties of the {@code Diagram} holding this
fiore@3 166 * model updater.
fiore@3 167 *
fiore@3 168 * @param node the node whose properties are being added to
fiore@3 169 * @param type the type of the new property being added
fiore@3 170 * @param value the value of the new property being added
fiore@3 171 * @param source the source of the {@code setProperty} action. it can be used by collection listeners.
fiore@3 172 */
fiore@3 173 public void addProperty(Node node, String type, String value,DiagramEventSource source);
fiore@0 174
fiore@3 175 /**
fiore@3 176 * Removes a property from a node's properties of the {@code Diagram} holding this
fiore@3 177 * model updater.
fiore@3 178 *
fiore@3 179 * @param node the node whose properties are being removed from
fiore@3 180 * @param type the type of the new property being removed
fiore@3 181 * @param index the index of the property being removed
fiore@3 182 * @param source the source of the {@code removeProperty} action. it can be used by collection listeners.
fiore@3 183 */
fiore@3 184 public void removeProperty(Node node, String type, int index,DiagramEventSource source);
fiore@0 185
fiore@3 186 /**
fiore@3 187 * Set the modifiers for a property of a node in of the {@code Diagram} holding this
fiore@3 188 * model updater.
fiore@3 189 *
fiore@3 190 * @param node the node whose properties whose modifiers are being
fiore@3 191 * @param type the type of the property whose modifiers are being set
fiore@3 192 * @param index the index of the property whose modifiers are being set
fiore@3 193 * @param modifiers the new modifiers indexes. the indexes refer to the modifiers type array.
fiore@3 194 * @param source the source of the {@code setModifiers} action. it can be used by collection listeners.
fiore@3 195 */
fiore@3 196 public void setModifiers(Node node, String type, int index, Set<Integer> modifiers,DiagramEventSource source);
fiore@0 197
fiore@3 198 /**
fiore@3 199 * Set the end label for an edge of the {@code Diagram} holding this
fiore@3 200 * model updater.
fiore@3 201 *
fiore@3 202 * @param edge the edge whose label is being set
fiore@3 203 * @param node the node at the edge end where the label is being set
fiore@3 204 * @param label the new label
fiore@3 205 * @param source the source of the {@code setLabel} action. it can be used by collection listeners.
fiore@3 206 */
fiore@3 207 public void setEndLabel(Edge edge, Node node, String label,DiagramEventSource source);
fiore@0 208
fiore@3 209 /**
fiore@3 210 * Set the end description for an edge of the {@code Diagram} holding this
fiore@3 211 * model updater.
fiore@3 212 *
fiore@3 213 * @param edge the edge whose end description is being set
fiore@3 214 * @param node the node at the edge end where the end description is being set
fiore@3 215 * @param index the index of the new end description in the end description array of {@code edge}
fiore@3 216 * @param source the source of the {@code setEndDescription} action. it can be used by collection listeners.
fiore@3 217 */
fiore@3 218 public void setEndDescription(Edge edge, Node node, int index, DiagramEventSource source);
fiore@0 219
fiore@3 220 /**
fiore@3 221 * Translates a graph element of the {@code Diagram} holding this
fiore@3 222 * model updater.
fiore@3 223 *
fiore@3 224 * @param ge the graph element being translated
fiore@3 225 * @param p the starting point of the translation
fiore@3 226 * @param x the distance to translate along the x-axis
fiore@3 227 * @param y the distance to translate along the y-axis
fiore@3 228 * @param source the source of the {@code translate} action. it can be used by collection listeners.
fiore@3 229 */
fiore@3 230 public void translate(GraphElement ge, Point2D p, double x, double y,DiagramEventSource source);
fiore@0 231
fiore@3 232 /**
fiore@3 233 * Starts the move for a graph element of the {@code Diagram} holding this
fiore@3 234 * model updater. The move can be either a translation or a bend (if {@code ge} is an Edge).
fiore@3 235 * This method must be called before such motion methods are called in turn.
fiore@3 236 *
fiore@3 237 * @param ge the graph element being translated
fiore@3 238 * @param p the starting point of the motion
fiore@3 239 * @param source the source of the {@code startMove} action. it can be used by collection listeners.
fiore@3 240 */
fiore@3 241 public void startMove(GraphElement ge, Point2D p, DiagramEventSource source);
fiore@0 242
fiore@3 243 /**
fiore@3 244 * Bends an edge of the {@code Diagram} holding this model updater.
fiore@3 245 *
fiore@3 246 * @param edge the edge being bended
fiore@3 247 * @param p the starting point of the motion
fiore@3 248 * @param source the source of the {@code bend} action. it can be used by collection listeners.
fiore@3 249 */
fiore@3 250 public void bend(Edge edge, Point2D p,DiagramEventSource source);
fiore@0 251
fiore@3 252 /**
fiore@3 253 * Finishes off the motion of a graph element of the {@code Diagram} holding this
fiore@3 254 * model updater.
fiore@3 255 *
fiore@3 256 * @param ge the graph element being moved
fiore@5 257 * @param source the source of the {@code stopMove} action. it can be used by collection listeners.
fiore@3 258 */
fiore@3 259 public void stopMove(GraphElement ge,DiagramEventSource source);
fiore@0 260 }