java.lang.Object
com.flexganttfx.view.graphics.renderer.RendererBase
- Direct Known Subclasses:
LinkRenderer
,Renderer
,SystemLayer
public abstract class RendererBase extends Object
The base class of all renderers used by FlexGanttFX.
-
Property Summary
Properties Type Property Description DoubleProperty
alpha
BooleanProperty
enabled
BooleanProperty
snapToPixel
-
Constructor Summary
Constructors Constructor Description RendererBase(GraphicsBase<?> graphics, String name)
Constructs a new renderer. -
Method Summary
Modifier and Type Method Description DoubleProperty
alphaProperty()
protected void
disableRedrawAfterPropertyChange()
Disables automatic redrawing of the graphics area when one of the observed properties changes.BooleanProperty
enabledProperty()
protected void
enableRedrawAfterPropertyChange()
Enabled automatic redrawing of the graphics area when one of the observed properties changes.double
getAlpha()
Gets the value of the property alpha.GraphicsBase<?>
getGraphics()
protected double
getLocation(Instant time, Canvas canvas)
Calculates the x coordinate for the given time.String
getName()
protected Instant
getTimeAt(double location)
Calculates the time at the given x coordinate.boolean
isEnabled()
Gets the value of the property enabled.boolean
isSnapToPixel()
Gets the value of the property snapToPixel.protected void
redrawObservable(Observable observable)
Registers the given observable as something that requires a redraw of the graphics area.void
setAlpha(double alpha)
Sets the value of the property alpha.void
setEnabled(boolean enabled)
Sets the value of the property enabled.void
setSnapToPixel(boolean snap)
Sets the value of the property snapToPixel.double
snapPositionX(double value)
If this renderer's snapToPixel property is true, returns a value rounded to the nearest pixel in the horizontal direction, else returns the same value.double
snapPositionY(double value)
If this renderer's snapToPixel property is true, returns a value rounded to the nearest pixel in the vertical direction, else returns the same value.double
snapSizeX(double value)
If this renderer's snapToPixel property is true, returns a value ceiled to the nearest pixel in the horizontal direction, else returns the same value.double
snapSizeY(double value)
If this renderer's snapToPixel property is true, returns a value ceiled to the nearest pixel in the vertical direction, else returns the same value.double
snapSpaceX(double value)
If this renderer's snapToPixel property is true, returns a value rounded to the nearest pixel in the horizontal direction, else returns the same value.double
snapSpaceY(double value)
If this renderer's snapToPixel property is true, returns a value rounded to the nearest pixel in the vertical direction, else returns the same value.BooleanProperty
snapToPixelProperty()
-
Property Details
-
enabled
- See Also:
isEnabled()
,setEnabled(boolean)
-
snapToPixel
- See Also:
isSnapToPixel()
,setSnapToPixel(boolean)
-
alpha
- See Also:
getAlpha()
,setAlpha(double)
-
-
Constructor Details
-
RendererBase
Constructs a new renderer.- Parameters:
graphics
- the graphics control where the renderer will be usedname
- the name of the renderer (useful for tooling)
-
-
Method Details
-
snapSpaceX
public double snapSpaceX(double value)If this renderer's snapToPixel property is true, returns a value rounded to the nearest pixel in the horizontal direction, else returns the same value.- Parameters:
value
- the space value to be snapped- Returns:
- value rounded to nearest pixel
-
snapSpaceY
public double snapSpaceY(double value)If this renderer's snapToPixel property is true, returns a value rounded to the nearest pixel in the vertical direction, else returns the same value.- Parameters:
value
- the space value to be snapped- Returns:
- value rounded to nearest pixel
-
snapSizeX
public double snapSizeX(double value)If this renderer's snapToPixel property is true, returns a value ceiled to the nearest pixel in the horizontal direction, else returns the same value.- Parameters:
value
- the size value to be snapped- Returns:
- value ceiled to nearest pixel
-
snapSizeY
public double snapSizeY(double value)If this renderer's snapToPixel property is true, returns a value ceiled to the nearest pixel in the vertical direction, else returns the same value.- Parameters:
value
- the size value to be snapped- Returns:
- value ceiled to nearest pixel
-
snapPositionX
public double snapPositionX(double value)If this renderer's snapToPixel property is true, returns a value rounded to the nearest pixel in the horizontal direction, else returns the same value.- Parameters:
value
- the position value to be snapped- Returns:
- value rounded to nearest pixel
-
snapPositionY
public double snapPositionY(double value)If this renderer's snapToPixel property is true, returns a value rounded to the nearest pixel in the vertical direction, else returns the same value.- Parameters:
value
- the position value to be snapped- Returns:
- value rounded to nearest pixel
-
disableRedrawAfterPropertyChange
protected final void disableRedrawAfterPropertyChange()Disables automatic redrawing of the graphics area when one of the observed properties changes. Useful for not going into infinite loops. -
enableRedrawAfterPropertyChange
protected final void enableRedrawAfterPropertyChange()Enabled automatic redrawing of the graphics area when one of the observed properties changes. Useful for not going into infinite loops. -
redrawObservable
Registers the given observable as something that requires a redraw of the graphics area. E.g.: the stroke color has changed.- Parameters:
observable
- the observable to monitor for changes
-
getName
-
getGraphics
-
getLocation
Calculates the x coordinate for the given time. This method only returns valid results when the renderers is used in a layout with horizontal orientation. It will not work inAgendaLayout
.- Parameters:
time
- the time for which to calculate the x coordinate- Returns:
- the location of the given time point
- Since:
- 1.0
- See Also:
TimelineModel.calculateLocationForTime(Instant)
-
getTimeAt
Calculates the time at the given x coordinate. This method only returns valid results when the renderer is used in a layout with horizontal orientation. It will not work inAgendaLayout
.- Parameters:
location
- the location for which to return the time- Returns:
- the time at the given x coordinate
- Since:
- 1.0
- See Also:
TimelineModel.calculateTimeForLocation(double)
-
enabledProperty
- See Also:
isEnabled()
,setEnabled(boolean)
-
isEnabled
public final boolean isEnabled()Gets the value of the property enabled.- Property description:
-
setEnabled
public final void setEnabled(boolean enabled)Sets the value of the property enabled.- Property description:
-
snapToPixelProperty
- See Also:
isSnapToPixel()
,setSnapToPixel(boolean)
-
setSnapToPixel
public final void setSnapToPixel(boolean snap)Sets the value of the property snapToPixel.- Property description:
-
isSnapToPixel
public final boolean isSnapToPixel()Gets the value of the property snapToPixel.- Property description:
-
alphaProperty
- See Also:
getAlpha()
,setAlpha(double)
-
setAlpha
public final void setAlpha(double alpha)Sets the value of the property alpha.- Property description:
-
getAlpha
public final double getAlpha()Gets the value of the property alpha.- Property description:
-