Enum TabBehaviour

java.lang.Object
java.lang.Enum<TabBehaviour>
com.googlecode.lanterna.screen.TabBehaviour
All Implemented Interfaces:
Serializable, Comparable<TabBehaviour>, java.lang.constant.Constable

public enum TabBehaviour extends Enum<TabBehaviour>
What to do about the tab character when putting on a Screen. Since tabs are a bit special, their meaning depends on which column the cursor is in when it's printed, we'll need to have some way to tell the Screen what to do when encountering a tab character.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Tab characters are replaced with enough space characters to reach the next column index that is evenly divisible by 4, simulating a normal tab character when placed inside a text document.
    Tab characters are replaced with enough space characters to reach the next column index that is evenly divisible by 8, simulating a normal tab character when placed inside a text document.
    Tab characters are replaced with eight blank spaces, no matter where the tab was placed.
    Tab characters are replaced with four blank spaces, no matter where the tab was placed.
    Tab characters are replaced with a single blank space, no matter where the tab was placed.
    Tab characters are replaced with three blank spaces, no matter where the tab was placed.
    Tab characters are replaced with two blank spaces, no matter where the tab was placed.
    Tab characters are not replaced, this will probably have undefined and weird behaviour!
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Integer
     
    private final Integer
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    TabBehaviour(Integer replaceFactor, Integer alignFactor)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getTabReplacement(int columnIndex)
    Returns the String that can replace a tab at the specified position, according to this TabBehaviour.
    replaceTabs(String string, int columnIndex)
    Given a string, being placed on the screen at column X, returns the same string with all tab characters (\t) replaced according to this TabBehaviour.
    Returns the enum constant of this type with the specified name.
    static TabBehaviour[]
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • IGNORE

      public static final TabBehaviour IGNORE
      Tab characters are not replaced, this will probably have undefined and weird behaviour!
    • CONVERT_TO_ONE_SPACE

      public static final TabBehaviour CONVERT_TO_ONE_SPACE
      Tab characters are replaced with a single blank space, no matter where the tab was placed.
    • CONVERT_TO_TWO_SPACES

      public static final TabBehaviour CONVERT_TO_TWO_SPACES
      Tab characters are replaced with two blank spaces, no matter where the tab was placed.
    • CONVERT_TO_THREE_SPACES

      public static final TabBehaviour CONVERT_TO_THREE_SPACES
      Tab characters are replaced with three blank spaces, no matter where the tab was placed.
    • CONVERT_TO_FOUR_SPACES

      public static final TabBehaviour CONVERT_TO_FOUR_SPACES
      Tab characters are replaced with four blank spaces, no matter where the tab was placed.
    • CONVERT_TO_EIGHT_SPACES

      public static final TabBehaviour CONVERT_TO_EIGHT_SPACES
      Tab characters are replaced with eight blank spaces, no matter where the tab was placed.
    • ALIGN_TO_COLUMN_4

      public static final TabBehaviour ALIGN_TO_COLUMN_4
      Tab characters are replaced with enough space characters to reach the next column index that is evenly divisible by 4, simulating a normal tab character when placed inside a text document.
    • ALIGN_TO_COLUMN_8

      public static final TabBehaviour ALIGN_TO_COLUMN_8
      Tab characters are replaced with enough space characters to reach the next column index that is evenly divisible by 8, simulating a normal tab character when placed inside a text document.
  • Field Details

    • replaceFactor

      private final Integer replaceFactor
    • alignFactor

      private final Integer alignFactor
  • Constructor Details

    • TabBehaviour

      private TabBehaviour(Integer replaceFactor, Integer alignFactor)
  • Method Details

    • values

      public static TabBehaviour[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static TabBehaviour valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • replaceTabs

      public String replaceTabs(String string, int columnIndex)
      Given a string, being placed on the screen at column X, returns the same string with all tab characters (\t) replaced according to this TabBehaviour.
      Parameters:
      string - String that is going to be put to the screen, potentially containing tab characters
      columnIndex - Column on the screen where the first character of the string is going to end up
      Returns:
      The input string with all tab characters replaced with spaces, according to this TabBehaviour
    • getTabReplacement

      public String getTabReplacement(int columnIndex)
      Returns the String that can replace a tab at the specified position, according to this TabBehaviour.
      Parameters:
      columnIndex - Column index of where the tab character is placed
      Returns:
      String consisting of 1 or more space character