Class AbstractTreeNodeDecorator
- java.lang.Object
-
- hu.webarticum.treeprinter.decorator.AbstractTreeNodeDecorator
-
- All Implemented Interfaces:
TreeNode
- Direct Known Subclasses:
BorderTreeNodeDecorator,DefaultFsTreeNodeDecorator,JustifyTreeNodeDecorator,PadTreeNodeDecorator,ShadowTreeNodeDecorator,TrackingTreeNodeDecorator
public abstract class AbstractTreeNodeDecorator extends java.lang.Object implements TreeNode
Base class forTreeNodedecorators. Decorators should only effect if the wrapped node is decorable. Decorators should inherit by default (wrap their children with a similar decorator), and should not inherit when theinheritoption is set tofalse.
-
-
Constructor Summary
Constructors Constructor Description AbstractTreeNodeDecorator(TreeNode baseNode)AbstractTreeNodeDecorator(TreeNode baseNode, boolean inherit)AbstractTreeNodeDecorator(TreeNode baseNode, boolean inherit, boolean decorable)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.List<TreeNode>children()Gets the list of child nodes of this node.java.lang.Stringcontent()Gets the content of this node.protected abstract java.lang.StringdecoratedContent()TreeNodegetDecoratedNode()Insetsinsets()Gets the content insets.booleanisDecorable()Checks if this node can be decorated.booleanisPlaceholder()Checks if this node is a placeholder.TreeNodeoriginalNode()Gets the original node object.protected abstract TreeNodewrapChild(TreeNode childNode, int index)
-
-
-
Field Detail
-
baseNode
protected final TreeNode baseNode
-
inherit
protected final boolean inherit
-
decorable
protected final boolean decorable
-
-
Constructor Detail
-
AbstractTreeNodeDecorator
public AbstractTreeNodeDecorator(TreeNode baseNode)
-
AbstractTreeNodeDecorator
public AbstractTreeNodeDecorator(TreeNode baseNode, boolean inherit)
-
AbstractTreeNodeDecorator
public AbstractTreeNodeDecorator(TreeNode baseNode, boolean inherit, boolean decorable)
-
-
Method Detail
-
content
public java.lang.String content()
Description copied from interface:TreeNodeGets the content of this node.
-
getDecoratedNode
public TreeNode getDecoratedNode()
-
originalNode
public TreeNode originalNode()
Description copied from interface:TreeNodeGets the original node object. By default, returns withthis. Decorators should return with the most inner decorated node.- Specified by:
originalNodein interfaceTreeNode
-
insets
public Insets insets()
Description copied from interface:TreeNodeGets the content insets. Returns with the sizes of the visual decoration around the main content. By default, this is fully zero. Visually extending decorators (border, shadow etc.) should extend the insets with the sizes of the visual extension.
-
isDecorable
public boolean isDecorable()
Description copied from interface:TreeNodeChecks if this node can be decorated. By default, decorators should keep non-decorable nodes untouched.- Specified by:
isDecorablein interfaceTreeNode
-
isPlaceholder
public boolean isPlaceholder()
Description copied from interface:TreeNodeChecks if this node is a placeholder. By default, genericTreePrinterimplementations hide placeholder nodes. Some types of implementation (e. g. n-ary trees) should take these into account anyway.- Specified by:
isPlaceholderin interfaceTreeNode
-
children
public java.util.List<TreeNode> children()
Description copied from interface:TreeNodeGets the list of child nodes of this node.
-
decoratedContent
protected abstract java.lang.String decoratedContent()
-
-