net.sourceforge.nite.gui.textviewer
Class NTextElement

java.lang.Object
  extended by net.sourceforge.nite.gui.textviewer.NTextElement
Direct Known Subclasses:
IconTextElement

public class NTextElement
extends java.lang.Object

An individual piece of text which can be added to an NTextArea. Each NTextElement can be associated with two XML source elements - one which caused the element to be displayed and another which will be edited when the text is clicked on. It can also have its own style.


Field Summary
static int UNTIMED
           
 
Constructor Summary
NTextElement()
           
NTextElement(java.lang.String s, java.lang.String style)
          Creates a new NTextElement with the specified content and display style
NTextElement(java.lang.String s, java.lang.String style, double start, double end)
           
NTextElement(java.lang.String t, java.lang.String s, double start, double end, ObjectModelElement element)
          Creates a new NTextElement with the specified content and display style; with start and end times and with an object model element (an item in the source document with which this text element is associated).
NTextElement(java.lang.String t, java.lang.String s, int pos, double start, double end)
          Creates a new NTextElement with the specified content and display style, and with start and end times
NTextElement(java.lang.String t, java.lang.String s, int pos, double start, double end, ObjectModelElement element)
          Creates a new NTextElement with the specified content and display style; with start and end times and with an object model element (an item in the source document with which this text element is associated).
NTextElement(java.lang.String t, java.lang.String s, int pos, double start, double end, ObjectModelElement element, ObjectModelElement edit_element)
          Creates a new NTextElement with the specified content and display style; with start and end times and with TWO object model elements - the first is the element that caused this element to be displayed, and the second is the element associated with this for editing purposes.
NTextElement(java.lang.String s, java.lang.String style, ObjectModelElement element)
          Creates a new NTextElement with the specified content and display style and with an object model element (an item in the source document with which this text element is associated).
NTextElement(java.lang.String s, java.lang.String style, ObjectModelElement element, ObjectModelElement edit_element)
          Creates a new NTextElement with the specified content and display style and with TWO object model elements - the first is the element that caused this element to be displayed, and the second is the element associated with this for editing purposes.
 
Method Summary
 NTextElement copy()
          Returns a new copy of this NTextElement
 ObjectModelElement getDataElement()
          Returns the dataElement.
 ObjectModelElement getEditElement()
          Returns the display Element - by default this is the same as the dataElement, but it may be different if the displayed element is different to the edited one.
 double getEndTime()
           
 int getPosition()
           
 double getStartTime()
           
 java.lang.String getStyle()
          Return the style object which specifies the way the content is displayed
 java.lang.String getText()
          Returns the content of this text element as a string
 void setDataElement(ObjectModelElement dataElement)
          Sets the dataElement.
 void setEditElement(ObjectModelElement editElement)
          Sets the editElement - by default this is the same as the dataElement, but it may be different for specialised displays (where one wishes particular highlighting and editing behaviour).
 void setEndTime(double e)
           
 void setPosition(int p)
           
 void setStartTime(double s)
           
 void setStyle(java.lang.String name)
          Sets the content of this text element to be displayed in the specified style
 void setText(java.lang.String s)
          Sets the content of this text element to be the argument string
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNTIMED

public static final int UNTIMED
See Also:
Constant Field Values
Constructor Detail

NTextElement

public NTextElement(java.lang.String t,
                    java.lang.String s,
                    int pos,
                    double start,
                    double end)
Creates a new NTextElement with the specified content and display style, and with start and end times


NTextElement

public NTextElement(java.lang.String s,
                    java.lang.String style)
Creates a new NTextElement with the specified content and display style


NTextElement

public NTextElement(java.lang.String t,
                    java.lang.String s,
                    int pos,
                    double start,
                    double end,
                    ObjectModelElement element)
Creates a new NTextElement with the specified content and display style; with start and end times and with an object model element (an item in the source document with which this text element is associated).


NTextElement

public NTextElement(java.lang.String s,
                    java.lang.String style,
                    double start,
                    double end)

NTextElement

public NTextElement(java.lang.String t,
                    java.lang.String s,
                    double start,
                    double end,
                    ObjectModelElement element)
Creates a new NTextElement with the specified content and display style; with start and end times and with an object model element (an item in the source document with which this text element is associated).


NTextElement

public NTextElement(java.lang.String s,
                    java.lang.String style,
                    ObjectModelElement element)
Creates a new NTextElement with the specified content and display style and with an object model element (an item in the source document with which this text element is associated).


NTextElement

public NTextElement(java.lang.String t,
                    java.lang.String s,
                    int pos,
                    double start,
                    double end,
                    ObjectModelElement element,
                    ObjectModelElement edit_element)
Creates a new NTextElement with the specified content and display style; with start and end times and with TWO object model elements - the first is the element that caused this element to be displayed, and the second is the element associated with this for editing purposes.


NTextElement

public NTextElement(java.lang.String s,
                    java.lang.String style,
                    ObjectModelElement element,
                    ObjectModelElement edit_element)
Creates a new NTextElement with the specified content and display style and with TWO object model elements - the first is the element that caused this element to be displayed, and the second is the element associated with this for editing purposes.


NTextElement

public NTextElement()
Method Detail

copy

public NTextElement copy()
Returns a new copy of this NTextElement

Returns:

setStartTime

public void setStartTime(double s)

setEndTime

public void setEndTime(double e)

getPosition

public int getPosition()

getStartTime

public double getStartTime()

getEndTime

public double getEndTime()

getText

public java.lang.String getText()
Returns the content of this text element as a string


setText

public void setText(java.lang.String s)
Sets the content of this text element to be the argument string


setPosition

public void setPosition(int p)

getStyle

public java.lang.String getStyle()
Return the style object which specifies the way the content is displayed


setStyle

public void setStyle(java.lang.String name)
Sets the content of this text element to be displayed in the specified style


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDataElement

public ObjectModelElement getDataElement()
Returns the dataElement.

Returns:
ObjectModelElement

setDataElement

public void setDataElement(ObjectModelElement dataElement)
Sets the dataElement.

Parameters:
dataElement - The dataElement to set

getEditElement

public ObjectModelElement getEditElement()
Returns the display Element - by default this is the same as the dataElement, but it may be different if the displayed element is different to the edited one.

Returns:
ObjectModelElement

setEditElement

public void setEditElement(ObjectModelElement editElement)
Sets the editElement - by default this is the same as the dataElement, but it may be different for specialised displays (where one wishes particular highlighting and editing behaviour). The edit element defines the element that is edited when this textelement is highlighted.

Parameters:
dataElement - The dataElement to set