001: /*
002: * uDig - User Friendly Desktop Internet GIS client
003: * http://udig.refractions.net
004: * (C) 2004, Refractions Research Inc.
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: */
017: package net.refractions.udig.printing.model;
018:
019: import org.eclipse.emf.common.notify.Notification;
020: import org.eclipse.emf.common.notify.impl.AdapterImpl;
021:
022: /**
023: * Provides easy access for listening to printing events.
024: * Developers wishing to use this should extend it and override the *Changed()
025: * methods that they are interested in.
026: *
027: * @see PropertyListener#boxesChanged()
028: * @see PropertyListener#locationChanged()
029: * @see PropertyListener#mapChanged()
030: * @see PropertyListener#sizeChanged()
031: * @see PropertyListener#sourceConnectionsChanged()
032: * @see PropertyListener#targetConnectionsChanged()
033: * @see PropertyListener#textChanged()
034: *
035: *
036: * @author Richard Gould
037: * @since 0.3
038: */
039: public class PropertyListener extends AdapterImpl {
040:
041: /**
042: * Maps an event to its particular *Changed method.
043: */
044: public void notifyChanged(Notification msg) {
045: switch (msg.getFeatureID(Element.class)) {
046: case ModelPackage.ELEMENT__LOCATION:
047: locationChanged();
048: break;
049: case ModelPackage.ELEMENT__SIZE:
050: sizeChanged();
051: break;
052: }
053: switch (msg.getFeatureID(Page.class)) {
054: case ModelPackage.PAGE__BOXES:
055: boxesChanged();
056: break;
057: }
058: super .notifyChanged(msg);
059: }
060:
061: /**
062: * Indicates that the Text property has been changed
063: * Override me to perform an action when Text is changed
064: */
065: protected void textChanged() {
066: //do nothing
067: }
068:
069: /**
070: * Indicates that the Boxes property has been changed
071: * Override me to perform an action when Boxes are changed
072: */
073: protected void boxesChanged() {
074: //do nothing
075: }
076:
077: /**
078: * Indicates that the Size property has been changed
079: *
080: * Override me to perform an action when Size is changed
081: */
082: protected void sizeChanged() {
083: //do nothing
084: }
085:
086: /**
087: * Indicates that the Location property has been changed
088: *
089: * Override me to perform an action when Location is changed
090: */
091: protected void locationChanged() {
092: //do nothing
093: }
094:
095: /**
096: * Indicates that the Target Connections property has been changed
097: *
098: * Override me to perform an action when TargetConnections are changed
099: */
100: protected void targetConnectionsChanged() {
101: //do nothing
102: }
103:
104: /**
105: * Indicates that the Source Connections property has been changed
106: *
107: * Override me to perform an action when SourceConnections are changed
108: */
109: protected void sourceConnectionsChanged() {
110: //do nothing
111: }
112: }
|