Package org.eclipse.draw2d
Class AbstractLabeledBorder
java.lang.Object
org.eclipse.draw2d.AbstractBorder
org.eclipse.draw2d.AbstractLabeledBorder
- All Implemented Interfaces:
Border
,LabeledBorder
- Direct Known Subclasses:
GroupBoxBorder
,TitleBarBorder
Provides support for a border with a label describing the contents of which
it is surrounding.
-
Field Summary
Fields inherited from class org.eclipse.draw2d.AbstractBorder
tempRect
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a default AbstractLabeledBorder with the name of this class set as its label.Constructs a border with the label set to the String passed in as input. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Insets
calculateInsets
(IFigure figure) Calculates insets based on the current font and other attributes.protected Font
Returns the font that this border will use.Returns the insets, or space associated for this border.getLabel()
Returns the label for this Border.getPreferredSize
(IFigure fig) Returns the preferred width and height that this border would like to display itself properly.Returns the text Color of this AbstractLabeledBorder's label.protected Dimension
Calculates and returns the size required by this border's label.protected void
Resets the internal values and state so that they can be recalculated.void
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.void
Sets the text to be displayed as the label for this Border.void
setTextColor
(Color color) Sets the color for this border's text.Methods inherited from class org.eclipse.draw2d.AbstractBorder
getPaintRectangle, isOpaque
-
Constructor Details
-
AbstractLabeledBorder
public AbstractLabeledBorder()Constructs a default AbstractLabeledBorder with the name of this class set as its label.- Since:
- 2.0
-
AbstractLabeledBorder
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
Calculates insets based on the current font and other attributes. This value will be cached untilinvalidate()
is called.- Parameters:
figure
- The figure to which the border is being applied- Returns:
- The Insets
-
getFont
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
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. -
getLabel
Description copied from interface:LabeledBorder
Returns the label for this Border.- Specified by:
getLabel
in interfaceLabeledBorder
- Returns:
- The label for this Border
- See Also:
-
getPreferredSize
Description copied from interface:Border
Returns the preferred width and height that this border would like to display itself properly.- Specified by:
getPreferredSize
in interfaceBorder
- Overrides:
getPreferredSize
in classAbstractBorder
- Parameters:
fig
- The figure- Returns:
- The preferred size
- See Also:
-
getTextColor
Returns the text Color of this AbstractLabeledBorder's label.- Returns:
- The text color
- Since:
- 2.0
-
getTextExtents
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
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 interfaceLabeledBorder
- Parameters:
font
- The font
-
setLabel
Description copied from interface:LabeledBorder
Sets the text to be displayed as the label for this Border.- Specified by:
setLabel
in interfaceLabeledBorder
- Parameters:
s
- The text- See Also:
-
setTextColor
Sets the color for this border's text.- Parameters:
color
- Color to be set for this border's text- Since:
- 2.0
-