Class SchemeBorder

java.lang.Object
org.eclipse.draw2d.AbstractBorder
org.eclipse.draw2d.SchemeBorder
All Implemented Interfaces:
Border, ColorConstants
Direct Known Subclasses:
ButtonBorder, SimpleEtchedBorder, SimpleLoweredBorder, SimpleRaisedBorder

public class SchemeBorder extends AbstractBorder implements ColorConstants
SchemeBorder allows the creation of borders based on Schemes. A Scheme is a class whose only purpose is to carry border specific information. SchemeBorder renders the border based on the information given by the Scheme set to it.
  • Field Details

    • scheme

      protected SchemeBorder.Scheme scheme
      The SchemeBorder.Scheme associated with this SchemeBorder
    • DARKEST_DARKER

      protected static final Color[] DARKEST_DARKER
      Arrays of Colors, used for shadow or highlight effects
    • LIGHTER_DARKER

      protected static final Color[] LIGHTER_DARKER
    • DARKER_LIGHTER

      protected static final Color[] DARKER_LIGHTER
  • Constructor Details

    • SchemeBorder

      protected SchemeBorder()
      Constructs a default SchemeBorder with no scheme defined.
      Since:
      2.0
    • SchemeBorder

      public SchemeBorder(SchemeBorder.Scheme scheme)
      Constructs a SchemeBorder with the Scheme given as input.
      Parameters:
      scheme - the Scheme to be used by this border
      Since:
      2.0
  • Method Details

    • getInsets

      public Insets getInsets(IFigure figure)
      Description copied from interface: Border
      Returns the Insets for this Border for the given Figure.
      Specified by:
      getInsets in interface Border
      Parameters:
      figure - The figure this border belongs to
      Returns:
      The insets
      See Also:
    • getScheme

      protected SchemeBorder.Scheme getScheme()
      Returns the scheme used by this border.
      Returns:
      the Scheme used by this border
      Since:
      2.0
    • isOpaque

      public boolean isOpaque()
      Returns the opaque state of this border. Returns true indicating that this will fill in the area enclosed by the border.
      Specified by:
      isOpaque in interface Border
      Overrides:
      isOpaque in class AbstractBorder
      Returns:
      true if this border is opaque
      See Also:
    • setScheme

      protected void setScheme(SchemeBorder.Scheme scheme)
      Sets the Scheme for this border to the Scheme given as input.
      Parameters:
      scheme - the Scheme for this border
      Since:
      2.0
    • paint

      public void paint(IFigure figure, Graphics g, Insets insets)
      Description copied from interface: Border
      Paints the border. The border should paint inside figure's IFigure.getBounds(), inset by the parameter insets. The border generally should not paint inside its own insets. More specifically, Border b should paint inside the rectangle: figure.getBounds().getCropped(insets) and outside of the rectangle: figure.getBounds().getCropped(insets).getCropped(getInsets()) where inside is defined as Rectangle.contains(int, int).
      Specified by:
      paint in interface Border
      Parameters:
      figure - The figure this border belongs to
      g - The graphics object used for painting
      insets - The insets
      See Also:
    • paint

      protected void paint(Graphics graphics, IFigure fig, Insets insets, Color[] tl, Color[] br)
      Paints the border using the information in the set Scheme and the inputs given. Side widths are determined by the number of colors in the Scheme for each side.
      Parameters:
      graphics - the graphics object
      fig - the figure this border belongs to
      insets - the insets
      tl - the highlight (top/left) colors
      br - the shadow (bottom/right) colors