mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

matthew_swift
14.06.2007 abaf062ce64bbe4909651563cb81171e794c37ab
Add support for indenting the heading separator and use it in menus to emphasis the option numbers.
2 files modified
38 ■■■■■ changed files
opends/src/server/org/opends/server/util/cli/MenuBuilder.java 1 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/table/TextTablePrinter.java 37 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/cli/MenuBuilder.java
@@ -787,6 +787,7 @@
      printer.setDisplayHeadings(false);
    } else {
      printer.setDisplayHeadings(true);
      printer.setHeadingSeparatorStartColumn(1);
    }
    printer.setIndentWidth(4);
opends/src/server/org/opends/server/util/table/TextTablePrinter.java
@@ -139,10 +139,20 @@
          }
          for (int j = 0; j < width; j++) {
            builder.append(headingSeparator);
            if (headingSeparatorStartColumn > 0) {
              if (i < headingSeparatorStartColumn) {
                builder.append(' ');
              } else if (i == headingSeparatorStartColumn && j < padding) {
                builder.append(' ');
              } else {
                builder.append(headingSeparator);
              }
            } else {
              builder.append(headingSeparator);
            }
          }
          if (i < (totalColumns - 1)) {
          if ((i >= headingSeparatorStartColumn) && i < (totalColumns - 1)) {
            builder.append(columnSeparator);
          }
        }
@@ -362,6 +372,9 @@
  // heading row from the rows beneath.
  private char headingSeparator = DEFAULT_HEADING_SEPARATOR;
  // The column where the heading separator should begin.
  private int headingSeparatorStartColumn = 0;
  // The padding which will be used to separate a cell's
  // contents from its adjacent column separators.
  private int padding = DEFAULT_PADDING;
@@ -479,6 +492,26 @@
  /**
   * Sets the heading separator start column. The heading separator
   * will only be display in the specified column and all subsequent
   * columns. Usually this should be left at zero (the default) but
   * sometimes it useful to indent the heading separate in order to
   * provide additional emphasis (for example in menus).
   *
   * @param startColumn
   *          The heading separator start column.
   */
  public void setHeadingSeparatorStartColumn(int startColumn) {
    if (startColumn < 0) {
      throw new IllegalArgumentException("Negative start column "
          + startColumn);
    }
    this.headingSeparatorStartColumn = startColumn;
  }
  /**
   * Sets the amount of characters that the table should be indented.
   * By default the table is not indented.
   *