Mercurial > hg > ccmieditor
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/src/uk/ac/qmul/eecs/ccmi/diagrammodel/DiagramTreeNodeEvent.java Wed Apr 25 17:09:09 2012 +0100 @@ -0,0 +1,75 @@ +/* + CCmI Editor - A Collaborative Cross-Modal Diagram Editing Tool + + Copyright (C) 2011 Queen Mary University of London (http://ccmi.eecs.qmul.ac.uk/) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package uk.ac.qmul.eecs.ccmi.diagrammodel; + +import java.util.EventObject; + +/** + * An event that is triggered in the {@code DiagramModel} when an action + * happens that can involve all the tree nodes of the model's {@code DiagramTree} + * rather than only nodes or edges. + * + * Particularly such actions happens when the user set the notes for a tree node or when + * they bookmark a tree node. + * + */ +@SuppressWarnings("serial") +public class DiagramTreeNodeEvent extends EventObject { + /** + * Creates a new event related to a change in a tree node on either notes or bookmarks. + * In order to get the status of the tree node before the change the old value is passed as + * parameter to this constructor. + * For {@code setNotes} this value is the notes before the change. For {@code removeBookmark} it + * will be the bookmark that has just been removed. Finally for {@code putBookmark()} the value is the + * new bookmark. + * + * @see uk.ac.qmul.eecs.ccmi.diagrammodel.TreeModel uk.ac.qmul.eecs.ccmi.diagrammodel.TreeModel + * + * @param treeNode the tree node where the action happened + * @param value the value that the tree node had before this action. + * @param source the source of the action + */ + public DiagramTreeNodeEvent(DiagramTreeNode treeNode, String value, Object source){ + super(source); + this.treeNode = treeNode; + this.value = value; + } + + /** + * Returns the tree node on which a new note has been set or a bookmark has been added/removed. + * + * @return the tree node this event refers to. + */ + public DiagramTreeNode getTreeNode() { + return treeNode; + } + + /** + * Returns the old value before the action (the old notes for {@code setNotes()}, + * and the bookmark key for {@code putBookmark() and removeBookmark()}. + * + * @return the old value before the action + */ + public String getValue() { + return value; + } + + private DiagramTreeNode treeNode; + private String value; +}