/* * Version: MPL 1.1 * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations under * the License. * * The Original Code is ICEfaces 1.5 open source software code, released * November 5, 2006. The Initial Developer of the Original Code is ICEsoft * Technologies Canada, Corp. Portions created by ICEsoft are Copyright (C) * 2004-2011 ICEsoft Technologies Canada, Corp. All Rights Reserved. * * Contributor(s): _____________________. */ package org.icefaces.dialog; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import java.io.Serializable; import java.util.ArrayList; import javax.faces.event.AjaxBehaviorEvent; import org.icefaces.ace.event.CloseEvent; @ManagedBean @SessionScoped public class AjaxTestBean implements Serializable { public AjaxTestBean() { itemList = new ArrayList(); itemList.add(new Item("Item A1", "Item A2")); itemList.add(new Item("Item B1", "Item B2")); itemList.add(new Item("Item C1", "Item C2")); itemList.add(new Item("Item D1", "Item D2")); } private int valueA = 0; private int valueB = 0; private int valueC = 0; private int ajaxEventCtr = 0; private String execute = "@all"; private String render = "@all"; private String statusMsg = ""; private String text = "init"; public int getValueA() { return valueA; } public void setValueA(int value) { valueA++; } public int getValueB() { return valueB; } public void setValueB(int value) { valueB++; valueC++; } public int getValueC() { return valueC; } public void setValueC(int value) { valueC++; } public String getStatusMsg() { return statusMsg; } public void setStatusMsg(String value) { statusMsg = value; } /*public void ajaxEventListener(AjaxBehaviorEvent event) { if (event != null) { statusMsg = "AjaxBehaviorEvent received! (#" + ++ajaxEventCtr+")"; } else { statusMsg = "FAIL! - Null AjaxBehaviorEvent received!"; } }*/ public void closeEventListener(CloseEvent event) { System.out.println("AjaxTestBean.closeEventListener"); if (event != null) { statusMsg = "CloseEvent received! (#" + ++ajaxEventCtr+")"; } else { statusMsg = "FAIL! - Null CloseEvent received!"; } } public void closeEventListener(AjaxBehaviorEvent event) { System.out.println("AjaxTestBean.closeEventListener"); } public String getExecute() { return execute; } public void setExecute(String value) { execute = value; } public String getRender() { return render; } public void setRender(String value) { render = value; } public void clear() { valueA = 0; valueB = 0; valueC = 0; statusMsg = ""; ajaxEventCtr = 0; } private ArrayList itemList; public ArrayList getItemList() { return itemList; } public void setItemList(ArrayList itemList) { this.itemList = itemList; } public String getText() { System.out.println("AjaxTestBean.getText"); System.out.println("text = " + text); return text; } public void setText(String text) { System.out.println("AjaxTestBean.setText"); System.out.println("text = " + text); this.text = text; } public class Item implements Serializable { private String itemOne; private String itemTwo; public Item(String itemOne, String itemTwo) { this.itemOne = itemOne; this.itemTwo = itemTwo; } public String getItemOne() { return itemOne; } public void setItemOne(String itemOne) { this.itemOne = itemOne; } public String getItemTwo() { return itemTwo; } public void setItemTwo(String itemTwo) { this.itemTwo = itemTwo; } } }