public class DefaultOutlineNode extends Object implements MutableOutlineNode<DefaultOutlineNode>
MutableOutlineNode
(and thus OutlineNode
) suitable
for most common use cases.
Typically, DefaultOutlineNode
s are part of an Outline Tree with an instance of
DefaultOutline
at its root. Refer to DefaultOutline
's class documentation for
further information on both classes.Constructor and Description |
---|
DefaultOutlineNode()
Create a new instance with an empty description and no instructions.
|
DefaultOutlineNode(String description,
Instruction... instructions)
Create a new instance with the given description and instructions.
|
DefaultOutlineNode(String description,
InstructionChain instructionChain) |
DefaultOutlineNode(String description,
List<Instruction> instructions)
Create a new instance with the given description and list of instructions.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Register a
PropertyChangeListener which will be informed upon every property change of
this node. |
protected void |
ensureWriteLocked() |
List<DefaultOutlineNode> |
getChildren()
Returns this node's direct children in a list which allows for modifications.
|
String |
getDescription()
Get the human-readable description of this node.
|
InstructionChain |
getInstructionChain()
Get the
Instruction s to be executed for this node. |
DefaultOutline |
getOutline()
Return the
DefaultOutline to which this node belongs. |
DefaultOutlineNode |
getParent()
Return the parent
OutlineNode or null , if this node is the root of a
subtree or the root of an Outline Tree (see Outline ). |
Map<String,Object> |
getProperties()
Return a map of user properties.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a
PropertyChangeListener which was previously registered using
addPropertyChangeListener(PropertyChangeListener) . |
void |
setDescription(String description)
Set the human-readable description for this node.
|
void |
setInstructionChain(Instruction... instructions)
Convenience method to replace the entire chain of instructionChain with an
InstructionChain created from the given Instruction s. |
void |
setInstructionChain(InstructionChain newChain)
Replace the entire chain of instructionChain with the given one.
|
String |
toString() |
public DefaultOutlineNode()
public DefaultOutlineNode(String description, Instruction... instructions)
description
- a concise, human-readable description of this node. Passing
null
leads to an empty String being set.instructions
- zero or more Instruction
instances to be assigned to this nodepublic DefaultOutlineNode(String description, List<Instruction> instructions)
description
- a concise, human-readable description of this node. Passing
null
leads to an empty String being set.instructions
- a list of Instruction
instances to be assigned to this node. They
will be copied into an immutable list.public DefaultOutlineNode(String description, InstructionChain instructionChain)
public Map<String,Object> getProperties()
OutlineNode
's presentation or in other ways further augment its data.
A mutable, thread-safe map implementation is returned. It is not necessary to acquire the
Outline
's lock when calling this method or when accessing/modifying the map's contents.
getProperties
in interface MutableOutlineNode<DefaultOutlineNode>
getProperties
in interface OutlineNode<DefaultOutlineNode>
getProperties
in interface PropertiesProvider
public List<DefaultOutlineNode> getChildren()
DefaultOutline.getLock()
. For modifications, the write lock must be acquired, for
read-only operations the read lock will suffice.getChildren
in interface MutableOutlineNode<DefaultOutlineNode>
getChildren
in interface OutlineNode<DefaultOutlineNode>
public InstructionChain getInstructionChain()
Instruction
s to be executed for this node. It is not necessary to acquire the
outline's lock before calling this method.getInstructionChain
in interface OutlineNode<DefaultOutlineNode>
null
.public void setInstructionChain(Instruction... instructions)
InstructionChain
created from the given Instruction
s. It is necessary to
acquire the outline's lock via DefaultOutline.getLock()
before calling this method.instructions
- The Instruction
s to be used by this node in the future. If this
parameter is null
, the node will have no Instruction
s to be
executed.setInstructionChain(InstructionChain)
public void setInstructionChain(InstructionChain newChain)
DefaultOutline.getLock()
before calling this method.setInstructionChain
in interface MutableOutlineNode<DefaultOutlineNode>
newChain
- An InstructionChain
holding the Instruction
s to be used by this
node in the future. If this parameter is null
, the node will have no
Instruction
s to be executed.public String getDescription()
getDescription
in interface OutlineNode<DefaultOutlineNode>
null
.public void setDescription(String description)
DefaultOutline.getLock()
before calling this method.setDescription
in interface MutableOutlineNode<DefaultOutlineNode>
description
- the new description string. Passing null
leads to an empty
string being set.protected void ensureWriteLocked()
public DefaultOutlineNode getParent()
OutlineNode
or null
, if this node is the root of a
subtree or the root of an Outline Tree (see Outline
).
It is not necessary to acquire the outline's read lock via DefaultOutline.getLock()
before calling this method.
getParent
in interface OutlineNode<DefaultOutlineNode>
null
if this node is the root node.public void addPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
which will be informed upon every property change of
this node.listener
- the listener implementation to be registered. Passing null
will
have no effect.for a listener that will be informed upon every change in every node in an
entire Outline Tree
public void removePropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
which was previously registered using
addPropertyChangeListener(PropertyChangeListener)
.listener
- the listener implementation to be removed. Passing null
will hae
no effect.public DefaultOutline getOutline()
DefaultOutline
to which this node belongs. It is not required to acquire the
outline's lock to call this method.getOutline
in interface MutableOutlineNode<DefaultOutlineNode>
getOutline
in interface OutlineNode<DefaultOutlineNode>
DefaultOutline
, or null
if this node is not part of an
Outline TreeCopyright © 2024 levigo holding gmbh. All rights reserved.