Creating ICEfaces Applications with Eclipse

Table of Contents

Creating ICEfaces Applications with Eclipse

The ICEfaces Eclipse Integration provides ICEfaces support for developers who use the Eclipse IDE for Java EE. The integration allows you to quickly start developing ICEfaces applications. Design view integration allows you to easily work with ICEfaces components.





Development Tools Used

The following tools are used in this tutorial:

Download the Eclipse plugin from http://www.icesoft.org/downloads/icefaces-downloads.jsf under Tools Support -> Eclipse.
Place the zip file in a local directory.



Start Eclipse. From the Eclipse main menu bar, select Help -> Install New Software... -> Add --> Archive...
Select the plugin (zip file) from your local directory, give it a name and click Ok.



Select the checkbox beside ICEfaces Update Site, click Next, accept Licenses and click Finish.



This will require a restart of Eclipse.


Creating an ICEfaces Project

Now that we have the ICEfaces plugin installed, we can create a new project with ICEfaces capabilities.
From the Eclipse main menu bar, select File -> New -> Dynamic Web Project

Type in the Project name and select a Target runtime. For Configuration, select 'ICEfaces 3 Default Project Configuration' and click Next>



In the JSF Capabilities dialog, there is a download button (with the arrow pointing down) available to download the required JSF and ICEfaces jars. Click on the button to launch the Download Library dialog.



Once you click the button you will see a list of selections similar to those in the image below. Libraries have to be downloaded one at a time. To download a library, highlight it and click Next> to accept the license. Finally, click Finish.
The JSF 2 (Mojarra 2.1.3) jars are required.



After the libraries have been downloaded select the libraries you want to include in your project by checking the checkbox beside each library. Click Next>



The next dialog is related to ICEfaces configurations. Accept the defaults and Click Finish:



The new project should show up in Project Explorer:




Running an ICEfaces Project

We have created an ICEfaces/JSF 2 project in above steps. To run the ICEfaces project just created,
Right click on the project in Project Explorer
Select Debug As... -> Debug On Server
Choose Tomcat 7 in Run On Server dialog if you have installed Tomcat 7 locally
After clicking on the Finish button, Eclipse will launch the application in the browser you have selected under Window -> Web Browser:




Adding an ICEfaces Advanced (ACE) Component

The Eclipse Visual JSF Page Designer has been added since Eclipse 3.3 as part of WTP 2.0. The Design Time Canvas provides an intuitive close-to-WYSIWIG editing experience. It allows you to visually manipulate JSF page layout and components using drag and drop.

The ICEfaces plugin includes design time support for ICEfaces ACE Component and ICEfaces ICE Component. This includes the palette view and property view when opening your ICEfaces pages with the Web Page Editor.

To open your page with the Web Page Editor:
Right click on the ICEfaces xhtml page
Select Open With -> Web Page Editor



You can select ICEfaces ACE Components and/or ICEfaces ICE components from the Palette. In this case we select a dateTimeEntry component from the ICEfaces ACE components:
Drag and Drop the component on to the Design Time Canvas. The component will automatically be rendered in the Design Time Canvas:



Create a new Java class file called YourBean in the package org.icefaces.view and paste the code below:

PersonBean.java
package org.icefaces.view;

import java.io.Serializable;
import java.util.Date;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import org.icefaces.ace.event.DateSelectEvent;

@ManagedBean(name= "yourBean")
@ViewScoped
public class YourBean implements Serializable {
	
	private Date selectDateProperty = new Date(System.currentTimeMillis());

	public Date getSelectDateProperty() {
		return selectDateProperty;
	}

	public void setSelectDateProperty(Date selectDateProperty) {
		this.selectDateProperty = selectDateProperty;
	}
	
	public void dateSelectListener(DateSelectEvent event) {
		setSelectDateProperty(event.getDate());
    }
}

This bean model has an instance variable to back the field on our page. The dateSelectListener method will set the instance variable to the value what was submitted, but otherwise the class is simple.

We can now run the application and see the added component rendered out to the browser:




Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

© Copyright 2014 ICEsoft Technologies Canada Corp.