Author: nbelaevski
Date: 2010-01-28 14:07:27 -0500 (Thu, 28 Jan 2010)
New Revision: 16377
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ImportAttributes.java
root/cdk/trunk/plugins/generator/src/test/resources/META-INF/cdk/attributes/dummy-template-props.xml
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy-attributes.xml
Modified:
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/attributes/AttributesTest.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/ELNodeConstants.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/StringUtils.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/node/AstLiteralTreeNode.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/node/AstStringTreeNode.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd
root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessor.groovy
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml
root/framework/trunk/commons/src/main/java/org/richfaces/renderkit/ComponentAttribute.java
root/framework/trunk/commons/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/RenderKitUtilsTest.java
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/button.template.xml
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/link.template.xml
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml
Log:
https://jira.jboss.org/jira/browse/RF-8309
https://jira.jboss.org/jira/browse/RF-8325
https://jira.jboss.org/jira/browse/RF-7732
Modified:
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java
===================================================================
---
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java 2010-01-28
19:07:27 UTC (rev 16377)
@@ -61,6 +61,8 @@
private String defaultValue;
+ private String componentAttributeName;
+
private Kind kind = Kind.GENERIC;
public Attribute() {
@@ -137,6 +139,21 @@
this.kind = kind;
}
+ /**
+ * @return the componentAttributeName
+ */
+ @XmlElement(name = "component-attribute-name")
+ public String getComponentAttributeName() {
+ return componentAttributeName;
+ }
+
+ /**
+ * @param componentAttributeName the componentAttributeName to set
+ */
+ public void setComponentAttributeName(String componentAttributeName) {
+ this.componentAttributeName = componentAttributeName;
+ }
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
Modified:
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/attributes/AttributesTest.java
===================================================================
---
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/attributes/AttributesTest.java 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/attributes/AttributesTest.java 2010-01-28
19:07:27 UTC (rev 16377)
@@ -94,6 +94,10 @@
Attribute dirAttribute = new Attribute("dir");
dirAttribute.setDefaultValue("ltr");
imgElement.addAttribute(dirAttribute);
+
+ Attribute classAttribute = new Attribute("class");
+ classAttribute.setComponentAttributeName("styleClass");
+ imgElement.addAttribute(classAttribute);
}
public void tearDown() {
@@ -155,5 +159,10 @@
assertNotNull(restoredDirAttribute);
assertEquals("dir", restoredDirAttribute.getName());
assertEquals("ltr", restoredDirAttribute.getDefaultValue());
+
+ Attribute restoredClassAttribute = restoredImgAttributes.get("class");
+ assertNotNull(restoredClassAttribute);
+ assertEquals("class", restoredClassAttribute.getName());
+ assertEquals("styleClass",
restoredClassAttribute.getComponentAttributeName());
}
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/ELNodeConstants.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/ELNodeConstants.java 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/ELNodeConstants.java 2010-01-28
19:07:27 UTC (rev 16377)
@@ -56,7 +56,6 @@
public static final String LEFT_SQUARE_BRACKET = "[";
public static final String NEGATIVE = "-";
public static final String QUESTION_SIGN = " ? ";
- public static final String QUOTE = "\"";
public static final String RIGHT_BRACKET = ")";
public static final String RIGHT_SQUARE_BRACKET = "]";
public static final String THIS_PREFIX = "this";
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/StringUtils.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/StringUtils.java 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/StringUtils.java 2010-01-28
19:07:27 UTC (rev 16377)
@@ -53,6 +53,7 @@
public static String getEscapedString(String s) {
StringBuilder result = new StringBuilder();
+ result.append('"');
char[] chars = s.toCharArray();
@@ -80,9 +81,29 @@
}
}
+ result.append('"');
+
return result.toString();
}
+ public static String getEscapedStringsArray(String... strings) {
+ StringBuilder sb = new StringBuilder();
+
+ for (String string : strings) {
+ if (sb.length() > 0) {
+ sb.append(", ");
+ }
+
+ sb.append(getEscapedString(string));
+ }
+
+ return sb.toString();
+ }
+
+ public static boolean isEmpty(String s) {
+ return s == null || s.length() == 0;
+ }
+
/**
* Returns true if the char isalpha() or isdigit().
*/
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/node/AstLiteralTreeNode.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/node/AstLiteralTreeNode.java 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/node/AstLiteralTreeNode.java 2010-01-28
19:07:27 UTC (rev 16377)
@@ -26,7 +26,6 @@
import java.util.Map;
import org.jboss.el.parser.Node;
-import org.richfaces.cdk.parser.el.ELNodeConstants;
import org.richfaces.cdk.parser.el.ELVisitor;
import org.richfaces.cdk.parser.el.ParsingException;
import org.richfaces.cdk.parser.el.StringUtils;
@@ -47,9 +46,7 @@
@Override
public void visit(StringBuilder sb, Map<String, Type> context, ELVisitor
visitor) throws ParsingException {
if (getNode().getImage() != null) {
- sb.append(ELNodeConstants.QUOTE);
sb.append(StringUtils.getEscapedString(getNode().getImage()));
- sb.append(ELNodeConstants.QUOTE);
visitor.setVariableType(TypesFactory.getType(String.class));
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/node/AstStringTreeNode.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/node/AstStringTreeNode.java 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/node/AstStringTreeNode.java 2010-01-28
19:07:27 UTC (rev 16377)
@@ -27,7 +27,6 @@
import org.jboss.el.parser.AstString;
import org.jboss.el.parser.Node;
-import org.richfaces.cdk.parser.el.ELNodeConstants;
import org.richfaces.cdk.parser.el.ELVisitor;
import org.richfaces.cdk.parser.el.ParsingException;
import org.richfaces.cdk.parser.el.StringUtils;
@@ -47,9 +46,7 @@
@Override
public void visit(StringBuilder sb, Map<String, Type> context, ELVisitor
visitor) throws ParsingException {
- sb.append(ELNodeConstants.QUOTE);
sb.append(StringUtils.getEscapedString(((AstString) getNode()).getString()));
- sb.append(ELNodeConstants.QUOTE);
visitor.setVariableType(TypesFactory.getType(String.class));
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-01-28
19:07:27 UTC (rev 16377)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
@@ -32,7 +33,6 @@
import java.util.Set;
import java.util.TreeMap;
-import javax.annotation.Generated;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
@@ -143,7 +143,7 @@
this.compositeInterface = compositeInterface;
this.classLoader = classLoader;
- //TODO - cache unmarshalled data
+ // TODO - cache unmarshalled data (as CDKWorker?)
SchemaSet schemaSet =
jaxbBinding.unmarshal("urn:attributes:xhtml-el.xml", null, SchemaSet.class);
this.attributesSchema = schemaSet.getSchemas().get(Template.XHTML_EL_NAMESPACE);
}
@@ -157,9 +157,10 @@
this.generatedClass.addImport(ResponseWriter.class);
this.generatedClass.addImport(UIComponent.class);
- this.generatedClass.addAnnotation(Generated.class, "\"RichFaces
CDK\"");
+ // TODO - make this JavaDoc - Generated annotation is present since JDK6
+ // this.generatedClass.addAnnotation(Generated.class, "\"RichFaces
CDK\"");
// TODO remove this after improving Java model
- this.generatedClass.addImport(Generated.class);
+ // this.generatedClass.addImport(Generated.class);
this.createMethodContext();
}
@@ -259,37 +260,33 @@
return result;
}
- private String createPassThroughAttributeCode(String attributeName, String[]
eventNames) {
+ private String createPassThroughAttributeCode(String htmlAttributeName, Attribute
componentAttribute,
+ String[] eventNames) {
+
generatedClass.addImport("org.richfaces.renderkit.ComponentAttribute");
StringBuilder sb = new StringBuilder();
sb.append("new ComponentAttribute(");
- sb.append('"');
- sb.append(StringUtils.getEscapedString(attributeName));
- sb.append('"');
+ sb.append(StringUtils.getEscapedString(htmlAttributeName));
- boolean isFirstEventName = true;
+ sb.append(")");
+
+ String componentAttributeName = componentAttribute.getComponentAttributeName();
+ if (!StringUtils.isEmpty(componentAttributeName)) {
+ sb.append(".setComponentAttributeName(");
+ sb.append(StringUtils.getEscapedString(componentAttributeName));
+ sb.append(")");
+ }
+
if (eventNames != null && eventNames.length != 0) {
- sb.append(", ");
+ sb.append(".setEventNames(");
sb.append("new String[] {");
- for (String eventName : eventNames) {
- if (isFirstEventName) {
- isFirstEventName = false;
- } else {
- sb.append(", ");
- }
+ sb.append(StringUtils.getEscapedStringsArray(eventNames));
- sb.append('"');
- sb.append(StringUtils.getEscapedString(eventName));
- sb.append('"');
- }
-
- sb.append("}");
+ sb.append("})");
}
-
- sb.append(")");
return sb.toString();
}
@@ -309,12 +306,13 @@
generatedClass.addImport("org.richfaces.renderkit.ComponentAttribute");
generatedClass.addImport("org.richfaces.renderkit.RenderKitUtils");
-
- //TODO - get rid of FQNs for classes via imports
+ generatedClass.addImport(Collections.class);
+
+ // TODO - get rid of FQNs for classes via imports
passThroughField.setGenericArguments(new JavaClass[] { new
JavaClass(String.class),
new JavaClass("org.richfaces.renderkit.ComponentAttribute") });
- StringBuilder fieldValue = new
StringBuilder("ComponentAttribute.createMap(");
+ StringBuilder fieldValue = new
StringBuilder("Collections.unmodifiableMap(ComponentAttribute.createMap(");
boolean isFirstArgument = true;
for (Map.Entry<String, Attribute> entry : attributesMap.entrySet()) {
if (isFirstArgument) {
@@ -324,13 +322,13 @@
}
// TODO behaviors data
- fieldValue.append(createPassThroughAttributeCode(entry.getKey(), null));
+ fieldValue.append(createPassThroughAttributeCode(entry.getKey(),
entry.getValue(), null));
}
- fieldValue.append(")");
-
+ fieldValue.append("))");
+
passThroughField.setValue(fieldValue.toString());
-
+
return passThroughField;
}
@@ -469,7 +467,7 @@
} else {
String attributeLocalName = attributeName.getLocalPart();
if (writtenAttributes.add(attributeLocalName)) {
- //TODO externalize
+ // TODO externalize
generatedClass.addImport("org.richfaces.renderkit.RenderKitUtils");
currentStatement.addStatement(new
WriteAttributeStatement(attributeLocalName, compileEl(
attributeValue.toString(), String.class)));
@@ -497,7 +495,7 @@
if (!actualAttributesMap.isEmpty()) {
JavaField passThroughField =
createPassThroughField(actualAttributesMap);
generatedClass.addField(passThroughField);
- //TODO externalize
+ // TODO externalize
generatedClass.addImport("org.richfaces.renderkit.RenderKitUtils");
currentStatement.addStatement(new
WriteAttributesSetStatement(passThroughField.getName()));
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-01-28
19:07:27 UTC (rev 16377)
@@ -45,7 +45,9 @@
import org.richfaces.cdk.templatecompiler.model.Attribute;
import org.richfaces.cdk.templatecompiler.model.ClientBehavior;
import org.richfaces.cdk.templatecompiler.model.CompositeInterface;
+import org.richfaces.cdk.templatecompiler.model.ImportAttributes;
import org.richfaces.cdk.templatecompiler.model.Template;
+import org.richfaces.cdk.xmlconfig.FragmentParser;
import org.richfaces.cdk.xmlconfig.JAXBBinding;
import com.google.common.collect.Lists;
@@ -142,6 +144,7 @@
// component.getRenderers().add(renderer);
+ //TODO set default values according to template name
String family = compositeInterface.getComponentFamily();
if (null != family) {
@@ -153,6 +156,17 @@
Map<String, Property> rendererAttributes = renderer.getAttributes();
+ List<ImportAttributes> attributesImports =
compositeInterface.getAttributesImports();
+ if (attributesImports != null) {
+ for (ImportAttributes attributesImport : attributesImports) {
+ String importURI = attributesImport.getSource();
+ Map<String, Property> properties =
getContext().getWorker(FragmentParser.class).parseProperties(importURI);
+ if (properties != null) {
+ rendererAttributes.putAll(properties);
+ }
+ }
+ }
+
List<Attribute> templateAttributes = compositeInterface.getAttributes();
if (templateAttributes != null) {
for (Attribute templateAttribute : templateAttributes) {
@@ -168,6 +182,7 @@
rendererProperty.getEventNames().addAll(eventNamesSet);
}
+ //TODO handle attributes - add extensions to schema & handling for
them
// rendererProperty.setAliases(aliases)
// rendererProperty.setExtension(extension)
// rendererProperty.setGenerate(exists)
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java 2010-01-28
19:07:27 UTC (rev 16377)
@@ -49,6 +49,8 @@
private List<ResourceDependency> resourceDependencies;
+ private List<ImportAttributes> attributesImports;
+
private String renderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
private String javaClass;
@@ -230,4 +232,24 @@
public void setRendersChildren(boolean rendersChildren) {
this.rendersChildren = rendersChildren;
}
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the attributesImports
+ */
+ @XmlElement(name = "import-attributes", namespace =
Template.CDK_NAMESPACE)
+ public List<ImportAttributes> getAttributesImports() {
+ return attributesImports;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param attributesImports the attributesImports to set
+ */
+ public void setAttributesImports(List<ImportAttributes> attributesImports) {
+ this.attributesImports = attributesImports;
+ }
+
}
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ImportAttributes.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ImportAttributes.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ImportAttributes.java 2010-01-28
19:07:27 UTC (rev 16377)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler.model;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class ImportAttributes {
+
+ private String source;
+
+ /**
+ * @return the source
+ */
+ @XmlAttribute(name = "src")
+ public String getSource() {
+ return source;
+ }
+
+ /**
+ * @param source the source to set
+ */
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+}
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd 2010-01-28
19:07:27 UTC (rev 16377)
@@ -111,6 +111,12 @@
<xs:element name="component-family" />
<xs:element name="renderer-type" />
<xs:element name="renders-children" type="xs:boolean" />
+
+ <xs:element name="import-attributes">
+ <xs:complexType>
+ <xs:attribute use="required" name="src"
type="xs:anyURI" form="unqualified" />
+ </xs:complexType>
+ </xs:element>
<xs:group name="structural">
<xs:choice>
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd 2010-01-28
19:07:27 UTC (rev 16377)
@@ -468,6 +468,14 @@
</xs:documentation>
</xs:annotation>
+ <xs:attribute name="class" type="NMTOKENS">
+ <xs:annotation>
+ <xs:appinfo>
+ <cdk-addinfo:component-attribute-name>styleClass</cdk-addinfo:component-attribute-name>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:attribute>
+
<xs:attributeGroup name="coreattrs">
<xs:annotation>
<xs:documentation>
@@ -481,7 +489,7 @@
</xs:documentation>
</xs:annotation>
<xs:attribute name="id" type="ID" />
- <xs:attribute name="class" type="NMTOKENS" />
+ <xs:attribute ref="class" />
<xs:attribute name="style" type="StyleSheet" />
<xs:attribute name="title" type="Text" />
</xs:attributeGroup>
@@ -3026,11 +3034,11 @@
<xs:group ref="map.children" />
<xs:attributeGroup ref="i18n"></xs:attributeGroup>
<xs:attributeGroup ref="events"></xs:attributeGroup>
- <xs:attribute use="required" name="id"
type="ID"></xs:attribute>
- <xs:attribute name="class"
type="xs:anySimpleType"></xs:attribute>
- <xs:attribute name="style"
type="StyleSheet"></xs:attribute>
- <xs:attribute name="title" type="Text"></xs:attribute>
- <xs:attribute name="name"
type="xs:anySimpleType"></xs:attribute>
+ <xs:attribute use="required" name="id" type="ID"
/>
+ <xs:attribute ref="class" />
+ <xs:attribute name="style" type="StyleSheet" />
+ <xs:attribute name="title" type="Text" />
+ <xs:attribute name="name" type="xs:anySimpleType" />
<xs:attributeGroup ref="cdk:core.attrs" />
</xs:complexType>
Modified: root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessor.groovy
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessor.groovy 2010-01-28
14:08:02 UTC (rev 16376)
+++ root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessor.groovy 2010-01-28
19:07:27 UTC (rev 16377)
@@ -64,7 +64,7 @@
return xPath;
}
- private String getDefaultValue(XSAttributeUse attributeUse) throws
XPathExpressionException {
+ private String getAdditionalInfo(XSAttributeUse attributeUse, String elementName)
throws XPathExpressionException {
String defaultValue = null;
XSAttributeDecl attributeDecl = attributeUse.getDecl();
@@ -73,7 +73,7 @@
Object annotationElement = annotation.getAnnotation();
if (annotationElement != null) {
XPath xPath = createXPath();
- Node node = (Node)
xPath.evaluate("xs:appinfo/cdk-schema-info:default-value", annotationElement,
+ Node node = (Node) xPath.evaluate("xs:appinfo/cdk-schema-info:"
+ elementName, annotationElement,
XPathConstants.NODE);
if (node != null) {
defaultValue = xPath.evaluate("text()", node);
@@ -84,6 +84,14 @@
return defaultValue;
}
+ private String getComponentAttributeName(XSAttributeUse attributeUse) throws
XPathExpressionException {
+ return getAdditionalInfo(attributeUse, "component-attribute-name");
+ }
+
+ private String getDefaultValue(XSAttributeUse attributeUse) throws
XPathExpressionException {
+ return getAdditionalInfo(attributeUse, "default-value");
+ }
+
private boolean isGenericKind(Attribute.Kind attributeKind) {
return Kind.GENERIC.equals(attributeKind);
}
@@ -173,6 +181,7 @@
modelAttribute.setKind(getAttributeKind(attributeDecl.getType()));
modelAttribute.setRequired(xsAttributeUse.isRequired());
modelAttribute.setDefaultValue(getDefaultValue(xsAttributeUse));
+ modelAttribute.setComponentAttributeName(getComponentAttributeName(xsAttributeUse));
}
}
}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-01-28
19:07:27 UTC (rev 16377)
@@ -234,6 +234,15 @@
assertEquals("Required Attribute",
requiredAttribute.getDisplayname());
}
+ private void checkDummyComponentImportedAttribute(Property importedAttribute,
Class<?> type) {
+ assertNotNull(importedAttribute);
+ assertNoEventNames(importedAttribute);
+ assertNoSignature(importedAttribute);
+ assertNoDefaultValue(importedAttribute);
+ assertFalse(importedAttribute.isRequired());
+
+ assertEquals(type.getName(), importedAttribute.getType().getName());
+ }
@Before
@@ -290,7 +299,12 @@
checkDummyComponentIntegerAttribute(attributes.get("integerAttribute"));
checkDummyComponentRequiredAttribute(attributes.get("requiredAttribute"));
- assertEquals(7, attributes.size());
+
checkDummyComponentImportedAttribute(attributes.get("anotherImportedStringProperty"),
String.class);
+
checkDummyComponentImportedAttribute(attributes.get("anotherImportedProperty"),
Object.class);
+
checkDummyComponentImportedAttribute(attributes.get("importedBooleanProperty"),
boolean.class);
+
checkDummyComponentImportedAttribute(attributes.get("importedIntegerProperty"),
Integer.class);
+
+ assertEquals(11, attributes.size());
}
}
Added:
root/cdk/trunk/plugins/generator/src/test/resources/META-INF/cdk/attributes/dummy-template-props.xml
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/META-INF/cdk/attributes/dummy-template-props.xml
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/META-INF/cdk/attributes/dummy-template-props.xml 2010-01-28
19:07:27 UTC (rev 16377)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ JBoss, Home of Professional Open Source Copyright ${year}, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of individual
+ contributors. This is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version. This software is
+ distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details. You should have received a copy of the GNU
+ Lesser General Public License along with this software; if not, write
+ to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ Boston, MA 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+-->
+<cdk:properties
xmlns:xi="http://www.w3.org/2001/XInclude"
+
xmlns:cdk="http://richfaces.org/cdk/extensions"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xmlns="http://java.sun.com/xml/ns/javaee">
+
+ <property>
+ <property-name>importedBooleanProperty</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <property-name>importedIntegerProperty</property-name>
+ <property-class>java.lang.Integer</property-class>
+ </property>
+
+</cdk:properties>
\ No newline at end of file
Added:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy-attributes.xml
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy-attributes.xml
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy-attributes.xml 2010-01-28
19:07:27 UTC (rev 16377)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ JBoss, Home of Professional Open Source Copyright ${year}, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of individual
+ contributors. This is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version. This software is
+ distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details. You should have received a copy of the GNU
+ Lesser General Public License along with this software; if not, write
+ to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ Boston, MA 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+-->
+<cdk:properties
xmlns:xi="http://www.w3.org/2001/XInclude"
+
xmlns:cdk="http://richfaces.org/cdk/extensions"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xmlns="http://java.sun.com/xml/ns/javaee">
+
+ <property>
+ <property-name>anotherImportedStringProperty</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <property-name>anotherImportedProperty</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+
+</cdk:properties>
\ No newline at end of file
Modified:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml 2010-01-28
19:07:27 UTC (rev 16377)
@@ -28,6 +28,9 @@
<cc:attribute name="integerAttribute" type="java.lang.Integer"
default="-1" />
<cc:attribute name="requiredAttribute" shortDescription="That's a
required attribute"
displayName="Required Attribute" required="true" />
+
+ <cdk:import-attributes
src="urn:resource:org/richfaces/cdk/templatecompiler/dummy-attributes.xml"
/>
+ <cdk:import-attributes src="urn:attributes:dummy-template-props.xml"
/>
</cc:interface>
<cc:implementation />
Modified:
root/framework/trunk/commons/src/main/java/org/richfaces/renderkit/ComponentAttribute.java
===================================================================
---
root/framework/trunk/commons/src/main/java/org/richfaces/renderkit/ComponentAttribute.java 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/framework/trunk/commons/src/main/java/org/richfaces/renderkit/ComponentAttribute.java 2010-01-28
19:07:27 UTC (rev 16377)
@@ -22,7 +22,6 @@
package org.richfaces.renderkit;
-import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;
@@ -31,47 +30,71 @@
*/
public class ComponentAttribute implements Comparable<ComponentAttribute> {
- private final String name;
+ private final String htmlAttributeName;
- private final String[] eventNames;
+ private String componentAttributeName;
+ private String[] eventNames;
+
//TODO handling for aliases: "styleClass" -> "class"
- public ComponentAttribute(String name) {
- this(name, null);
- }
-
- public ComponentAttribute(String name, String[] eventNames) {
+ public ComponentAttribute(String htmlAttributeName) {
super();
- this.name = name;
- this.eventNames = eventNames;
+ this.htmlAttributeName = htmlAttributeName;
}
public static final Map<String, ComponentAttribute>
createMap(ComponentAttribute... attributes) {
Map<String,ComponentAttribute> result = new TreeMap<String,
ComponentAttribute>();
for (ComponentAttribute componentAttribute : attributes) {
- result.put(componentAttribute.getName(), componentAttribute);
+ result.put(componentAttribute.getHtmlAttributeName(), componentAttribute);
}
- return Collections.unmodifiableMap(result);
+ return result;
}
/**
* @return the name
*/
- public String getName() {
- return name;
+ public String getHtmlAttributeName() {
+ return htmlAttributeName;
}
/**
+ * @return the componentAttributeName
+ */
+ public String getComponentAttributeName() {
+ return (componentAttributeName == null) ? htmlAttributeName :
componentAttributeName;
+ }
+
+ /**
+ * @param componentAttributeName the componentAttributeName to set
+ * @return
+ */
+ public ComponentAttribute setComponentAttributeName(String componentAttributeName) {
+ this.componentAttributeName = componentAttributeName;
+
+ return this;
+ }
+
+ /**
* @return the eventNames
*/
public String[] getEventNames() {
return eventNames;
}
-
+
+ /**
+ * @param eventNames the eventNames to set
+ * @return
+ */
+ public ComponentAttribute setEventNames(String[] eventNames) {
+ this.eventNames = eventNames;
+
+ return this;
+ }
+
public int compareTo(ComponentAttribute o) {
- return getName().compareTo(o.getName());
+ return getHtmlAttributeName().compareTo(o.getHtmlAttributeName());
}
}
Modified:
root/framework/trunk/commons/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
===================================================================
---
root/framework/trunk/commons/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/framework/trunk/commons/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-01-28
19:07:27 UTC (rev 16377)
@@ -164,6 +164,7 @@
return result.toString();
}
+ //TODO filter out empty strings
static boolean shouldRenderAttribute(Object attributeValue) {
if (attributeValue == null) {
return false;
@@ -216,15 +217,15 @@
String prefixedAttributeName = prefixAttributeName(attributeName, writer);
if (Arrays.binarySearch(URI_ATTRIBUTE_NAMES, attributeName) >= 0) {
- writer.writeURIAttribute(prefixedAttributeName, attributeValue,
attributeName);
+ writer.writeURIAttribute(prefixedAttributeName, attributeValue, null);
} else if (Arrays.binarySearch(BOOLEAN_ATTRIBUTE_NAMES, attributeName) >= 0)
{
boolean booleanAttributeValue =
Boolean.valueOf(String.valueOf(attributeValue));
if (booleanAttributeValue) {
// TODO - is passing in Boolean.TRUE value documented somewhere?
- writer.writeAttribute(prefixedAttributeName, Boolean.TRUE,
attributeName);
+ writer.writeAttribute(prefixedAttributeName, Boolean.TRUE, null);
}
} else {
- writer.writeAttribute(prefixedAttributeName, attributeValue, attributeName);
+ writer.writeAttribute(prefixedAttributeName, attributeValue, null);
}
}
@@ -243,8 +244,9 @@
throw new NullPointerException("componentAttribute");
}
- String attributeName = componentAttribute.getName();
- Object attributeValue = component.getAttributes().get(attributeName);
+ String htmlAttributeName = componentAttribute.getHtmlAttributeName();
+ String componentAttributeName = componentAttribute.getComponentAttributeName();
+ Object attributeValue = component.getAttributes().get(componentAttributeName);
Map<String, List<ClientBehavior>> behaviorsMap =
getClientBehaviorsMap(component);
if (behaviorsMap != null) {
@@ -266,7 +268,7 @@
}
}
- renderAttribute(facesContext, attributeName, attributeValue);
+ renderAttribute(facesContext, htmlAttributeName, attributeValue);
}
public static void renderPassThroughAttributesOptimized(FacesContext context,
UIComponent component,
@@ -296,7 +298,7 @@
for (Map.Entry<String, ComponentAttribute> knownAttributesMapEntry :
knownAttributesMap.entrySet()) {
ComponentAttribute knownAttribute = knownAttributesMapEntry.getValue();
- if (handledAttributes.contains(knownAttribute.getName())) {
+ if (handledAttributes.contains(knownAttribute.getHtmlAttributeName())) {
continue;
}
Modified:
root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/RenderKitUtilsTest.java
===================================================================
---
root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/RenderKitUtilsTest.java 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/RenderKitUtilsTest.java 2010-01-28
19:07:27 UTC (rev 16377)
@@ -162,6 +162,7 @@
knownAttributes.put("style", new
ComponentAttribute("style"));
knownAttributes.put("src", new ComponentAttribute("src"));
knownAttributes.put("lang", new ComponentAttribute("lang"));
+ knownAttributes.put("class", new
ComponentAttribute("class").setComponentAttributeName("styleClass"));
Map<String, Object> componentAttributes = new HashMap<String,
Object>();
componentAttributes.put("disabled", Boolean.TRUE);
@@ -170,16 +171,18 @@
componentAttributes.put("src", "urn:abc");
componentAttributes.put("facelets.Mark", 123);
componentAttributes.put("lang", "ru");
+ componentAttributes.put("styleClass", "rich-component");
UIComponent component = FacesMock.createMock(UIComponent.class);
expect(component.getAttributes()).andReturn(componentAttributes).anyTimes();
- responseWriter.writeAttribute(eq("disabled"), eq(Boolean.TRUE),
eq("disabled"));
+ responseWriter.writeAttribute(eq("disabled"), eq(Boolean.TRUE),
EasyMock.<String>isNull());
// checked attribute shouldn't be rendered - it's 'false'
- responseWriter.writeAttribute(eq("style"), eq("color:red"),
eq("style"));
- responseWriter.writeURIAttribute(eq("src"), eq("urn:abc"),
eq("src"));
+ responseWriter.writeAttribute(eq("style"), eq("color:red"),
EasyMock.<String>isNull());
+ responseWriter.writeURIAttribute(eq("src"), eq("urn:abc"),
EasyMock.<String>isNull());
// facelets.Mark shouldn't be rendered - it's unknown
- responseWriter.writeAttribute(eq("xml:lang"), eq("ru"),
eq("lang"));
+ responseWriter.writeAttribute(eq("xml:lang"), eq("ru"),
EasyMock.<String>isNull());
+ responseWriter.writeAttribute(eq("class"),
eq("rich-component"), EasyMock.<String>isNull());
FacesMock.replay(facesEnvironment, component, responseWriter);
@@ -190,7 +193,7 @@
private ClientBehavior createClientBehavior(String handlerData,
Set<ClientBehaviorHint> hints) {
ClientBehavior behavior = FacesMock.createMock(ClientBehavior.class);
-
expect(behavior.getScript(EasyMock.<ClientBehaviorContext>notNull())).andReturn(
+ expect(behavior.getScript(EasyMock.<ClientBehaviorContext>
notNull())).andReturn(
MessageFormat.format("prompt({0})", handlerData)).anyTimes();
expect(behavior.getHints()).andReturn(hints).anyTimes();
@@ -200,10 +203,14 @@
@Test
public void testBehaviors() throws Exception {
Map<String, ComponentAttribute> knownAttributes = new HashMap<String,
ComponentAttribute>();
- knownAttributes.put("onclick", new
ComponentAttribute("onclick", new String[] { "click",
"action" }));
- knownAttributes.put("onmousemove", new
ComponentAttribute("onmousemove", new String[] { "mousemove" }));
- knownAttributes.put("onkeypress", new
ComponentAttribute("onkeypress", new String[] { "keypress" }));
- knownAttributes.put("oncontextmenu", new
ComponentAttribute("oncontextmenu", new String[] { "contextmenu" }));
+ knownAttributes.put("onclick", new
ComponentAttribute("onclick")
+ .setEventNames(new String[] { "click", "action" }));
+ knownAttributes.put("onmousemove", new
ComponentAttribute("onmousemove")
+ .setEventNames(new String[] { "mousemove" }));
+ knownAttributes.put("onkeypress", new
ComponentAttribute("onkeypress")
+ .setEventNames(new String[] { "keypress" }));
+ knownAttributes.put("oncontextmenu", new
ComponentAttribute("oncontextmenu")
+ .setEventNames(new String[] { "contextmenu" }));
Map<String, Object> componentAttributes = new HashMap<String,
Object>();
componentAttributes.put("onkeypress", "alert(keypress)");
@@ -214,7 +221,7 @@
Set<ClientBehaviorHint> submittingHintsSet =
EnumSet.of(ClientBehaviorHint.SUBMITTING);
Map<String, List<ClientBehavior>> behaviorsMap = new
HashMap<String, List<ClientBehavior>>();
-
+
ClientBehavior keypressBehavior = createClientBehavior("keypress",
emptyHintsSet);
ClientBehavior actionBehavior1 = createClientBehavior("action1",
emptyHintsSet);
ClientBehavior actionBehavior2 = createClientBehavior("action2",
submittingHintsSet);
@@ -233,18 +240,18 @@
Arrays.asList("click", "action", "mousemove",
"keypress", "blur", "contextmenu")).anyTimes();
responseWriter.writeAttribute(eq("onkeypress"),
eq("jsf.util.chain('alert(keypress)','prompt(keypress)')"),
- eq("onkeypress"));
+ EasyMock.<String>isNull());
responseWriter.writeAttribute(eq("onclick"),
-
eq("jsf.util.chain('alert(click)','prompt(action1)','prompt(action2)')"),
eq("onclick"));
- responseWriter.writeAttribute(eq("onmousemove"),
eq("alert(mousemove)"), eq("onmousemove"));
- responseWriter.writeAttribute(eq("oncontextmenu"),
eq("prompt(contextmenu)"), eq("oncontextmenu"));
+
eq("jsf.util.chain('alert(click)','prompt(action1)','prompt(action2)')"),
EasyMock.<String>isNull());
+ responseWriter.writeAttribute(eq("onmousemove"),
eq("alert(mousemove)"), EasyMock.<String>isNull());
+ responseWriter.writeAttribute(eq("oncontextmenu"),
eq("prompt(contextmenu)"), EasyMock.<String>isNull());
- FacesMock.replay(component, facesEnvironment, responseWriter, keypressBehavior,
actionBehavior1, actionBehavior2,
- actionBehavior3, contextmenuBehavior);
+ FacesMock.replay(component, facesEnvironment, responseWriter, keypressBehavior,
actionBehavior1,
+ actionBehavior2, actionBehavior3, contextmenuBehavior);
RenderKitUtils.renderPassThroughAttributes(facesContext, component,
knownAttributes);
- FacesMock.verify(component, facesEnvironment, responseWriter, keypressBehavior,
actionBehavior1, actionBehavior2,
- actionBehavior3, contextmenuBehavior);
+ FacesMock.verify(component, facesEnvironment, responseWriter, keypressBehavior,
actionBehavior1,
+ actionBehavior2, actionBehavior3, contextmenuBehavior);
}
}
\ No newline at end of file
Modified:
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/button.template.xml
===================================================================
---
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/button.template.xml 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/button.template.xml 2010-01-28
19:07:27 UTC (rev 16377)
@@ -14,8 +14,8 @@
<cc:implementation>
<input id="#{clientId}" name="#{clientId}"
- cdk:passThroughWithExclusions="name onclick type id class"
onclick="#{this.getOnClick(facesContext,cc)}"
- value="#{cc.attributes['value']}"
class="#{cc.attributes['styleClass']}">
+ cdk:passThroughWithExclusions="type"
onclick="#{this.getOnClick(facesContext,cc)}"
+ value="#{cc.attributes['value']}">
<cdk:call expression="encodeTypeAndImage(facesContext,cc);" />
</input>
</cc:implementation>
Modified:
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/link.template.xml
===================================================================
---
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/link.template.xml 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/link.template.xml 2010-01-28
19:07:27 UTC (rev 16377)
@@ -13,8 +13,8 @@
<cc:implementation>
<a id="#{clientId}" name="#{clientId}"
- cdk:passThroughWithExclusions="value name onclick href id"
onclick="#{this.getOnClick(facesContext, cc)}"
- href="#" class="#{cc.attributes['styleClass']}">
+ cdk:passThroughWithExclusions="value"
onclick="#{this.getOnClick(facesContext, cc)}"
+ href="#">
#{cc.attributes['value']}
<cdk:body>
<cdk:call expression="renderChildren(facesContext, cc);" />
Modified:
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml
===================================================================
---
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml 2010-01-28
14:08:02 UTC (rev 16376)
+++
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml 2010-01-28
19:07:27 UTC (rev 16377)
@@ -27,8 +27,7 @@
LOG.LEVEL = LOG.#{component.attributes["level"]}; </script>
</div>
</cdk:otherwise> </cdk:choose
-->
- <div id="richfaces.log" class="rich-log
#{cc.attributes['styleClass']}"
- cdk:passThroughWithExclusions="id class">
+ <div id="richfaces.log" class="rich-log
#{cc.attributes['styleClass']}">
<script type="text/javascript">
RichFaces.log.setLevel("#{cc.attributes['level']}");
</script>