sk.uniba.euromath.editor.textEditor.editParts
Class TextEditPart

java.lang.Object
  extended by org.eclipse.gef.editparts.AbstractEditPart
      extended by org.eclipse.gef.editparts.AbstractGraphicalEditPart
          extended by sk.uniba.euromath.editor.xmlEditor.editParts.XMLEditPart
              extended by sk.uniba.euromath.editor.textEditor.editParts.TextEditPart
All Implemented Interfaces:
IAdaptable, org.eclipse.gef.EditPart, org.eclipse.gef.GraphicalEditPart, org.eclipse.gef.RequestConstants, ITextPieceKeeper, IXMLEditPart

public class TextEditPart
extends XMLEditPart
implements ITextPieceKeeper

EditPart that represents one line of text. Has also editing capabilities, but editing does nothing, supposed to be overriden.

Author:
Tomáš Studva, Martin Kollar 1.10.2005

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
org.eclipse.gef.editparts.AbstractGraphicalEditPart.AccessibleGraphicalEditPart, org.eclipse.gef.editparts.AbstractGraphicalEditPart.DefaultAccessibleAnchorProvider
 
Nested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractEditPart
org.eclipse.gef.editparts.AbstractEditPart.EditPolicyIterator
 
Field Summary
 
Fields inherited from class sk.uniba.euromath.editor.xmlEditor.editParts.XMLEditPart
id
 
Fields inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
figure, sourceConnections, targetConnections
 
Fields inherited from class org.eclipse.gef.editparts.AbstractEditPart
children, FLAG_ACTIVE, FLAG_FOCUS, MAX_FLAG
 
Fields inherited from interface org.eclipse.gef.EditPart
SELECTED, SELECTED_NONE, SELECTED_PRIMARY
 
Fields inherited from interface org.eclipse.gef.RequestConstants
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 Summary
TextEditPart(ITextLocator figure, CaretManager cManager, org.eclipse.gef.GraphicalViewer graphicalViewer, XMLAccess xmlAccess, Boolean selectable)
          Constructor.
 
Method Summary
protected  void createEditPolicies()
          Installs adition policies - text policies.
 org.eclipse.gef.DragTracker getDragTracker(org.eclipse.gef.Request request)
           
protected  org.eclipse.gef.GraphicalViewer getGraphicalViewer()
          Getter for graphical viewer.
 ITextPieceKeeper getKeeperInDirection(Direction direction, int gapIndex)
          Returns keeper located in direction from this keeper at xCoordinate.
 List getModelChildren()
          Returns empty list, because can't have children.
 ITextPieceKeeper getNextKeeperInDirection(Direction position)
          Returns keeper located next in direction to this's.
 ITextPieceSelectionStatus getSelectionStatus()
          Returns status about which text is selected.
 String getText()
          Returns rendered keeper's text.
 ITextPieceContainer getTextContainer()
          Returns ITextPieceContainer where keeper is held.
 ITextLocator getTextLocator()
          Returns ITextLocator for this keeper.
 ITextPieceInfo getTextPieceInfo()
          Returns ITextPieceInfo about keeper's text piece.
protected  org.eclipse.gef.EditPolicy getUnderstandingPolicy(org.eclipse.gef.Request request)
          Returns first policy that understands request.
protected  XMLAccess getXmlAccess()
          Getter.
 void performRequest(org.eclipse.gef.Request req)
          Finds Understaning policy, gets command from this policy and put it to command stack for execute.
 void setTextContainer(ITextPieceContainer textContainer)
          Sets text container and text info from that container.
 void showSelection()
          Shows(renders) actual selection stored in ITextSelectionStatus.
 String toString()
           
 
Methods inherited from class sk.uniba.euromath.editor.xmlEditor.editParts.XMLEditPart
addChildVisual, computeModelChildren, createFigure, getID, getTargetEditPart, getXMLEditPartFactory, isSelectable, refreshVisuals, removeChildVisual, setID, setSelectability
 
Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
activate, addNodeListener, addNotify, addSourceConnection, addTargetConnection, createConnection, createOrFindConnection, deactivate, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, getAdapter, getContentPane, getFigure, getLayer, getModelSourceConnections, getModelTargetConnections, getSourceConnections, getTargetConnections, primAddSourceConnection, primAddTargetConnection, primRemoveSourceConnection, primRemoveTargetConnection, refresh, refreshSourceConnections, refreshTargetConnections, registerVisuals, removeNodeListener, removeNotify, removeSourceConnection, removeTargetConnection, reorderChild, reorderSourceConnection, reorderTargetConnection, setFigure, setLayoutConstraint, unregisterVisuals
 
Methods inherited from class org.eclipse.gef.editparts.AbstractEditPart
activateEditPolicies, addChild, addEditPartListener, createChild, deactivateEditPolicies, debug, debugFeedback, eraseSourceFeedback, eraseTargetFeedback, fireActivated, fireChildAdded, fireDeactivated, fireRemovingChild, fireSelectionChanged, getAccessibleEditPart, getChildren, getCommand, getEditPolicy, getEditPolicyIterator, getEventListeners, getFlag, getModel, getParent, getRoot, getSelected, getViewer, hasFocus, installEditPolicy, isActive, refreshChildren, register, registerAccessibility, registerModel, removeChild, removeEditPartListener, removeEditPolicy, setFlag, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest, unregister, unregisterAccessibility, unregisterModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface sk.uniba.euromath.editor.xmlEditor.IXMLEditPart
getID
 
Methods inherited from interface org.eclipse.gef.GraphicalEditPart
addNodeListener, getContentPane, getFigure, getSourceConnections, getTargetConnections, removeNodeListener, setLayoutConstraint
 
Methods inherited from interface org.eclipse.gef.EditPart
activate, addEditPartListener, addNotify, deactivate, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, refresh, removeEditPartListener, removeEditPolicy, removeNotify, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Constructor Detail

TextEditPart

public TextEditPart(ITextLocator figure,
                    CaretManager cManager,
                    org.eclipse.gef.GraphicalViewer graphicalViewer,
                    XMLAccess xmlAccess,
                    Boolean selectable)
Constructor.

Parameters:
figure - displaying text piece
cManager - CaretManager
graphicalViewer - graphical viewer reference
xmlAccess - xml access reference
selectable - flag if is selectable
Method Detail

getDragTracker

public org.eclipse.gef.DragTracker getDragTracker(org.eclipse.gef.Request request)
Specified by:
getDragTracker in interface org.eclipse.gef.EditPart
Overrides:
getDragTracker in class XMLEditPart
Parameters:
request - can be anything, the result does not depent on request
Returns:
TextDragTracker or null
See Also:
EditPart.getDragTracker(org.eclipse.gef.Request)

createEditPolicies

protected void createEditPolicies()
Installs adition policies - text policies.

Overrides:
createEditPolicies in class XMLEditPart

getModelChildren

public List getModelChildren()
Returns empty list, because can't have children.

Overrides:
getModelChildren in class XMLEditPart
Returns:
empty list

getUnderstandingPolicy

protected org.eclipse.gef.EditPolicy getUnderstandingPolicy(org.eclipse.gef.Request request)
Returns first policy that understands request.

Parameters:
request - to understand
Returns:
policy which understands request and null otherwise

performRequest

public void performRequest(org.eclipse.gef.Request req)
Finds Understaning policy, gets command from this policy and put it to command stack for execute.

Specified by:
performRequest in interface org.eclipse.gef.EditPart
Overrides:
performRequest in class org.eclipse.gef.editparts.AbstractEditPart
Parameters:
req - Request

getTextLocator

public ITextLocator getTextLocator()
Description copied from interface: ITextPieceKeeper
Returns ITextLocator for this keeper.

Specified by:
getTextLocator in interface ITextPieceKeeper
Returns:
text locator to lacate keeped text piece

getTextPieceInfo

public ITextPieceInfo getTextPieceInfo()
Description copied from interface: ITextPieceKeeper
Returns ITextPieceInfo about keeper's text piece.

Specified by:
getTextPieceInfo in interface ITextPieceKeeper
Returns:
info for keeped text

getSelectionStatus

public ITextPieceSelectionStatus getSelectionStatus()
Description copied from interface: ITextPieceKeeper
Returns status about which text is selected.

Specified by:
getSelectionStatus in interface ITextPieceKeeper
Returns:
selection status

getTextContainer

public ITextPieceContainer getTextContainer()
Description copied from interface: ITextPieceKeeper
Returns ITextPieceContainer where keeper is held.

Specified by:
getTextContainer in interface ITextPieceKeeper
Returns:
container containing this keeper

showSelection

public void showSelection()
Description copied from interface: ITextPieceKeeper
Shows(renders) actual selection stored in ITextSelectionStatus.

Specified by:
showSelection in interface ITextPieceKeeper

getText

public String getText()
Description copied from interface: ITextPieceKeeper
Returns rendered keeper's text. Same as ITextPieceInfo.getRenderedText()

Specified by:
getText in interface ITextPieceKeeper
Returns:
rendered text piece of this keeper.

getNextKeeperInDirection

public ITextPieceKeeper getNextKeeperInDirection(Direction position)
Description copied from interface: ITextPieceKeeper
Returns keeper located next in direction to this's.

Specified by:
getNextKeeperInDirection in interface ITextPieceKeeper
Parameters:
position - one of Direction#LEFT, Direction#RIGHT

getKeeperInDirection

public ITextPieceKeeper getKeeperInDirection(Direction direction,
                                             int gapIndex)
Description copied from interface: ITextPieceKeeper
Returns keeper located in direction from this keeper at xCoordinate.

Specified by:
getKeeperInDirection in interface ITextPieceKeeper
Parameters:
direction - Direction#TOP, Direction#BOTTOM
gapIndex - x coordinate of vertical to find closest keeper in direction

toString

public String toString()
Overrides:
toString in class XMLEditPart

setTextContainer

public void setTextContainer(ITextPieceContainer textContainer)
Sets text container and text info from that container.

Specified by:
setTextContainer in interface ITextPieceKeeper
Parameters:
textContainer -

getXmlAccess

protected XMLAccess getXmlAccess()
Getter.

Returns:
Returns the xmlAccess.

getGraphicalViewer

protected org.eclipse.gef.GraphicalViewer getGraphicalViewer()
Getter for graphical viewer.

Returns:
graphical viewer


Copyright © 2003-2006 null. All Rights Reserved.