instrument/JTree API Documentation

org.pvv.bcd.instrument.JTree
Class DefaultNodeInfo

java.lang.Object
  |
  +--org.pvv.bcd.instrument.JTree.DefaultNodeInfo
All Implemented Interfaces:
java.lang.Cloneable, Copyable, DragOverData, NodeInfo, java.io.Serializable

public class DefaultNodeInfo
extends java.lang.Object
implements java.io.Serializable, NodeInfo, Copyable, DragOverData

Default implementation of the info present on a single node. It bases its contents model on a DefaultStyledDocument.

See Also:
DefaultStyledDocument, Serialized Form

Fields inherited from interface org.pvv.bcd.instrument.JTree.DragOverData
DRAG_BOTTOM, DRAG_CENTER, DRAG_NONE, DRAG_TOP
 
Constructor Summary
DefaultNodeInfo()
          Creates a new default node.
DefaultNodeInfo(NodeInfo ni)
          Copy constructor.
DefaultNodeInfo(java.lang.String newhead)
          Creates a new node with the given title and an empty string for contents.
DefaultNodeInfo(java.lang.String newhead, java.lang.String newtxt)
          Creates a new node with the given title and textual contents.
 
Method Summary
 Copyable copy()
          Makes a new copy of myself.
 void copyFrom(NodeInfo ni)
          Fills data into myself from another node.
 java.lang.String getContents()
          Retrieves the textual representation of the contents model.
 java.lang.Object getContentsModel()
          Returns the data model of the node contents.
 int getCurrentEffect()
          Retrieves the current drag-over effect for this node.
 java.lang.String getTitle()
          Returns the title of the node.
 void setContents(java.lang.String newtxt)
          Sets the contents by specifying its textual contents.
 void setCurrentEffect(int effect)
          Sets the current drag-over effect for this node.
 void setTitle(java.lang.String newhead)
          Sets my title.
 java.lang.String toString()
          Returns my title.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultNodeInfo

public DefaultNodeInfo()
Creates a new default node. It has a title of "" and an empty string for its textual contents.

DefaultNodeInfo

public DefaultNodeInfo(java.lang.String newhead)
Creates a new node with the given title and an empty string for contents.
Parameters:
newhead - Name for new node

DefaultNodeInfo

public DefaultNodeInfo(java.lang.String newhead,
                       java.lang.String newtxt)
Creates a new node with the given title and textual contents.
Parameters:
newhead - Name for new node
newtxt - Textual content of new node

DefaultNodeInfo

public DefaultNodeInfo(NodeInfo ni)
Copy constructor. Does a deep copy.
Parameters:
ni - Node to copy
Method Detail

getContents

public java.lang.String getContents()
Retrieves the textual representation of the contents model.
Specified by:
getContents in interface NodeInfo
Returns:
Our textual contents or an empty string if there was none

setContents

public void setContents(java.lang.String newtxt)
Sets the contents by specifying its textual contents.
Parameters:
newtxt - New textual contents

getContentsModel

public java.lang.Object getContentsModel()
Returns the data model of the node contents. This is a DefaultStyledDocument.
Specified by:
getContentsModel in interface NodeInfo
Returns:
Data model of our contents

getTitle

public java.lang.String getTitle()
Returns the title of the node.
Specified by:
getTitle in interface NodeInfo
Returns:
Our title

copyFrom

public void copyFrom(NodeInfo ni)
Fills data into myself from another node. Does a deep copy.
Parameters:
ni - Node to copy from

setTitle

public void setTitle(java.lang.String newhead)
Sets my title.
Parameters:
newhead - New title

toString

public java.lang.String toString()
Returns my title.
Overrides:
toString in class java.lang.Object
Returns:
My title

copy

public Copyable copy()
Makes a new copy of myself. Does a deep copy.
Specified by:
copy in interface Copyable
Returns:
Copy of myself in a newly allocated object

getCurrentEffect

public int getCurrentEffect()
Retrieves the current drag-over effect for this node. Useful in conjunction with graphical presentation.
Specified by:
getCurrentEffect in interface DragOverData
Returns:
Current drag-over effect.

setCurrentEffect

public void setCurrentEffect(int effect)
Sets the current drag-over effect for this node. Useful in conjunction with graphical presentation.
Specified by:
setCurrentEffect in interface DragOverData
Parameters:
effect - New drag-over effect.

instrument/JTree API Documentation