fiore@3
|
1 /*
|
fiore@3
|
2 CCmI Editor - A Collaborative Cross-Modal Diagram Editing Tool
|
fiore@3
|
3
|
fiore@3
|
4 Copyright (C) 2011 Queen Mary University of London (http://ccmi.eecs.qmul.ac.uk/)
|
fiore@3
|
5
|
fiore@3
|
6 This program is free software: you can redistribute it and/or modify
|
fiore@3
|
7 it under the terms of the GNU General Public License as published by
|
fiore@3
|
8 the Free Software Foundation, either version 3 of the License, or
|
fiore@3
|
9 (at your option) any later version.
|
fiore@3
|
10
|
fiore@3
|
11 This program is distributed in the hope that it will be useful,
|
fiore@3
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
fiore@3
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
fiore@3
|
14 GNU General Public License for more details.
|
fiore@3
|
15
|
fiore@3
|
16 You should have received a copy of the GNU General Public License
|
fiore@3
|
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
|
fiore@3
|
18 */
|
fiore@3
|
19 package uk.ac.qmul.eecs.ccmi.diagrammodel;
|
fiore@3
|
20
|
fiore@3
|
21 import java.util.EventObject;
|
fiore@3
|
22
|
fiore@3
|
23 /**
|
fiore@3
|
24 * An event that is triggered in the {@code DiagramModel} when an action
|
fiore@3
|
25 * happens that can involve all the tree nodes of the model's {@code DiagramTree}
|
fiore@3
|
26 * rather than only nodes or edges.
|
fiore@3
|
27 *
|
fiore@3
|
28 * Particularly such actions happens when the user set the notes for a tree node or when
|
fiore@3
|
29 * they bookmark a tree node.
|
fiore@3
|
30 *
|
fiore@3
|
31 */
|
fiore@3
|
32 @SuppressWarnings("serial")
|
fiore@3
|
33 public class DiagramTreeNodeEvent extends EventObject {
|
fiore@3
|
34 /**
|
fiore@3
|
35 * Creates a new event related to a change in a tree node on either notes or bookmarks.
|
fiore@3
|
36 * In order to get the status of the tree node before the change the old value is passed as
|
fiore@3
|
37 * parameter to this constructor.
|
fiore@3
|
38 * For {@code setNotes} this value is the notes before the change. For {@code removeBookmark} it
|
fiore@3
|
39 * will be the bookmark that has just been removed. Finally for {@code putBookmark()} the value is the
|
fiore@3
|
40 * new bookmark.
|
fiore@3
|
41 *
|
fiore@3
|
42 * @see uk.ac.qmul.eecs.ccmi.diagrammodel.TreeModel uk.ac.qmul.eecs.ccmi.diagrammodel.TreeModel
|
fiore@3
|
43 *
|
fiore@3
|
44 * @param treeNode the tree node where the action happened
|
fiore@3
|
45 * @param value the value that the tree node had before this action.
|
fiore@3
|
46 * @param source the source of the action
|
fiore@3
|
47 */
|
fiore@3
|
48 public DiagramTreeNodeEvent(DiagramTreeNode treeNode, String value, Object source){
|
fiore@3
|
49 super(source);
|
fiore@3
|
50 this.treeNode = treeNode;
|
fiore@3
|
51 this.value = value;
|
fiore@3
|
52 }
|
fiore@3
|
53
|
fiore@3
|
54 /**
|
fiore@3
|
55 * Returns the tree node on which a new note has been set or a bookmark has been added/removed.
|
fiore@3
|
56 *
|
fiore@3
|
57 * @return the tree node this event refers to.
|
fiore@3
|
58 */
|
fiore@3
|
59 public DiagramTreeNode getTreeNode() {
|
fiore@3
|
60 return treeNode;
|
fiore@3
|
61 }
|
fiore@3
|
62
|
fiore@3
|
63 /**
|
fiore@3
|
64 * Returns the old value before the action (the old notes for {@code setNotes()},
|
fiore@3
|
65 * and the bookmark key for {@code putBookmark() and removeBookmark()}.
|
fiore@3
|
66 *
|
fiore@3
|
67 * @return the old value before the action
|
fiore@3
|
68 */
|
fiore@3
|
69 public String getValue() {
|
fiore@3
|
70 return value;
|
fiore@3
|
71 }
|
fiore@3
|
72
|
fiore@3
|
73 private DiagramTreeNode treeNode;
|
fiore@3
|
74 private String value;
|
fiore@3
|
75 }
|