JBoss Rich Faces SVN: r16690 - in root/examples-sandbox/trunk/components/tables/src/main: webapp and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-03-31 07:55:08 -0400 (Wed, 31 Mar 2010)
New Revision: 16690
Modified:
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/DataBean.java
root/examples-sandbox/trunk/components/tables/src/main/webapp/extendedtable.xhtml
Log:
RF-7852 ExtendedDataTable sample
Modified: root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/DataBean.java
===================================================================
--- root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/DataBean.java 2010-03-31 10:46:24 UTC (rev 16689)
+++ root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/DataBean.java 2010-03-31 11:55:08 UTC (rev 16690)
@@ -1,5 +1,6 @@
package org.richfaces.demo;
+import java.util.Date;
import java.util.List;
import javax.faces.bean.ManagedBean;
@@ -49,5 +50,8 @@
public void sortingListener(SortingEvent event) {
System.out.println(event.getSortOrder());
}
-
+
+ public Date getDate() {
+ return new Date();
+ }
}
Modified: root/examples-sandbox/trunk/components/tables/src/main/webapp/extendedtable.xhtml
===================================================================
--- root/examples-sandbox/trunk/components/tables/src/main/webapp/extendedtable.xhtml 2010-03-31 10:46:24 UTC (rev 16689)
+++ root/examples-sandbox/trunk/components/tables/src/main/webapp/extendedtable.xhtml 2010-03-31 11:55:08 UTC (rev 16690)
@@ -1,3 +1,10 @@
+<?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:rich="http://richfaces.org/rich">
<!--
JBoss, Home of Professional Open Source
Copyright ${year}, Red Hat, Inc. and individual contributors
@@ -22,12 +29,6 @@
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
-<!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:rich="http://richfaces.org/rich">
<f:view contentType="text/html"/>
<h:head>
@@ -47,9 +48,11 @@
<h:selectBooleanCheckbox value="#{dataBean.state}">
<f:ajax render="extendedDataTable" />
</h:selectBooleanCheckbox>
- <rich:extendedDataTable id="extendedDataTable" clientRows="40" rows="100" frozenColumns="2" value="#{dataBean.state ? dataBean.employeeList : null}" var="record" noDataLabel="There isn't data." styleClass="extendedDataTable">
+ <rich:extendedDataTable id="extendedDataTable" clientRows="40" rows="100" frozenColumns="2"
+ value="#{dataBean.state ? dataBean.employeeList : null}" var="record" noDataLabel="There isn't data."
+ styleClass="extendedDataTable" rowKeyVar="rkv">
<f:facet name="header">
- <h:outputText value="Header of table."/>
+ <h:outputText value="Current date: #{dataBean.date}"/>
</f:facet>
<f:facet name="footer">
<h:outputText value="Footer of table."/>
@@ -57,6 +60,15 @@
<f:facet name="noData">
<h:outputText value="There isn't data." style="border: solid black 1px;"/>
</f:facet>
+ <rich:column >
+ <f:facet name="header">
+ <h:outputText value="Index"/>
+ </f:facet>
+ <h:outputText value="#{rkv}" />
+ <f:facet name="footer">
+ <h:outputText value="index"/>
+ </f:facet>
+ </rich:column>
<rich:column id="column_name">
<f:facet name="header">
<h:outputText id="columnHeader1" value="Column Header Facet"/>
@@ -78,13 +90,13 @@
<h:outputText value="#{record.EMail}" />
</rich:column>
<rich:column id="column_company_name" width="300px">
- <h:outputText value="#{record.company.name}" />
+ <h:outputText value="#{record.companies[0].name}" />
</rich:column>
<rich:column id="column_company_state">
- <h:outputText value="#{record.company.state}" />
+ <h:outputText value="#{record.companies[0].state}" />
</rich:column>
<rich:column id="column_company_phone">
- <h:outputText value="#{record.company.phone}" />
+ <h:outputText value="#{record.companies[0].phone}" />
</rich:column>
</rich:extendedDataTable>
<input type="submit" />
14 years, 9 months
JBoss Rich Faces SVN: r16689 - in root/cdk/trunk/plugins: generator/src/main/java/org/richfaces/cdk/apt/processors and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-31 06:46:24 -0400 (Wed, 31 Mar 2010)
New Revision: 16689
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Alias.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
Log:
fix checkstyle errors
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Alias.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Alias.java 2010-03-31 08:21:38 UTC (rev 16688)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Alias.java 2010-03-31 10:46:24 UTC (rev 16689)
@@ -23,10 +23,8 @@
package org.richfaces.cdk.annotations;
-import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
/**
* <p class="changed_added_4_0">
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java 2010-03-31 08:21:38 UTC (rev 16688)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java 2010-03-31 10:46:24 UTC (rev 16689)
@@ -31,7 +31,6 @@
import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.util.Strings;
-import javax.lang.model.element.TypeElement;
import javax.lang.model.type.MirroredTypeException;
import javax.lang.model.type.MirroredTypesException;
import javax.lang.model.type.TypeMirror;
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-03-31 08:21:38 UTC (rev 16688)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-03-31 10:46:24 UTC (rev 16689)
@@ -26,14 +26,11 @@
import com.google.common.collect.Lists;
import com.google.inject.Inject;
import org.richfaces.cdk.CdkException;
-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;
import org.richfaces.cdk.annotations.SubComponent;
import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.cdk.annotations.Test;
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
import org.richfaces.cdk.model.ClassName;
@@ -81,73 +78,7 @@
setClassNames(componentElement, component, annotation.generate());
setComponentProperties(componentElement, component, annotation, library);
for (final SubComponent subcomponent : annotation.components()) {
- JsfComponent subAnnotation = new JsfComponent() {
-
- @Override
- public Class<? extends Annotation> annotationType() {
- return JsfComponent.class;
- }
-
- @Override
- public String type() {
- return subcomponent.type();
- }
-
- @Override
- public Test test() {
- return subcomponent.test();
- }
-
- @Override
- public Tag[] tag() {
- return subcomponent.tag();
- }
-
- @Override
- public JsfRenderer renderer() {
- return subcomponent.renderer();
- }
-
- @Override
- public Class<?>[] interfaces() {
- return subcomponent.interfaces();
- }
-
- @Override
- public String generate() {
- return subcomponent.generate();
- }
-
- @Override
- public Event[] fires() {
- return new Event[0];
- }
-
- @Override
- public String family() {
- return annotation.family();
- }
-
- @Override
- public Facet[] facets() {
- return subcomponent.facets();
- }
-
- @Override
- public Description description() {
- return subcomponent.description();
- }
-
- @Override
- public SubComponent[] components() {
- return new SubComponent[0];
- }
-
- @Override
- public String[] attributes() {
- return subcomponent.attributes();
- }
- };
+ JsfComponent subAnnotation = new JsfSubComponent(subcomponent, annotation.family());
ComponentModel subcomponentModel = new ComponentModel();
subcomponentModel.setBaseClass(component.getTargetClass());
subcomponentModel.setTargetClass(ClassName.parseName(subcomponent.generate()));
@@ -175,12 +106,12 @@
}
} catch (MirroredTypesException e) {
List<? extends TypeMirror> typeMirrors = e.getTypeMirrors();
- for(TypeMirror mirror :typeMirrors){
+ for (TypeMirror mirror : typeMirrors) {
// TODO call processAttributes with element from type mirror.
interfaceNames.add(ClassName.parseName(mirror.toString()));
}
}
- processAttributes(componentElement, component,annotation.attributes());
+ processAttributes(componentElement, component, annotation.attributes());
for (Tag tag : annotation.tag()) {
setTagInfo(tag, component);
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java 2010-03-31 10:46:24 UTC (rev 16689)
@@ -0,0 +1,115 @@
+/*
+ * 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 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;
+import org.richfaces.cdk.annotations.SubComponent;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.annotations.Test;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author akolonitsky
+ * @since Mar 31, 2010
+ */
+public class JsfSubComponent implements JsfComponent {
+
+ private SubComponent subcomponent;
+
+ private String family;
+
+ public JsfSubComponent(SubComponent subcomponent, String family) {
+ this.subcomponent = subcomponent;
+ this.family = family;
+ }
+
+ @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();
+ }
+
+ @Override
+ public Event[] fires() {
+ return new Event[0];
+ }
+
+ @Override
+ public String family() {
+ return this.family;
+ }
+
+ @Override
+ public Facet[] facets() {
+ return this.subcomponent.facets();
+ }
+
+ @Override
+ public Description description() {
+ return this.subcomponent.description();
+ }
+
+ @Override
+ public SubComponent[] components() {
+ return new SubComponent[0];
+ }
+
+ @Override
+ public String[] attributes() {
+ return this.subcomponent.attributes();
+ }
+}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2010-03-31 08:21:38 UTC (rev 16688)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2010-03-31 10:46:24 UTC (rev 16689)
@@ -24,7 +24,6 @@
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import java.util.Collection;
-import java.util.List;
import java.util.Set;
public abstract class ProcessorBase {
@@ -83,7 +82,7 @@
}
protected void setDescription(DescriptionGroup component, Description description, String docComment) {
- if(!Strings.isEmpty(docComment)){
+ if (!Strings.isEmpty(docComment)) {
component.setDescription(docComment);
}
if (description != null) {
@@ -119,7 +118,7 @@
}
protected String getDocComment(TypeElement componentElement) {
- return null != componentElement?getSourceUtils().getDocComment(asClassDesctiption(componentElement)):null;
+ return null != componentElement ? getSourceUtils().getDocComment(asClassDesctiption(componentElement)) : null;
}
protected void processAttributes(TypeElement componentElement, final BeanModelBase component, String[] annotationAttributes) throws CdkException {
@@ -141,7 +140,7 @@
});
// Process all files from @Jsf.. attributes property.
- for(String attributes : annotationAttributes){
+ for (String attributes : annotationAttributes) {
try {
component.getAttributes().addAll(parseProperties(
CdkEntityResolver.URN_ATTRIBUTES + attributes));
14 years, 9 months
JBoss Rich Faces SVN: r16688 - in branches/community/3.3.X/test-applications/regression-test/src/main: java/org and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-03-31 04:21:38 -0400 (Wed, 31 Mar 2010)
New Revision: 16688
Added:
branches/community/3.3.X/test-applications/regression-test/src/main/java/org/
branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/
branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/
branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/
branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/Capital.java
branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/CapitalData.java
branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/ExtendedTableBean.java
branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/ExtendedTableBean2.java
branches/community/3.3.X/test-applications/regression-test/src/main/webapp/pages/rf8212.xhtml
Modified:
branches/community/3.3.X/test-applications/regression-test/src/main/webapp/WEB-INF/faces-config.xml
branches/community/3.3.X/test-applications/regression-test/src/main/webapp/WEB-INF/web.xml
branches/community/3.3.X/test-applications/regression-test/src/main/webapp/pages/index.xhtml
Log:
https://jira.jboss.org/jira/browse/RFPL-511
test case for RF-8212 (keyboard navigation in Extended Data Table)
Added: branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/Capital.java
===================================================================
--- branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/Capital.java (rev 0)
+++ branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/Capital.java 2010-03-31 08:21:38 UTC (rev 16688)
@@ -0,0 +1,59 @@
+package org.richfaces.regressiontest.rf8212;
+
+import java.io.Serializable;
+
+/**
+ * @author Ilya Shaikovsky
+ */
+public class Capital implements Serializable {
+
+ private static final long serialVersionUID = -1042449580199397136L;
+ private boolean checked=false;
+ private String name;
+ private String state;
+ private String timeZone;
+ private CapitalData data;
+
+ public CapitalData getData() {
+ return data;
+ }
+ public void setData(CapitalData data) {
+ this.data = data;
+ }
+ private final static String FILE_EXT = ".gif";
+ public Capital() {
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getState() {
+ return state;
+ }
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ private String stateNameToFileName() {
+ return state.replaceAll("\\s", "").toLowerCase();
+ }
+
+ public String getStateFlag() {
+ return "/images/capitals/" + stateNameToFileName() + FILE_EXT;
+ }
+
+ public String getTimeZone() {
+ return timeZone;
+ }
+ public void setTimeZone(String timeZone) {
+ this.timeZone = timeZone;
+ }
+ public boolean isChecked() {
+ return checked;
+ }
+ public void setChecked(boolean checked) {
+ this.checked = checked;
+ }
+}
Property changes on: branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/Capital.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Added: branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/CapitalData.java
===================================================================
--- branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/CapitalData.java (rev 0)
+++ branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/CapitalData.java 2010-03-31 08:21:38 UTC (rev 16688)
@@ -0,0 +1,23 @@
+package org.richfaces.regressiontest.rf8212;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Ilya Shaikovsky
+ */
+public class CapitalData implements Serializable {
+
+ private static final long serialVersionUID = -3456988151970108426L;
+ private List<String> items = new ArrayList<String>();
+
+ public void addItem(String item) {
+ items.add(item);
+ }
+
+ public List<String> getItems() {
+ return items;
+ }
+
+}
Property changes on: branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/CapitalData.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/ExtendedTableBean.java
===================================================================
--- branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/ExtendedTableBean.java (rev 0)
+++ branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/ExtendedTableBean.java 2010-03-31 08:21:38 UTC (rev 16688)
@@ -0,0 +1,123 @@
+package org.richfaces.regressiontest.rf8212;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.richfaces.model.DataProvider;
+import org.richfaces.model.ExtendedTableDataModel;
+import org.richfaces.model.selection.Selection;
+import org.richfaces.model.selection.SimpleSelection;
+
+/**
+ * @author Ilya Shaikovsky, Pavol Pitonak
+ */
+public class ExtendedTableBean {
+ private String sortMode="single";
+ private String selectionMode="multi";
+ private Object tableState;
+ private Selection selection = new SimpleSelection();
+ private List<Capital> capitals = new ArrayList<Capital>();
+ private ExtendedTableDataModel<Capital> dataModel;
+ private List<Capital> selectedCapitals = new ArrayList<Capital>();
+
+ public String getSortMode() {
+ return sortMode;
+ }
+
+ public void setSortMode(String sortMode) {
+ this.sortMode = sortMode;
+ }
+
+ public String getSelectionMode() {
+ return selectionMode;
+ }
+
+ public void setSelectionMode(String selectionMode) {
+ this.selectionMode = selectionMode;
+ }
+
+ public ExtendedTableBean() {
+
+ for (char charr = 'a'; charr <= 'z'; charr++) {
+ Capital c = new Capital();
+ c.setName("name " + charr + charr + charr);
+ c.setState("state " + charr + charr + charr);
+ capitals.add(c);
+ }
+
+
+
+ }
+
+ public void takeSelection(){
+ selectedCapitals.clear();
+ Iterator<Object> iterator = getSelection().getKeys();
+ while (iterator.hasNext()) {
+ Object key = iterator.next();
+ selectedCapitals.add(getCapitalsDataModel().getObjectByKey(key));
+ }
+ }
+
+ public ExtendedTableDataModel<Capital> getCapitalsDataModel() {
+ if (dataModel == null) {
+ dataModel = new ExtendedTableDataModel<Capital>(new DataProvider<Capital>(){
+
+ private static final long serialVersionUID = 5054087821033164847L;
+
+ public Capital getItemByKey(Object key) {
+ for(Capital c : capitals){
+ if (key.equals(getKey(c))){
+ return c;
+ }
+ }
+ return null;
+ }
+
+ public List<Capital> getItemsByRange(int firstRow, int endRow) {
+ return capitals.subList(firstRow, endRow);
+ }
+
+ public Object getKey(Capital item) {
+ return item.getName();
+ }
+
+ public int getRowCount() {
+ return capitals.size();
+ }
+
+ });
+
+ }
+ return dataModel;
+ }
+
+ public void setCapitals(List<Capital> capitals) {
+ this.capitals = capitals;
+ }
+
+ public Object getTableState() {
+ return tableState;
+ }
+
+ public void setTableState(Object tableState) {
+ this.tableState = tableState;
+ }
+
+ public Selection getSelection() {
+ return selection;
+ }
+
+ public void setSelection(Selection selection) {
+ this.selection = selection;
+ }
+
+ public List<Capital> getSelectedCapitals() {
+ return selectedCapitals;
+ }
+
+ public void setSelectedCapitals(List<Capital> selectedCapitals) {
+ this.selectedCapitals = selectedCapitals;
+ }
+
+}
Property changes on: branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/ExtendedTableBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/ExtendedTableBean2.java
===================================================================
--- branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/ExtendedTableBean2.java (rev 0)
+++ branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/ExtendedTableBean2.java 2010-03-31 08:21:38 UTC (rev 16688)
@@ -0,0 +1,127 @@
+/**
+ *
+ */
+package org.richfaces.regressiontest.rf8212;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.richfaces.model.DataProvider;
+import org.richfaces.model.ExtendedTableDataModel;
+import org.richfaces.model.selection.Selection;
+import org.richfaces.model.selection.SimpleSelection;
+
+/**
+ * @author Ilya Shaikovsky, Pavol Pitonak
+ *
+ */
+public class ExtendedTableBean2 {
+ private String sortMode="single";
+ private String selectionMode="none";
+ private Object tableState;
+ private Selection selection = new SimpleSelection();
+ private List<Capital> capitals = new ArrayList<Capital>();
+ private ExtendedTableDataModel<Capital> dataModel;
+ private List<Capital> selectedCapitals = new ArrayList<Capital>();
+
+ public String getSortMode() {
+ return sortMode;
+ }
+
+ public void setSortMode(String sortMode) {
+ this.sortMode = sortMode;
+ }
+
+ public String getSelectionMode() {
+ return selectionMode;
+ }
+
+ public void setSelectionMode(String selectionMode) {
+ this.selectionMode = selectionMode;
+ }
+
+ public ExtendedTableBean2() {
+
+ for (char charr = 'a'; charr <= 'z'; charr++) {
+ Capital c = new Capital();
+ c.setName("name " + charr + charr + charr);
+ c.setState("state " + charr + charr + charr);
+ capitals.add(c);
+ }
+
+
+
+ }
+
+ public void takeSelection(){
+ selectedCapitals.clear();
+ Iterator<Object> iterator = getSelection().getKeys();
+ while (iterator.hasNext()) {
+ Object key = iterator.next();
+ selectedCapitals.add(getCapitalsDataModel().getObjectByKey(key));
+ }
+ }
+
+ public ExtendedTableDataModel<Capital> getCapitalsDataModel() {
+ if (dataModel == null) {
+ dataModel = new ExtendedTableDataModel<Capital>(new DataProvider<Capital>(){
+
+ private static final long serialVersionUID = 5054087821033164847L;
+
+ public Capital getItemByKey(Object key) {
+ for(Capital c : capitals){
+ if (key.equals(getKey(c))){
+ return c;
+ }
+ }
+ return null;
+ }
+
+ public List<Capital> getItemsByRange(int firstRow, int endRow) {
+ return capitals.subList(firstRow, endRow);
+ }
+
+ public Object getKey(Capital item) {
+ return item.getName();
+ }
+
+ public int getRowCount() {
+ return capitals.size();
+ }
+
+ });
+
+ }
+ return dataModel;
+ }
+
+ public void setCapitals(List<Capital> capitals) {
+ this.capitals = capitals;
+ }
+
+ public Object getTableState() {
+ return tableState;
+ }
+
+ public void setTableState(Object tableState) {
+ this.tableState = tableState;
+ }
+
+ public Selection getSelection() {
+ return selection;
+ }
+
+ public void setSelection(Selection selection) {
+ this.selection = selection;
+ }
+
+ public List<Capital> getSelectedCapitals() {
+ return selectedCapitals;
+ }
+
+ public void setSelectedCapitals(List<Capital> selectedCapitals) {
+ this.selectedCapitals = selectedCapitals;
+ }
+
+}
Property changes on: branches/community/3.3.X/test-applications/regression-test/src/main/java/org/richfaces/regressiontest/rf8212/ExtendedTableBean2.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/community/3.3.X/test-applications/regression-test/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/community/3.3.X/test-applications/regression-test/src/main/webapp/WEB-INF/faces-config.xml 2010-03-31 00:11:47 UTC (rev 16687)
+++ branches/community/3.3.X/test-applications/regression-test/src/main/webapp/WEB-INF/faces-config.xml 2010-03-31 08:21:38 UTC (rev 16688)
@@ -1,20 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
-<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xi="http://www.w3.org/2001/XInclude"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
- <managed-bean>
- <managed-bean-name>gameBean</managed-bean-name>
- <managed-bean-class>org.jboss.richfaces.samples.tictactoe.GameBean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- </managed-bean>
- <navigation-rule>
- <from-view-id>/pages/*</from-view-id>
- <navigation-case>
- <from-outcome>index</from-outcome>
- <to-view-id>/pages/index.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <application>
- <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
- </application>
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+ <managed-bean>
+ <managed-bean-name>extendedTableBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.regressiontest.rf8212.ExtendedTableBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>extendedTableBean2</managed-bean-name>
+ <managed-bean-class>org.richfaces.regressiontest.rf8212.ExtendedTableBean2</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <navigation-rule>
+ <from-view-id>/pages/*</from-view-id>
+ <navigation-case>
+ <from-outcome>index</from-outcome>
+ <to-view-id>/pages/index.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
</faces-config>
Modified: branches/community/3.3.X/test-applications/regression-test/src/main/webapp/WEB-INF/web.xml
===================================================================
--- branches/community/3.3.X/test-applications/regression-test/src/main/webapp/WEB-INF/web.xml 2010-03-31 00:11:47 UTC (rev 16687)
+++ branches/community/3.3.X/test-applications/regression-test/src/main/webapp/WEB-INF/web.xml 2010-03-31 08:21:38 UTC (rev 16688)
@@ -1,61 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
-<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
- <display-name>Tic Tac Toe</display-name>
- <context-param>
- <param-name>javax.faces.CONFIG_FILES</param-name>
- <param-value>/WEB-INF/faces-config.xml</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>server</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
- <param-value>.xhtml</param-value>
- </context-param>
- <context-param>
- <param-name>facelets.VIEW_MAPPINGS</param-name>
- <param-value>*.xhtml</param-value>
- </context-param>
- <context-param>
- <param-name>org.richfaces.SKIN</param-name>
- <param-value>DEFAULT</param-value>
- </context-param>
- <context-param>
- <param-name>org.richfaces.CONTROL_SKINNING</param-name>
- <param-value>enable</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
- <param-value>true</param-value>
- </context-param>
- <filter>
- <display-name>RichFaces Filter</display-name>
- <filter-name>richfaces</filter-name>
- <filter-class>org.ajax4jsf.Filter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>richfaces</filter-name>
- <servlet-name>Faces Servlet</servlet-name>
- <dispatcher>REQUEST</dispatcher>
- <dispatcher>FORWARD</dispatcher>
- <dispatcher>INCLUDE</dispatcher>
- </filter-mapping>
- <servlet>
- <servlet-name>Faces Servlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>/faces/*</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>*.jsf</url-pattern>
- </servlet-mapping>
- <login-config>
- <auth-method>BASIC</auth-method>
- </login-config>
-</web-app>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
+ <display-name>Tic Tac Toe</display-name>
+ <context-param>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/faces-config.xml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>facelets.VIEW_MAPPINGS</param-name>
+ <param-value>*.xhtml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.SKIN</param-name>
+ <param-value>DEFAULT</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.CONTROL_SKINNING</param-name>
+ <param-value>enable</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <filter>
+ <display-name>RichFaces Filter</display-name>
+ <filter-name>richfaces</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>richfaces</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
\ No newline at end of file
Modified: branches/community/3.3.X/test-applications/regression-test/src/main/webapp/pages/index.xhtml
===================================================================
--- branches/community/3.3.X/test-applications/regression-test/src/main/webapp/pages/index.xhtml 2010-03-31 00:11:47 UTC (rev 16687)
+++ branches/community/3.3.X/test-applications/regression-test/src/main/webapp/pages/index.xhtml 2010-03-31 08:21:38 UTC (rev 16688)
@@ -25,9 +25,13 @@
<td><a id="rf7994-jira" href="https://jira.jboss.org/jira/browse/RF-7994">https://jira.jboss.org/jira/browse/RF-7994</a></td>
</tr>
<tr>
- <td><a id="rf8356-tc" href="/regression-test/pages/rf8356.jsf">Items inside menu</a></td>
- <td><a id="rf8356-jira" href="https://jira.jboss.org/jira/browse/RF-8356">https://jira.jboss.org/jira/browse/RF-8356</a></td>
+ <td><a id="rf8212-tc" href="/regression-test/pages/rf8212.jsf">Extended Data Table</a></td>
+ <td><a id="rf8212-jira" href="https://jira.jboss.org/jira/browse/RF-8212">https://jira.jboss.org/jira/browse/RF-8212</a></td>
</tr>
+ <tr>
+ <td><a id="rf8356-tc" href="/regression-test/pages/rf8356.jsf">Items inside menu</a></td>
+ <td><a id="rf8356-jira" href="https://jira.jboss.org/jira/browse/RF-8356">https://jira.jboss.org/jira/browse/RF-8356</a></td>
+ </tr>
</table>
</h:form>
</ui:define>
Added: branches/community/3.3.X/test-applications/regression-test/src/main/webapp/pages/rf8212.xhtml
===================================================================
--- branches/community/3.3.X/test-applications/regression-test/src/main/webapp/pages/rf8212.xhtml (rev 0)
+++ branches/community/3.3.X/test-applications/regression-test/src/main/webapp/pages/rf8212.xhtml 2010-03-31 08:21:38 UTC (rev 16688)
@@ -0,0 +1,165 @@
+<!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:rich="http://richfaces.org/rich"
+ xmlns:a4j="http://richfaces.org/a4j">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="title">Extended Data Table - RF-8212</ui:define>
+
+ <ui:define name="body">
+ <h1>Extended Data Table</h1>
+ <h3><a href="https://jira.jboss.org/jira/browse/RF-8212">https://jira.jboss.org/jira/browse/RF-8212</a></h3>
+
+
+ <a id="back1" href="#{facesContext.externalContext.requestContextPath}">Back to main page</a>
+
+
+ <h:form>
+
+
+ <fieldset><legend>Extended DataTable example 1</legend>
+
+ <h:panelGrid columns="2">
+ <rich:extendedDataTable value="#{extendedTableBean.capitalsDataModel}" var="cap" id="table1"
+ width="580px" height="400px" sortMode="#{extendedTableBean.sortMode}"
+ selectionMode="#{extendedTableBean.selectionMode}" tableState="#{extendedTableBean.tableState}"
+ selection="#{extendedTableBean.selection}">
+ <rich:column sortable="true" sortBy="#{cap.state}" id="col1_1" filterBy="#{cap.state}"
+ filterEvent="onkeyup" width="170px" label="State Name">
+ <f:facet name="header">
+ <h:outputText value="State Name" id="stateName1" />
+ </f:facet>
+ <h:outputText value="#{cap.state}" id="capState" />
+ </rich:column>
+ <rich:column sortable="true" sortBy="#{cap.name}" id="col2_1" filterBy="#{cap.name}"
+ filterEvent="onkeyup" width="170px" label="State Capital">
+ <f:facet name="header">
+ <h:outputText value="State Capital" id="stateCapital1" />
+ </f:facet>
+ <h:outputText value="#{cap.name}" id="capName1" />
+ </rich:column>
+ <a4j:support reRender="table2" id="extendedTableBeanTakeSelection"
+ action="#{extendedTableBean.takeSelection}" event="onselectionchange" />
+ </rich:extendedDataTable>
+ <h:panelGroup layout="block" style="width:250px">
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Sort/Selection modes changing" />
+ </f:facet>
+ <h:panelGrid columns="2">
+ <h:outputText value="Sort Mode:" />
+ <h:selectOneMenu value="#{extendedTableBean.sortMode}">
+ <f:selectItem itemLabel="Single" itemValue="single" />
+ <f:selectItem itemLabel="Multi" itemValue="multi" />
+ <a4j:support event="onchange" ajaxSingle="true" reRender="table1"
+ id="supportSortOnchange1" />
+ </h:selectOneMenu>
+ <h:outputText value="Selection Mode:" />
+ <h:selectOneMenu value="#{extendedTableBean.selectionMode}">
+ <a4j:support ajaxSingle="true" event="onchange" reRender="table1"
+ id="supportSelectOnchange1" />
+ <f:selectItem itemLabel="Single" itemValue="single" />
+ <f:selectItem itemLabel="Multi" itemValue="multi" />
+ <f:selectItem itemLabel="None" itemValue="none" />
+ </h:selectOneMenu>
+ </h:panelGrid>
+ </rich:panel>
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Currently selected rows:" />
+ </f:facet>
+ <rich:dataTable value="#{extendedTableBean.selectedCapitals}" var="sel" id="selectionTable1">
+ <rich:column>
+ <h:outputText value="#{sel.state}" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{sel.name}" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{sel.timeZone}" />
+ </rich:column>
+ </rich:dataTable>
+ </rich:panel>
+ </h:panelGroup>
+ </h:panelGrid>
+ </fieldset>
+ <rich:spacer height="20" />
+
+
+
+ <fieldset><legend>Extended Data Table example 2 - none</legend> <h:panelGrid columns="2"
+ columnClasses="top , top">
+ <rich:extendedDataTable value="#{extendedTableBean2.capitalsDataModel}" var="cap" id="table2"
+ width="580px" height="400px" sortMode="#{extendedTableBean2.sortMode}"
+ selectionMode="#{extendedTableBean2.selectionMode}" tableState="#{extendedTableBean2.tableState}"
+ selection="#{extendedTableBean2.selection}">
+ <rich:column sortable="true" sortBy="#{cap.state}" id="col1_2" filterBy="#{cap.state}"
+ filterEvent="onkeyup" width="170px" label="State Name">
+ <f:facet name="header">
+ <h:outputText value="State Name" id="stateName2" />
+ </f:facet>
+ <h:outputText value="#{cap.state}" id="capState2" />
+ </rich:column>
+ <rich:column sortable="true" sortBy="#{cap.name}" id="col2_2" filterBy="#{cap.name}"
+ filterEvent="onkeyup" width="170px" label="State Capital">
+ <f:facet name="header">
+ <h:outputText value="State Capital" id="stateCapital2" />
+ </f:facet>
+ <h:outputText value="#{cap.name}" id="capName2" />
+ </rich:column>
+ </rich:extendedDataTable>
+ <h:panelGroup layout="block" style="width:250px">
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Sort/Selection modes changing" />
+ </f:facet>
+ <h:panelGrid columns="2">
+ <h:outputText value="Sort Mode:" />
+ <h:selectOneMenu value="#{extendedTableBean2.sortMode}">
+ <f:selectItem itemLabel="Single" itemValue="single" />
+ <f:selectItem itemLabel="Multi" itemValue="multi" />
+ <a4j:support event="onchange" ajaxSingle="true" reRender="table2"
+ id="supportSortOnchange2" />
+ </h:selectOneMenu>
+ <h:outputText value="Selection Mode:" />
+ <h:selectOneMenu value="#{extendedTableBean2.selectionMode}">
+ <a4j:support ajaxSingle="true" event="onchange" reRender="table2"
+ id="supportSelectOnchange2" />
+ <f:selectItem itemLabel="Single" itemValue="single" />
+ <f:selectItem itemLabel="Multi" itemValue="multi" />
+ <f:selectItem itemLabel="None" itemValue="none" />
+ </h:selectOneMenu>
+ </h:panelGrid>
+ </rich:panel>
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Currently selected rows:" />
+ </f:facet>
+ <rich:dataTable value="#{extendedTableBean2.selectedCapitals}" var="sel" id="selectionTable2">
+ <rich:column>
+ <h:graphicImage value="#{sel.stateFlag}" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{sel.state}" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{sel.name}" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{sel.timeZone}" />
+ </rich:column>
+ </rich:dataTable>
+ </rich:panel>
+ </h:panelGroup>
+ </h:panelGrid></fieldset>
+
+ </h:form>
+ <a id="back2" href="#{facesContext.externalContext.requestContextPath}">Back to main page</a>
+
+ </ui:define>
+
+</ui:composition>
+</body>
+</html>
Property changes on: branches/community/3.3.X/test-applications/regression-test/src/main/webapp/pages/rf8212.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 9 months
JBoss Rich Faces SVN: r16687 - root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-03-30 20:11:47 -0400 (Tue, 30 Mar 2010)
New Revision: 16687
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
Log:
https://jira.jboss.org/jira/browse/RF-8523 - process renderer-specific components from annotations.
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-03-30 23:44:36 UTC (rev 16686)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-03-31 00:11:47 UTC (rev 16687)
@@ -23,6 +23,7 @@
package org.richfaces.cdk.apt.processors;
+import com.google.common.collect.Lists;
import com.google.inject.Inject;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.annotations.Description;
@@ -47,6 +48,7 @@
import javax.lang.model.type.MirroredTypesException;
import javax.lang.model.type.TypeMirror;
import java.lang.annotation.Annotation;
+import java.util.List;
import java.util.Set;
/**
@@ -165,6 +167,19 @@
processEvents(componentElement, component, annotation);
// TODO - process interfaces() attribute.
+ List<ClassName> interfaceNames = Lists.newArrayList();
+ 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){
+ // TODO call processAttributes with element from type mirror.
+ interfaceNames.add(ClassName.parseName(mirror.toString()));
+ }
+ }
processAttributes(componentElement, component,annotation.attributes());
for (Tag tag : annotation.tag()) {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2010-03-30 23:44:36 UTC (rev 16686)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2010-03-31 00:11:47 UTC (rev 16687)
@@ -24,6 +24,7 @@
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import java.util.Collection;
+import java.util.List;
import java.util.Set;
public abstract class ProcessorBase {
@@ -152,7 +153,6 @@
Set<BeanProperty> properties = Sets.newHashSet();
properties.addAll(sourceUtils.getBeanPropertiesAnnotatedWith(Attribute.class, componentClassName));
properties.addAll(sourceUtils.getAbstractBeanProperties(componentClassName));
-
// TODO - encapsulate attribute builder into utility class.
for (BeanProperty beanProperty : properties) {
attributeProcessor.process(beanProperty, component.getOrCreateAttribute(beanProperty.getName()));
14 years, 9 months
JBoss Rich Faces SVN: r16686 - in root/cdk/trunk/plugins: generator/src/main/java/org/richfaces/cdk/apt/processors and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-03-30 19:44:36 -0400 (Tue, 30 Mar 2010)
New Revision: 16686
Added:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Description.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/SubComponent.java
Removed:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Attributes.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/DefaultValue.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/DisplayName.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/EventNames.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Facets.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Family.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Fires.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Generate.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Icon.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/RendererTemplate.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/RendererTemplates.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/SuggestedValue.java
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Alias.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Attribute.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Facet.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/package-info.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ConverterProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ValidatorProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AnnotationProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/BehaviorProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
Log:
https://jira.jboss.org/jira/browse/RF-8523 - process renderer-specific components from annotations.
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Alias.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Alias.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Alias.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -37,18 +37,17 @@
* @author asmirnov(a)exadel.com
*/
@Retention(RetentionPolicy.CLASS)
-@Target( { ElementType.METHOD, ElementType.FIELD })
public @interface Alias {
public static final String NAME = "org.richfaces.cdk.annotations.Alias";
/**
* <p class="changed_added_4_0">
- * Attribute aliases. This is mandatory parameter
+ * Attribute alias. This is mandatory parameter
* </p>
*
* @return attribute aliases.
*/
- public String[] value();
+ public String value();
}
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Attribute.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Attribute.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Attribute.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -79,15 +79,15 @@
boolean generate() default true;
- String displayName() default "";
-
String defaultValue() default "";
String suggestedValue() default "";
- Icon icon() default @Icon();
+ Description description() default @Description();
Signature signature() default @Signature();
EventName[] events() default {};
+
+ Alias[] aliases() default {};
}
Deleted: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Attributes.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Attributes.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Attributes.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -1,55 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- */
-(a)Retention(RetentionPolicy.CLASS)
-(a)Target(ElementType.TYPE)
-@Inherited
-public @interface Attributes {
-
- public static final String NAME = "org.richfaces.cdk.annotations.Attributes";
-
- /**
- * <p class="changed_added_4_0">
- * To avoid copy/paste routine for standard or other useful attributes, their definitions could be stored in
- * faces-config.xml extensions and reused from different components.
- * </p>
- *
- * @return URL's of the XML files that contain attribute definitions.
- */
- public String[] value();
-
-}
Deleted: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/DefaultValue.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/DefaultValue.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/DefaultValue.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -1,44 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-(a)Retention(RetentionPolicy.CLASS)
-@Target( { ElementType.METHOD, ElementType.FIELD })
-@Inherited
-public @interface DefaultValue {
- String value();
-}
Copied: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Description.java (from rev 16685, root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Icon.java)
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Description.java (rev 0)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Description.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -0,0 +1,66 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.annotations;
+
+/**
+ * <p class="changed_added_4_0">
+ * Description used that would be used in IDE to display.
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ */
+public @interface Description {
+
+ public static final String NAME = "org.richfaces.cdk.annotations.Description";
+
+ /**
+ * <p class="changed_added_4_0">Long description of the object.</p>
+ * @return
+ */
+ public String value() default "";
+ /**
+ * <p class="changed_added_4_0">
+ * Display name for development tools.
+ * </p>
+ *
+ * @return
+ */
+ public String displayName() default "";
+
+ /**
+ * <p class="changed_added_4_0">
+ * URL that defines IDE icon.
+ * </p>
+ *
+ * @return Description url.
+ */
+ public String smallIcon() default "";
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return
+ */
+ public String largeIcon() default "";
+
+}
Property changes on: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Description.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Deleted: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/DisplayName.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/DisplayName.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/DisplayName.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -1,55 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p class="changed_added_4_0">
- * Defines name that would be used in IDE to display.
- * </p>
- *
- * @author asmirnov(a)exadel.com
- */
-(a)Retention(RetentionPolicy.CLASS)
-@Target( { ElementType.TYPE, ElementType.METHOD })
-@Inherited
-public @interface DisplayName {
-
- public static final String NAME = "org.richfaces.cdk.annotations.DisplayName";
-
- /**
- * <p class="changed_added_4_0">
- * IDE display name.
- * </p>
- *
- * @return Icon url.
- */
- public String value();
-
-}
Deleted: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/EventNames.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/EventNames.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/EventNames.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -1,51 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-(a)Retention(RetentionPolicy.CLASS)
-@Target( { ElementType.METHOD, ElementType.FIELD })
-@Inherited
-public @interface EventNames {
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @return
- */
- public EventName[] value();
-}
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Facet.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Facet.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Facet.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -49,12 +49,23 @@
*
* @return
*/
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return
+ */
String name() default "";
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return
+ */
boolean generate() default true;
- Icon icon() default @Icon;
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return
+ */
+ Description description() default @Description;
- String displayName() default "";
}
Deleted: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Facets.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Facets.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Facets.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -1,55 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- */
-(a)Retention(RetentionPolicy.CLASS)
-(a)Target(ElementType.TYPE)
-@Inherited
-public @interface Facets {
-
- public static final String NAME = "org.richfaces.cdk.annotations.Facets";
-
- /**
- * <p class="changed_added_4_0">
- * To avoid copy/paste routine for standard or other useful attributes, their definitions could be stored in
- * faces-config.xml extensions and reused from different components.
- * </p>
- *
- * @return references to XML files that contain attributes definitions.
- */
- public Facet[] value();
-
-}
Deleted: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Family.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Family.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Family.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -1,62 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p class="changed_added_4_0">
- * Defines family of the JSF component or renderer.
- * </p>
- *
- * @author asmirnov(a)exadel.com
- */
-(a)Retention(RetentionPolicy.CLASS)
-(a)Target(ElementType.TYPE)
-@Inherited
-public @interface Family {
-
- /**
- * <p class="changed_added_4_0">
- * Annotation class name to use as key for annotation processor class.
- * </p>
- */
- public static final String NAME = "org.richfaces.cdk.annotations.Family";
-
- /**
- * <p class="changed_added_4_0">
- * The value of this annotation attribute is taken to be <em>component-family</em> for annotated JSF component or
- * renderer class. If this value an empty, it will be inferred from component type or <code>COMPONENT_FAMILY</code>
- * constant.
- * </p>
- *
- * @return component family.
- */
- public String value() default "";
-
-}
Deleted: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Fires.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Fires.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Fires.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -1,54 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.faces.event.FacesEvent;
-
-/**
- * <p class="changed_added_4_0">
- * This annotation defines events that are fired by component.
- * </p>
- *
- * @author asmirnov(a)exadel.com
- */
-(a)Retention(RetentionPolicy.CLASS)
-(a)Target(ElementType.TYPE)
-@Inherited
-public @interface Fires {
-
- /**
- * <p class="changed_added_4_0">
- * Array of all {@link FacesEvent} inherited classes that could be fired by component.
- * </p>
- *
- * @return
- */
- public Class<? extends FacesEvent>[] value();
-}
Deleted: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Generate.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Generate.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Generate.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -1,58 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p class="changed_added_4_0">
- * The presence of this annotation tells CDK to generate class or method implementation even though target does not have
- * the {@code abstract} modifier.
- * </p>
- *
- * @author asmirnov(a)exadel.com
- */
-(a)Retention(RetentionPolicy.CLASS)
-@Target( { ElementType.TYPE, ElementType.METHOD })
-@Inherited
-public @interface Generate {
-
- public static final String NAME = "org.richfaces.cdk.annotations.Generate";
-
- public static final String DEFAULT = NAME + ".DEFAULT";
-
- /**
- * <p class="changed_added_4_0">
- * Name of the generated class. If this value was an empty, name will be inferred by CDK.
- * </p>
- *
- * @return generated object type.
- */
- public String value() default "";
-
-}
Deleted: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Icon.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Icon.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Icon.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -1,52 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.annotations;
-
-/**
- * <p class="changed_added_4_0">
- * Icon used that would be used in IDE to display.
- * </p>
- *
- * @author asmirnov(a)exadel.com
- */
-public @interface Icon {
-
- public static final String NAME = "org.richfaces.cdk.annotations.Icon";
-
- /**
- * <p class="changed_added_4_0">
- * URL that defines IDE icon.
- * </p>
- *
- * @return Icon url.
- */
- public String small() default "";
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return
- */
- public String large() default "";
-
-}
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -54,26 +54,17 @@
public Tag tag() default @Tag;
-
+ public JsfBehaviorRenderer renderer() default @JsfBehaviorRenderer();
/**
* <p class="changed_added_4_0">
- * Icon used by IDE.
+ * Description used by IDE.
* </p>
*
* @return
*/
- public Icon icon() default @Icon();
+ public Description description() default @Description();
- /**
- * <p class="changed_added_4_0">
- * Display name for development tools.
- * </p>
- *
- * @return
- */
- public String displayName() default "";
-
/**
* <p class="changed_added_4_0">
* defines fragments of faces-config.xml that contain standard attribute definitions. CDK also tries to read
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -37,4 +37,10 @@
@Target(ElementType.TYPE)
public @interface JsfBehaviorRenderer {
+ public String type() default "";
+
+ public String renderKitId() default "";
+
+ public Description description() default @Description();
+
}
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -51,9 +51,12 @@
public static final String NAME = "org.richfaces.cdk.annotations.JsfComponent";
/**
- * <p class="changed_added_4_0">Excplicitly disable component generation</p>
- */
+ * <p class="changed_added_4_0">
+ * Excplicitly disable component generation
+ * </p>
+ */
public static final String DISABLED = "##DISABLED";
+
/**
* <p class="changed_added_4_0">
* Type of the component. This is mandatory parameter because CDK uses <em>component-type</em> as primary key for
@@ -88,24 +91,15 @@
/**
* <p class="changed_added_4_0">
- * Icon used by IDE.
+ * Description used by IDE.
* </p>
*
* @return
*/
- public Icon icon() default @Icon();
+ public Description description() default @Description();
/**
* <p class="changed_added_4_0">
- * Display name for development tools.
- * </p>
- *
- * @return
- */
- public String displayName() default "";
-
- /**
- * <p class="changed_added_4_0">
* Cenerated Junit test.
* </p>
*
@@ -129,7 +123,7 @@
*
* @return
*/
- public Tag[] tag() default {@Tag};
+ public Tag[] tag() default { @Tag };
/**
* <p class="changed_added_4_0">
@@ -162,4 +156,20 @@
*/
public String[] attributes() default {};
+ /**
+ * <p class="changed_added_4_0">
+ * Interfaces that should be implemented in the generated component class. CDK processes all {@link Attribute} and
+ * {@link Facet} annotations in these interfaces
+ * </p>
+ *
+ * @return
+ */
+ public Class<?>[] interfaces() default {};
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return
+ */
+ public SubComponent[] components() default {};
+
}
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -49,22 +49,13 @@
/**
* <p class="changed_added_4_0">
- * Icon used by IDE.
+ * Description used by IDE.
* </p>
*
* @return
*/
- public Icon icon() default @Icon();
+ public Description description() default @Description();
- /**
- * <p class="changed_added_4_0">
- * Display name for development tools.
- * </p>
- *
- * @return
- */
- public String displayName() default "";
-
public Tag tag() default @Tag;
public static final class NONE {}
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -57,7 +57,6 @@
public String template() default "";
- public Icon icon() default @Icon();
+ public Description description() default @Description();
- public String displayName() default "";
}
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -22,25 +22,15 @@
public Tag tag() default @Tag;
/**
* <p class="changed_added_4_0">
- * Icon used by IDE.
+ * Description used by IDE.
* </p>
*
* @return
*/
- public Icon icon() default @Icon();
+ public Description description() default @Description();
/**
* <p class="changed_added_4_0">
- * Display name for development tools.
- * </p>
- *
- * @return
- */
- public String displayName() default "";
-
-
- /**
- * <p class="changed_added_4_0">
* defines fragments of faces-config.xml that contain standard attribute definitions. CDK also tries to read
* META-INF/cdk/attributes/[classname].xml file for all component superclasses and interfaces, therefore it is not
* necessary to explicit include definitions for UIComponent and any other standard JSF classes. CDK defines couple
Deleted: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/RendererTemplate.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/RendererTemplate.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/RendererTemplate.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -1,49 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.annotations;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- */
-(a)Retention(RetentionPolicy.SOURCE)
-public @interface RendererTemplate {
-
- public static final String NAME = "org.richfaces.cdk.annotations.RendererTemplate";
-
- /**
- * <p class="changed_added_4_0">
- * Reference to renderer template used with that component.
- * </p>
- *
- * @return template url.
- */
- public String value();
-
-}
Deleted: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/RendererTemplates.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/RendererTemplates.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/RendererTemplates.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -1,50 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.annotations;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- */
-(a)Retention(RetentionPolicy.SOURCE)
-public @interface RendererTemplates {
-
- public static final String NAME = "org.richfaces.cdk.annotations.RendererTemplates";
-
- /**
- * <p class="changed_added_4_0">
- * To avoid copy/paste routine for standard or other useful attributes, their definitions could be stored in
- * faces-config.xml extensions and reused from different components.
- * </p>
- *
- * @return references to XML files that contain attributes definitions.
- */
- public RendererTemplate[] value();
-
-}
Added: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/SubComponent.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/SubComponent.java (rev 0)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/SubComponent.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -0,0 +1,133 @@
+/*
+ * $Id: JsfComponent.java 16684 2010-03-30 12:16:40Z Alex.Kolonitsky $
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * <p class="changed_added_4_0">
+ * That annotation defines class that is generated from the concrete class defined in the {@link JsfComponent}
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ */
+(a)Retention(RetentionPolicy.SOURCE)
+public @interface SubComponent {
+
+
+
+ /**
+ * <p class="changed_added_4_0">
+ * Type of the component. This is mandatory parameter because CDK uses <em>component-type</em> as primary key for
+ * components library model.
+ * </p>
+ * <p class="todo">
+ * TODO if this value is an empty, component type will be inferred from class name.
+ * </p>
+ *
+ * @return component type.
+ */
+ public String type() default "";
+
+
+ /**
+ * <p class="changed_added_4_0">
+ * Name of the generated component implementation class.
+ * </p>
+ *
+ * @return
+ */
+ public String generate() default "";
+
+ /**
+ * <p class="changed_added_4_0">
+ * Description used by IDE.
+ * </p>
+ *
+ * @return
+ */
+ public Description description() default @Description();
+
+ /**
+ * <p class="changed_added_4_0">
+ * Cenerated Junit test.
+ * </p>
+ *
+ * @return
+ */
+ public Test test() default @Test(testClass = "");
+
+ /**
+ * <p class="changed_added_4_0">
+ * JsfRenderer associated with this component.
+ * </p>
+ *
+ * @return
+ */
+ public JsfRenderer renderer() default @JsfRenderer();
+
+ /**
+ * <p class="changed_added_4_0">
+ * View Description Language, JSP or Facelets, tags.
+ * </p>
+ *
+ * @return
+ */
+ public Tag[] tag() default { @Tag };
+
+
+ /**
+ * <p class="changed_added_4_0">
+ * Component facets.
+ * </p>
+ *
+ * @return
+ */
+ public Facet[] facets() default {};
+
+ /**
+ * <p class="changed_added_4_0">
+ * defines fragments of faces-config.xml that contain standard attribute definitions. CDK also tries to read
+ * META-INF/cdk/attributes/[classname].xml file for all component superclasses and interfaces, therefore it is not
+ * necessary to explicit include definitions for UIComponent and any other standard JSF classes. CDK defines couple
+ * of its own "urn" namespaces: "urn:resource:" for classpath resources, "urn:config:" for for project configuration
+ * folder and "urn:attributes:" for META-INF/cdk/attributes/ in the annotations library.
+ * </p>
+ *
+ * @return
+ */
+ public String[] attributes() default {};
+
+ /**
+ * <p class="changed_added_4_0">
+ * Interfaces that should be implemented in the generated component class. CDK processes all {@link Attribute} and
+ * {@link Facet} annotations in these interfaces
+ * </p>
+ *
+ * @return
+ */
+ public Class<?>[] interfaces() default {};
+
+}
Property changes on: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/SubComponent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/SuggestedValue.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/SuggestedValue.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/SuggestedValue.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -1,42 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-(a)Retention(RetentionPolicy.SOURCE)
-@Target( { ElementType.METHOD, ElementType.FIELD })
-public @interface SuggestedValue {
- String value();
-}
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/package-info.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/package-info.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/package-info.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -11,7 +11,7 @@
* <li>@{@link JsfRenderer}("retnderer.Type") , @{@link RendererTemplate}("/renderer/template.xml") associate renderer with that component. The first one defines independently created renderer, while @{@link RendererTemplate tells CDK to generate renderer class from that template. It is possible to define more than one template with component class using @{@link RendererTemplates}({@{@link RendererTemplate}("one.xml"),@{@link RendererTemplate}("two.xml").<br /></li>
* <li>@{@link Attributes}({"base.xml","command.xml"}) defines fragments of faces-config.xml which contain standart attributes definitions. CDK also tries to read META-INF/cdk/attributes/[classname].xml file for all component superclasses and interfaces, therefore it is not necessary to explicit include definitions for UIComponent and any other standard JSF classes. CDK defines couple of its own "urn" namespaces: "urn:resource:" for classpath resources, "urn:config:" for for project configuration folder and "urn:attributes:" for META-INF/cdk/attributes/ in the annotations library.<br /></li>
* <li>@{@link Fires}({MyEvent.class}) defines event classes that this component could fire.</li>
- * <li>@{@link Icon} , @{@link DisplayName} - optional IDE-related parameters.<br /></li>
+ * <li>@{@link Description} , @{@link DisplayName} - optional IDE-related parameters.<br /></li>
* </ul>
* <p> </p>
* <h2>Attribute level annotations ( for getter or setter level ):</h2>
@@ -22,7 +22,7 @@
* <li>@{@link Alias}({"foo","bar"})</li>
* <li>@{@link EventName}(value="click",defaultEvent=true) defines behavior event name for that attribute. To define more than one event name they could be grouped as @{@link EventNames}({@{@link EventName}("foo),@{@link EventName}("bar")})</li>
* <li>@{@link DefaultValue}("12"), @{@link SuggestedValue}("12") ...</li>
- * <li>@{@link Icon} , @{@link DisplayName} - optional IDE-related parameters.</li>
+ * <li>@{@link Description} , @{@link DisplayName} - optional IDE-related parameters.</li>
* </ul>
* <p> </p>
* <h3>Facet annotations.</h3>
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -53,7 +53,7 @@
Attribute attributeAnnotarion = beanProperty.getAnnotation(Attribute.class);
if (attributeAnnotarion == null) {
attribute.setGenerate(!beanProperty.isExists());
- setDescription(attribute, null, beanProperty.getDocComment(), null);
+ setDescription(attribute, null, beanProperty.getDocComment());
} else {
attribute.setHidden(attributeAnnotarion.hidden());
@@ -63,7 +63,7 @@
attribute.setReadOnly(attributeAnnotarion.readOnly());
attribute.setGenerate(attributeAnnotarion.generate() || !beanProperty.isExists());
- setDescription(attribute, attributeAnnotarion.icon(), beanProperty.getDocComment(), attributeAnnotarion.displayName());
+ setDescription(attribute, attributeAnnotarion.description(), beanProperty.getDocComment());
String defaultValue = attributeAnnotarion.defaultValue();
if (!Strings.isEmpty(defaultValue)) {
@@ -135,8 +135,4 @@
}
}
- @Override
- protected String[] getAnnotationAttributes(TypeElement componentElement) {
- throw new UnsupportedOperationException();
- }
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -49,8 +49,8 @@
setClassNames(element, behaviorModel, behavior.generate());
setTagInfo(behavior.tag(), behaviorModel);
- processAttributes(element, behaviorModel);
- setDescription(behaviorModel, behavior.icon(), getDocComment(element), behavior.displayName());
+ processAttributes(element, behaviorModel,behavior.attributes());
+ setDescription(behaviorModel, behavior.description(), getDocComment(element));
library.getBehaviors().add(behaviorModel);
}
@@ -60,12 +60,4 @@
return JsfBehavior.class;
}
-
-
- @Override
- protected String[] getAnnotationAttributes(TypeElement element) {
- JsfBehavior behavior = element.getAnnotation(JsfBehavior.class);
- return behavior.attributes();
- }
-
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -21,17 +21,21 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
package org.richfaces.cdk.apt.processors;
import com.google.inject.Inject;
import org.richfaces.cdk.CdkException;
+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;
+import org.richfaces.cdk.annotations.SubComponent;
import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.annotations.Test;
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.FacesId;
@@ -46,12 +50,13 @@
import java.util.Set;
/**
- * <p class="changed_added_4_0">That class process component-related annotations such as {@link org.richfaces.cdk.annotations.JsfComponent} or
+ * <p class="changed_added_4_0">
+ * That class process component-related annotations such as {@link org.richfaces.cdk.annotations.JsfComponent} or
* {@link javax.faces.component.FacesComponent} and stores information in model.
* </p>
- *
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
public class ComponentProcessor extends ProcessorBase implements CdkAnnotationProcessor {
@@ -63,7 +68,7 @@
private RendererProcessor rendererProcessor;
public void process(TypeElement componentElement, ComponentLibrary library) {
- JsfComponent annotation = componentElement.getAnnotation(JsfComponent.class);
+ final JsfComponent annotation = componentElement.getAnnotation(JsfComponent.class);
if (annotation == null) {
return;
}
@@ -73,67 +78,141 @@
// Should that component be generated ?
setClassNames(componentElement, component, annotation.generate());
setComponentProperties(componentElement, component, annotation, library);
- for (Tag tag : annotation.tag()) {
- setTagInfo(tag, component);
+ for (final SubComponent subcomponent : annotation.components()) {
+ JsfComponent subAnnotation = new JsfComponent() {
+
+ @Override
+ public Class<? extends Annotation> annotationType() {
+ return JsfComponent.class;
+ }
+
+ @Override
+ public String type() {
+ return subcomponent.type();
+ }
+
+ @Override
+ public Test test() {
+ return subcomponent.test();
+ }
+
+ @Override
+ public Tag[] tag() {
+ return subcomponent.tag();
+ }
+
+ @Override
+ public JsfRenderer renderer() {
+ return subcomponent.renderer();
+ }
+
+ @Override
+ public Class<?>[] interfaces() {
+ return subcomponent.interfaces();
+ }
+
+ @Override
+ public String generate() {
+ return subcomponent.generate();
+ }
+
+ @Override
+ public Event[] fires() {
+ return new Event[0];
+ }
+
+ @Override
+ public String family() {
+ return annotation.family();
+ }
+
+ @Override
+ public Facet[] facets() {
+ return subcomponent.facets();
+ }
+
+ @Override
+ public Description description() {
+ return subcomponent.description();
+ }
+
+ @Override
+ public SubComponent[] components() {
+ return new SubComponent[0];
+ }
+
+ @Override
+ public String[] attributes() {
+ return subcomponent.attributes();
+ }
+ };
+ ComponentModel subcomponentModel = new ComponentModel();
+ subcomponentModel.setBaseClass(component.getTargetClass());
+ subcomponentModel.setTargetClass(ClassName.parseName(subcomponent.generate()));
+ setComponentProperties(null, subcomponentModel, subAnnotation, library);
}
library.getComponents().add(component);
}
- private void setComponentProperties(TypeElement componentElement, ComponentModel component, JsfComponent annotation, ComponentLibrary library)
- throws CdkException {
+ void setComponentProperties(TypeElement componentElement, ComponentModel component,
+ JsfComponent annotation, ComponentLibrary library) throws CdkException {
setComponentType(componentElement, component, annotation.type());
setComponeneFamily(componentElement, component, annotation.family());
- setDescription(component, annotation.icon(), getDocComment(componentElement), annotation.displayName());
+ setDescription(component, annotation.description(), getDocComment(componentElement));
processFacets(componentElement, component, annotation);
processEvents(componentElement, component, annotation);
- processAttributes(componentElement, component);
+ // TODO - process interfaces() attribute.
+ processAttributes(componentElement, component,annotation.attributes());
+ for (Tag tag : annotation.tag()) {
+ setTagInfo(tag, component);
+ }
+
rendererProcessor.process(componentElement, annotation.renderer(), library);
// TODO - process @Test annotations.
}
- private void setComponentType(TypeElement componentElement, ComponentModel component, String type) {
+ void setComponentType(TypeElement componentElement, ComponentModel component, String type) {
if (!Strings.isEmpty(type)) {
component.setType(FacesId.parseId(type));
- return;
+ } else if (null != componentElement) {
+ // static final String COMPONENT_FAMILY = "...";
+ Object value = getSourceUtils().getConstant(asClassDesctiption(componentElement), COMPONENT_TYPE);
+ if (value != null) {
+ component.setType(FacesId.parseId(value.toString()));
+ }
}
-
- // static final String COMPONENT_FAMILY = "...";
- Object value = getSourceUtils().getConstant(asClassDesctiption(componentElement), COMPONENT_TYPE);
- if (value != null) {
- component.setType(FacesId.parseId(value.toString()));
- return;
- }
-
- component.setType(this.getNamingConventions().inferComponentType(asClassDesctiption(componentElement)));
}
final void processFacets(TypeElement componentElement, ComponentModel component, JsfComponent annotation) {
- SourceUtils sourceUtils = getSourceUtils();
- Set<BeanProperty> properties = sourceUtils.getBeanPropertiesAnnotatedWith(Facet.class, asClassDesctiption(componentElement));
+ if (null != componentElement) {
+ SourceUtils sourceUtils = getSourceUtils();
+ Set<BeanProperty> properties =
+ sourceUtils.getBeanPropertiesAnnotatedWith(Facet.class, asClassDesctiption(componentElement));
- // TODO - encapsulate attribute builder into utility class.
- for (BeanProperty beanProperty : properties) {
- Facet facet = beanProperty.getAnnotation(Facet.class);
- FacetModel facetModel = component.getOrCreateFacet(beanProperty.getName());
+ // TODO - encapsulate attribute builder into utility class.
+ for (BeanProperty beanProperty : properties) {
+ Facet facet = beanProperty.getAnnotation(Facet.class);
+ FacetModel facetModel = component.getOrCreateFacet(beanProperty.getName());
- facetModel.setDescription(beanProperty.getDocComment());
+ facetModel.setDescription(beanProperty.getDocComment());
- processFacet(facet, facetModel);
- if (!beanProperty.isExists()) {
- facetModel.setGenerate(true);
+ processFacet(facet, facetModel, beanProperty.getDocComment());
+ if (!beanProperty.isExists()) {
+ facetModel.setGenerate(true);
+ }
}
+
}
-
for (Facet facet : annotation.facets()) {
String name = facet.name();
if (!Strings.isEmpty(name)) {
FacetModel facetModel = component.getOrCreateFacet(name);
- processFacet(facet, facetModel);
+ processFacet(facet, facetModel, null);
} else {
// TODO - record error.
throw new CdkException("Facet name should be set");
@@ -141,29 +220,23 @@
}
}
- final void processFacet(Facet facet, FacetModel facetModel) {
- setIcon(facetModel, facet.icon());
- facetModel.setDisplayname(facet.displayName());
+ final void processFacet(Facet facet, FacetModel facetModel, String docComment) {
+ setDescription(facetModel, facet.description(), docComment);
facetModel.setGenerate(facet.generate());
}
final void setComponeneFamily(TypeElement componentElement, ComponentModel component, String family) {
if (!Strings.isEmpty(family)) {
component.setFamily(family);
- return;
+ } else if (null != componentElement) {
+ // static final String COMPONENT_FAMILY = "...";
+ Object value = getSourceUtils().getConstant(asClassDesctiption(componentElement), COMPONENT_FAMILY);
+ if (null != value) {
+ component.setFamily(value.toString());
+ }
}
-
- // static final String COMPONENT_FAMILY = "...";
- Object value = getSourceUtils().getConstant(asClassDesctiption(componentElement), COMPONENT_FAMILY);
- if (null != value) {
- component.setFamily(value.toString());
- return;
- }
-
- component.setFamily(getNamingConventions().inferUIComponentFamily(component.getType()));
}
-
final void processEvents(TypeElement componentElement, ComponentModel component, JsfComponent annotation) {
Event[] fires = annotation.fires();
@@ -183,11 +256,6 @@
}
@Override
- protected final String[] getAnnotationAttributes(TypeElement componentElement) {
- return componentElement.getAnnotation(JsfComponent.class).attributes();
- }
-
- @Override
public final Class<? extends Annotation> getProcessedAnnotation() {
return JsfComponent.class;
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ConverterProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ConverterProcessor.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ConverterProcessor.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -59,9 +59,9 @@
}
}
- setDescription(converterModel, converter.icon(), getDocComment(element), converter.displayName());
+ setDescription(converterModel, converter.description(), getDocComment(element));
- processAttributes(element, converterModel);
+ processAttributes(element, converterModel,converter.attributes());
setClassNames(element, converterModel, converter.generate());
setTagInfo(converter.tag(), converterModel);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -6,7 +6,7 @@
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.NamingConventions;
import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.Icon;
+import org.richfaces.cdk.annotations.Description;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
@@ -65,32 +65,36 @@
model.getTags().add(tagModel);
}
- protected void setIcon(DescriptionGroup component, Icon icon) {
- if (null != icon && (!Strings.isEmpty(icon.small()) || !Strings.isEmpty(icon.large()))) {
+ protected void setIcon(DescriptionGroup component, Description icon) {
+ if (null != icon && (!Strings.isEmpty(icon.smallIcon()) || !Strings.isEmpty(icon.largeIcon()))) {
DescriptionGroup.Icon iconValue = new DescriptionGroup.Icon();
- if (!Strings.isEmpty(icon.small())) {
- iconValue.setSmallIcon(icon.small());
+ if (!Strings.isEmpty(icon.smallIcon())) {
+ iconValue.setSmallIcon(icon.smallIcon());
}
- if (!Strings.isEmpty(icon.large())) {
- iconValue.setLargeIcon(icon.large());
+ if (!Strings.isEmpty(icon.largeIcon())) {
+ iconValue.setLargeIcon(icon.largeIcon());
}
component.setIcon(iconValue);
}
}
- protected void setDescription(DescriptionGroup component, Icon icon, String description, String displayName) {
- component.setDescription(description);
-
- if (icon != null) {
- setIcon(component, icon);
+ protected void setDescription(DescriptionGroup component, Description description, String docComment) {
+ if(!Strings.isEmpty(docComment)){
+ component.setDescription(docComment);
}
+ if (description != null) {
+ setIcon(component, description);
+ if (!Strings.isEmpty(description.displayName())) {
+ component.setDisplayname(description.displayName());
+ }
+ if (!Strings.isEmpty(description.value())) {
+ component.setDescription(description.value());
+ }
+ }
- if (!Strings.isEmpty(displayName)) {
- component.setDisplayname(displayName);
- }
}
protected void setClassNames(TypeElement componentElement, ModelElementBase modelElement,
@@ -114,14 +118,11 @@
}
protected String getDocComment(TypeElement componentElement) {
- return getSourceUtils().getDocComment(asClassDesctiption(componentElement));
+ return null != componentElement?getSourceUtils().getDocComment(asClassDesctiption(componentElement)):null;
}
- protected abstract String[] getAnnotationAttributes(TypeElement componentElement);
+ protected void processAttributes(TypeElement componentElement, final BeanModelBase component, String[] annotationAttributes) throws CdkException {
-
- protected void processAttributes(TypeElement componentElement, final BeanModelBase component) throws CdkException {
-
// Process XML files with standard attributes definitions.
SourceUtils sourceUtils = getSourceUtils();
ClassName componentClassName = asClassDesctiption(componentElement);
@@ -139,10 +140,10 @@
});
// Process all files from @Jsf.. attributes property.
- for(String annotationAttributes : getAnnotationAttributes(componentElement)){
+ for(String attributes : annotationAttributes){
try {
component.getAttributes().addAll(parseProperties(
- CdkEntityResolver.URN_ATTRIBUTES + annotationAttributes));
+ CdkEntityResolver.URN_ATTRIBUTES + attributes));
} catch (CdkException e) {
// TODO - log errors ?
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -83,7 +83,7 @@
setRendererType(rendererElement, rendererModel, annotation);
setComponentType(rendererModel);
setComponentFamily(rendererElement, rendererModel, annotation);
- setDescription(rendererModel, annotation.icon(), getDocComment(rendererElement), annotation.displayName());
+ setDescription(rendererModel, annotation.description(), getDocComment(rendererElement));
setTemplate(rendererModel, annotation);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ValidatorProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ValidatorProcessor.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ValidatorProcessor.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -44,7 +44,7 @@
ValidatorModel validatorModel = new ValidatorModel(FacesId.parseId(validator.id()));
setClassNames(element, validatorModel, validator.generate());
- setDescription(validatorModel, validator.icon(), getDocComment(element), validator.displayName());
+ setDescription(validatorModel, validator.description(), getDocComment(element));
setTagInfo(validator.tag(), validatorModel);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -48,7 +48,7 @@
private String displayname;
/**
* <p class="changed_added_4_0">
- * Icon name for IDE tools
+ * Description name for IDE tools
* </p>
*/
private Icon icon;
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AnnotationProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AnnotationProcessorTest.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/AnnotationProcessorTest.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -21,10 +21,14 @@
package org.richfaces.cdk.apt.processors;
-import com.google.common.collect.ImmutableList;
-import com.google.inject.Binder;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.el.ELContext;
+import javax.faces.component.UIComponent;
+import javax.lang.model.element.Name;
+
import org.richfaces.cdk.CdkClassLoader;
import org.richfaces.cdk.CdkTestBase;
import org.richfaces.cdk.FileManager;
@@ -36,18 +40,14 @@
import org.richfaces.cdk.SourceFileManager;
import org.richfaces.cdk.SourceImpl;
import org.richfaces.cdk.Sources;
-import org.richfaces.cdk.apt.processors.ComponentProcessor;
-import org.richfaces.cdk.annotations.Family;
+import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.model.ComponentModel;
-import javax.el.ELContext;
-import javax.faces.component.UIComponent;
-import javax.lang.model.element.Name;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.Binder;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* @author akolonitsky
* @since Jan 14, 2010
@@ -136,7 +136,7 @@
protected CdkClassLoader createClassLoader() {
try {
return new CdkClassLoader(ImmutableList.of(getLibraryFile("test.source.properties"),
- getLibraryFile(ComponentModel.class), getLibraryFile(ELContext.class), getLibraryFile(Family.class),
+ getLibraryFile(ComponentModel.class), getLibraryFile(ELContext.class), getLibraryFile(JsfComponent.class),
getLibraryFile(UIComponent.class)), this.getClass().getClassLoader());
} catch (Exception e) {
throw new RuntimeException(e);
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/BehaviorProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/BehaviorProcessorTest.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/BehaviorProcessorTest.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -38,6 +38,7 @@
import org.richfaces.cdk.NamingConventions;
import org.richfaces.cdk.Stub;
import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.Description;
import org.richfaces.cdk.annotations.JsfBehavior;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
@@ -89,6 +90,9 @@
private JsfBehavior behaviorAnnotation;
@Mock
+ private Description description;
+
+ @Mock
private JAXB jaxb;
@Mock
@@ -107,8 +111,7 @@
expect(behaviorAnnotation.generate()).andReturn("foo.Bar");
expect(behaviorAnnotation.tag()).andReturn(tag);
expect(behaviorAnnotation.attributes()).andReturn(new String[]{});
- expect(behaviorAnnotation.icon()).andReturn(null);
- expect(behaviorAnnotation.displayName()).andReturn(null);
+ expect(behaviorAnnotation.description()).andReturn(this.description);
expect(tag.handler()).andStubReturn("");
utils.visitSupertypes((ClassName)anyObject(), (SuperTypeVisitor)anyObject());expectLastCall();
expect(utils.getBeanPropertiesAnnotatedWith(eq(Attribute.class), (ClassName)anyObject())).andReturn(Collections.<BeanProperty>emptySet());
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -50,7 +50,7 @@
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.Facet;
-import org.richfaces.cdk.annotations.Icon;
+import org.richfaces.cdk.annotations.Description;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
@@ -98,6 +98,9 @@
@Mock
private JsfComponent annotation;
+
+ @Mock
+ private Description description;
@Mock
private JAXB jaxb;
@@ -197,9 +200,9 @@
@Test
public void testSetIcon() throws Exception {
- Icon icon = createMock(Icon.class);
- expect(icon.large()).andReturn(LARGE_GIF).atLeastOnce();
- expect(icon.small()).andReturn(SMALL_JPG).atLeastOnce();
+ Description icon = createMock(Description.class);
+ expect(icon.largeIcon()).andReturn(LARGE_GIF).atLeastOnce();
+ expect(icon.smallIcon()).andReturn(SMALL_JPG).atLeastOnce();
replay(log, utils, componentElement, jaxb, annotation,icon);
processor.setIcon(model, icon);
verify(log, utils, componentElement, jaxb,annotation,icon );
@@ -210,9 +213,9 @@
@Test
public void testSetIcon1() throws Exception {
- Icon icon = createMock(Icon.class);
- expect(icon.large()).andReturn("").atLeastOnce();
- expect(icon.small()).andReturn("").atLeastOnce();
+ Description icon = createMock(Description.class);
+ expect(icon.largeIcon()).andReturn("").atLeastOnce();
+ expect(icon.smallIcon()).andReturn("").atLeastOnce();
replay(log, utils, componentElement, jaxb, annotation,icon);
processor.setIcon(model, icon);
verify(log, utils, componentElement, jaxb,annotation,icon );
@@ -227,14 +230,17 @@
expect(annotation.facets()).andReturn(new Facet[0]);
expect(property.getAnnotation(Facet.class)).andReturn(facet);
expect(property.getName()).andReturn("foo");
- expect(property.getDocComment()).andReturn("my comment");
+ expect(property.getDocComment()).andReturn("my comment").times(2);
expect(property.isExists()).andReturn(true);
- expect(facet.icon()).andReturn(null);
- expect(facet.displayName()).andReturn("fooFacet");
+ expect(facet.description()).andReturn(description);
expect(facet.generate()).andReturn(true);
- replay(log, utils, componentElement, jaxb, annotation,property,facet);
+ expect(this.description.smallIcon()).andReturn("");
+ expect(this.description.largeIcon()).andReturn("");
+ expect(this.description.displayName()).andReturn("fooFacet").times(2);
+ expect(this.description.value()).andReturn("");
+ replay(log, utils, componentElement, jaxb, annotation,property,facet,description);
processor.processFacets(componentElement, model, annotation);
- verify(log, utils, componentElement, jaxb,annotation,property,facet);
+ verify(log, utils, componentElement, jaxb,annotation,property,facet,description);
assertEquals(1, model.getFacets().size());
FacetModel facetModel = Iterables.getOnlyElement(model.getFacets());
assertTrue(facetModel.isGenerate());
@@ -250,12 +256,15 @@
expect(utils.getBeanPropertiesAnnotatedWith(eq(Facet.class),eq(ClassName.parseName(FOO_BAR)))).andReturn(Collections.<BeanProperty>emptySet());
expect(annotation.facets()).andReturn(new Facet[]{facet});
expect(facet.name()).andReturn("foo");
- expect(facet.icon()).andReturn(null);
- expect(facet.displayName()).andReturn("fooFacet");
+ expect(facet.description()).andReturn(this.description);
expect(facet.generate()).andReturn(true);
- replay(log, utils, componentElement, jaxb, annotation,property,facet);
+ expect(this.description.smallIcon()).andReturn("");
+ expect(this.description.largeIcon()).andReturn("");
+ expect(this.description.displayName()).andReturn("fooFacet").times(2);
+ expect(this.description.value()).andReturn("");
+ replay(log, utils, componentElement, jaxb, annotation,property,facet,description);
processor.processFacets(componentElement, model, annotation);
- verify(log, utils, componentElement, jaxb,annotation,property,facet);
+ verify(log, utils, componentElement, jaxb,annotation,property,facet,description);
assertEquals(1, model.getFacets().size());
FacetModel facetModel = Iterables.getOnlyElement(model.getFacets());
assertTrue(facetModel.isGenerate());
@@ -269,8 +278,6 @@
public void testProcessAttributesFromProperty() throws Exception {
Attribute attribute = createNiceMock(Attribute.class);
expect(componentElement.getQualifiedName()).andStubReturn(new TestName(FOO_BAR));
- expect(componentElement.getAnnotation(JsfComponent.class)).andReturn(annotation);
- expect(annotation.attributes()).andReturn(new String[0]);
utils.visitSupertypes(eq(ClassName.parseName(FOO_BAR)), (SuperTypeVisitor) anyObject());expectLastCall();
expect(utils.getBeanPropertiesAnnotatedWith(eq(Attribute.class),eq(ClassName.parseName(FOO_BAR)))).andReturn(Collections.singleton(property));
expect(utils.getAbstractBeanProperties(eq(ClassName.parseName(FOO_BAR)))).andReturn(Collections.<BeanProperty>emptySet());
@@ -279,13 +286,16 @@
expect(property.getAnnotation(Attribute.class)).andReturn(attribute);
expect(property.getDocComment()).andReturn("my comment");
// expect(property.isExists()).andReturn(true);
- expect(attribute.icon()).andReturn(null);
- expect(attribute.displayName()).andReturn("fooFacet");
+ expect(attribute.description()).andReturn(this.description);
expect(attribute.generate()).andReturn(true);
expect(attribute.events()).andReturn(new EventName[]{});
- replay(log, utils, componentElement, jaxb, annotation,property,attribute);
- processor.processAttributes(componentElement, model);
- verify(log, utils, componentElement, jaxb,annotation,property,attribute);
+ expect(this.description.smallIcon()).andReturn("");
+ expect(this.description.largeIcon()).andReturn("");
+ expect(this.description.displayName()).andReturn("fooFacet").times(2);
+ expect(this.description.value()).andReturn("");
+ replay(log, utils, componentElement, jaxb, annotation,property,attribute,description);
+ processor.processAttributes(componentElement, model,new String[0]);
+ verify(log, utils, componentElement, jaxb,annotation,property,attribute,description);
assertEquals(1, model.getAttributes().size());
PropertyBase propertyModel = Iterables.getOnlyElement(model.getAttributes());
assertTrue(propertyModel.isGenerate());
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2010-03-30 12:31:35 UTC (rev 16685)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2010-03-30 23:44:36 UTC (rev 16686)
@@ -31,7 +31,7 @@
import org.richfaces.cdk.annotations.Family;
import org.richfaces.cdk.annotations.Fires;
import org.richfaces.cdk.annotations.Generate;
-import org.richfaces.cdk.annotations.Icon;
+import org.richfaces.cdk.annotations.Description;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.test.event.TestEvent;
14 years, 9 months
JBoss Rich Faces SVN: r16685 - in root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk: templatecompiler and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-30 08:31:35 -0400 (Tue, 30 Mar 2010)
New Revision: 16685
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
Log:
RF-8232 Tags support
Remove System.out...
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2010-03-30 12:16:40 UTC (rev 16684)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2010-03-30 12:31:35 UTC (rev 16685)
@@ -1,5 +1,7 @@
package org.richfaces.cdk.apt;
+import com.google.inject.Inject;
+import org.richfaces.cdk.Logger;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.InvalidNameException;
import org.richfaces.cdk.util.PropertyUtils;
@@ -29,6 +31,8 @@
private final ProcessingEnvironment processingEnv;
+ @Inject
+ private Logger log;
/**
* <p class="changed_added_4_0"></p>
@@ -74,8 +78,8 @@
}
public Set<BeanProperty> getAbstractBeanProperties(ClassName type) {
- System.out.println("AptSourceUtils.getAbstractBeanProperties");
- System.out.println(" - type = " + type);
+ log.debug("AptSourceUtils.getAbstractBeanProperties");
+ log.debug(" - type = " + type);
Set<BeanProperty> properties = new HashSet<BeanProperty>();
List<? extends Element> members = this.processingEnv.getElementUtils().getAllMembers(asTypeElement(type));
@@ -161,7 +165,7 @@
ExecutableElement method = (ExecutableElement) childElement;
boolean exists = !isAbstract(method);
if (!annotated && exists) {
- System.out.println(" - " + childElement.getSimpleName() + " : didn't annotated and didn't abstract.");
+ log.debug(" - " + childElement.getSimpleName() + " : didn't annotated and didn't abstract.");
return;
}
@@ -174,7 +178,7 @@
} else if (!parameters.isEmpty()) {
// TODO Invalid method signature for a bean property,
// throw exception ?
- System.out.println(" - " + childElement.getSimpleName() + " : Invalid method signature for a bean property.");
+ log.debug(" - " + childElement.getSimpleName() + " : Invalid method signature for a bean property.");
return;
}
@@ -187,10 +191,10 @@
property.exists = exists;
properties.add(property);
- System.out.println(" - " + childElement.getSimpleName() + " : was added.");
+ log.debug(" - " + childElement.getSimpleName() + " : was added.");
} catch (InvalidNameException e) {
- System.out.println(" - " + childElement.getSimpleName() + " : Invalid method name for a bean property, throw.");
+ log.debug(" - " + childElement.getSimpleName() + " : Invalid method name for a bean property, throw.");
// TODO Invalid method name for a bean property, throw
// exception ?
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-03-30 12:16:40 UTC (rev 16684)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-03-30 12:31:35 UTC (rev 16685)
@@ -164,12 +164,12 @@
}
public void build(File file, RendererModel rendererModel) {
- System.out.println("RendererTemplateParser.build");
- System.out.println(" - file = " + file.getAbsolutePath());
- System.out.println(" - renderer = " + rendererModel);
+ log.debug("RendererTemplateParser.build");
+ log.debug(" - file = " + file.getAbsolutePath());
+ log.debug(" - renderer = " + rendererModel);
if (PROCESSED_TEMPLATES.containsKey(file.getAbsolutePath())) {
- System.out.println(" - Template was already processed.");
+ log.debug(" - Template was already processed.");
return;
}
14 years, 9 months
JBoss Rich Faces SVN: r16684 - in root: cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk and 11 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-30 08:16:40 -0400 (Tue, 30 Mar 2010)
New Revision: 16684
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandButton.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandLink.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/CommandButtonRendererBase.java
Removed:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxCommandButton.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxCommandLink.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxCommandButtonRendererBase.java
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentAdapter.java
root/ui/trunk/components/core/src/main/config/faces-config.xml
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractMediaOutput.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractOutputPanel.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractPush.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxFunctionRendererBase.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java
root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/button.template.xml
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/link.template.xml
Log:
RF-8232 Tags support
Correction generation of taglib and facesconfig
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -129,7 +129,7 @@
*
* @return
*/
- public Tag[] tag() default {};
+ public Tag[] tag() default {@Tag};
/**
* <p class="changed_added_4_0">
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -53,6 +53,8 @@
*/
public FacesId inferComponentType(ClassName componentClass) throws InvalidNameException;
+ public FacesId inferComponentType(String componentFamily) throws InvalidNameException;
+
/**
* <p class="changed_added_4_0">Calculates concrete component class from explicit value or type.</p>
* <ul>
@@ -88,4 +90,10 @@
public String inferRendererTypeByTemplatePath(String templateName);
public String inferRendererName(RendererModel.Type type);
+
+ public String inferComponentTypeByRendererClass(String s);
+
+ public String inferComponentFamilyByRendererClass(String s);
+
+ public String inferRendererBaseName(RendererModel.Type type);
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -4,10 +4,13 @@
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.InvalidNameException;
import org.richfaces.cdk.model.Name;
+import org.richfaces.cdk.model.Name.Classifier;
import org.richfaces.cdk.model.RendererModel;
-import org.richfaces.cdk.model.Name.Classifier;
import org.richfaces.cdk.util.Strings;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+
/**
* <p class="changed_added_4_0">
* </p>
@@ -75,6 +78,11 @@
}
@Override
+ public FacesId inferComponentType(String componentFamily) throws InvalidNameException {
+ return new FacesId(componentFamily);
+ }
+
+ @Override
public ClassName inferUIComponentClass(FacesId componentType) throws InvalidNameException {
if (null == componentType) {
throw new IllegalArgumentException();
@@ -134,7 +142,12 @@
}
public String inferRendererTypeByRendererClass(ClassName rendererClass) {
- return null;
+ Pattern pattern = Pattern.compile("^(.*).renderkit.(.*\\.)?(.*)RendererBase$");
+ Matcher matcher = pattern.matcher(rendererClass.getName());
+ if (matcher.matches()) {
+ return matcher.group(1) + "." + matcher.group(3) + "Renderer";
+ }
+ return "";
}
public String inferComponentFamily(RendererModel.Type type) {
@@ -152,5 +165,22 @@
public String inferRendererName(RendererModel.Type type) {
return null;
}
+
+ public String inferRendererBaseName(RendererModel.Type type) {
+ return null;
+ }
+
+ public String inferComponentTypeByRendererClass(String s) {
+ Pattern pattern = Pattern.compile("^(.*).renderkit.(.*\\.)?(.*)RendererBase$");
+ Matcher matcher = pattern.matcher(s);
+ if (matcher.matches()) {
+ return matcher.group(1) + "." + matcher.group(3);
+ }
+ return "";
+ }
+
+ public String inferComponentFamilyByRendererClass(String s) {
+ return inferComponentTypeByRendererClass(s);
+ }
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -44,6 +44,7 @@
public class AttributeProcessor extends ProcessorBase {
private static final String SIGNATURE_NONE_CLASS_NAME = Signature.NONE.class.getName().replace('$', '.');
+ private static final String STRING_NAME = String.class.getName();
public void process(SourceUtils.BeanProperty beanProperty, PropertyBase attribute) {
@@ -66,9 +67,13 @@
String defaultValue = attributeAnnotarion.defaultValue();
if (!Strings.isEmpty(defaultValue)) {
+ if (STRING_NAME.equals(attribute.getType().toString())) {
+ defaultValue = "\"" + defaultValue + "\"";
+ }
attribute.setDefaultValue(defaultValue);
}
+
String suggestedValue = attributeAnnotarion.suggestedValue();
if (!Strings.isEmpty(suggestedValue)) {
attribute.setSuggestedValue(suggestedValue);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -26,7 +26,6 @@
import com.google.inject.Inject;
import org.richfaces.cdk.CdkException;
-import org.richfaces.cdk.NamingConventions;
import org.richfaces.cdk.annotations.Event;
import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
@@ -63,9 +62,6 @@
@Inject
private RendererProcessor rendererProcessor;
- @Inject
- private NamingConventions namingConventions;
-
public void process(TypeElement componentElement, ComponentLibrary library) {
JsfComponent annotation = componentElement.getAnnotation(JsfComponent.class);
if (annotation == null) {
@@ -195,12 +191,4 @@
public final Class<? extends Annotation> getProcessedAnnotation() {
return JsfComponent.class;
}
-
- public NamingConventions getNamingConventions() {
- return namingConventions;
- }
-
- public void setNamingConventions(NamingConventions namingConventions) {
- this.namingConventions = namingConventions;
- }
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -4,6 +4,7 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.NamingConventions;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.Icon;
import org.richfaces.cdk.annotations.Tag;
@@ -27,10 +28,8 @@
public abstract class ProcessorBase {
-
@Inject
private Provider<SourceUtils> sourceUtils;
-
@Inject
private FragmentParser fragmentParser;
@@ -38,6 +37,10 @@
@Inject
private AttributeProcessor attributeProcessor;
+ @Inject
+ private NamingConventions namingConventions;
+
+
public FragmentParser getFragmentParser() {
return this.fragmentParser;
}
@@ -47,10 +50,12 @@
}
protected void setTagInfo(Tag tag, ModelElementBase model) {
+ TagModel tagModel = new TagModel();
String name = tag.name();
-
- TagModel tagModel = new TagModel();
+ if (Strings.isEmpty(name)) {
+ name = getNamingConventions().inferTagName(model.getId());
+ }
tagModel.setName(name);
tagModel.setTargetClass(ClassName.parseName(tag.handler()));
tagModel.setType(tag.type());
@@ -152,4 +157,12 @@
attributeProcessor.process(beanProperty, component.getOrCreateAttribute(beanProperty.getName()));
}
}
+
+ public NamingConventions getNamingConventions() {
+ return namingConventions;
+ }
+
+ public void setNamingConventions(NamingConventions namingConventions) {
+ this.namingConventions = namingConventions;
+ }
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -25,7 +25,6 @@
import org.richfaces.cdk.FileManager;
import org.richfaces.cdk.Source;
import org.richfaces.cdk.Sources;
-import org.richfaces.cdk.annotations.Family;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.model.ClassName;
@@ -36,6 +35,7 @@
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.faces.render.RenderKitFactory;
+import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import java.io.File;
import java.io.FileNotFoundException;
@@ -48,6 +48,10 @@
@SupportedAnnotationTypes({"javax.faces.component.FacesComponent", JsfRenderer.NAME})
public class RendererProcessor extends ProcessorBase implements CdkAnnotationProcessor {
+ private static final String COMPONENT_FAMILY = "COMPONENT_FAMILY";
+
+ private static final String RENDERER_TYPE = "RENDERER_TYPE";
+
@Inject
@Source(Sources.RENDERER_TEMPLATES)
private FileManager sources;
@@ -73,10 +77,12 @@
public RendererModel process(TypeElement rendererElement, JsfRenderer annotation, ComponentLibrary library) {
RendererModel rendererModel = new RendererModel();
- rendererModel.setRendererClass(new ClassName(rendererElement.getQualifiedName().toString()));
- setRendererType(rendererModel, annotation);
- setComponentFamily(rendererModel, annotation);
+ setClassNames(rendererElement, rendererModel, null);
+
+ setRendererType(rendererElement, rendererModel, annotation);
+ setComponentType(rendererModel);
+ setComponentFamily(rendererElement, rendererModel, annotation);
setDescription(rendererModel, annotation.icon(), getDocComment(rendererElement), annotation.displayName());
setTemplate(rendererModel, annotation);
@@ -89,6 +95,22 @@
return 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));
+ } else {
+ modelElement.setGenerate(false);
+ }
+
+ modelElement.setBaseClass(ClassName.parseName(componentElement.getQualifiedName().toString()));
+ }
+
+ private void setComponentType(RendererModel rendererModel) {
+ getNamingConventions().inferComponentType(rendererModel.getFamily());
+ }
+
private void addToRenderKit(JsfRenderer annotation, ComponentLibrary library, RendererModel rendererModel) {
String renderKitId = annotation.renderKitId();
if (Strings.isEmpty(renderKitId)) {
@@ -119,20 +141,41 @@
}
}
- private void setComponentFamily(RendererModel rendererModel, JsfRenderer annotation) {
+ private void setComponentFamily(TypeElement rendererElement, RendererModel rendererModel, JsfRenderer annotation) {
String family = annotation.family();
if (!Strings.isEmpty(family)) {
rendererModel.setFamily(family);
+ return;
}
+
+ Object value = getSourceUtils().getConstant(asClassDesctiption(rendererElement), COMPONENT_FAMILY);
+ if (value != null) {
+ rendererModel.setFamily(value.toString());
+ return;
+ }
+
+ rendererModel.setFamily(getNamingConventions()
+ .inferComponentFamilyByRendererClass(rendererElement.getQualifiedName().toString()));
}
- private void setRendererType(RendererModel rendererModel, JsfRenderer annotation) {
+ private String getRendererType(TypeElement rendererElement, JsfRenderer annotation) {
String type = annotation.type();
if (!Strings.isEmpty(type)) {
- rendererModel.setType(new RendererModel.Type(type));
+ return type;
}
+
+ Object value = getSourceUtils().getConstant(asClassDesctiption(rendererElement), RENDERER_TYPE);
+ if (value != null) {
+ return value.toString();
+ }
+
+ return getNamingConventions().inferRendererTypeByRendererClass(asClassDesctiption(rendererElement));
}
+ private void setRendererType(TypeElement rendererElement, RendererModel rendererModel, JsfRenderer annotation) {
+ rendererModel.setType(new RendererModel.Type(getRendererType(rendererElement, annotation)));
+ }
+
protected String getComponentType(TypeElement componentElement) {
JsfComponent annotation = componentElement.getAnnotation(JsfComponent.class);
if (annotation != null) {
@@ -142,20 +185,6 @@
return null;
}
- private void setRendererFamily(TypeElement rendererElement, RendererModel renderer) {
- Family family = rendererElement.getAnnotation(Family.class);
-
- if (null != family) {
- renderer.setFamily(family.value());
- } else {
- // static final COMPONENT_FAMILY string constant.
- Object value = getSourceUtils().getConstant(asClassDesctiption(rendererElement), "COMPONENT_FAMILY");
- if (null != value) {
- renderer.setFamily(value.toString());
- }
- }
- }
-
@Override
public Class<? extends Annotation> getProcessedAnnotation() {
return JsfRenderer.class;
@@ -164,5 +193,4 @@
protected String[] getAnnotationAttributes(TypeElement componentElement) {
return null;
}
-
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -28,12 +28,10 @@
import org.richfaces.cdk.annotations.TagType;
import org.richfaces.cdk.model.BeanModelBase;
import org.richfaces.cdk.model.BehaviorModel;
-import org.richfaces.cdk.model.BehaviorRenderer;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.ConverterModel;
-import org.richfaces.cdk.model.EventModel;
-import org.richfaces.cdk.model.FacetModel;
+import org.richfaces.cdk.model.EmptyVisitor;
import org.richfaces.cdk.model.ListenerModel;
import org.richfaces.cdk.model.ModelElement;
import org.richfaces.cdk.model.PropertyBase;
@@ -41,7 +39,6 @@
import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.model.TagModel;
import org.richfaces.cdk.model.ValidatorModel;
-import org.richfaces.cdk.model.Visitor;
import java.util.List;
@@ -49,13 +46,18 @@
* @author akolonitsky
* @since Feb 3, 2010
*/
-public class TaglibGeneratorVisitor implements Visitor {
+public class TaglibGeneratorVisitor extends EmptyVisitor {
private static final String COMPONENT = "component";
private static final String COMPONENT_TYPE = "component-type";
+ private static final String RENDERER_TYPE = "renderer-type";
+ private static final String HANDLER_CLASS = "handler-class";
private Document document = DocumentHelper.createDocument();
+
private Element faceletTaglib;
+ private ComponentLibrary componentLibrary;
+
public Document getDocument() {
return document;
}
@@ -65,6 +67,8 @@
}
public void visitComponentLibrary(ComponentLibrary model) {
+ this.componentLibrary = model;
+
faceletTaglib = document.addElement("facelet-taglib", "http://java.sun.com/xml/ns/javaee");
faceletTaglib.addAttribute("version", "2.0");
@@ -75,23 +79,27 @@
public void visitComponent(ComponentModel model) {
for (TagModel tagModel : model.getTags()) {
- if (TagType.Facelets.equals(tagModel.getType())) {
- Element tag = createTag(tagModel.getName());
- Element component = tag.addElement(COMPONENT);
- component.addElement(COMPONENT_TYPE).addText(model.getType().getType());
- RendererModel renderer = model.getRenderer();
- if (null != renderer) {
- component.addElement("renderer-type").addText(renderer.getType().getType());
- }
- addTagHandler(component, tagModel);
- appendAttributs(tag, model);
+ if (TagType.Facelets != tagModel.getType()
+ && TagType.All != tagModel.getType()) {
+
+ continue;
}
+
+ Element tag = createTag(tagModel.getName());
+ Element component = tag.addElement(COMPONENT);
+ component.addElement(COMPONENT_TYPE).addText(model.getType().getType());
+ RendererModel renderer = componentLibrary.getRenderer(model.getFamily(), model.getType().getType());
+ if (null != renderer) {
+ component.addElement(RENDERER_TYPE).addText(renderer.getType().getType());
+ }
+ addTagHandler(component, tagModel);
+ appendAttributs(tag, model);
}
}
private void addTagHandler(Element parent, TagModel tag) {
if (tag != null && tag.getTargetClass() != null) {
- parent.addElement("handler-class").addText(tag.getTargetClass().toString());
+ parent.addElement(HANDLER_CLASS).addText(tag.getTargetClass().toString());
}
}
@@ -188,22 +196,6 @@
}
}
- public void visitFacet(FacetModel model) {
-
- }
-
- public void visitEvent(EventModel model) {
-
- }
-
- public void visitBehaviorRenderer(BehaviorRenderer model) {
-
- }
-
- public void visitProperty(PropertyBase model) {
-
- }
-
public void visitRenderKit(RenderKitModel model) {
for (RendererModel renderer : model.getRenderers()) {
visitRender(renderer);
@@ -220,7 +212,7 @@
return;
}
- component.addElement("renderer-type", model.getType().getType());
+ component.addElement(RENDERER_TYPE, model.getType().getType());
}
private Element findComponent(String family) {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -27,6 +27,7 @@
import com.google.inject.Singleton;
import org.richfaces.cdk.model.RenderKitModel.Id;
+import org.richfaces.cdk.util.Strings;
import java.beans.IntrospectionException;
import java.beans.Introspector;
@@ -35,8 +36,10 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
+import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
+import java.util.ArrayList;
/**
* <p class="changed_added_4_0">
@@ -193,6 +196,42 @@
this.addRenderer(new RenderKitModel.Id(renderKitId), rendererModel);
}
+ public RendererModel getRenderer(String componentFamily, String componentType) {
+ if (Strings.isEmpty(componentFamily)) {
+ return null;
+ }
+
+ List<RendererModel> res = new ArrayList<RendererModel>();
+ for (RenderKitModel renderKitModel : renderKits.values()) {
+ for (RendererModel rendererModel : renderKitModel.getRenderers()) {
+ if (componentFamily.equals(rendererModel.getFamily())) {
+ res.add(rendererModel);
+ }
+ }
+ }
+
+ if (res.size() == 0) {
+ return null;
+ }
+
+ if (res.size() > 1) {
+ for (RendererModel renderer : res) {
+ String rendererComponentType = renderer.getComponentType();
+ if (rendererComponentType == null) {
+ if (renderer.getType().getType().startsWith(componentType)) {
+ return renderer; // TODO do it throw naming convention
+ }
+ } else {
+ if (rendererComponentType.equals(componentType)) {
+ return renderer;
+ }
+ }
+ }
+ }
+
+ return res.get(0);
+ }
+
/**
* <p class="changed_added_4_0">
* </p>
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -32,12 +32,8 @@
* relation.
* </p>
*/
-// private final ModelCollection<RendererModel> renderers = ModelCollection.<RendererModel>create();
-
private String family;
- private RendererModel renderer;
-
public ComponentModel(FacesId key) {
this.setId(key);
}
@@ -172,20 +168,8 @@
return event;
}
- /**
- * <p class="changed_added_4_0"></p>
- * TODO - synchronize renderers collection with library ?
- * @return the renderers
- */
- public RendererModel getRenderer() {
- return renderer;
+ @Override
+ public String toString() {
+ return "Component {type: " + getType() + ", family: " + getFamily() + "}";
}
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param renderer the renderer to set
- */
- public void setRenderer(RendererModel renderer) {
- this.renderer = renderer;
- }
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -26,23 +26,27 @@
package org.richfaces.cdk.model;
import org.richfaces.cdk.templatecompiler.model.Template;
+import org.richfaces.cdk.util.Strings;
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
*
*/
-public class RendererModel extends BeanModelBase implements ModelElement<RendererModel> {
+public class RendererModel extends ModelElementBase implements ModelElement<RendererModel> {
private static final long serialVersionUID = -5802466539382148578L;
+ private RenderKitModel.Id renderKitId;
+
private String family;
- private ClassName rendererClass;
+
+ private String componentType;
+
private String templatePath;
+
private Template template;
- private Type type;
- private RenderKitModel.Id renderKitId;
-
+
private boolean rendersChildren;
private TagModel tag;
@@ -50,107 +54,59 @@
public RendererModel() { }
public RendererModel(Type type) {
- this.type = type;
+ setType(type);
}
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.model.ModelElement#getType()
- */
public Type getKey() {
- return type;
+ return getType();
}
- /**
- * <p class="changed_added_4_0"></p>
- * @param type the type to set
- */
public void setType(Type type) {
- this.type = type;
+ this.setId(type);
}
public Type getType() {
- return type;
+ return (Type) getId();
}
- /**
- * <p class="changed_added_4_0"></p>
- * @return the template
- */
@Merge
public Template getTemplate() {
return template;
}
- /**
- * <p class="changed_added_4_0"></p>
- * @param template the template to set
- */
public void setTemplate(Template template) {
this.template = template;
}
- /**
- * <p class="changed_added_4_0"></p>
- * @return the family
- */
@Merge
public String getFamily() {
return family;
}
- /**
- * <p class="changed_added_4_0"></p>
- * @param family the family to set
- */
public void setFamily(String family) {
this.family = family;
}
- /**
- * <p class="changed_added_4_0"></p>
- * @return the rendererClass
- */
public ClassName getRendererClass() {
- return rendererClass;
+ return getTargetClass();
}
- /**
- * <p class="changed_added_4_0"></p>
- * @param rendererClass the rendererClass to set
- */
public void setRendererClass(ClassName rendererClass) {
- this.rendererClass = rendererClass;
+ setTargetClass(rendererClass);
}
- /**
- * <p class="changed_added_4_0"></p>
- * @return the rendersChildren
- */
public boolean isRendersChildren() {
return this.rendersChildren;
}
- /**
- * <p class="changed_added_4_0"></p>
- * @param rendersChildren the rendersChildren to set
- */
public void setRendersChildren(boolean rendersChildren) {
this.rendersChildren = rendersChildren;
}
- /**
- * <p class="changed_added_4_0"></p>
- * @return the tag
- */
public TagModel getTag() {
return this.tag;
}
- /**
- * <p class="changed_added_4_0"></p>
- * @param tag the tag to set
- */
public void setTag(TagModel tag) {
this.tag = tag;
}
@@ -169,7 +125,22 @@
@Override
public void merge(RendererModel other) {
+ if (other == null) {
+ return;
+ }
+
ComponentLibrary.merge(this, other);
+
+ // TODO review
+ ClassName targetClass = this.getTargetClass();
+ if (targetClass == null || Strings.isEmpty(targetClass.getName())) {
+ setTargetClass(other.getTargetClass());
+ }
+
+ ClassName baseClass = this.getBaseClass();
+ if (baseClass == null || Strings.isEmpty(baseClass.getName())) {
+ setTargetClass(other.getBaseClass());
+ }
}
@Override
@@ -197,6 +168,14 @@
this.renderKitId = renderKitId;
}
+ public String getComponentType() {
+ return componentType;
+ }
+
+ public void setComponentType(String componentType) {
+ this.componentType = componentType;
+ }
+
/**
* <p class="changed_added_4_0">FacesId for lookup renderer in the model.</p>
* @author asmirnov(a)exadel.com
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -37,7 +37,6 @@
import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.RenderKitModel;
import org.richfaces.cdk.model.RendererModel;
-import org.richfaces.cdk.model.RendererModel.Type;
import org.richfaces.cdk.templatecompiler.builder.model.JavaClass;
import org.richfaces.cdk.templatecompiler.model.Template;
@@ -79,18 +78,7 @@
}
private ComponentModel findComponentByRenderer(RendererModel renderer) {
- Type rendererType = renderer.getType();
- Collection<ComponentModel> components = library.getComponents();
- if (components != null) {
- for (ComponentModel component : components) {
- RendererModel rendererModel = component.getRenderer();
- if (rendererModel != null && rendererType.equals(rendererModel.getType())) {
- return component;
- }
- }
- }
-
- return null;
+ return library.getComponentModel(renderer.getFamily());
}
/*
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -195,6 +195,7 @@
setRendererType(template, compositeInterface, renderer);
setFamily(compositeInterface, renderer); //TODO set default values according to template name
setRendererClass(compositeInterface, renderer);
+ setRendererBaseClass(compositeInterface, renderer);
RenderKitModel renderKit = library.addRenderKit(compositeInterface.getRenderKitId());
renderKit.getRenderers().add(renderer);
@@ -271,6 +272,14 @@
renderer.setRendererClass(new ClassName(javaClass));
}
+ private void setRendererBaseClass(CompositeInterface compositeInterface, RendererModel renderer) {
+ String baseClass = compositeInterface.getBaseClass();
+ if (baseClass == null) {
+ baseClass = getNamingConventions().inferRendererBaseName(renderer.getType());
+ }
+ renderer.setBaseClass(new ClassName(baseClass));
+ }
+
private void setFamily(CompositeInterface compositeInterface, RendererModel renderer) {
String family = compositeInterface.getComponentFamily();
if (family == null) {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentAdapter.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentAdapter.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentAdapter.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -51,9 +51,10 @@
@Override
protected void postMarshal(ComponentModel model, ComponentBean bean) {
super.postMarshal(model, bean);
- if(null != model.getRenderer()){
- bean.getExtension().setRendererType(model.getRenderer().getType().getType());
- }
+// TODO
+// if(null != model.getRenderer()){
+// bean.getExtension().setRendererType(model.getRenderer().getType().getType());
+// }
}
@Override
Modified: root/ui/trunk/components/core/src/main/config/faces-config.xml
===================================================================
--- root/ui/trunk/components/core/src/main/config/faces-config.xml 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/ui/trunk/components/core/src/main/config/faces-config.xml 2010-03-30 12:16:40 UTC (rev 16684)
@@ -4,74 +4,67 @@
version="2.0">
<component>
- <component-type>org.richfaces.Push</component-type>
- <component-class>org.richfaces.component.html.HtmlPush</component-class>
+ <component-type>org.richfaces.Function</component-type>
+ <component-class>org.richfaces.component.html.HtmlAjaxFunction</component-class>
<component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
+ <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions" >true</cdk:generate>
</component-extension>
</component>
-
<component>
- <component-type>org.richfaces.Function</component-type>
- <component-class>org.richfaces.component.html.HtmlAjaxFunction</component-class>
+ <component-type>org.richfaces.Status</component-type>
+ <component-class>org.richfaces.component.html.HtmlAjaxStatus</component-class>
<component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
+ <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions" >true</cdk:generate>
</component-extension>
</component>
-
<component>
- <component-type>org.richfaces.MediaOutput</component-type>
- <component-class>org.richfaces.component.html.HtmlMediaOutput</component-class>
+ <component-type>org.richfaces.Queue</component-type>
+ <component-class>org.richfaces.component.html.HtmlQueue</component-class>
<component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
+ <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions" >true</cdk:generate>
</component-extension>
</component>
-
<component>
- <component-type>org.richfaces.OutputPanel</component-type>
- <component-class>org.richfaces.component.html.HtmlOutputPanel</component-class>
+ <component-type>org.richfaces.CommandLink</component-type>
+ <component-class>org.richfaces.component.html.HtmlCommandLink</component-class>
<component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
+ <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions" >true</cdk:generate>
</component-extension>
</component>
-
<component>
- <component-type>org.richfaces.Status</component-type>
- <component-class>org.richfaces.component.html.HtmlAjaxStatus</component-class>
+ <component-type>org.richfaces.CommandButton</component-type>
+ <component-class>org.richfaces.component.html.HtmlCommandButton</component-class>
<component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
+ <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions" >true</cdk:generate>
</component-extension>
</component>
-
<component>
- <component-type>org.richfaces.AjaxLog</component-type>
- <component-class>org.richfaces.component.html.HtmlAjaxLog</component-class>
+ <component-type>org.richfaces.MediaOutput</component-type>
+ <component-class>org.richfaces.component.html.HtmlMediaOutput</component-class>
<component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
+ <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions" >true</cdk:generate>
</component-extension>
</component>
-
<component>
- <component-type>org.richfaces.CommandLink</component-type>
- <component-class>org.richfaces.component.html.HtmlCommandLink</component-class>
+ <component-type>org.richfaces.Push</component-type>
+ <component-class>org.richfaces.component.html.HtmlPush</component-class>
<component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
+ <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions" >true</cdk:generate>
</component-extension>
</component>
-
<component>
- <component-type>org.richfaces.CommandButton</component-type>
- <component-class>org.richfaces.component.html.HtmlCommandButton</component-class>
+ <component-type>org.richfaces.OutputPanel</component-type>
+ <component-class>org.richfaces.component.html.HtmlOutputPanel</component-class>
<component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
+ <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions" >true</cdk:generate>
</component-extension>
</component>
<component>
- <component-type>org.richfaces.Queue</component-type>
- <component-class>org.richfaces.component.html.HtmlQueue</component-class>
+ <component-type>org.richfaces.AjaxLog</component-type>
+ <component-class>org.richfaces.component.html.HtmlAjaxLog</component-class>
<component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
+ <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions" >true</cdk:generate>
</component-extension>
</component>
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxCommandButton.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxCommandButton.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxCommandButton.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -1,69 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.richfaces.component;
-
-import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.EventName;
-import org.richfaces.cdk.annotations.JsfComponent;
-
-import javax.faces.component.UIComponentBase;
-
-/**
- * @author Nick Belaevski
- *
- */
-@JsfComponent
-public abstract class AbstractAjaxCommandButton extends UIComponentBase {
-
- public static final String COMPONENT_TYPE = "org.richfaces.CommandButton";
-
- public static final String COMPONENT_FAMILY = "org.richfaces.AjaxCommandButton";
-
- public AbstractAjaxCommandButton() {
- setRendererType("org.richfaces.CommandButtonRenderer");
- }
-
- @Attribute(
- defaultValue = "\"\"",
- events = {
- @EventName("click"),
- @EventName("mousemove"),
- @EventName("dblclick"),
- @EventName("keydown"),
- @EventName("keypress"),
- @EventName("keyup"),
- @EventName("mousedown"),
- @EventName("mouseout"),
- @EventName("mouseover"),
- @EventName("mouseup"),
- @EventName(value = "action", defaultEvent = true)}
- )
- public abstract String getStyle();
-
- @Attribute(defaultValue = "\"\"")
- public abstract String getStyleClass();
-
- @Attribute(defaultValue = "Boolean.FALSE")
- public abstract boolean isLimitRender();
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxCommandLink.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxCommandLink.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxCommandLink.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -1,71 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.richfaces.component;
-
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.EventName;
-
-import javax.faces.component.UIComponentBase;
-
-/**
- * @author Nick Belaevski
- *
- */
-@JsfComponent(
- generate = "org.richfaces.component.html.HtmlCommandLink"
-)
-public abstract class AbstractAjaxCommandLink extends UIComponentBase {
-
- public static final String COMPONENT_TYPE = "org.richfaces.CommandLink";
-
- public static final String COMPONENT_FAMILY = "org.richfaces.AjaxCommandLink";
-
- public AbstractAjaxCommandLink() {
- setRendererType("org.richfaces.CommandLinkRenderer");
- }
-
- @Attribute(
- defaultValue = "\"\"",
- events = {
- @EventName("click"),
- @EventName("mousemove"),
- @EventName("dblclick"),
- @EventName("keydown"),
- @EventName("keypress"),
- @EventName("keyup"),
- @EventName("mousedown"),
- @EventName("mouseout"),
- @EventName("mouseover"),
- @EventName("mouseup"),
- @EventName(value = "action", defaultEvent = true)}
- )
- public abstract String getStyle();
-
- @Attribute(defaultValue = "\"\"")
- public abstract String getStyleClass();
-
- @Attribute(defaultValue = "Boolean.FALSE")
- public abstract boolean isLimitRender();
-}
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -60,13 +60,13 @@
return COMPONENT_FAMILY;
}
- @Attribute(defaultValue = "\"\"")
+ @Attribute(defaultValue = "")
public abstract String getStyle();
- @Attribute(defaultValue = "\"\"")
+ @Attribute(defaultValue = "")
public abstract String getLevel();
- @Attribute(defaultValue = "\"\"")
+ @Attribute(defaultValue = "")
public abstract String getStyleClass();
// public abstract String getHotkey();
Copied: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandButton.java (from rev 16679, root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxCommandButton.java)
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandButton.java (rev 0)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandButton.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -0,0 +1,85 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+package org.richfaces.component;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.JsfComponent;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@JsfComponent
+public abstract class AbstractCommandButton extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.CommandButton";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.CommandButton";
+
+ public AbstractCommandButton() {
+ setRendererType("org.richfaces.CommandButtonRenderer");
+ }
+
+ @Attribute(events = {@EventName("click"), @EventName(value = "action", defaultEvent = true)})
+ public abstract String getOnclick();
+
+ @Attribute(events = @EventName("mousemove"))
+ public abstract String getOnmousemove();
+
+ @Attribute(events = @EventName("dblclick"))
+ public abstract String getOndblclick();
+
+ @Attribute(events = @EventName("keydown"))
+ public abstract String getOnkeydown();
+
+ @Attribute(events = @EventName("keypress"))
+ public abstract String getOnkeypress();
+
+ @Attribute(events = @EventName("keyup"))
+ public abstract String getOnkeyup();
+
+ @Attribute(events = @EventName("mousedown"))
+ public abstract String getOnmousedown();
+
+ @Attribute(events = @EventName("mouseout"))
+ public abstract String getOnmouseout();
+
+ @Attribute(events = @EventName("mouseover"))
+ public abstract String getOnmouseover();
+
+ @Attribute(events = @EventName("mouseup"))
+ public abstract String getOnmouseup();
+
+ @Attribute(defaultValue = "")
+ public abstract String getStyle();
+
+ @Attribute(defaultValue = "")
+ public abstract String getStyleClass();
+
+ @Attribute(defaultValue = "Boolean.FALSE")
+ public abstract boolean isLimitRender();
+}
Copied: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandLink.java (from rev 16679, root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxCommandLink.java)
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandLink.java (rev 0)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractCommandLink.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -0,0 +1,85 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+package org.richfaces.component;
+
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.EventName;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@JsfComponent
+public abstract class AbstractCommandLink extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.CommandLink";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.CommandLink";
+
+ public AbstractCommandLink() {
+ setRendererType("org.richfaces.CommandLinkRenderer");
+ }
+
+ @Attribute(events = {@EventName("click"), @EventName(value = "action", defaultEvent = true)})
+ public abstract String getOnclick();
+
+ @Attribute(events = @EventName("mousemove"))
+ public abstract String getOnmousemove();
+
+ @Attribute(events = @EventName("dblclick"))
+ public abstract String getOndblclick();
+
+ @Attribute(events = @EventName("keydown"))
+ public abstract String getOnkeydown();
+
+ @Attribute(events = @EventName("keypress"))
+ public abstract String getOnkeypress();
+
+ @Attribute(events = @EventName("keyup"))
+ public abstract String getOnkeyup();
+
+ @Attribute(events = @EventName("mousedown"))
+ public abstract String getOnmousedown();
+
+ @Attribute(events = @EventName("mouseout"))
+ public abstract String getOnmouseout();
+
+ @Attribute(events = @EventName("mouseover"))
+ public abstract String getOnmouseover();
+
+ @Attribute(events = @EventName("mouseup"))
+ public abstract String getOnmouseup();
+
+ @Attribute(defaultValue = "")
+ public abstract String getStyle();
+
+ @Attribute(defaultValue = "")
+ public abstract String getStyleClass();
+
+ @Attribute(defaultValue = "Boolean.FALSE")
+ public abstract boolean isLimitRender();
+}
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractMediaOutput.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractMediaOutput.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractMediaOutput.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -25,10 +25,10 @@
import org.ajax4jsf.resource.ResourceComponent2;
import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.Signature;
import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.cdk.annotations.EventName;
import org.richfaces.resource.MediaOutputResource;
import org.richfaces.webapp.taglib.MethodBindingMethodExpressionAdaptor;
import org.richfaces.webapp.taglib.MethodExpressionMethodBindingAdaptor;
@@ -47,9 +47,7 @@
*
*/
@JsfComponent(
- type = "org.richfaces.MediaOutput",
- tag = @Tag(name = "mediaOutput", handler = "org.richfaces.taghandler.html.PushMediaOutput"),
- generate = ""
+ tag = @Tag(handler = "org.richfaces.taglib.html.facelets.MediaOutputHandler")
)
public abstract class AbstractMediaOutput extends UIOutput implements ResourceComponent2 {
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractOutputPanel.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractOutputPanel.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractOutputPanel.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -24,10 +24,9 @@
package org.richfaces.component;
import org.ajax4jsf.component.AjaxOutput;
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.JsfComponent;
import javax.faces.component.UIPanel;
@@ -36,10 +35,7 @@
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:26 $
*
*/
-@JsfComponent(
- tag = @Tag(handler = "org.richfaces.taghandler.html.OutputPanelTagHandler"),
- generate = "org.richfaces.component.html.HtmlOutputPanel"
-)
+@JsfComponent
public abstract class AbstractOutputPanel extends UIPanel implements AjaxOutput {
public static final String COMPONENT_TYPE = "org.richfaces.OutputPanel";
@@ -56,7 +52,7 @@
@Attribute(defaultValue = "Boolean.FALSE")
public abstract boolean isKeepTransient();
- @Attribute(defaultValue = "\"inline\"")
+ @Attribute(defaultValue = "inline")
public abstract String getLayout();
@Attribute(events = @EventName("click"))
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractPush.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractPush.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractPush.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -24,10 +24,10 @@
package org.richfaces.component;
import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.Signature;
import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.cdk.annotations.EventName;
import javax.el.MethodExpression;
import javax.faces.component.NamingContainer;
@@ -45,9 +45,7 @@
*
*/
@JsfComponent(
- type = "org.richfaces.Push",
- tag = @Tag(name = "push", handler = "org.richfaces.taghandler.html.PushTagHandler"),
- generate = ""
+ tag = @Tag(handler = "org.richfaces.taglib.html.facelets.AjaxPushHandler")
)
public abstract class AbstractPush extends UICommand {
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxFunctionRendererBase.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxFunctionRendererBase.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxFunctionRendererBase.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -23,14 +23,6 @@
package org.richfaces.renderkit;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIParameter;
-import javax.faces.context.FacesContext;
-
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSReference;
@@ -38,6 +30,13 @@
import org.ajax4jsf.renderkit.AjaxEventOptions;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIParameter;
+import javax.faces.context.FacesContext;
+import java.util.Iterator;
+import java.util.Map;
+
/**
* @author shura
*
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxCommandButtonRendererBase.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxCommandButtonRendererBase.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxCommandButtonRendererBase.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -1,63 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.richfaces.renderkit.html;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.richfaces.renderkit.AjaxCommandRendererBase;
-
-/**
- * @author Nick Belaevski
- *
- */
-public abstract class AjaxCommandButtonRendererBase extends AjaxCommandRendererBase {
- protected void encodeTypeAndImage(FacesContext context, UIComponent uiComponent) throws IOException {
- ResponseWriter writer = context.getResponseWriter();
- String type = (String) uiComponent.getAttributes().get("type");
- String image = (String) uiComponent.getAttributes().get("image");
-
- if (image != null) {
- image = context.getApplication().getViewHandler().getResourceURL(context, image);
- image = context.getExternalContext().encodeResourceURL(image);
- writer.writeAttribute("type", "image", "image");
- writer.writeURIAttribute("src", image, "image");
-
- Object value = uiComponent.getAttributes().get("value");
-
- if (null == uiComponent.getAttributes().get("alt") && null != value) {
- writer.writeAttribute("alt", value, "value");
- }
- } else {
- if (null != type) {
- writer.writeAttribute("type", type.toLowerCase(), "type");
- } else {
- writer.writeAttribute("type", "submit", "type");
- }
- }
- }
-}
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -54,6 +54,10 @@
@JsfRenderer
public class AjaxPushRenderer extends RendererBase {
+ public static final String COMPONENT_FAMILY = "org.richfaces.Push";
+
+ public static final String RENDERER_TYPE = "org.richfaces.PushRenderer";
+
public static final String PUSH_INTERVAL_PARAMETER = "A4J.AJAX.Push.INTERVAL";
public static final String PUSH_WAIT_PARAMETER = "A4J.AJAX.Push.WAIT";
Copied: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/CommandButtonRendererBase.java (from rev 16679, root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxCommandButtonRendererBase.java)
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/CommandButtonRendererBase.java (rev 0)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/CommandButtonRendererBase.java 2010-03-30 12:16:40 UTC (rev 16684)
@@ -0,0 +1,65 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+package org.richfaces.renderkit.html;
+
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.renderkit.AjaxCommandRendererBase;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@JsfRenderer
+public abstract class CommandButtonRendererBase extends AjaxCommandRendererBase {
+
+ protected void encodeTypeAndImage(FacesContext context, UIComponent uiComponent) throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ String type = (String) uiComponent.getAttributes().get("type");
+ String image = (String) uiComponent.getAttributes().get("image");
+
+ if (image != null) {
+ image = context.getApplication().getViewHandler().getResourceURL(context, image);
+ image = context.getExternalContext().encodeResourceURL(image);
+ writer.writeAttribute("type", "image", "image");
+ writer.writeURIAttribute("src", image, "image");
+
+ Object value = uiComponent.getAttributes().get("value");
+
+ if (null == uiComponent.getAttributes().get("alt") && null != value) {
+ writer.writeAttribute("alt", value, "value");
+ }
+ } else {
+ if (null != type) {
+ writer.writeAttribute("type", type.toLowerCase(), "type");
+ } else {
+ writer.writeAttribute("type", "submit", "type");
+ }
+ }
+ }
+}
Modified: root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml
===================================================================
--- root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml 2010-03-30 12:16:40 UTC (rev 16684)
@@ -1,39 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
-<facelet-taglib version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" id="a4j">
+<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee" version="2.0" id="a4j">
<namespace>http://richfaces.org/a4j</namespace>
-
<tag>
- <tag-name>push</tag-name>
- <component>
- <component-type>org.richfaces.Push</component-type>
- <renderer-type>org.richfaces.PushRenderer</renderer-type>
- <handler-class>org.richfaces.taglib.html.facelets.AjaxPushHandler</handler-class>
- </component>
- </tag>
- <tag>
<tag-name>jsFunction</tag-name>
<component>
<component-type>org.richfaces.Function</component-type>
<renderer-type>org.richfaces.FunctionRenderer</renderer-type>
</component>
+
</tag>
<tag>
- <tag-name>outputPanel</tag-name>
- <component>
- <component-type>org.richfaces.OutputPanel</component-type>
- <renderer-type>org.richfaces.OutputPanelRenderer</renderer-type>
- </component>
- </tag>
- <tag>
- <tag-name>mediaOutput</tag-name>
- <component>
- <component-type>org.richfaces.MediaOutput</component-type>
- <renderer-type>org.richfaces.MediaOutputRenderer</renderer-type>
- <handler-class>org.richfaces.taglib.html.facelets.MediaOutputHandler</handler-class>
- </component>
- </tag>
- <tag>
<tag-name>status</tag-name>
<component>
<component-type>org.richfaces.Status</component-type>
@@ -41,10 +18,10 @@
</component>
</tag>
<tag>
- <tag-name>log</tag-name>
+ <tag-name>queue</tag-name>
<component>
- <component-type>org.richfaces.AjaxLog</component-type>
- <renderer-type>org.richfaces.AjaxLogRenderer</renderer-type>
+ <component-type>org.richfaces.Queue</component-type>
+ <renderer-type>org.richfaces.QueueRenderer</renderer-type>
</component>
</tag>
<tag>
@@ -62,26 +39,48 @@
</component>
</tag>
<tag>
- <tag-name>queue</tag-name>
+ <tag-name>repeat</tag-name>
<component>
- <component-type>org.richfaces.Queue</component-type>
- <renderer-type>org.richfaces.QueueRenderer</renderer-type>
+ <component-type>org.richfaces.Repeat</component-type>
+ <renderer-type>org.richfaces.RepeatRenderer</renderer-type>
</component>
</tag>
<tag>
- <tag-name>repeat</tag-name>
+ <tag-name>mediaOutput</tag-name>
<component>
- <component-type>org.richfaces.Repeat</component-type>
- <renderer-type>org.richfaces.RepeatRenderer</renderer-type>
+ <component-type>org.richfaces.MediaOutput</component-type>
+ <renderer-type>org.richfaces.MediaOutputRenderer</renderer-type>
+ <handler-class>org.richfaces.taglib.html.facelets.MediaOutputHandler</handler-class>
</component>
+
</tag>
-
<tag>
+ <tag-name>log</tag-name>
+ <component>
+ <component-type>org.richfaces.AjaxLog</component-type>
+ <renderer-type>org.richfaces.AjaxLogRenderer</renderer-type>
+ </component>
+ </tag>
+ <tag>
+ <tag-name>push</tag-name>
+ <component>
+ <component-type>org.richfaces.Push</component-type>
+ <renderer-type>org.richfaces.PushRenderer</renderer-type>
+ <handler-class>org.richfaces.taglib.html.facelets.AjaxPushHandler</handler-class>
+ </component>
+ </tag>
+ <tag>
+ <tag-name>outputPanel</tag-name>
+ <component>
+ <component-type>org.richfaces.OutputPanel</component-type>
+ <renderer-type>org.richfaces.OutputPanelRenderer</renderer-type>
+ </component>
+ </tag>
+ <tag>
<tag-name>ajax</tag-name>
<behavior>
<behavior-id>org.ajax4jsf.behavior.Ajax</behavior-id>
<handler-class>org.ajax4jsf.facelets.tag.AjaxHandler</handler-class>
</behavior>
</tag>
-
</facelet-taglib>
Modified: root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/button.template.xml
===================================================================
--- root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/button.template.xml 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/button.template.xml 2010-03-30 12:16:40 UTC (rev 16684)
@@ -6,10 +6,10 @@
<cc:interface>
<cdk:class>org.richfaces.renderkit.html.CommandButtonRenderer</cdk:class>
- <cdk:superclass>org.richfaces.renderkit.html.AjaxCommandButtonRendererBase</cdk:superclass>
- <cdk:component-family>javax.faces.Command</cdk:component-family>
- <cdk:renderer-type>org.richfaces.CommandButtonRenderer
- </cdk:renderer-type>
+ <cdk:superclass>org.richfaces.renderkit.html.CommandButtonRendererBase</cdk:superclass>
+ <!--<cdk:component-family>javax.faces.Command</cdk:component-family>-->
+ <cdk:component-family>org.richfaces.CommandButton</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.CommandButtonRenderer</cdk:renderer-type>
</cc:interface>
<cc:implementation>
Modified: root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/link.template.xml
===================================================================
--- root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/link.template.xml 2010-03-29 15:14:11 UTC (rev 16683)
+++ root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/link.template.xml 2010-03-30 12:16:40 UTC (rev 16684)
@@ -7,7 +7,8 @@
<cc:interface>
<cdk:class>org.richfaces.renderkit.html.CommandLinkRenderer</cdk:class>
<cdk:superclass>org.richfaces.renderkit.AjaxCommandRendererBase</cdk:superclass>
- <cdk:component-family>javax.faces.Command</cdk:component-family>
+ <cdk:component-family>org.richfaces.CommandLink</cdk:component-family>
+ <!--<cdk:component-family>javax.faces.Command</cdk:component-family>-->
<cdk:renderer-type>org.richfaces.CommandLinkRenderer</cdk:renderer-type>
</cc:interface>
14 years, 9 months
JBoss Rich Faces SVN: r16683 - root/framework/trunk/impl/src/main/java/org/richfaces/context.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-03-29 11:14:11 -0400 (Mon, 29 Mar 2010)
New Revision: 16683
Modified:
root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
Log:
RF-7858 - fixed compilation error
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java 2010-03-29 14:39:03 UTC (rev 16682)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java 2010-03-29 15:14:11 UTC (rev 16683)
@@ -46,7 +46,6 @@
import javax.faces.context.ResponseWriter;
import javax.faces.event.PhaseId;
-import org.ajax4jsf.component.AjaxOutput;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.richfaces.component.PartiallyEncodedComponent;
@@ -396,19 +395,6 @@
}
protected void addImplicitRenderIds(Collection<String> ids, boolean limitRender) {
- if (!limitRender) {
- // TODO: data table support
- Collection<AjaxOutput> ajaxOutputComponentsSet =
- PartialViewContextAjaxOutputTracker.getAjaxOutputComponentsSet(facesContext);
-
- for (AjaxOutput ajaxOutput : ajaxOutputComponentsSet) {
- if (ajaxOutput.isAjaxRendered()) {
- UIComponent ajaxOutputComponent = (UIComponent) ajaxOutput;
-
- ids.add(ajaxOutputComponent.getClientId(facesContext));
- }
- }
- }
}
protected void renderExtensions(FacesContext context, UIComponent component) throws IOException {
14 years, 9 months
JBoss Rich Faces SVN: r16682 - in root/framework/trunk: api/src/main/java/org/richfaces/context and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-03-29 10:39:03 -0400 (Mon, 29 Mar 2010)
New Revision: 16682
Added:
root/framework/trunk/api/src/main/java/org/richfaces/context/
root/framework/trunk/api/src/main/java/org/richfaces/context/ExtendedVisitContext.java
root/framework/trunk/api/src/main/java/org/richfaces/context/ExtendedVisitContextMode.java
Modified:
root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java
root/framework/trunk/impl/src/main/java/org/richfaces/component/UISequence.java
root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextAjaxOutputTracker.java
root/framework/trunk/impl/src/main/resources/META-INF/components.faces-config.xml
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js
Log:
https://jira.jboss.org/jira/browse/RF-7856
Added: root/framework/trunk/api/src/main/java/org/richfaces/context/ExtendedVisitContext.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/context/ExtendedVisitContext.java (rev 0)
+++ root/framework/trunk/api/src/main/java/org/richfaces/context/ExtendedVisitContext.java 2010-03-29 14:39:03 UTC (rev 16682)
@@ -0,0 +1,34 @@
+/*
+ * 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.context;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface ExtendedVisitContext {
+
+ public static final String SUB_COMPONENT_ID = "org.richfaces.SubComponentId";
+
+ public ExtendedVisitContextMode getVisitMode();
+
+}
Added: root/framework/trunk/api/src/main/java/org/richfaces/context/ExtendedVisitContextMode.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/context/ExtendedVisitContextMode.java (rev 0)
+++ root/framework/trunk/api/src/main/java/org/richfaces/context/ExtendedVisitContextMode.java 2010-03-29 14:39:03 UTC (rev 16682)
@@ -0,0 +1,33 @@
+/*
+ * 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.context;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public enum ExtendedVisitContextMode {
+
+ EXECUTE,
+ RENDER
+
+}
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-03-29 13:56:12 UTC (rev 16681)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-03-29 14:39:03 UTC (rev 16682)
@@ -63,6 +63,7 @@
import org.ajax4jsf.model.ExtendedDataModel;
import org.ajax4jsf.model.Range;
import org.ajax4jsf.model.SerializableDataModel;
+import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.log.RichfacesLogger;
import org.slf4j.Logger;
@@ -155,17 +156,30 @@
setRowKey(context, rowKey);
if (isRowAvailable()) {
- Iterator<UIComponent> dataChildrenItr = dataChildren();
+ VisitResult result = VisitResult.ACCEPT;
- while (dataChildrenItr.hasNext()) {
- UIComponent dataChild = dataChildrenItr.next();
-
- if (dataChild.visitTree(visitContext, callback)) {
+ if (context instanceof ExtendedVisitContext) {
+ result = visitContext.invokeVisitCallback(UIDataAdaptor.this, callback);
+ if (VisitResult.COMPLETE.equals(result)) {
visitResult = true;
return DataVisitResult.STOP;
}
}
+
+ if (VisitResult.ACCEPT.equals(result)) {
+ Iterator<UIComponent> dataChildrenItr = dataChildren();
+
+ while (dataChildrenItr.hasNext()) {
+ UIComponent dataChild = dataChildrenItr.next();
+
+ if (dataChild.visitTree(visitContext, callback)) {
+ visitResult = true;
+
+ return DataVisitResult.STOP;
+ }
+ }
+ }
}
return DataVisitResult.CONTINUE;
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/component/UISequence.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/component/UISequence.java 2010-03-29 13:56:12 UTC (rev 16681)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/component/UISequence.java 2010-03-29 14:39:03 UTC (rev 16682)
@@ -27,9 +27,11 @@
import java.util.List;
import java.util.Map;
+import javax.el.ValueExpression;
import javax.faces.component.UINamingContainer;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
+import javax.faces.el.ValueBinding;
import javax.faces.model.ArrayDataModel;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
@@ -124,7 +126,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.richfaces.component.UIDataAdaptor#getRowKeyConverter()
*/
@@ -156,6 +158,7 @@
}
public void setValue(Object value) {
+ resetDataModel();
getStateHelper().put(PropertyKeys.value, value);
}
@@ -170,7 +173,7 @@
public int getRowIndex() {
return getExtendedDataModel().getRowIndex();
}
-
+
@Override
public void captureOrigValue(FacesContext faces) {
super.captureOrigValue(faces);
@@ -234,4 +237,21 @@
}
}
+ @Override
+ public void setValueBinding(String name, ValueBinding binding) {
+ if ("value".equals(name)) {
+ resetDataModel();
+ }
+
+ super.setValueBinding(name, binding);
+ }
+
+ @Override
+ public void setValueExpression(String name, ValueExpression binding) {
+ if ("value".equals(name)) {
+ resetDataModel();
+ }
+
+ super.setValueExpression(name, binding);
+ }
}
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextAjaxOutputTracker.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextAjaxOutputTracker.java 2010-03-29 13:56:12 UTC (rev 16681)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextAjaxOutputTracker.java 2010-03-29 14:39:03 UTC (rev 16682)
@@ -21,50 +21,127 @@
package org.richfaces.context;
-import org.ajax4jsf.component.AjaxOutput;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
-import javax.faces.context.FacesContext;
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
import javax.faces.event.AbortProcessingException;
+import javax.faces.event.PostAddToViewEvent;
+import javax.faces.event.PreRemoveFromViewEvent;
import javax.faces.event.SystemEvent;
import javax.faces.event.SystemEventListener;
-import java.util.ArrayList;
-import java.util.Collection;
+import org.ajax4jsf.component.AjaxOutput;
+
/**
* @author Nick Belaevski
*/
public class PartialViewContextAjaxOutputTracker implements SystemEventListener {
- private static final String AJAX_OUTPUT_COMPONENTS_SET_ATTRIBUTE = PartialViewContextAjaxOutputTracker.class
- + ":AjaxOutputComponentsSet";
- static Collection<AjaxOutput> getAjaxOutputComponentsSet(FacesContext context) {
- AttributesContext attributes = SingletonsContext.FACES_CONTEXT.get(context);
- Collection<AjaxOutput> components =
- (Collection<AjaxOutput>) attributes.getAttribute(AJAX_OUTPUT_COMPONENTS_SET_ATTRIBUTE);
+ private static final String ATTRIBUTE_NAME = "org.richfaces.AjaxOutputTracker";
- if (components == null) {
- components = new ArrayList<AjaxOutput>();
- attributes.setAttribute(AJAX_OUTPUT_COMPONENTS_SET_ATTRIBUTE, components);
+ private static Set<String> getTrackedChildrenSet(UIComponent component, boolean create) {
+ Map<String, Object> attributes = component.getAttributes();
+
+ @SuppressWarnings("unchecked")
+ Set<String> trackedChildrenSet = (Set<String>) attributes.get(ATTRIBUTE_NAME);
+ if (trackedChildrenSet == null && create) {
+ trackedChildrenSet = new HashSet<String>();
+ attributes.put(ATTRIBUTE_NAME, trackedChildrenSet);
}
- return components;
+ return trackedChildrenSet;
}
- /*
- * (non-Javadoc)
- * @see javax.faces.event.SystemEventListener#isListenerForSource(java.lang.Object)
- */
- public boolean isListenerForSource(Object source) {
- return source instanceof AjaxOutput;
+ private static void clearTrackedChildrenSet(UIComponent component) {
+ component.getAttributes().remove(ATTRIBUTE_NAME);
}
- /*
- * (non-Javadoc)
- * @see javax.faces.event.SystemEventListener#processEvent(javax.faces.event.SystemEvent)
- */
+ static boolean hasNestedAjaxOutputs(UIComponent component) {
+ if (!isContainerComponent(component)) {
+ throw new IllegalArgumentException(component.toString());
+ }
+
+ Set<String> trackedChildrenSet = getTrackedChildrenSet(component, false);
+
+ return trackedChildrenSet != null && !trackedChildrenSet.isEmpty();
+ }
+
+ private static String getId(UIComponent component) {
+ String id = component.getId();
+ if (id == null) {
+ //TODO force clientId creation?
+ component.getClientId();
+ id = component.getId();
+ }
+ return id;
+ }
+
+ private static boolean isContainerComponent(UIComponent component) {
+ return component instanceof NamingContainer || component instanceof UIViewRoot;
+ }
+
+ private UIComponent findParentContainerComponent(UIComponent component) {
+ UIComponent c = component.getParent();
+ while (c != null && !isContainerComponent(c)) {
+ c = c.getParent();
+ }
+
+ return c;
+ }
+
+ private void componentAdded(UIComponent c) {
+ UIComponent child = c;
+ UIComponent parent;
+ while ((parent = findParentContainerComponent(child)) != null) {
+ Set<String> trackedChildrenSet = getTrackedChildrenSet(parent, true);
+ boolean updateNextParent = trackedChildrenSet.isEmpty();
+ trackedChildrenSet.add(getId(child));
+
+ if (!updateNextParent) {
+ break;
+ }
+
+ child = parent;
+ }
+ }
+
+ private void componentRemoved(UIComponent c) {
+ UIComponent child = c;
+ UIComponent parent;
+ while ((parent = findParentContainerComponent(child)) != null) {
+ Set<String> ajaxOutputSet = getTrackedChildrenSet(parent, false);
+ if (ajaxOutputSet != null) {
+ ajaxOutputSet.remove(getId(child));
+
+ if (ajaxOutputSet.isEmpty()) {
+ clearTrackedChildrenSet(parent);
+ } else {
+ break;
+ }
+ }
+
+ child = parent;
+ }
+ }
+
public void processEvent(SystemEvent event) throws AbortProcessingException {
- FacesContext facesContext = FacesContext.getCurrentInstance();
+ if (event instanceof PostAddToViewEvent) {
+ PostAddToViewEvent addToViewEvent = (PostAddToViewEvent) event;
+ componentAdded(addToViewEvent.getComponent());
+ } else if (event instanceof PreRemoveFromViewEvent) {
+ PreRemoveFromViewEvent removeFromViewEvent = (PreRemoveFromViewEvent) event;
+ componentRemoved(removeFromViewEvent.getComponent());
+ } else {
+ throw new IllegalArgumentException(event.toString());
+ }
+ }
- getAjaxOutputComponentsSet(facesContext).add((AjaxOutput) event.getSource());
+ public boolean isListenerForSource(Object source) {
+ return source instanceof AjaxOutput;
}
+
}
Modified: root/framework/trunk/impl/src/main/resources/META-INF/components.faces-config.xml
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/components.faces-config.xml 2010-03-29 13:56:12 UTC (rev 16681)
+++ root/framework/trunk/impl/src/main/resources/META-INF/components.faces-config.xml 2010-03-29 14:39:03 UTC (rev 16682)
@@ -10,6 +10,10 @@
<application>
<system-event-listener>
<system-event-listener-class>org.richfaces.context.PartialViewContextAjaxOutputTracker</system-event-listener-class>
+ <system-event-class>javax.faces.event.PreRemoveFromViewEvent</system-event-class>
+ </system-event-listener>
+ <system-event-listener>
+ <system-event-listener-class>org.richfaces.context.PartialViewContextAjaxOutputTracker</system-event-listener-class>
<system-event-class>javax.faces.event.PostAddToViewEvent</system-event-class>
</system-event-listener>
</application>
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js 2010-03-29 13:56:12 UTC (rev 16681)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js 2010-03-29 14:39:03 UTC (rev 16682)
@@ -20,13 +20,13 @@
input = newInput.appendTo(form);
}
} else {
- input.val(parameterValue);
+ input.val(parameterValue);
}
-
+
input.each(function() {parameterInputs.push(this)});
}
}
-
+
//TODO: inline onsubmit handler is not triggered - http://dev.jquery.com/ticket/4930
form.trigger("submit");
} finally {
@@ -35,15 +35,15 @@
}
};
//
-
+
//utils.js
jQuery.fn.toXML = function () {
var out = '';
-
+
if (this.length > 0) {
if (typeof XMLSerializer == 'function' ||
typeof XMLSerializer == 'object') {
-
+
var xs = new XMLSerializer();
this.each(function() { out += xs.serializeToString(this); });
} else if (this[0].xml !== undefined) {
@@ -52,16 +52,16 @@
this.each( function() { out += this; } );
}
}
-
+
return out;
};
-
+
richfaces.log = (function(jQuery) {
var LOG_LEVELS = {'debug': 1, 'info': 2, 'warn': 3, 'error': 4};
var LOG_LEVEL_COLORS = {'debug': 'darkblue', 'info': 'blue', 'warn': 'gold', 'error': 'red'};
- var DEFAULT_LOG_LEVEL = LOG_LEVELS['info'];
+ var DEFAULT_LOG_LEVEL = LOG_LEVELS['info'];
var currentLogLevel = DEFAULT_LOG_LEVEL;
-
+
var consoleInitialized = false;
var setLevel = function(level) {
@@ -71,11 +71,11 @@
}
clear();
};
-
+
var setLevelFromSelect = function(iLevel) {
currentLogLevel = iLevel || DEFAULT_LOG_LEVEL;
};
-
+
var clear = function() {
if (window.console && useBrowserConsole) {
window.console.clear();
@@ -84,7 +84,7 @@
console.children(".rich-log-contents").children().remove();
}
};
-
+
var getConsole = function() {
var console = jQuery('#richfaces\\.log');
if (console.length != 0) {
@@ -93,15 +93,15 @@
var clearBtn = console.children("button.rich-log-element");
if (clearBtn.length == 0) {
- clearBtn = jQuery("<button class='rich-log-element'>Clear</button>").appendTo(console);
+ clearBtn = jQuery("<button type='button' class='rich-log-element'>Clear</button>").appendTo(console);
}
clearBtn.click(clear);
-
+
var levelSelect = console.children("select.rich-log-element");
if (levelSelect.length == 0) {
levelSelect = jQuery("<select class='rich-log-element' />").appendTo(console);
}
-
+
if (levelSelect.children().length == 0) {
for (var level in LOG_LEVELS) {
jQuery("<option value='" + LOG_LEVELS[level]+ "'>" + level + "</option>").appendTo(levelSelect);
@@ -110,7 +110,7 @@
levelSelect.val(currentLogLevel);
levelSelect.change(function(event) { clear(); setLevelFromSelect(parseInt(jQuery(this).val(), 10)); return false;});
-
+
var consoleEntries = console.children(".rich-log-contents");
if (consoleEntries.length == 0) {
consoleEntries = jQuery("<div class='rich-log-contents'></div>").appendTo(console);
@@ -120,30 +120,30 @@
return console;
};
-
+
var useBrowserConsole = false;
var AM_PM = /(\s*(?:a|p)m)$/i;
-
+
var getMessagePrefix = function(level) {
var date = new Date();
var formattedDate = date.toLocaleTimeString();
-
+
var ms = (date.getMilliseconds() + 1000).toString().substr(1);
if (AM_PM.test(formattedDate)) {
formattedDate = formattedDate.replace(AM_PM, "." + ms + "$1");
} else {
formattedDate += "." + ms;
}
-
+
return level + '[' + formattedDate.replace() + ']: ';
};
-
+
var appendConsoleEntry = function(level, messagePrefix, messageText, console) {
//TODO - cache jQuery("<element>")?
var newEntry = jQuery(document.createElement("div")).appendTo(console.children(".rich-log-contents"));
jQuery("<span style='color: " + LOG_LEVEL_COLORS[level] + "'></span>").appendTo(newEntry).text(messagePrefix);
-
+
var entrySpan = jQuery(document.createElement("span")).appendTo(newEntry);
if (typeof messageText != 'object' || !messageText.appendTo) {
entrySpan.text(messageText);
@@ -155,7 +155,7 @@
var appendBrowserConsoleEntry = function(level, text) {
window.console[level]();
};
-
+
var appendMessage = function(level, message) {
if (window.console && useBrowserConsole) {
var text = getMessagePrefix(level) + message;
@@ -168,7 +168,7 @@
}
}
};
-
+
var methods = {setLevel: setLevel, clear: clear};
for (var logLevel in LOG_LEVELS) {
var f = function(text) {
@@ -179,14 +179,14 @@
}
return methods;
}(jQuery));
-
+
/**
* Evaluates chained properties for the "base" object.
- * For example, window.document.location is equivalent to
+ * For example, window.document.location is equivalent to
* "propertyNamesString" = "document.location" and "base" = window
* Evaluation is safe, so it stops on the first null or undefined object
- *
- * @param propertyNamesArray - array of strings that contains names of the properties to evaluate
+ *
+ * @param propertyNamesArray - array of strings that contains names of the properties to evaluate
* @param base - base object to evaluate properties on
* @return returns result of evaluation or empty string
*/
@@ -196,14 +196,14 @@
do {
result = result[propertyNamesArray[c++]];
} while (result && c != propertyNamesArray.length);
-
+
return result;
};
-
+
var VARIABLE_NAME_PATTERN_STRING = "[_A-Z,a-z]\\w*";
var VARIABLES_CHAIN = new RegExp("^\\s*"+VARIABLE_NAME_PATTERN_STRING+"(?:\\s*\\.\\s*"+VARIABLE_NAME_PATTERN_STRING+")*\\s*$");
var DOT_SEPARATOR = /\s*\.\s*/;
-
+
richfaces.evalMacro = function(macro, base) {
var value = "";
// variable evaluation
@@ -211,8 +211,8 @@
// object's variable evaluation
var propertyNamesArray = jQuery.trim(macro).split(DOT_SEPARATOR);
value = richfaces.getValue(propertyNamesArray, base);
- if (!value) {
- value = richfaces.getValue(propertyNamesArray, window);
+ if (!value) {
+ value = richfaces.getValue(propertyNamesArray, window);
}
} else {
//js string evaluation
@@ -222,25 +222,25 @@
} else with (base) {
value = eval(macro) ;
}
- } catch (e) {
- richfaces.log.warn("Exception: " + e.message + "\n[" + macro + "]");
+ } catch (e) {
+ richfaces.log.warn("Exception: " + e.message + "\n[" + macro + "]");
}
}
- if (typeof value == 'function') {
- value = value(base);
+ if (typeof value == 'function') {
+ value = value(base);
}
//TODO 0 and false are also treated as null values
return value || "";
};
var ALPHA_NUMERIC_MULTI_CHAR_REGEXP = /^\w+$/;
-
+
richfaces.interpolate = function (placeholders, context) {
var contextVarsArray = new Array();
for (var contextVar in context) {
if (ALPHA_NUMERIC_MULTI_CHAR_REGEXP.test(contextVar)) {
- //guarantees that no escaping for the below RegExp is necessary
+ //guarantees that no escaping for the below RegExp is necessary
contextVarsArray.push(contextVar);
}
}
@@ -248,23 +248,23 @@
var regexp = new RegExp("\\{(" + contextVarsArray.join("|") + ")\\}", "g");
return placeholders.replace(regexp, function(str, contextVar) {return context[contextVar];});
};
-
+
richfaces.clonePosition = function(element, baseElement, positioning, offset) {
-
+
};
//
var pushTracker = {};
-
+
richfaces.startPush = function(options) {
var clientId = options.clientId;
var pushResourceUrl = options.pushResourceUrl;
var pushId = options.pushId;
var interval = options.interval;
var ondataavailable = options.ondataavailable;
-
+
richfaces.stopPush(pushId);
-
+
pushTracker[pushId] = setTimeout(function() { // TODO: define this function in richfaces object to avoid definition every time when call startPush
var ajaxOptions = {
type: "HEAD",
@@ -274,7 +274,7 @@
dataType: "text",
complete: function(xhr) {
var isPushActive = !!pushTracker[pushId];
-
+
//TODO may someone wish to stop push from dataavailable handler?
delete pushTracker[pushId];
@@ -292,11 +292,11 @@
}
}
};
-
+
if (options.timeout) {
ajaxOptions.timeout = options.timeout;
}
-
+
jQuery.ajax(ajaxOptions);
}, interval);
};
@@ -307,7 +307,7 @@
delete pushTracker[id];
}
};
-
+
var jsfEventsAdapterEventNames = {
event: {
'begin': ['begin'],
@@ -347,7 +347,7 @@
if (type != 'error') {
delete event.status;
}
-
+
handler.call(source, event);
}
}
@@ -365,9 +365,9 @@
}
var getGlobalStatusNameVariable = function() {
- return richfaces.statusName;
+ return richfaces.statusName;
}
-
+
var chain = function() {
var functions = arguments;
if (functions.length == 1) {
@@ -379,7 +379,7 @@
var f = functions[i];
callResult = f.apply(this, arguments);
}
-
+
return callResult;
};
}
@@ -391,20 +391,20 @@
var curry = function(g, a) {
var _g = g;
var _a = a;
-
+
return function(b) {
_g(_a, b);
};
};
-
+
var createEventHandler = function(handlerCode) {
if (handlerCode) {
return new Function("event", "data", handlerCode);
}
-
+
return null;
};
-
+
//TODO take events just from .java code using EL-expression
var AJAX_EVENTS = (function() {
var serverEventHandler = function(clientHandler, event) {
@@ -431,29 +431,29 @@
clientHandler.call(window, event, data);
}
};
-
+
return {
'begin': null,
'complete': serverEventHandler,
'beforedomupdate': serverEventHandler
}
}());
-
+
richfaces.ajax = function(source, event, options) {
-
+
options = options || {};
var sourceId = (typeof source == 'object' && source.id) ? source.id : source;
-
+
parameters = options.parameters || {}; // TODO: change "parameters" to "richfaces.ajax.params"
- parameters.execute = "@component";
+ parameters.execute = "@component";
parameters.render = "@component";
-
+
if (!parameters["org.richfaces.ajax.component"]) {
parameters["org.richfaces.ajax.component"] = sourceId;
}
var eventHandlers;
-
+
for (var eventName in AJAX_EVENTS) {
var handler = createEventHandler(options[eventName]);
@@ -461,7 +461,7 @@
if (serverHandler) {
handler = curry(serverHandler, handler);
}
-
+
if (handler) {
eventHandlers = eventHandlers || {};
eventHandlers[eventName] = handler;
@@ -487,35 +487,35 @@
parameters['onevent'] = eventsAdapter;
parameters['onerror'] = eventsAdapter;
}
-
+
jsf.ajax.request(source, event, parameters);
};
-
+
var RICHFACES_AJAX_STATUS = "richfaces:ajaxStatus";
-
+
var getStatusDataAttributeName = function(statusName) {
return statusName ? (RICHFACES_AJAX_STATUS + "@" + statusName) : RICHFACES_AJAX_STATUS;
};
-
+
var statusAjaxEventHandler = function(data, methodName) {
if (methodName) {
//global status name
- var statusName = getGlobalStatusNameVariable();
+ var statusName = getGlobalStatusNameVariable();
var source = data.source;
-
+
var statusApplied = false;
var statusDataAttribute = getStatusDataAttributeName(statusName);
-
+
var statusContainers;
if (statusName) {
statusContainers = [jQuery()];
} else {
statusContainers = [jQuery(source).parents('form'), jQuery()];
}
-
- for (var containerIdx = 0; containerIdx < statusContainers.length && !statusApplied;
+
+ for (var containerIdx = 0; containerIdx < statusContainers.length && !statusApplied;
containerIdx++) {
-
+
var statusContainer = statusContainers[containerIdx];
var statuses = statusContainer.data(statusDataAttribute);
if (statuses) {
@@ -528,7 +528,7 @@
delete statuses[statusId];
}
}
-
+
if (!statusApplied) {
statusContainer.removeData(statusDataAttribute);
}
@@ -548,19 +548,19 @@
success: function(event) { statusAjaxEventHandler(event, 'success'); },
complete: function() { setGlobalStatusNameVariable(null); }
});
-
+
jsf.ajax.addOnEvent(jsfEventsListener);
//TODO blocks default alert error handler
jsf.ajax.addOnError(jsfEventsListener);
}
};
-
+
richfaces.status = function(statusId, options) {
this.statusId = statusId;
this.options = options || {};
this.register();
};
-
+
jQuery.extend(richfaces.status.prototype, (function() {
//TODO - support for parallel requests
@@ -568,7 +568,7 @@
var elt = document.getElementById(this.statusId);
return elt ? jQuery(elt) : null;
};
-
+
var showHide = function(selector) {
var element = getElement.call(this);
if (element) {
@@ -577,17 +577,17 @@
var t = jQuery(this);
t.css('display', t.is(selector) ? '': 'none');
});
-
+
return true;
}
-
+
return false;
};
-
+
return {
register: function() {
initializeStatuses();
-
+
var statusName = this.options.statusName;
var dataStatusAttribute = getStatusDataAttributeName(statusName);
@@ -600,39 +600,39 @@
container = jQuery();
};
}
-
+
var statuses = container.data(dataStatusAttribute);
if (!statuses) {
statuses = {};
container.data(dataStatusAttribute, statuses);
}
-
+
statuses[this.statusId] = this;
},
-
+
start: function() {
if (this.options.onstart) {
this.options.onstart.apply(this, arguments);
}
-
+
return showHide.call(this, '.rich-status-start');
},
-
+
stop: function() {
if (this.options.onstop) {
this.options.onstop.apply(this, arguments);
}
},
-
+
success: function() {
if (this.options.onsuccess) {
this.options.onsuccess.apply(this, arguments);
}
this.stop();
-
+
return showHide.call(this, '.rich-status-stop');
},
-
+
error: function() {
if (this.options.onerror) {
this.options.onerror.apply(this, arguments);
@@ -643,6 +643,6 @@
}
};
}()));
-
+
}(window.RichFaces = {}, jQuery));
14 years, 9 months
JBoss Rich Faces SVN: r16681 - in root/framework/trunk: impl/src/main/java/org/richfaces/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-03-29 09:56:12 -0400 (Mon, 29 Mar 2010)
New Revision: 16681
Added:
root/framework/trunk/impl/src/main/java/org/richfaces/component/DataAdaptorStateHelper.java
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java
root/framework/trunk/impl/src/main/java/org/richfaces/component/SavedState.java
root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java
root/framework/trunk/impl/src/test/java/org/richfaces/component/DataAdaptorTestCase.java
Log:
Fixed state saving for nested UIDataAdaptor components
Several updates for UIDataAdaptor
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java 2010-03-29 09:25:57 UTC (rev 16680)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java 2010-03-29 13:56:12 UTC (rev 16681)
@@ -23,6 +23,8 @@
package org.ajax4jsf.component;
+import javax.faces.context.FacesContext;
+
/**
* In the original {@link javax.faces.component.UIData} component, only state for a
* {@link javax.faces.component.EditableValueHolder} component saved for an iteration.
@@ -35,15 +37,18 @@
/**
* Get component state for a current iteration.
+ * @param context current {@link FacesContext}
* @return request-scope component state. Details are subject for a component implementation
*/
- public Object getIterationState();
+ public Object getIterationState(FacesContext context);
/**
* Set component state for the next iteration. State can be either previously saved iteration state
* or <code>null</code> value. In the second case component should reset its state to the initial.
+ *
+ * @param context current {@link FacesContext}
* @param state request-scope component state or <code>null</code>. Details are subject for a component
* implementation
*/
- public void setIterationState(Object state);
+ public void setIterationState(FacesContext context, Object state);
}
Added: root/framework/trunk/impl/src/main/java/org/richfaces/component/DataAdaptorStateHelper.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/component/DataAdaptorStateHelper.java (rev 0)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/component/DataAdaptorStateHelper.java 2010-03-29 13:56:12 UTC (rev 16681)
@@ -0,0 +1,137 @@
+/*
+ * 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.component;
+
+import java.io.Serializable;
+
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.DataComponentState;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.SerializableDataModel;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public final class DataAdaptorStateHelper implements StateHolder {
+
+ private boolean tranzient = false;
+
+ private boolean componentStateIsStateHolder = false;
+
+ private Object savedComponentState;
+
+ private DataComponentState dataComponentState;
+
+ private ExtendedDataModel<?> extendedDataModel;
+
+ public DataAdaptorStateHelper() {
+ }
+
+ DataAdaptorStateHelper(DataComponentState dataComponentState, ExtendedDataModel<?> extendedDataModel) {
+ super();
+ this.dataComponentState = dataComponentState;
+ this.extendedDataModel = extendedDataModel;
+ }
+
+ public DataComponentState getDataComponentState() {
+ return dataComponentState;
+ }
+
+ public ExtendedDataModel<?> getExtendedDataModel() {
+ return extendedDataModel;
+ }
+
+ public boolean isTransient() {
+ return tranzient;
+ }
+
+ public void setTransient(boolean newTransientValue) {
+ tranzient = newTransientValue;
+ }
+
+ public Object saveState(FacesContext context) {
+ //TODO - save only encoded states (see UIDataAdaptor#getEncodedIds())?
+
+ if (dataComponentState != null) {
+ if (dataComponentState instanceof StateHolder) {
+ componentStateIsStateHolder = true;
+
+ StateHolder stateHolder = (StateHolder) dataComponentState;
+ if (!stateHolder.isTransient()) {
+ savedComponentState = stateHolder.saveState(context);
+ }
+ } else {
+ componentStateIsStateHolder = false;
+
+ if (dataComponentState instanceof Serializable) {
+ savedComponentState = dataComponentState;
+ }
+ }
+ }
+
+ Object savedSerializableModel = null;
+
+ if (dataComponentState != null && extendedDataModel != null) {
+ // TODO handle model serialization - "execute" model
+ savedSerializableModel = extendedDataModel.getSerializableModel(dataComponentState.getRange());
+ }
+
+ if (savedComponentState != null || savedSerializableModel != null) {
+ return new Object[] {
+ componentStateIsStateHolder ? Boolean.TRUE : Boolean.FALSE,
+ savedComponentState,
+ savedSerializableModel
+ };
+ } else {
+ return null;
+ }
+ }
+
+ public void restoreState(FacesContext context, Object stateObject) {
+ if (stateObject != null) {
+ Object[] state = (Object[]) stateObject;
+
+ componentStateIsStateHolder = Boolean.TRUE.equals(state[0]);
+
+ if (componentStateIsStateHolder) {
+ savedComponentState = state[1];
+ } else {
+ dataComponentState = (DataComponentState) UIComponentBase.restoreAttachedState(context,
+ savedComponentState);
+ }
+
+ extendedDataModel = (SerializableDataModel) UIComponentBase.restoreAttachedState(context, state[2]);
+ }
+ }
+
+ void restoreComponentState(FacesContext context, UIDataAdaptor dataAdaptor) {
+ if (savedComponentState != null && componentStateIsStateHolder) {
+ dataComponentState = dataAdaptor.createComponentState();
+ ((StateHolder) dataComponentState).restoreState(context, savedComponentState);
+ savedComponentState = null;
+ }
+ }
+}
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/component/SavedState.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/component/SavedState.java 2010-03-29 09:25:57 UTC (rev 16680)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/component/SavedState.java 2010-03-29 13:56:12 UTC (rev 16681)
@@ -22,12 +22,14 @@
package org.richfaces.component;
-import org.ajax4jsf.component.IterationStateHolder;
-
import javax.faces.component.EditableValueHolder;
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponentBase;
import javax.faces.component.UIForm;
-import java.io.Serializable;
+import javax.faces.context.FacesContext;
+import org.ajax4jsf.component.IterationStateHolder;
+
//from RI
/**
@@ -36,9 +38,11 @@
*
* @author shura
*/
-final class SavedState implements Serializable {
+public final class SavedState implements StateHolder {
+
public static final SavedState EMPTY = new SavedState();
- private static final long serialVersionUID = 2920252657338389849L;
+
+ private boolean tranzient = false;
private boolean valid = true;
private Object iterationState;
private boolean localValueSet;
@@ -58,9 +62,9 @@
this.localValueSet = evh.isLocalValueSet();
}
- public SavedState(IterationStateHolder ish) {
+ public SavedState(FacesContext context, IterationStateHolder ish) {
super();
- this.iterationState = ish.getIterationState();
+ this.iterationState = ish.getIterationState(context);
}
public SavedState(UIForm form) {
@@ -125,11 +129,40 @@
evh.setLocalValueSet(this.localValueSet);
}
- public void apply(IterationStateHolder ish) {
- ish.setIterationState(this.iterationState);
+ public void apply(FacesContext context, IterationStateHolder ish) {
+ ish.setIterationState(context, this.iterationState);
}
public void apply(UIForm form) {
form.setSubmitted(this.submitted);
}
+
+ public boolean isTransient() {
+ return tranzient;
+ }
+
+ public void restoreState(FacesContext context, Object stateObject) {
+ Object[] state = (Object[]) stateObject;
+ iterationState = UIComponentBase.restoreAttachedState(context, state[0]);
+ localValueSet = Boolean.TRUE.equals(state[1]);
+ submitted = Boolean.TRUE.equals(state[2]);
+ submittedValue = state[3];
+ value = state[4];
+ valid = Boolean.TRUE.equals(state[5]);
+ }
+
+ public Object saveState(FacesContext context) {
+ return new Object[] {
+ UIComponentBase.saveAttachedState(context, iterationState),
+ localValueSet ? Boolean.TRUE : Boolean.FALSE,
+ submitted ? Boolean.TRUE : Boolean.FALSE,
+ submittedValue,
+ value,
+ valid ? Boolean.TRUE : Boolean.FALSE
+ };
+ }
+
+ public void setTransient(boolean newTransientValue) {
+ tranzient = newTransientValue;
+ }
}
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-03-29 09:25:57 UTC (rev 16680)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-03-29 13:56:12 UTC (rev 16681)
@@ -23,23 +23,20 @@
package org.richfaces.component;
import java.io.IOException;
-import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import javax.el.ValueExpression;
import javax.faces.FacesException;
+import javax.faces.application.Application;
import javax.faces.application.FacesMessage;
import javax.faces.component.ContextCallback;
import javax.faces.component.EditableValueHolder;
import javax.faces.component.NamingContainer;
-import javax.faces.component.StateHelper;
-import javax.faces.component.StateHolder;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.component.UIForm;
@@ -53,12 +50,12 @@
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import javax.faces.event.AbortProcessingException;
-import javax.faces.event.ActionEvent;
-import javax.faces.event.BehaviorEvent;
import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PostValidateEvent;
+import javax.faces.event.PreValidateEvent;
import javax.faces.render.Renderer;
-import org.ajax4jsf.component.AjaxDataEncoder;
import org.ajax4jsf.component.IterationStateHolder;
import org.ajax4jsf.model.DataComponentState;
import org.ajax4jsf.model.DataVisitResult;
@@ -70,17 +67,14 @@
import org.slf4j.Logger;
/**
- * Base class for iterable components, like dataTable, Tomahawk dataList,
- * Facelets repeat, tree etc., with support for partial rendering on AJAX
- * responces for one or more selected iterations.
+ * Base class for iterable components, like dataTable, Tomahawk dataList, Facelets repeat, tree etc., with support for
+ * partial rendering on AJAX responces for one or more selected iterations.
*
* @author shura
*/
+public abstract class UIDataAdaptor extends UIComponentBase implements NamingContainer,
+ UniqueIdVendor, IterationStateHolder {
-//TODO check AjaxDataEncoder
-public abstract class UIDataAdaptor extends UIComponentBase
- implements AjaxDataEncoder, NamingContainer, UniqueIdVendor, IterationStateHolder {
-
/**
* <p>The standard component family for this component.</p>
*/
@@ -123,7 +117,6 @@
}
};
- private Object ajaxRowKey = null;
private DataComponentState componentState = null;
private ExtendedDataModel<?> extendedDataModel = null;
private Object rowKey = null;
@@ -133,19 +126,19 @@
/**
* @author Nick Belaevski
- *
+ *
*/
private final class DataVisitorForVisitTree implements DataVisitor {
/**
- *
+ *
*/
private final VisitCallback callback;
/**
- *
+ *
*/
private final VisitContext visitContext;
/**
- *
+ *
*/
private boolean visitResult;
@@ -177,14 +170,14 @@
return DataVisitResult.CONTINUE;
}
-
+
public boolean getVisitResult() {
return visitResult;
}
}
private enum PropertyKeys {
- ajaxKeys, lastId, var, rowKeyVar, stateVar, childState, rowKeyConverter
+ lastId, var, rowKeyVar, stateVar, childState, rowKeyConverter
}
public UIDataAdaptor() {
@@ -194,7 +187,7 @@
protected Map<String, Object> getVariablesMap(FacesContext facesContext) {
return facesContext.getExternalContext().getRequestMap();
}
-
+
/*
* (non-Javadoc)
* @see javax.faces.component.UIComponent#getFamily()
@@ -205,33 +198,8 @@
}
/*
- * (non-Javadoc)
- * @see org.ajax4jsf.component.AjaxDataEncoder#getAjaxKeys()
- */
- @SuppressWarnings("unchecked")
- public Set<Object> getAjaxKeys() {
- Set<Object> defaultAjaxKeys = null;
-
- if (ajaxRowKey != null) {
-
- // cannot use Collections.singleton() because ajaxKeys set should be modifiable
- defaultAjaxKeys = new HashSet<Object>(1);
- defaultAjaxKeys.add(ajaxRowKey);
- }
-
- return (Set<Object>) getStateHelper().eval(PropertyKeys.ajaxKeys, defaultAjaxKeys);
- }
-
- /*
- * (non-Javadoc)
- * @see org.ajax4jsf.component.AjaxDataEncoder#setAjaxKeys(java.util.Set)
- */
- public void setAjaxKeys(Set<Object> ajaxKeys) {
- getStateHelper().put(PropertyKeys.ajaxKeys, ajaxKeys);
- }
-
- /*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.ajax4jsf.component.AjaxChildrenEncoder#encodeAjaxChild(javax.faces.context.FacesContext,
* java.lang.String, java.util.Set, java.util.Set)
*/
@@ -314,7 +282,7 @@
if (component instanceof IterationStateHolder) {
IterationStateHolder ish = (IterationStateHolder) component;
- state = new SavedState(ish);
+ state = new SavedState(facesContext, ish);
} else if (component instanceof EditableValueHolder) {
EditableValueHolder evh = (EditableValueHolder) component;
@@ -385,8 +353,9 @@
component.setId(id); // Forces client id to be reset
SavedState savedState = null;
- @SuppressWarnings("unchecked") Map<String, SavedState> savedStatesMap =
- (Map<String, SavedState>) getStateHelper().get(PropertyKeys.childState);
+ @SuppressWarnings("unchecked")
+ Map<String, SavedState> savedStatesMap = (Map<String, SavedState>) getStateHelper()
+ .get(PropertyKeys.childState);
if (savedStatesMap != null) {
savedState = savedStatesMap.get(component.getClientId(facesContext));
@@ -399,7 +368,7 @@
if (component instanceof IterationStateHolder) {
IterationStateHolder ish = (IterationStateHolder) component;
- savedState.apply(ish);
+ savedState.apply(facesContext, ish);
} else if (component instanceof EditableValueHolder) {
EditableValueHolder evh = (EditableValueHolder) component;
@@ -427,28 +396,12 @@
setRowKey(getFacesContext(), rowKey);
}
- protected boolean isAjaxKeyEvent(FacesEvent event) {
- return (event instanceof ActionEvent) || (event instanceof BehaviorEvent);
- }
-
- protected void addAjaxKeyEvent(FacesEvent event) {
- Object eventRowKey = getRowKey();
-
- if (null != eventRowKey) {
- this.ajaxRowKey = eventRowKey;
- }
- }
-
/*
* (non-Javadoc)
* @see javax.faces.component.UIComponentBase#queueEvent(javax.faces.event.FacesEvent)
*/
@Override
public void queueEvent(FacesEvent event) {
- if (isAjaxKeyEvent(event)) {
- addAjaxKeyEvent(event);
- }
-
super.queueEvent(new RowKeyContextEventWrapper(this, event, getRowKey()));
}
@@ -472,7 +425,7 @@
RowKeyContextEventWrapper revent = (RowKeyContextEventWrapper) event;
Object oldRowKey = getRowKey();
- setRowKey(revent.getRowKey());
+ setRowKey(context, revent.getRowKey());
FacesEvent rowEvent = revent.getFacesEvent();
UIComponent source = rowEvent.getComponent();
@@ -497,7 +450,7 @@
}
}
- setRowKey(oldRowKey);
+ setRowKey(context, oldRowKey);
}
/**
@@ -688,7 +641,7 @@
// Store converter for a invokeOnComponents call.
if (null != rowKeyConverter) {
- //TODO - review
+ // TODO - review
setRowKeyConverter(rowKeyConverter);
}
}
@@ -840,7 +793,7 @@
getExtendedDataModel().walk(faces, visitor, range, argument);
- setRowKey(key);
+ setRowKey(faces, key);
restoreOrigValue(faces);
}
@@ -849,8 +802,11 @@
return;
}
+ pushComponentToEL(faces, this);
+ preDecode(faces);
this.iterate(faces, decodeVisitor);
this.decode(faces);
+ popComponentFromEL(faces);
}
public void processValidators(FacesContext faces) {
@@ -858,7 +814,13 @@
return;
}
+ pushComponentToEL(faces, this);
+ Application app = faces.getApplication();
+ app.publishEvent(faces, PreValidateEvent.class, this);
+ preValidate(faces);
this.iterate(faces, validateVisitor);
+ app.publishEvent(faces, PostValidateEvent.class, this);
+ popComponentFromEL(faces);
}
public void processUpdates(FacesContext faces) {
@@ -866,6 +828,8 @@
return;
}
+ pushComponentToEL(faces, this);
+ preUpdate(faces);
this.iterate(faces, updateVisitor);
ExtendedDataModel<?> dataModel = getExtendedDataModel();
@@ -877,6 +841,8 @@
serializableModel.update();
}
+
+ popComponentFromEL(faces);
}
@Override
@@ -889,54 +855,66 @@
* (non-Javadoc)
* @see org.ajax4jsf.component.IterationStateHolder#getIterationState()
*/
- public Object getIterationState() {
+ public Object getIterationState(FacesContext context) {
assert rowKey == null;
- StateHelper stateHelper = getStateHelper();
-
- return new Object[]{stateHelper.get(PropertyKeys.childState), this.componentState, this.ajaxRowKey,
- this.extendedDataModel,};
+ return new DataAdaptorStateHelper(this.componentState, this.extendedDataModel);
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see org.ajax4jsf.component.IterationStateHolder#setIterationState(java.lang.Object)
*/
- public void setIterationState(Object stateObject) {
+ public void setIterationState(FacesContext context, Object stateObject) {
assert rowKey == null;
// TODO - ?
// restoreChildState(getFacesContext());
- StateHelper stateHelper = getStateHelper();
-
if (stateObject != null) {
- Object[] state = (Object[]) stateObject;
+ DataAdaptorStateHelper stateHelper = (DataAdaptorStateHelper) stateObject;
+ stateHelper.restoreComponentState(context, this);
- stateHelper.put(PropertyKeys.childState, state[0]);
- this.componentState = (DataComponentState) state[1];
- this.ajaxRowKey = state[2];
- this.extendedDataModel = (ExtendedDataModel<?>) state[3];
+ this.componentState = stateHelper.getDataComponentState();
+ this.extendedDataModel = stateHelper.getExtendedDataModel();
} else {
- stateHelper.remove(PropertyKeys.childState);
this.componentState = null;
- this.ajaxRowKey = null;
this.extendedDataModel = null;
}
}
- protected void resetDataModel(FacesContext context) {
+ protected void resetDataModel() {
this.extendedDataModel = null;
}
- protected void resetChildState(FacesContext context) {
+ protected void resetChildState() {
getStateHelper().remove(PropertyKeys.childState);
}
+ protected void preDecode(FacesContext context) {
+ resetDataModel();
+
+ Object savedChildState = getStateHelper().get(PropertyKeys.childState);
+ // TODO - verify the check for null: savedChildState == null
+ if (savedChildState == null || !keepSaved(context)) {
+ resetChildState();
+ }
+ }
+
+ // TODO - do we need this method?
+ protected void preValidate(FacesContext context) {
+ }
+
+ // TODO - do we need this method?
+ protected void preUpdate(FacesContext context) {
+ }
+
protected void preEncodeBegin(FacesContext context) {
- resetDataModel(context);
+ resetDataModel();
if (!keepSaved(context)) {
- resetChildState(context);
+ //TODO - this also resets state for the nested iteration components - is it correct?
+ resetChildState();
}
}
@@ -953,32 +931,16 @@
@Override
public Object saveState(FacesContext context) {
- // TODO handle model serialization - "execute" model
- Boolean componentStateIsStateHolder = null;
- Object savedComponentState = null;
-
// TODO - partial state saving handling
- if (componentState instanceof StateHolder) {
- componentStateIsStateHolder = Boolean.TRUE;
-
- StateHolder stateHolder = (StateHolder) componentState;
-
- if (!stateHolder.isTransient()) {
- savedComponentState = stateHolder.saveState(context);
- }
- } else {
- componentStateIsStateHolder = Boolean.FALSE;
-
- if (componentState instanceof Serializable) {
- savedComponentState = componentState;
- }
- }
-
- return new Object[]{super.saveState(context), savedComponentState, componentStateIsStateHolder};
+ return new Object[] {
+ super.saveState(context),
+ new DataAdaptorStateHelper(componentState, extendedDataModel).saveState(context)
+ };
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.UIComponentBase#restoreState(javax.faces.context.FacesContext, java.lang.Object)
*/
@Override
@@ -988,19 +950,14 @@
// TODO Auto-generated method stub
super.restoreState(context, state[0]);
- Object savedComponentState = state[1];
+ if (state[1] != null) {
+ DataAdaptorStateHelper dataAdaptorStateHelper = new DataAdaptorStateHelper();
+ dataAdaptorStateHelper.restoreState(context, state[1]);
+ dataAdaptorStateHelper.restoreComponentState(context, this);
- if (savedComponentState != null) {
- boolean componentStateIsStateHolder = ((Boolean) state[2]).booleanValue();
-
- if (componentStateIsStateHolder) {
- componentState = createComponentState();
- ((StateHolder) componentState).restoreState(context, savedComponentState);
- } else {
- componentState = (DataComponentState) restoreAttachedState(context, savedComponentState);
- }
-
// TODO update state model binding
+ componentState = dataAdaptorStateHelper.getDataComponentState();
+ extendedDataModel = dataAdaptorStateHelper.getExtendedDataModel();
}
}
@@ -1112,28 +1069,41 @@
// Tests whether we need to visit our children as part of
// a tree visit
- private boolean doVisitChildren(VisitContext context) {
+ private boolean doVisitChildren(VisitContext context, boolean visitRows) {
// Just need to check whether there are any ids under this
- // subtree. Make sure row index is cleared out since
+ // subtree. Make sure row index is cleared out since
// getSubtreeIdsToVisit() needs our row-less client id.
- setRowKey(null);
+ // TODO check this
+ if (visitRows) {
+ setRowKey(context.getFacesContext(), null);
+ }
+
+ // TODO optimize for returned IDs
Collection<String> idsToVisit = context.getSubtreeIdsToVisit(this);
assert idsToVisit != null;
+ if (idsToVisit == VisitContext.ALL_IDS) {
+ // TODO
+ }
+
// All ids or non-empty collection means we need to visit our children.
return !idsToVisit.isEmpty();
}
- private boolean visitFixedChildren(VisitContext visitContext, VisitCallback callback) {
- Iterator<UIComponent> fixedChildrenItr = fixedChildren();
+ private boolean visitComponents(Iterator<UIComponent> components, VisitContext context, VisitCallback callback,
+ boolean resetKeyBeforeVisit) {
- while (fixedChildrenItr.hasNext()) {
- UIComponent fixedChild = fixedChildrenItr.next();
+ if (resetKeyBeforeVisit) {
+ setRowKey(context.getFacesContext(), null);
+ }
- if (fixedChild.visitTree(visitContext, callback)) {
+ while (components.hasNext()) {
+ UIComponent nextChild = components.next();
+
+ if (nextChild.visitTree(context, callback)) {
return true;
}
}
@@ -1141,19 +1111,29 @@
return false;
}
- private boolean visitDataChildren(final VisitContext visitContext, final VisitCallback callback) {
- FacesContext facesContext = visitContext.getFacesContext();
+ protected boolean visitFixedChildren(VisitContext visitContext, VisitCallback callback, boolean resetKeyBeforeVisit) {
- DataVisitorForVisitTree dataVisitor = new DataVisitorForVisitTree(callback, visitContext);
- this.walk(facesContext, dataVisitor, null);
+ return visitComponents(fixedChildren(), visitContext, callback, resetKeyBeforeVisit);
+ }
- return dataVisitor.getVisitResult();
+ protected boolean visitDataChildren(VisitContext visitContext, VisitCallback callback, boolean resetKeyBeforeVisit) {
+
+ if (resetKeyBeforeVisit) {
+ FacesContext facesContext = visitContext.getFacesContext();
+
+ DataVisitorForVisitTree dataVisitor = new DataVisitorForVisitTree(callback, visitContext);
+ this.walk(facesContext, dataVisitor, null);
+
+ return dataVisitor.getVisitResult();
+ } else {
+ return visitComponents(dataChildren(), visitContext, callback, false);
+ }
}
@Override
public boolean visitTree(VisitContext visitContext, VisitCallback callback) {
- // First check to see whether we are visitable. If not
+ // First check to see whether we are visitable. If not
// short-circuit out of this subtree, though allow the
// visit to proceed through to other subtrees.
if (!isVisitable(visitContext)) {
@@ -1164,18 +1144,23 @@
// we start from a clean slate.
FacesContext facesContext = visitContext.getFacesContext();
- captureOrigValue(facesContext);
+ // NOTE: that the visitRows local will be obsolete once the
+ // appropriate visit hints have been added to the API
+ boolean visitRows = requiresRowIteration(facesContext);
- Object oldRowKey = getRowKey();
+ Object oldRowKey = null;
+ if (visitRows) {
+ captureOrigValue(facesContext);
+ oldRowKey = getRowKey();
+ setRowKey(facesContext, null);
+ }
- setRowKey(facesContext, null);
-
// Push ourselves to EL
pushComponentToEL(facesContext, null);
try {
- // Visit ourselves. Note that we delegate to the
+ // Visit ourselves. Note that we delegate to the
// VisitContext to actually perform the visit.
VisitResult result = visitContext.invokeVisitCallback(this, callback);
@@ -1185,12 +1170,14 @@
}
// Visit children, short-circuiting as necessary
- if ((result == VisitResult.ACCEPT) && doVisitChildren(visitContext)) {
- if (visitFixedChildren(visitContext, callback)) {
+ if ((result == VisitResult.ACCEPT) && doVisitChildren(visitContext, visitRows)) {
+
+ if (visitFixedChildren(visitContext, callback, visitRows)) {
return true;
}
- if (visitDataChildren(visitContext, callback)) {
+ // TODO check doVisitChildren() once again
+ if (visitDataChildren(visitContext, callback, visitRows)) {
return true;
}
}
@@ -1199,13 +1186,15 @@
// Clean up - pop EL and restore old row index
popComponentFromEL(facesContext);
- try {
- setRowKey(oldRowKey);
- restoreOrigValue(facesContext);
- } catch (Exception e) {
+ if (visitRows) {
+ try {
+ setRowKey(facesContext, oldRowKey);
+ restoreOrigValue(facesContext);
+ } catch (Exception e) {
- // TODO: handle exception
- LOG.error(e.getMessage(), e);
+ // TODO: handle exception
+ LOG.error(e.getMessage(), e);
+ }
}
}
@@ -1214,18 +1203,25 @@
}
/**
+ * @param facesContext
+ * @return
+ */
+ private boolean requiresRowIteration(FacesContext context) {
+ return (!PhaseId.RESTORE_VIEW.equals(context.getCurrentPhaseId()));
+ }
+
+ /**
* @param context
* @param substring
* @return
*/
- //TODO review!
+ // TODO review!
protected String extractKeySegment(FacesContext context, String substring) {
return null;
}
/**
- * Base class for visit data model at phases decode, validation and update
- * model
+ * Base class for visit data model at phases decode, validation and update model
*
* @author shura
*/
Modified: root/framework/trunk/impl/src/test/java/org/richfaces/component/DataAdaptorTestCase.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/richfaces/component/DataAdaptorTestCase.java 2010-03-29 09:25:57 UTC (rev 16680)
+++ root/framework/trunk/impl/src/test/java/org/richfaces/component/DataAdaptorTestCase.java 2010-03-29 13:56:12 UTC (rev 16681)
@@ -54,7 +54,7 @@
/**
* @author Nick Belaevski
- *
+ *
*/
public class DataAdaptorTestCase extends AbstractFacesTest {
@@ -220,59 +220,59 @@
form.getChildren().add(input);
form.getFacets().put("facet", stateHolder);
- mockDataAdaptor.setRowKey(Integer.valueOf(0));
+ mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(0));
assertFalse(form.isSubmitted());
assertNull(input.getSubmittedValue());
assertNull(input.getLocalValue());
assertTrue(input.isValid());
assertFalse(input.isLocalValueSet());
- assertNull(stateHolder.getIterationState());
+ assertNull(stateHolder.getIterationState(facesContext));
form.setSubmitted(true);
input.setSubmittedValue("user input");
input.setValue("component value");
input.setValid(false);
input.setLocalValueSet(true);
- stateHolder.setIterationState("state");
+ stateHolder.setIterationState(facesContext, "state");
- mockDataAdaptor.setRowKey(Integer.valueOf(1));
+ mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(1));
assertFalse(form.isSubmitted());
assertNull(input.getSubmittedValue());
assertNull(input.getLocalValue());
assertTrue(input.isValid());
assertFalse(input.isLocalValueSet());
- assertNull(stateHolder.getIterationState());
+ assertNull(stateHolder.getIterationState(facesContext));
input.setSubmittedValue("another input from user");
input.setValue("123");
assertTrue(input.isLocalValueSet());
- stateHolder.setIterationState("456");
+ stateHolder.setIterationState(facesContext, "456");
- mockDataAdaptor.setRowKey(Integer.valueOf(0));
+ mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(0));
assertTrue(form.isSubmitted());
assertEquals("user input", input.getSubmittedValue());
assertEquals("component value", input.getLocalValue());
assertFalse(input.isValid());
assertTrue(input.isLocalValueSet());
- assertEquals("state", stateHolder.getIterationState());
+ assertEquals("state", stateHolder.getIterationState(facesContext));
- mockDataAdaptor.setRowKey(Integer.valueOf(1));
+ mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(1));
assertFalse(form.isSubmitted());
assertEquals("another input from user", input.getSubmittedValue());
assertEquals("123", input.getLocalValue());
assertTrue(input.isValid());
assertTrue(input.isLocalValueSet());
- assertEquals("456", stateHolder.getIterationState());
+ assertEquals("456", stateHolder.getIterationState(facesContext));
- mockDataAdaptor.setRowKey(null);
+ mockDataAdaptor.setRowKey(facesContext, null);
assertFalse(form.isSubmitted());
assertNull(input.getSubmittedValue());
assertNull(input.getLocalValue());
assertTrue(input.isValid());
assertFalse(input.isLocalValueSet());
- assertNull(stateHolder.getIterationState());
+ assertNull(stateHolder.getIterationState(facesContext));
}
public void testSaveRestoreChildrenStateNestedDataAdaptors() throws Exception {
@@ -287,8 +287,8 @@
Integer rowKey = Integer.valueOf(2);
Integer childKey = Integer.valueOf(1);
- mockDataAdaptor.setRowKey(rowKey);
- childAdaptor.setRowKey(childKey);
+ mockDataAdaptor.setRowKey(facesContext, rowKey);
+ childAdaptor.setRowKey(facesContext, childKey);
assertNull(input.getSubmittedValue());
assertNull(input.getLocalValue());
@@ -298,17 +298,17 @@
input.setSubmittedValue("submittedValue");
input.setValue("value");
- childAdaptor.setRowKey(null);
- mockDataAdaptor.setRowKey(Integer.valueOf(3));
- childAdaptor.setRowKey(Integer.valueOf(0));
+ childAdaptor.setRowKey(facesContext, null);
+ mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(3));
+ childAdaptor.setRowKey(facesContext, Integer.valueOf(0));
assertNull(input.getSubmittedValue());
assertNull(input.getLocalValue());
assertFalse(input.isLocalValueSet());
- childAdaptor.setRowKey(null);
- mockDataAdaptor.setRowKey(rowKey);
- childAdaptor.setRowKey(childKey);
+ childAdaptor.setRowKey(facesContext, null);
+ mockDataAdaptor.setRowKey(facesContext, rowKey);
+ childAdaptor.setRowKey(facesContext, childKey);
assertEquals("submittedValue", input.getSubmittedValue());
assertEquals("value", input.getLocalValue());
@@ -329,11 +329,11 @@
});
mockDataAdaptor.getChildren().add(input);
- mockDataAdaptor.setRowKey(Integer.valueOf(1));
+ mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(1));
assertEquals(data.get(1), getVarValue());
new ValueChangeEvent(input, null, "testValue").queue();
- mockDataAdaptor.setRowKey(null);
+ mockDataAdaptor.setRowKey(facesContext, null);
facesContext.getViewRoot().broadcastEvents(facesContext, PhaseId.PROCESS_VALIDATIONS);
assertEquals(1, testCallback.get());
@@ -492,11 +492,11 @@
return "test.Component";
}
- public Object getIterationState() {
+ public Object getIterationState(FacesContext context) {
return iterationState;
}
- public void setIterationState(Object state) {
+ public void setIterationState(FacesContext context, Object state) {
iterationState = state;
}
14 years, 9 months