edu.northwestern.at.utils.swing.styledtext
Class StyleInfo

java.lang.Object
  extended by edu.northwestern.at.utils.swing.styledtext.StyleInfo
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable

public class StyleInfo
extends java.lang.Object
implements java.io.Externalizable, java.lang.Cloneable

Style information.

This lightweight class wraps an array of StyleRun objects. It represents saved style information from an XTextPane.

The intent is for this class and the StyleRun class to represent style information in a simple and efficient format which is neutral with respect to the type of client which may need to use the information (e.g., a Swing client vs. an HTML web client etc.), but which is easily converted to and from the formats used by the clients.

The runs should be in non-decreasing order by starting offset. If a run intersects some other run it should either be for exactly the same range or the earlier run should completely contain the later run. That is, runs should not "overlap".

See Also:
Serialized Form

Field Summary
 StyleRun[] info
          The array of style run information.
(package private) static long serialVersionUID
          Serial version UID.
 
Constructor Summary
StyleInfo()
          Constructs a new empty StyleInfo object.
StyleInfo(java.util.ArrayList list)
          Constructs a new StyleInfo object from an arraylist of run info.
 
Method Summary
 java.lang.Object clone()
          Returns a copy of the style information.
 boolean equals(java.lang.Object obj)
          Compares this style info to other style info.
 void readExternal(java.io.DataInputStream in)
          Reads the style information from a data input stream.
 void readExternal(java.io.ObjectInput in)
          Reads the style information on deserialization.
 java.lang.String toString()
          Returns a string representation of the style information.
 void writeExternal(java.io.DataOutputStream out)
          Writes the style information to a data output stream.
 void writeExternal(java.io.ObjectOutput out)
          Writes the style information on serialization.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
Serial version UID.

See Also:
Constant Field Values

info

public StyleRun[] info
The array of style run information.

Constructor Detail

StyleInfo

public StyleInfo()
Constructs a new empty StyleInfo object.


StyleInfo

public StyleInfo(java.util.ArrayList list)
Constructs a new StyleInfo object from an arraylist of run info.

Parameters:
list - Array list of style run information.
Method Detail

toString

public java.lang.String toString()
Returns a string representation of the style information.

Overrides:
toString in class java.lang.Object
Returns:
The string representation.

equals

public boolean equals(java.lang.Object obj)
Compares this style info to other style info.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The other style info.
Returns:
True if the two style infos are equal.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Writes the style information on serialization.

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - Object output stream.
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Reads the style information on deserialization.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - Object input stream.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.DataOutputStream out)
                   throws java.io.IOException
Writes the style information to a data output stream.

Parameters:
out - Object output stream.
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.DataInputStream in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Reads the style information from a data input stream.

Parameters:
in - Object input stream.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

clone

public java.lang.Object clone()
Returns a copy of the style information.

Overrides:
clone in class java.lang.Object
Returns:
The copy.