001/*
002 * (C) Copyright 2007 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 *
019 * $Id: EditableModelRowEvent.java 28493 2008-01-04 19:51:30Z sfermigier $
020 */
021
022package org.nuxeo.ecm.platform.ui.web.model.impl;
023
024import javax.faces.component.UIComponent;
025import javax.faces.event.FacesEvent;
026import javax.faces.event.FacesListener;
027import javax.faces.event.PhaseId;
028
029/**
030 * EditableModel row event
031 * <p>
032 * Row event wraps the original event to put it in the row context.
033 *
034 * @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a>
035 */
036public class EditableModelRowEvent extends FacesEvent {
037
038    private static final long serialVersionUID = -2537709468370440334L;
039
040    private final FacesEvent event;
041
042    private final Integer key;
043
044    public EditableModelRowEvent(UIComponent source, FacesEvent wrapped, Integer key) {
045        super(source);
046        event = wrapped;
047        this.key = key;
048    }
049
050    @Override
051    public PhaseId getPhaseId() {
052        return event.getPhaseId();
053    }
054
055    @Override
056    public void setPhaseId(PhaseId phaseId) {
057        event.setPhaseId(phaseId);
058    }
059
060    @Override
061    public void processListener(FacesListener listener) {
062        // This event is never delivered to a listener
063        throw new IllegalStateException();
064    }
065
066    @Override
067    public boolean isAppropriateListener(FacesListener listener) {
068        // This event is never delivered to a listener
069        return false;
070    }
071
072    public FacesEvent getEvent() {
073        return event;
074    }
075
076    public Integer getKey() {
077        return key;
078    }
079
080}