Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Runtime

org.eclipse.gmf.runtime.draw2d.ui.figures
Class WrapLabel

java.lang.Object
  extended by 

org.eclipse.draw2d.Figure
      extended by 

org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel
          extended by 
org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel
All Implemented Interfaces:
IFigure, PositionConstants

Deprecated. This class has been deprecated and may be removed in the future. Use 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
extends WrappingLabel

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 org.eclipse.draw2d. Figure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getParent, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, internalGetEventDispatcher, intersects, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, paint, paintBorder, paintChildren, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WrapLabel

public WrapLabel()
Deprecated. 
Construct an empty Label.

Since:
2.0

WrapLabel

public WrapLabel(java.lang.String s)
Deprecated. 
Construct a Label with passed String as its text.

Parameters:
s - the label text
Since:
2.0

WrapLabel

public WrapLabel(
Image i)
Deprecated. 
Construct a Label with passed Image as its icon.

Parameters:
i - the label image
Since:
2.0

WrapLabel

public WrapLabel(java.lang.String s,
                 
Image i)
Deprecated. 
Construct a Label with passed String as text and passed Image as its icon.

Parameters:
s - the label text
i - the label image
Since:
2.0
Method Detail

calculateSubStringTextSize

protected 
Dimension calculateSubStringTextSize()
Deprecated. If this behavior is required then a request can be made (with justification) for the WrappingLabel.

Calculates the size of the Label's text size. The text size calculated takes into consideration if the Label's text is currently truncated. If text size without considering current truncation is desired, use calculateTextSize(int, int).

Returns:
the size of the label's text, taking into account truncation
Since:
2.0

calculateTextSize

protected 
Dimension calculateTextSize(int wHint,
                                      int hHint)
Deprecated. If this behavior is required then a request can be made (with justification) for the WrappingLabel.

Calculates and returns the size of the Label's text. Note that this Dimension is calculated using the Label's full text, regardless of whether or not its text is currently truncated. If text size considering current truncation is desired, use calculateSubStringTextSize().

Parameters:
wHint - a width hint
hHint - a height hint
Returns:
the size of the label's text, ignoring truncation
Since:
2.0

getIconBounds

public 
Rectangle getIconBounds()
Deprecated. The icon location can be retrieved with WrappingLabel.getIconLocation() and the icon(s) size can be retrieved with WrappingLabel.getTotalIconSize().

Returns the bounds of the Label's icon.

Returns:
the icon's bounds
Since:
2.0

getSubStringText

public java.lang.String getSubStringText()
Deprecated. If this behavior is required then a request can be made (with justification) for the WrappingLabel.

Calculates the amount of the Label's current text will fit in the Label, including an elipsis "..." if truncation is required.

Returns:
the substring
Since:
2.0

getSubStringTextSize

protected 
Dimension getSubStringTextSize()
Deprecated. If this behavior is required then a request can be made (with justification) for the WrappingLabel.

Returns the size of the Label's current text. If the text is currently truncated, the truncated text with its ellipsis is used to calculate the size.

Returns:
the size of this label's text, taking into account truncation
Since:
2.0

getTextLocation

protected 
Point getTextLocation()
Deprecated. Use getTextBounds().getLocation() instead.

Returns the location of the label's text relative to the label.

Returns:
the text location
Since:
2.0

getTextSize

protected 
Dimension getTextSize(int wHint,
                                int hHint)
Deprecated. If this behavior is required then a request can be made (with justification) for the WrappingLabel.

Returns the size of the label's complete text. Note that the text used to make this calculation is the label's full text, regardless of whether the label's text is currently being truncated and is displaying an ellipsis. If the size considering current truncation is desired, call getSubStringTextSize().

Parameters:
wHint - a width hint
hHint - a height hint
Returns:
the size of this label's complete text
Since:
2.0

invalidate

public void invalidate()
Deprecated. 
Specified by:
invalidate in interface IFigure
Overrides:
invalidate in class WrappingLabel
See Also:
IFigure.invalidate()

isTextTruncated

public boolean isTextTruncated()
Deprecated. If this behavior is required then a request can be made (with justification) for the WrappingLabel.

Returns true if the label's text is currently truncated and is displaying an ellipsis, false otherwise.

Overrides:
isTextTruncated in class WrappingLabel
Returns:
true if the label's text is truncated
Since:
2.0

getEllipse

protected java.lang.String getEllipse()
Deprecated. Renamed to getTruncationString()

Return the ellipse string.

Returns:
the String that represents the fact that the text has been truncated and that more text is available but hidden. Usually this is represented by "...".

getTruncationString

protected java.lang.String getTruncationString()
Deprecated. 
Description copied from class: WrappingLabel
Gets the truncation string. The default is an ellipsis "...". Clients may override, but if the truncation string changes throughout the lifecycle of this figure, then revalidate() should be called to ensure the cached truncationStringSize is cleared.

Overrides:
getTruncationString in class WrappingLabel
Returns:
the truncation string

isTextWrapped

public 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.

Returns:
whether the label text wrap is on

setTextWrapWidth

public void setTextWrapWidth(int i)
Deprecated. this method was empty and never called

Sets the wrapping width of the label text. This is only valid if text wrapping is turned on

Parameters:
i - The label text wrapping width

setTextWrapAlignment

public 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.

Sets the wrapping width of the label text. This is only valid if text wrapping is turned on

Parameters:
i - The label text wrapping width

setLabelAlignment

public void setLabelAlignment(int alignment)
Deprecated. This never worked properly anyways. Call WrappingLabel.setAlignment(int) instead to position the icon and text within the label.


getTextWrapAlignment

public int getTextWrapAlignment()
Deprecated. Renamed to WrappingLabel.getTextJustification()

Returns:
the label text wrapping width

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire