Class RenameColumnHelper

java.lang.Object
org.eclipse.nebula.widgets.nattable.columnRename.RenameColumnHelper
All Implemented Interfaces:
IPersistable

public class RenameColumnHelper extends Object implements IPersistable
Helper class for handling column renaming by user interactions on the column header.
  • Field Details

    • PERSISTENCE_KEY_RENAMED_COLUMN_HEADERS

      public static final String PERSISTENCE_KEY_RENAMED_COLUMN_HEADERS
      See Also:
    • renamedColumnsLabelsByIndex

      protected Map<Integer,String> renamedColumnsLabelsByIndex
      Tracks the renamed labels provided by the user.
  • Constructor Details

  • Method Details

    • renameColumnPosition

      public boolean renameColumnPosition(int columnPosition, String customColumnName)
      Rename the column at the given position. Note: This does not change the underlying column name.
      Parameters:
      columnPosition - The column position of the column that should be renamed.
      customColumnName - The name that should used as the user defined column name.
      Returns:
      true if the column at the given position was successfully changed.
    • renameColumnIndex

      public boolean renameColumnIndex(int index, String customColumnName)
      Rename the column at the given index. Note: This does not change the underlying column name.
      Parameters:
      index - The column index of the column that should be renamed.
      customColumnName - The name that should used as the user defined column name.
      Returns:
      true if the column at the given index was successfully changed.
    • getRenamedColumnLabel

      public String getRenamedColumnLabel(int columnIndex)
      Parameters:
      columnIndex - the column index
      Returns:
      the custom label for this column as specified by the user Null if the columns is not renamed
    • isColumnRenamed

      public boolean isColumnRenamed(int columnIndex)
      Parameters:
      columnIndex - the column index
      Returns:
      true if the column at the specified index was renamed by a user.
    • isAnyColumnRenamed

      public boolean isAnyColumnRenamed()
      Returns:
      true if a user renamed any column.
    • handleStructuralChanges

      public void handleStructuralChanges(Collection<StructuralDiff> columnDiffs)
      Handle the given collection of StructuralDiff objects to update the indexes of the renamed column labels.
      Parameters:
      columnDiffs - The StructuralDiffs to handle
      Since:
      1.4
    • loadState

      public void loadState(String prefix, Properties properties)
      Description copied from interface: IPersistable
      Restore the state out of the given Properties identified by the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.
      Specified by:
      loadState in interface IPersistable
      Parameters:
      prefix - The prefix to use for the state keys. Is also used as the state configuration name.
      properties - The Properties instance to load the state from.
    • saveState

      public void saveState(String prefix, Properties properties)
      Description copied from interface: IPersistable
      Saves the state to the given Properties using the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.
      Specified by:
      saveState in interface IPersistable
      Parameters:
      prefix - The prefix to use for the state keys. Is also used as the state configuration name.
      properties - The Properties instance to save the state to.