blob: 9a6499d01a592673321695d24e36d5493742b229 [file] [log] [blame]
package org.eclipse.nebula.widgets.nattable.core.layer.axis
import java.io.Serializable
import org.eclipse.nebula.widgets.nattable.core.event.EventListener
import org.eclipse.nebula.widgets.nattable.core.event.EventSource
/**
* Represents a linear dimension (e.g. horizontal, vertical) that is composed of segments (e.g. columns, rows).
*/
interface Axis extends EventSource, EventListener {
/**
* @return The number of segments on this axis.
*/
def int getSegmentCount()
/**
* Gets the start pixel location of the segment at the given position. This function must be defined for all valid segment position
* values and <em>also</em> for segment position = segment count. Technically the segment count is not a valid segment position because
* segment positions are 0-indexed and range from 0 to segment count - 1. However, the 'start' pixel location of the segment position after
* the last segment is used to calculate the pixel size of the last segment, and also the overall pixel size of the axis.
*
* @param segmentPosition
* @return The start pixel location of the given segment position.
*/
def double getStartPixelOfSegmentPosition(int segmentPosition)
/**
* Gets the minimum pixel location of this axis. This is normally the same as getStartPixelOfSegmentPosition(0).
*/
def double getMinPixelLocation()
/**
* Gets the maximum pixel size of this axis. This is normally the same as getStartPixelOfSegmentPosition(getSegmentCount()) - getMinPixelLocation().
*/
def double getPixelSize()
/**
* Gets the position of the segment that is nearest to the the given pixel location.
*
* @param pixelLocation
* @return The position of the segment that contains the given pixel location.
* If the given pixel location is less than 0, the segment position returned will be -1.
* If the given pixel location is greater than the size of the axis, then the last segment position + 1 will be returned (= segment count).
*/
def int getSegmentPositionOfPixelLocation(double pixelLocation)
/**
* @param segmentPosition
* @return The identifier associated with the given segment position.
*/
def Serializable getIdOfSegmentPosition(int segmentPosition)
/**
* @param segmentId
* @return The position of the segment associated with the given segment identifier.
*/
def int getSegmentPositionOfId(Serializable segmentId)
}