D - The diagram type.C - The handled canvas type.public abstract class AbstractCanvasHandler<D extends Diagram,C extends AbstractCanvas> extends Object implements CanvasHandler<D,C>, HasCanvasListeners<CanvasElementListener>
AbstractCanvasHandler, so most of the different IOC resolutions that Stunner requires
on other areas will be, at least, resolved with the default implementations that rely on subtypes
for AbstractCanvasHandler.| Constructor and Description |
|---|
AbstractCanvasHandler() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
addChild(Element parent,
Element child)
This method sets the given
child instance as children for the given
given parent instance. |
HasCanvasListeners<CanvasElementListener> |
addRegistrationListener(CanvasElementListener instance)
Adds a listener instance in order to be notified about graph element structure updates.
|
protected void |
applyElementMutation(Element candidate,
boolean applyPosition,
boolean applyProperties,
MutationContext mutationContext) |
void |
applyElementMutation(Element element,
MutationContext mutationContext)
When an element has been changed, this method produces to update the handler and the canvas
and mutates the shape bind to the given element using new properties and/or values.
|
protected abstract void |
applyElementMutation(Shape shape,
Element candidate,
boolean applyPosition,
boolean applyProperties,
MutationContext mutationContext) |
CanvasHandler<D,C> |
clear()
Clears this handler state and the handled canvas instance.
|
void |
clearCanvas() |
HasCanvasListeners<CanvasElementListener> |
clearRegistrationListeners()
Clears all the registered listeners.
|
void |
deregister(Element element)
Deregisters an element from the graph structure and from the canvas.
|
void |
deregister(Element element,
boolean fireEvents)
De-registers an element from the graph structure and from the canvas.
|
protected abstract void |
deregister(Shape shape,
Element element,
boolean fireEvents) |
void |
destroy()
Destroys this handler state and the handled canvas instance.
|
abstract void |
dock(Element parent,
Element child)
This method sets the given
child instance as docked child for the given
given parent instance. |
protected abstract CanvasHandler<D,C> |
doClear()
Subtypes must clear this instance's state here.
|
protected abstract void |
doDestroy()
Subtypes must destroy this instance's state here.
|
boolean |
equals(Object o) |
AbstractCanvas |
getAbstractCanvas()
Used to avoid forcing specifying the generic for the canvas type
from other beans.
|
abstract DefinitionManager |
getDefinitionManager()
Provides a definition manager instance in this context.
|
abstract GraphCommandExecutionContext |
getGraphExecutionContext()
Should return a graph execution context to perform the model updates applied by the graph command executions.
|
abstract Index<?,?> |
getGraphIndex()
Returns the graph index instance to perform lookups over the graph structure
foe this canvas handler's diagram instance loaded.
|
abstract GraphRulesManager |
getGraphRulesManager()
Provides the graph rules manager instance for this context.
|
abstract ModelRulesManager |
getModelRulesManager()
Provides the graph rules manager instance for this context.
|
protected abstract ShapeFactory<Object,AbstractCanvasHandler,Shape> |
getShapeFactory(String shapeSetId) |
protected String |
getUuid() |
int |
hashCode() |
protected boolean |
isCanvasRoot(Element parent) |
protected void |
notifyCanvasClear()
Notifies a clean canvas to the listeners.
|
void |
notifyCanvasElementAdded(Element candidate)
Notifies an element added to the listeners.
|
void |
notifyCanvasElementRemoved(Element candidate)
Notifies an element removed to the listeners.
|
void |
notifyCanvasElementUpdated(Element candidate)
Notifies an element updated to the listeners.
|
protected abstract void |
register(Shape shape,
Element<View<?>> candidate,
boolean fireEvents) |
void |
register(ShapeFactory<Object,AbstractCanvasHandler,Shape> factory,
Element<View<?>> candidate,
boolean fireEvents)
It does:
- Registers a new graph element into the structure
- Creates the shape for the element to register, using the given shape factory.
|
void |
register(String shapeSetId,
Element<View<?>> candidate)
It does:
- Registers a new graph element into the structure
- Creates the shape for the element to register, using the shape factory provided
for the given
shapeSetId value. |
abstract void |
removeChild(Element parent,
Element child)
This method removes the given
child instance as children for the given
given parent instance. |
HasCanvasListeners<CanvasElementListener> |
removeRegistrationListener(CanvasElementListener instance)
Removes a previously register listener instance.
|
String |
toString() |
abstract void |
undock(Element parent,
Element child)
This method removes the given
child instance as docked child for the given
given parent instance. |
void |
updateElementPosition(Element element,
MutationContext mutationContext)
When an element has been changed, this method produces to update the coordinates for
the shape bind to the given element.
|
void |
updateElementProperties(Element element,
MutationContext mutationContext)
When an element has been changed, this method produces to update the handler and the canvas
and mutates the shape bind to the given element using new properties and/or values.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitdraw, getCanvas, getDiagram, handlepublic abstract DefinitionManager getDefinitionManager()
public abstract GraphRulesManager getGraphRulesManager()
public abstract ModelRulesManager getModelRulesManager()
public abstract Index<?,?> getGraphIndex()
public abstract GraphCommandExecutionContext getGraphExecutionContext()
null or an empty context type.public abstract void addChild(Element parent, Element child)
child instance as children for the given
given parent instance.
It sets the shape for the child instance as child shape for the
parent instance's shape.parent - The parent graph element.child - The graph element to set as child.public abstract void removeChild(Element parent, Element child)
child instance as children for the given
given parent instance.
It removes the shape for the child instance as child shape for the
parent instance's shape.parent - The parent graph element.child - The element to remove as a child from the parent.public abstract void dock(Element parent, Element child)
child instance as docked child for the given
given parent instance.
It sets the shape for the child instance as a docked child shape for the
parent instance's shape.parent - The parent graph element.child - The graph element to set as a docked child.public abstract void undock(Element parent, Element child)
child instance as docked child for the given
given parent instance.
It removes the shape for the child instance as a docked child shape for the
parent instance's shape.parent - The parent graph element.child - The element to remove as a docked child from the parent.protected abstract CanvasHandler<D,C> doClear()
protected abstract void doDestroy()
protected abstract void register(Shape shape, Element<View<?>> candidate, boolean fireEvents)
protected abstract void applyElementMutation(Shape shape, Element candidate, boolean applyPosition, boolean applyProperties, MutationContext mutationContext)
protected abstract ShapeFactory<Object,AbstractCanvasHandler,Shape> getShapeFactory(String shapeSetId)
public void register(String shapeSetId, Element<View<?>> candidate)
shapeSetId value.shapeSetId - The identifier for the ShapeSet to use.candidate - The graph element to register.public void register(ShapeFactory<Object,AbstractCanvasHandler,Shape> factory, Element<View<?>> candidate, boolean fireEvents)
factory - The shape factory to use.candidate - The graph element to register.fireEvents - If canvas and canvas handled registration events must be fired.public void deregister(Element element)
element - The element to deregister and remove from the canvas.public void deregister(Element element, boolean fireEvents)
element - The element to de-register and remove from the canvas.fireEvents - If canvas and canvas handled registration events must be fired.public void applyElementMutation(Element element, MutationContext mutationContext)
element - The element that has been updated.mutationContext - The context for the shape mutations.public void updateElementPosition(Element element, MutationContext mutationContext)
element - The element that has been updated.mutationContext - The context for the shape mutations.public void updateElementProperties(Element element, MutationContext mutationContext)
element - The element that has been updated.mutationContext - The context for the shape mutations.protected void applyElementMutation(Element candidate, boolean applyPosition, boolean applyProperties, MutationContext mutationContext)
public HasCanvasListeners<CanvasElementListener> addRegistrationListener(CanvasElementListener instance)
addRegistrationListener in interface HasCanvasListeners<CanvasElementListener>instance - The listener instance.public HasCanvasListeners<CanvasElementListener> removeRegistrationListener(CanvasElementListener instance)
removeRegistrationListener in interface HasCanvasListeners<CanvasElementListener>instance - The listener instance.public HasCanvasListeners<CanvasElementListener> clearRegistrationListeners()
clearRegistrationListeners in interface HasCanvasListeners<CanvasElementListener>public void notifyCanvasElementRemoved(Element candidate)
public void notifyCanvasElementAdded(Element candidate)
public void notifyCanvasElementUpdated(Element candidate)
protected void notifyCanvasClear()
public void clearCanvas()
public CanvasHandler<D,C> clear()
clear in interface CanvasHandler<D extends Diagram,C extends AbstractCanvas>public void destroy()
destroy in interface CanvasHandler<D extends Diagram,C extends AbstractCanvas>public AbstractCanvas getAbstractCanvas()
protected boolean isCanvasRoot(Element parent)
protected String getUuid()
Copyright © 2001–2017 JBoss by Red Hat. All rights reserved.