com.dlsc.flexgantt.swing.layer.timeline

## Class TimelineObjectLayer

- java.lang.Object
- - com.dlsc.flexgantt.swing.layer.AbstractLayer
  - - com.dlsc.flexgantt.swing.layer.timeline.TimelineObjectLayer

- All Implemented Interfaces:
    ITimelineObjectSelectionListener, MouseListener, MouseMotionListener, EventListener

      public class TimelineObjectLayer
      extends AbstractLayer
      implements MouseListener, MouseMotionListener, ITimelineObjectSelectionListener

  The timeline object layer is responsible for rendering the timeline objects returned by the Gantt chart model. The layer container will create one instance of a timeline object layer for each layer defined by the model. Timeline objects get rendered by the layer via the help of so-called timeline object renderers (see `ITimelineObjectRenderer`).

  The timeline object layer uses its alpha value to determine the transparency of the timeline objects that it renders. This feature is especially useful in situations where timeline objects overlap each other (then again, consider using inner lines, see `ILinePolicy`).

  Each timeline object layer uses its own selection model to keep track of the currently selected timeline objects. Applications need to register listeners with these selection models for every layer that they are interested in.

  Timeline object layers are capable of returning `ObjectBounds` for timeline objects. These bounds contain various information about the object itself, its location, the layer it is on and the model it belongs to.

  Since:
    1.0
  Version:
    $Revision: 1.34 $
  Author:
    Dirk Lemmermann
  See Also:
    `IGanttChartModel.getLayers()`, `ILayerFactory`

- - ### Field Summary

    - ### Fields inherited from class com.dlsc.flexgantt.swing.layer.AbstractLayer

      `alpha, changeSupport, ganttChart, layerContainer, PROPERTY_ALPHA, PROPERTY_VISIBLE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimelineObjectLayer(LayerContainer lc, ILayer layer)` Constructs a new timeline object layer.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Collection<ObjectBounds>` | `getAllObjectBoundsAt(int x, int y)` Returns the object bounds for all timeline objects found at the given coordinate.
    `ILayer` | `getLayer()` Returns the model layer visualized by the timeline object layer.
    `ObjectBounds` | `getObjectBounds(TimelineObjectPath path)` Returns the object bounds for the given timeline object (path).
    `ObjectBounds` | `getObjectBoundsAt(int x, int y)` Returns the object bounds for the timeline object found at the given coordinate.
    `ObjectBounds` | `getObjectBoundsAt(int x, int y, int proximity)` Returns the object bounds for the timeline object found at the given coordinate.
    `ObjectBounds` | `getObjectBoundsAt(MouseEvent evt)` Returns the object bounds for the timeline object found at the location of the given mouse event.
    `ObjectBounds` | `getObjectBoundsAt(Point p)` Returns the object bounds for the timeline object found at the given location.
    `ITimeSpan` | `getTimeSpanUsed()` Returns the time span that is used by the layer.
    `boolean` | `isDebuggingObjectBounds()` Determines whether the layer will draw red rectangles showing the individual object bounds of the timeline objects.
    `boolean` | `isVisible()` Determines whether the layer is currently visible or not.
    `void` | `mouseClicked(MouseEvent e)`
    `void` | `mouseDragged(MouseEvent e)`
    `void` | `mouseEntered(MouseEvent e)`
    `void` | `mouseExited(MouseEvent e)`
    `void` | `mouseMoved(MouseEvent e)`
    `void` | `mousePressed(MouseEvent e)`
    `void` | `mouseReleased(MouseEvent e)`
    `protected void` | `paintLayer(Graphics g)`
    `void` | `setDebuggingObjectBounds(boolean debug)` Specifies whether the layer will draw red rectangles showing the individual object bounds of the timeline objects.
    `void` | `tearDown()` Performs tear down operations when the layer is no longer needed (removing listeners, etc...).
    `void` | `valueChanged(TimelineObjectSelectionEvent evt)` Callback method that gets invoked when the selection within the observed `TimelineObjectLayer` changes.

    - ### Methods inherited from class com.dlsc.flexgantt.swing.layer.AbstractLayer

      `addPropertyChangeListener, getAlpha, getDateline, getEventline, getGanttChart, getHeight, getLayerContainer, getLayerPolicyProvider, getModel, getName, getStartRow, getTimeAt, getTimeline, getTimeLocation, getToolTipText, getTreeTable, getTreeTablePolicyProvider, getWidth, removePropertyChangeListener, repaint, repaint, repaint, setAlpha, setVisible`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TimelineObjectLayer

          public TimelineObjectLayer(LayerContainer lc,
                                     ILayer layer)

      Constructs a new timeline object layer.
      Parameters:
        `lc` - the parent layer container
        `layer` - the model layer that will be visualized by the UI layer
      Since:
        1.0

  - ### Method Detail

    - #### isVisible

          public boolean isVisible()

      Description copied from class: `AbstractLayer`
      Determines whether the layer is currently visible or not.
      Overrides:
        `isVisible` in class `AbstractLayer`
      Returns:
        TRUE if the layer is currently visible
      See Also:
        `AbstractLayer.setVisible(boolean)`

    - #### tearDown

          public void tearDown()

      Description copied from class: `AbstractLayer`
      Performs tear down operations when the layer is no longer needed (removing listeners, etc...).
      Overrides:
        `tearDown` in class `AbstractLayer`

    - #### getObjectBounds

          public ObjectBounds getObjectBounds(TimelineObjectPath path)

      Returns the object bounds for the given timeline object (path). The bounds provide detailed information about the visual representation of the timeline object (the location, the width, the height, the layer, etc...).
      Parameters:
        `path` - the path for which to return the bounds
      Returns:
        the object bounds for the given timeline object (path)
      Since:
        1.0

    - #### getObjectBoundsAt

          public ObjectBounds getObjectBoundsAt(MouseEvent evt)

      Returns the object bounds for the timeline object found at the location of the given mouse event. The bounds provide detailed information about the visual representation of the timeline object (the location, the width, the height, the layer, etc...).
      Parameters:
        `evt` - the mouse event for which to return object bounds
      Returns:
        the object bounds found at the location of the given mouse event
      Since:
        1.0

    - #### getObjectBoundsAt

          public ObjectBounds getObjectBoundsAt(Point p)

      Returns the object bounds for the timeline object found at the given location. The bounds provide detailed information about the visual representation of the timeline object (the location, the width, the height, the layer, etc...).
      Parameters:
        `p` - the location within the layer
      Returns:
        the object bounds for the timeline object at the given location
      Since:
        1.0

    - #### getObjectBoundsAt

          public ObjectBounds getObjectBoundsAt(int x,
                                                int y)

      Returns the object bounds for the timeline object found at the given coordinate. The bounds provide detailed information about the visual representation of the timeline object (the location, the width, the height, the layer, etc...).
      Parameters:
        `x` - the x-coordinate of the location to check
        `y` - the y-coordinate of the location to check
      Returns:
        the object bounds for the given timeline object (path)
      Since:
        1.0

    - #### getObjectBoundsAt

          public ObjectBounds getObjectBoundsAt(int x,
                                                int y,
                                                int proximity)

      Returns the object bounds for the timeline object found at the given coordinate. The bounds provide detailed information about the visual representation of the timeline object (the location, the width, the height, the layer, etc...).
      Parameters:
        `x` - the x-coordinate of the location to check
        `y` - the y-coordinate of the location to check
        `proximity` - controls whether to find objects that are within the proximity of the given location, objects that are "close enough"
      Returns:
        the object bounds for the given timeline object (path)
      Since:
        2.0

    - #### getAllObjectBoundsAt

          public Collection<ObjectBounds> getAllObjectBoundsAt(int x,
                                                               int y)

      Returns the object bounds for all timeline objects found at the given coordinate. The bounds provide detailed information about the visual representation of the timeline objects (the location, the width, the height, the layer, etc...).
      Parameters:
        `x` - the x-coordinate of the location to check
        `y` - the y-coordinate of the location to check
      Returns:
        the object bounds for all timeline objects located at the given coordinates
      Since:
        1.0

    - #### paintLayer

          protected void paintLayer(Graphics g)

      Overrides:
        `paintLayer` in class `AbstractLayer`

    - #### getTimeSpanUsed

          public ITimeSpan getTimeSpanUsed()

      Description copied from class: `AbstractLayer`
      Returns the time span that is used by the layer. Useful for various operations (e.g. to make all timeline objects become visible). The default implementation returns `TimeSpan.UNDEFINED`.
      Overrides:
        `getTimeSpanUsed` in class `AbstractLayer`
      Returns:
        the time span that is 'used' by the layer

    - #### mouseMoved

          public void mouseMoved(MouseEvent e)

      Specified by:
        `mouseMoved` in interface `MouseMotionListener`

    - #### mouseDragged

          public void mouseDragged(MouseEvent e)

      Specified by:
        `mouseDragged` in interface `MouseMotionListener`

    - #### mouseEntered

          public void mouseEntered(MouseEvent e)

      Specified by:
        `mouseEntered` in interface `MouseListener`

    - #### mouseExited

          public void mouseExited(MouseEvent e)

      Specified by:
        `mouseExited` in interface `MouseListener`

    - #### mousePressed

          public void mousePressed(MouseEvent e)

      Specified by:
        `mousePressed` in interface `MouseListener`

    - #### mouseReleased

          public void mouseReleased(MouseEvent e)

      Specified by:
        `mouseReleased` in interface `MouseListener`

    - #### mouseClicked

          public void mouseClicked(MouseEvent e)

      Specified by:
        `mouseClicked` in interface `MouseListener`

    - #### valueChanged

          public void valueChanged(TimelineObjectSelectionEvent evt)

      Description copied from interface: `ITimelineObjectSelectionListener`
      Callback method that gets invoked when the selection within the observed `TimelineObjectLayer` changes.
      Specified by:
        `valueChanged` in interface `ITimelineObjectSelectionListener`
      Parameters:
        `evt` - the event with detailed information about the change that occured

    - #### getLayer

          public ILayer getLayer()

      Returns the model layer visualized by the timeline object layer.
      Returns:
        the model layer
      Since:
        1.0

    - #### isDebuggingObjectBounds

          public boolean isDebuggingObjectBounds()

      Determines whether the layer will draw red rectangles showing the individual object bounds of the timeline objects. This is very useful for debugging purposes.
      Returns:
        TRUE if the layer draws the object bounds
      Since:
        1.0
      See Also:
        `ITimelineObjectRenderer.getTimelineObjectRendererInsets(int, int, int, int)`

    - #### setDebuggingObjectBounds

          public void setDebuggingObjectBounds(boolean debug)

      Specifies whether the layer will draw red rectangles showing the individual object bounds of the timeline objects. This is very useful for debugging purposes.
      Parameters:
        `debug` - if TRUE the layer draws the object bounds
      Since:
        1.0
      See Also:
        `ITimelineObjectRenderer.getTimelineObjectRendererInsets(int, int, int, int)`

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.