annotate java/src/uk/ac/qmul/eecs/ccmi/gui/DiagramModelUpdater.java @ 1:e3935c01cde2 tip

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