|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.nebula.widgets.nattable.layer.AbstractLayer org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer
public class ViewportLayer
Viewport - the visible area of NatTable Places a 'viewport' over the table.
Introduces scroll bars over the table and keeps them in sync with the data
being displayed. This is typically placed over the SelectionLayer
.
Field Summary |
---|
Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform |
---|
underlyingLayer |
Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer |
---|
commandHandlers, eventHandlers, layerPainter |
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable |
---|
DOT, VALUE_SEPARATOR |
Constructor Summary | |
---|---|
ViewportLayer(IUniqueIndexLayer underlyingLayer)
|
Method Summary | |
---|---|
protected int |
adjustOriginX(int originX)
If the client area size is greater than the content size, move origin to fill as much content as possible. |
protected int |
adjustOriginY(int originY)
If the client area size is greater than the content size, move origin to fill as much content as possible. |
void |
dispose()
|
boolean |
doCommand(ILayerCommand command)
Opportunity to respond to a command as it flows down the stack. |
void |
drag(int x,
int y)
Used for edge hover scrolling. |
void |
drag(SelectionLayer.MoveDirectionEnum horizontal,
SelectionLayer.MoveDirectionEnum vertical)
Used to scroll in the given direction on drag operations outside the visible region. |
protected void |
fireScrollEvent()
|
org.eclipse.swt.graphics.Rectangle |
getBoundsByPosition(int columnPosition,
int rowPosition)
Calculates the bounds in pixel for the given cell position. |
int |
getClientAreaHeight()
|
int |
getClientAreaWidth()
|
int |
getColumnCount()
|
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. |
int |
getHeight()
Returns the total height in pixels of this layer. |
int |
getMaxColumnPosition()
|
int |
getMaxHeight()
|
int |
getMaxRowPosition()
|
int |
getMaxWidth()
|
int |
getMinColumnPosition()
|
int |
getMinHorizontalStart()
|
PixelCoordinate |
getMinimumOrigin()
|
int |
getMinimumOriginColumnPosition()
|
int |
getMinimumOriginRowPosition()
|
int |
getMinRowPosition()
|
int |
getMinVerticalStart()
|
PixelCoordinate |
getOrigin()
|
int |
getRowCount()
|
int |
getRowHeightByPosition(int rowPosition)
Returns the height in pixels of the given row. |
int |
getRowPositionByIndex(int rowIndex)
|
int |
getRowPositionByY(int y)
Returns the row position that contains the given y coordinate. |
IUniqueIndexLayer |
getScrollableLayer()
|
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. |
int |
getWidth()
Returns the total width in pixels of this layer. |
protected void |
handleGridResize()
Recalculate viewport characteristics when the grid has been resized. |
void |
handleLayerEvent(ILayerEvent event)
Handle layer event notification. |
void |
invalidateHorizontalStructure()
Clear horizontal caches |
void |
invalidateVerticalStructure()
Clear vertical caches |
boolean |
isColumnPositionResizable(int columnPosition)
|
protected boolean |
isLastColumnCompletelyDisplayed()
|
protected boolean |
isLastRowCompletelyDisplayed()
|
int |
localToUnderlyingColumnPosition(int localColumnPosition)
Convert a column position to the coordinates of the underlying layer. |
int |
localToUnderlyingRowPosition(int localRowPosition)
|
void |
moveCellPositionIntoViewport(int scrollableColumnPosition,
int scrollableRowPosition)
Srcolls the table so that the specified cell is visible i.e. |
void |
moveColumnPositionIntoViewport(int scrollableColumnPosition)
Scrolls the viewport (if required) so that the specified column is visible. |
void |
moveRowPositionIntoViewport(int scrollableRowPosition)
|
protected void |
recalculateAvailableHeightAndRowCount()
Recalculate vertical dimension properties. |
protected void |
recalculateAvailableWidthAndColumnCount()
Recalculate horizontal dimension properties. |
void |
recalculateScrollBars()
Recalculate scrollbar characteristics. |
protected void |
registerCommandHandlers()
Layers should use this method to register their command handlers and call it from their constructor. |
void |
resetOrigin(int newOriginX,
int newOriginY)
Reset the origin pixel position to the given values. |
void |
scrollVerticallyByAPage(ScrollSelectionCommand scrollSelectionCommand)
Scrolls the viewport vertically by a page. |
protected MoveSelectionCommand |
scrollVerticallyByAPageCommand(ScrollSelectionCommand scrollSelectionCommand)
|
void |
setHorizontalScrollbarEnabled(boolean enabled)
Enable/disable the horizontal scrollbar in this ViewportLayer. |
void |
setHorizontalScroller(IScroller<?> scroller)
Set a different horizontal scroller than the default one. |
void |
setMaxColumnPosition(int maxColumnPosition)
|
void |
setMaxRowPosition(int maxRowPosition)
|
void |
setMinColumnPosition(int minColumnPosition)
Sets the minimum column position for a split viewport and directly sets the minimum origin x value dependent on the configuration. |
void |
setMinimumOrigin(int newMinimumOriginX,
int newMinimumOriginY)
Set the minimum origin pixel position to the given values. |
void |
setMinimumOriginX(int newMinimumOriginX)
Set the minimum origin X pixel position. |
void |
setMinimumOriginY(int newMinimumOriginY)
Set the minimum origin Y pixel position. |
void |
setMinRowPosition(int minRowPosition)
Sets the minimum row position for a split viewport and directly sets the minimum origin y value dependent on the configuration. |
void |
setOriginX(int newOriginX)
Set the origin X pixel position. |
void |
setOriginY(int newOriginY)
Set the origin Y pixel position. |
void |
setVerticalScrollbarEnabled(boolean enabled)
Enable/disable the vertical scrollbar in this ViewportLayer. |
void |
setVerticalScroller(IScroller<?> scroller)
Set a different vertical scroller than the default one. |
String |
toString()
|
int |
underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer,
int underlyingColumnPosition)
|
int |
underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer,
int underlyingRowPosition)
|
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer |
---|
addConfiguration, addLayerListener, clearConfiguration, fireLayerEvent, getClientAreaProvider, getConfigLabelAccumulator, getRegionName, hasLayerListener, registerCommandHandler, registerEventHandler, registerPersistable, removeLayerListener, setConfigLabelAccumulator, setLayerPainter, setRegionName, unregisterCommandHandler, unregisterEventHandler, unregisterPersistable |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable |
---|
loadState, saveState |
Constructor Detail |
---|
public ViewportLayer(IUniqueIndexLayer underlyingLayer)
Method Detail |
---|
public void dispose()
dispose
in interface ILayer
dispose
in class AbstractLayerTransform
public void setHorizontalScroller(IScroller<?> scroller)
scroller
- The scroller that should be used for horizontal scrolling.public void setVerticalScroller(IScroller<?> scroller)
scroller
- The scroller that should be used for vertical scrolling.public int getMaxWidth()
public int getMinVerticalStart()
public int getMaxHeight()
public int getMinHorizontalStart()
public PixelCoordinate getMinimumOrigin()
public int getMinimumOriginColumnPosition()
public int getMinimumOriginRowPosition()
public void setMinimumOriginX(int newMinimumOriginX)
newMinimumOriginX
- public void setMinimumOriginY(int newMinimumOriginY)
newMinimumOriginY
- public void setMinimumOrigin(int newMinimumOriginX, int newMinimumOriginY)
newMinimumOriginX
- newMinimumOriginY
- public PixelCoordinate getOrigin()
public void setOriginX(int newOriginX)
newOriginX
- public void setOriginY(int newOriginY)
newOriginY
- public void resetOrigin(int newOriginX, int newOriginY)
newOriginX
- newOriginY
- public int getMaxColumnPosition()
public void setMaxColumnPosition(int maxColumnPosition)
maxColumnPosition
- The right most column position in case split viewports need to
be configured.public int getMinColumnPosition()
public void setMinColumnPosition(int minColumnPosition)
minColumnPosition
- The left most column position in case split viewport need to
be configured.public int getMaxRowPosition()
public void setMaxRowPosition(int maxRowPosition)
maxRowPosition
- The right most row position in case split viewports need to be
configured.public int getMinRowPosition()
public void setMinRowPosition(int minRowPosition)
minRowPosition
- The left most row position in case split viewport need to be
configured.protected void registerCommandHandlers()
AbstractLayer
registerCommandHandlers
in class AbstractLayer
public int getColumnCount()
getColumnCount
in interface ILayer
getColumnCount
in class AbstractLayerTransform
public int getColumnPositionByIndex(int columnIndex)
getColumnPositionByIndex
in interface IUniqueIndexLayer
public int localToUnderlyingColumnPosition(int localColumnPosition)
ILayer
localToUnderlyingColumnPosition
in interface ILayer
localToUnderlyingColumnPosition
in class AbstractLayerTransform
localColumnPosition
- column position in local (the layer's own) coordinates
public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition)
underlyingToLocalColumnPosition
in interface ILayer
underlyingToLocalColumnPosition
in class AbstractLayerTransform
public int getWidth()
ILayer
getWidth
in interface ILayer
getWidth
in class AbstractLayerTransform
public int getColumnWidthByPosition(int columnPosition)
ILayer
getColumnWidthByPosition
in interface ILayer
getColumnWidthByPosition
in class AbstractLayerTransform
columnPosition
- the column position in this layer
public boolean isColumnPositionResizable(int columnPosition)
isColumnPositionResizable
in interface ILayer
isColumnPositionResizable
in class AbstractLayerTransform
public int getColumnPositionByX(int x)
ILayer
getColumnPositionByX
in interface ILayer
getColumnPositionByX
in class AbstractLayerTransform
x
- a horizontal pixel location relative to the pixel boundary of
this layer
public int getStartXOfColumnPosition(int columnPosition)
ILayer
getStartXOfColumnPosition
in interface ILayer
getStartXOfColumnPosition
in class AbstractLayerTransform
columnPosition
- the column position in this layer
public int getRowCount()
getRowCount
in interface ILayer
getRowCount
in class AbstractLayerTransform
public int getRowPositionByIndex(int rowIndex)
getRowPositionByIndex
in interface IUniqueIndexLayer
public int localToUnderlyingRowPosition(int localRowPosition)
localToUnderlyingRowPosition
in interface ILayer
localToUnderlyingRowPosition
in class AbstractLayerTransform
public int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition)
underlyingToLocalRowPosition
in interface ILayer
underlyingToLocalRowPosition
in class AbstractLayerTransform
public int getHeight()
ILayer
getHeight
in interface ILayer
getHeight
in class AbstractLayerTransform
public int getRowHeightByPosition(int rowPosition)
ILayer
getRowHeightByPosition
in interface ILayer
getRowHeightByPosition
in class AbstractLayerTransform
rowPosition
- the row position in this layer
public int getRowPositionByY(int y)
ILayer
getRowPositionByY
in interface ILayer
getRowPositionByY
in class AbstractLayerTransform
y
- a vertical pixel location relative to the pixel boundary of
this layer
public int getStartYOfRowPosition(int rowPosition)
ILayer
getStartYOfRowPosition
in interface ILayer
getStartYOfRowPosition
in class AbstractLayerTransform
rowPosition
- the row position in this layer
public org.eclipse.swt.graphics.Rectangle getBoundsByPosition(int columnPosition, int rowPosition)
ILayer
getBoundsByPosition
in interface ILayer
getBoundsByPosition
in class AbstractLayer
columnPosition
- the column position of the cellrowPosition
- the row position of the cell
null
if there are no valid boundspublic void invalidateHorizontalStructure()
public void invalidateVerticalStructure()
protected void recalculateAvailableWidthAndColumnCount()
protected void recalculateAvailableHeightAndRowCount()
public void moveCellPositionIntoViewport(int scrollableColumnPosition, int scrollableRowPosition)
scrollableColumnPosition
- scrollableRowPosition
- public void moveColumnPositionIntoViewport(int scrollableColumnPosition)
scrollableColumnPosition
- column position in terms of the Scrollable Layerpublic void moveRowPositionIntoViewport(int scrollableRowPosition)
moveColumnPositionIntoViewport(int)
protected void fireScrollEvent()
public boolean doCommand(ILayerCommand command)
ILayer
ILayerCommand.convertToTargetLayer(ILayer)
doCommand
in interface ILayer
doCommand
in class AbstractLayerTransform
command
- the command to perform
public void recalculateScrollBars()
protected void handleGridResize()
protected int adjustOriginX(int originX)
protected int adjustOriginY(int originY)
public void scrollVerticallyByAPage(ScrollSelectionCommand scrollSelectionCommand)
scrollSelectionCommand
- protected MoveSelectionCommand scrollVerticallyByAPageCommand(ScrollSelectionCommand scrollSelectionCommand)
protected boolean isLastColumnCompletelyDisplayed()
protected boolean isLastRowCompletelyDisplayed()
public void handleLayerEvent(ILayerEvent event)
AbstractLayer
super.fireLayerEvent(event)
- unless you plan to eat the
event yourself.
handleLayerEvent
in interface ILayerListener
handleLayerEvent
in class AbstractLayer
event
- the eventpublic int getClientAreaWidth()
public int getClientAreaHeight()
public IUniqueIndexLayer getScrollableLayer()
public String toString()
toString
in class AbstractLayer
public void drag(int x, int y)
x
- y
- public void drag(SelectionLayer.MoveDirectionEnum horizontal, SelectionLayer.MoveDirectionEnum vertical)
horizontal
- The horizontal movement for the scroll operation
MoveDirectionEnum.LEFT
,
MoveDirectionEnum.RIGHT
,
MoveDirectionEnum.NONE
vertical
- The vertical movement for the scroll operation
MoveDirectionEnum.UP
,
MoveDirectionEnum.DOWN
,
MoveDirectionEnum.NONE
public void setHorizontalScrollbarEnabled(boolean enabled)
Note: Setting the value to false
will avoid registering a
HorizontalScrollBarHandler, which means that there are no actions
performed on the horizontal scrollbar in any case. If a horizontal
scrollbar is rendered, it will be shown disabled. The rendering of
scrollbar is typically configured via style bit in the NatTable control.
So if there is a disabled scrollbar rendered check the style bits of the
NatTable, and try to remove SWT.H_SCROLL which is set in the default
style options.
enabled
- false
to disable the horizontal scrollbar,
true
to enable it.public void setVerticalScrollbarEnabled(boolean enabled)
Note: Setting the value to false
will avoid registering a
VerticalScrollBarHandler which means that there are no actions performed
on the vertical scrollbar in any case. If a vertical scrollbar is
rendered, it will be shown disabled. The rendering of scrollbar is
typically configured via style bit in the NatTable control. So if there
is a disabled scrollbar rendered check the style bits of the NatTable,
and try to remove SWT.V_SCROLL which is set in the default style options.
enabled
- false
to disable the vertical scrollbar,
true
to enable it.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |