Package docking.widgets.table
Interface SpannedRenderer<N extends Number>
- All Known Implementing Classes:
RangeCursorTableHeaderRenderer,SpanSetTableCellRenderer,SpanTableCellRenderer
public interface SpannedRenderer<N extends Number>
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordA closed interval on doubles -
Method Summary
Modifier and TypeMethodDescriptionGet the span of the viewportGet the span of the viewport with double endpointsintGet the height of the rendererdoublegetSpan()Get the length of the spanintgetWidth()Get the width of the rendererdefault intinterpolate(int w, double val) Compute the horizontal pixel position of the given valuedefault voidpaintRange(Graphics g, Span<N, ?> range) Paint a given spanvoidsetFullRange(Span<N, ?> fullRange) Set the span of the viewportstatic SpannedRenderer.DoubleSpanvalidateViewRange(Span<? extends Number, ?> fullSpan) Validate the given span and convert its endpoints to doubles
-
Method Details
-
validateViewRange
Validate the given span and convert its endpoints to doubles- Parameters:
fullSpan- the span to validate- Returns:
- the converted span
-
setFullRange
Set the span of the viewport- Parameters:
fullRange- the span
-
getFullRange
Get the span of the viewport- Returns:
- the span
-
getFullRangeDouble
Get the span of the viewport with double endpoints- Returns:
- the span
-
getSpan
double getSpan()Get the length of the span- Returns:
- the length
-
interpolate
default int interpolate(int w, double val) Compute the horizontal pixel position of the given valueThis interpolates the given value linearly mapping it to a pixel. Pixel 0 is at the full span's lower endpoint and pixel
wis at the full span's upper endpoint. If the given value falls outside the full span, it is clamped.- Parameters:
w- the width of the viewport in pixels, i.e.,getWidth()val- the value as in the span's domain, but as a double- Returns:
- the horizontal pixel
-
getWidth
int getWidth()Get the width of the renderer- Returns:
- the width
- Implementation Notes:
- this is often implemented by inheriting
Component.getWidth()
-
getHeight
int getHeight()Get the height of the renderer- Returns:
- the height
- Implementation Notes:
- this is often implemented by inheriting
Component.getHeight()
-
paintRange
Paint a given span- Parameters:
g- the graphics, bound to a componentrange- the span
-