uk.ac.kcl.cch.jb.pliny.imageRes.parts
Class ImageResourcePart

java.lang.Object
  extended byorg.eclipse.gef.editparts.AbstractEditPart
      extended byorg.eclipse.gef.editparts.AbstractGraphicalEditPart
          extended byuk.ac.kcl.cch.jb.pliny.parts.ParentOfOrderableAbstractGraphicalEditPart
              extended byuk.ac.kcl.cch.jb.pliny.imageRes.parts.ImageResourcePart
All Implemented Interfaces:
org.eclipse.gef.EditPart, EventListener, org.eclipse.gef.GraphicalEditPart, org.eclipse.core.runtime.IAdaptable, IHasReferencerManager, IMoveableChildrenEditPart, IScalableImagePart, PropertyChangeListener, org.eclipse.gef.RequestConstants

public class ImageResourcePart
extends ParentOfOrderableAbstractGraphicalEditPart
implements IScalableImagePart, PropertyChangeListener

the GEF EditPart that acts as the root for the ImageEditor's annotation area.

This class displays a Scalable image, and therefore implements IScaleableImagePart to provide scaling services for coordinates that the displayed image, and the reference objects use to position and size themselves. Furthermore, this class tracks the setting of the Zoom size stored in the associated ImageResource, and trickers a rescaling of the underlying image and annotation area when it changes.

Author:
John Bradley

Nested Class Summary
 
Nested classes inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
org.eclipse.gef.editparts.AbstractGraphicalEditPart.AccessibleGraphicalEditPart, org.eclipse.gef.editparts.AbstractGraphicalEditPart.DefaultAccessibleAnchorProvider
 
Nested classes inherited from class org.eclipse.gef.editparts.AbstractEditPart
org.eclipse.gef.editparts.AbstractEditPart.EditPolicyIterator
 
Field Summary
 
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
ImageResourcePart(ImageResource data)
           
 
Method Summary
 void activate()
          Upon activation, attach to the model element as a property change listener.
 org.eclipse.draw2d.geometry.Point alignForDisplay(int x, int y)
           
 org.eclipse.draw2d.geometry.Point alignForDisplay(org.eclipse.draw2d.geometry.Point pt)
           
 org.eclipse.draw2d.geometry.Point alignForImage(int x, int y)
           
 org.eclipse.draw2d.geometry.Point alignForImage(org.eclipse.draw2d.geometry.Point pt)
           
protected  void createEditPolicies()
           
protected  org.eclipse.draw2d.IFigure createFigure()
           
 void deactivate()
          Upon deactivation, detach from the model element as a property change listener.
 org.eclipse.draw2d.IFigure getContentPane()
           
protected  ImageFigure getImageFigure()
           
 ImageResource getImageResource()
           
protected  List getModelChildren()
           
 org.eclipse.draw2d.geometry.Rectangle positionForDisplay(org.eclipse.draw2d.geometry.Rectangle in)
           
 org.eclipse.draw2d.geometry.Rectangle positionForImage(org.eclipse.draw2d.geometry.Rectangle in)
           
 void propertyChange(PropertyChangeEvent arg0)
           
 org.eclipse.draw2d.geometry.Dimension scaleForDisplay(org.eclipse.draw2d.geometry.Dimension in)
           
 org.eclipse.draw2d.geometry.Rectangle scaleForDisplay(org.eclipse.draw2d.geometry.Rectangle in)
           
 org.eclipse.draw2d.geometry.Dimension scaleForImage(org.eclipse.draw2d.geometry.Dimension in)
           
 org.eclipse.draw2d.geometry.Rectangle scaleForImage(org.eclipse.draw2d.geometry.Rectangle in)
           
 org.eclipse.draw2d.geometry.Point shiftNoScaling(int x, int y)
           
protected  void updateChildren()
           
 
Methods inherited from class uk.ac.kcl.cch.jb.pliny.parts.ParentOfOrderableAbstractGraphicalEditPart
addReferencerList, getDragTracker, getReferencerManager, MoveToPosition
 
Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
addChildVisual, addNodeListener, addNotify, addSourceConnection, addTargetConnection, createConnection, createOrFindConnection, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, getAdapter, getFigure, getLayer, getModelSourceConnections, getModelTargetConnections, getSourceConnections, getTargetConnections, primAddSourceConnection, primAddTargetConnection, primRemoveSourceConnection, primRemoveTargetConnection, refresh, refreshSourceConnections, refreshTargetConnections, registerVisuals, removeChildVisual, 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, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, performRequest, refreshChildren, refreshVisuals, register, registerAccessibility, registerModel, removeChild, removeEditPartListener, removeEditPolicy, setFlag, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, toString, 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 org.eclipse.gef.GraphicalEditPart
addNodeListener, getFigure, getSourceConnections, getTargetConnections, removeNodeListener, setLayoutConstraint
 
Methods inherited from interface org.eclipse.gef.EditPart
addEditPartListener, addNotify, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getDragTracker, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, performRequest, refresh, removeEditPartListener, removeEditPolicy, removeNotify, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Constructor Detail

ImageResourcePart

public ImageResourcePart(ImageResource data)
Method Detail

getImageResource

public ImageResource getImageResource()

createFigure

protected org.eclipse.draw2d.IFigure createFigure()

getImageFigure

protected ImageFigure getImageFigure()

shiftNoScaling

public org.eclipse.draw2d.geometry.Point shiftNoScaling(int x,
                                                        int y)
Specified by:
shiftNoScaling in interface IScalableImagePart

alignForImage

public org.eclipse.draw2d.geometry.Point alignForImage(int x,
                                                       int y)
Specified by:
alignForImage in interface IScalableImagePart

alignForImage

public org.eclipse.draw2d.geometry.Point alignForImage(org.eclipse.draw2d.geometry.Point pt)
Specified by:
alignForImage in interface IScalableImagePart

scaleForImage

public org.eclipse.draw2d.geometry.Dimension scaleForImage(org.eclipse.draw2d.geometry.Dimension in)
Specified by:
scaleForImage in interface IScalableImagePart

positionForImage

public org.eclipse.draw2d.geometry.Rectangle positionForImage(org.eclipse.draw2d.geometry.Rectangle in)
Specified by:
positionForImage in interface IScalableImagePart

scaleForImage

public org.eclipse.draw2d.geometry.Rectangle scaleForImage(org.eclipse.draw2d.geometry.Rectangle in)
Specified by:
scaleForImage in interface IScalableImagePart

alignForDisplay

public org.eclipse.draw2d.geometry.Point alignForDisplay(int x,
                                                         int y)
Specified by:
alignForDisplay in interface IScalableImagePart

alignForDisplay

public org.eclipse.draw2d.geometry.Point alignForDisplay(org.eclipse.draw2d.geometry.Point pt)
Specified by:
alignForDisplay in interface IScalableImagePart

scaleForDisplay

public org.eclipse.draw2d.geometry.Dimension scaleForDisplay(org.eclipse.draw2d.geometry.Dimension in)
Specified by:
scaleForDisplay in interface IScalableImagePart

positionForDisplay

public org.eclipse.draw2d.geometry.Rectangle positionForDisplay(org.eclipse.draw2d.geometry.Rectangle in)
Specified by:
positionForDisplay in interface IScalableImagePart

scaleForDisplay

public org.eclipse.draw2d.geometry.Rectangle scaleForDisplay(org.eclipse.draw2d.geometry.Rectangle in)
Specified by:
scaleForDisplay in interface IScalableImagePart

getContentPane

public org.eclipse.draw2d.IFigure getContentPane()
Specified by:
getContentPane in interface org.eclipse.gef.GraphicalEditPart
Returns:
the Content pane for adding or removing child figures

getModelChildren

protected List getModelChildren()

createEditPolicies

protected void createEditPolicies()

activate

public void activate()
Upon activation, attach to the model element as a property change listener.

Specified by:
activate in interface org.eclipse.gef.EditPart

deactivate

public void deactivate()
Upon deactivation, detach from the model element as a property change listener.

Specified by:
deactivate in interface org.eclipse.gef.EditPart

updateChildren

protected void updateChildren()

propertyChange

public void propertyChange(PropertyChangeEvent arg0)
Specified by:
propertyChange in interface PropertyChangeListener