Class RendererBase

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
     
     
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    RendererBase(GraphicsBase<?> graphics, String name)
    Constructs a new renderer.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    protected final void
    Disables automatic redrawing of the graphics area when one of the observed properties changes.
     
    protected final void
    Enabled automatic redrawing of the graphics area when one of the observed properties changes.
    final double
    Gets the value of the property alpha.
    final GraphicsBase<?>
     
    protected final double
    getLocation(Instant time, Canvas canvas)
    Calculates the x coordinate for the given time.
    final String
     
    protected final Instant
    getTimeAt(double location)
    Calculates the time at the given x coordinate.
    final boolean
    Gets the value of the property enabled.
    final boolean
    Gets the value of the property snapToPixel.
    protected void
    Registers the given observable as something that requires a redraw of the graphics area.
    final void
    setAlpha(double alpha)
    Sets the value of the property alpha.
    final void
    setEnabled(boolean enabled)
    Sets the value of the property enabled.
    final 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.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Property Details

  • Constructor Details

    • RendererBase

      public RendererBase(GraphicsBase<?> graphics, String name)
      Constructs a new renderer.
      Parameters:
      graphics - the graphics control where the renderer will be used
      name - 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

      protected void redrawObservable(Observable observable)
      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

      public final String getName()
    • getGraphics

      public final GraphicsBase<?> getGraphics()
    • getLocation

      protected final double getLocation(Instant time, Canvas canvas)
      Calculates the x coordinate for the given time. This method only returns valid results when the renderer is used in a layout with horizontal orientation. It will not work in AgendaLayout.
      Parameters:
      time - the time for which to calculate the x coordinate
      Returns:
      the location of the given time point
      Since:
      1.0
      See Also:
    • getTimeAt

      protected final Instant getTimeAt(double location)
      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 in AgendaLayout.
      Parameters:
      location - the location for which to return the time
      Returns:
      the time at the given x coordinate
      Since:
      1.0
      See Also:
    • enabledProperty

      public final BooleanProperty enabledProperty()
      See Also:
    • 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

      public final BooleanProperty snapToPixelProperty()
      See Also:
    • 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

      public final DoubleProperty alphaProperty()
      See Also:
    • 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: