root/org.nuxeo.ecm.platform/trunk/nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/tag/handler/GenericHtmlComponentHandler.java

Revision 28612, 2.1 kB (checked in by sfermigier, 4 months ago)

Forward port of [28607], [28609], [28610].

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
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.ValueHolder;
23
24 import org.nuxeo.ecm.platform.ui.web.tag.jsf.GenericValueHolderRule;
25
26 import com.sun.facelets.tag.MetaRuleset;
27 import com.sun.facelets.tag.jsf.ComponentConfig;
28 import com.sun.facelets.tag.jsf.html.HtmlComponentHandler;
29
30 /**
31  * Generic HTML component handler.
32  *
33  * Handler evaluating the "value" attribute as a regular value expression, or
34  * invoking a method expression.
35  *
36  * The method can have parameters and the expression must use parentheses even
37  * if no parameters are needed.
38  *
39  * @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a>
40  *
41  */
42 public class GenericHtmlComponentHandler extends HtmlComponentHandler {
43
44     public GenericHtmlComponentHandler(ComponentConfig config) {
45         super(config);
46         // TODO Auto-generated constructor stub
47     }
48
49     /**
50      * Create meta rule set as regular html component, overriding value holder
51      * rule to use a generic value holder rule.
52      */
53     @Override
54     protected MetaRuleset createMetaRuleset(Class type) {
55         MetaRuleset m = super.createMetaRuleset(type);
56         // alias value so that regular ValueHolder rule does not apply, actually
57         // this is not necessary as last rule added applies.
58         if (ValueHolder.class.isAssignableFrom(type)) {
59             m.alias("value", "genericValue");
60             m.addRule(GenericValueHolderRule.Instance);
61         }
62         return m;
63     }
64
65 }
Note: See TracBrowser for help on using the browser.