Mercurial > hg > ccmieditor
view java/src/uk/ac/qmul/eecs/ccmi/diagrammodel/ElementChangedEvent.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 |
line wrap: on
line source
/* 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; /** * ElementChangedEvent is used to notify the model listeners that an element ({@code DiagramNode} * or {@code DiagramEdge}) in the model has been changed (e.g. it has a new name). * */ @SuppressWarnings("serial") public class ElementChangedEvent extends EventObject { /** * Creates a new instance of {@code ElementChangedEvent} * * @param element the element that has been changed * @param args the arguments of this change event, if any * @param changeType it's a {@code String} identifying the change type. Subclasses of {@code DiagramNode} and * {@code DiagramEdge} can define their own change events and and make listeners aware of them via their * {@code notifyChnage()} method. Listeners (defined outside this package as well) can then identify such changes using this string. * @param source the source of the change that triggered this event */ public ElementChangedEvent( DiagramElement element, Object args, String changeType, Object source) { super(source); this.changeType = changeType; this.element = element; this.arguments = args; } /** * A String representing the change type. Subclasses of DiagramNode and DiagramEdge * can throw their own events by passing as argument a String that describes the change. * Such events will have no effect in the model but will be fired to all the registered ChangeEventListener. * * @return a String describing the change type */ public String getChangeType(){ return changeType; } /** * Returns the DiagramElement that has been affected by this change * @return the DiagramElement that has been affected by this change */ public DiagramElement getDiagramElement(){ return element; } /** * Returns the arguments of the change if the the change type has any * * @return an object representing the arguments or null */ public Object getArguments(){ return arguments; } private String changeType; private DiagramElement element; private Object arguments; /** * This class is returned by {@link ElementChangedEvent#getArguments()} when a node property is * changed. It holds the informations about the property type and the property index, so that * listeners can retrieve the property when handling the event. * */ public static class PropertyChangeArgs { public PropertyChangeArgs(String type, int index, String oldValue){ this.type = type; this.index = index; this.oldValue = oldValue; } public String getPropertyType(){ return type; } public int getPropertyIndex(){ return index; } public String getOldValue(){ return oldValue; } private String type; private String oldValue; private int index; } }