org.eclipse.draw2d
Class TitleBarBorder
java.lang.Object
org.eclipse.draw2d.AbstractBorder
org.eclipse.draw2d.AbstractLabeledBorder
org.eclipse.draw2d.TitleBarBorder
-
All Implemented Interfaces:
-
Border,
LabeledBorder
- public class TitleBarBorder
- extends
AbstractLabeledBorder
Border provides a title bar on the Figure for which this is the border of. Generally
used in conjunction with other borders to create window-like effects. Also provides for
alignment of the text in the bar.
-
See Also:
-
FrameBorder
Constructor Summary
|
TitleBarBorder
()
Constructs a TitleBarBorder with its label set to the name of this class. |
TitleBarBorder
(java.lang.String s)
Constructs a TitleBarBorder with its label set to the passed String. |
Method Summary
|
protected
Insets
|
calculateInsets
(
IFigure figure)
Calculates and returns the Insets for this border. |
protected Color
|
getBackgroundColor
()
Returns the background Color of this TitleBarBorder. |
protected
Insets
|
getPadding
()
Returns this TitleBarBorder's padding. |
int
|
getTextAlignment
()
Returns the alignment of the text in the title bar. |
boolean
|
isOpaque
()
Returns true thereby filling up all the contents within its boundaries,
eleminating the need by the figure to clip the boundaries and do the same. |
void
|
paint
(
IFigure figure,
Graphics g,
Insets insets)
Paints the border. |
void
|
setBackgroundColor
(Color color)
Sets the background color of the area within the boundaries of this border. |
void
|
setPadding
(
Insets pad)
Sets the padding space of this TitleBarBorder to the passed value. |
void
|
setPadding
(int all)
Sets the padding space to be applied on all sides of the border. |
void
|
setTextAlignment
(int align)
Sets the alignment of the text in the title bar. |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
|
TitleBarBorder
public TitleBarBorder()
- Constructs a TitleBarBorder with its label set to the name of this class.
-
Since:
- 2.0
TitleBarBorder
public TitleBarBorder(java.lang.String s)
- Constructs a TitleBarBorder with its label set to the passed String.
-
Parameters:
-
s
- text of the label -
Since:
- 2.0
calculateInsets
protected
Insets calculateInsets(
IFigure figure)
- Calculates and returns the Insets for this border.
-
-
Specified by:
-
calculateInsets
in class
AbstractLabeledBorder
-
-
Parameters:
-
figure
- the figure on which Insets calculations are based
-
Returns:
- the calculated Insets
-
Since:
- 2.0
getBackgroundColor
protected Color getBackgroundColor()
- Returns the background Color of this TitleBarBorder.
-
-
Returns:
- the background color
-
Since:
- 2.0
getPadding
protected
Insets getPadding()
- Returns this TitleBarBorder's padding. Padding provides spacing along the sides of the
TitleBarBorder. The default value is no padding along all sides.
-
-
Returns:
- the Insets representing the space along the sides of the TitleBarBorder
-
Since:
- 2.0
getTextAlignment
public int getTextAlignment()
- Returns the alignment of the text in the title bar. Possible values are
PositionConstants.LEFT
,
PositionConstants.CENTER
and
PositionConstants.RIGHT
.
-
-
Returns:
- the text alignment
-
Since:
- 2.0
isOpaque
public boolean isOpaque()
- Returns
true
thereby filling up all the contents within its boundaries,
eleminating the need by the figure to clip the boundaries and do the same.
-
-
Specified by:
-
isOpaque
in interface
Border
-
Overrides:
-
isOpaque
in class
AbstractBorder
-
-
See Also:
-
Border.isOpaque()
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)
.
-
-
Parameters:
-
figure
- The figure this border belongs to -
g
- The graphics object used for painting -
insets
- The insets -
See Also:
-
Border.paint(IFigure, Graphics, Insets)
setBackgroundColor
public void setBackgroundColor(Color color)
- Sets the background color of the area within the boundaries of this border. This is
required as this border takes responsibility for filling up the region, as
TitleBarBorders are always opaque.
-
-
Parameters:
-
color
- the background color -
Since:
- 2.0
setPadding
public void setPadding(int all)
- Sets the padding space to be applied on all sides of the border. The default value is
no padding on all sides.
-
-
Parameters:
-
all
- the value of the padding on all sides -
Since:
- 2.0
setPadding
public void setPadding(
Insets pad)
- Sets the padding space of this TitleBarBorder to the passed value. The default value is
no padding on all sides.
-
-
Parameters:
-
pad
- the padding -
Since:
- 2.0
setTextAlignment
public void setTextAlignment(int align)
- Sets the alignment of the text in the title bar. Possible values are
PositionConstants.LEFT
,
PositionConstants.CENTER
and
PositionConstants.RIGHT
.
-
-
Parameters:
-
align
- the new text alignment -
Since:
- 2.0
Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.