public static class CommandLine.Help.Layout extends Object
Delegates to the renderers to create CommandLine.Help.Ansi.Text
values for the annotated fields, and uses a
CommandLine.Help.TextTable
to display these values in tabular format. Layout is responsible for deciding which values
to display where in the table. By default, Layout shows one option or parameter per table row.
Customize by overriding the layout(Field, CommandLine.Help.Ansi.Text[][])
method.
Modifier and Type | Field and Description |
---|---|
protected CommandLine.Help.ColorScheme |
colorScheme |
protected CommandLine.Help.IOptionRenderer |
optionRenderer |
protected CommandLine.Help.IParameterRenderer |
parameterRenderer |
protected CommandLine.Help.TextTable |
table |
Constructor and Description |
---|
Layout(CommandLine.Help.ColorScheme colorScheme)
Constructs a Layout with the specified color scheme, a new default TextTable, the
default option renderer, and the
default parameter renderer.
|
Layout(CommandLine.Help.ColorScheme colorScheme,
CommandLine.Help.TextTable textTable)
Constructs a Layout with the specified color scheme, the specified TextTable, the
default option renderer, and the
default parameter renderer.
|
Layout(CommandLine.Help.ColorScheme colorScheme,
CommandLine.Help.TextTable textTable,
CommandLine.Help.IOptionRenderer optionRenderer,
CommandLine.Help.IParameterRenderer parameterRenderer)
Constructs a Layout with the specified color scheme, the specified TextTable, the
specified option renderer and the specified parameter renderer.
|
Modifier and Type | Method and Description |
---|---|
void |
addOption(Field field,
CommandLine.Help.IParamLabelRenderer paramLabelRenderer)
Delegates to the
option renderer of this layout to obtain
text values for the specified CommandLine.Option , and then calls the layout(Field, CommandLine.Help.Ansi.Text[][])
method to write these text values into the correct cells in the TextTable. |
void |
addOptions(List<Field> fields,
CommandLine.Help.IParamLabelRenderer paramLabelRenderer)
Calls
addOption(Field, CommandLine.Help.IParamLabelRenderer) for all non-hidden Options in the list. |
void |
addPositionalParameter(Field field,
CommandLine.Help.IParamLabelRenderer paramLabelRenderer)
Delegates to the
parameter renderer of this layout
to obtain text values for the specified CommandLine.Parameters , and then calls
layout(Field, CommandLine.Help.Ansi.Text[][]) to write these text values into the correct cells in the TextTable. |
void |
addPositionalParameters(List<Field> fields,
CommandLine.Help.IParamLabelRenderer paramLabelRenderer)
Calls
addPositionalParameter(Field, CommandLine.Help.IParamLabelRenderer) for all non-hidden Parameters in the list. |
void |
layout(Field field,
CommandLine.Help.Ansi.Text[][] cellValues)
Copies the specified text values into the correct cells in the
CommandLine.Help.TextTable . |
String |
toString()
Returns the section of the usage help message accumulated in the TextTable owned by this layout.
|
protected final CommandLine.Help.ColorScheme colorScheme
protected final CommandLine.Help.TextTable table
protected CommandLine.Help.IOptionRenderer optionRenderer
protected CommandLine.Help.IParameterRenderer parameterRenderer
public Layout(CommandLine.Help.ColorScheme colorScheme)
colorScheme
- the color scheme to use for common, auto-generated parts of the usage help messagepublic Layout(CommandLine.Help.ColorScheme colorScheme, CommandLine.Help.TextTable textTable)
colorScheme
- the color scheme to use for common, auto-generated parts of the usage help messagetextTable
- the TextTable to lay out parts of the usage help message in tabular formatpublic Layout(CommandLine.Help.ColorScheme colorScheme, CommandLine.Help.TextTable textTable, CommandLine.Help.IOptionRenderer optionRenderer, CommandLine.Help.IParameterRenderer parameterRenderer)
colorScheme
- the color scheme to use for common, auto-generated parts of the usage help messageoptionRenderer
- the object responsible for rendering Options to TextparameterRenderer
- the object responsible for rendering Parameters to TexttextTable
- the TextTable to lay out parts of the usage help message in tabular formatpublic void layout(Field field, CommandLine.Help.Ansi.Text[][] cellValues)
CommandLine.Help.TextTable
. This implementation
delegates to CommandLine.Help.TextTable.addRowValues(CommandLine.Help.Ansi.Text...)
for each row of values.
Subclasses may override.
field
- the field annotated with the specified Option or ParameterscellValues
- the text values representing the Option/Parameters, to be displayed in tabular formpublic void addOptions(List<Field> fields, CommandLine.Help.IParamLabelRenderer paramLabelRenderer)
addOption(Field, CommandLine.Help.IParamLabelRenderer)
for all non-hidden Options in the list.fields
- fields annotated with CommandLine.Option
to add usage descriptions forparamLabelRenderer
- object that knows how to render option parameterspublic void addOption(Field field, CommandLine.Help.IParamLabelRenderer paramLabelRenderer)
option renderer
of this layout to obtain
text values for the specified CommandLine.Option
, and then calls the layout(Field, CommandLine.Help.Ansi.Text[][])
method to write these text values into the correct cells in the TextTable.field
- the field annotated with the specified OptionparamLabelRenderer
- knows how to render option parameterspublic void addPositionalParameters(List<Field> fields, CommandLine.Help.IParamLabelRenderer paramLabelRenderer)
addPositionalParameter(Field, CommandLine.Help.IParamLabelRenderer)
for all non-hidden Parameters in the list.fields
- fields annotated with CommandLine.Parameters
to add usage descriptions forparamLabelRenderer
- knows how to render option parameterspublic void addPositionalParameter(Field field, CommandLine.Help.IParamLabelRenderer paramLabelRenderer)
parameter renderer
of this layout
to obtain text values for the specified CommandLine.Parameters
, and then calls
layout(Field, CommandLine.Help.Ansi.Text[][])
to write these text values into the correct cells in the TextTable.field
- the field annotated with the specified ParametersparamLabelRenderer
- knows how to render option parametersCopyright © 1999-2020 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.