comparison java/src/uk/ac/qmul/eecs/ccmi/diagrammodel/DiagramTreeNodeEvent.java @ 3:9e67171477bc

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