JBoss Rich Faces SVN: r20943 - in modules/tests/metamer/trunk/application/src/main: webapp/components and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-11 06:35:42 -0500 (Tue, 11 Jan 2011)
New Revision: 20943
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuItemBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richPanelMenuItem/
modules/tests/metamer/trunk/application/src/main/webapp/components/richPanelMenuItem/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richPanelMenuItem/simple.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
rich:panelMenu - panelMenuItem - added initial sample (RFPL-1045)
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2011-01-11 11:34:56 UTC (rev 20942)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2011-01-11 11:35:42 UTC (rev 20943)
@@ -146,6 +146,7 @@
components.put("richMenuSeparator", "Rich Menu Separator");
components.put("richPanel", "Rich Panel");
components.put("richPanelMenu", "Rich Panel Menu");
+ components.put("richPanelMenuItem", "Rich Panel Menu Item");
components.put("richPopupPanel", "Rich Popup Panel");
components.put("richProgressBar", "Rich Progress Bar");
components.put("richSelect", "Rich Select");
Added: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuItemBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuItemBean.java (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuItemBean.java 2011-01-11 11:35:42 UTC (rev 20943)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.tests.metamer.bean;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+import org.richfaces.component.html.HtmlPanelMenuItem;
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for rich:panelMenu.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richPanelMenuItemBean")
+@ViewScoped
+public class RichPanelMenuItemBean implements Serializable {
+
+ private static final long serialVersionUID = -1L;
+ private static Logger logger;
+ private Attributes attributes;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ attributes = Attributes.getComponentAttributesFromClass(HtmlPanelMenuItem.class, getClass());
+
+ attributes.setAttribute("rendered", true);
+
+ // already defined in source directly
+ attributes.remove("name");
+ attributes.remove("label");
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+}
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richPanelMenuItem/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richPanelMenuItem/list.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richPanelMenuItem/list.xhtml 2011-01-11 11:35:42 UTC (rev 20943)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
+ <!--
+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.
+ -->
+
+ <ui:composition template="/templates/list.xhtml">
+
+ <ui:define name="pageTitle">Rich Panel Menu Item</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="simple" outcome="simple" value="Simple">
+ Simple page containing <b>rich:panelMenuItem</b> inside <b>rich:panelMenu</b> and input boxes for all its attributes.
+ </metamer:testPageLink>
+
+ </ui:define>
+
+ </ui:composition>
+
+</html>
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richPanelMenuItem/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richPanelMenuItem/simple.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richPanelMenuItem/simple.xhtml 2011-01-11 11:35:42 UTC (rev 20943)
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+ xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j">
+
+ <!--
+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.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <rich:panelMenu id="panelMenu" style="width: 250px; "
+ action="#{richBean.dummyAction}"
+ actionListener="#{richBean.dummyActionListener}"
+ activeItem="#{richPanelMenuBean.attributes['activeItem'].value}"
+ itemChangeListener="#{richPanelMenuBean.itemChangeListener}">
+
+ <rich:panelMenuGroup id="group1" name="group1" label="Group 1">
+ <rich:panelMenuItem id="item11" name="item11" label="Item 1.1"/>
+ <rich:panelMenuItem id="item12" name="item12" label="Item 1.2 (influenced by attributes)"
+ action="#{richBean.dummyAction}"
+ actionListener="#{richBean.dummyActionListener}"
+ bypassUpdates="#{richPanelMenuItemBean.attributes['bypassUpdates'].value}"
+ data="#{richPanelMenuItemBean.attributes['data'].value}"
+ disabled="#{richPanelMenuItemBean.attributes['disabled'].value}"
+ disabledClass="#{richPanelMenuItemBean.attributes['disabledClass'].value}"
+ execute="#{richPanelMenuItemBean.attributes['disabledClass'].value}"
+ hoverClass="#{richPanelMenuItemBean.attributes['hoverClass'].value}"
+ iconLeft="#{richPanelMenuItemBean.attributes['iconLeft'].value}"
+ iconLeftClass="#{richPanelMenuItemBean.attributes['iconLeftClass'].value}"
+ iconLeftDisabled="#{richPanelMenuItemBean.attributes['iconLeftDisabled'].value}"
+ iconRight="#{richPanelMenuItemBean.attributes['iconRight'].value}"
+ iconRightClass="#{richPanelMenuItemBean.attributes['iconRightClass'].value}"
+ iconRightDisabled="#{richPanelMenuItemBean.attributes['iconRightDisabled'].value}"
+ immediate="#{richPanelMenuItemBean.attributes['immediate'].value}"
+ limitRender="#{richPanelMenuItemBean.attributes['limitRender'].value}"
+ mode="#{richPanelMenuItemBean.attributes['mode'].value}"
+ onbeforedomupdate="#{richPanelMenuItemBean.attributes['onbeforedomupdate'].value}"
+ onmousedown="#{richPanelMenuItemBean.attributes['onmousedown'].value}"
+ onmousemove="#{richPanelMenuItemBean.attributes['onmousemove'].value}"
+ onmouseout="#{richPanelMenuItemBean.attributes['onmouseout'].value}"
+ onmouseover="#{richPanelMenuItemBean.attributes['onmouseover'].value}"
+ onmouseup="#{richPanelMenuItemBean.attributes['onmouseup'].value}"
+ onselect="#{richPanelMenuItemBean.attributes['onselect'].value}"
+ onunselect="#{richPanelMenuItemBean.attributes['onunselect'].value}"
+ render="#{richPanelMenuItemBean.attributes['render'].value}"
+ rendered="#{richPanelMenuItemBean.attributes['rendered'].value}"
+ status="#{richPanelMenuItemBean.attributes['status'].value}"
+ style="#{richPanelMenuItemBean.attributes['style'].value}"
+ styleClass="#{richPanelMenuItemBean.attributes['styleClass'].value}"
+ />
+ <rich:panelMenuItem id="item13" name="item13" label="Item 1.3"/>
+ </rich:panelMenuGroup>
+ </rich:panelMenu>
+
+ <br/><br/>
+
+ <fieldset>
+ <legend>selected item</legend>
+
+ <a4j:outputPanel id="selectedPanel" ajaxRendered="true">
+ <h:outputText id="current" value="#{richPanelMenuBean.attributes['activeItem'].value}" />
+ </a4j:outputPanel>
+ </fieldset>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{richPanelMenuItemBean.attributes}" id="attributes" render="log"/>
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
14 years, 11 months
JBoss Rich Faces SVN: r20942 - in modules/tests/metamer/trunk/application/src/main: resources/org/richfaces/tests/metamer/bean and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-11 06:34:56 -0500 (Tue, 11 Jan 2011)
New Revision: 20942
Added:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichPanelMenuBean.properties
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuBean.java
Log:
rich:panelMenu - simple sample - attribute consolidation (RFPL-1045)
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuBean.java 2011-01-11 11:34:09 UTC (rev 20941)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuBean.java 2011-01-11 11:34:56 UTC (rev 20942)
@@ -27,7 +27,7 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
-import org.richfaces.component.UIPanelMenu;
+import org.richfaces.component.html.HtmlPanelMenu;
import org.richfaces.event.ItemChangeEvent;
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
@@ -35,7 +35,7 @@
/**
* Managed bean for rich:panelMenu.
- *
+ *
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
@@ -55,21 +55,15 @@
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
- attributes = Attributes.getComponentAttributesFromFacesConfig(UIPanelMenu.class, getClass());
+ // loading from Class to work around RF-10161
+ attributes = Attributes.getComponentAttributesFromClass(HtmlPanelMenu.class, getClass());
- attributes.setAttribute("groupCollapseIconLeft", "disc");
- attributes.setAttribute("groupCollapseIconRight", "chevronDown");
- attributes.setAttribute("groupExpandIconLeft", "disc");
- attributes.setAttribute("groupExpandIconRight", "chevronUp");
attributes.setAttribute("rendered", true);
attributes.setAttribute("style", "width: 200px;");
- attributes.setAttribute("topGroupCollapseIconLeft", "disc");
- attributes.setAttribute("topGroupCollapseIconRight", "chevronDown");
- attributes.setAttribute("topGroupExpandIconLeft", "disc");
- attributes.setAttribute("topGroupExpandIconRight", "chevronUp");
- // will tested in another way
+ // will be tested in another way
attributes.remove("itemChangeListener");
+ attributes.remove("converter");
}
public Attributes getAttributes() {
@@ -82,7 +76,7 @@
/**
* An item change listener that logs to the page old and new value.
- *
+ *
* @param event
* an event representing the activation of a user interface component
*/
Added: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichPanelMenuBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichPanelMenuBean.properties (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichPanelMenuBean.properties 2011-01-11 11:34:56 UTC (rev 20942)
@@ -0,0 +1,188 @@
+attr.groupMode.client=client
+attr.groupMode.ajax=ajax
+attr.groupMode.server=server
+attr.groupMode.null=
+attr.itemMode.client=client
+attr.itemMode.ajax=ajax
+attr.itemMode.server=server
+attr.itemMode.null=
+attr.groupCollapseIconLeft.grid=grid
+attr.groupCollapseIconLeft.disc=disc
+attr.groupCollapseIconLeft.chevronUp=chevronUp
+attr.groupCollapseIconLeft.chevronDown=chevronDown
+attr.groupCollapseIconLeft.triangle=triangle
+attr.groupCollapseIconLeft.triangleUp=triangleUp
+attr.groupCollapseIconLeft.triangleDown=triangleDown
+attr.groupCollapseIconLeft.customURL=/resources/images/loading.gif
+attr.groupCollapseIconLeft.null=
+attr.groupCollapseIconRight.grid=grid
+attr.groupCollapseIconRight.disc=disc
+attr.groupCollapseIconRight.chevronUp=chevronUp
+attr.groupCollapseIconRight.chevronDown=chevronDown
+attr.groupCollapseIconRight.triangle=triangle
+attr.groupCollapseIconRight.triangleUp=triangleUp
+attr.groupCollapseIconRight.triangleDown=triangleDown
+attr.groupCollapseIconRight.customURL=/resources/images/loading.gif
+attr.groupCollapseIconRight.null=
+attr.groupDisableIconLeft.grid=grid
+attr.groupDisableIconLeft.disc=disc
+attr.groupDisableIconLeft.chevronUp=chevronUp
+attr.groupDisableIconLeft.chevronDown=chevronDown
+attr.groupDisableIconLeft.triangle=triangle
+attr.groupDisableIconLeft.triangleUp=triangleUp
+attr.groupDisableIconLeft.triangleDown=triangleDown
+attr.groupDisableIconLeft.customURL=/resources/images/loading.gif
+attr.groupDisableIconLeft.null=
+attr.groupDisableIconRight.grid=grid
+attr.groupDisableIconRight.disc=disc
+attr.groupDisableIconRight.chevronUp=chevronUp
+attr.groupDisableIconRight.chevronDown=chevronDown
+attr.groupDisableIconRight.triangle=triangle
+attr.groupDisableIconRight.triangleUp=triangleUp
+attr.groupDisableIconRight.triangleDown=triangleDown
+attr.groupDisableIconRight.customURL=/resources/images/loading.gif
+attr.groupDisableIconRight.null=
+attr.groupExpandIconLeft.grid=grid
+attr.groupExpandIconLeft.disc=disc
+attr.groupExpandIconLeft.chevronUp=chevronUp
+attr.groupExpandIconLeft.chevronDown=chevronDown
+attr.groupExpandIconLeft.triangle=triangle
+attr.groupExpandIconLeft.triangleUp=triangleUp
+attr.groupExpandIconLeft.triangleDown=triangleDown
+attr.groupExpandIconLeft.customURL=/resources/images/loading.gif
+attr.groupExpandIconLeft.null=
+attr.groupExpandIconRight.grid=grid
+attr.groupExpandIconRight.disc=disc
+attr.groupExpandIconRight.chevronUp=chevronUp
+attr.groupExpandIconRight.chevronDown=chevronDown
+attr.groupExpandIconRight.triangle=triangle
+attr.groupExpandIconRight.triangleUp=triangleUp
+attr.groupExpandIconRight.triangleDown=triangleDown
+attr.groupExpandIconRight.customURL=/resources/images/loading.gif
+attr.groupExpandIconRight.null=
+attr.itemDisableIconLeft.grid=grid
+attr.itemDisableIconLeft.disc=disc
+attr.itemDisableIconLeft.chevronUp=chevronUp
+attr.itemDisableIconLeft.chevronDown=chevronDown
+attr.itemDisableIconLeft.triangle=triangle
+attr.itemDisableIconLeft.triangleUp=triangleUp
+attr.itemDisableIconLeft.triangleDown=triangleDown
+attr.itemDisableIconLeft.customURL=/resources/images/loading.gif
+attr.itemDisableIconLeft.null=
+attr.itemDisableIconRight.grid=grid
+attr.itemDisableIconRight.disc=disc
+attr.itemDisableIconRight.chevronUp=chevronUp
+attr.itemDisableIconRight.chevronDown=chevronDown
+attr.itemDisableIconRight.triangle=triangle
+attr.itemDisableIconRight.triangleUp=triangleUp
+attr.itemDisableIconRight.triangleDown=triangleDown
+attr.itemDisableIconRight.customURL=/resources/images/loading.gif
+attr.itemDisableIconRight.null=
+attr.itemIconLeft.grid=grid
+attr.itemIconLeft.disc=disc
+attr.itemIconLeft.chevronUp=chevronUp
+attr.itemIconLeft.chevronDown=chevronDown
+attr.itemIconLeft.triangle=triangle
+attr.itemIconLeft.triangleUp=triangleUp
+attr.itemIconLeft.triangleDown=triangleDown
+attr.itemIconLeft.customURL=/resources/images/loading.gif
+attr.itemIconLeft.null=
+attr.itemIconRight.grid=grid
+attr.itemIconRight.disc=disc
+attr.itemIconRight.chevronUp=chevronUp
+attr.itemIconRight.chevronDown=chevronDown
+attr.itemIconRight.triangle=triangle
+attr.itemIconRight.triangleUp=triangleUp
+attr.itemIconRight.triangleDown=triangleDown
+attr.itemIconRight.customURL=/resources/images/loading.gif
+attr.itemIconRight.null=
+attr.topGroupCollapseIconLeft.grid=grid
+attr.topGroupCollapseIconLeft.disc=disc
+attr.topGroupCollapseIconLeft.chevronUp=chevronUp
+attr.topGroupCollapseIconLeft.chevronDown=chevronDown
+attr.topGroupCollapseIconLeft.triangle=triangle
+attr.topGroupCollapseIconLeft.triangleUp=triangleUp
+attr.topGroupCollapseIconLeft.triangleDown=triangleDown
+attr.topGroupCollapseIconLeft.customURL=/resources/images/loading.gif
+attr.topGroupCollapseIconLeft.null=
+attr.topGroupCollapseIconRight.grid=grid
+attr.topGroupCollapseIconRight.disc=disc
+attr.topGroupCollapseIconRight.chevronUp=chevronUp
+attr.topGroupCollapseIconRight.chevronDown=chevronDown
+attr.topGroupCollapseIconRight.triangle=triangle
+attr.topGroupCollapseIconRight.triangleUp=triangleUp
+attr.topGroupCollapseIconRight.triangleDown=triangleDown
+attr.topGroupCollapseIconRight.customURL=/resources/images/loading.gif
+attr.topGroupCollapseIconRight.null=
+attr.topGroupDisableIconLeft.grid=grid
+attr.topGroupDisableIconLeft.disc=disc
+attr.topGroupDisableIconLeft.chevronUp=chevronUp
+attr.topGroupDisableIconLeft.chevronDown=chevronDown
+attr.topGroupDisableIconLeft.triangle=triangle
+attr.topGroupDisableIconLeft.triangleUp=triangleUp
+attr.topGroupDisableIconLeft.triangleDown=triangleDown
+attr.topGroupDisableIconLeft.customURL=/resources/images/loading.gif
+attr.topGroupDisableIconLeft.null=
+attr.topGroupDisableIconRight.grid=grid
+attr.topGroupDisableIconRight.disc=disc
+attr.topGroupDisableIconRight.chevronUp=chevronUp
+attr.topGroupDisableIconRight.chevronDown=chevronDown
+attr.topGroupDisableIconRight.triangle=triangle
+attr.topGroupDisableIconRight.triangleUp=triangleUp
+attr.topGroupDisableIconRight.triangleDown=triangleDown
+attr.topGroupDisableIconRight.customURL=/resources/images/loading.gif
+attr.topGroupDisableIconRight.null=
+attr.topGroupExpandIconLeft.grid=grid
+attr.topGroupExpandIconLeft.disc=disc
+attr.topGroupExpandIconLeft.chevronUp=chevronUp
+attr.topGroupExpandIconLeft.chevronDown=chevronDown
+attr.topGroupExpandIconLeft.triangle=triangle
+attr.topGroupExpandIconLeft.triangleUp=triangleUp
+attr.topGroupExpandIconLeft.triangleDown=triangleDown
+attr.topGroupExpandIconLeft.customURL=/resources/images/loading.gif
+attr.topGroupExpandIconLeft.null=
+attr.topGroupExpandIconRight.grid=grid
+attr.topGroupExpandIconRight.disc=disc
+attr.topGroupExpandIconRight.chevronUp=chevronUp
+attr.topGroupExpandIconRight.chevronDown=chevronDown
+attr.topGroupExpandIconRight.triangle=triangle
+attr.topGroupExpandIconRight.triangleUp=triangleUp
+attr.topGroupExpandIconRight.triangleDown=triangleDown
+attr.topGroupExpandIconRight.customURL=/resources/images/loading.gif
+attr.topGroupExpandIconRight.null=
+attr.topItemDisableIconLeft.grid=grid
+attr.topItemDisableIconLeft.disc=disc
+attr.topItemDisableIconLeft.chevronUp=chevronUp
+attr.topItemDisableIconLeft.chevronDown=chevronDown
+attr.topItemDisableIconLeft.triangle=triangle
+attr.topItemDisableIconLeft.triangleUp=triangleUp
+attr.topItemDisableIconLeft.triangleDown=triangleDown
+attr.topItemDisableIconLeft.customURL=/resources/images/loading.gif
+attr.topItemDisableIconLeft.null=
+attr.topItemDisableIconRight.grid=grid
+attr.topItemDisableIconRight.disc=disc
+attr.topItemDisableIconRight.chevronUp=chevronUp
+attr.topItemDisableIconRight.chevronDown=chevronDown
+attr.topItemDisableIconRight.triangle=triangle
+attr.topItemDisableIconRight.triangleUp=triangleUp
+attr.topItemDisableIconRight.triangleDown=triangleDown
+attr.topItemDisableIconRight.customURL=/resources/images/loading.gif
+attr.topItemDisableIconRight.null=
+attr.topItemIconLeft.grid=grid
+attr.topItemIconLeft.disc=disc
+attr.topItemIconLeft.chevronUp=chevronUp
+attr.topItemIconLeft.chevronDown=chevronDown
+attr.topItemIconLeft.triangle=triangle
+attr.topItemIconLeft.triangleUp=triangleUp
+attr.topItemIconLeft.triangleDown=triangleDown
+attr.topItemIconLeft.customURL=/resources/images/loading.gif
+attr.topItemIconLeft.null=
+attr.topItemIconRight.grid=grid
+attr.topItemIconRight.disc=disc
+attr.topItemIconRight.chevronUp=chevronUp
+attr.topItemIconRight.chevronDown=chevronDown
+attr.topItemIconRight.triangle=triangle
+attr.topItemIconRight.triangleUp=triangleUp
+attr.topItemIconRight.triangleDown=triangleDown
+attr.topItemIconRight.customURL=/resources/images/loading.gif
+attr.topItemIconRight.null=
\ No newline at end of file
14 years, 11 months
JBoss Rich Faces SVN: r20941 - modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-11 06:34:09 -0500 (Tue, 11 Jan 2011)
New Revision: 20941
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/SelectItemComparator.java
Log:
sort null as first of SelectItems in Attributes list
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/SelectItemComparator.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/SelectItemComparator.java 2011-01-11 11:33:35 UTC (rev 20940)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/SelectItemComparator.java 2011-01-11 11:34:09 UTC (rev 20941)
@@ -46,9 +46,13 @@
* {@inheritDoc}
*/
public int compare(SelectItem o1, SelectItem o2) {
- if (o1 == null || o1.getLabel() == null) {
+ if (o1 == null || o1.getLabel() == null || o1.getLabel().equals("null")) {
return -1;
}
+
+ if (o2 == null || o2.getLabel() == null || o2.getLabel().equals("null")) {
+ return 1;
+ }
return o1.getLabel().compareTo(o2.getLabel());
}
14 years, 11 months
JBoss Rich Faces SVN: r20940 - modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-11 06:33:35 -0500 (Tue, 11 Jan 2011)
New Revision: 20940
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/attributes.xhtml
Log:
when many (>4) select-one attributes are present, use menu instead of radio
Modified: modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/attributes.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/attributes.xhtml 2011-01-11 09:49:12 UTC (rev 20939)
+++ modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/attributes.xhtml 2011-01-11 11:33:35 UTC (rev 20940)
@@ -1,6 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:a4j="http://richfaces.org/a4j">
+ xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:fn="http://java.sun.com/jsp/jstl/functions">
<h:body>
<composite:interface>
@@ -39,12 +40,21 @@
<f:selectItem itemValue="false" itemLabel="false"/>
</h:selectOneRadio>
</c:when>
-
+
<c:when test="#{entry.value.selectOptions != null}">
- <h:selectOneRadio id="#{entry.key}Input" value="#{entry.value.value}" onchange="#{cc.attrs.type == 'server' ? 'submit()' : 'submitAjax()'}"
- layout="pageDirection">
- <f:selectItems value="#{entry.value.selectOptions}" />
- </h:selectOneRadio>
+ <c:choose>
+ <c:when test="#{fn:length(entry.value.selectOptions) > 4}">
+ <h:selectOneMenu id="#{entry.key}Input" value="#{entry.value.value}" onchange="#{cc.attrs.type == 'server' ? 'submit()' : 'submitAjax()'}">
+ <f:selectItems value="#{entry.value.selectOptions}" noSelectionValue="null" />
+ </h:selectOneMenu>
+ </c:when>
+ <c:otherwise>
+ <h:selectOneRadio id="#{entry.key}Input" value="#{entry.value.value}" onchange="#{cc.attrs.type == 'server' ? 'submit()' : 'submitAjax()'}"
+ layout="pageDirection">
+ <f:selectItems value="#{entry.value.selectOptions}" />
+ </h:selectOneRadio>
+ </c:otherwise>
+ </c:choose>
</c:when>
<c:otherwise>
14 years, 11 months
JBoss Rich Faces SVN: r20939 - in modules/tests/metamer/trunk: application/src/main/resources/org/richfaces/tests/metamer/bean and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-01-11 04:49:12 -0500 (Tue, 11 Jan 2011)
New Revision: 20939
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestImage.java
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JMediaOutputBean.java
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/A4JMediaOutputBean.properties
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jMediaOutput/image.xhtml
Log:
https://issues.jboss.org/browse/RFPL-1046
* sample for a4j:mediaOutput rewritten
* added 31 tests for media output
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JMediaOutputBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JMediaOutputBean.java 2011-01-10 22:35:38 UTC (rev 20938)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JMediaOutputBean.java 2011-01-11 09:49:12 UTC (rev 20939)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -22,9 +22,7 @@
package org.richfaces.tests.metamer.bean;
import java.awt.Color;
-import java.awt.Font;
import java.awt.Graphics2D;
-import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
@@ -96,57 +94,24 @@
public void paint(OutputStream out, Object data) throws IOException {
if (data instanceof MediaData) {
MediaData paintData = (MediaData) data;
- BufferedImage img = new BufferedImage(paintData.width, paintData.height, BufferedImage.TYPE_INT_RGB);
- Graphics2D g2d = img.createGraphics();
+ BufferedImage img = new BufferedImage(paintData.getWidth(), paintData.getHeight(), BufferedImage.TYPE_INT_RGB);
+ Graphics2D graphics2D = img.createGraphics();
+ graphics2D.clearRect(0, 0, paintData.getWidth(), paintData.getHeight());
- g2d.setColor(Color.WHITE);
- g2d.fillRect(0, 0, paintData.width, paintData.height);
+ graphics2D.setColor(Color.YELLOW);
+ graphics2D.fillRect(0, 0, paintData.width / 2, paintData.height / 2);
- int testLenght = paintData.text.length();
- int fontSize = testLenght < 8 ? 40 : 40 - (testLenght - 8);
+ graphics2D.setColor(Color.RED);
+ graphics2D.fillRect(paintData.width / 2, 0, paintData.width / 2, paintData.height / 2);
- if (fontSize < 12) {
- fontSize = 12;
- }
+ graphics2D.setColor(Color.BLUE);
+ graphics2D.fillRect(0, paintData.height / 2, paintData.width / 2, paintData.height / 2);
- Font font = new Font("Serif", Font.HANGING_BASELINE, fontSize);
+ graphics2D.setColor(Color.GREEN);
+ graphics2D.fillRect(paintData.width / 2, paintData.height / 2, paintData.width / 2, paintData.height / 2);
- g2d.setFont(font);
-
- int x = 10;
- int y = fontSize * 5 / 2;
-
- g2d.translate(x, y);
-
- Color color = new Color(paintData.color);
-
- g2d.setPaint(new Color(color.getRed(), color.getGreen(), color.getBlue(), 30));
-
- AffineTransform origTransform = g2d.getTransform();
-
- g2d.shear(-0.5 * paintData.scale, 0);
- g2d.scale(1, paintData.scale);
- g2d.drawString(paintData.text, 0, 0);
- g2d.setTransform(origTransform);
- g2d.setPaint(color);
- g2d.drawString(paintData.text, 0, 0);
- ImageIO.write(img, "jpeg", out);
+ ImageIO.write(img, "png", out);
}
-
-// if (data instanceof MediaData) {
-//
-// MediaData paintData = (MediaData) data;
-// BufferedImage img = new BufferedImage(paintData.getWidth(),paintData.getHeight(),BufferedImage.TYPE_INT_RGB);
-// Graphics2D graphics2D = img.createGraphics();
-// graphics2D.clearRect(0,0,paintData.getWidth(),paintData.getHeight());
-// graphics2D.drawLine(5,5,paintData.getWidth()-5,paintData.getHeight()-5);
-// graphics2D.drawChars(new String("RichFaces").toCharArray(),0,9,40,15);
-// graphics2D.drawChars(new String("mediaOutput").toCharArray(),0,11,5,45);
-//
-// ImageIO.write(img,"jpeg",out);
-//
-// }
-
}
private void copy(InputStream in, OutputStream out) throws IOException {
Modified: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/A4JMediaOutputBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/A4JMediaOutputBean.properties 2011-01-10 22:35:38 UTC (rev 20938)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/A4JMediaOutputBean.properties 2011-01-11 09:49:12 UTC (rev 20939)
@@ -0,0 +1,3 @@
+attr.dir.lrt=ltr
+attr.dir.rtl=rtl
+attr.dir.null=
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jMediaOutput/image.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jMediaOutput/image.xhtml 2011-01-10 22:35:38 UTC (rev 20938)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jMediaOutput/image.xhtml 2011-01-11 09:49:12 UTC (rev 20939)
@@ -6,7 +6,7 @@
<!--
JBoss, Home of Professional Open Source
-Copyright 2010, Red Hat, Inc. and individual contributors
+Copyright 2010-2011, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
@@ -63,7 +63,7 @@
ismap="#{a4jMediaOutputBean.attributes['ismap'].value}"
lang="#{a4jMediaOutputBean.attributes['lang'].value}"
lastModified="#{a4jMediaOutputBean.attributes['lastModified'].value}"
- mimeType="image/jpeg"
+ mimeType="image/png"
onblur="#{a4jMediaOutputBean.attributes['onblur'].value}"
onclick="#{a4jMediaOutputBean.attributes['onclick'].value}"
ondblclick="#{a4jMediaOutputBean.attributes['ondblclick'].value}"
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestImage.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestImage.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestImage.java 2011-01-11 09:49:12 UTC (rev 20939)
@@ -0,0 +1,270 @@
+/*******************************************************************************
+ * 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.tests.metamer.ftest.a4jMediaOutput;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.awt.Color;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.net.URL;
+
+import javax.imageio.ImageIO;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jMediaOutput/image.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestImage extends AbstractMetamerTest {
+
+ private JQueryLocator image = pjq("img[id$=mediaOutput]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jMediaOutput/image.xhtml");
+ }
+
+ @Test
+ public void testImage() {
+ AttributeLocator imageURLAttr = image.getAttribute(Attribute.SRC);
+ URL imageURL = buildUrl(contextRoot, selenium.getAttribute(imageURLAttr));
+
+ BufferedImage bufferedImage = null;
+
+ try {
+ bufferedImage = ImageIO.read(imageURL);
+ } catch (IOException ex) {
+ fail("Could not download image from URL " + imageURL.getPath());
+ }
+
+ assertEquals(bufferedImage.getHeight(), 120, "Height of the image");
+ assertEquals(bufferedImage.getWidth(), 300, "Width of the image");
+
+ for (int x = 0; x < 150; x++) {
+ for (int y = 0; y < 60; y++) {
+ assertEquals(bufferedImage.getRGB(x, y), Color.YELLOW.getRGB(), "Top-left quadrant should be yellow [" + x + ", " + y + "].");
+ }
+ }
+
+ for (int x = 151; x < 300; x++) {
+ for (int y = 0; y < 60; y++) {
+ assertEquals(bufferedImage.getRGB(x, y), Color.RED.getRGB(), "Top-right quadrant should be red [" + x + ", " + y + "].");
+ }
+ }
+
+ for (int x = 0; x < 150; x++) {
+ for (int y = 61; y < 120; y++) {
+ assertEquals(bufferedImage.getRGB(x, y), Color.BLUE.getRGB(), "Bottom-left quadrant should be blue [" + x + ", " + y + "].");
+ }
+ }
+
+ for (int x = 151; x < 300; x++) {
+ for (int y = 61; y < 120; y++) {
+ assertEquals(bufferedImage.getRGB(x, y), Color.GREEN.getRGB(), "Bottom-right quadrant should be yellow [" + x + ", " + y + "].");
+ }
+ }
+ }
+
+ @Test
+ public void testAccesskey() {
+ testHtmlAttribute("accesskey", "r");
+ }
+
+ @Test
+ public void testAlign() {
+ testHtmlAttribute("align", "left");
+ }
+
+ @Test
+ public void testBorder() {
+ testHtmlAttribute("border", "3");
+ }
+
+ @Test
+ public void testCharset() {
+ testHtmlAttribute("charset", "utf-8");
+ }
+
+ @Test
+ public void testCoords() {
+ testHtmlAttribute("coords", "circle: 150, 60, 60");
+ }
+
+ @Test
+ public void testDir() {
+ testDir(image);
+ }
+
+ @Test
+ public void testHreflang() {
+ testHtmlAttribute("hreflang", "sk");
+ }
+
+ @Test
+ public void testIsmap() {
+ AttributeLocator<?> attr = image.getAttribute(new Attribute("ismap"));
+ assertFalse(selenium.isAttributePresent(attr), "Attribute ismap should not be present.");
+
+ selenium.click(pjq("input[type=radio][name$=ismapInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ assertTrue(selenium.isAttributePresent(attr), "Attribute ismap should be present.");
+ assertEquals(selenium.getAttribute(attr), "ismap", "Attribute dir");
+ }
+
+ @Test
+ public void testOnblur() {
+ testFireEvent(Event.BLUR, image);
+ }
+
+ @Test
+ public void testOnclick() {
+ testFireEvent(Event.CLICK, image);
+ }
+
+ @Test
+ public void testOndblclick() {
+ testFireEvent(Event.DBLCLICK, image);
+ }
+
+ @Test
+ public void testOnfocus() {
+ testFireEvent(Event.FOCUS, image);
+ }
+
+ @Test
+ public void testOnkeydown() {
+ testFireEvent(Event.KEYDOWN, image);
+ }
+
+ @Test
+ public void testOnkeypress() {
+ testFireEvent(Event.KEYPRESS, image);
+ }
+
+ @Test
+ public void testOnkeyup() {
+ testFireEvent(Event.KEYUP, image);
+ }
+
+ @Test
+ public void testOnmousedown() {
+ testFireEvent(Event.MOUSEDOWN, image);
+ }
+
+ @Test
+ public void testOnmousemove() {
+ testFireEvent(Event.MOUSEMOVE, image);
+ }
+
+ @Test
+ public void testOnmouseout() {
+ testFireEvent(Event.MOUSEOUT, image);
+ }
+
+ @Test
+ public void testOnmouseover() {
+ testFireEvent(Event.MOUSEOVER, image);
+ }
+
+ @Test
+ public void testOnmouseup() {
+ testFireEvent(Event.MOUSEUP, image);
+ }
+
+ @Test
+ public void testRel() {
+ testHtmlAttribute("rel", "metamer");
+ }
+
+ @Test
+ public void testRendered() {
+ JQueryLocator input = pjq("input[type=radio][name$=renderedInput][value=false]");
+ selenium.click(input);
+ selenium.waitForPageToLoad();
+
+ assertFalse(selenium.isElementPresent(image), "Image should not be rendered when rendered=false.");
+ }
+
+ @Test
+ public void testRev() {
+ testHtmlAttribute("rev", "metamer");
+ }
+
+ @Test
+ public void testShape() {
+ testHtmlAttribute("shape", "default");
+ }
+
+ @Test
+ public void testStyle() {
+ testStyle(image, "style");
+ }
+
+ @Test
+ public void testStyleClass() {
+ testStyleClass(image, "styleClass");
+ }
+
+ @Test
+ public void testTabindex() {
+ testHtmlAttribute("tabindex", "50");
+ }
+
+ @Test
+ public void testTarget() {
+ testHtmlAttribute("target", "_blank");
+ }
+
+ @Test
+ public void testTitle() {
+ testTitle(image);
+ }
+
+ @Test
+ public void testUsemap() {
+ testHtmlAttribute("usemap", "metamer");
+ }
+
+ private void testHtmlAttribute(String attribute, String value) {
+ AttributeLocator<?> attr = image.getAttribute(new Attribute(attribute));
+ assertFalse(selenium.isAttributePresent(attr), "Attribute " + attribute + " should not be present.");
+
+ selenium.type(pjq("input[id$=" + attribute + "Input]"), value);
+ selenium.waitForPageToLoad();
+
+ assertTrue(selenium.getAttribute(attr).contains(value), "Attribute " + attribute + " should contain \"" + value + "\".");
+ }
+}
Property changes on: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestImage.java
___________________________________________________________________
Name: svn:keywords
+ Revision
14 years, 11 months
JBoss Rich Faces SVN: r20938 - in trunk: cdk/generator/src/main/java/org/richfaces/cdk/apt and 13 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-01-10 17:35:38 -0500 (Mon, 10 Jan 2011)
New Revision: 20938
Added:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ViewElement.java
Removed:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java
Modified:
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/Event.java
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/RendererSpecificComponent.java
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/TagType.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ConverterProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessorImpl.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/EventProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/FunctionProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ValidatorProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMarkerWriter.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroup.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/EventModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/DescriptionGroupBean.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/BehaviorProcessorTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/DescriptionProcessorTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
trunk/ui/core/ui/src/main/java/org/richfaces/component/UIRepeat.java
Log:
RESOLVED - issue RF-10093: https://issues.jboss.org/browse/RF-10093
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/Event.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/Event.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/Event.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -23,6 +23,8 @@
package org.richfaces.cdk.annotations;
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
import javax.faces.event.FacesListener;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
@@ -50,13 +52,18 @@
public static final String NAME = "org.richfaces.cdk.annotations.Event";
/**
+ * <p class="changed_added_4_0">Used in the {@link JsfComponent} only, to define event type.</p>
+ * @return
+ */
+ public Class<? extends FacesEvent> value() default DEFAULT.class;
+ /**
* <p class="changed_added_4_0">
- * The listener interface class that process annotated event. This is mandatory parameter.
+ * The listener interface class that process annotated event.
* </p>
*
* @return name of listener interface
*/
- public Class<? extends FacesListener> listener();
+ public Class<? extends FacesListener> listener() default DEFAULT_LISTENER.class;
/**
* <p class="changed_added_4_0">Name for the listener interface method that process annotated event type.</p>
@@ -82,4 +89,24 @@
*/
public Tag[] tag() default {};
+ @SuppressWarnings("serial")
+ static final class DEFAULT extends FacesEvent {
+
+ public DEFAULT(UIComponent component) {
+ super(component);
+ }
+
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ return false;
+ }
+
+ @Override
+ public void processListener(FacesListener listener) {
+ }
+ }
+
+ static final class DEFAULT_LISTENER implements FacesListener {
+
+ }
}
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -52,7 +52,7 @@
public String generate() default "";
- public Tag tag() default @Tag;
+ public Tag[] tag() default {};
public JsfBehaviorRenderer renderer() default @JsfBehaviorRenderer();
/**
@@ -77,4 +77,13 @@
* @return
*/
public String[] attributes() default {};
+
+ /**
+ * <p class="changed_added_4_0">
+ * Interfaces that should be implemented in the generated class. CDK processes all {@link Attribute} annotations in these interfaces
+ * </p>
+ *
+ * @return
+ */
+ public Class<?>[] interfaces() default {};
}
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -134,7 +134,7 @@
*
* @return
*/
- public Class<? extends FacesEvent>[] fires() default {};
+ public Event[] fires() default {};
/**
* <p class="changed_added_4_0">
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -56,7 +56,7 @@
*/
public Description description() default @Description();
- public Tag tag() default @Tag;
+ public Tag[] tag() default {};
public static final class NONE {}
@@ -72,5 +72,13 @@
* @return
*/
public String[] attributes() default {};
+ /**
+ * <p class="changed_added_4_0">
+ * Interfaces that should be implemented in the generated class. CDK processes all {@link Attribute} annotations in these interfaces
+ * </p>
+ *
+ * @return
+ */
+ public Class<?>[] interfaces() default {};
}
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -58,6 +58,13 @@
* @return
*/
public String family() default "";
+
+
+ /**
+ * <p class="changed_added_4_0">Name of generated renderer class.</p>
+ * @return
+ */
+ public String generate() default "";
/**
* <p class="changed_added_4_0">RenderKit for which this renderer is belong to</p>
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -19,7 +19,7 @@
public String generate() default "";
- public Tag tag() default @Tag;
+ public Tag[] tag() default {};
/**
* <p class="changed_added_4_0">
* Description used by IDE.
@@ -41,4 +41,13 @@
* @return
*/
public String[] attributes() default {};
+ /**
+ * <p class="changed_added_4_0">
+ * Interfaces that should be implemented in the generated class. CDK processes all {@link Attribute} annotations in these interfaces
+ * </p>
+ *
+ * @return
+ */
+ public Class<?>[] interfaces() default {};
+
}
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/RendererSpecificComponent.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/RendererSpecificComponent.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/RendererSpecificComponent.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -129,5 +129,13 @@
* @return
*/
public Class<?>[] interfaces() default {};
+ /**
+ * <p class="changed_added_4_0">
+ * Events fired by the component.
+ * </p>
+ *
+ * @return
+ */
+ public Event[] fires() default {};
}
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/TagType.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/TagType.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/TagType.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -28,16 +28,19 @@
*/
public enum TagType {
/**
- * <p class="changed_added_4_0">Do not generate any tags, this is default value for {@link Tag#type()} annotation.</p>
- */
- None, /**
- * <p class="changed_added_4_0">Defines JSP tag.</p>
- */
+ * <p class="changed_added_4_0">
+ * Defines JSP tag.
+ * </p>
+ */
Jsp, /**
- * <p class="changed_added_4_0">Defines Facelets tag.</p>
- */
+ * <p class="changed_added_4_0">
+ * Defines Facelets tag.
+ * </p>
+ */
Facelets, /**
- * <p class="changed_added_4_0">Enforces tag annotation to generate all known tag types</p>
- */
+ * <p class="changed_added_4_0">
+ * Enforces tag annotation to generate all known tag types
+ * </p>
+ */
All
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -25,6 +25,7 @@
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.Logger;
import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.util.PropertyUtils;
import com.google.common.base.Predicate;
@@ -160,7 +161,7 @@
AptBeanProperty beanProperty = result.get(propertyName);
checkPropertyType(type, propertyName, propertyType, beanProperty);
if (null != (setter?beanProperty.setter:beanProperty.getter)) {
- log.warn("Two " + (setter ? "setter" : "getter") + " methods for the same bean property "
+ log.debug("Two " + (setter ? "setter" : "getter") + " methods for the same bean property "
+ propertyName + " in the class " + type.getQualifiedName());
if(!method.getModifiers().contains(Modifier.ABSTRACT)){
beanProperty.setAccessMethod(method, setter);
@@ -278,8 +279,11 @@
VariableElement variable = (VariableElement) annotationValue.getValue();
return (T) Enum.valueOf((Class<? extends Enum>) expectedType, variable.getSimpleName().toString());
} else if (ClassName.class.equals(expectedType)) {
- TypeMirror value = (TypeMirror) annotationValue.getValue();
+ Object value = annotationValue.getValue();
return (T) ClassName.get(value.toString());
+ } else if (FacesId.class.equals(expectedType)) {
+ String value = (String) annotationValue.getValue();
+ return (T) FacesId.parseId(value);
} else if (AnnotationMirror.class.isAssignableFrom(expectedType)) {
AnnotationMirror value = (AnnotationMirror) annotationValue.getValue();
return (T) value;
@@ -290,7 +294,7 @@
@SuppressWarnings("unchecked")
@Override
- public <T> List<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType) {
+ public <T> Iterable<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType) {
Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> attributeEntry =
findAnnotationProperty(annotation, propertyName);
List<? extends AnnotationValue> annotationValues =
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -24,7 +24,6 @@
package org.richfaces.cdk.apt;
import java.lang.annotation.Annotation;
-import java.util.List;
import java.util.Set;
import javax.lang.model.element.AnnotationMirror;
@@ -113,7 +112,7 @@
}
@Override
- public <T> List<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType) {
+ public <T> Iterable<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType) {
// TODO Auto-generated method stub
return null;
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -24,7 +24,6 @@
package org.richfaces.cdk.apt;
import java.lang.annotation.Annotation;
-import java.util.List;
import java.util.Set;
import javax.lang.model.element.AnnotationMirror;
@@ -200,7 +199,7 @@
* @param propertyName
* @return
*/
- <T> List<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType);
+ <T> Iterable<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType);
/**
* <p class="changed_added_4_0"></p>
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -23,6 +23,7 @@
import org.richfaces.cdk.xmlconfig.CdkEntityResolver;
import org.richfaces.cdk.xmlconfig.FragmentParser;
+import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -83,19 +84,20 @@
}
} else {
SourceUtils utils = utilsProvider.get();
- utils.setModelProperty(attribute, attributeAnnotarion, "hidden");
- utils.setModelProperty(attribute, attributeAnnotarion, "literal");
- utils.setModelProperty(attribute, attributeAnnotarion, "passThrough");
- utils.setModelProperty(attribute, attributeAnnotarion, "required");
- utils.setModelProperty(attribute, attributeAnnotarion, "readOnly");
+ utils.setModelProperty(attribute, attributeAnnotarion, "hidden");
+ utils.setModelProperty(attribute, attributeAnnotarion, "literal");
+ utils.setModelProperty(attribute, attributeAnnotarion, "passThrough");
+ utils.setModelProperty(attribute, attributeAnnotarion, "required");
+ utils.setModelProperty(attribute, attributeAnnotarion, "readOnly");
if (!utils.isDefaultValue(attributeAnnotarion, "generate")) {
attribute.setGenerate(utils.getAnnotationValue(attributeAnnotarion, "generate", boolean.class));
} else {
attribute.setGenerate(!beanProperty.isExists());
}
- descriptionProcessor.processDescription(attribute, beanProperty.getAnnotation(Attribute.class).description(), beanProperty
- .getDocComment());
+ descriptionProcessor.processDescription(attribute,
+ utils.getAnnotationValue(attributeAnnotarion, "description", AnnotationMirror.class),
+ beanProperty.getDocComment());
setDefaultValue(attribute, attributeAnnotarion);
@@ -104,13 +106,13 @@
// MethodExpression call signature.
attribute.setSignature(getSignature(attributeAnnotarion));
- for (AnnotationMirror event : utils.getAnnotationValues(attributeAnnotarion, "events", AnnotationMirror.class)){
+ for (AnnotationMirror event : utils.getAnnotationValues(attributeAnnotarion, "events",
+ AnnotationMirror.class)) {
setBehaviorEvent(attribute, event);
}
}
}
-
private void setDefaultValue(PropertyBase attribute, AnnotationMirror attributeAnnotarion) {
SourceUtils utils = utilsProvider.get();
String defaultValue;
@@ -165,8 +167,8 @@
if (!SIGNATURE_NONE_CLASS_NAME.equals(returnType)) {
MethodSignature methodSignature = new MethodSignature();
- methodSignature.setParameters(utils.getAnnotationValues(signatureAnnotation, "parameters",
- ClassName.class));
+ methodSignature.setParameters(Lists.newArrayList(utils.getAnnotationValues(signatureAnnotation, "parameters",
+ ClassName.class)));
methodSignature.setReturnType(returnType);
return methodSignature;
}
@@ -174,7 +176,6 @@
return null;
}
-
private void setBehaviorEvent(PropertyBase attribute, AnnotationMirror eventMirror) {
if (null != eventMirror) {
SourceUtils utils = utilsProvider.get();
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -26,14 +26,15 @@
import java.lang.annotation.Annotation;
import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.annotations.JsfBehavior;
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.BehaviorModel;
import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.model.FacesId;
/**
* <p class="changed_added_4_0"></p>
@@ -45,17 +46,17 @@
@Override
public void process(Element element, ComponentLibrary library) throws CdkProcessingException {
- JsfBehavior behavior = element.getAnnotation(JsfBehavior.class);
+ SourceUtils sourceUtils = getSourceUtils();
+ AnnotationMirror behavior = sourceUtils.getAnnotationMirror(element, JsfBehavior.class);
- BehaviorModel behaviorModel = new BehaviorModel(new FacesId(behavior.id()));
- setClassNames((TypeElement) element, behaviorModel, behavior.generate());
+ BehaviorModel behaviorModel = new BehaviorModel();
+
+ sourceUtils.setModelProperty(behaviorModel, behavior, "id");
+ setClassNames((TypeElement) element, behaviorModel, behavior);
- setTagInfo(behavior.tag(), behaviorModel);
- AttributesProcessor attributesProcessor = getAttributeProcessor();
- attributesProcessor.processXmlFragment(behaviorModel, behavior.attributes());
- attributesProcessor.processType(behaviorModel, (TypeElement) element);
- setDescription(behaviorModel, behavior.description(), getDocComment(element));
-
+ setTagInfo(behavior, behaviorModel);
+ processAttributes((TypeElement) element, behaviorModel, behavior);
+ setDescription(behaviorModel, behavior, getDocComment(element));
library.getBehaviors().add(behaviorModel);
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -24,36 +24,24 @@
package org.richfaces.cdk.apt.processors;
import java.lang.annotation.Annotation;
-import java.util.Collection;
-import java.util.List;
import java.util.Set;
-import javax.faces.event.FacesEvent;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.MirroredTypeException;
-import javax.lang.model.type.MirroredTypesException;
-import javax.lang.model.type.TypeKind;
-import javax.lang.model.type.TypeMirror;
import org.richfaces.cdk.CdkException;
-import org.richfaces.cdk.Logger;
import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.annotations.RendererSpecificComponent;
-import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.EventModel;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.FacetModel;
-import org.richfaces.cdk.util.Strings;
-import com.google.inject.Inject;
-
/**
* <p class="changed_added_4_0">
* That class process component-related annotations such as {@link org.richfaces.cdk.annotations.JsfComponent} or
@@ -69,32 +57,32 @@
public static final String COMPONENT_TYPE = "COMPONENT_TYPE";
- @Inject
- private Logger log;
-
public void process(Element componentElement, ComponentLibrary library) {
- final JsfComponent annotation = componentElement.getAnnotation(JsfComponent.class);
- if (annotation == null) {
- return;
- }
+ SourceUtils sourceUtils = getSourceUtils();
+ if (sourceUtils.isAnnotationPresent(componentElement, JsfComponent.class)) {
+ AnnotationMirror annotation = sourceUtils.getAnnotationMirror(componentElement, JsfComponent.class);
+ // Process class-level annotations.
+ ComponentModel component = new ComponentModel();
- // Process class-level annotations.
- ComponentModel component = new ComponentModel();
+ // Should that component be generated ?
+ setClassNames((TypeElement) componentElement, component, annotation);
+ setComponentProperties((TypeElement) componentElement, component, annotation);
- // Should that component be generated ?
- setClassNames((TypeElement) componentElement, component, annotation.generate());
- setComponentProperties((TypeElement) componentElement, component, annotation);
- library.getComponents().add(component);
+ library.getComponents().add(component);
- // Process the second level annotations.
- for (final RendererSpecificComponent subcomponent : annotation.components()) {
- JsfComponent subAnnotation = new JsfSubComponent(subcomponent, annotation);
- ComponentModel subcomponentModel = new ComponentModel();
- subcomponentModel.setBaseClass(component.getTargetClass());
- subcomponentModel.setTargetClass(ClassName.parseName(subcomponent.generate()));
- subcomponentModel.setGenerate(!Strings.isEmpty(subcomponent.generate()));
- setComponentProperties(null, subcomponentModel, subAnnotation);
- library.getComponents().add(subcomponentModel);
+ // Process the second level annotations.
+ for (AnnotationMirror subcomponent : sourceUtils.getAnnotationValues(annotation, "components",
+ AnnotationMirror.class)) {
+ ComponentModel subcomponentModel = new ComponentModel();
+ subcomponentModel.setBaseClass(component.getTargetClass());
+ if (!sourceUtils.isDefaultValue(subcomponent, "generate")) {
+ subcomponentModel.setTargetClass(sourceUtils.getAnnotationValue(subcomponent, "generate",
+ ClassName.class));
+ subcomponentModel.setGenerate(true);
+ }
+ setComponentProperties(null, subcomponentModel, subcomponent);
+ library.getComponents().add(subcomponentModel);
+ }
}
}
@@ -108,91 +96,48 @@
* @param annotation
* @throws CdkException
*/
- void setComponentProperties(TypeElement componentElement, ComponentModel component, JsfComponent annotation)
+ void setComponentProperties(TypeElement componentElement, ComponentModel component, AnnotationMirror annotation)
throws CdkException {
+ SourceUtils sourceUtils = getSourceUtils();
- setComponentType(componentElement, component, annotation.type());
- setComponeneFamily(componentElement, component, annotation.family());
- setDescription(component, annotation.description(), getDocComment(componentElement));
- setRendererType(component, annotation.renderer());
-
+ setComponentType(componentElement, component, annotation);
+ setComponeneFamily(componentElement, component, annotation);
+ setDescription(component, annotation, getDocComment(componentElement));
+ if (!sourceUtils.isDefaultValue(annotation, "renderer")) {
+ setRendererType(component, sourceUtils.getAnnotationValue(annotation, "renderer", AnnotationMirror.class));
+ }
processFacets(componentElement, component, annotation);
processAttributes(componentElement, component, annotation);
processEvents(componentElement, component, annotation);
- for (Tag tag : annotation.tag()) {
- setTagInfo(tag, component);
- }
+ setTagInfo(annotation, component);
// TODO - process @Test annotations.
}
- private void setRendererType(ComponentModel component, JsfRenderer jsfRenderer) {
- if(!Strings.isEmpty(jsfRenderer.type())){
- component.setRendererType(FacesId.parseId(jsfRenderer.type()));
+ private void setRendererType(ComponentModel component, AnnotationMirror annotation) {
+ SourceUtils sourceUtils = getSourceUtils();
+ if (!sourceUtils.isDefaultValue(annotation, "type")) {
+ component.setRendererType(sourceUtils.getAnnotationValue(annotation, "type", FacesId.class));
}
- if(!Strings.isEmpty(jsfRenderer.template())){
- component.setRendererTemplate(jsfRenderer.template());
+ if (!sourceUtils.isDefaultValue(annotation, "template")) {
+ component.setRendererTemplate(sourceUtils.getAnnotationValue(annotation, "template", String.class));
}
}
- private void processAttributes(TypeElement componentElement, ComponentModel component, JsfComponent annotation) {
- AttributesProcessor attributesProcessor = getAttributeProcessor();
- attributesProcessor.processXmlFragment(component, annotation.attributes());
-
- if (componentElement != null) {
- attributesProcessor.processType(component, componentElement);
- }
-
- Collection<ClassName> interfaceNames = component.getInterfaces();
- try {
- Class<?>[] interfaces = annotation.interfaces();
- for (Class<?> clazz : interfaces) {
- interfaceNames.add(new ClassName(clazz));
- }
- } catch (MirroredTypesException e) {
- List<? extends TypeMirror> typeMirrors = e.getTypeMirrors();
- for (TypeMirror mirror : typeMirrors) {
- processInterface(component, attributesProcessor, mirror);
- }
- } catch (MirroredTypeException e) {
- processInterface(component, attributesProcessor, e.getTypeMirror());
- }
+ void setComponentType(TypeElement componentElement, ComponentModel component, AnnotationMirror annotation) {
+ component.setId(FacesId.parseId(getAnnotationPropertyOrConstant(componentElement, annotation,"type",COMPONENT_TYPE)));
}
- private void processInterface(ComponentModel component, AttributesProcessor attributesProcessor, TypeMirror mirror) {
- component.getInterfaces().add(ClassName.parseName(mirror.toString()));
- if (TypeKind.DECLARED.equals(mirror.getKind())) {
- attributesProcessor.processType(component, getSourceUtils().asTypeElement(mirror));
- } else {
- // TODO - record warning.
- }
- }
-
- void setComponentType(TypeElement componentElement, ComponentModel component, String type) {
- if (!Strings.isEmpty(type)) {
- component.setId(FacesId.parseId(type));
- } else if (null != componentElement) {
-
- // static final String COMPONENT_FAMILY = "...";
- Object value = getSourceUtils().getConstant(componentElement, COMPONENT_TYPE);
- if (value != null) {
- component.setId(FacesId.parseId(value.toString()));
- }
- }
- }
-
- final void processFacets(TypeElement componentElement, ComponentModel component, JsfComponent annotation) {
+ final void processFacets(TypeElement componentElement, ComponentModel component, AnnotationMirror annotation) {
+ SourceUtils sourceUtils = getSourceUtils();
if (null != componentElement) {
- SourceUtils sourceUtils = getSourceUtils();
Set<BeanProperty> properties = sourceUtils.getBeanPropertiesAnnotatedWith(Facet.class, componentElement);
// TODO - encapsulate attribute builder into utility class.
for (BeanProperty beanProperty : properties) {
- Facet facet = beanProperty.getAnnotation(Facet.class);
+ AnnotationMirror facet = beanProperty.getAnnotationMirror(Facet.class);
FacetModel facetModel = component.getOrCreateFacet(beanProperty.getName());
-
facetModel.setDescription(beanProperty.getDocComment());
-
processFacet(facet, facetModel, beanProperty.getDocComment());
if (!beanProperty.isExists()) {
facetModel.setGenerate(true);
@@ -200,57 +145,42 @@
}
}
- for (Facet facet : annotation.facets()) {
- String name = facet.name();
- if (!Strings.isEmpty(name)) {
+ for (AnnotationMirror facet : sourceUtils.getAnnotationValues(annotation, "facets", AnnotationMirror.class)) {
+ if (!sourceUtils.isDefaultValue(facet, "name")) {
+ String name = sourceUtils.getAnnotationValue(facet, "name", String.class);
FacetModel facetModel = component.getOrCreateFacet(name);
processFacet(facet, facetModel, null);
} else {
- // TODO - record error.
throw new CdkException("Facet name should be set");
}
}
}
- final void processFacet(Facet facet, FacetModel facetModel, String docComment) {
- setDescription(facetModel, facet.description(), docComment);
- facetModel.setGenerate(facet.generate());
+ final void processFacet(AnnotationMirror facet, FacetModel facetModel, String docComment) {
+ SourceUtils sourceUtils = getSourceUtils();
+ if (!sourceUtils.isDefaultValue(facet, "description")) {
+ setDescription(facetModel, facet, docComment);
+ }
+ if (!sourceUtils.isDefaultValue(facet, "generate")) {
+ facetModel.setGenerate(sourceUtils.getAnnotationValue(facet, "generate", Boolean.class));
+ }
}
- final void setComponeneFamily(TypeElement componentElement, ComponentModel component, String family) {
- if (!Strings.isEmpty(family)) {
- component.setFamily(FacesId.parseId(family));
- } else if (null != componentElement) {
- // static final String COMPONENT_FAMILY = "...";
- Object value = getSourceUtils().getConstant(componentElement, COMPONENT_FAMILY);
- if (null != value) {
- component.setFamily(FacesId.parseId(value.toString()));
- }
+ final void setComponeneFamily(TypeElement componentElement, ComponentModel component, AnnotationMirror annotation) {
+ if(null != componentElement){
+ component.setFamily(FacesId.parseId(getAnnotationPropertyOrConstant(componentElement, annotation,"family",COMPONENT_FAMILY)));
}
}
- final void processEvents(TypeElement componentElement, ComponentModel component, JsfComponent annotation) {
- try {
- Class<? extends FacesEvent>[] fires = annotation.fires();
-
- for (Class<? extends FacesEvent> event : fires) {
- try {
- component.addEvent(event.getName());
- } catch (MirroredTypesException mirror) {
- for (TypeMirror eventType : mirror.getTypeMirrors()) {
- component.addEvent(eventType.toString());
- }
- } catch (MirroredTypeException mirror) {
- component.addEvent(mirror.getTypeMirror().toString());
- }
-
- }
- } catch (MirroredTypesException mirror) {
- for (TypeMirror eventType : mirror.getTypeMirrors()) {
- component.addEvent(eventType.toString());
- }
- } catch (MirroredTypeException mirror) {
- component.addEvent(mirror.getTypeMirror().toString());
+ final void processEvents(TypeElement componentElement, ComponentModel component, AnnotationMirror annotation) {
+ SourceUtils sourceUtils = getSourceUtils();
+ for (AnnotationMirror event : sourceUtils.getAnnotationValues(annotation, "fires", AnnotationMirror.class)) {
+ EventModel model = new EventModel();
+ sourceUtils.setModelProperty(model, event, "type", "value");
+ sourceUtils.setModelProperty(model, event, "listenerInterface", "listener");
+ sourceUtils.setModelProperty(model, event, "listenerMethod");
+ sourceUtils.setModelProperty(model, event, "sourceInterface", "source");
+ component.getEvents().add(model);
}
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ConverterProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ConverterProcessor.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ConverterProcessor.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -24,16 +24,14 @@
import java.lang.annotation.Annotation;
import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.MirroredTypeException;
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.annotations.JsfConverter;
-import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConverterModel;
-import org.richfaces.cdk.model.FacesId;
/**
* @author akolonitsky
@@ -44,32 +42,16 @@
@Override
public void process(Element element, ComponentLibrary library) throws CdkProcessingException {
- JsfConverter converter = element.getAnnotation(JsfConverter.class);
+ SourceUtils sourceUtils = getSourceUtils();
+ AnnotationMirror converter = sourceUtils.getAnnotationMirror(element, JsfConverter.class);
ConverterModel converterModel = new ConverterModel();
- converterModel.setId(FacesId.parseId(converter.id()));
+ sourceUtils.setModelProperty(converterModel, converter, "id");
+ sourceUtils.setModelProperty(converterModel, converter, "converterForClass","forClass");
- try {
- Class<?> forClass = converter.forClass();
- if (!JsfConverter.NONE.class.equals(forClass)) {
- converterModel.setConverterForClass(new ClassName(forClass.getName()));
- }
- } catch (MirroredTypeException e) {
- String name = e.getTypeMirror().toString();
- if (!JsfConverter.NONE.class.getName().equals(name)) {
- converterModel.setConverterForClass(new ClassName(name));
- }
- }
-
- setDescription(converterModel, converter.description(), getDocComment(element));
-
- AttributesProcessor attributesProcessor = getAttributeProcessor();
- attributesProcessor.processXmlFragment(converterModel, converter.attributes());
- attributesProcessor.processType(converterModel, (TypeElement) element);
- setClassNames((TypeElement) element, converterModel, converter.generate());
-
- setTagInfo(converter.tag(), converterModel);
-
+ setDescription(converterModel, converter, getDocComment(element));
+ processAttributes(element, converterModel, converter);
+ setTagInfo(converter, converterModel);
library.getConverters().add(converterModel);
}
@@ -77,11 +59,4 @@
public Class<? extends Annotation> getProcessedAnnotation() {
return JsfConverter.class;
}
-
-
- protected String[] getAnnotationAttributes(TypeElement element) {
- JsfConverter converter = element.getAnnotation(JsfConverter.class);
-
- return converter.attributes();
- }
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessor.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessor.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -23,7 +23,8 @@
package org.richfaces.cdk.apt.processors;
-import org.richfaces.cdk.annotations.Description;
+import javax.lang.model.element.AnnotationMirror;
+
import org.richfaces.cdk.model.DescriptionGroup;
/**
@@ -36,15 +37,15 @@
/**
* <p class="changed_added_4_0">process {@link Description} annotation and set information from it into model. Optional string from the JavaDoc comment has precedence over {@link Desription#value()} attribute.</p>
* @param model
- * @param description
+ * @param annotation
* @param docComment JavaDoc comment associated with described element.
*/
- public void processDescription(DescriptionGroup model, Description description, String docComment);
+ public void processDescription(DescriptionGroup model, AnnotationMirror annotation, String docComment);
/**
* <p class="changed_added_4_0">process {@link Description} annotation and set information from it into model.</p>
* @param model
* @param description
*/
- public void processDescription(DescriptionGroup model, Description description);
+ public void processDescription(DescriptionGroup model, AnnotationMirror description);
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessorImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessorImpl.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessorImpl.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -23,51 +23,56 @@
package org.richfaces.cdk.apt.processors;
-import org.richfaces.cdk.annotations.Description;
+import javax.lang.model.element.AnnotationMirror;
+
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.DescriptionGroup;
import org.richfaces.cdk.util.Strings;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
/**
- * <p class="changed_added_4_0"></p>
- *
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
*/
public class DescriptionProcessorImpl implements DescriptionProcessor {
+ private final Provider<SourceUtils> utilsProvider;
+
+ @Inject
+ public DescriptionProcessorImpl(Provider<SourceUtils> utilsProvider) {
+ this.utilsProvider = utilsProvider;
+ }
+
@Override
- public void processDescription(DescriptionGroup model, Description description, String docComment) {
+ public void processDescription(DescriptionGroup model, AnnotationMirror description, String docComment) {
if (!Strings.isEmpty(docComment)) {
model.setDescription(docComment);
}
if (description != null) {
+ SourceUtils utils = utilsProvider.get();
setIcon(model, description);
- if (!Strings.isEmpty(description.displayName())) {
- model.setDisplayname(description.displayName());
- }
- if (!Strings.isEmpty(description.value())) {
- model.setDescription(description.value());
- }
+ utils.setModelProperty(model, description, "displayName");
+ utils.setModelProperty(model, description, "description","value");
}
}
@Override
- public void processDescription(DescriptionGroup model, Description description) {
+ public void processDescription(DescriptionGroup model, AnnotationMirror description) {
processDescription(model, description, null);
}
- protected void setIcon(DescriptionGroup component, Description icon) {
- if (null != icon && (!Strings.isEmpty(icon.smallIcon()) || !Strings.isEmpty(icon.largeIcon()))) {
+ protected void setIcon(DescriptionGroup component, AnnotationMirror description) {
+ SourceUtils utils = utilsProvider.get();
+ if (null != description
+ && (!utils.isDefaultValue(description, "smallIcon") || !utils.isDefaultValue(description, "largeIcon"))) {
DescriptionGroup.Icon iconValue = new DescriptionGroup.Icon();
-
- if (!Strings.isEmpty(icon.smallIcon())) {
- iconValue.setSmallIcon(icon.smallIcon());
- }
-
- if (!Strings.isEmpty(icon.largeIcon())) {
- iconValue.setLargeIcon(icon.largeIcon());
- }
-
+ utils.setModelProperty(iconValue, description, "smallIcon");
+ utils.setModelProperty(iconValue, description, "largeIcon");
component.setIcon(iconValue);
}
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/EventProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/EventProcessor.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/EventProcessor.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -25,28 +25,31 @@
import java.lang.annotation.Annotation;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.MirroredTypeException;
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.annotations.Event;
-import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.cdk.annotations.TagType;
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.EventModel;
-import org.richfaces.cdk.util.Strings;
/**
- * <p class="changed_added_4_0">This class processes annotations for FacesEvents.</p>
+ * <p class="changed_added_4_0">
+ * This class processes annotations for FacesEvents.
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
public class EventProcessor extends ProcessorBase implements CdkAnnotationProcessor {
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.apt.processors.CdkAnnotationProcessor#getProcessedAnnotation()
*/
@Override
@@ -54,31 +57,24 @@
return Event.class;
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.apt.processors.CdkAnnotationProcessor#process(javax.lang.model.element.Element, org.richfaces.cdk.model.ComponentLibrary)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.apt.processors.CdkAnnotationProcessor#process(javax.lang.model.element.Element,
+ * org.richfaces.cdk.model.ComponentLibrary)
*/
@Override
public void process(Element element, ComponentLibrary library) throws CdkProcessingException {
if (ElementKind.CLASS.equals(element.getKind())) {
+ SourceUtils sourceUtils = getSourceUtils();
TypeElement eventType = (TypeElement) element;
- Event event = eventType.getAnnotation(Event.class);
+ AnnotationMirror event = sourceUtils.getAnnotationMirror(element, Event.class);
EventModel model = new EventModel();
model.setType(ClassName.parseName(eventType.getQualifiedName().toString()));
- try {
- model.setListenerInterface(ClassName.parseName(event.listener().toString()));
- } catch (MirroredTypeException mirror) {
- model.setListenerInterface(ClassName.parseName(mirror.getTypeMirror().toString()));
- }
- String listenerMethod = event.listenerMethod();
- if(!Strings.isEmpty(listenerMethod)){
- model.setListenerMethod(listenerMethod);
- }
- model.setSourceInterface(ClassName.parseName(event.source()));
- for (Tag tag : event.tag()) {
- if(!TagType.None.equals(tag.type())){
- model.getTags().add(processTag(tag));
- }
- }
+ sourceUtils.setModelProperty(model, event, "listenerInterface", "listener");
+ sourceUtils.setModelProperty(model, event, "listenerMethod");
+ sourceUtils.setModelProperty(model, event, "sourceInterface", "source");
+ setTagInfo(event, model);
library.getEvents().add(model);
}
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/FunctionProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/FunctionProcessor.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/FunctionProcessor.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -26,6 +26,7 @@
import java.lang.annotation.Annotation;
import java.util.Set;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
@@ -35,11 +36,14 @@
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.annotations.Function;
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.FunctionModel;
-import org.richfaces.cdk.util.Strings;
+import com.google.common.base.Joiner;
+import com.google.common.collect.Iterables;
+
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
@@ -47,6 +51,14 @@
*/
public class FunctionProcessor extends ProcessorBase implements CdkAnnotationProcessor {
+ private static final Joiner PARAMETERS_JOINER = Joiner.on(',').skipNulls();
+ private static final com.google.common.base.Function<VariableElement,String> PARAMETER_CONVERTER = new com.google.common.base.Function<VariableElement,String>(){
+
+ @Override
+ public String apply(VariableElement var) {
+ return var.asType().toString();
+ }
+ };
/* (non-Javadoc)
* @see org.richfaces.cdk.apt.processors.CdkAnnotationProcessor#getProcessedAnnotation()
*/
@@ -60,6 +72,7 @@
*/
@Override
public void process(Element element, ComponentLibrary library) throws CdkProcessingException {
+ SourceUtils utils = getSourceUtils();
switch (element.getKind()) {
case METHOD:
ExecutableElement methodElement = (ExecutableElement) element;
@@ -72,27 +85,20 @@
if(!modifiers.contains(Modifier.STATIC)){
throw new CdkProcessingException("Only static method can be registered as EL function "+methodElement.getSimpleName());
}
- Function function = methodElement.getAnnotation(Function.class);
+ AnnotationMirror function = utils.getAnnotationMirror(methodElement, Function.class);
FunctionModel model = new FunctionModel();
- if(!Strings.isEmpty(function.name())){
- model.setName(function.name());
+ if(!utils.isDefaultValue(function, "name")){
+ utils.setModelProperty(model, function, "name");
} else {
model.setName(methodElement.getSimpleName().toString());
}
- model.setType(function.type());
- setDescription(model, function.description(), getDocComment(methodElement));
+ utils.setModelProperty(model, function, "type");
+ setDescription(model, function, getDocComment(methodElement));
// Calculate method signature
StringBuilder signature = new StringBuilder();
signature.append(methodElement.getReturnType()).append(" ");
signature.append(methodElement.getSimpleName()).append("(");
- boolean first = true;
- for(VariableElement parameter :methodElement.getParameters()){
- if(!first){
- signature.append(",");
- }
- signature.append(parameter.asType());
- first = false;
- }
+ PARAMETERS_JOINER.appendTo(signature, Iterables.transform(methodElement.getParameters(), PARAMETER_CONVERTER));
signature.append(")");
model.setSignature(signature.toString());
Element declaringClass = methodElement.getEnclosingElement();
Deleted: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -1,120 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright , 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.apt.processors;
-
-import java.lang.annotation.Annotation;
-
-import javax.faces.event.FacesEvent;
-
-import org.richfaces.cdk.annotations.Description;
-import org.richfaces.cdk.annotations.Facet;
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.annotations.RendererSpecificComponent;
-import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.cdk.annotations.Test;
-
-/**
- * This calss wraps {@link RendererSpecificComponent} annotation so it would be used by {@link ComponentProcessor} methods, so they
- * can be reused for different types of the component annotations.
- *
- * @author akolonitsky
- * @since Mar 31, 2010
- */
-public class JsfSubComponent implements JsfComponent {
-
- private final RendererSpecificComponent subcomponent;
-
- private final JsfComponent parent;
-
- public JsfSubComponent(RendererSpecificComponent subcomponent, JsfComponent parent) {
- this.subcomponent = subcomponent;
- this.parent = parent;
- }
-
- @Override
- public Class<? extends Annotation> annotationType() {
- return JsfComponent.class;
- }
-
- @Override
- public String type() {
- return this.subcomponent.type();
- }
-
- @Override
- public Test test() {
- return this.subcomponent.test();
- }
-
- @Override
- public Tag[] tag() {
- return this.subcomponent.tag();
- }
-
- @Override
- public JsfRenderer renderer() {
- return this.subcomponent.renderer();
- }
-
- @Override
- public Class<?>[] interfaces() {
- return this.subcomponent.interfaces();
- }
-
- @Override
- public String generate() {
- return this.subcomponent.generate();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends FacesEvent>[] fires() {
- return new Class[0];
- }
-
- @Override
- public String family() {
- return this.parent.family();
- }
-
- @Override
- public Facet[] facets() {
- return this.subcomponent.facets();
- }
-
- @Override
- public Description description() {
- return this.subcomponent.description();
- }
-
- @Override
- public RendererSpecificComponent[] components() {
- return new RendererSpecificComponent[0];
- }
-
- @Override
- public String[] attributes() {
- return this.subcomponent.attributes();
- }
-}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -1,27 +1,33 @@
package org.richfaces.cdk.apt.processors;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import org.richfaces.cdk.Logger;
import org.richfaces.cdk.NamingConventions;
-import org.richfaces.cdk.annotations.Description;
-import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.TagType;
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.DescriptionGroup;
+import org.richfaces.cdk.model.ModelCollection;
import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.TagModel;
-import org.richfaces.cdk.util.Strings;
+import org.richfaces.cdk.model.ViewElement;
import com.google.inject.Inject;
import com.google.inject.Provider;
-public abstract class ProcessorBase {
+public abstract class ProcessorBase {
-
@Inject
+ protected Logger log;
+
+ @Inject
private Provider<SourceUtils> sourceUtils;
@Inject
@@ -29,7 +35,7 @@
@Inject
private NamingConventions namingConventions;
-
+
@Inject
private DescriptionProcessor descriptionProcessor;
@@ -37,46 +43,47 @@
return this.sourceUtils.get();
}
- protected void setTagInfo(Tag tag, ModelElementBase model) {
-
- if (!TagType.None.equals(tag.type())) {
+ protected void setTagInfo(AnnotationMirror annotation, ViewElement model) {
+ SourceUtils sourceUtils = getSourceUtils();
+ ModelCollection<TagModel> tags = model.getTags();
+ for (AnnotationMirror tag : sourceUtils.getAnnotationValues(annotation, "tag", AnnotationMirror.class)) {
TagModel tagModel = processTag(tag);
-
- model.getTags().add(tagModel);
-
+ tags.add(tagModel);
}
}
- protected TagModel processTag(Tag tag) {
+ protected TagModel processTag(AnnotationMirror tag) {
TagModel tagModel = new TagModel();
- String name = tag.name();
- tagModel.setName(name);
- tagModel.setType(tag.type());
- tagModel.setTargetClass(ClassName.parseName(tag.handler()));
- tagModel.setBaseClass(ClassName.parseName(tag.baseClass()));
- tagModel.setGenerate(tag.generate());
+ SourceUtils sourceUtils = getSourceUtils();
+ sourceUtils.setModelProperty(tagModel, tag, "name");
+ tagModel.setType(sourceUtils.getAnnotationValue(tag, "type", TagType.class));
+ sourceUtils.setModelProperty(tagModel, tag, "targetClass", "handler");
+ sourceUtils.setModelProperty(tagModel, tag, "baseClass");
+ sourceUtils.setModelProperty(tagModel, tag, "generate");
return tagModel;
}
- protected void setClassNames(TypeElement componentElement, ModelElementBase modelElement,
- String generatedClass) {
-
- if (componentElement.getModifiers().contains(Modifier.ABSTRACT) || !Strings.isEmpty(generatedClass)) {
+ protected void setClassNames(TypeElement componentElement, ModelElementBase modelElement, AnnotationMirror behavior) {
+ SourceUtils sourceUtils = getSourceUtils();
+ if (componentElement.getModifiers().contains(Modifier.ABSTRACT)
+ || !sourceUtils.isDefaultValue(behavior, "generate")) {
modelElement.setGenerate(true);
- modelElement.setTargetClass(ClassName.parseName(generatedClass));
+ sourceUtils.setModelProperty(modelElement, behavior, "targetClass", "generate");
} else {
modelElement.setGenerate(false);
+ modelElement.setTargetClass(ClassName.parseName(componentElement.getQualifiedName().toString()));
}
modelElement.setBaseClass(ClassName.parseName(componentElement.getQualifiedName().toString()));
}
-
protected String getDocComment(Element element) {
return null != element ? getSourceUtils().getDocComment(element) : null;
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the attributeProcessor
*/
protected AttributesProcessor getAttributeProcessor() {
@@ -91,7 +98,44 @@
this.namingConventions = namingConventions;
}
- protected void setDescription(DescriptionGroup model, Description description, String docComment) {
- descriptionProcessor.processDescription(model, description, docComment);
+ protected void setDescription(DescriptionGroup model, AnnotationMirror annotation, String docComment) {
+ descriptionProcessor.processDescription(model,
+ getSourceUtils().getAnnotationValue(annotation, "description", AnnotationMirror.class), docComment);
}
+
+ protected void processAttributes(Element element, ModelElementBase component, AnnotationMirror annotation) {
+ AttributesProcessor attributesProcessor = getAttributeProcessor();
+ SourceUtils sourceUtils = getSourceUtils();
+ for (String atributesFragment : sourceUtils.getAnnotationValues(annotation, "attributes", String.class)) {
+ attributesProcessor.processXmlFragment(component, atributesFragment);
+ }
+ if (element != null && ElementKind.CLASS.equals(element.getKind())) {
+ attributesProcessor.processType(component, (TypeElement) element);
+ }
+ for (TypeMirror atributesInterface : sourceUtils
+ .getAnnotationValues(annotation, "interfaces", TypeMirror.class)) {
+ processInterface(component, attributesProcessor, atributesInterface);
+ }
+ }
+
+ private void processInterface(ModelElementBase component, AttributesProcessor attributesProcessor, TypeMirror mirror) {
+ component.getInterfaces().add(ClassName.parseName(mirror.toString()));
+ if (TypeKind.DECLARED.equals(mirror.getKind())) {
+ attributesProcessor.processType(component, getSourceUtils().asTypeElement(mirror));
+ } else {
+ // TODO - record warning.
+ }
+ }
+
+ protected String getAnnotationPropertyOrConstant(TypeElement element, AnnotationMirror annotation, String annotationAttribute, String fieldName) {
+ SourceUtils utils = getSourceUtils();
+ if (!utils.isDefaultValue(annotation, annotationAttribute)) {
+ return utils.getAnnotationValue(annotation, annotationAttribute,String.class);
+ }
+ Object value = utils.getConstant((TypeElement) element, fieldName);
+ if (value != null) {
+ return value.toString();
+ }
+ return null;
+ }
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -24,23 +24,18 @@
import java.lang.annotation.Annotation;
import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.faces.render.RenderKitFactory;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
-import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.TypeKind;
-import javax.lang.model.type.TypeMirror;
-import org.richfaces.cdk.Logger;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.util.Strings;
-import com.google.inject.Inject;
/**
* @author akolonitsky
@@ -53,61 +48,29 @@
private static final String RENDERER_TYPE = "RENDERER_TYPE";
- @Inject
- private Logger log;
-
-
public void process(Element rendererElement, ComponentLibrary library) {
- JsfRenderer annotation = rendererElement.getAnnotation(JsfRenderer.class);
+ SourceUtils sourceUtils = getSourceUtils();
+ AnnotationMirror annotation = sourceUtils.getAnnotationMirror(rendererElement, JsfRenderer.class);
- RendererModel rendererModel = process((TypeElement) rendererElement, annotation, library);
-
- addToRenderKit(annotation, library, rendererModel);
-
- }
-
- public RendererModel process(TypeElement rendererElement, JsfRenderer annotation, ComponentLibrary library) {
RendererModel rendererModel = new RendererModel();
- setClassNames(rendererElement, rendererModel, null);
+ TypeElement rendererTypeElement = (TypeElement) rendererElement;
+ setClassNames(rendererTypeElement, rendererModel, annotation);
- setRendererType(rendererElement, rendererModel, annotation);
- setComponentFamily(rendererElement, rendererModel, annotation);
- setDescription(rendererModel, annotation.description(), getDocComment(rendererElement));
+ setRendererType(rendererTypeElement, rendererModel, annotation);
+
+ setComponentFamily(rendererTypeElement, rendererModel, annotation);
+ setDescription(rendererModel, annotation, getDocComment(rendererElement));
- setTemplate(rendererModel, annotation);
+ sourceUtils.setModelProperty(rendererModel, annotation, "templatePath","template");
- // TODO - process @Test annotations.
- return rendererModel;
- }
+ String renderKitId = sourceUtils.getAnnotationValue(annotation, "renderKitId", String.class);
+ library.addRenderer(renderKitId, rendererModel);
- protected void setClassNames(TypeElement componentElement, RendererModel modelElement, String generatedClass) {
-
- if (componentElement.getModifiers().contains(Modifier.ABSTRACT) || !Strings.isEmpty(generatedClass)) {
- modelElement.setGenerate(true);
- modelElement.setRendererClass(ClassName.parseName(generatedClass));
- modelElement.setBaseClass(ClassName.parseName(componentElement.getQualifiedName().toString()));
- } else {
- modelElement.setGenerate(false);
- modelElement.setRendererClass(ClassName.parseName(componentElement.getQualifiedName().toString()));
-
- TypeMirror superclass = componentElement.getSuperclass();
- if (superclass.getKind() == TypeKind.DECLARED) {
- TypeElement typeElement = getSourceUtils().asTypeElement(superclass);
- modelElement.setBaseClass(ClassName.parseName(typeElement.getQualifiedName().toString()));
- }
- }
-
}
- private void addToRenderKit(JsfRenderer annotation, ComponentLibrary library, RendererModel rendererModel) {
- String renderKitId = annotation.renderKitId();
- if (Strings.isEmpty(renderKitId)) {
- renderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT; // TODO ???
- }
- library.addRenderer(renderKitId, rendererModel);
- }
+
private void setTemplate(RendererModel rendererModel, JsfRenderer annotation) {
String template = annotation.template();
if (!Strings.isEmpty(template)) {
@@ -116,39 +79,14 @@
}
- private void setComponentFamily(TypeElement rendererElement, RendererModel rendererModel, JsfRenderer annotation) {
- String family = annotation.family();
- if (!Strings.isEmpty(family)) {
- rendererModel.setFamily(FacesId.parseId(family));
- return;
- } else {
-
- Object value = getSourceUtils().getConstant(rendererElement, COMPONENT_FAMILY);
- if (value != null) {
- rendererModel.setFamily(FacesId.parseId(value.toString()));
- return;
- }
- }
+ private void setComponentFamily(TypeElement rendererElement, RendererModel rendererModel, AnnotationMirror annotation) {
+ rendererModel.setFamily(FacesId.parseId(getAnnotationPropertyOrConstant(rendererElement, annotation,"family",COMPONENT_FAMILY)));
}
- private String getRendererType(TypeElement rendererElement, JsfRenderer annotation) {
- String type = annotation.type();
- if (!Strings.isEmpty(type)) {
- return type;
- }
-
- Object value = getSourceUtils().getConstant(rendererElement, RENDERER_TYPE);
- if (value != null) {
- return value.toString();
- }
-
- return null;
+ private void setRendererType(TypeElement rendererElement, RendererModel rendererModel, AnnotationMirror annotation) {
+ rendererModel.setId(FacesId.parseId(getAnnotationPropertyOrConstant(rendererElement, annotation,"type",RENDERER_TYPE)));
}
- private void setRendererType(TypeElement rendererElement, RendererModel rendererModel, JsfRenderer annotation) {
- rendererModel.setId(FacesId.parseId(getRendererType(rendererElement, annotation)));
- }
-
protected String getComponentType(TypeElement componentElement) {
JsfComponent annotation = componentElement.getAnnotation(JsfComponent.class);
if (annotation != null) {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ValidatorProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ValidatorProcessor.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ValidatorProcessor.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -24,13 +24,14 @@
import java.lang.annotation.Annotation;
import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.annotations.JsfValidator;
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.ValidatorModel;
/**
@@ -42,13 +43,15 @@
@Override
public void process(Element element, ComponentLibrary library) throws CdkProcessingException {
- JsfValidator validator = element.getAnnotation(JsfValidator.class);
+ SourceUtils utils = getSourceUtils();
+ AnnotationMirror validator = utils.getAnnotationMirror(element,JsfValidator.class);
- ValidatorModel validatorModel = new ValidatorModel(FacesId.parseId(validator.id()));
- setClassNames((TypeElement) element, validatorModel, validator.generate());
- setDescription(validatorModel, validator.description(), getDocComment(element));
+ ValidatorModel validatorModel = new ValidatorModel();
+ utils.setModelProperty(validatorModel, validator, "id");
+ setClassNames((TypeElement) element, validatorModel, validator);
+ setDescription(validatorModel, validator, getDocComment(element));
- setTagInfo(validator.tag(), validatorModel);
+ setTagInfo(validator, validatorModel);
library.getValidators().add(validatorModel);
}
@@ -57,10 +60,4 @@
public Class<? extends Annotation> getProcessedAnnotation() {
return JsfValidator.class;
}
-
-
- protected String[] getAnnotationAttributes(TypeElement element) {
- JsfValidator validator = element.getAnnotation(JsfValidator.class);
- return validator.attributes();
- }
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMarkerWriter.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMarkerWriter.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMarkerWriter.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -36,6 +36,7 @@
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.Trackable;
+import org.richfaces.cdk.model.ViewElement;
import freemarker.template.TemplateException;
@@ -86,7 +87,7 @@
}
protected String getOutputFileName(C c) throws CdkException {
- if (c instanceof ModelElementBase) {
+ if (c instanceof ViewElement) {
ModelElementBase modelElement = (ModelElementBase) c;
return modelElement.getTargetClass().getName().replace('.', File.separatorChar) + ".java";
} else {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -26,9 +26,9 @@
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.EventModel;
import org.richfaces.cdk.model.FacesId;
-import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.TagModel;
+import org.richfaces.cdk.model.ViewElement;
import freemarker.ext.beans.BeansWrapper;
import freemarker.ext.beans.StringModel;
@@ -72,7 +72,7 @@
return create(obj, EventTemplateModel.FACTORY);
} else if (obj instanceof TagModel) {
return create(obj, TagTemplateModel.FACTORY);
- } else if (obj instanceof ModelElementBase) {
+ } else if (obj instanceof ViewElement) {
return create(obj, ModelElementBaseTemplateModel.FACTORY);
} else {
return super.wrap(obj);
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -122,39 +122,46 @@
public TemplateModel getImportClasses() throws TemplateModelException {
Set<ClassName> result = Sets.newTreeSet();
-
+ String targetPackage = model.getTargetClass().getPackage();
for (PropertyBase entry : model.getAttributes()) {
- if (entry.getGenerate() && !isPredefined(entry)) {
- result.add(entry.getType());
+ if (entry.getGenerate()) {
+ addIfNecessary(targetPackage, result, entry.getType());
}
}
// Import all interfaces implemented by the generated class.
result.addAll(model.getInterfaces());
if (model instanceof ComponentModel) {
ComponentModel component = (ComponentModel) model;
- for(EventModel event :component.getEvents()){
- result.add(event.getSourceInterface());
- result.add(event.getListenerInterface());
+ for (EventModel event : component.getEvents()) {
+ addIfNecessary(targetPackage, result, event.getSourceInterface());
+ addIfNecessary(targetPackage, result, event.getListenerInterface());
}
}
// Collection<String> list = new ArrayList<String>(result);
return this.wrapper.wrap(result);
}
+
+ private void addIfNecessary(String pkg, Set<ClassName> classNames, ClassName toadd) {
+ if (null != toadd && !isPredefined(toadd) && !pkg.equals(toadd.getPackage())) {
+ classNames.add(toadd);
+ }
+ }
+
public TemplateModel getTagImports() throws TemplateModelException {
Set<ClassName> result = Sets.newTreeSet();
for (PropertyBase entry : model.getAttributes()) {
- if (!(entry.isHidden()||entry.isReadOnly()||null == entry.getSignature())) {
+ if (!(entry.isHidden() || entry.isReadOnly() || null == entry.getSignature())) {
MethodSignature methodSignature = entry.getSignature();
- if(!isPredefined(methodSignature.getReturnType())){
+ if (!isPredefined(methodSignature.getReturnType())) {
result.add(methodSignature.getReturnType());
}
for (ClassName className : methodSignature.getParameters()) {
- if(!isPredefined(className)){
+ if (!isPredefined(className)) {
result.add(className);
}
-
+
}
}
}
@@ -173,15 +180,18 @@
public TemplateModel getImplementedInterfaces() throws TemplateModelException {
Set<ClassName> result = Sets.newTreeSet();
- if(getEventNames().size()>0){
+ if (getEventNames().size() > 0) {
result.add(ClassName.parseName("javax.faces.component.behavior.ClientBehaviorHolder"));
}
// Import all interfaces implemented by the generated class.
result.addAll(model.getInterfaces());
if (model instanceof ComponentModel) {
ComponentModel component = (ComponentModel) model;
- for(EventModel event :component.getEvents()){
- result.add(event.getSourceInterface());
+ for (EventModel event : component.getEvents()) {
+ ClassName sourceInterface = event.getSourceInterface();
+ if (null != sourceInterface) {
+ result.add(sourceInterface);
+ }
}
}
// Collection<String> list = new ArrayList<String>(result);
@@ -193,7 +203,7 @@
}
public boolean isPredefined(ClassName type) {
- return type.isPrimitive() ||"java.lang".equals(type.getPackage());
+ return type.isPrimitive() || "java.lang".equals(type.getPackage());
}
private TemplateModel eventNames() throws TemplateModelException {
@@ -254,7 +264,7 @@
@Override
public boolean apply(PropertyBase input) {
- return !(input.isHidden()||input.isReadOnly());
+ return !(input.isHidden() || input.isReadOnly());
}
}));
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -288,8 +288,8 @@
if (!Strings.isEmpty(model.getDescription())) {
parent.addElement("description").addText(model.getDescription());
}
- if (!Strings.isEmpty(model.getDisplayname())) {
- parent.addElement("display-name").addText(model.getDisplayname());
+ if (!Strings.isEmpty(model.getDisplayName())) {
+ parent.addElement("display-name").addText(model.getDisplayName());
}
if (null != model.getIcon()) {
Element iconElement = parent.addElement("icon");
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -159,15 +159,18 @@
return events;
}
- public EventModel addEvent(String className) {
+ public EventModel addEvent(ClassName className) {
- // TODO - use a single events collection from library.
EventModel event = new EventModel();
- event.setType(new ClassName(className));
+ event.setType(className);
events.add(event);
return event;
}
+ public EventModel addEvent(String className) {
+ return addEvent(ClassName.get(className));
+ }
+
@Override
public String toString() {
return "Component {type: " + getId() + ", family: " + getFamily() + "}";
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroup.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroup.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroup.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -36,7 +36,7 @@
*/
@XmlElement(name = "display-name")
@Merge
- public String getDisplayname();
+ public String getDisplayName();
/**
* <p class="changed_added_4_0">
@@ -44,7 +44,7 @@
*
* @param displayname the displayname to set
*/
- public void setDisplayname(String displayname);
+ public void setDisplayName(String displayname);
/**
* <p class="changed_added_4_0">
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -65,11 +65,11 @@
}
@Merge
- public final String getDisplayname() {
+ public final String getDisplayName() {
return displayname;
}
- public final void setDisplayname(String displayname) {
+ public final void setDisplayName(String displayname) {
this.displayname = displayname;
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/EventModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/EventModel.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/EventModel.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -41,7 +41,7 @@
@SuppressWarnings("serial")
@XmlType(name = "event-configType", namespace = ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
-public class EventModel implements ModelElement<EventModel> {
+public class EventModel implements ModelElement<EventModel>, ViewElement {
private String description;
private ClassName listenerInterface;
private String listenerMethod;
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -10,7 +10,7 @@
* @author asmirnov(a)exadel.com
*
*/
-public class ModelElementBase extends BeanModelBase implements FacesComponent {
+public class ModelElementBase extends BeanModelBase implements FacesComponent, ViewElement {
private FacesId id;
@@ -23,10 +23,10 @@
private final Collection<ClassName> interfaces = Lists.newArrayList();
- /**
- * <p class="changed_added_4_0"></p>
- * @return the tags
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.model.ViewElement#getTags()
*/
+ @Override
public ModelCollection<TagModel> getTags() {
return this.tags;
}
Added: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ViewElement.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ViewElement.java (rev 0)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ViewElement.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -0,0 +1,11 @@
+package org.richfaces.cdk.model;
+
+public interface ViewElement {
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the tags
+ */
+ ModelCollection<TagModel> getTags();
+
+}
\ No newline at end of file
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -319,22 +319,19 @@
protected void verifyEvents(ComponentLibrary library) {
for (EventModel event : library.getEvents()) {
ClassName listenerInterface = event.getListenerInterface();
- if (null == listenerInterface) {
- // TODO - infer listener interface name.
- }
SourceUtils sourceUtils = sourceUtilsProvider.get();
- event.setGenerateListener(!sourceUtils.isClassExists(listenerInterface));
+ if (null != listenerInterface) {
+ event.setGenerateListener(!sourceUtils.isClassExists(listenerInterface));
+ }
String methodName = event.getListenerMethod();
if (null == methodName) {
- // TODO infer listener method name.
methodName = "process";
event.setListenerMethod(methodName);
}
ClassName sourceInterface = event.getSourceInterface();
- if (null == sourceInterface) {
- // TODO - infer source interface.
+ if (null != sourceInterface) {
+ event.setGenerateSource(!sourceUtils.isClassExists(sourceInterface));
}
- event.setGenerateSource(!sourceUtils.isClassExists(sourceInterface));
// Propagate event to corresponding components.
for (ComponentModel component : library.getComponents()) {
for (EventModel componentEvent : component.getEvents()) {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -246,7 +246,7 @@
// TODO is it the right one?
rendererProperty.setDescription(templateAttribute.getShortDescription());
- rendererProperty.setDisplayname(templateAttribute.getDisplayName());
+ rendererProperty.setDisplayName(templateAttribute.getDisplayName());
Set<EventName> eventNamesSet = convert(templateAttribute.getClientBehaviors());
if (eventNamesSet != null) {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/DescriptionGroupBean.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/DescriptionGroupBean.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/DescriptionGroupBean.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -7,7 +7,7 @@
import org.richfaces.cdk.model.DescriptionGroup;
@XmlType(name = "descriptionType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
- propOrder = {"description", "displayname", "icon"})
+ propOrder = {"description", "displayName", "icon"})
public class DescriptionGroupBean implements DescriptionGroup {
private String description;
private String displayname;
@@ -61,7 +61,7 @@
* @return the displayname
*/
@XmlElement(name = "display-name", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
- public final String getDisplayname() {
+ public final String getDisplayName() {
return displayname;
}
@@ -70,7 +70,7 @@
*
* @param displayname the displayname to set
*/
- public final void setDisplayname(String displayname) {
+ public final void setDisplayName(String displayname) {
this.displayname = displayname;
}
}
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -13,6 +13,7 @@
import org.richfaces.cdk.model.ClassName;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
public class AptSourceUtilsAnnotationsTest extends SourceUtilsTestBase {
@@ -136,11 +137,11 @@
public void process(SourceUtils utils, RoundEnvironment roundEnv) {
Element element = findElement(roundEnv, ANNOTATIONS_TEST_CLASS);
AnnotationMirror annotationMirror = utils.getAnnotationMirror(element, TestAnnotation.class);
- List<T> annotationValues = utils.getAnnotationValues(annotationMirror, propertyName, type);
- assertEquals("Annotation values size is different from expected",expected.length, annotationValues.size());
+ Iterable<T> annotationValues = utils.getAnnotationValues(annotationMirror, propertyName, type);
+ assertEquals("Annotation values size is different from expected",expected.length, Iterables.size(annotationValues));
for (int i = 0; i < expected.length; i++) {
Object expectedValue = expected[i];
- assertEquals("Annotation value at position "+i+" is different from expected",expectedValue, annotationValues.get(i));
+ assertEquals("Annotation value at position "+i+" is different from expected",expectedValue, Iterables.get(annotationValues, i));
}
}
});
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/BehaviorProcessorTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/BehaviorProcessorTest.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/BehaviorProcessorTest.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -104,7 +104,7 @@
expect(componentElement.getModifiers()).andReturn(Collections.singleton(Modifier.ABSTRACT));
expect(componentElement.getQualifiedName()).andReturn(name).atLeastOnce();
expect(behaviorAnnotation.generate()).andReturn("foo.Bar");
- expect(behaviorAnnotation.tag()).andReturn(tag);
+ expect(behaviorAnnotation.tag()).andReturn(new Tag[]{tag});
expect(behaviorAnnotation.attributes()).andReturn(new String[] {});
expect(behaviorAnnotation.description()).andReturn(this.description);
expect(tag.handler()).andStubReturn("");
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -28,6 +28,7 @@
import java.util.Collections;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
@@ -71,7 +72,7 @@
private static final String FOO_HTML_BAR = "foo.HtmlBar";
@Mock
- private JsfComponent annotation;
+ private AnnotationMirror annotation;
@Mock
private AttributesProcessor attributesProcessor;
@@ -112,13 +113,19 @@
@Test
public void testProcessFacetsFromAnnotation() throws Exception {
- Facet facet = createMock(Facet.class);
+ AnnotationMirror facet = createMock(AnnotationMirror.class);
expect(utils.getBeanPropertiesAnnotatedWith(eq(Facet.class), same(componentElement))).andReturn(
Collections.<BeanProperty> emptySet());
- expect(annotation.facets()).andReturn(new Facet[] { facet });
- expect(facet.name()).andReturn("foo");
- expect(facet.description()).andReturn(this.description);
- expect(facet.generate()).andReturn(true);
+// expect(annotation.facets()).andReturn(new Facet[] { facet });
+ expect(utils.getAnnotationValues(annotation, "facets",AnnotationMirror.class)).andReturn(Collections.singleton(facet));
+ expect(utils.isDefaultValue(same(facet), eq("name"))).andReturn(false);
+ expect(utils.getAnnotationValue(facet, "name",String.class)).andReturn("foo");
+ expect(utils.isDefaultValue(same(facet), eq("description"))).andReturn(true);
+ expect(utils.isDefaultValue(same(facet), eq("generate"))).andReturn(false);
+ expect(utils.getAnnotationValue(facet, "generate",Boolean.class)).andReturn(true);
+// expect(facet.name()).andReturn("foo");
+// expect(facet.description()).andReturn(this.description);
+// expect(facet.generate()).andReturn(true);
// expect(this.description.smallIcon()).andReturn("");
// expect(this.description.largeIcon()).andReturn("");
// expect(this.description.displayName()).andReturn("fooFacet").times(2);
@@ -139,20 +146,17 @@
@Test
public void testProcessFacetsFromProperty() throws Exception {
- Facet facet = createMock(Facet.class);
+ AnnotationMirror facet = createMock(AnnotationMirror.class);
expect(utils.getBeanPropertiesAnnotatedWith(eq(Facet.class), same(componentElement))).andReturn(
Collections.singleton(property));
- expect(annotation.facets()).andReturn(new Facet[0]);
- expect(property.getAnnotation(Facet.class)).andReturn(facet);
+ expect(property.getAnnotationMirror(Facet.class)).andReturn(facet);
expect(property.getName()).andReturn("foo");
expect(property.getDocComment()).andReturn("my comment").times(2);
expect(property.isExists()).andReturn(true);
- expect(facet.description()).andReturn(description);
- expect(facet.generate()).andReturn(true);
- // expect(this.description.smallIcon()).andReturn("");
- // expect(this.description.largeIcon()).andReturn("");
- // expect(this.description.displayName()).andReturn("fooFacet").times(2);
- // expect(this.description.value()).andReturn("");
+ expect(utils.isDefaultValue(same(facet), eq("description"))).andReturn(true);
+ expect(utils.isDefaultValue(same(facet), eq("generate"))).andReturn(false);
+ expect(utils.getAnnotationValue(facet, "generate",Boolean.class)).andReturn(true);
+ expect(utils.getAnnotationValues(annotation, "facets",AnnotationMirror.class)).andReturn(Collections.<AnnotationMirror>emptySet());
replay(utils, componentElement, jaxb, annotation, property, facet, description);
processor.processFacets(componentElement, model, annotation);
@@ -162,9 +166,6 @@
FacetModel facetModel = Iterables.getOnlyElement(model.getFacets());
assertTrue(facetModel.getGenerate());
assertEquals("foo", facetModel.getName());
- // assertEquals("my comment", facetModel.getDescription());
- // assertEquals("fooFacet", facetModel.getDisplayname());
- // assertNull(facetModel.getIcon());
}
/**
@@ -177,12 +178,14 @@
public void testSetClassNames() throws Exception {
expect(componentElement.getModifiers()).andReturn(Collections.<Modifier> emptySet());
expect(componentElement.getQualifiedName()).andReturn(new TestName(FOO_BAR));
+ expect(utils.isDefaultValue(annotation, "generate")).andReturn(true);
+ expect(componentElement.getQualifiedName()).andReturn(new TestName(FOO_BAR));
replay(utils, componentElement, jaxb, annotation);
- processor.setClassNames(componentElement, model, "");
+ processor.setClassNames(componentElement, model, annotation);
verify(utils, componentElement, jaxb, annotation);
assertFalse(model.getGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
- assertNull(model.getTargetClass());
+ assertEquals(FOO_BAR, model.getTargetClass().toString());
}
/**
@@ -194,10 +197,11 @@
@Test
public void testSetClassNames1() throws Exception {
expect(componentElement.getModifiers()).andReturn(Collections.<Modifier> singleton(Modifier.ABSTRACT));
+ utils.setModelProperty(model, annotation, "targetClass","generate");expectLastCall();
expect(componentElement.getQualifiedName()).andReturn(new TestName(FOO_BAR));
replay(utils, componentElement, jaxb, annotation);
- processor.setClassNames(componentElement, model, "");
+ processor.setClassNames(componentElement, model, annotation);
verify(utils, componentElement, jaxb, annotation);
assertTrue(model.getGenerate());
@@ -214,50 +218,18 @@
@Test
public void testSetClassNames2() throws Exception {
expect(componentElement.getModifiers()).andReturn(Collections.<Modifier> emptySet());
+ expect(utils.isDefaultValue(annotation, "generate")).andReturn(false);
+ utils.setModelProperty(model, annotation, "targetClass","generate");expectLastCall();
expect(componentElement.getQualifiedName()).andReturn(new TestName(FOO_BAR));
replay(utils, componentElement, jaxb, annotation);
- processor.setClassNames(componentElement, model, FOO_HTML_BAR);
+ processor.setClassNames(componentElement, model, annotation);
verify(utils, componentElement, jaxb, annotation);
assertTrue(model.getGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
- assertEquals(FOO_HTML_BAR, model.getTargetClass().toString());
}
- @Test
- public void testSetFamily() throws Exception {
- replay(utils, componentElement, jaxb, annotation);
-
- processor.setComponeneFamily(componentElement, model, FOO_HTML_BAR);
-
- verify(utils, componentElement, jaxb, annotation);
- assertEquals(FacesId.parseId(FOO_HTML_BAR), model.getFamily());
- }
-
- @Test
- public void testSetFamily1() throws Exception {
- expect(utils.getConstant(same(componentElement), eq(ComponentProcessor.COMPONENT_FAMILY))).andReturn(
- FOO_HTML_BAR);
- replay(utils, componentElement, jaxb, annotation);
-
- processor.setComponeneFamily(componentElement, model, "");
-
- verify(utils, componentElement, jaxb, annotation);
- assertEquals(FacesId.parseId(FOO_HTML_BAR), model.getFamily());
- }
-
- @Test
- public void testSetFamily2() throws Exception {
- expect(utils.getConstant(same(componentElement), eq(ComponentProcessor.COMPONENT_FAMILY))).andReturn(null);
- replay(utils, componentElement, jaxb, annotation);
-
- processor.setComponeneFamily(componentElement, model, "");
-
- verify(utils, componentElement, jaxb, annotation);
- assertNull(model.getFamily());
- }
-
@Override
protected Iterable<String> sources() {
return Collections.singleton(COMPONENT_CLASS_JAVA);
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/DescriptionProcessorTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/DescriptionProcessorTest.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/DescriptionProcessorTest.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -27,12 +27,15 @@
import java.util.Collections;
+import javax.lang.model.element.AnnotationMirror;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.cdk.CdkTestRunner;
import org.richfaces.cdk.Mock;
import org.richfaces.cdk.annotations.Description;
import org.richfaces.cdk.apt.AnnotationProcessorTestBase;
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.DescriptionGroup;
import com.google.inject.Inject;
@@ -55,12 +58,14 @@
private DescriptionGroup bean;
@Mock
- private Description description;
+ private AnnotationMirror description;
@Inject
private DescriptionProcessorImpl descriptionProcessor;
- /**
+ @Mock
+ private SourceUtils utils;
+ /**
* Test method for
* {@link org.richfaces.cdk.apt.processors.DescriptionProcessorImpl#processDescription(org.richfaces.cdk.model.DescriptionGroup, org.richfaces.cdk.annotations.Description, java.lang.String)}
* .
@@ -69,12 +74,14 @@
public void testProcessDescription() {
bean.setDescription(FOO_BAR_ELEMENT);
expectLastCall();
- bean.setDisplayname(FOO_FACET);
- expectLastCall();
- expect(this.description.smallIcon()).andReturn("");
- expect(this.description.largeIcon()).andReturn("");
- expect(this.description.displayName()).andReturn(FOO_FACET).times(2);
- expect(this.description.value()).andReturn("");
+ expect(utils.isDefaultValue(description, "smallIcon")).andStubReturn(true);
+ expect(utils.isDefaultValue(description, "largeIcon")).andStubReturn(true);
+ utils.setModelProperty(bean, description, "displayName");expectLastCall();
+ utils.setModelProperty(bean, description, "description","value");expectLastCall();
+// expect(this.description.smallIcon()).andReturn("");
+// expect(this.description.largeIcon()).andReturn("");
+// expect(this.description.displayName()).andReturn(FOO_FACET).times(2);
+// expect(this.description.value()).andReturn("");
mockController.replay();
descriptionProcessor.processDescription(bean, description, FOO_BAR_ELEMENT);
mockController.verify();
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -252,7 +252,7 @@
assertTrue(requiredAttribute.isRequired());
assertEquals("That's a required attribute", requiredAttribute.getDescription());
- assertEquals("Required Attribute", requiredAttribute.getDisplayname());
+ assertEquals("Required Attribute", requiredAttribute.getDisplayName());
}
@Test
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -103,7 +103,7 @@
assertEquals("panel.gif", component.getIcon().getSmallIcon());
assertEquals("panel-large.gif", component.getIcon().getLargeIcon());
assertEquals("Panel component", component.getDescription());
- assertEquals("Panel", component.getDisplayname());
+ assertEquals("Panel", component.getDisplayName());
assertTrue(component.getGenerate());
FacetModel facet = Iterables.getOnlyElement(component.getFacets());
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -113,7 +113,7 @@
assertEquals("int", property.getType().getName());
assertEquals("test2 property", property.getDescription());
assertEquals("ontest2.png", property.getIcon().getSmallIcon());
- assertEquals("test2 event property", property.getDisplayname());
+ assertEquals("test2 event property", property.getDisplayName());
assertEquals("3", property.getDefaultValue());
assertEquals("15", property.getSuggestedValue());
Modified: trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -31,9 +31,12 @@
import javax.faces.component.ValueHolder;
import javax.faces.el.MethodBinding;
import javax.faces.el.ValueBinding;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.event.ValueChangeListener;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.Description;
+import org.richfaces.cdk.annotations.Event;
import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
@@ -56,7 +59,7 @@
description=@Description(displayName="Test Component",largeIcon="large.gif",smallIcon="spall.png"),
generate="org.richfaces.cdk.test.component.UITestComponent",
facets=@Facet(name="caption",generate=true,description=@Description("Caption Facet")),
- fires=TestEvent.class,
+ fires={@Event(TestEvent.class),(a)Event(value=ValueChangeEvent.class,listener=ValueChangeListener.class)},
interfaces=ValueHolder.class,
components={
@RendererSpecificComponent(type = "org.richfaces.cdk.test.TestHtmlAbbr",
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/component/UIRepeat.java
===================================================================
--- trunk/ui/core/ui/src/main/java/org/richfaces/component/UIRepeat.java 2011-01-10 22:19:53 UTC (rev 20937)
+++ trunk/ui/core/ui/src/main/java/org/richfaces/component/UIRepeat.java 2011-01-10 22:35:38 UTC (rev 20938)
@@ -30,7 +30,7 @@
* @author Nick Belaevski
*
*/
-@JsfComponent(generate = "", tag = @Tag(name = "repeat", type = TagType.Facelets), renderer = @JsfRenderer(type = "org.richfaces.RepeatRenderer"))
+@JsfComponent(tag = @Tag(name = "repeat", type = TagType.Facelets), renderer = @JsfRenderer(type = "org.richfaces.RepeatRenderer"))
public class UIRepeat extends UISequence {
public static final String COMPONENT_TYPE = "org.richfaces.Repeat";
14 years, 11 months
JBoss Rich Faces SVN: r20937 - in trunk/ui/iteration/ui/src/main: resources/META-INF/cdk/attributes and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2011-01-10 17:19:53 -0500 (Mon, 10 Jan 2011)
New Revision: 20937
Added:
trunk/ui/iteration/ui/src/main/resources/META-INF/cdk/attributes/tree-common-props.xml
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java
Log:
https://issues.jboss.org/browse/RF-10041
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2011-01-10 16:47:16 UTC (rev 20936)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2011-01-10 22:19:53 UTC (rev 20937)
@@ -92,7 +92,7 @@
family = AbstractTree.COMPONENT_FAMILY,
tag = @Tag(name = "tree", handler = "org.richfaces.view.facelets.TreeHandler"),
renderer = @JsfRenderer(type = "org.richfaces.TreeRenderer"),
- attributes = {"events-props.xml", "core-props.xml", "i18n-props.xml"}
+ attributes = {"ajax-props.xml", "events-props.xml", "core-props.xml", "i18n-props.xml", "tree-common-props.xml"}
)
//TODO add rowData caching for wrapper events
public abstract class AbstractTree extends UIDataAdaptor implements MetaComponentResolver, MetaComponentEncoder, TreeSelectionChangeSource, TreeToggleSource {
@@ -165,24 +165,15 @@
return treeRange;
}
+ @Attribute
public abstract Object getValue();
+ @Attribute
public abstract boolean isImmediate();
- public abstract String getIconLeaf();
-
- public abstract String getIconExpanded();
-
- public abstract String getIconCollapsed();
-
+ @Attribute
public abstract String getNodeClass();
- public abstract String getHandleClass();
-
- public abstract String getIconClass();
-
- public abstract String getLabelClass();
-
@Attribute(events = @EventName("nodetoggle"))
public abstract String getOnnodetoggle();
@@ -201,27 +192,12 @@
@Attribute
public abstract SwitchType getSelectionType();
+ @Attribute
public abstract String getNodeType();
+ @Attribute
public abstract String getToggleNodeEvent();
- public abstract Object getExecute();
-
- public abstract Object getRender();
-
- public abstract boolean isLimitRender();
-
- @Attribute(events = @EventName("begin"))
- public abstract String getOnbegin();
-
- @Attribute(events = @EventName("beforedomupdate"))
- public abstract String getOnbeforedomupdate();
-
- @Attribute(events = @EventName("complete"))
- public abstract String getOncomplete();
-
- public abstract String getStatus();
-
@Override
public String getFamily() {
return COMPONENT_FAMILY;
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java 2011-01-10 16:47:16 UTC (rev 20936)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java 2011-01-10 22:19:53 UTC (rev 20937)
@@ -58,7 +58,7 @@
family = AbstractTreeNode.COMPONENT_FAMILY,
tag = @Tag(name = "treeNode", handler = "org.richfaces.view.facelets.TreeNodeHandler"),
renderer = @JsfRenderer(type = "org.richfaces.TreeNodeRenderer"),
- attributes = {"events-props.xml", "core-props.xml", "i18n-props.xml"}
+ attributes = {"events-props.xml", "core-props.xml", "i18n-props.xml", "tree-common-props.xml"}
)
public abstract class AbstractTreeNode extends UIComponentBase implements MetaComponentResolver, MetaComponentEncoder, IterationStateHolder, TreeToggleSource {
@@ -87,20 +87,9 @@
@Attribute
public abstract boolean isImmediate();
+ @Attribute
public abstract String getType();
- public abstract String getIconLeaf();
-
- public abstract String getIconExpanded();
-
- public abstract String getIconCollapsed();
-
- public abstract String getHandleClass();
-
- public abstract String getIconClass();
-
- public abstract String getLabelClass();
-
@Attribute(events = @EventName("toggle"))
public abstract String getOntoggle();
@@ -111,6 +100,7 @@
return (Boolean) getStateHelper().get(PropertyKeys.expanded);
}
+ @Attribute
public boolean isExpanded() {
FacesContext context = getFacesContext();
Boolean localExpandedValue = getLocalExpandedValue(context);
Copied: trunk/ui/iteration/ui/src/main/resources/META-INF/cdk/attributes/tree-common-props.xml (from rev 20836, trunk/ui/iteration/ui/src/main/resources/META-INF/cdk/attributes/tree-common-props.xml)
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/cdk/attributes/tree-common-props.xml (rev 0)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/cdk/attributes/tree-common-props.xml 2011-01-10 22:19:53 UTC (rev 20937)
@@ -0,0 +1,45 @@
+<?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://jboss.org/schema/richfaces/cdk/extensions"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee">
+
+ <property>
+ <property-name>iconLeaf</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <property-name>iconExpanded</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <property-name>iconCollapsed</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+
+ <property>
+ <property-name>handleClass</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <property-name>iconClass</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <property-name>labelClass</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+
+</cdk:properties>
14 years, 11 months
JBoss Rich Faces SVN: r20936 - modules/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-10 11:47:16 -0500 (Mon, 10 Jan 2011)
New Revision: 20936
Modified:
modules/tests/metamer/trunk/ftest/pom.xml
Log:
increased jboss6x-snapshot version to 6.0.1-SNAPSHOT
Modified: modules/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- modules/tests/metamer/trunk/ftest/pom.xml 2011-01-10 16:22:03 UTC (rev 20935)
+++ modules/tests/metamer/trunk/ftest/pom.xml 2011-01-10 16:47:16 UTC (rev 20936)
@@ -296,8 +296,8 @@
</property>
</activation>
<properties>
- <container.short.version>6.0.0-SNAPSHOT</container.short.version>
- <container.version>6.0.0-SNAPSHOT</container.version>
+ <container.short.version>6.0.1-SNAPSHOT</container.short.version>
+ <container.version>6.0.1-SNAPSHOT</container.version>
<container.dir.deflatted>jboss-6.0.x</container.dir.deflatted>
<container.dir.unflatted>jboss-${container.version}</container.dir.unflatted>
<container.installer.url>http://hudson.qa.jboss.com/hudson/view/JBoss%20AS/job/JBoss-AS-6.0.x/last...</container.installer.url>
14 years, 11 months
JBoss Rich Faces SVN: r20935 - in trunk/ui/output/ui/src: main/templates and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2011-01-10 11:22:03 -0500 (Mon, 10 Jan 2011)
New Revision: 20935
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menuitem.js
trunk/ui/output/ui/src/main/templates/menuitem.template.xml
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/DrowDownMenuRendererTest.java
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/MenuItemRendererTest.java
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_ajaxMode.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_serverMode.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_ajaxMode.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_clientMode.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_serverMode.xmlunit.xml
Log:
https://issues.jboss.org/browse/RF-10107 Drop down menu: keyboard navigation. Tests was updated.
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menuitem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menuitem.js 2011-01-10 14:57:44 UTC (rev 20934)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menuitem.js 2011-01-10 16:22:03 UTC (rev 20935)
@@ -50,11 +50,11 @@
__clickHandler : function (e) {
parentMenu = this.__getParentMenu();
if (parentMenu){
- this.__getParentMenu().processItem(this.element);
- if (this.options.submitFunction){
- this.options.submitFunction.call(this,e);
- }
+ this.__getParentMenu().processItem(this.element);
}
+ if (this.options.submitFunction){
+ this.options.submitFunction.call(this,e);
+ }
},
__getParentMenu : function () {
Modified: trunk/ui/output/ui/src/main/templates/menuitem.template.xml
===================================================================
--- trunk/ui/output/ui/src/main/templates/menuitem.template.xml 2011-01-10 14:57:44 UTC (rev 20934)
+++ trunk/ui/output/ui/src/main/templates/menuitem.template.xml 2011-01-10 16:22:03 UTC (rev 20935)
@@ -17,6 +17,7 @@
<cdk:resource-dependency name="ajax.reslib" library="org.richfaces" />
<cdk:resource-dependency name="base-component.reslib" library="org.richfaces" />
+ <cdk:resource-dependency name="richfaces-event.js" />
<cdk:resource-dependency name="menuitem.js" library="org.richfaces" />
</cc:interface>
@@ -75,8 +76,6 @@
</c:choose>
</c:otherwise>
</c:choose>
-
- </div>
<c:choose>
<c:when test="#{not isDisabled}">
<script type="text/javascript">
@@ -91,5 +90,7 @@
<c:otherwise>
</c:otherwise>
</c:choose>
+ </div>
+
</cc:implementation>
</cdk:root>
Modified: trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/DrowDownMenuRendererTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/DrowDownMenuRendererTest.java 2011-01-10 14:57:44 UTC (rev 20934)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/DrowDownMenuRendererTest.java 2011-01-10 16:22:03 UTC (rev 20935)
@@ -37,7 +37,6 @@
import com.gargoylesoftware.htmlunit.html.HtmlDivision;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
-@Ignore
public class DrowDownMenuRendererTest extends RendererTestBase {
@Override
@@ -49,7 +48,7 @@
}
@Test
- public void testDoEncodeServerMode() throws IOException, SAXException {
+ public void testDoEncodeServerMode() throws IOException, SAXException {
doTest("dropDownMenu_serverMode", "form:ddmenu");
}
Modified: trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/MenuItemRendererTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/MenuItemRendererTest.java 2011-01-10 14:57:44 UTC (rev 20934)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/MenuItemRendererTest.java 2011-01-10 16:22:03 UTC (rev 20935)
@@ -37,7 +37,6 @@
import com.gargoylesoftware.htmlunit.html.HtmlDivision;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
-@Ignore
public class MenuItemRendererTest extends RendererTestBase {
@Override
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_ajaxMode.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_ajaxMode.xmlunit.xml 2011-01-10 14:57:44 UTC (rev 20934)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_ajaxMode.xmlunit.xml 2011-01-10 16:22:03 UTC (rev 20935)
@@ -4,9 +4,9 @@
File
</div>
<div class="rf-ddm-pos">
- <div class="rf-ddm-lst" id="form:ddmenu_list" style="display:none;min-width:250px;">
+ <div class="rf-ddm-lst" id="form:ddmenu_list" style="display:none;min-width:250px;" tabindex="-1">
<div class="rf-ddm-lst-bg">
- <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:open" onclick="RichFaces.ajax("form:open",event,{"incId":"1"} );return false;" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:open" >
<span class="rf-ddm-itm-ic ">
<div class="rf-ddm-emptyIcon">
</div>
@@ -14,8 +14,14 @@
<span class="rf-ddm-itm-lbl ">
Open
</span>
+ <script type="text/javascript">
+//<![CDATA[
+new RichFaces.ui.MenuItem("form:open",{"submitFunction":function(event){RichFaces.ajax("form:open",event,{"incId":"1"} );return false;}} );
+//]]>
+ </script>
</div>
- <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:group" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel'" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:group">
<span class="rf-ddm-itm-ic ">
<div class="rf-ddm-emptyIcon">
</div>
@@ -24,27 +30,40 @@
Save As...
</span>
<div class="rf-ddm-nd">
- <div class="rf-ddm-lst rf-ddm-sublst" id="form:group_list" style="display:none;min-width:250px;">
+ <div class="rf-ddm-lst rf-ddm-sublst" id="form:group_list" style="display:none;min-width:250px;" tabindex="-1">
<div class="rf-ddm-lst-bg">
- <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:save" onclick="RichFaces.ajax("form:save",event,{"incId":"1"} );return false;" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:save" >
<span class="rf-ddm-itm-ic ">
<img src="/images/ddmenu/save.gif"/>
</span>
<span class="rf-ddm-itm-lbl ">
Save
</span>
+ <script type="text/javascript">
+//<![CDATA[
+new RichFaces.ui.MenuItem("form:save",{"submitFunction":function(event){RichFaces.ajax("form:save",event,{"incId":"1"} );return false;}} );
+//]]>
+ </script>
</div>
+
<div class="rf-ddm-sep">
</div>
- <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:saveAll" onclick="RichFaces.ajax("form:saveAll",event,{"incId":"1"} );return false;" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:saveAll">
<span class="rf-ddm-itm-ic ">
<div class="rf-ddm-emptyIcon">
</div>
</span>
<span class="rf-ddm-itm-lbl ">
SaveAll
- </span>
- </div>
+ </span>
+ <script type="text/javascript">
+
+//<![CDATA[
+new RichFaces.ui.MenuItem("form:saveAll",{"submitFunction":function(event){RichFaces.ajax("form:saveAll",event,{"incId":"1"} );return false;}} );
+//]]>
+ </script>
+ </div>
</div>
</div>
</div>
@@ -54,7 +73,7 @@
</div>
<script type="text/javascript">
//<![CDATA[
-new RichFaces.ui.Menu("form:ddmenu",{"mode":"ajax"} ).initiateGroups([{"id":"form:group"} ] );
+new RichFaces.ui.Menu("form:ddmenu",{"direction":"AA","jointPoint":"AA","mode":"ajax"} ).initiateGroups([{"id":"form:group"} ] );
//]]>
</script>
</div>
\ No newline at end of file
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_serverMode.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_serverMode.xmlunit.xml 2011-01-10 14:57:44 UTC (rev 20934)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_serverMode.xmlunit.xml 2011-01-10 16:22:03 UTC (rev 20935)
@@ -4,9 +4,9 @@
File
</div>
<div class="rf-ddm-pos">
- <div class="rf-ddm-lst" id="form:ddmenu_list" style="display:none;min-width:250px;">
+ <div class="rf-ddm-lst" id="form:ddmenu_list" style="display:none;min-width:250px;" tabindex="-1">
<div class="rf-ddm-lst-bg">
- <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:open" onclick="RichFaces.submitForm("form",{"form:open":"form:open"} )" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:open">
<span class="rf-ddm-itm-ic ">
<div class="rf-ddm-emptyIcon">
</div>
@@ -14,8 +14,14 @@
<span class="rf-ddm-itm-lbl ">
Open
</span>
+ <script type="text/javascript">
+//<![CDATA[
+new RichFaces.ui.MenuItem("form:open", {"submitFunction": function(event){RichFaces.submitForm("form", {"form:open":"form:open"})}});
+//]]>
+ </script>
</div>
- <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:group" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel'" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:group">
<span class="rf-ddm-itm-ic ">
<div class="rf-ddm-emptyIcon">
</div>
@@ -24,19 +30,25 @@
Save As...
</span>
<div class="rf-ddm-nd">
- <div class="rf-ddm-lst rf-ddm-sublst" id="form:group_list" style="display:none;min-width:250px;">
+ <div class="rf-ddm-lst rf-ddm-sublst" id="form:group_list" style="display:none;min-width:250px;" tabindex="-1">
<div class="rf-ddm-lst-bg">
- <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:save" onclick="RichFaces.submitForm("form",{"form:save":"form:save"} )" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:save">
<span class="rf-ddm-itm-ic ">
<img src="/images/ddmenu/save.gif"/>
</span>
<span class="rf-ddm-itm-lbl ">
Save
</span>
+ <script type="text/javascript">
+//<![CDATA[
+new RichFaces.ui.MenuItem("form:save",{"submitFunction":function(event){RichFaces.submitForm("form",{"form:save":"form:save"} )}} );
+//]]>
+ </script>
</div>
+
<div class="rf-ddm-sep">
</div>
- <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:saveAll" onclick="RichFaces.submitForm("form",{"form:saveAll":"form:saveAll"} )" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:saveAll">
<span class="rf-ddm-itm-ic ">
<div class="rf-ddm-emptyIcon">
</div>
@@ -44,7 +56,13 @@
<span class="rf-ddm-itm-lbl ">
SaveAll
</span>
+ <script type="text/javascript">
+//<![CDATA[
+new RichFaces.ui.MenuItem("form:saveAll",{"submitFunction":function(event){RichFaces.submitForm("form",{"form:saveAll":"form:saveAll"} )}} );
+//]]>
+ </script>
</div>
+
</div>
</div>
</div>
@@ -54,7 +72,7 @@
</div>
<script type="text/javascript">
//<![CDATA[
-new RichFaces.ui.Menu("form:ddmenu").initiateGroups([{"id":"form:group"} ] );
+new RichFaces.ui.Menu("form:ddmenu", {"direction":"AA","jointPoint":"AA"}).initiateGroups([{"id":"form:group"} ] );
//]]>
</script>
</div>
\ No newline at end of file
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_ajaxMode.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_ajaxMode.xmlunit.xml 2011-01-10 14:57:44 UTC (rev 20934)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_ajaxMode.xmlunit.xml 2011-01-10 16:22:03 UTC (rev 20935)
@@ -1,7 +1,4 @@
- <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:menuItem"
- onclick="RichFaces.ajax("form:menuItem",event,{"incId":"1"} );return false;"
- onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '"
- onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:menuItem">
<span class="rf-ddm-itm-ic ">
<div class="rf-ddm-emptyIcon">
</div>
@@ -9,4 +6,9 @@
<span class="rf-ddm-itm-lbl ">
Test
</span>
- </div>
\ No newline at end of file
+ <script type="text/javascript">
+//<![CDATA[
+ new RichFaces.ui.MenuItem("form:menuItem",{"submitFunction":function(event){RichFaces.ajax("form:menuItem",event,{"incId":"1"} );return false;}} );
+ //]]>
+ </script>
+ </div>
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_clientMode.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_clientMode.xmlunit.xml 2011-01-10 14:57:44 UTC (rev 20934)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_clientMode.xmlunit.xml 2011-01-10 16:22:03 UTC (rev 20935)
@@ -1,6 +1,4 @@
- <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:menuItem"
- onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '"
- onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:menuItem">
<span class="rf-ddm-itm-ic ">
<div class="rf-ddm-emptyIcon">
</div>
@@ -8,4 +6,9 @@
<span class="rf-ddm-itm-lbl ">
Test
</span>
- </div>
\ No newline at end of file
+ <script type="text/javascript">
+ //<![CDATA[
+ new RichFaces.ui.MenuItem("form:menuItem");
+//]]>
+ </script>
+ </div>
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_serverMode.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_serverMode.xmlunit.xml 2011-01-10 14:57:44 UTC (rev 20934)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_serverMode.xmlunit.xml 2011-01-10 16:22:03 UTC (rev 20935)
@@ -1,12 +1,15 @@
- <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:menuItem"
- onclick="RichFaces.submitForm("form",{"form:menuItem":"form:menuItem"} )"
- onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '"
- onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
- <span class="rf-ddm-itm-ic ">
- <div class="rf-ddm-emptyIcon">
- </div>
- </span>
- <span class="rf-ddm-itm-lbl ">
- Test
- </span>
- </div>
\ No newline at end of file
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:menuItem">
+ <span class="rf-ddm-itm-ic ">
+ <div class="rf-ddm-emptyIcon">
+ </div>
+ </span>
+ <span class="rf-ddm-itm-lbl ">
+ Test
+ </span>
+ <script type="text/javascript">
+//<![CDATA[
+new RichFaces.ui.MenuItem("form:menuItem", {"submitFunction": function(event) {RichFaces.submitForm("form", {"form:menuItem":"form:menuItem"})}});
+ //]]>
+ </script>
+ </div>
+
\ No newline at end of file
14 years, 11 months
JBoss Rich Faces SVN: r20934 - modules/tests/metamer/trunk/ftest/src/test/resources.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-01-10 09:57:44 -0500 (Mon, 10 Jan 2011)
New Revision: 20934
Modified:
modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml
Log:
* added rich functions and menu separator
Modified: modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml
===================================================================
--- modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml 2011-01-10 14:45:29 UTC (rev 20933)
+++ modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml 2011-01-10 14:57:44 UTC (rev 20934)
@@ -6,7 +6,9 @@
<package name="org.richfaces.tests.metamer.ftest.hCommandButton" />
<package name="org.richfaces.tests.metamer.ftest.richComponentControl" />
<package name="org.richfaces.tests.metamer.ftest.richDataScroller" />
+ <package name="org.richfaces.tests.metamer.ftest.richFunctions" />
<package name="org.richfaces.tests.metamer.ftest.richJQuery" />
+ <package name="org.richfaces.tests.metamer.ftest.richMenuSeparator" />
<package name="org.richfaces.tests.metamer.ftest.richToggleControl" />
</packages>
</test>
14 years, 11 months