Modelers

org.topcased.draw2d.figures
Class EditableLabel

java.lang.Object
  extended by org.eclipse.draw2d.Figure
      extended by org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel
          extended by org.topcased.draw2d.figures.Label
              extended by org.topcased.draw2d.figures.EditableLabel
All Implemented Interfaces:
org.eclipse.draw2d.IFigure, org.eclipse.draw2d.PositionConstants, ILabel
Direct Known Subclasses:
EdgeObjectEditableLabel, EditableLabelFigure, ModelerLabelFigure, RotatableEditableLabel

public class EditableLabel
extends Label
implements ILabel

A customized Label based on the label used in the flow example. Primary selection is denoted by highlight and focus rectangle. Normal selection is denoted by highlight only. Borrowed from the Flow Editor example


Nested Class Summary
static class EditableLabel.TextProvider
          A TextProvider class where we define an abstract method getText() where subclasses must define the part of the Text that must be displayed during the editing.
 
Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure
org.eclipse.draw2d.Figure.FigureIterator, org.eclipse.draw2d.Figure.IdentitySearch
 
Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure
org.eclipse.draw2d.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.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
 
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
 
Constructor Summary
EditableLabel()
          The default Constructor
EditableLabel(EditableLabel.TextProvider txtProvider)
          The constructor with a TextProvider parameter
EditableLabel(org.eclipse.swt.graphics.Image img)
          Constructor with the initial icon
EditableLabel(org.eclipse.swt.graphics.Image img, EditableLabel.TextProvider txtProvider)
          The constructor with a TextProvider parameter
EditableLabel(java.lang.String text)
          The constructor with a String parameter
 
Method Summary
 java.lang.String getEditableText()
          Return the current editable Text
 boolean getSelected()
          Return the selected value of the widget
 void setColorSelectedLabel(org.eclipse.swt.graphics.Color newColor)
          Sets the backgroundColor of the Label when it is selected
 void setColorUnselectedLabel(org.eclipse.swt.graphics.Color newColor)
          Sets the backgroundColor of the Label when it is not selected
 void setSelected(boolean b)
          Sets the selection state of this EditableLabel
 void setText(java.lang.String s)
          Sets the new Text of the label
 
Methods inherited from class org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel
calculateLabelSize, calculateSubStringTextSize, calculateTextSize, getEllipse, getIcon, getIcon, getIconAlignment, getIconBounds, getIconLocation, getIconSize, getIconTextGap, getMaximumSize, getMinimumSize, getNumberofIcons, getPreferredSize, getSubStringText, getSubStringTextSize, getText, getTextAlignment, getTextBounds, getTextLocation, getTextPlacement, getTextSize, getTextWrapAlignment, getTotalIconSize, hasFocus, hasIcons, invalidate, isSelected, isTextStrikedThrough, isTextTruncated, isTextUnderlined, isTextWrapped, paintFigure, setFocus, setIcon, setIcon, setIconAlignment, setLabelAlignment, setTextAlignment, setTextPlacement, setTextStrikeThrough, setTextUnderline, setTextWrap, setTextWrapAlignment, setTextWrapWidth
 
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, 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, layout, paint, paintBorder, paintChildren, paintClientArea, 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, setFont, 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, toString, wait, wait, wait
 
Methods inherited from interface org.topcased.draw2d.figures.ILabel
getText
 
Methods inherited from interface org.eclipse.draw2d.IFigure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getCursor, getFont, getForegroundColor, getInsets, getLayoutManager, getLocalBackgroundColor, getLocalForegroundColor, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isOpaque, isRequestFocusEnabled, isShowing, isVisible, paint, remove, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setConstraint, setCursor, setEnabled, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
 

Constructor Detail

EditableLabel

public EditableLabel()
The default Constructor


EditableLabel

public EditableLabel(java.lang.String text)
The constructor with a String parameter

Parameters:
text - the value to display

EditableLabel

public EditableLabel(org.eclipse.swt.graphics.Image img)
Constructor with the initial icon

Parameters:
img - the icon displayed in the label

EditableLabel

public EditableLabel(EditableLabel.TextProvider txtProvider)
The constructor with a TextProvider parameter

Parameters:
txtProvider - the TextProvider

EditableLabel

public EditableLabel(org.eclipse.swt.graphics.Image img,
                     EditableLabel.TextProvider txtProvider)
The constructor with a TextProvider parameter

Parameters:
img - the icon displayed in the label
txtProvider - the TextProvider
Method Detail

setText

public void setText(java.lang.String s)
Sets the new Text of the label

Specified by:
setText in interface ILabel
Overrides:
setText in class org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel
Parameters:
s - the new String

getEditableText

public java.lang.String getEditableText()
Return the current editable Text

Returns:
The editable text

setColorSelectedLabel

public void setColorSelectedLabel(org.eclipse.swt.graphics.Color newColor)
Sets the backgroundColor of the Label when it is selected

Parameters:
newColor - the new Color

setColorUnselectedLabel

public void setColorUnselectedLabel(org.eclipse.swt.graphics.Color newColor)
Sets the backgroundColor of the Label when it is not selected

Parameters:
newColor - the new Color

setSelected

public void setSelected(boolean b)
Sets the selection state of this EditableLabel

Overrides:
setSelected in class org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel
Parameters:
b - true will cause the label to appear selected

getSelected

public boolean getSelected()
Return the selected value of the widget

Returns:
a boolean

Modelers

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.