001: /*
002: * Version: MPL 1.1/GPL 2.0/LGPL 2.1
003: *
004: * "The contents of this file are subject to the Mozilla Public License
005: * Version 1.1 (the "License"); you may not use this file except in
006: * compliance with the License. You may obtain a copy of the License at
007: * http://www.mozilla.org/MPL/
008: *
009: * Software distributed under the License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
011: * License for the specific language governing rights and limitations under
012: * the License.
013: *
014: * The Original Code is ICEfaces 1.5 open source software code, released
015: * November 5, 2006. The Initial Developer of the Original Code is ICEsoft
016: * Technologies Canada, Corp. Portions created by ICEsoft are Copyright (C)
017: * 2004-2006 ICEsoft Technologies Canada, Corp. All Rights Reserved.
018: *
019: * Contributor(s): _____________________.
020: *
021: * Alternatively, the contents of this file may be used under the terms of
022: * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"
023: * License), in which case the provisions of the LGPL License are
024: * applicable instead of those above. If you wish to allow use of your
025: * version of this file only under the terms of the LGPL License and not to
026: * allow others to use your version of this file under the MPL, indicate
027: * your decision by deleting the provisions above and replace them with
028: * the notice and other provisions required by the LGPL License. If you do
029: * not delete the provisions above, a recipient may use your version of
030: * this file under either the MPL or the LGPL License."
031: *
032: */
033:
034: package com.icesoft.faces.component.panelpositioned;
035:
036: import javax.faces.component.UIComponent;
037: import javax.faces.el.MethodBinding;
038: import javax.faces.event.FacesEvent;
039: import javax.faces.event.FacesListener;
040: import javax.faces.event.PhaseId;
041: import java.util.List;
042:
043: /**
044: * Event fired by positioned panel events
045: */
046: public class PanelPositionedEvent extends FacesEvent {
047:
048: private MethodBinding listener;
049: private int index;
050: private int oldIndex = -1;
051: private int type;
052: private List oldList;
053: private List newList;
054:
055: public static int TYPE_ADD = 1;
056: public static int TYPE_REMOVE = 2;
057: public static int TYPE_MOVE = 3;
058: private PhaseId phaseId = PhaseId.UPDATE_MODEL_VALUES;
059:
060: public PanelPositionedEvent(UIComponent uiComponent,
061: MethodBinding listener, int eventType, int index,
062: int oldIndex, List oldList, List newList) {
063: super (uiComponent);
064: this .listener = listener;
065: this .type = eventType;
066: this .index = index;
067: this .oldIndex = oldIndex;
068: this .oldList = oldList;
069: this .newList = newList;
070:
071: }
072:
073: public PhaseId getPhaseId() {
074: return phaseId;
075: }
076:
077: public void setPhaseId(PhaseId phaseId) {
078: this .phaseId = phaseId;
079: }
080:
081: public boolean isAppropriateListener(FacesListener facesListener) {
082: return false;
083: }
084:
085: public void processListener(FacesListener facesListener) {
086:
087: }
088:
089: public void process() {
090:
091: oldList.clear();
092: oldList.addAll(newList);
093: }
094:
095: public MethodBinding getListener() {
096: return listener;
097: }
098:
099: public void setListener(MethodBinding listener) {
100: this .listener = listener;
101: }
102:
103: /**
104: * Index added, removed or changed
105: *
106: * @return int index
107: */
108: public int getIndex() {
109: return index;
110: }
111:
112: public void setIndex(int index) {
113: this .index = index;
114: }
115:
116: /**
117: * The other index when the event type is MOVE. Otherwise its -1.
118: *
119: * @return int oldIndex
120: */
121: public int getOldIndex() {
122: return oldIndex;
123: }
124:
125: public void setOldIndex(int oldIndex) {
126: this .oldIndex = oldIndex;
127: }
128:
129: /**
130: * Type of event cna be Added, Removed or changed
131: *
132: * @return int type
133: */
134: public int getType() {
135: return type;
136: }
137:
138: public void setType(int type) {
139: this.type = type;
140: }
141: }
|