Each time a JViews
Diagrammer JSF component is created, a corresponding JavaScriptâ„¢ object is also created. You
can access this object through a global JavaScript variable whose
name is the same as the
id
attribute of the tag. For example, the tag:
<jvdf:diagrammerView id="diagrammer" [...] />
will be rendered as the following JavaScript
code:
diagrammer = new IlvDiagrammerViewProxy ('diagrammer', ...);
Note
See the documentation of the Javaâ„¢
API of each renderer to know which JavaScript proxy will be
generated for this component.
You can modify the object locally by using a set of methods
attached to this object. For further information about available
JavaScript objects, see the JavaScript API reference documentation
of JViews Diagrammer.
For example, the following code defines a
button that dynamically installs a zoom interactor on the view
without a server round trip.
<jvf:panInteractor id="pan" <jvf:imageButton [...] onclick="diagrammer.setInteractor(pan)" /> <jvdf:diagrammerView id="diagrammer" [...] />
At rendering time, an IlvDiagrammerViewProxy JavaScript object is
created, accessible through the JavaScript variable. Then, since a
JavaScript object named
pan
has been created in the same way, you can directly set this
interactor with the
setInteractor
method.
Additionally, the behavior of these
JavaScript objects is to keep their state, so that if a submit
request is issued, the state of the object is sent to the server.
This behavior makes sure that the client and the server remain
coherent.
For further information about available JavaScript objects, see the
JavaScript API reference documentation of JViews Diagrammer .