org.eclipse.nebula.widgets.nattable.layer
Class InvertedLayer

java.lang.Object
  extended by org.eclipse.nebula.widgets.nattable.layer.InvertedLayer
All Implemented Interfaces:
ILayer, ILayerListener, IUniqueIndexLayer, IPersistable

public class InvertedLayer
extends Object
implements IUniqueIndexLayer


Field Summary
 
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR
 
Constructor Summary
InvertedLayer(IUniqueIndexLayer underlyingLayer)
           
 
Method Summary
 void addLayerListener(ILayerListener listener)
           
 void configure(ConfigRegistry configRegistry, UiBindingRegistry uiBindingRegistry)
          Every layer gets this call back, starting at the top of the stack.
 void dispose()
           
 boolean doCommand(ILayerCommand command)
          Opportunity to respond to a command as it flows down the stack.
 void fireLayerEvent(ILayerEvent event)
          Events can be fired to notify other components of the grid.
 org.eclipse.swt.graphics.Rectangle getBoundsByPosition(int columnPosition, int rowPosition)
          Calculates the bounds in pixel for the given cell position.
 ILayerCell getCellByPosition(int columnPosition, int rowPosition)
           
 ICellPainter getCellPainter(int columnPosition, int rowPosition, ILayerCell cell, IConfigRegistry configRegistry)
           
 IClientAreaProvider getClientAreaProvider()
           
 int getColumnCount()
           
 int getColumnIndexByPosition(int columnPosition)
          Gets the underlying non-transformed column index for the given column position.
 int getColumnPositionByIndex(int columnIndex)
           
 int getColumnPositionByX(int x)
          Returns the column position that contains the given x coordinate.
 int getColumnWidthByPosition(int columnPosition)
          Returns the width in pixels of the given column.
 LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition)
           
 Object getDataValueByPosition(int columnPosition, int rowPosition)
           
 String getDisplayModeByPosition(int columnPosition, int rowPosition)
           
 int getHeight()
          Returns the total height in pixels of this layer.
 ILayerPainter getLayerPainter()
           
 int getPreferredColumnCount()
           
 int getPreferredHeight()
           
 int getPreferredRowCount()
           
 int getPreferredWidth()
           
 LabelStack getRegionLabelsByXY(int x, int y)
          Layer can apply its own labels to any cell it wishes.
 int getRowCount()
           
 int getRowHeightByPosition(int rowPosition)
          Returns the height in pixels of the given row.
 int getRowIndexByPosition(int rowPosition)
          Gets the underlying non-transformed row index for the given row position.
 int getRowPositionByIndex(int rowIndex)
           
 int getRowPositionByY(int y)
          Returns the row position that contains the given y coordinate.
 int getStartXOfColumnPosition(int columnPosition)
          Returns the x offset in pixels of the given column.
 int getStartYOfRowPosition(int rowPosition)
          Returns the y offset in pixels of the given row.
 ILayer getUnderlyingLayerByPosition(int columnPosition, int rowPosition)
           
 Collection<ILayer> getUnderlyingLayersByColumnPosition(int columnPosition)
           
 Collection<ILayer> getUnderlyingLayersByRowPosition(int rowPosition)
           
 int getWidth()
          Returns the total width in pixels of this layer.
 void handleLayerEvent(ILayerEvent event)
          Handle an event notification from an ILayer
 boolean hasLayerListener(Class<? extends ILayerListener> layerListenerClass)
           
 boolean isColumnPositionResizable(int columnPosition)
           
 boolean isRowPositionResizable(int rowPosition)
           
 void loadState(String prefix, Properties properties)
          Restore the state out of the given Properties identified by the specified prefix.
 int localToUnderlyingColumnPosition(int localColumnPosition)
          Convert a column position to the coordinates of the underlying layer.
 int localToUnderlyingRowPosition(int localRowPosition)
           
 void registerCommandHandler(ILayerCommandHandler<?> commandHandler)
           
 void registerPersistable(IPersistable persistable)
          Persistables registered with a layer will have a chance to write their data out to the Properties instance when the layer is persisted.
 void removeLayerListener(ILayerListener listener)
           
 void saveState(String prefix, Properties properties)
          Saves the state to the given Properties using the specified prefix.
 void setClientAreaProvider(IClientAreaProvider clientAreaProvider)
           
 int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition)
           
 Collection<Range> underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingColumnPositionRanges)
           
 int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition)
           
 Collection<Range> underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingRowPositionRanges)
           
 void unregisterCommandHandler(Class<? extends ILayerCommand> commandClass)
           
 void unregisterPersistable(IPersistable persistable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InvertedLayer

public InvertedLayer(IUniqueIndexLayer underlyingLayer)
Method Detail

handleLayerEvent

public void handleLayerEvent(ILayerEvent event)
Description copied from interface: ILayerListener
Handle an event notification from an ILayer

Specified by:
handleLayerEvent in interface ILayerListener
Parameters:
event - the event

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.

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.

dispose

public void dispose()
Specified by:
dispose in interface ILayer

registerPersistable

public void registerPersistable(IPersistable persistable)
Description copied from interface: ILayer
Persistables registered with a layer will have a chance to write their data out to the Properties instance when the layer is persisted.

Specified by:
registerPersistable in interface ILayer
Parameters:
persistable - the persistable to be registered

unregisterPersistable

public void unregisterPersistable(IPersistable persistable)
Specified by:
unregisterPersistable in interface ILayer

configure

public void configure(ConfigRegistry configRegistry,
                      UiBindingRegistry uiBindingRegistry)
Description copied from interface: ILayer
Every layer gets this call back, starting at the top of the stack. This is triggered by the NatTable.configure() method. This is an opportunity to add any key/mouse bindings and other general configuration.

Specified by:
configure in interface ILayer
Parameters:
configRegistry - instance owned by NatTable
uiBindingRegistry - instance owned by NatTable

getRegionLabelsByXY

public LabelStack getRegionLabelsByXY(int x,
                                      int y)
Description copied from interface: ILayer
Layer can apply its own labels to any cell it wishes.

Specified by:
getRegionLabelsByXY in interface ILayer
Parameters:
x - the x pixel coordinate
y - the y pixel coordinate
Returns:
a LabelStack containing the region labels for the cell at the given pixel position

doCommand

public boolean doCommand(ILayerCommand command)
Description copied from interface: ILayer
Opportunity to respond to a command as it flows down the stack. If the layer is not interested in the command it should allow the command to keep traveling down the stack. Note: Before the layer can process a command it must convert the command to its local co-ordinates using ILayerCommand.convertToTargetLayer(ILayer)

Specified by:
doCommand in interface ILayer
Parameters:
command - the command to perform
Returns:
true if the command has been handled, false otherwise

registerCommandHandler

public void registerCommandHandler(ILayerCommandHandler<?> commandHandler)
Specified by:
registerCommandHandler in interface ILayer

unregisterCommandHandler

public void unregisterCommandHandler(Class<? extends ILayerCommand> commandClass)
Specified by:
unregisterCommandHandler in interface ILayer

fireLayerEvent

public void fireLayerEvent(ILayerEvent event)
Description copied from interface: ILayer
Events can be fired to notify other components of the grid. Events travel up the layer stack and may cause a repaint.

Example: When the contents of the grid change IVisualChangeEvent can be fired to notify other layers to refresh their caches etc.

Specified by:
fireLayerEvent in interface ILayer
Parameters:
event - the event to fire

addLayerListener

public void addLayerListener(ILayerListener listener)
Specified by:
addLayerListener in interface ILayer

removeLayerListener

public void removeLayerListener(ILayerListener listener)
Specified by:
removeLayerListener in interface ILayer

hasLayerListener

public boolean hasLayerListener(Class<? extends ILayerListener> layerListenerClass)
Specified by:
hasLayerListener in interface ILayer
Parameters:
layerListenerClass - The type of ILayerListener to check for existence
Returns:
true if this ILayer has a ILayerListener registered for the specified type, false if there is no such listener registered already

getLayerPainter

public ILayerPainter getLayerPainter()
Specified by:
getLayerPainter in interface ILayer

getClientAreaProvider

public IClientAreaProvider getClientAreaProvider()
Specified by:
getClientAreaProvider in interface ILayer

setClientAreaProvider

public void setClientAreaProvider(IClientAreaProvider clientAreaProvider)
Specified by:
setClientAreaProvider in interface ILayer

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface ILayer
Returns:
the number of columns in this coordinate model

getPreferredColumnCount

public int getPreferredColumnCount()
Specified by:
getPreferredColumnCount in interface ILayer

getColumnIndexByPosition

public int getColumnIndexByPosition(int columnPosition)
Description copied from interface: ILayer
Gets the underlying non-transformed column index for the given column position.

Specified by:
getColumnIndexByPosition in interface ILayer
Parameters:
columnPosition - a column position relative to this coordinate model
Returns:
an underlying non-transformed column index, or -1 if the given column position does not exist within this coordinate system

localToUnderlyingColumnPosition

public int localToUnderlyingColumnPosition(int localColumnPosition)
Description copied from interface: ILayer
Convert a column position to the coordinates of the underlying layer. This is possible since each layer is aware of its underlying layer.

Specified by:
localToUnderlyingColumnPosition in interface ILayer
Parameters:
localColumnPosition - column position in local (the layer's own) coordinates
Returns:
column position in the underlying layer's coordinates

underlyingToLocalColumnPosition

public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer,
                                           int underlyingColumnPosition)
Specified by:
underlyingToLocalColumnPosition in interface ILayer

underlyingToLocalColumnPositions

public Collection<Range> underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer,
                                                          Collection<Range> underlyingColumnPositionRanges)
Specified by:
underlyingToLocalColumnPositions in interface ILayer

getWidth

public int getWidth()
Description copied from interface: ILayer
Returns the total width in pixels of this layer.

Specified by:
getWidth in interface ILayer
Returns:
the width of this layer

getPreferredWidth

public int getPreferredWidth()
Specified by:
getPreferredWidth in interface ILayer

getColumnWidthByPosition

public int getColumnWidthByPosition(int columnPosition)
Description copied from interface: ILayer
Returns the width in pixels of the given column. The width of invisible and non-existing columns is 0.

Specified by:
getColumnWidthByPosition in interface ILayer
Parameters:
columnPosition - the column position in this layer
Returns:
the width of the column

isColumnPositionResizable

public boolean isColumnPositionResizable(int columnPosition)
Specified by:
isColumnPositionResizable in interface ILayer

getColumnPositionByX

public int getColumnPositionByX(int x)
Description copied from interface: ILayer
Returns the column position that contains the given x coordinate.

Specified by:
getColumnPositionByX in interface ILayer
Parameters:
x - a horizontal pixel location relative to the pixel boundary of this layer
Returns:
a column position relative to the associated coordinate system, or -1 if there is no column that contains x

getStartXOfColumnPosition

public int getStartXOfColumnPosition(int columnPosition)
Description copied from interface: ILayer
Returns the x offset in pixels of the given column.

Specified by:
getStartXOfColumnPosition in interface ILayer
Parameters:
columnPosition - the column position in this layer
Returns:
the x offset of the column, or -1

getUnderlyingLayersByColumnPosition

public Collection<ILayer> getUnderlyingLayersByColumnPosition(int columnPosition)
Specified by:
getUnderlyingLayersByColumnPosition in interface ILayer

getColumnPositionByIndex

public int getColumnPositionByIndex(int columnIndex)
Specified by:
getColumnPositionByIndex in interface IUniqueIndexLayer

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface ILayer
Returns:
the number of rows in this coordinate model

getPreferredRowCount

public int getPreferredRowCount()
Specified by:
getPreferredRowCount in interface ILayer

getRowIndexByPosition

public int getRowIndexByPosition(int rowPosition)
Description copied from interface: ILayer
Gets the underlying non-transformed row index for the given row position.

Specified by:
getRowIndexByPosition in interface ILayer
Parameters:
rowPosition - a row position relative to this coordinate model
Returns:
an underlying non-transformed row index, or -1 if the given row position does not exist within this coordinate system

localToUnderlyingRowPosition

public int localToUnderlyingRowPosition(int localRowPosition)
Specified by:
localToUnderlyingRowPosition in interface ILayer

underlyingToLocalRowPosition

public int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer,
                                        int underlyingRowPosition)
Specified by:
underlyingToLocalRowPosition in interface ILayer

underlyingToLocalRowPositions

public Collection<Range> underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer,
                                                       Collection<Range> underlyingRowPositionRanges)
Specified by:
underlyingToLocalRowPositions in interface ILayer

getHeight

public int getHeight()
Description copied from interface: ILayer
Returns the total height in pixels of this layer.

Specified by:
getHeight in interface ILayer
Returns:
the height of this layer

getPreferredHeight

public int getPreferredHeight()
Specified by:
getPreferredHeight in interface ILayer

getRowHeightByPosition

public int getRowHeightByPosition(int rowPosition)
Description copied from interface: ILayer
Returns the height in pixels of the given row. The height of invisible and non-existing rows is 0.

Specified by:
getRowHeightByPosition in interface ILayer
Parameters:
rowPosition - the row position in this layer
Returns:
the height of the row

isRowPositionResizable

public boolean isRowPositionResizable(int rowPosition)
Specified by:
isRowPositionResizable in interface ILayer

getRowPositionByY

public int getRowPositionByY(int y)
Description copied from interface: ILayer
Returns the row position that contains the given y coordinate.

Specified by:
getRowPositionByY in interface ILayer
Parameters:
y - a vertical pixel location relative to the pixel boundary of this layer
Returns:
a row position relative to the associated coordinate system, or -1 if there is no row that contains y

getStartYOfRowPosition

public int getStartYOfRowPosition(int rowPosition)
Description copied from interface: ILayer
Returns the y offset in pixels of the given row.

Specified by:
getStartYOfRowPosition in interface ILayer
Parameters:
rowPosition - the row position in this layer
Returns:
the y offset of the row, or -1

getUnderlyingLayersByRowPosition

public Collection<ILayer> getUnderlyingLayersByRowPosition(int rowPosition)
Specified by:
getUnderlyingLayersByRowPosition in interface ILayer

getRowPositionByIndex

public int getRowPositionByIndex(int rowIndex)
Specified by:
getRowPositionByIndex in interface IUniqueIndexLayer

getCellByPosition

public ILayerCell getCellByPosition(int columnPosition,
                                    int rowPosition)
Specified by:
getCellByPosition in interface ILayer

getBoundsByPosition

public org.eclipse.swt.graphics.Rectangle getBoundsByPosition(int columnPosition,
                                                              int rowPosition)
Description copied from interface: ILayer
Calculates the bounds in pixel for the given cell position.

Specified by:
getBoundsByPosition in interface ILayer
Parameters:
columnPosition - the column position of the cell
rowPosition - the row position of the cell
Returns:
the bounds, or null if there are no valid bounds

getDisplayModeByPosition

public String getDisplayModeByPosition(int columnPosition,
                                       int rowPosition)
Specified by:
getDisplayModeByPosition in interface ILayer
Parameters:
columnPosition - the column position of the cell
rowPosition - the row position of the cell
Returns:
DisplayMode for the cell at the given position. The DisplayMode affects the settings out of the ConfigRegistry. Display mode is NORMAL by default.

Example: SelectionLayer overrides this to return the SELECT label for cells which are selected.


getConfigLabelsByPosition

public LabelStack getConfigLabelsByPosition(int columnPosition,
                                            int rowPosition)
Specified by:
getConfigLabelsByPosition in interface ILayer

getDataValueByPosition

public Object getDataValueByPosition(int columnPosition,
                                     int rowPosition)
Specified by:
getDataValueByPosition in interface ILayer

getUnderlyingLayerByPosition

public ILayer getUnderlyingLayerByPosition(int columnPosition,
                                           int rowPosition)
Specified by:
getUnderlyingLayerByPosition in interface ILayer

getCellPainter

public ICellPainter getCellPainter(int columnPosition,
                                   int rowPosition,
                                   ILayerCell cell,
                                   IConfigRegistry configRegistry)
Specified by:
getCellPainter in interface ILayer


Copyright © 2015. All rights reserved.