public class ViewportLayer extends AbstractLayerTransform implements IUniqueIndexLayer
SelectionLayer
.underlyingLayer
layerPainter
DOT, VALUE_SEPARATOR
Constructor and Description |
---|
ViewportLayer(IUniqueIndexLayer underlyingLayer) |
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
PixelCoordinate |
getMinimumOrigin() |
int |
getMinimumOriginColumnPosition() |
int |
getMinimumOriginRowPosition() |
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 |
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 |
setOriginX(int newOriginX)
Set the origin X pixel position.
|
void |
setOriginY(int newOriginY)
Set the origin Y pixel position.
|
String |
toString() |
int |
underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer,
int underlyingColumnPosition) |
int |
underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer,
int underlyingRowPosition) |
configure, getCellByPosition, getCellPainter, getColumnIndexByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowIndexByPosition, getUnderlyingLayer, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, isRowPositionResizable, loadState, saveState, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalColumnPositions, underlyingToLocalRowPositions
addConfiguration, addLayerListener, clearConfiguration, fireLayerEvent, getClientAreaProvider, getConfigLabelAccumulator, getRegionName, hasLayerListener, registerCommandHandler, registerEventHandler, registerPersistable, removeLayerListener, setConfigLabelAccumulator, setLayerPainter, setRegionName, unregisterCommandHandler, unregisterPersistable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addLayerListener, configure, fireLayerEvent, getCellByPosition, getCellPainter, getClientAreaProvider, getColumnIndexByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowIndexByPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, hasLayerListener, isRowPositionResizable, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, underlyingToLocalColumnPositions, underlyingToLocalRowPositions, unregisterCommandHandler, unregisterPersistable
loadState, saveState
public ViewportLayer(IUniqueIndexLayer underlyingLayer)
public void dispose()
dispose
in interface ILayer
dispose
in class AbstractLayerTransform
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
- 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) coordinatespublic 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 layerpublic 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 layerpublic int getStartXOfColumnPosition(int columnPosition)
ILayer
getStartXOfColumnPosition
in interface ILayer
getStartXOfColumnPosition
in class AbstractLayerTransform
columnPosition
- the column position in this layerpublic 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 layerpublic 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 layerpublic int getStartYOfRowPosition(int rowPosition)
ILayer
getStartYOfRowPosition
in interface ILayer
getStartYOfRowPosition
in class AbstractLayerTransform
rowPosition
- the row position in this layerpublic 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 cellnull
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
- forceEntireCellIntoViewport
- public void moveColumnPositionIntoViewport(int scrollableColumnPosition)
scrollableColumnPosition
- column position in terms of the Scrollable Layerpublic void moveRowPositionIntoViewport(int scrollableRowPosition)
#moveColumnPositionIntoViewport(int, boolean)
protected void fireScrollEvent()
public boolean doCommand(ILayerCommand command)
ILayer
ILayerCommand.convertToTargetLayer(ILayer)
doCommand
in interface ILayer
doCommand
in class AbstractLayerTransform
command
- the command to performpublic 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
- Copyright © 2013. All Rights Reserved.