edu.neu.ccs
Class XObject

java.lang.Object
  extended byedu.neu.ccs.XObject
All Implemented Interfaces:
Cloneable, Serializable, Stringable
Direct Known Subclasses:
XBoolean, XChar, XColor, XNumber, XString

public abstract class XObject
extends Object
implements Stringable, Cloneable, Serializable

Abstract superclass for Stringable objects.

Version:
2.5.0
See Also:
Serialized Form

Field Summary
protected  SwingPropertyChangeSupport changeAdapter
          Helper object for property change API.
static String VALUE
          Bound property name for the value property that indicates that a value has been set.
 
Constructor Summary
XObject()
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Registers the given object to listen for property change events generated by this object.
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Registers the given object to listen for property change events with the provided name generated by this object.
static String formatErrorMessage(ParseException ex, String data)
          Returns a neatly formatted String representation of the given exception and the data that generated the exception, for use in user error messages.
abstract  void fromStringData(String data)
          Sets the state of this object using information contained in the given String.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Deregisters the given object from listening for property change events generated by this object.
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Deregisters the given object from listening for property change events with the provided name generated by this object.
static String[] toStringArray(Stringable[] obj)
          Returns an array of Strings containing the encapsulated states of the given array of Stringable objects.
abstract  String toStringData()
          Returns a String encapsulation of this object that contains information needed to set the state of this object at a later time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALUE

public static final String VALUE
Bound property name for the value property that indicates that a value has been set.

See Also:
Constant Field Values

changeAdapter

protected SwingPropertyChangeSupport changeAdapter
Helper object for property change API.

Constructor Detail

XObject

public XObject()
Method Detail

fromStringData

public abstract void fromStringData(String data)
                             throws ParseException
Description copied from interface: Stringable
Sets the state of this object using information contained in the given String.

Specified by:
fromStringData in interface Stringable
Parameters:
data - the String containing state information
Throws:
ParseException - if the data is malformed
See Also:
Stringable.toStringData()

toStringData

public abstract String toStringData()
Description copied from interface: Stringable
Returns a String encapsulation of this object that contains information needed to set the state of this object at a later time.

Specified by:
toStringData in interface Stringable
See Also:
Stringable.fromStringData(String)

toStringArray

public static String[] toStringArray(Stringable[] obj)
Returns an array of Strings containing the encapsulated states of the given array of Stringable objects.

Parameters:
obj - an array of Stringable objects
Returns:
the resulting array of Strings
Since:
1.0

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Registers the given object to listen for property change events generated by this object.

Parameters:
listener - the listener to be registered
Since:
1.0

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Registers the given object to listen for property change events with the provided name generated by this object.

Parameters:
propertyName - the name of the desired property
listener - the listener to be registered
Since:
1.0

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Deregisters the given object from listening for property change events generated by this object.

Parameters:
listener - the listener to be deregistered
Since:
1.0

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Deregisters the given object from listening for property change events with the provided name generated by this object.

Parameters:
propertyName - the name of the desired property
listener - the listener to be deregistered
Since:
1.0

formatErrorMessage

public static String formatErrorMessage(ParseException ex,
                                        String data)

Returns a neatly formatted String representation of the given exception and the data that generated the exception, for use in user error messages.

As of 2.5.0, this method has been simplified to return ex.getMessage() since the formatting is now handled automatically via code in the class BaseParser. The data parameter is now ignored.

This method was left in place rather than edit numerous JPT classes that used the method.

Parameters:
ex - the ParseException to be reported
data - the input String that generated the exception
Since:
1.0