This section describes the
interoperability between JViews components and ICEfaces
components. JViews components and ICEfaces components are both
JSF components. They can work together both on the client side
and on the server side.
On the client side, JViews JSF components are high-level
Ajax-enabled JavaScript™ objects. You can direct the behavior of
JViews components by invoking their JavaScript methods. For
example, when you click an ICEfaces button you can update the
contents of a JViews view by calling its JavaScript method:
updateImage()
.
On the server side, both JViews components
and ICEfaces components can be bound to backing beans. This
allows you to exchange parameters and data between the backing
beans of JViews components and ICEfaces components.
The interoperability between JViews and
ICEfaces components can involve both the server side and the
client side.
Run this sample now to understand the
situation better.
The action is initiated on the client side
by clicking a button. However, the task cannot be performed
completely on the client side because there is not enough
information on the selected node. Therefore you have to submit
the request to the server and ask the server to perform more
computation.
Once the backing bean on the server side
has computed the offset to be applied to center the selected node
on the screen, you need to find a way to tell the client-side
JViews components to apply that offset. For this purpose,
ICEfaces provides a way for you to send JavaScript code from the
server to the client. The code is as follows.
com.icesoft.faces.context.effects.JavascriptContext
.addJavascriptCall(FacesContext.getCurrentInstance(),
"diagrammer.moveTo(300, 500);");
The ICEfaces Ajax agent on the client will
evaluate the received JavaScript code in order to scroll the
diagram to the expected position.
For more details, see the
DiagrammerBean.java
file in the same sample.