001: /*
002: #IFNDEF ALT_LICENSE
003: ThinWire(R) RIA Ajax Framework
004: Copyright (C) 2003-2007 Custom Credit Systems
005:
006: This library is free software; you can redistribute it and/or modify it under
007: the terms of the GNU Lesser General Public License as published by the Free
008: Software Foundation; either version 2.1 of the License, or (at your option) any
009: later version.
010:
011: This library is distributed in the hope that it will be useful, but WITHOUT ANY
012: WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
013: PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
014:
015: You should have received a copy of the GNU Lesser General Public License along
016: with this library; if not, write to the Free Software Foundation, Inc., 59
017: Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:
019: Users who would rather have a commercial license, warranty or support should
020: contact the following company who invented, built and supports the technology:
021:
022: Custom Credit Systems, Richardson, TX 75081, USA.
023: email: info@thinwire.com ph: +1 (888) 644-6405
024: http://www.thinwire.com
025: #ENDIF
026: [ v1.2_RC2 ]
027: */
028: package thinwire.ui.event;
029:
030: import java.util.EventObject;
031:
032: import thinwire.ui.Component;
033:
034: /**
035: * @author Joshua J. Gertzen
036: */
037: public final class PropertyChangeEvent extends EventObject {
038: private String stringValue;
039: private Component sourceComponent;
040: private String propertyName;
041: private Object newValue;
042: private Object oldValue;
043:
044: public PropertyChangeEvent(String propertyName, Object oldValue,
045: Object newValue, Component sourceComponent) {
046: this (propertyName, oldValue, newValue, sourceComponent, null);
047: }
048:
049: public PropertyChangeEvent(String propertyName, Object oldValue,
050: Object newValue, Component sourceComponent, Object source) {
051: super (source == null ? sourceComponent : source);
052: if (sourceComponent == null)
053: throw new IllegalArgumentException(
054: "sourceComponent == null");
055: if (propertyName == null || propertyName.length() == 0)
056: throw new IllegalArgumentException(
057: "propertyName == null || propertyName.length() == 0");
058: this .propertyName = propertyName;
059: this .newValue = newValue;
060: this .oldValue = oldValue;
061: this .sourceComponent = sourceComponent;
062: }
063:
064: public String getPropertyName() {
065: return propertyName;
066: }
067:
068: public Component getSourceComponent() {
069: return sourceComponent;
070: }
071:
072: public Object getNewValue() {
073: return newValue;
074: }
075:
076: public Object getOldValue() {
077: return oldValue;
078: }
079:
080: public boolean equals(Object o) {
081: return o instanceof PropertyChangeEvent
082: && toString().equals(o.toString());
083: }
084:
085: public int hashCode() {
086: return toString().hashCode();
087: }
088:
089: public String toString() {
090: if (stringValue == null)
091: stringValue = "PropertyChangeEvent{propertyName:"
092: + propertyName + ",oldValue:" + oldValue
093: + ",newValue:" + newValue + ",sourceComponent:"
094: + sourceComponent.getClass().getName() + "@"
095: + System.identityHashCode(sourceComponent)
096: + ",source:" + source + "@"
097: + System.identityHashCode(source) + "}";
098: return stringValue;
099: }
100: }
|