Class OneLineBorder

  • All Implemented Interfaces:
    org.eclipse.draw2d.Border

    public class OneLineBorder
    extends org.eclipse.draw2d.LineBorder
    This is a border that only draws a line at several position around the shape based on a position constant. This is useful for cases where it may be necessary to draw a separator between shapes without instantiating a new figure.
    • Field Summary

      • Fields inherited from class org.eclipse.draw2d.AbstractBorder

        tempRect
    • Constructor Summary

      Constructors 
      Constructor Description
      OneLineBorder​(int width, int positions)
      Constructor.
      OneLineBorder​(org.eclipse.swt.graphics.Color color, int width, int positions)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.eclipse.draw2d.geometry.Insets getInsets​(org.eclipse.draw2d.IFigure figure)  
      int getPositions()  
      void paint​(org.eclipse.draw2d.IFigure figure, org.eclipse.draw2d.Graphics graphics, org.eclipse.draw2d.geometry.Insets insets)
      Paints the border based on the inputs given.
      • Methods inherited from class org.eclipse.draw2d.LineBorder

        getColor, getStyle, getWidth, isOpaque, setColor, setStyle, setWidth
      • Methods inherited from class org.eclipse.draw2d.AbstractBorder

        getPaintRectangle, getPreferredSize
    • Constructor Detail

      • OneLineBorder

        public OneLineBorder​(int width,
                             int positions)
        Constructor.
        Parameters:
        width - the width of the line in relative coordinates
        position - the value should be mask from the PositionConstants.TOP, PositionConstants.BOTTOM, PositionConstants.LEFT, PositionConstants.RIGHT
        See Also:
        PositionConstants
      • OneLineBorder

        public OneLineBorder​(org.eclipse.swt.graphics.Color color,
                             int width,
                             int positions)
        Constructor.
        Parameters:
        color - The color of the border.
        width - the width of the line in relative coordinates
        position - the value should be mask from the PositionConstants.TOP, PositionConstants.BOTTOM, PositionConstants.LEFT, PositionConstants.RIGHT
        See Also:
        PositionConstants
    • Method Detail

      • getPositions

        public int getPositions()
        Returns:
        the positions mask.
      • getInsets

        public org.eclipse.draw2d.geometry.Insets getInsets​(org.eclipse.draw2d.IFigure figure)
        Specified by:
        getInsets in interface org.eclipse.draw2d.Border
        Overrides:
        getInsets in class org.eclipse.draw2d.LineBorder
      • paint

        public void paint​(org.eclipse.draw2d.IFigure figure,
                          org.eclipse.draw2d.Graphics graphics,
                          org.eclipse.draw2d.geometry.Insets insets)
        Paints the border based on the inputs given.
        Specified by:
        paint in interface org.eclipse.draw2d.Border
        Overrides:
        paint in class org.eclipse.draw2d.LineBorder
        Parameters:
        figure - IFigure for which this is the border.
        graphics - Graphics handle for drawing the border.
        insets - Space to be taken up by this border.