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
- 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 Summary
|
AbstractLabeledBorder
()
Constructs a default AbstractLabeledBorder with the name of this class set as its
label. |
AbstractLabeledBorder
(java.lang.String s)
Constructs a border with the label set to the String passed in as input. |
Method Summary
|
protected abstract
Insets
|
calculateInsets
(
IFigure figure)
Calculates insets based on the current font and other attributes. |
protected Font
|
getFont
(
IFigure f)
Returns the font that this border will use. |
Insets
|
getInsets
(
IFigure fig)
Returns the insets, or space associated for this border. |
java.lang.String
|
getLabel
()
Returns the label for this Border. |
Dimension
|
getPreferredSize
(
IFigure fig)
Returns the preferred width and height that this border would like to display itself
properly. |
Color
|
getTextColor
()
Returns the text Color of this AbstractLabeledBorder's label. |
protected
Dimension
|
getTextExtents
(
IFigure f)
Calculates and returns the size required by this border's label. |
protected void
|
invalidate
()
Resets the internal values and state so that they can be recalculated. |
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. |
void
|
setLabel
(java.lang.String s)
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 java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
|
AbstractLabeledBorder
public AbstractLabeledBorder()
- Constructs a default AbstractLabeledBorder with the name of this class set as its
label.
-
Since:
- 2.0
AbstractLabeledBorder
public AbstractLabeledBorder(java.lang.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
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 java.lang.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:
-
LabeledBorder.getLabel()
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
-
-
See Also:
-
Border.getPreferredSize(IFigure)
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(java.lang.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:
-
LabeledBorder.setLabel(String)
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
Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.