public class IlvInteractorRenderer extends IlvFilterSDMRenderer
IlvInteractorRenderer
is a filtering renderer that puts an object interactor
on every graphic object representing a node or a link of
the data model.
This class is mostly used as a base class for other renderers that set built-in interactors on nodes and links.
The interactor renderer can also be used as-is. For
this, you must specify the class of the object interactor
that you want to be set on the objects. To do so, you use
the interactor
property or the Interactor
rendering property. For example:
SDM { Interactor : "true"; } Interactor { interactor : "mypackage.MyInteractor"; } node[special="true"] { Interactor : "mypackage.MySpecialInteractor"; }
If the Interactor
rendering property is set to
an empty string, no interactor will be set on the object.
Normally, Perforce JViews never calls object interactors when a view
interactor is active on a manager view. To overcome this, the
interactor renderer provides a "shortcut" mechanism that
propagates certain types of events to the object interactor,
even if a view interactor is active. See acceptShortcut(ilog.views.sdm.IlvSDMEngine, ilog.views.IlvManagerView, java.awt.event.InputEvent)
.
IlvObjectInteractor
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected IlvObjectInteractor |
_interactor
The interactor that this renderer will put
on graphic objects.
|
_renderer
PSEUDOCLASS_PREFIX
Constructor and Description |
---|
IlvInteractorRenderer()
Creates a new interactor renderer with a
null
filtered renderer. |
IlvInteractorRenderer(IlvSDMRenderer renderer)
Creates a new interactor renderer for a specified
filtered renderer.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
acceptInteractor(IlvSDMEngine engine,
Object object,
IlvGraphic graphic)
This method allows subclasses to filter the objects on which the
interactor will be set.
|
protected boolean |
acceptShortcut(IlvSDMEngine engine,
IlvManagerView view,
InputEvent event)
The intent of this method is to allow
the object interactor installed by this renderer to be activated
even if a view interactor is installed on the manager view.
|
protected void |
addViewListeners(IlvManagerView view)
Adds the mouse listeners that handle shortcuts.
|
String |
getInteractor()
Returns the class name of the interactor that will be put on the
graphic objects created by the filtered renderer.
|
String |
getParameter()
This method calls
getInteractor() . |
boolean |
isProcessMouseMoveEvents()
Returns true if MouseMove events are processed as well.
|
static boolean |
isShorcutEnabled()
Deprecated.
Use
isShortcutEnabled() instead |
static boolean |
isShortcutEnabled()
Tests if shortcuts are enabled for all object interactors at once.
|
void |
linkGraphicAdded(IlvSDMEngine engine,
Object link,
IlvGraphic graphic,
boolean redraw)
Sets the object interactor on the link once it has been
added in the grapher.
|
protected boolean |
needsViewListeners()
Returns
true , because this renderer needs to install
mouse listeners on all the views to handle shortcuts. |
void |
nodeGraphicAdded(IlvSDMEngine engine,
Object node,
IlvGraphic graphic,
boolean redraw)
Sets the object interactor on the node once it has been
added in the grapher.
|
void |
propertiesChanged(IlvSDMEngine engine,
Object object,
Collection<String> propertyNames,
IlvGraphic graphic)
Resets the object interactor on the object once it has been
customized.
|
protected void |
removeViewListeners(IlvManagerView view)
Adds the mouse listeners that handle shortcuts.
|
void |
setInteractor(String interactor)
Changes the interactor that will be put on the
graphic objects created by the filtered renderer.
|
void |
setParameter(String parameter)
This method calls
setInteractor(java.lang.String) . |
void |
setProcessMouseMoveEvents(boolean processMouseMoveEvents)
Sets the processMouseMoveEvents to set.
|
static void |
setShorcutEnabled(boolean newValue)
Deprecated.
Use
setShortcutEnabled(boolean) instead |
static void |
setShortcutEnabled(boolean newValue)
Sets if shortcuts are enabled for all interactors at once.
|
addLinkGraphic, addNodeGraphic, computeBBox, createLinkGraphic, createNodeGraphic, customize, getEncapsulatedGraphic, getFilteredRenderer, getGraphicProperty, getLinkConnectionRectangle, moveResizeNodeGraphic, nodeGraphicBBoxChanged, prepareRendering, processServerAction, removeAll, removeLinkGraphic, removeNodeGraphic, renderingDone, setFilteredRenderer, updateObjectProperties
callMoveResizeNodeGraphic, convert, convert, getAlias, getAuxiliaryBean, getAuxiliaryBeans, getEngine, getLinkConnectionRectangle, getLocation, propertyChanged, setAlias, setEngine, setLayerName
protected IlvObjectInteractor _interactor
public IlvInteractorRenderer(IlvSDMRenderer renderer)
renderer
- The filtered renderer.public IlvInteractorRenderer()
null
filtered renderer.public void setInteractor(String interactor)
interactor
- The fully qualified class name of
the new interactor, for example:
"ilog.views.objectinteractor.IlvButtonInteractor"
.public String getInteractor()
public void setParameter(String parameter)
setInteractor(java.lang.String)
. So, you can
simply customize the interactor renderer as follows:
SDM { Interactor : "ilog.views.objectinteractor.IlvButtonInteractor"; }
setParameter
in class IlvSDMRenderer
parameter
- The interactor class name.public String getParameter()
getInteractor()
.getParameter
in class IlvSDMRenderer
setInteractor(java.lang.String)
public void nodeGraphicAdded(IlvSDMEngine engine, Object node, IlvGraphic graphic, boolean redraw)
nodeGraphicAdded
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in which
the graphic object has been added.node
- The node that is being translated into an IlvGraphic
.graphic
- The graphic object returned by createNodeGraphic
.redraw
- If true
, the region covered by the new
graphic object must be redrawn.IlvSDMRenderer.addNodeGraphic(ilog.views.sdm.IlvSDMEngine, java.lang.Object, ilog.views.IlvGraphic, boolean)
public void linkGraphicAdded(IlvSDMEngine engine, Object link, IlvGraphic graphic, boolean redraw)
linkGraphicAdded
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in which
the graphic object has been added.link
- The link that is being translated into an IlvGraphic
.graphic
- The graphic object returned by createLinkGraphic
.redraw
- If true
, the region covered by the new
graphic object must be redrawn.IlvSDMRenderer.addLinkGraphic(ilog.views.sdm.IlvSDMEngine, java.lang.Object, ilog.views.IlvGraphic, boolean)
public void propertiesChanged(IlvSDMEngine engine, Object object, Collection<String> propertyNames, IlvGraphic graphic)
propertiesChanged
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in
which the graphic object is displayed.object
- The data object whose property has changed.propertyNames
- The names of the properties that have been modified.graphic
- The graphic object associated with object
.protected boolean acceptInteractor(IlvSDMEngine engine, Object object, IlvGraphic graphic)
If the method returns true
, the interactor will be
installed on the graphic object representing the specified
data object. Otherwise, no interactor will installed on this
object.
The default implementation always returns true
,
which means that the interactor is installed on all objects.
engine
- The SDM engine.object
- The data object.graphic
- The graphic object.protected boolean needsViewListeners()
true
, because this renderer needs to install
mouse listeners on all the views to handle shortcuts.needsViewListeners
in class IlvSDMRenderer
IlvSDMRenderer.addViewListeners(ilog.views.IlvManagerView)
,
IlvSDMRenderer.removeViewListeners(ilog.views.IlvManagerView)
protected void addViewListeners(IlvManagerView view)
addViewListeners
in class IlvSDMRenderer
view
- The manager view.IlvSDMRenderer.needsViewListeners()
protected void removeViewListeners(IlvManagerView view)
removeViewListeners
in class IlvSDMRenderer
view
- The manager view.IlvSDMRenderer.needsViewListeners()
protected boolean acceptShortcut(IlvSDMEngine engine, IlvManagerView view, InputEvent event)
If a view interactor is installed on the reference view
of the SDM engine, this method is called every time a mouse
or keyboard event occurs in the reference view. If the method
returns true
, the event will be sent to the interactor
of the object where the event occurred. If the method returns
false
, the object interactor is not called.
The default implementation returns true
if the
event is a middle- or right-click.
engine
- The SDM engine attached to the reference view
in which the event occurred.view
- The reference view.event
- The event received by the manager view while
a view interactor was active.@Deprecated public static void setShorcutEnabled(boolean newValue)
setShortcutEnabled(boolean)
insteadnewValue
- Set to true
to enable shortcuts.acceptShortcut(IlvSDMEngine, IlvManagerView, InputEvent)
public static void setShortcutEnabled(boolean newValue)
newValue
- Set to true
to enable shortcuts.acceptShortcut(IlvSDMEngine, IlvManagerView, InputEvent)
@Deprecated public static boolean isShorcutEnabled()
isShortcutEnabled()
insteadtrue
is returned.public static boolean isShortcutEnabled()
true
is returned.public boolean isProcessMouseMoveEvents()
public void setProcessMouseMoveEvents(boolean processMouseMoveEvents)
processMouseMoveEvents
- The processMouseMoveEvents to set© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.