JavaScript objects
Each time a JViews Maps 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:
<jvmf:mapView id="map" [...] />
is rendered as the following JavaScript code:
map = new IlvDiagrammerViewProxy ('map', ...);
map.setServletClass("ilog.views.maps.servlet.IlvFacesMapsServlet");
See the documentation of the Java™ API (
overview-summary) of each renderer to know which JavaScript proxy is 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 reference documentation of JViews Maps.
The following example defines a button that dynamically installs a zoom interactor on the view without a server round trip.
Defining a dynamic zoom interactor button
<jvf:panInteractor id="pan"
<jvf:imageButton [...] onclick="map.setInteractor(pan)" />
<jvmf:mapView id="map" [...] />
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 Maps.
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.