| 1 |
/* |
|---|
| 2 |
* (C) Copyright 2007 Nuxeo SAS (http://nuxeo.com/) and contributors. |
|---|
| 3 |
* |
|---|
| 4 |
* All rights reserved. This program and the accompanying materials |
|---|
| 5 |
* are made available under the terms of the GNU Lesser General Public License |
|---|
| 6 |
* (LGPL) version 2.1 which accompanies this distribution, and is available at |
|---|
| 7 |
* http://www.gnu.org/licenses/lgpl.html |
|---|
| 8 |
* |
|---|
| 9 |
* This library is distributed in the hope that it will be useful, |
|---|
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 12 |
* Lesser General Public License for more details. |
|---|
| 13 |
* |
|---|
| 14 |
* Contributors: |
|---|
| 15 |
* Nuxeo - initial API and implementation |
|---|
| 16 |
* |
|---|
| 17 |
* $Id$ |
|---|
| 18 |
*/ |
|---|
| 19 |
|
|---|
| 20 |
package org.nuxeo.ecm.platform.ui.web.binding; |
|---|
| 21 |
|
|---|
| 22 |
import java.io.Serializable; |
|---|
| 23 |
|
|---|
| 24 |
import javax.faces.context.FacesContext; |
|---|
| 25 |
import javax.faces.el.MethodBinding; |
|---|
| 26 |
|
|---|
| 27 |
/** |
|---|
| 28 |
* Simple action method binding for method evaluations already resolved to a |
|---|
| 29 |
* String. |
|---|
| 30 |
* |
|---|
| 31 |
* @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a> |
|---|
| 32 |
* |
|---|
| 33 |
*/ |
|---|
| 34 |
public class ActionMethodBinding extends MethodBinding implements Serializable { |
|---|
| 35 |
|
|---|
| 36 |
private static final long serialVersionUID = 36959684012420323L; |
|---|
| 37 |
|
|---|
| 38 |
private final String result; |
|---|
| 39 |
|
|---|
| 40 |
public ActionMethodBinding(String result) { |
|---|
| 41 |
this.result = result; |
|---|
| 42 |
} |
|---|
| 43 |
|
|---|
| 44 |
@Override |
|---|
| 45 |
public Object invoke(FacesContext context, Object[] params) { |
|---|
| 46 |
return result; |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|
| 49 |
@Override |
|---|
| 50 |
public String getExpressionString() { |
|---|
| 51 |
return result; |
|---|
| 52 |
} |
|---|
| 53 |
|
|---|
| 54 |
@Override |
|---|
| 55 |
public Class getType(FacesContext context) { |
|---|
| 56 |
return String.class; |
|---|
| 57 |
} |
|---|
| 58 |
|
|---|
| 59 |
} |
|---|