public abstract class AbstractTreeEditPart extends AbstractEditPart implements TreeEditPart
TreeEditPart
s used in GEF
TreeViewer
s.
This is an implementation class, and the documentation here is targeted at subclassing this class. Callers of public API should refer to the interface's documentation.
AbstractEditPart.EditPolicyIterator
Modifier and Type | Field and Description |
---|---|
protected Widget |
widget
Either a Tree or TreeItem
|
children, FLAG_ACTIVE, FLAG_FOCUS, MAX_FLAG
SELECTED, SELECTED_NONE, SELECTED_PRIMARY
REQ_ADD, REQ_ALIGN, REQ_ALIGN_CHILDREN, REQ_CLONE, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILDREN, REQ_OPEN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_SOURCE, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER
Constructor and Description |
---|
AbstractTreeEditPart()
Default constructor
|
AbstractTreeEditPart(java.lang.Object model)
Constructs a new EditPart with the specified model.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addChildVisual(EditPart childEditPart,
int index)
Implemented to assign the child its
widget . |
protected boolean |
checkTreeItem()
Convenience method that returns
true if the widget is a
TreeItem and is safe to use. |
protected void |
createEditPolicies()
Override this method to install the EditPolicies for your EditPart.
|
DragTracker |
getDragTracker(Request req)
Returns a
DragTracker for dragging this EditPart. |
protected Image |
getImage()
Override this method to return the
Image for this EditPart's
widget . |
protected java.lang.String |
getText()
Override this method to return the String to be used in this EditPart's
widget . |
Widget |
getWidget()
|
protected void |
refreshVisuals()
By default, this method will apply an
Image and
String to the widget if it is a TreeItem . |
protected void |
removeChildVisual(EditPart childEditPart)
Disposes the child's
widget and sets it to null
. |
protected void |
reorderChild(EditPart editpart,
int index)
Moves a child
EditPart into a lower index than it currently
occupies. |
void |
setWidget(Widget widget)
Sets the
widget . |
protected void |
setWidgetImage(Image image)
Sets a specified
Image into the widget iff it is a
TreeItem . |
protected void |
setWidgetText(java.lang.String text)
Sets a specified
String into the widget iff it is a
TreeItem . |
activate, activateEditPolicies, addChild, addEditPartListener, addNotify, createChild, deactivate, deactivateEditPolicies, debug, debugFeedback, eraseSourceFeedback, eraseTargetFeedback, fireActivated, fireChildAdded, fireDeactivated, fireRemovingChild, fireSelectionChanged, getAccessibleEditPart, getAdapter, getChildren, getCommand, getEditPolicy, getEditPolicyIterator, getEventListeners, getFlag, getModel, getModelChildren, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, performRequest, refresh, refreshChildren, register, registerAccessibility, registerModel, registerVisuals, removeChild, removeEditPartListener, removeEditPolicy, removeNotify, setFlag, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, toString, understandsRequest, unregister, unregisterAccessibility, unregisterModel, unregisterVisuals
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
activate, addEditPartListener, addNotify, deactivate, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, performRequest, refresh, removeEditPartListener, removeEditPolicy, removeNotify, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest
getAdapter
protected Widget widget
public AbstractTreeEditPart(java.lang.Object model)
model
- the modelpublic AbstractTreeEditPart()
protected void addChildVisual(EditPart childEditPart, int index)
widget
. Subclasses should not call
or override this method.addChildVisual
in class AbstractEditPart
childEditPart
- The EditPart being addedindex
- The child's positionAbstractEditPart.addChildVisual(EditPart, int)
protected final boolean checkTreeItem()
true
if the widget is a
TreeItem and is safe to use.true
if the widget is a TreeItem
and is
not disposedprotected void createEditPolicies()
createEditPolicies
in class AbstractEditPart
AbstractEditPart.createEditPolicies()
public DragTracker getDragTracker(Request req)
EditPart
DragTracker
for dragging this EditPart. The
SelectionTool
is the only
Tool by default that calls this method. The SelectionTool will use a
SelectionRequest
to provide information
such as which mouse button is down, and what modifier keys are pressed.getDragTracker
in interface EditPart
req
- a Request
indicating the context of the dragnull
or a DragTrackerEditPart.getDragTracker(Request)
protected Image getImage()
Image
for this EditPart's
widget
. This method is called from refreshVisuals()
.protected java.lang.String getText()
widget
. This method is called from refreshVisuals()
.public Widget getWidget()
TreeEditPart
getWidget
in interface TreeEditPart
TreeEditPart.getWidget()
protected void refreshVisuals()
Image
and
String
to the widget if it is a TreeItem
.
Subclasses should override getImage()
and getText()
to
provide the Image
and String
used.
Subclasses might extend this method if they also want to change the TreeItem's foreground or background color.
refreshVisuals
in class AbstractEditPart
AbstractEditPart.refreshVisuals()
protected void removeChildVisual(EditPart childEditPart)
widget
and sets it to null
.removeChildVisual
in class AbstractEditPart
childEditPart
- the child EditPartAbstractEditPart.removeChildVisual(EditPart)
protected void reorderChild(EditPart editpart, int index)
AbstractEditPart
EditPart
into a lower index than it currently
occupies. This method is called from AbstractEditPart.refreshChildren()
.reorderChild
in class AbstractEditPart
editpart
- the child being reorderedindex
- new index for the childAbstractEditPart.reorderChild(EditPart, int)
public void setWidget(Widget widget)
widget
.setWidget
in interface TreeEditPart
widget
- the WidgetTreeEditPart.setWidget(Widget)
protected final void setWidgetImage(Image image)
Image
into the widget iff it is a
TreeItem
.image
- the Imageprotected final void setWidgetText(java.lang.String text)
String
into the widget iff it is a
TreeItem
.text
- the StringCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.