blob: 13168cc2851c84588877c73f1b76ec406eb08546 [file] [log] [blame]
package org.eclipse.nebula.widgets.nattable.core.axis.viewport
import org.eclipse.nebula.widgets.nattable.core.axis.Axis
import org.eclipse.nebula.widgets.nattable.core.geometry.PixelRange
class ViewportAxis implements Axis {
val Axis underlyingAxis
/**
* Indicates the visible portion of the axis. Note that the pixel locations returned by this ClientDimensionProvider
* must be in terms of underlying axis pixel coordinates.
*/
val PixelRange visiblePixelRange
int pixelOrigin
new(Axis underlyingAxis, PixelRange visiblePixelRange) {
this.underlyingAxis = underlyingAxis
this.visiblePixelRange = visiblePixelRange
}
def getPixelOrigin() { pixelOrigin }
def void setPixelOrigin(int pixelOrigin) {
this.pixelOrigin = pixelOrigin
}
def int getOriginSegmentPosition() {
underlyingAxis.getSegmentPositionByPixelLocation(pixelOrigin)
}
override getSegmentCount() {
val endSegmentPosition = underlyingAxis.getSegmentPositionByPixelLocation(visiblePixelRange.endPixel)
endSegmentPosition - originSegmentPosition
}
override getStartPixelOfSegmentPosition(int segmentPosition) {
pixelOrigin + underlyingAxis.getStartPixelOfSegmentPosition(segmentPosition)
}
override getSegmentPositionByPixelLocation(int pixelLocation) {
underlyingAxis.getSegmentPositionByPixelLocation(pixelOrigin + pixelLocation)
}
override getIdOfSegmentPosition(int segmentPosition) {
underlyingAxis.getIdOfSegmentPosition(originSegmentPosition + segmentPosition)
}
override getSegment(int segmentPosition) {
underlyingAxis.getSegment(originSegmentPosition + segmentPosition)
}
}