|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.sourceforge.java.util.gui.jface.viewers.MutableTreeElement
Default IMutableTreeElement implementation which can be used
to create and organize hierarchical structures in JFace
TreeViewer instances.
| Field Summary | |
private boolean |
allowsSubElements
true to allow, false to disallow sub
elements
|
private Object |
data
The associated data Object |
private List |
elements
The elements in a MutableTreeElement |
private static ITreeElement[] |
EMPTY_ELEMENTS
A predefined empty elements array if a MutableTreeElement does not hold any elements. |
private List |
eventListener
The list of registered IMutableTreeElementListener
instances.
|
private IMutableTreeElement |
parent
The parent of a MutableTreeElement |
| Constructor Summary | |
MutableTreeElement()
Creates a new MutableTreeElement which is allowed to have
sub elements by default.
|
|
MutableTreeElement(Object data)
Creates a new MutableTreeElement associated to the
specified data Object which is allowed to
have sub elements by default.
|
|
MutableTreeElement(Object data,
boolean allowsSubElements)
Creates a new MutableTreeElement associated to the
specified data Object and allowing sub
elements depending on the given allowsSubElements flag.
|
|
| Method Summary | |
void |
add(IMutableTreeElement element)
Adds the specified element to this MutableTreeElement.
|
void |
addIMutableTreeElementListener(IMutableTreeElementListener listener)
Adds the specified IMutableTreeElementListener to the list
of registered listeners.
|
boolean |
allowsSubElements()
Returns true if this MutableTreeElement
allows sub elements.
|
ITreeElement[] |
collectLeafs()
Recursively collects all leafs, i.e. |
void |
dispose()
Disposes this MutableTreeElement.
|
protected void |
fireElementAdded(IMutableTreeElement elementAdded)
Notifies all registered IMutableTreeElementListener
instances that the specified element has been added to this
MutableTreeElement.
|
protected void |
fireElementRemoved(IMutableTreeElement elementRemoved)
Notifies all registered IMutableTreeElementListener
instances that the specified element has been removed from this
MutableTreeElement.
|
protected void |
fireElementUpdated(IMutableTreeElement elementUpdated)
Notifies all registered IMutableTreeElementListener
instances that the specified element has been updated.
|
Object |
getData()
Gets the data Object associated to this
MutableTreeElement.
|
ITreeElement |
getElementAt(int index)
Returns the IMutableTreeElement at the specified index.
|
ITreeElement[] |
getElements()
Returns the elements in this MutableTreeElement.
|
int |
getIndex(ITreeElement element)
Returns the index of the specified element in this
MutableTreeElement.
|
ITreeElement |
getParent()
Returns the parent of this MutableTreeElement.
|
static String |
getPath(IMutableTreeElement element)
Gets a String forming the path from the root to the
specified ITreeElement using the > character as
path delimiter.
|
int |
getSize()
Returns the number of elements in this MutableTreeElement.
|
boolean |
hasSubElements()
Returns true if this MutableTreeElement
contains any sub elements.
|
private void |
initializeEventListener()
Initializes the internal event listener list structure. |
boolean |
isSubElement(ITreeElement element)
Returns true if the specified element is a
sub element, i.e. a descendant of this MutableTreeElement.
|
void |
remove(IMutableTreeElement element)
Removes the specified element from this MutableTreeElement.
|
void |
removeIMutableTreeElementListener(IMutableTreeElementListener listener)
Removes the specified IMutableTreeElementListener from the
list of registered listeners.
|
void |
setData(Object data)
Sets an arbitrary data Object for this
MutableTreeElement.
|
void |
setParent(IMutableTreeElement parent)
Sets this MutableTreeElement's parent to the specified
element.
|
String |
toString()
Gets the textual represntation of this MutableTreeElement.
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private static final ITreeElement[] EMPTY_ELEMENTS
A predefined empty elements array if a MutableTreeElement does not hold any elements.
private List elements
The elements in a MutableTreeElement
private IMutableTreeElement parent
The parent of a MutableTreeElement
private Object data
The associated data Object
private boolean allowsSubElements
true to allow, false to disallow sub
elements
private List eventListener
The list of registered IMutableTreeElementListener
instances.
| Constructor Detail |
public MutableTreeElement()
Creates a new MutableTreeElement which is allowed to have
sub elements by default.
MutableTreeElement(Object),
MutableTreeElement(Object, boolean)public MutableTreeElement(Object data)
Creates a new MutableTreeElement associated to the
specified data Object which is allowed to
have sub elements by default.
data - the Object to associate this
MutableTreeElement toMutableTreeElement(),
MutableTreeElement(Object, boolean)
public MutableTreeElement(Object data,
boolean allowsSubElements)
Creates a new MutableTreeElement associated to the
specified data Object and allowing sub
elements depending on the given allowsSubElements flag.
data - the Object to associate this
MutableTreeElement toallowsSubElements - true to allow, false
to disallow sub elementsMutableTreeElement(),
MutableTreeElement(Object)| Method Detail |
public String toString()
Gets the textual represntation of this MutableTreeElement.
Delegates to the ToString() method of this
MutableTreeElement's data object.
MutableTreeElement
or null if this MutableTreeElement's data
object is set to null, i.e. is not availablepublic void add(IMutableTreeElement element)
Adds the specified element to this MutableTreeElement.
Notifies all registered IMutableTreeElementListener
instances of the add operation. Note that this method has only effect if
this MutableTreeElement is allowed to have sub elements,
i.e. the allowsSubElements() methods has to return
true.
add in interface IMutableTreeElementelement - the IMutableTreeElement to addallowsSubElements()public void remove(IMutableTreeElement element)
Removes the specified element from this MutableTreeElement.
Notifies all registered IMutableTreeElementListener
instances of the removal operation. Note that this method has only effect
if this MutableTreeElement is allowed to have sub
elements, i.e. the allowsSubElements() methods has to return
true.
remove in interface IMutableTreeElementelement - the IMutableTreeElement to remove
IllegalArgumentException - if element is
null or is not an element of this
MutableTreeElementallowsSubElementspublic ITreeElement[] getElements()
Returns the elements in this MutableTreeElement.
getElements in interface ITreeElementMutableTreeElement; an empty array
if this MutableTreeElement does not hold any elementspublic boolean allowsSubElements()
Returns true if this MutableTreeElement
allows sub elements.
allowsSubElements in interface ITreeElementtrue if sub elements are allowed,
false otherwise;public ITreeElement getElementAt(int index)
Returns the IMutableTreeElement at the specified index.
getElementAt in interface ITreeElementindex - the index to query the IMutableTreeElement
for
IMutableTreeElement at the specified indexpublic int getSize()
Returns the number of elements in this MutableTreeElement.
getSize in interface ITreeElementMutableTreeElementpublic int getIndex(ITreeElement element)
Returns the index of the specified element in this
MutableTreeElement.
getIndex in interface ITreeElementelement - the IMutableTreeElement to get the index
for
element in this
MutableTreeElementpublic ITreeElement getParent()
Returns the parent of this MutableTreeElement.
getParent in interface ITreeElementMutableTreeElementsetParent(IMutableTreeElement)public void setParent(IMutableTreeElement parent)
Sets this MutableTreeElement's parent to the specified
element.
setParent in interface IMutableTreeElementparent - the new parent to set for this
MutableTreeElementgetParent()public boolean hasSubElements()
Returns true if this MutableTreeElement
contains any sub elements.
hasSubElements in interface ITreeElementtrue if this MutableTreeElement has
any sub elements; false otherwisepublic void setData(Object data)
Sets an arbitrary data Object for this
MutableTreeElement.
setData in interface IMutableTreeElementdata - the Object to associate this
MutableTreeElement togetData()public Object getData()
Gets the data Object associated to this
MutableTreeElement.
getData in interface IMutableTreeElementObject associated to this
MutableTreeElementsetData(Object)public boolean isSubElement(ITreeElement element)
Returns true if the specified element is a
sub element, i.e. a descendant of this MutableTreeElement.
isSubElement in interface ITreeElementelement - the element for which to test the posterity
true if the specified element is a
sub element, i.e. a descendant of this MutableTreeElement;
false otherwisepublic ITreeElement[] collectLeafs()
Recursively collects all leafs, i.e. IMutableTreeElements
that do not have any sub elements, starting at this
MutableTreeElement.
public void addIMutableTreeElementListener(IMutableTreeElementListener listener)
Adds the specified IMutableTreeElementListener to the list
of registered listeners.
addIMutableTreeElementListener in interface IMutableTreeElementlistener - the listener to addremoveIMutableTreeElementListener(IMutableTreeElementListener)public void removeIMutableTreeElementListener(IMutableTreeElementListener listener)
Removes the specified IMutableTreeElementListener from the
list of registered listeners.
removeIMutableTreeElementListener in interface IMutableTreeElementlistener - the listener to removeaddIMutableTreeElementListener(IMutableTreeElementListener)public void dispose()
Disposes this MutableTreeElement.
dispose in interface IMutableTreeElementpublic static String getPath(IMutableTreeElement element)
Gets a String forming the path from the root to the
specified ITreeElement using the > character as
path delimiter.
element - the ITreeElement to get the path for
ITreeElementprotected void fireElementAdded(IMutableTreeElement elementAdded)
Notifies all registered IMutableTreeElementListener
instances that the specified element has been added to this
MutableTreeElement.
elementAdded - the element that was added to this
MutableTreeElementprotected void fireElementRemoved(IMutableTreeElement elementRemoved)
Notifies all registered IMutableTreeElementListener
instances that the specified element has been removed from this
MutableTreeElement.
elementRemoved - the element that was removed from this
MutableTreeElementprotected void fireElementUpdated(IMutableTreeElement elementUpdated)
Notifies all registered IMutableTreeElementListener
instances that the specified element has been updated.
elementUpdated - the element that was updatedprivate void initializeEventListener()
Initializes the internal event listener list structure.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||