Using JViews components with ICEfaces

Settings for using JViews components in ICEfaces

This section describes the settings you need to use JViews JSF components with ICEfaces.You are assumed to be familiar with Web application development using JSF technologies. You need to have JViews 8.5 or above and ICEfaces 1.7.2 or above installed. You can go to http://www.icefaces.org to download a more recent version of ICEfaces. If you use Eclipse® , ICEfaces also has a plug-in for this environment.
Since JViews 8.5, JViews JSF components support ICEfaces completely. JViews requires the standard request mode of ICEfaces. This is the mode in which ICEfaces interoperates with third-party components. To set this mode, you need to add the following element to the web.xml file of your Web application.
<context-param>
   <param-name>com.icesoft.faces.standardRequestScope</param-name>
   <param-value>true</param-value>
</context-param>
For other settings required by JViews JSF components, see Required settings.
For more settings and concrete examples, look at the sample installed in <installdir> /samples/faces/jsf-tgo-ice.

Interoperability between JViews components and ICEfaces components

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.
Suppose that you have a diagram view showing a number of nodes and links. You want to display a particular node and center it on the screen when you click an ICEfaces button. This use case is shown in the code example at <installdir> /../jviews-diagrammer89/codefragments/jsf-diagrammer-ice/srchtml/diagrammer.jsp.html
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.

Push updates to JViews components

This section describes the techniques for push updates (server-initiated rendering) with JViews components. One of the interesting features of ICEfaces is its server-initiated rendering. This technique allows push updates to components rendered by Web browsers. This topic explains how to make push updates to JViews components.
JViews components are Ajax-enabled components and their contents are generally GIF or PNG images generated by JViews server-side servlet supports. There is no way to push images directly to JViews components.
ICEfaces is able to push things such as HTML fragments and JavaScript code but not images. However, you can use the ICEfaces push mechanism to notify client-side JViews components that updates are available on the server. Then the JViews components can use the Ajax mechanism to get the updated images. This approach is quite efficient in terms of network traffic.
To notify client-side JViews components, you can use the ICEfaces server-initiated rendering technique to push JavaScript code. The ICEfaces Ajax agent will receive and evaluate the code. For example, you can put something like the following in JavaScript code:
<script type="text/javascript">diagrammer.updateImage();</script>
This code tells a JViews diagram component to update its contents.
For tips and tricks on how to push JViews components, look at the push example installed with JViews TGO in <installdir> /../jviews-diagrammer89/codefragments/jsf-diagrammer-ice.

ICEfaces software in JViews

This section describes the ICEfaces binary files provided with JViews and lists the known issues.

ICEfaces binary files provided with JViews

ICEfaces binary files are included in the JViews distribution so that the integration code samples can run out-of-the-box. ICEfaces jar files can be found under /lib/external . However, the full ICEfaces distribution is not included.
To get a complete or more updated distribution, you can get ICEfaces under the Mozilla® Open Source License 1.1. ICEfaces source code is available at http://www.icefaces.org. A copy of the Mozilla Open Source License 1.1 is available there or at http://www.mozilla.org/MPL/MPL-1.1.htm.

Known ICEfaces issues

The following issue exists when using ICEfaces components with JViews components:
  • ICEfaces is not able to parse JViews component <jvf:view> in JSP mode probably because it confuses this tag with <f:view> , although they are in different namespaces. A workaround has been found. See the Graphic Framework example and the iview.tld file in the code example installed in <installdir> /../jviews-diagrammer89/codefragments/jsf-diagrammer-ice.