001/*
002 * (C) Copyright 2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Nuxeo - initial API and implementation
016 *
017 * $Id: EditableModelRowEvent.java 28493 2008-01-04 19:51:30Z sfermigier $
018 */
019
020package org.nuxeo.ecm.platform.ui.web.model.impl;
021
022import javax.faces.component.UIComponent;
023import javax.faces.event.FacesEvent;
024import javax.faces.event.FacesListener;
025import javax.faces.event.PhaseId;
026
027/**
028 * EditableModel row event
029 * <p>
030 * Row event wraps the original event to put it in the row context.
031 *
032 * @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a>
033 */
034public class EditableModelRowEvent extends FacesEvent {
035
036    private static final long serialVersionUID = -2537709468370440334L;
037
038    private final FacesEvent event;
039
040    private final Integer key;
041
042    public EditableModelRowEvent(UIComponent source, FacesEvent wrapped, Integer key) {
043        super(source);
044        event = wrapped;
045        this.key = key;
046    }
047
048    @Override
049    public PhaseId getPhaseId() {
050        return event.getPhaseId();
051    }
052
053    @Override
054    public void setPhaseId(PhaseId phaseId) {
055        event.setPhaseId(phaseId);
056    }
057
058    @Override
059    public void processListener(FacesListener listener) {
060        // This event is never delivered to a listener
061        throw new IllegalStateException();
062    }
063
064    @Override
065    public boolean isAppropriateListener(FacesListener listener) {
066        // This event is never delivered to a listener
067        return false;
068    }
069
070    public FacesEvent getEvent() {
071        return event;
072    }
073
074    public Integer getKey() {
075        return key;
076    }
077
078}