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 Summary
Fields Modifier and Type Field Description static String
PERSISTENCE_KEY_RENAMED_COLUMN_HEADERS
protected Map<Integer,String>
renamedColumnsLabelsByIndex
Tracks the renamed labels provided by the user.-
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description RenameColumnHelper(ColumnHeaderLayer columnHeaderLayer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getRenamedColumnLabel(int columnIndex)
void
handleStructuralChanges(Collection<StructuralDiff> columnDiffs)
Handle the given collection ofStructuralDiff
objects to update the indexes of the renamed column labels.boolean
isAnyColumnRenamed()
boolean
isColumnRenamed(int columnIndex)
void
loadState(String prefix, Properties properties)
Restore the state out of the given Properties identified by the specified prefix.boolean
renameColumnIndex(int index, String customColumnName)
Rename the column at the given index.boolean
renameColumnPosition(int columnPosition, String customColumnName)
Rename the column at the given position.void
saveState(String prefix, Properties properties)
Saves the state to the given Properties using the specified prefix.
-
-
-
Field Detail
-
PERSISTENCE_KEY_RENAMED_COLUMN_HEADERS
public static final String PERSISTENCE_KEY_RENAMED_COLUMN_HEADERS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RenameColumnHelper
public RenameColumnHelper(ColumnHeaderLayer columnHeaderLayer)
- Parameters:
columnHeaderLayer
- TheColumnHeaderLayer
this helper is connected to.
-
-
Method Detail
-
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 ofStructuralDiff
objects to update the indexes of the renamed column labels.- Parameters:
columnDiffs
- TheStructuralDiff
s 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 interfaceIPersistable
- 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 interfaceIPersistable
- 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.
-
-