annotate java/src/uk/ac/qmul/eecs/ccmi/diagrammodel/TreeModel.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.diagrammodel;
fiore@0 20
fiore@0 21 import java.util.Set;
fiore@3 22 import java.util.concurrent.locks.ReentrantLock;
fiore@0 23
fiore@0 24 /**
fiore@0 25 *
fiore@0 26 * Represents the tree side of a DiagramModel instance.
fiore@0 27 *
fiore@0 28 * @param <N> a type extending DiagramNode
fiore@0 29 * @param <E> a type extending DiagramEdge
fiore@0 30 */
fiore@0 31 public interface TreeModel<N extends DiagramNode, E extends DiagramEdge> extends javax.swing.tree.TreeModel {
fiore@0 32
fiore@0 33 /**
fiore@0 34 * insert a DiagramNode into the diagram model
fiore@0 35 *
fiore@0 36 * @param treeNode the DiagramNode to be inserted in the collection
fiore@3 37 * @param source the source of the action. This will be reported as the source of the event
fiore@3 38 * generated by this action to the registered listeners. If null the TreeModel instance
fiore@3 39 * itself will be used as source
fiore@0 40 * @return true if the model changed as a result of the call
fiore@0 41 */
fiore@3 42 boolean insertTreeNode(N treeNode, Object source);
fiore@0 43
fiore@0 44 /**
fiore@0 45 * insert a DiagramEdge into the diagram model
fiore@0 46 *
fiore@0 47 * @param treeNode the DiagramEdge to be inserted in the collection
fiore@3 48 * @param source the source of the action. This will be reported as the source of the event
fiore@3 49 * generated by this action to the registered listeners. If null the TreeModel instance
fiore@3 50 * itself will be used as source
fiore@0 51 * @return true if the model changed as a result of the call
fiore@0 52 */
fiore@3 53 boolean insertTreeNode(E treeNode, Object source);
fiore@0 54
fiore@0 55 /**
fiore@0 56 * remove a DiagramElement from the model
fiore@0 57 *
fiore@0 58 * @param treeNode the diagramElement to be removed
fiore@3 59 * @param source the source of the action. This will be reported as the source of the event
fiore@3 60 * generated by this action to the registered listeners. If null the TreeModel instance
fiore@3 61 * itself will be used as source
fiore@0 62 * @return true if the model changed as a result of the call
fiore@0 63 */
fiore@3 64 boolean takeTreeNodeOut(DiagramElement treeNode, Object source);
fiore@0 65
fiore@0 66 /**
fiore@0 67 *
fiore@0 68 * Add a bookmark for the specified tree node in the internal collection
fiore@0 69 *
fiore@0 70 * @param bookmark a bookmark
fiore@0 71 * @param treeNode the tree node to be bookmarked
fiore@5 72 * @param source the sorce of the action that triggered this method
fiore@0 73 * @return previous value associated with specified key, or null if there was no mapping for key.
fiore@0 74 * @throws IllegalArgumentException if bookmark is null
fiore@0 75 */
fiore@3 76 DiagramTreeNode putBookmark(String bookmark, DiagramTreeNode treeNode, Object source);
fiore@0 77
fiore@0 78 /**
fiore@0 79 * Returns a bookmarked tree node
fiore@0 80 * @param bookmark the bookmark associated with the tree node
fiore@0 81 * @return the bookmarked tree node or null if no tree node was bookmarked with the argument
fiore@0 82 */
fiore@3 83 DiagramTreeNode getBookmarkedTreeNode(String bookmark);
fiore@0 84
fiore@0 85 /**
fiore@0 86 * Returns the list of all the bookmarks of this tree model
fiore@0 87 * @return the list of all the bookmarks
fiore@0 88 */
fiore@0 89 Set<String> getBookmarks();
fiore@0 90
fiore@0 91 /**
fiore@0 92 * Remove the bookmark from the bookmark internal collection
fiore@0 93 *
fiore@0 94 * @param bookmark the bookmark to remove
fiore@5 95 * @param source the source of the action that triggered this method
fiore@0 96 * @return previous value associated with specified key, or null if there was no mapping for key.
fiore@0 97 */
fiore@3 98 DiagramTreeNode removeBookmark(String bookmark, Object source);
fiore@0 99
fiore@0 100 /**
fiore@0 101 * Set the notes for the specified tree node. Passing an empty string as notes
fiore@0 102 * means actually to remove the notes from the tree node.
fiore@0 103 *
fiore@0 104 * @param treeNode the tree node to be noted
fiore@0 105 * @param notes the notes to be assigned to the tree node
fiore@3 106 * @param source the source of the action. This will be reported as the source of the event
fiore@3 107 * generated by this action to the registered listeners
fiore@0 108 */
fiore@3 109 void setNotes(DiagramTreeNode treeNode, String notes, Object source);
fiore@0 110
fiore@0 111 /**
fiore@3 112 * Add a {@code DiagramNodeListener} to this object. The listeners will be fired each time the model
fiore@0 113 * goes from the unmodified to modified state. The model is modified when a either a
fiore@0 114 * node or an edge are inserted or removed or changed when they are within the model.
fiore@3 115 * @param l a {@code DiagramNodeListener} to add to the model
fiore@0 116 */
fiore@3 117 void addDiagramTreeNodeListener(DiagramTreeNodeListener l);
fiore@0 118
fiore@0 119 /**
fiore@3 120 * Removes a {@code DiagramNodeListener} from this object.
fiore@3 121 * @param l a {@code DiagramNodeListener} to remove from ththis object.
fiore@0 122 */
fiore@3 123 void removeDiagramTreeNodeListener(DiagramTreeNodeListener l);
fiore@0 124
fiore@0 125 /**
fiore@0 126 * Returns true if the model has been modified
fiore@0 127 * @return true if the model has been modified
fiore@0 128 */
fiore@0 129 boolean isModified();
fiore@0 130
fiore@0 131 /**
fiore@0 132 * Sets the model as unmodified. This entails that {@link #isModified()} will return
fiore@0 133 * false unless the model doesn't get modified again. After this call a new modification
fiore@0 134 * of the model would trigger the associated change listeners again.
fiore@0 135 */
fiore@0 136 public void setUnmodified();
fiore@0 137
fiore@0 138 /**
fiore@3 139 * Returns a reentrant lock that can be used to access the nodes and edges in a synchronized fashion.
fiore@3 140 * @return a lock object
fiore@0 141 */
fiore@3 142 public ReentrantLock getMonitor();
fiore@0 143 }