public final class TreeOptions extends Object
| Constructor and Description |
|---|
TreeOptions() |
| Modifier and Type | Method and Description |
|---|---|
static TreeOptions |
copyOf(TreeOptions pTreeOptions) |
AnnotationPosition |
getAnnotationPosition() |
BiFunction<Callout,Node,String> |
getCalloutProcessor()
Getter.
|
String |
getCalloutText(Callout pCalloutType)
Look up the callout type in order to check if a specific callout text is registered for this callout type.
|
ColorScheme |
getColorScheme() |
CycleProtection |
getCycleProtection() |
IdentityScheme |
getIdentityScheme() |
int |
getMaxDepth() |
TreeStyle |
getStyle() |
int |
getVerticalSpacing() |
boolean |
isCycleAsPruned() |
void |
setAnnotationPosition(AnnotationPosition pAnnotationPosition) |
void |
setCalloutProcessor(BiFunction<Callout,Node,String> pCalloutProcessor)
Registers a callout processor.
|
void |
setCalloutText(Callout pCalloutType,
String pText)
Register a callout text for a callout type, which will be printed instead of the normal callout text.
|
void |
setColorScheme(ColorScheme pColorScheme) |
void |
setCycleAsPruned(boolean pCycleAsPruned)
Setter.
|
void |
setCycleProtection(CycleProtection pCycleProtection) |
void |
setEnableDefaultColoring(boolean pEnableDefaultColoring)
Setter.
|
void |
setIdentityScheme(IdentityScheme pIdentityScheme) |
void |
setMaxDepth(int pMaxDepth)
Setter.
|
void |
setStyle(TreeStyle pStyle) |
void |
setVerticalSpacing(int pVerticalSpacing)
Setter.
|
public static TreeOptions copyOf(@Nonnull TreeOptions pTreeOptions)
@Nonnull public AnnotationPosition getAnnotationPosition()
@CheckForNull public BiFunction<Callout,Node,String> getCalloutProcessor()
setCalloutProcessor(java.util.function.BiFunction<org.barfuin.texttree.api.Callout, org.barfuin.texttree.api.Node, java.lang.String>), if any@CheckForNull public String getCalloutText(@Nonnull Callout pCalloutType)
pCalloutType - the type of callout to checknull if no text was registered@Nonnull public ColorScheme getColorScheme()
@Nonnull public CycleProtection getCycleProtection()
@Nonnull public IdentityScheme getIdentityScheme()
public int getMaxDepth()
public int getVerticalSpacing()
public boolean isCycleAsPruned()
public void setAnnotationPosition(@Nullable AnnotationPosition pAnnotationPosition)
public void setCalloutProcessor(@Nullable BiFunction<Callout,Node,String> pCalloutProcessor)
null, in which case no callout will be printed.
The callout processor can only affect the callout texts, not other behavior. For example, when a cycle is
detected and the callout processor returns null, then no callout will be printed, but printing of
child nodes will still stop because of the cycle.
The node passed to the callout processor is the real object from your tree, which should be treated as read-only, i.e. the callout processor should not modify the node.
The callout processor may refer to the text that would have been printed without it by calling
Callout.getText() on its first argument.
This method allows for highly dynamic callout texts which depend on the individual node as well as the callout
type. For simpler cases, consider using setCalloutText(org.barfuin.texttree.api.Callout, java.lang.String) which simply sets a text per callout type.
For example, in order to disable printing of callouts entirely, setCalloutProcessor((c, n) ->
null);
A callout processor takes precedence over callout texts registered with setCalloutText(org.barfuin.texttree.api.Callout, java.lang.String).
pCalloutProcessor - the callout processor, or null to unregistersetCalloutText(org.barfuin.texttree.api.Callout, java.lang.String)public void setCalloutText(@Nonnull Callout pCalloutType, @Nullable String pText)
Note that callout texts produced by a callout processor take precedence over texts registered with this method.
pCalloutType - the callout typepText - the text to display for that callout, or null to show the default textsetCalloutProcessor(java.util.function.BiFunction<org.barfuin.texttree.api.Callout, org.barfuin.texttree.api.Node, java.lang.String>)public void setColorScheme(@Nullable ColorScheme pColorScheme)
public void setCycleAsPruned(boolean pCycleAsPruned)
pCycleAsPruned - flag indicating whether detected cycles should be flagged with a
RepeatingNode callout instead of a Cycle. This would tune
down the cycles a bit, a behavior which may be desired by the invoking application.public void setCycleProtection(@Nullable CycleProtection pCycleProtection)
public void setEnableDefaultColoring(boolean pEnableDefaultColoring)
pEnableDefaultColoring - flag indicating whether the resulting tree should have default colors
(true) or not be colored at all (false). The default is false.
Individual node colors will always be displayed if set.setColorScheme(org.barfuin.texttree.api.color.ColorScheme)public void setIdentityScheme(@Nullable IdentityScheme pIdentityScheme)
public void setMaxDepth(int pMaxDepth)
pMaxDepth - the maximum depth of the resulting tree. Nodes which are lower down will be clipped. A value of
zero indicates unlimited depth.public void setVerticalSpacing(int pVerticalSpacing)
pVerticalSpacing - the number of blank lines to print before each node (defaults to 0)