Class ConnectionLayer

All Implemented Interfaces:
FreeformFigure, IFigure

public class ConnectionLayer extends FreeformLayer
Layer designed specifically to handle the presence of connections. This is done due to the necessity of having a router for the connections added.
  • Field Details

    • connectionRouter

      protected ConnectionRouter connectionRouter
      The ConnectionRouter used to route all connections on this layer.
  • Constructor Details

    • ConnectionLayer

      public ConnectionLayer()
  • Method Details

    • add

      public void add(IFigure figure, Object constraint, int index)
      Adds the given figure with the given contraint at the given index. If the figure is a Connection, its ConnectionRouter is set.
      Specified by:
      add in interface IFigure
      Overrides:
      add in class FreeformLayer
      Parameters:
      figure - Figure being added
      constraint - Constraint of the figure being added
      index - Index where the figure is to be added
      Since:
      2.0
      See Also:
    • getConnectionRouter

      public ConnectionRouter getConnectionRouter()
      Returns the ConnectionRouter being used by this layer.
      Returns:
      ConnectionRouter being used by this layer
      Since:
      2.0
    • paint

      public void paint(Graphics graphics)
      Description copied from class: Figure
      Paints this Figure and its children.
      Specified by:
      paint in interface IFigure
      Overrides:
      paint in class Figure
      Parameters:
      graphics - The Graphics object used for painting
      See Also:
    • remove

      public void remove(IFigure figure)
      Removes the figure from this Layer. If the figure is a Connection , that Connection's ConnectionRouter is set to null.
      Specified by:
      remove in interface IFigure
      Overrides:
      remove in class FreeformLayer
      Parameters:
      figure - The figure to remove
      See Also:
    • setConnectionRouter

      public void setConnectionRouter(ConnectionRouter router)
      Sets the ConnectionRouter for this layer. This router is set as the ConnectionRouter for all the child connections of this Layer.
      Parameters:
      router - The ConnectionRouter to set for this Layer
      Since:
      2.0
    • setAntialias

      public void setAntialias(int antialias)
      Sets whether antialiasing should be enabled for the connection layer. If this value is set to something other than SWT.DEFAULT, Graphics.setAntialias(int) will be called with the given value when painting this layer.
      Parameters:
      antialias - the antialias setting
      Since:
      3.1