|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.draw2d.Figure
org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel
org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel
WrappingLabel
instead. This class now extends
from WrappingLabel
so the behavior should be the
same. If client code is calling one of the methods on
WrapLabel
that no longer exists, evaluate whether
this is necessary or not.
public class WrapLabel
An extended label that has the following extra features:
1- It is capable of showing selection and focus feedback (primary or
secondary) 2- It is capable of optionally underlining the label's text 3- It
is capable of wrapping the label's text at a given width with a given
alignment 4- It is capable of supporting multiple label icons (temporary
feature)
This class was originally deriving off Draw2d's Label
class
but with the introduction of the auto-wrapping feature, a copy had to be made
overriding was not straightforward. Hopefully, this extended version can be
pushed to opensource
Code taken from Eclipse reference bugzilla #98820
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure |
---|
Figure.FigureIterator, Figure.IdentitySearch |
Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure |
---|
IFigure.NoInsets |
Field Summary |
---|
Fields inherited from class org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel |
---|
MAX_FLAG, preferredTextSize |
Fields inherited from class org.eclipse.draw2d.Figure |
---|
bgColor, border, bounds, fgColor, flags, font, maxSize, minSize, NO_MANAGER, prefSize, toolTip |
Fields inherited from interface org.eclipse.draw2d.PositionConstants |
---|
ALWAYS_LEFT, ALWAYS_RIGHT, BOTTOM, CENTER, EAST, EAST_WEST, HORIZONTAL, LEFT, LEFT_CENTER_RIGHT, MIDDLE, NONE, NORTH, NORTH_EAST, NORTH_SOUTH, NORTH_WEST, NSEW, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TOP_MIDDLE_BOTTOM, VERTICAL, WEST |
Fields inherited from interface org.eclipse.draw2d.IFigure |
---|
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS |
Constructor Summary | |
---|---|
WrapLabel()
Deprecated. Construct an empty Label. |
|
WrapLabel(Image i)
Deprecated. Construct a Label with passed Image as its icon. |
|
WrapLabel(java.lang.String s)
Deprecated. Construct a Label with passed String as its text. |
|
WrapLabel(java.lang.String s,
Image i)
Deprecated. Construct a Label with passed String as text and passed Image as its icon. |
Method Summary | |
---|---|
protected Dimension |
calculateSubStringTextSize()
Deprecated. If this behavior is required then a request can be made (with justification) for the WrappingLabel. |
protected Dimension |
calculateTextSize(int wHint,
int hHint)
Deprecated. If this behavior is required then a request can be made (with justification) for the WrappingLabel. |
protected java.lang.String |
getEllipse()
Deprecated. Renamed to getTruncationString() |
Rectangle |
getIconBounds()
Deprecated. The icon location can be retrieved with WrappingLabel.getIconLocation() and the icon(s) size can be
retrieved with WrappingLabel.getTotalIconSize() . |
java.lang.String |
getSubStringText()
Deprecated. If this behavior is required then a request can be made (with justification) for the WrappingLabel. |
protected Dimension |
getSubStringTextSize()
Deprecated. If this behavior is required then a request can be made (with justification) for the WrappingLabel. |
protected Point |
getTextLocation()
Deprecated. Use getTextBounds().getLocation() instead. |
protected Dimension |
getTextSize(int wHint,
int hHint)
Deprecated. If this behavior is required then a request can be made (with justification) for the WrappingLabel. |
int |
getTextWrapAlignment()
Deprecated. Renamed to WrappingLabel.getTextJustification() |
protected java.lang.String |
getTruncationString()
Deprecated. Gets the truncation string. |
void |
invalidate()
Deprecated. |
boolean |
isTextTruncated()
Deprecated. If this behavior is required then a request can be made (with justification) for the WrappingLabel. |
boolean |
isTextWrapped()
Deprecated. Use WrappingLabel.isTextWrapOn() instead. This method was renamed
because it never indicated if the text was actually wrapped,
but whether text wrapping was turned on in the label. |
void |
setLabelAlignment(int alignment)
Deprecated. This never worked properly anyways. Call WrappingLabel.setAlignment(int) instead to position the icon and
text within the label. |
void |
setTextWrapAlignment(int i)
Deprecated. Call WrappingLabel.setTextJustification(int) and
WrappingLabel.setAlignment(int) instead. This method was somewhat
controlling text justification and label alignment, but they
are really two independent settings. Previously,
setTextWrapAlignment(CENTER) would not only center-justifies
the text, but also put the label in the center. Now, you need
to call WrappingLabel.setTextJustification(int) to justify the
text (this only affects text when it is wrapped) and
WrappingLabel.setAlignment(int) to position the text correctly in
the label. If you want the text in the center of the label
than call setAlignment(PositionConstants.CENTER) .
Look at the implementation of this method to see how your
code needs to be migrated. |
void |
setTextWrapWidth(int i)
Deprecated. this method was empty and never called |
Methods inherited from class org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel |
---|
calculateLabelSize, getAlignment, getIcon, getIcon, getIconAlignment, getIconLocation, getIconSize, getIconTextGap, getMinimumSize, getNumberofIcons, getPreferredSize, getText, getTextAlignment, getTextBounds, getTextFigure, getTextJustification, getTextPlacement, getTotalIconSize, hasFocus, hasIcons, isSelected, isTextStrikedThrough, isTextUnderlined, isTextWrapOn, layout, paintClientArea, paintFigure, setAlignment, setFocus, setFont, setIcon, setIcon, setIconAlignment, setIconLocation, setSelected, setText, setTextAlignment, setTextJustification, setTextPlacement, setTextStrikeThrough, setTextUnderline, setTextWrap, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public WrapLabel()
public WrapLabel(java.lang.String s)
s
- the label textpublic WrapLabel(Image i)
i
- the label imagepublic WrapLabel(java.lang.String s, Image i)
s
- the label texti
- the label imageMethod Detail |
---|
protected Dimension calculateSubStringTextSize()
calculateTextSize(int, int)
.
protected Dimension calculateTextSize(int wHint, int hHint)
calculateSubStringTextSize()
.
wHint
- a width hinthHint
- a height hint
public Rectangle getIconBounds()
WrappingLabel.getIconLocation()
and the icon(s) size can be
retrieved with WrappingLabel.getTotalIconSize()
.
public java.lang.String getSubStringText()
protected Dimension getSubStringTextSize()
protected Point getTextLocation()
getTextBounds().getLocation()
instead.
protected Dimension getTextSize(int wHint, int hHint)
getSubStringTextSize()
.
wHint
- a width hinthHint
- a height hint
public void invalidate()
invalidate
in interface IFigure
invalidate
in class WrappingLabel
IFigure.invalidate()
public boolean isTextTruncated()
true
if the label's text is currently truncated
and is displaying an ellipsis, false
otherwise.
isTextTruncated
in class WrappingLabel
true
if the label's text is truncatedprotected java.lang.String getEllipse()
getTruncationString()
String
that represents the fact that the text
has been truncated and that more text is available but hidden.
Usually this is represented by "...".protected java.lang.String getTruncationString()
WrappingLabel
truncationStringSize
is cleared.
getTruncationString
in class WrappingLabel
public boolean isTextWrapped()
WrappingLabel.isTextWrapOn()
instead. This method was renamed
because it never indicated if the text was actually wrapped,
but whether text wrapping was turned on in the label.
public void setTextWrapWidth(int i)
i
- The label text wrapping widthpublic void setTextWrapAlignment(int i)
WrappingLabel.setTextJustification(int)
and
WrappingLabel.setAlignment(int)
instead. This method was somewhat
controlling text justification and label alignment, but they
are really two independent settings. Previously,
setTextWrapAlignment(CENTER) would not only center-justifies
the text, but also put the label in the center. Now, you need
to call WrappingLabel.setTextJustification(int)
to justify the
text (this only affects text when it is wrapped) and
WrappingLabel.setAlignment(int)
to position the text correctly in
the label. If you want the text in the center of the label
than call setAlignment(PositionConstants.CENTER)
.
Look at the implementation of this method to see how your
code needs to be migrated.
i
- The label text wrapping widthpublic void setLabelAlignment(int alignment)
WrappingLabel.setAlignment(int)
instead to position the icon and
text within the label.
public int getTextWrapAlignment()
WrappingLabel.getTextJustification()
|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.