net.officefloor.eclipse.common.editparts
Class AbstractOfficeFloorEditPart<M extends Model,E extends Enum<E>,F extends OfficeFloorFigure>

java.lang.Object
  extended by org.eclipse.gef.editparts.AbstractEditPart
      extended by org.eclipse.gef.editparts.AbstractGraphicalEditPart
          extended by net.officefloor.eclipse.common.editparts.AbstractOfficeFloorEditPart<M,E,F>
All Implemented Interfaces:
PropertyChangeListener, EventListener, org.eclipse.core.runtime.IAdaptable, org.eclipse.gef.EditPart, org.eclipse.gef.GraphicalEditPart, org.eclipse.gef.NodeEditPart, org.eclipse.gef.RequestConstants
Direct Known Subclasses:
AbstractOfficeFloorDiagramEditPart, AdministratorEditPart, DeployedOfficeEditPart, DeployedOfficeInputEditPart, DeployedOfficeObjectEditPart, DeployedOfficeTeamEditPart, DeskManagedObjectDependencyEditPart, DeskManagedObjectEditPart, DeskManagedObjectSourceEditPart, DeskManagedObjectSourceFlowEditPart, DutyEditPart, ExistingItemEditPart, ExistingModelEditPart, ExternalFlowEditPart, ExternalFlowEditPart, ExternalManagedObjectEditPart, ExternalManagedObjectEditPart, ExternalManagedObjectEditPart, OfficeEscalationEditPart, OfficeFloorInputManagedObjectEditPart, OfficeFloorManagedObjectDependencyEditPart, OfficeFloorManagedObjectEditPart, OfficeFloorManagedObjectSourceEditPart, OfficeFloorManagedObjectSourceFlowEditPart, OfficeFloorManagedObjectSourceInputDependencyEditPart, OfficeFloorManagedObjectSourceTeamEditPart, OfficeFloorTeamEditPart, OfficeInputManagedObjectDependencyEditPart, OfficeManagedObjectDependencyEditPart, OfficeManagedObjectEditPart, OfficeManagedObjectSourceEditPart, OfficeManagedObjectSourceFlowEditPart, OfficeManagedObjectSourceTeamEditPart, OfficeSectionEditPart, OfficeSectionInputEditPart, OfficeSectionObjectEditPart, OfficeSectionOutputEditPart, OfficeSectionResponsibilityEditPart, OfficeStartEditPart, OfficeSubSectionEditPart, OfficeTaskEditPart, OfficeTeamEditPart, SectionManagedObjectDependencyEditPart, SectionManagedObjectEditPart, SectionManagedObjectSourceEditPart, SectionManagedObjectSourceFlowEditPart, SubSectionEditPart, SubSectionInputEditPart, SubSectionObjectEditPart, SubSectionOutputEditPart, TargetItemEditPart, TargetModelEditPart, TaskAdministrationJoinPointEditPart, TaskEditPart, TaskEscalationEditPart, TaskFlowEditPart, WorkEditPart, WorkTaskEditPart, WorkTaskObjectEditPart

public abstract class AbstractOfficeFloorEditPart<M extends Model,E extends Enum<E>,F extends OfficeFloorFigure>
extends org.eclipse.gef.editparts.AbstractGraphicalEditPart
implements PropertyChangeListener, org.eclipse.gef.NodeEditPart

Abstract EditPart for the Office.

This provides the implementation of a NodeEditPart but does not implement the interface. Subclasses may therefore choose to implement the interface if it requires this functionality.

Author:
Daniel Sagenschneider

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 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
AbstractOfficeFloorEditPart()
           
 
Method Summary
 void activate()
           
 BeanDialog createBeanDialog(Object bean, String... ignoreProperties)
          Creates the BeanDialog for the input bean.
protected  void createEditPolicies()
           
protected  org.eclipse.draw2d.IFigure createFigure()
           
protected abstract  F createOfficeFloorFigure()
          Creates the OfficeFloorFigure for this EditPart.
 void deactivate()
           
protected  void executeCommand(OfficeFloorCommand command)
          Executes the input Command.
 M getCastedModel()
          Obtains the model casted to its specific type.
 org.eclipse.draw2d.IFigure getContentPane()
           
 AbstractOfficeFloorEditor<?,?> getEditor()
          Obtains the Editor for this.
protected  List<?> getModelChildren()
           
protected  List<?> getModelSourceConnections()
           
protected  List<?> getModelTargetConnections()
           
 F getOfficeFloorFigure()
           Obtains the OfficeFloorFigure for this EditPart.
protected abstract  Class<E> getPropertyChangeEventType()
          Obtains the Enum type for the property change events.
 org.eclipse.gef.RootEditPart getRoot()
           
 org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection)
           
 org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.Request request)
           
 org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection)
           
 org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.Request request)
           
protected abstract  void handlePropertyChange(E property, PropertyChangeEvent evt)
          Handles the PropertyChangeEvent.
protected  void init()
          Sub classes may override this method to initialise various state.
protected  boolean isFreeformFigure()
           Override to indicate that IFigure needs a FreeformWrapperFigure.
 void messageError(org.eclipse.core.runtime.IStatus status)
          Displays the IStatus error.
 void messageError(String message)
          Displays the message as an error MessageDialog.
 void messageError(String message, Throwable cause)
          Displays the message and its cause as an error MessageDialog.
 void messageError(Throwable error)
          Displays the Throwable error details as an error MessageDialog.
 void messageWarning(String message)
          Displays the message as a warning MessageDialog.
 void performRequest(org.eclipse.gef.Request req)
           
protected  void populateConnectionSourceModels(List<Object> models)
          Populates the Models that are sources of connections.
protected  void populateConnectionTargetModels(List<Object> models)
          Populates the Models that are targets of connections.
protected  void populateModelChildren(List<Object> childModels)
          Override to populate the children of this model.
protected  void populateOfficeFloorDirectEditPolicy(OfficeFloorDirectEditPolicy<M> policy)
          Sub classes may override to populate the OfficeFloorDirectEditPolicy.
protected  void populateOfficeFloorOpenEditPolicy(OfficeFloorOpenEditPolicy<M> policy)
          Sub classes may override to populate the OfficeFloorOpenEditPolicy.
 void propertyChange(PropertyChangeEvent evt)
           
protected  void refreshVisuals()
          Refresh the visuals.
 void setLocation(org.eclipse.draw2d.geometry.Point location)
           Specifies the location for the figure.
 void setModel(Object model)
           
 void setOfficeFloorEditor(AbstractOfficeFloorEditor<?,?> editor)
          Specifies the AbstractOfficeFloorEditor that contains this EditPart.
 
Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
addChildVisual, addNodeListener, addNotify, addSourceConnection, addTargetConnection, createConnection, createOrFindConnection, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, getAdapter, getDragTracker, getFigure, getLayer, getSourceConnections, getTargetConnections, isSelectable, 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, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, refreshChildren, register, registerAccessibility, registerModel, removeChild, removeEditPartListener, removeEditPolicy, setFlag, setFocus, 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, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, refresh, removeEditPartListener, removeEditPolicy, removeNotify, setFocus, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Constructor Detail

AbstractOfficeFloorEditPart

public AbstractOfficeFloorEditPart()
Method Detail

setOfficeFloorEditor

public void setOfficeFloorEditor(AbstractOfficeFloorEditor<?,?> editor)
Specifies the AbstractOfficeFloorEditor that contains this EditPart.

Parameters:
editor - Editor containing this.

getEditor

public AbstractOfficeFloorEditor<?,?> getEditor()
Obtains the Editor for this.

Returns:
Editor for this.

setLocation

public void setLocation(org.eclipse.draw2d.geometry.Point location)

Specifies the location for the figure.

This is utilised by MovePositionalModelCommand.

Parameters:
location - Location for the figure.

createBeanDialog

public BeanDialog createBeanDialog(Object bean,
                                   String... ignoreProperties)
Creates the BeanDialog for the input bean.

Parameters:
bean - Bean.
ignoreProperties - Properties to not be populated.
Returns:
BeanDialog for the bean.

messageError

public void messageError(String message)
Displays the message as an error MessageDialog.

Parameters:
message - Error message.

messageError

public void messageError(Throwable error)
Displays the Throwable error details as an error MessageDialog.

Parameters:
error - Error.

messageError

public void messageError(String message,
                         Throwable cause)
Displays the message and its cause as an error MessageDialog.

Parameters:
message - Error message.
cause - Cause of error.

messageError

public void messageError(org.eclipse.core.runtime.IStatus status)
Displays the IStatus error.

Parameters:
status - IStatus error.

messageWarning

public void messageWarning(String message)
Displays the message as a warning MessageDialog.

Parameters:
message - Warning message

propertyChange

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

getPropertyChangeEventType

protected abstract Class<E> getPropertyChangeEventType()
Obtains the Enum type for the property change events.

Returns:
Enum type for the property change events.

handlePropertyChange

protected abstract void handlePropertyChange(E property,
                                             PropertyChangeEvent evt)
Handles the PropertyChangeEvent.

Parameters:
property - Enum property change event.
evt - PropertyChangeEvent.

getRoot

public org.eclipse.gef.RootEditPart getRoot()
Specified by:
getRoot in interface org.eclipse.gef.EditPart
Overrides:
getRoot in class org.eclipse.gef.editparts.AbstractEditPart

createEditPolicies

protected void createEditPolicies()
Specified by:
createEditPolicies in class org.eclipse.gef.editparts.AbstractEditPart

populateOfficeFloorDirectEditPolicy

protected void populateOfficeFloorDirectEditPolicy(OfficeFloorDirectEditPolicy<M> policy)
Sub classes may override to populate the OfficeFloorDirectEditPolicy.

Parameters:
policy - OfficeFloorDirectEditPolicy to populate.

populateOfficeFloorOpenEditPolicy

protected void populateOfficeFloorOpenEditPolicy(OfficeFloorOpenEditPolicy<M> policy)
Sub classes may override to populate the OfficeFloorOpenEditPolicy.

Parameters:
policy - OfficeFloorOpenEditPolicy to populate.

init

protected void init()
Sub classes may override this method to initialise various state.


setModel

public void setModel(Object model)
Specified by:
setModel in interface org.eclipse.gef.EditPart
Overrides:
setModel in class org.eclipse.gef.editparts.AbstractEditPart

createFigure

protected org.eclipse.draw2d.IFigure createFigure()
Specified by:
createFigure in class org.eclipse.gef.editparts.AbstractGraphicalEditPart

getOfficeFloorFigure

public F getOfficeFloorFigure()

Obtains the OfficeFloorFigure for this EditPart.

This will lazy create the OfficeFloorFigure.

Returns:
OfficeFloorFigure.

isFreeformFigure

protected boolean isFreeformFigure()

Override to indicate that IFigure needs a FreeformWrapperFigure.

By default this will return true only if the parent EditPart is a AbstractOfficeFloorDiagramEditPart. Typically this default behaviour will cover most scenarios.

Returns:
true if IFigure needs a FreeformWrapperFigure.

createOfficeFloorFigure

protected abstract F createOfficeFloorFigure()
Creates the OfficeFloorFigure for this EditPart.

Returns:
OfficeFloorFigure.

getContentPane

public org.eclipse.draw2d.IFigure getContentPane()
Specified by:
getContentPane in interface org.eclipse.gef.GraphicalEditPart
Overrides:
getContentPane in class org.eclipse.gef.editparts.AbstractGraphicalEditPart

getModelChildren

protected List<?> getModelChildren()
Overrides:
getModelChildren in class org.eclipse.gef.editparts.AbstractEditPart

populateModelChildren

protected void populateModelChildren(List<Object> childModels)
Override to populate the children of this model.

Parameters:
childModels - List to be populated with the children models.

getModelSourceConnections

protected List<?> getModelSourceConnections()
Overrides:
getModelSourceConnections in class org.eclipse.gef.editparts.AbstractGraphicalEditPart

populateConnectionSourceModels

protected void populateConnectionSourceModels(List<Object> models)
Populates the Models that are sources of connections.

Parameters:
models - List to be populated with Models that are the sources of connections.

getModelTargetConnections

protected List<?> getModelTargetConnections()
Overrides:
getModelTargetConnections in class org.eclipse.gef.editparts.AbstractGraphicalEditPart

populateConnectionTargetModels

protected void populateConnectionTargetModels(List<Object> models)
Populates the Models that are targets of connections.

Parameters:
models - List to be populated with Models that are the targets of connections.

refreshVisuals

protected void refreshVisuals()
Refresh the visuals.

Overrides:
refreshVisuals in class org.eclipse.gef.editparts.AbstractEditPart

getCastedModel

public M getCastedModel()
Obtains the model casted to its specific type.

Returns:
Model casted to its specific type.

executeCommand

protected void executeCommand(OfficeFloorCommand command)
Executes the input Command.

Parameters:
command - Command.

performRequest

public void performRequest(org.eclipse.gef.Request req)
Specified by:
performRequest in interface org.eclipse.gef.EditPart
Overrides:
performRequest in class org.eclipse.gef.editparts.AbstractEditPart

activate

public void activate()
Specified by:
activate in interface org.eclipse.gef.EditPart
Overrides:
activate in class org.eclipse.gef.editparts.AbstractGraphicalEditPart

deactivate

public void deactivate()
Specified by:
deactivate in interface org.eclipse.gef.EditPart
Overrides:
deactivate in class org.eclipse.gef.editparts.AbstractGraphicalEditPart

getSourceConnectionAnchor

public org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection)
Specified by:
getSourceConnectionAnchor in interface org.eclipse.gef.NodeEditPart

getSourceConnectionAnchor

public org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.Request request)
Specified by:
getSourceConnectionAnchor in interface org.eclipse.gef.NodeEditPart

getTargetConnectionAnchor

public org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection)
Specified by:
getTargetConnectionAnchor in interface org.eclipse.gef.NodeEditPart

getTargetConnectionAnchor

public org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.Request request)
Specified by:
getTargetConnectionAnchor in interface org.eclipse.gef.NodeEditPart


Copyright © 2005-2013. All Rights Reserved.