|
Eclipse Draw2d 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.draw2d.Figure | +--org.eclipse.draw2d.Label
Nested Class Summary |
Nested classes inherited from class org.eclipse.draw2d.Figure |
Figure.FigureIterator |
Nested classes inherited from class org.eclipse.draw2d.IFigure |
IFigure.NoInsets |
Field Summary |
Fields inherited from class org.eclipse.draw2d.Figure |
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip |
Fields inherited from interface org.eclipse.draw2d.PositionConstants |
BOTTOM, CENTER, EAST, EAST_WEST, LEFT, LEFT_CENTER_RIGHT, MIDDLE, NONE, NORTH, NORTH_EAST, NORTH_SOUTH, NORTH_WEST, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TOP_MIDDLE_BOTTOM, WEST |
Fields inherited from interface org.eclipse.draw2d.IFigure |
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS |
Constructor Summary | |
Label()
Construct an empty Label. |
|
Label(Image i)
Construct a Label with passed Image as its icon. |
|
Label(String s)
Construct a Label with passed String as its text. |
|
Label(String s,
Image i)
Construct a Label with passed String as text and passed Image as its icon. |
Method Summary | |
protected Dimension |
calculateLabelSize(Dimension txtSize)
Calculates the size of the Label using the passed Dimension as the size of the Label's text. |
protected Dimension |
calculateSubStringTextSize()
Calculates the size of the Label's text size. |
protected Dimension |
calculateTextSize()
Calculates and returns the size of the Label's text. |
Image |
getIcon()
Returns the Label's icon |
int |
getIconAlignment()
Returns the current alignment of the Label's icon. |
Rectangle |
getIconBounds()
Returns the bounds of the Label's icon. |
protected Point |
getIconLocation()
Returns the location of the Label's icon relative to the Label |
int |
getIconTextGap()
Returns the gap in pixels between the Label's icon and its text. |
Dimension |
getMinimumSize(int w,
int h)
Returns a hint indicating the smallest desireable size for the IFigure. |
Dimension |
getPreferredSize(int wHint,
int hHint)
Returns the desireable size for this IFigure using the provided width and height hints. |
String |
getSubStringText()
Calculates the amount of the Label's current text will fit in the Label, including an elipsis "..." if truncation is required. |
protected Dimension |
getSubStringTextSize()
Returns the size of the Label's current text. |
String |
getText()
Returns the text of the Label. |
int |
getTextAlignment()
Returns the current alignment of the Label's text. |
Rectangle |
getTextBounds()
Returns the bounds of the Label's text. |
protected Point |
getTextLocation()
Returns the location of the Label's text relative to the Label |
int |
getTextPlacement()
Returns the current placement of the Label's text relative to its icon. |
protected Dimension |
getTextSize()
Returns the size of the Label's complete text. |
void |
invalidate()
Invalidates this IFigure. |
boolean |
isTextTruncated()
Returns true if the Label's text is currently truncated and is displaying an ellipsis, false otherwise. |
protected void |
paintFigure(Graphics graphics)
Paints this Figure's primary representation, or background. |
void |
setIcon(Image image)
Sets the Label's icon to the passed image |
void |
setIconAlignment(int align)
Sets the icon alignment relative to the Label's alignment to the passed value. |
void |
setIconDimension(Dimension d)
Sets the Label's icon size to the passed Dimension. |
void |
setIconTextGap(int gap)
Sets the gap in pixels between the Label's icon and text to the passed value. |
void |
setLabelAlignment(int align)
Sets the Label's alignment to the passed value. |
void |
setText(String s)
Sets the Label's text to the passed String. |
void |
setTextAlignment(int align)
Sets the text alignment of the Label relative to the label alignment Default is org.eclipse.draw2d.PositionConstants.CENTER |
void |
setTextPlacement(int where)
Sets the text placement of the Label relative to its icon. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Label()
public Label(String s)
public Label(Image i)
public Label(String s, Image i)
Method Detail |
protected Dimension calculateLabelSize(Dimension txtSize)
txtSize
- Pre-calculated size of the Label's text.protected Dimension calculateSubStringTextSize()
protected Dimension calculateTextSize()
public Image getIcon()
public int getIconAlignment()
PositionConstants.CENTER
public Rectangle getIconBounds()
protected Point getIconLocation()
public int getIconTextGap()
public Dimension getMinimumSize(int w, int h)
IFigure
getMinimumSize
in interface IFigure
getMinimumSize
in class Figure
w
- the width hinth
- the height hint
public Dimension getPreferredSize(int wHint, int hHint)
IFigure
getPreferredSize
in interface IFigure
getPreferredSize
in class Figure
IFigure.getPreferredSize(int, int)
public String getSubStringText()
protected Dimension getSubStringTextSize()
public String getText()
public int getTextAlignment()
PositionConstants.CENTER
public Rectangle getTextBounds()
protected Point getTextLocation()
public int getTextPlacement()
PositionConstants.EAST
protected Dimension getTextSize()
public void invalidate()
IFigure
invalidate
in interface IFigure
invalidate
in class Figure
IFigure.invalidate()
public boolean isTextTruncated()
protected void paintFigure(Graphics graphics)
Figure
Figure.paintClientArea(Graphics)
and Figure.paintBorder(Graphics)
. Furthermore, it is safe
to call graphics.restoreState()
within this method, and doing so will
restore the graphics to its original state upon entry.
paintFigure
in class Figure
graphics
- The Graphics used to paintpublic void setIcon(Image image)
image
- The desired icon for the Labelpublic void setIconAlignment(int align)
align
- The desired icon alignment
Valid values are integer constants CENTER,TOP,BOTTOM,LEFT,RIGHT
in PositionConstants
public void setIconDimension(Dimension d)
public void setIconTextGap(int gap)
public void setLabelAlignment(int align)
align
- The desired label alignment. Valid values are
the integer constants TOP, CENTER, BOTTOM, RIGHT, LEFT in
PositionConstants
public void setText(String s)
public void setTextAlignment(int align)
align
- The desired text alignment. Valid values are
the integer constants TOP, CENTER, BOTTOM, RIGHT, LEFT in
PositionConstants
public void setTextPlacement(int where)
where
- The desired text placement. Valid values are
the integer constants NORTH, SOUTH, EAST, WEST in
PositionConstants
|
Eclipse Draw2d 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |