Class AbstractLabeledBorder

java.lang.Object
org.eclipse.draw2d.AbstractBorder
org.eclipse.draw2d.AbstractLabeledBorder
All Implemented Interfaces:
Border, LabeledBorder
Direct Known Subclasses:
GroupBoxBorder, TitleBarBorder

public abstract class AbstractLabeledBorder extends AbstractBorder implements LabeledBorder
Provides support for a border with a label describing the contents of which it is surrounding.
  • Constructor Details

    • AbstractLabeledBorder

      public AbstractLabeledBorder()
      Constructs a default AbstractLabeledBorder with the name of this class set as its label.
      Since:
      2.0
    • AbstractLabeledBorder

      public AbstractLabeledBorder(String s)
      Constructs a border with the label set to the String passed in as input.
      Parameters:
      s - Label to be set on the border
      Since:
      2.0
  • Method Details

    • calculateInsets

      protected abstract Insets calculateInsets(IFigure figure)
      Calculates insets based on the current font and other attributes. This value will be cached until invalidate() is called.
      Parameters:
      figure - The figure to which the border is being applied
      Returns:
      The Insets
    • getFont

      protected Font getFont(IFigure f)
      Returns the font that this border will use. If no Font has been specified, the font associated with the input Figure will be used.
      Parameters:
      f - Figure used to get a default font
      Returns:
      The font for this border
    • getInsets

      public Insets getInsets(IFigure fig)
      Returns the insets, or space associated for this border. Returns any previously set value if present, else calculates it from the Figure provided in as input.
      Specified by:
      getInsets in interface Border
      Parameters:
      fig - Figure used to calculate insets
      Returns:
      The insets
    • getLabel

      public String getLabel()
      Description copied from interface: LabeledBorder
      Returns the label for this Border.
      Specified by:
      getLabel in interface LabeledBorder
      Returns:
      The label for this Border
      See Also:
    • getPreferredSize

      public Dimension getPreferredSize(IFigure fig)
      Description copied from interface: Border
      Returns the preferred width and height that this border would like to display itself properly.
      Specified by:
      getPreferredSize in interface Border
      Overrides:
      getPreferredSize in class AbstractBorder
      Parameters:
      fig - The figure
      Returns:
      The preferred size
      See Also:
    • getTextColor

      public Color getTextColor()
      Returns the text Color of this AbstractLabeledBorder's label.
      Returns:
      The text color
      Since:
      2.0
    • getTextExtents

      protected Dimension getTextExtents(IFigure f)
      Calculates and returns the size required by this border's label.
      Parameters:
      f - IFigure on which the calculations are to be made
      Returns:
      Dimensions required by the text of this border's label
      Since:
      2.0
    • invalidate

      protected void invalidate()
      Resets the internal values and state so that they can be recalculated. Called whenever a state change has occurred that effects the insets or text extents of this border.
    • setFont

      public void setFont(Font font)
      Sets the Font of this border to the input value, and invalidates the border forcing an update of internal parameters of insets and text extents.
      Specified by:
      setFont in interface LabeledBorder
      Parameters:
      font - The font
    • setLabel

      public void setLabel(String s)
      Description copied from interface: LabeledBorder
      Sets the text to be displayed as the label for this Border.
      Specified by:
      setLabel in interface LabeledBorder
      Parameters:
      s - The text
      See Also:
    • setTextColor

      public void setTextColor(Color color)
      Sets the color for this border's text.
      Parameters:
      color - Color to be set for this border's text
      Since:
      2.0