CommandLine.Help.Layout (picocli 2.3.0 API)
Date: 2018-02-13

picocli

## Class CommandLine.Help.Layout

- java.lang.Object
- - picocli.CommandLine.Help.Layout

- Enclosing class:
    CommandLine.Help

      public static class CommandLine.Help.Layout
      extends java.lang.Object

  Use a Layout to format usage help text for options and parameters in tabular format.

  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.

  See Also:
    `rendering options to text`, `rendering parameters to text`, `showing values in a tabular format`

- - ### Field Summary

    Fields
    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 Summary

    Constructors
    Constructor and Description
    `CommandLine.Help.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.
    `CommandLine.Help.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.
    `CommandLine.Help.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.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addOption(java.lang.reflect.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(java.util.List<java.lang.reflect.Field> fields, CommandLine.Help.IParamLabelRenderer paramLabelRenderer)` Calls `addOption(Field, CommandLine.Help.IParamLabelRenderer)` for all non-hidden Options in the list.
    `void` | `addPositionalParameter(java.lang.reflect.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(java.util.List<java.lang.reflect.Field> fields, CommandLine.Help.IParamLabelRenderer paramLabelRenderer)` Calls `addPositionalParameter(Field, CommandLine.Help.IParamLabelRenderer)` for all non-hidden Parameters in the list.
    `void` | `layout(java.lang.reflect.Field field, CommandLine.Help.Ansi.Text[][] cellValues)` Copies the specified text values into the correct cells in the `CommandLine.Help.TextTable`.
    `java.lang.String` | `toString()` Returns the section of the usage help message accumulated in the TextTable owned by this layout.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### colorScheme

          protected final CommandLine.Help.ColorScheme colorScheme

    - #### table

          protected final CommandLine.Help.TextTable table

    - #### optionRenderer

          protected CommandLine.Help.IOptionRenderer optionRenderer

    - #### parameterRenderer

          protected CommandLine.Help.IParameterRenderer parameterRenderer

  - ### Constructor Detail

    - #### CommandLine.Help.Layout

          public CommandLine.Help.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.
      Parameters:
        `colorScheme` - the color scheme to use for common, auto-generated parts of the usage help message

    - #### CommandLine.Help.Layout

          public CommandLine.Help.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.
      Parameters:
        `colorScheme` - the color scheme to use for common, auto-generated parts of the usage help message
        `textTable` - the TextTable to lay out parts of the usage help message in tabular format

    - #### CommandLine.Help.Layout

          public CommandLine.Help.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.
      Parameters:
        `colorScheme` - the color scheme to use for common, auto-generated parts of the usage help message
        `optionRenderer` - the object responsible for rendering Options to Text
        `parameterRenderer` - the object responsible for rendering Parameters to Text
        `textTable` - the TextTable to lay out parts of the usage help message in tabular format

  - ### Method Detail

    - #### layout

          public void layout(java.lang.reflect.Field field,
                    CommandLine.Help.Ansi.Text[][] cellValues)

      Copies the specified text values into the correct cells in the `CommandLine.Help.TextTable`. This implementation delegates to `CommandLine.Help.TextTable.addRowValues(CommandLine.Help.Ansi.Text...)` for each row of values.

      Subclasses may override.

      Parameters:
        `field` - the field annotated with the specified Option or Parameters
        `cellValues` - the text values representing the Option/Parameters, to be displayed in tabular form

    - #### addOptions

          public void addOptions(java.util.List<java.lang.reflect.Field> fields,
                        CommandLine.Help.IParamLabelRenderer paramLabelRenderer)

      Calls `addOption(Field, CommandLine.Help.IParamLabelRenderer)` for all non-hidden Options in the list.
      Parameters:
        `fields` - fields annotated with `CommandLine.Option` to add usage descriptions for
        `paramLabelRenderer` - object that knows how to render option parameters

    - #### addOption

          public void addOption(java.lang.reflect.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.
      Parameters:
        `field` - the field annotated with the specified Option
        `paramLabelRenderer` - knows how to render option parameters

    - #### addPositionalParameters

          public void addPositionalParameters(java.util.List<java.lang.reflect.Field> fields,
                                     CommandLine.Help.IParamLabelRenderer paramLabelRenderer)

      Calls `addPositionalParameter(Field, CommandLine.Help.IParamLabelRenderer)` for all non-hidden Parameters in the list.
      Parameters:
        `fields` - fields annotated with `CommandLine.Parameters` to add usage descriptions for
        `paramLabelRenderer` - knows how to render option parameters

    - #### addPositionalParameter

          public void addPositionalParameter(java.lang.reflect.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.
      Parameters:
        `field` - the field annotated with the specified Parameters
        `paramLabelRenderer` - knows how to render option parameters

    - #### toString

          public java.lang.String toString()

      Returns the section of the usage help message accumulated in the TextTable owned by this layout.
      Overrides:
        `toString` in class `java.lang.Object`