| 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.tag.handler; |
|---|
| 21 |
|
|---|
| 22 |
import javax.faces.component.ActionSource; |
|---|
| 23 |
import javax.faces.component.ValueHolder; |
|---|
| 24 |
|
|---|
| 25 |
import org.nuxeo.ecm.platform.ui.web.tag.jsf.MetaActionSourceRule; |
|---|
| 26 |
import org.nuxeo.ecm.platform.ui.web.tag.jsf.MetaValueHolderRule; |
|---|
| 27 |
|
|---|
| 28 |
import com.sun.facelets.tag.MetaRuleset; |
|---|
| 29 |
import com.sun.facelets.tag.jsf.ComponentConfig; |
|---|
| 30 |
import com.sun.facelets.tag.jsf.html.HtmlComponentHandler; |
|---|
| 31 |
|
|---|
| 32 |
/** |
|---|
| 33 |
* Component tag handler that wires a value holder rule attributes to a |
|---|
| 34 |
* {@link MetaValueHolderRule} set. |
|---|
| 35 |
* |
|---|
| 36 |
* @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a> |
|---|
| 37 |
* |
|---|
| 38 |
*/ |
|---|
| 39 |
public class MetaValueHolderTagHandler extends HtmlComponentHandler { |
|---|
| 40 |
|
|---|
| 41 |
public MetaValueHolderTagHandler(ComponentConfig config) { |
|---|
| 42 |
super(config); |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
@Override |
|---|
| 46 |
protected MetaRuleset createMetaRuleset(Class type) { |
|---|
| 47 |
MetaRuleset m = super.createMetaRuleset(type); |
|---|
| 48 |
if (ValueHolder.class.isAssignableFrom(type)) { |
|---|
| 49 |
m.addRule(MetaValueHolderRule.Instance); |
|---|
| 50 |
} |
|---|
| 51 |
return m; |
|---|
| 52 |
} |
|---|
| 53 |
} |
|---|