JBoss Rich Faces SVN: r16640 - branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-03-19 16:59:38 -0400 (Fri, 19 Mar 2010)
New Revision: 16640
Modified:
branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller/DataScrollerBean.java
Log:
RF-8357
Modified: branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller/DataScrollerBean.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller/DataScrollerBean.java 2010-03-19 20:58:39 UTC (rev 16639)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller/DataScrollerBean.java 2010-03-19 20:59:38 UTC (rev 16640)
@@ -21,7 +21,7 @@
public List<SelectItem> getPagesToScroll() {
List<SelectItem> list = new ArrayList<SelectItem>();
- for (int i = 1; i <= size / getRows(); i++) {
+ for (int i = 1; i <= Math.ceil(size / getRows()); i++) {
if (Math.abs(i - scrollerPage) < 5) {
SelectItem item = new SelectItem(i);
list.add(item);
14 years, 9 months
JBoss Rich Faces SVN: r16639 - branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/model.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-03-19 16:58:39 -0400 (Fri, 19 Mar 2010)
New Revision: 16639
Modified:
branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/model/SequenceRange.java
Log:
RF-8351
Modified: branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/model/SequenceRange.java
===================================================================
--- branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/model/SequenceRange.java 2010-03-19 18:04:19 UTC (rev 16638)
+++ branches/community/3.3.X/framework/api/src/main/java/org/ajax4jsf/model/SequenceRange.java 2010-03-19 20:58:39 UTC (rev 16639)
@@ -21,13 +21,20 @@
package org.ajax4jsf.model;
+import java.io.Serializable;
+
/**
* @author shura
*
*/
-public class SequenceRange implements Range {
+public class SequenceRange implements Range, Serializable {
- private int firstRow = 0;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 7376192091922085690L;
+
+ private int firstRow = 0;
private int rows = -1;
14 years, 9 months
JBoss Rich Faces SVN: r16638 - in root/ui-sandbox/trunk/components/tables/ui/src/main: java/org/richfaces/renderkit and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-03-19 14:04:19 -0400 (Fri, 19 Mar 2010)
New Revision: 16638
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
Log:
RF-8484
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java 2010-03-19 17:31:27 UTC (rev 16637)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java 2010-03-19 18:04:19 UTC (rev 16638)
@@ -1,8 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
package org.richfaces.component;
+import org.ajax4jsf.model.DataComponentState;
+import org.ajax4jsf.model.RepeatState;
+
+
/**
* @author Anton Belevich
*
*/
-public abstract class UIExtendedDataTable extends UIDataTable {
+public abstract class UIExtendedDataTable extends UIDataTableBase {
+
+ @Override
+ protected DataComponentState createComponentState() {
+ return new RepeatState() {
+ @Override
+ public int getFirst() {
+ return UIExtendedDataTable.this.getClientFirst();
+ }
+
+ @Override
+ public int getRows() {
+ return UIExtendedDataTable.this.getClientRows();
+ }
+ };
+ }
+
+ protected enum PropertyKeys {
+ clientFirst, clientRows
+ }
+
+ public int getClientFirst() {
+ return (Integer) getStateHelper().eval(PropertyKeys.clientFirst, 0);
+ }
+
+ public void setClientFirst(int clientFirst) {
+ getStateHelper().put(PropertyKeys.clientFirst, clientFirst);
+ }
+
+ @Override
+ public void setFirst(int first) {
+ super.setFirst(first);
+ setClientFirst(first);
+ }
+
+ public int getClientRows() {
+ return (Integer) getStateHelper().eval(PropertyKeys.clientRows, 0);
+ }
+
+ public void setClientRows(int clientRows) {
+ getStateHelper().put(PropertyKeys.clientRows, clientRows);
+ }
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-03-19 17:31:27 UTC (rev 16637)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-03-19 18:04:19 UTC (rev 16638)
@@ -203,12 +203,25 @@
ajaxFunction.addParameter(eventOptions);
}
- writer.write("new RichFaces.ExtendedDataTable('" + component.getClientId(context)
- + "', function(event, columnsOrder) {" + ajaxFunction.toScript() + ";});");
+ writer.write("new RichFaces.ExtendedDataTable('" + component.getClientId(context) + "', "
+ + getRowCount(component) + ", function(event, columnsOrder) {" + ajaxFunction.toScript() + ";});");
writer.endElement(HTML.SCRIPT_ELEM);
writer.endElement(HTML.DIV_ELEM);
}
+
+ private int getRowCount(UIComponent component) {
+ UIExtendedDataTable table = (UIExtendedDataTable) component;
+ int rows = table.getRows();
+ int rowCount = table.getRowCount() - table.getFirst();
+ if (rows > 0) {
+ rows = Math.min(rows, rowCount);
+ } else {
+ rows = rowCount;
+ }
+ return rows;
+ }
+
private void encodeStyle(RendererState state) throws IOException {
FacesContext context = state.getContext();
ResponseWriter writer = context.getResponseWriter();
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2010-03-19 17:31:27 UTC (rev 16637)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2010-03-19 18:04:19 UTC (rev 16638)
@@ -34,10 +34,10 @@
return rule;
};
- richfaces.ExtendedDataTable = function(id, ajaxFunction) {
+ richfaces.ExtendedDataTable = function(id, rowCount, ajaxFunction) {
var WIDTH_CLASS_NAME_BASE = "rich-extable-cell-width-";
var MIN_WIDTH = 20;
- var idSuffixs = [":header", ":footer"];
+ var idSuffixs = [":header", ":footer"]; //TODO Not use idSuffixs
var element = document.getElementById(id);
var bodyElement = document.getElementById(id + ":b");
@@ -57,7 +57,7 @@
idSuffixs[idSuffixs.length] = ":body";
//TODO var marginElement = contentElement.firstChild;this.marginElement = Richfaces.firstDescendant(this.contentElement);
var dataTableElement = contentElement.lastChild;//TODO this.dataTableElement = Richfaces.lastDescendant(this.contentElement);
- var rows = document.getElementById(id + idSuffixs[1]).firstChild.rows.length;//TODO Richfaces.firstDescendant;
+ var rows = document.getElementById(id + ":body").firstChild.rows.length;//TODO Richfaces.firstDescendant;
}
var scrollElement = document.getElementById(id + ":footer");
@@ -135,7 +135,7 @@
};
var initializeLayout = function() {
- //TODO contentElement.style.height = (rowCount * dataTableElement.offsetHeight / rows) + "px";
+ contentElement.style.height = (rowCount * dataTableElement.offsetHeight / rows) + "px";
updateLayout();
updateScrollPosition(); //TODO Restore horizontal scroll position
};
@@ -217,16 +217,6 @@
}
});
ajaxFunction(event, colunmsOrder);
-// bodyElement.style.display = "none";
-// jQuery("#" + escapedId + "\\:" + classNameOfReorderingColumn + "\\:h").insertBefore("#" + escapedId + "\\:" + className + "\\:h");
-// jQuery(bodyElement).find("table div tr").each(function(){
-// var div = jQuery(this).find("." + WIDTH_CLASS_NAME_BASE + classNameOfReorderingColumn);
-// if (div.length) {
-// div.parent().insertBefore(jQuery(this).find("." + WIDTH_CLASS_NAME_BASE + className).parent());
-// }
-// });
-// jQuery("#" + escapedId + "\\:" + classNameOfReorderingColumn + "\\:f").insertBefore("#" + escapedId + "\\:" + className + "\\:f");
-// bodyElement.style.display = "";
};
var cancelReorder = function(event) {
14 years, 9 months
JBoss Rich Faces SVN: r16637 - in root/ui-sandbox/trunk/components/tables/ui/src: main/java/org/richfaces/renderkit and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-03-19 13:31:27 -0400 (Fri, 19 Mar 2010)
New Revision: 16637
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java
Log:
RF-7865 change superclass of ExtendedDataTableRenderer
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-03-19 14:50:31 UTC (rev 16636)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-03-19 17:31:27 UTC (rev 16637)
@@ -69,6 +69,16 @@
return getFacet("footer");
}
+ public boolean isColumnFacetPresent(String facetName) {
+ Iterator<UIComponent> columns = columns();
+ boolean result = false;
+ while (columns.hasNext() && !result) {
+ UIComponent component = columns.next();
+ result = (component.isRendered() && null != component.getFacet(facetName));
+ }
+ return result;
+ }
+
@Override
public boolean getRendersChildren() {
return true;
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2010-03-19 14:50:31 UTC (rev 16636)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2010-03-19 17:31:27 UTC (rev 16637)
@@ -28,17 +28,6 @@
public static final String SORTING = "sorting";
- public boolean isColumnFacetPresent(UIDataTableBase table, String facetName) {
- Iterator<UIComponent> columns = table.columns();
- boolean result = false;
- while (columns.hasNext() && !result) {
- UIComponent component = columns.next();
- //TODO nick - only rendered facets should be handled
- result = (component.isRendered() && null != component.getFacet(facetName));
- }
- return result;
- }
-
/**
* Returns true if specified attribute (when present on the column) should generate header even if it is not
* specified on the table
@@ -61,7 +50,7 @@
}
protected boolean isEncodeHeaders(UIDataTableBase table) {
- return isColumnFacetPresent(table, "header") || isHeaderFactoryColumnAttributePresent(table, "sortBy")
+ return table.isColumnFacetPresent("header") || isHeaderFactoryColumnAttributePresent(table, "sortBy")
|| isHeaderFactoryColumnAttributePresent(table, "comparator")
|| isHeaderFactoryColumnAttributePresent(table, "filterBy");
}
@@ -211,7 +200,7 @@
public void encodeFooterFacet(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException {
UIComponent footer = dataTable.getFooter();
- boolean columnFacetPresent = isColumnFacetPresent(dataTable, "footer");
+ boolean columnFacetPresent = dataTable.isColumnFacetPresent("footer");
if ((footer != null && footer.isRendered()) || columnFacetPresent) {
boolean encodeTfoot = containsThead();
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-03-19 14:50:31 UTC (rev 16636)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-03-19 17:31:27 UTC (rev 16637)
@@ -42,23 +42,23 @@
import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.renderkit.AjaxEventOptions;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.UIDataTableBase;
+import org.richfaces.component.UIExtendedDataTable;
import org.richfaces.component.util.HtmlUtil;
@ResourceDependencies({ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(name = "jquery.js"), @ResourceDependency(name = "jquery.position.js"),
@ResourceDependency(name = "richfaces.js"), @ResourceDependency(name = "extendedDataTable.js"),
@ResourceDependency(name = "extendedDataTable.css") })
-public class ExtendedDataTableRenderer extends AbstractTableRenderer {
+public class ExtendedDataTableRenderer extends AbstractRowsRenderer{
private class RendererState extends RowHolderBase {
- private UIDataTableBase table;
+ private UIExtendedDataTable table;
private List<UIComponent> frozenColumns;
private List<UIComponent> columns;
private boolean frozen;
- public RendererState(FacesContext context, UIDataTableBase table) {
+ public RendererState(FacesContext context, UIExtendedDataTable table) {
super(context);
this.table = table;
columns = new ArrayList<UIComponent>();
@@ -81,21 +81,12 @@
for (; iterator.hasNext();) {
columns.add(iterator.next());
}
- int count = getFrozenColumnsCount();
+ int count = Math.min(((Integer) table.getAttributes().get("frozenColumns")).intValue(), columns.size());
frozenColumns = columns.subList(0, count);
columns = columns.subList(count, columns.size());
}
- private int getFrozenColumnsCount() {
- int count = ((Integer) table.getAttributes().get("frozenColumns")).intValue();
- int columnsCount = getColumnsCount(table);
- if (count > columnsCount) {
- count = columnsCount;
- }
- return count;
- }
-
- public UIDataTableBase getRow() {
+ public UIExtendedDataTable getRow() {
return table;
}
@@ -118,7 +109,7 @@
@Override
protected Class<? extends UIComponent> getComponentClass() {
- return UIDataTableBase.class;
+ return UIExtendedDataTable.class;
}
@Override
@@ -137,14 +128,20 @@
}
}
+
@Override
+ public RendererState createRowHolder(FacesContext context, UIComponent component) {
+ return new RendererState(context, (UIExtendedDataTable) component);
+ }
+
+ @Override
protected void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component)
throws IOException {
- UIDataTableBase table = (UIDataTableBase) component;
+ UIExtendedDataTable table = (UIExtendedDataTable) component;
Object key = table.getRowKey();
table.captureOrigValue(context);
table.setRowKey(context, null);
- RendererState state = new RendererState(context, table);
+ RendererState state = createRowHolder(context, table);
encodeStyle(state);
encodeHeaderOrFooter(state, "header");
encodeBody(state);
@@ -215,7 +212,7 @@
private void encodeStyle(RendererState state) throws IOException {
FacesContext context = state.getContext();
ResponseWriter writer = context.getResponseWriter();
- UIDataTableBase table = state.getRow();
+ UIExtendedDataTable table = state.getRow();
writer.startElement("style", table);
writer.writeAttribute(HTML.TYPE_ATTR, "text/css", null);
writer.writeText(".rich-extable-part-width{", null); // TODO getNormalizedId(context, state.getGrid())
@@ -241,8 +238,8 @@
private void encodeHeaderOrFooter(RendererState state, String name) throws IOException {
FacesContext context = state.getContext();
ResponseWriter writer = context.getResponseWriter();
- UIDataTableBase table = state.getRow();
- if (isColumnFacetPresent(table, name)) {
+ UIExtendedDataTable table = state.getRow();
+ if (table.isColumnFacetPresent(name)) {
writer.startElement(HTML.DIV_ELEM, table);
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, HtmlUtil.concatClasses("rich-extable-" + name, (String) table
.getAttributes().get(name + "Class")), null);
@@ -295,7 +292,7 @@
private void encodeBody(RendererState state) throws IOException {
FacesContext context = state.getContext();
ResponseWriter writer = context.getResponseWriter();
- UIDataTableBase table = state.getRow();
+ UIExtendedDataTable table = state.getRow();
writer.startElement(HTML.DIV_ELEM, table);
writer.writeAttribute(HTML.ID_ATTRIBUTE, table.getClientId(context) + ":b", null);
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-body", null);
@@ -311,9 +308,6 @@
}
} else {
writer.startElement(HTML.DIV_ELEM, table);
- // writer.startElement(HTML.DIV_ELEM, table); TODO
- // writer.write(" ");
- // writer.endElement(HTML.DIV_ELEM);
writer.startElement(HTML.TABLE_ELEMENT, table);
writer.writeAttribute(HTML.CELLPADDING_ATTRIBUTE, "0", null);
writer.writeAttribute(HTML.CELLSPACING_ATTRIBUTE, "0", null);
@@ -383,7 +377,7 @@
FacesContext context = rowHolder.getContext();
ResponseWriter writer = context.getResponseWriter();
RendererState state = (RendererState) rowHolder;
- UIDataTableBase table = state.getRow();
+ UIExtendedDataTable table = state.getRow();
writer.startElement(HTML.TR_ELEMENT, table);
Iterator<UIComponent> columns = null;
if (state.isFrozen()) {
@@ -453,131 +447,4 @@
}
return width;
}
-
-
-
- @Override
- public void encodeTableStructure(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable)
- throws IOException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public RowHolder createRowHolder(FacesContext context, UIComponent component) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean containsThead() {
- return false;
- }
-
- @Override
- public HeaderEncodeStrategy getHeaderEncodeStrategy(UIComponent column, String tableFacetName) {
- return null;
- }
-
- @Override
- public void encodeClientScript(ResponseWriter writer, FacesContext context, UIDataTableBase component) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public String getCellSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getColumnFooterCellSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getColumnFooterFirstSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getColumnFooterSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getColumnHeaderCellSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getColumnHeaderFirstSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getColumnHeaderSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getFirstRowSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getFooterCellSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getFooterFirstSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getFooterSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getHeaderCellSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getHeaderFirstSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getHeaderSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getRowSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getTableSkinClass() {
- // TODO Auto-generated method stub
- return null;
- }
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java 2010-03-19 14:50:31 UTC (rev 16636)
+++ root/ui-sandbox/trunk/components/tables/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java 2010-03-19 17:31:27 UTC (rev 16637)
@@ -255,4 +255,22 @@
table.setSortMode(SortMode.multi);
Assert.assertEquals(SortMode.multi, table.getSortMode());
}
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#isColumnFacetPresent(java.lang.String)}.
+ */
+ @Test
+ public void testIsColumnFacetPresent() {
+ String facetName = "header";
+ Assert.assertFalse(table.isColumnFacetPresent(facetName));
+ UIColumn child = new UIColumn();
+ List<UIComponent> children = table.getChildren();
+ children.add(new UIColumn());
+ children.add(child);
+ Assert.assertFalse(table.isColumnFacetPresent(facetName));
+ child.getFacets().put(facetName, new UIOutput());
+ Assert.assertTrue(table.isColumnFacetPresent(facetName));
+ child.setRendered(false);
+ Assert.assertFalse(table.isColumnFacetPresent(facetName));
+ }
}
14 years, 9 months
JBoss Rich Faces SVN: r16636 - in root/cdk/trunk/plugins/generator/src: main/java/org/richfaces/cdk/model/validator and 10 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-19 10:50:31 -0400 (Fri, 19 Mar 2010)
New Revision: 16636
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/AttributeModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EmptyVisitor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Visitor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.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/RendererClassVisitor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/TemplateVisitorFactory.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/VisitorFactoryImpl.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FragmentParser.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AdapterBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AttributeAdapter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AttributeBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorAdapter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java
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/ComponentBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterAdapter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyAdapter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorAdapter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/ComponentAdapterTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/TaglibGeneratorVisitorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyValidator.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml
Log:
RF-8232 Tags support
fix core-ui build
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/AttributeModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/AttributeModel.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/AttributeModel.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -30,7 +30,6 @@
* @author asmirnov(a)exadel.com
*
*/
-@SuppressWarnings("serial")
-public class AttributeModel extends Property {
+public class AttributeModel extends PropertyBase {
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -33,7 +33,7 @@
*/
public class BeanModelBase extends DescriptionGroupBase {
- private final ModelCollection<Property> attributes = ModelCollection.<Property>create();
+ private final ModelCollection<PropertyBase> attributes = ModelCollection.<PropertyBase>create();
/**
* <p class="changed_added_4_0">
@@ -42,7 +42,7 @@
*
* @return the attributes
*/
- public Collection<Property> getAttributes() {
+ public Collection<PropertyBase> getAttributes() {
return attributes;
}
@@ -51,13 +51,13 @@
* @param name
* @return
*/
- public Property getAttribute(final String name) {
+ public PropertyBase getAttribute(final String name) {
// OPTIMIZATION keep HashMap for name-property pair for fast lookup.
return attributes.find(new Named.NamedPredicate(name));
}
- public Property getOrCreateAttribute(String attributeName) {
- Property attribute = getAttribute(attributeName);
+ public PropertyBase getOrCreateAttribute(String attributeName) {
+ PropertyBase attribute = getAttribute(attributeName);
if (null == attribute) {
attribute = new Property();
attribute.setName(attributeName);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EmptyVisitor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EmptyVisitor.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/EmptyVisitor.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -61,7 +61,7 @@
// Do nothing.
}
- public void visitProperty(Property model) {
+ public void visitProperty(PropertyBase model) {
// Do nothing.
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -23,292 +23,11 @@
package org.richfaces.cdk.model;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import org.richfaces.cdk.util.ComparatorUtils;
-
-import java.util.List;
-import java.util.Set;
-
/**
* That class represents JSF component property.
* @author asmirnov(a)exadel.com
*
*/
-public class Property extends DescriptionGroupBase implements ModelElement<Property> , Named {
+public class Property extends PropertyBase {
- private static final long serialVersionUID = 3483864006602184580L;
-
- /**
- * <p class="changed_added_4_0">The name of bean property</p>
- */
- private String name;
-
- private boolean hidden = false;
- private boolean literal = false;
- private boolean required = false;
- private boolean readOnly = false;
- private boolean passThrough = false;
-
- private Set<EventName> eventNames = Sets.newLinkedHashSet();
- private List<ClassName> signature = Lists.newArrayList();
- private Set<String> aliases = Sets.newHashSet();
- private String defaultValue;
-
- private String suggestedValue;
-
- private ClassName type;
-
- private boolean bindingAttribute;
-
- private boolean binding;
-
- /**
- * <p class="changed_added_4_0"></p>
- */
- public Property() {
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the name
- */
- public String getName() {
- return this.name;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the type
- */
- @Merge
- public ClassName getType() {
- return type;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param type the type to set
- */
- public void setType(ClassName type) {
- this.type = type;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the defaultValue
- */
- @Merge
- public String getDefaultValue() {
- return defaultValue;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param dafaultValue - the defaultValue to set
- */
- public void setDefaultValue(String dafaultValue) {
- this.defaultValue = dafaultValue;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the suggestedValue
- */
- @Merge
- public String getSuggestedValue() {
- return suggestedValue;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param suggestedValue the suggestedValue to set
- */
- public void setSuggestedValue(String suggestedValue) {
- this.suggestedValue = suggestedValue;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the eventNames
- */
- @Merge
- public Set<EventName> getEventNames() {
- return eventNames;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param eventNames the eventNames to set
- */
- public void setEventNames(Set<EventName> eventNames) {
- this.eventNames = eventNames;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the hidden
- */
- public boolean isHidden() {
- return hidden;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param hidden the hidden to set
- */
- public void setHidden(boolean hidden) {
- this.hidden = hidden;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the literal
- */
- public boolean isLiteral() {
- return literal;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param literal the literal to set
- */
- public void setLiteral(boolean literal) {
- this.literal = literal;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the required
- */
- public boolean isRequired() {
- return required;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param required the required to set
- */
- public void setRequired(boolean required) {
- this.required = required;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param readOnly the readOnly to set
- */
- public void setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the readOnly
- */
- public boolean isReadOnly() {
- return readOnly;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the passThrough
- */
- public boolean isPassThrough() {
- return passThrough;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param passThrough the passThrough to set
- */
- public void setPassThrough(boolean passThrough) {
- this.passThrough = passThrough;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the signature
- */
- @Merge(true)
- public List<ClassName> getSignature() {
- return signature;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param signature the signature to set
- */
- public void setSignature(List<ClassName> signature) {
- this.signature = signature;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the aliases
- */
- public Set<String> getAliases() {
- return aliases;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param aliases the aliases to set
- */
- public void setAliases(Set<String> aliases) {
- this.aliases = aliases;
- }
-
- public boolean isPrimitive() {
- return getType().isPrimitive();
- }
-
- @Override
- public void merge(Property other) {
- boolean generate = isGenerate();
- ComponentLibrary.merge(this, other);
- setGenerate(generate || other.isGenerate());
- }
-
- public void accept(Visitor visitor) {
- visitor.visitProperty(this);
- }
-
- @Override
- public boolean same(Property other) {
- return ComparatorUtils.nullSafeEquals(this.getName(), other.getName());
- }
-
- public boolean isBindingAttribute() {
- return this.bindingAttribute;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param bindingAttribute the bindingAttribute to set
- */
- public void setBindingAttribute(boolean bindingAttribute) {
- this.bindingAttribute = bindingAttribute;
- }
-
- public boolean isBinding() {
- return this.binding;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param binding the binding to set
- */
- public void setBinding(boolean binding) {
- this.binding = binding;
- }
-
-
}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -0,0 +1,338 @@
+/*
+ * 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.model;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import org.richfaces.cdk.util.ComparatorUtils;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author akolonitsky
+ * @since Mar 19, 2010
+ */
+public abstract class PropertyBase extends DescriptionGroupBase implements ModelElement<PropertyBase>, Named {
+
+ private static final long serialVersionUID = 3483864006602184580L;
+
+ /**
+ * <p class="changed_added_4_0">The name of bean property</p>
+ */
+ private String name;
+
+ private boolean hidden = false;
+ private boolean literal = false;
+ private boolean required = false;
+ private boolean readOnly = false;
+ private boolean passThrough = false;
+
+ private Set<EventName> eventNames = Sets.newLinkedHashSet();
+ private List<ClassName> signature = Lists.newArrayList();
+ private Set<String> aliases = Sets.newHashSet();
+ private String defaultValue;
+
+ private String suggestedValue;
+
+ private ClassName type;
+
+ private boolean bindingAttribute;
+
+ private boolean binding;
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ */
+ public PropertyBase() {
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the name
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the type
+ */
+ @Merge
+ public ClassName getType() {
+ return type;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param type the type to set
+ */
+ public void setType(ClassName type) {
+ this.type = type;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the defaultValue
+ */
+ @Merge
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param dafaultValue - the defaultValue to set
+ */
+ public void setDefaultValue(String dafaultValue) {
+ this.defaultValue = dafaultValue;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the suggestedValue
+ */
+ @Merge
+ public String getSuggestedValue() {
+ return suggestedValue;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param suggestedValue the suggestedValue to set
+ */
+ public void setSuggestedValue(String suggestedValue) {
+ this.suggestedValue = suggestedValue;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the eventNames
+ */
+ @Merge
+ public Set<EventName> getEventNames() {
+ return eventNames;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param eventNames the eventNames to set
+ */
+ public void setEventNames(Set<EventName> eventNames) {
+ this.eventNames = eventNames;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the hidden
+ */
+ public boolean isHidden() {
+ return hidden;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param hidden the hidden to set
+ */
+ public void setHidden(boolean hidden) {
+ this.hidden = hidden;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the literal
+ */
+ public boolean isLiteral() {
+ return literal;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param literal the literal to set
+ */
+ public void setLiteral(boolean literal) {
+ this.literal = literal;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the required
+ */
+ public boolean isRequired() {
+ return required;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param required the required to set
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param readOnly the readOnly to set
+ */
+ public void setReadOnly(boolean readOnly) {
+ this.readOnly = readOnly;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the readOnly
+ */
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the passThrough
+ */
+ public boolean isPassThrough() {
+ return passThrough;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param passThrough the passThrough to set
+ */
+ public void setPassThrough(boolean passThrough) {
+ this.passThrough = passThrough;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the signature
+ */
+ @Merge(true)
+ public List<ClassName> getSignature() {
+ return signature;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param signature the signature to set
+ */
+ public void setSignature(List<ClassName> signature) {
+ this.signature = signature;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the aliases
+ */
+ public Set<String> getAliases() {
+ return aliases;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param aliases the aliases to set
+ */
+ public void setAliases(Set<String> aliases) {
+ this.aliases = aliases;
+ }
+
+ public boolean isPrimitive() {
+ return getType().isPrimitive();
+ }
+
+ @Override
+ public void merge(PropertyBase other) {
+ boolean generate = isGenerate();
+ ComponentLibrary.merge(this, other);
+ setGenerate(generate || other.isGenerate());
+ }
+
+ public void accept(Visitor visitor) {
+ visitor.visitProperty(this);
+ }
+
+ @Override
+ public boolean same(PropertyBase other) {
+ return ComparatorUtils.nullSafeEquals(this.getName(), other.getName());
+ }
+
+ public boolean isBindingAttribute() {
+ return this.bindingAttribute;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param bindingAttribute the bindingAttribute to set
+ */
+ public void setBindingAttribute(boolean bindingAttribute) {
+ this.bindingAttribute = bindingAttribute;
+ }
+
+ public boolean isBinding() {
+ return this.binding;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param binding the binding to set
+ */
+ public void setBinding(boolean binding) {
+ this.binding = binding;
+ }
+
+
+}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -25,10 +25,10 @@
package org.richfaces.cdk.model;
+import org.richfaces.cdk.annotations.TagType;
+
import java.io.Serializable;
-import org.richfaces.cdk.annotations.TagType;
-
/**
* <p class="changed_added_4_0">That bean represents VDL tag</p>
* @author asmirnov(a)exadel.com
@@ -40,7 +40,7 @@
/**
* <p class="changed_added_4_0">Component that the tag creates. This in bidirectional one to one relation.</p>
- * TODO - tag should also works with {@code Validator}, {@code Converter}, {@code Behavior}, {@code FacesListener}
+ * TODO - tag should also works with {@code FacesListener}
*/
private ModelElementBase model;
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Visitor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Visitor.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Visitor.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -43,7 +43,7 @@
void visitBehaviorRenderer(BehaviorRenderer model);
- void visitProperty(Property model);
+ void visitProperty(PropertyBase model);
void visitRenderKit(RenderKitModel model);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -35,7 +35,7 @@
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.DescriptionGroup;
import org.richfaces.cdk.model.FacetModel;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.RenderKitModel;
import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.util.Strings;
@@ -139,7 +139,7 @@
}
// TODO Propagate attributes from parent component.
// Check attributes.
- for (Property attribute : component.getAttributes()) {
+ for (PropertyBase attribute : component.getAttributes()) {
verifyAttribute(attribute, component.isGenerate());
}
// compact(component.getAttributes());
@@ -151,7 +151,7 @@
}
}
- protected void verifyAttribute(Property attribute, boolean generatedComponent) {
+ protected void verifyAttribute(PropertyBase attribute, boolean generatedComponent) {
// Check name.
if (Strings.isEmpty(attribute.getName())) {
log.error("No name for attribute " + attribute);
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-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -105,7 +105,7 @@
for (RendererModel renderer : renderKit.getRenderers()) {
Template template = renderer.getTemplate();
if (null != template) {
- Collection<Property> attributes = ModelCollection.<Property>create();
+ Collection<PropertyBase> attributes = ModelCollection.<PropertyBase>create();
ComponentModel component = findComponentByRenderer(renderer);
if (component != null) {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -27,7 +27,13 @@
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
-import org.richfaces.builder.model.*;
+import org.richfaces.builder.model.Argument;
+import org.richfaces.builder.model.JavaClass;
+import org.richfaces.builder.model.JavaField;
+import org.richfaces.builder.model.JavaMethod;
+import org.richfaces.builder.model.JavaModifier;
+import org.richfaces.builder.model.MethodBody;
+import org.richfaces.builder.model.MethodBodyStatementsContainer;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.Logger;
import org.richfaces.cdk.attributes.Attribute;
@@ -35,11 +41,27 @@
import org.richfaces.cdk.attributes.Schema;
import org.richfaces.cdk.attributes.SchemaSet;
import org.richfaces.cdk.model.EventName;
-import org.richfaces.cdk.model.Property;
-import org.richfaces.cdk.parser.el.*;
+import org.richfaces.cdk.model.PropertyBase;
+import org.richfaces.cdk.parser.el.ELParserUtils;
+import org.richfaces.cdk.parser.el.ELVisitor;
+import org.richfaces.cdk.parser.el.HelperMethod;
+import org.richfaces.cdk.parser.el.ParsingException;
+import org.richfaces.cdk.parser.el.Type;
import org.richfaces.cdk.parser.el.types.TypesFactory;
import static org.richfaces.cdk.templatecompiler.QNameComparator.QNAME_COMPARATOR;
-import org.richfaces.cdk.templatecompiler.model.*;
+import org.richfaces.cdk.templatecompiler.model.AnyElement;
+import org.richfaces.cdk.templatecompiler.model.CdkBodyElement;
+import org.richfaces.cdk.templatecompiler.model.CdkCallElement;
+import org.richfaces.cdk.templatecompiler.model.CdkChooseElement;
+import org.richfaces.cdk.templatecompiler.model.CdkForEachElement;
+import org.richfaces.cdk.templatecompiler.model.CdkIfElement;
+import org.richfaces.cdk.templatecompiler.model.CdkObjectElement;
+import org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement;
+import org.richfaces.cdk.templatecompiler.model.CdkWhenElement;
+import org.richfaces.cdk.templatecompiler.model.CompositeImplementation;
+import org.richfaces.cdk.templatecompiler.model.CompositeInterface;
+import org.richfaces.cdk.templatecompiler.model.Template;
+import org.richfaces.cdk.templatecompiler.model.TemplateVisitor;
import static org.richfaces.cdk.util.JavaUtils.getEscapedString;
import static org.richfaces.cdk.util.JavaUtils.getEscapedStringsArray;
import org.richfaces.cdk.util.Strings;
@@ -51,7 +73,16 @@
import javax.faces.render.Renderer;
import javax.xml.namespace.QName;
import java.io.IOException;
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
/**
* <p class="changed_added_4_0">
@@ -126,9 +157,9 @@
private Type lastCompiledExpressionType;
private int passThroughCounter;
- private Collection<Property> attributes;
+ private Collection<PropertyBase> attributes;
- public RendererClassVisitor(CompositeInterface compositeInterface, Collection<Property> attributes,
+ public RendererClassVisitor(CompositeInterface compositeInterface, Collection<PropertyBase> attributes,
ClassLoader classLoader, JAXB jaxbBinding, Logger log) {
this.compositeInterface = compositeInterface;
this.attributes = attributes;
@@ -261,7 +292,7 @@
}
// OPTIMIZATION - use ModelCollection with lookup method
- for (Property property : attributes) {
+ for (PropertyBase property : attributes) {
if (attributeName.equals(property.getName())) {
Set<EventName> eventNames = property.getEventNames();
if (eventNames != null && !eventNames.isEmpty()) {
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-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -30,14 +30,15 @@
import org.richfaces.cdk.FileManager;
import org.richfaces.cdk.Logger;
import org.richfaces.cdk.ModelBuilder;
+import org.richfaces.cdk.NamingConventions;
+import org.richfaces.cdk.RichFacesConventions;
import org.richfaces.cdk.Source;
import org.richfaces.cdk.Sources;
-import org.richfaces.cdk.NamingConventions;
-import org.richfaces.cdk.RichFacesConventions;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.EventName;
import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.RenderKitModel;
import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.templatecompiler.model.Attribute;
@@ -195,13 +196,13 @@
renderer.setRendersChildren(rendersChildren);
}
- Collection<Property> rendererAttributes = renderer.getAttributes();
+ Collection<PropertyBase> rendererAttributes = renderer.getAttributes();
List<ImportAttributes> attributesImports = compositeInterface.getAttributesImports();
if (attributesImports != null) {
for (ImportAttributes attributesImport : attributesImports) {
String importURI = attributesImport.getSource();
- Collection<Property> properties = fragmentParser.parseProperties(importURI);
+ Collection<PropertyBase> properties = fragmentParser.parseProperties(importURI);
if (properties != null) {
rendererAttributes.addAll(properties);
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/TemplateVisitorFactory.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/TemplateVisitorFactory.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/TemplateVisitorFactory.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -23,7 +23,7 @@
package org.richfaces.cdk.templatecompiler;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.templatecompiler.model.CompositeInterface;
import org.richfaces.cdk.templatecompiler.model.TemplateVisitor;
@@ -36,6 +36,6 @@
*/
public interface TemplateVisitorFactory <T extends TemplateVisitor> {
- public T createVisitor(CompositeInterface composite, Collection<Property> attributes);
+ public T createVisitor(CompositeInterface composite, Collection<PropertyBase> attributes);
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/VisitorFactoryImpl.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/VisitorFactoryImpl.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/VisitorFactoryImpl.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -23,15 +23,14 @@
package org.richfaces.cdk.templatecompiler;
-import java.util.Collection;
-
+import com.google.inject.Inject;
import org.richfaces.cdk.CdkClassLoader;
import org.richfaces.cdk.Logger;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.templatecompiler.model.CompositeInterface;
import org.richfaces.cdk.xmlconfig.JAXB;
-import com.google.inject.Inject;
+import java.util.Collection;
/**
* <p class="changed_added_4_0"></p>
@@ -61,7 +60,7 @@
* @see org.richfaces.cdk.templatecompiler.TemplateVisitorFactory#createVisitor(org.richfaces.cdk.templatecompiler.model.CompositeInterface)
*/
@Override
- public RendererClassVisitor createVisitor(CompositeInterface composite,Collection<Property> attributes) {
+ public RendererClassVisitor createVisitor(CompositeInterface composite,Collection<PropertyBase> attributes) {
return new RendererClassVisitor(composite, attributes,classLoader, jaxbBinding, log);
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FragmentParser.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FragmentParser.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FragmentParser.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -27,7 +27,7 @@
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.xmlconfig.model.ComponentAdapter;
import org.richfaces.cdk.xmlconfig.model.Fragment;
@@ -61,7 +61,7 @@
* @param url
* @return
*/
- public Collection<Property> parseProperties(String url) throws CdkException {
+ public Collection<PropertyBase> parseProperties(String url) throws CdkException {
String schemaLocation = ComponentLibrary.FACES_CONFIG_SCHEMA_LOCATION;
Class<Fragment> bindClass = Fragment.class;
Fragment unmarshal = binding.unmarshal(url, schemaLocation, bindClass);
@@ -69,7 +69,7 @@
ComponentModel component = adapter.unmarshal(unmarshal);
return component.getAttributes();
} else {
- return Collections.<Property> emptySet();
+ return Collections.<PropertyBase> emptySet();
}
}
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AdapterBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AdapterBase.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AdapterBase.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -23,20 +23,18 @@
package org.richfaces.cdk.xmlconfig.model;
-import java.lang.reflect.Method;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.model.ConfigExtension;
import org.richfaces.cdk.model.Extensible;
import org.richfaces.cdk.model.ModelElement;
import org.richfaces.cdk.util.JavaUtils;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
/**
* <p class="changed_added_4_0"></p>
@@ -47,7 +45,12 @@
@Override
public Bean marshal(Model model) throws CdkException {
- Bean bean = createBean(getBeanClass(model), model);
+ Bean bean = null;
+ try {
+ bean = createBean(getBeanClass(model), model);
+ } catch (ClassCastException e) {
+ e.printStackTrace();
+ }
postMarshal(model, bean);
return bean;
}
@@ -68,15 +71,15 @@
*/
public Bean createBean(Class<? extends Bean> beanClass, Model model) throws CdkException {
try {
- Bean adapter = beanClass.newInstance();
+ Bean bean = beanClass.newInstance();
- // Copy properties from model to adapter.
- JavaUtils.copyProperties(model, adapter);
- if (model instanceof Extensible && adapter instanceof Extensible) {
- copyExtensions((Extensible) model, (Extensible) adapter, true);
+ // Copy properties from model to bean.
+ JavaUtils.copyProperties(model, bean);
+ if (model instanceof Extensible && bean instanceof Extensible) {
+ copyExtensions((Extensible) model, (Extensible) bean, true);
}
- return adapter;
+ return bean;
} catch (InstantiationException e) {
throw new CdkException("JAXB adapter class instantiation error", e);
} catch (IllegalAccessException e) {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AttributeAdapter.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AttributeAdapter.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AttributeAdapter.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -30,7 +30,7 @@
* @author asmirnov(a)exadel.com
*
*/
-public class AttributeAdapter extends AdapterBase<AttributeBean , AttributeModel> {
+public class AttributeAdapter extends AdapterBase<AttributeBean, AttributeModel> {
@Override
protected Class<? extends AttributeBean> getBeanClass(AttributeModel prop) {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AttributeBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AttributeBean.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AttributeBean.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -23,13 +23,13 @@
package org.richfaces.cdk.xmlconfig.model;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.ComponentLibrary;
+
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.richfaces.cdk.model.ClassName;
-import org.richfaces.cdk.model.ComponentLibrary;
-
/**
* <p class="changed_added_4_0"></p>
*
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorAdapter.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorAdapter.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorAdapter.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -28,8 +28,8 @@
* @author akolonitsky
* @since Jan 21, 2010
*/
-public class BehaviorAdapter extends AdapterBase<BehaviorBean, BehaviorModel> {
-
+public class BehaviorAdapter extends ElementAdapterBase<BehaviorBean, BehaviorModel> {
+
@Override
protected Class<? extends BehaviorBean> getBeanClass(BehaviorModel model) {
return BehaviorBean.class;
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -22,33 +22,28 @@
package org.richfaces.cdk.xmlconfig.model;
-import java.util.List;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.FacesId;
+import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.AttributeModel;
import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.List;
-import org.richfaces.cdk.model.ClassName;
-import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.model.FacesId;
-
-import com.google.common.collect.Lists;
-
/**
* @author akolonitsky
* @since Jan 21, 2010
*/
@XmlType(name = "faces-config-behaviorType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
- propOrder={"id", "targetClass", "attributes", "extension"})
+ propOrder={"id", "targetClass", "attributes", "properties", "extension"})
@XmlJavaTypeAdapter(BehaviorAdapter.class)
-public class BehaviorBean extends ExtensibleBean<BehaviorBean.BehaviorExtension> {
+public class BehaviorBean extends ElementBeanBase<BehaviorBean.BehaviorExtension> {
-
private ClassName targetClass;
- private List<PropertyBase> attributes = Lists.newArrayList();
-
private FacesId id;
@XmlElement(name = "behavior-id", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
@@ -60,6 +55,20 @@
this.id = id;
}
+ @Override
+ @XmlElement(name = "property", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = PropertyBean.class)
+ @XmlJavaTypeAdapter(PropertyAdapter.class)
+ public List<Property> getProperties() {
+ return super.getProperties();
+ }
+
+ @Override
+ @XmlElement(name = "attribute", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = AttributeBean.class)
+ @XmlJavaTypeAdapter(AttributeAdapter.class)
+ public List<AttributeModel> getAttributes() {
+ return super.getAttributes();
+ }
+
@XmlElement(name = "behavior-class", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
public ClassName getTargetClass() {
return targetClass;
@@ -69,19 +78,6 @@
this.targetClass = behaviorClass;
}
-
- @XmlElements({
- @XmlElement(name = "property", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = PropertyBean.class),
- @XmlElement(name = "attribute", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = AttributeBean.class)
- })
- public List<PropertyBase> getAttributes() {
- return attributes;
- }
-
- public void setAttributes(List<PropertyBase> property) {
- this.attributes = property;
- }
-
@Override
@XmlElement(name = "behavior-extension", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
public BehaviorExtension getExtension() {
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-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentAdapter.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -24,18 +24,18 @@
package org.richfaces.cdk.xmlconfig.model;
-import java.util.Collection;
-
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.RendererModel;
+import java.util.Collection;
+
/**
* <p class="changed_added_4_0"></p>
*
* @author asmirnov(a)exadel.com
*/
-public class ComponentAdapter extends AdapterBase<ComponentBean, ComponentModel> {
+public class ComponentAdapter extends ElementAdapterBase<ComponentBean, ComponentModel> {
private static final AttributeAdapter ATTRIBUTE_ADAPTER = new AttributeAdapter();
@@ -54,7 +54,9 @@
@Override
protected void postUnmarshal(ComponentBean bean, ComponentModel model) {
+ super.postUnmarshal(bean, model);
// Copy properties/attributes
+
Collection<RendererModel> renderers = model.getRenderers();
ComponentBean.ComponentExtension extension = bean.getExtension();
if (renderers != null && extension != null) {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -23,21 +23,19 @@
package org.richfaces.cdk.xmlconfig.model;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElements;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
+import com.google.common.collect.Lists;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.EventModel;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.FacetModel;
import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.AttributeModel;
-import com.google.common.collect.Lists;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.List;
/**
* <p class="changed_added_4_0"></p>
@@ -45,12 +43,10 @@
* @author asmirnov(a)exadel.com
*/
@XmlType(name = "faces-config-componentType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
- propOrder={"type", "targetClass", "facets",
- "attributes", "extension"})
+ propOrder={"type", "targetClass", "facets", "attributes", "properties", "extension"})
@XmlJavaTypeAdapter(ComponentAdapter.class)
-public class ComponentBean extends ExtensibleBean<ComponentBean.ComponentExtension> {
+public class ComponentBean extends ElementBeanBase<ComponentBean.ComponentExtension> {
- private List<Property> attributes = Lists.newArrayList();
private List<FacetModel> facets = Lists.newArrayList();
private ClassName targetClass;
private FacesId type;
@@ -74,6 +70,20 @@
this.type = type;
}
+ @Override
+ @XmlElement(name = "property", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = PropertyBean.class)
+ @XmlJavaTypeAdapter(PropertyAdapter.class)
+ public List<Property> getProperties() {
+ return super.getProperties();
+ }
+
+ @Override
+ @XmlElement(name = "attribute", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = AttributeBean.class)
+ @XmlJavaTypeAdapter(AttributeAdapter.class)
+ public List<AttributeModel> getAttributes() {
+ return super.getAttributes();
+ }
+
/**
* <p class="changed_added_4_0"></p>
*
@@ -97,35 +107,6 @@
/**
* <p class="changed_added_4_0"></p>
*
- * @return the attributes
- */
- @XmlElements({@XmlElement(
- name = "property",
- namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
- type = PropertyBean.class
- ), @XmlElement(
- name = "attribute",
- namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
- type = AttributeBean.class
- )})
-
-// @XmlElement(name="attributes",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
- public List<Property> getAttributes() {
- return attributes;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- *
- * @param property the attributes to set
- */
- public void setAttributes(List<Property> property) {
- this.attributes = property;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- *
* @return the facets
*/
@XmlElement(name = "facet", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterAdapter.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterAdapter.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterAdapter.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -27,7 +27,7 @@
* @author akolonitsky
* @since Jan 10, 2010
*/
-public class ConverterAdapter extends AdapterBase<ConverterBean, ConverterModel>{
+public class ConverterAdapter extends ElementAdapterBase<ConverterBean, ConverterModel>{
@Override
protected Class<? extends ConverterBean> getBeanClass(ConverterModel model) {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterBean.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterBean.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -21,36 +21,30 @@
package org.richfaces.cdk.xmlconfig.model;
-import java.util.List;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.FacesId;
+import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.AttributeModel;
import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.List;
-import org.richfaces.cdk.model.ClassName;
-import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.model.FacesId;
-
-import com.google.common.collect.Lists;
-
/**
* @author akolonitsky
* @since Jan 6, 2010
*/
@XmlType(name = "faces-config-converterType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
- propOrder={"id", "converterForClass", "targetClass",
- "attributes", "extension"})
+ propOrder={"id", "converterForClass", "targetClass", "attributes", "properties", "extension"})
@XmlJavaTypeAdapter(ConverterAdapter.class)
-public class ConverterBean extends ExtensibleBean<ConverterBean.ConverterExtension> {
+public class ConverterBean extends ElementBeanBase<ConverterBean.ConverterExtension> {
-
private ClassName converterForClass;
private ClassName targetClass;
- private List<PropertyBase> attributes = Lists.newArrayList();
-
private FacesId id;
@XmlElement(name = "converter-id", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
@@ -62,6 +56,21 @@
this.id = id;
}
+
+ @Override
+ @XmlElement(name = "property", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = PropertyBean.class)
+ @XmlJavaTypeAdapter(PropertyAdapter.class)
+ public List<Property> getProperties() {
+ return super.getProperties();
+ }
+
+ @Override
+ @XmlElement(name = "attribute", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = AttributeBean.class)
+ @XmlJavaTypeAdapter(AttributeAdapter.class)
+ public List<AttributeModel> getAttributes() {
+ return super.getAttributes();
+ }
+
@XmlElement(name = "converter-for-class", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
public ClassName getConverterForClass() {
return converterForClass;
@@ -80,33 +89,6 @@
this.targetClass = converterClass;
}
- /**
- * <p class="changed_added_4_0"></p>
- *
- * @return the attributes
- */
- @XmlElements({@XmlElement(
- name = "property",
- namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
- type = PropertyBean.class
- ), @XmlElement(
- name = "attribute",
- namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
- type = AttributeBean.class
- )})
- public List<PropertyBase> getAttributes() {
- return attributes;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- *
- * @param property the attributes to set
- */
- public void setAttributes(List<PropertyBase> property) {
- this.attributes = property;
- }
-
@Override
public void setExtension(ConverterExtension extension) {
super.setExtension(extension);
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementAdapterBase.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -0,0 +1,47 @@
+/*
+ * 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.xmlconfig.model;
+
+import org.richfaces.cdk.model.BeanModelBase;
+import org.richfaces.cdk.model.AttributeModel;
+
+import java.util.ArrayList;
+
+/**
+ * @author akolonitsky
+ * @since Mar 19, 2010
+ */
+public abstract class ElementAdapterBase<Bean extends ElementBeanBase, Model extends BeanModelBase> extends AdapterBase<Bean, Model> {
+
+ @Override
+ protected void postUnmarshal(Bean bean, Model model) {
+ model.getAttributes().addAll(bean.getAllProperties());
+ }
+
+ @Override
+ protected void postMarshal(Model model, Bean bean) {
+ bean.setAttributes(new ArrayList<AttributeModel>());
+ bean.setAllProperties(new ArrayList<org.richfaces.cdk.model.PropertyBase>(model.getAttributes()));
+ }
+}
+
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ElementBeanBase.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -0,0 +1,77 @@
+/*
+ * 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.xmlconfig.model;
+
+import com.google.common.collect.Lists;
+import org.richfaces.cdk.model.AttributeModel;
+import org.richfaces.cdk.model.ConfigExtension;
+import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author akolonitsky
+ * @since Mar 19, 2010
+ */
+public abstract class ElementBeanBase<E extends ConfigExtension> extends ExtensibleBean<E> {
+
+ private List<Property> properties = Lists.newArrayList();
+
+ private List<AttributeModel> attributes = Lists.newArrayList();
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(List<Property> properties) {
+ this.properties = properties;
+ }
+
+ public List<AttributeModel> getAttributes() {
+ return this.attributes;
+ }
+
+ public void setAttributes(List<AttributeModel> attributes) {
+ this.attributes = attributes;
+ }
+
+ public List<PropertyBase> getAllProperties() {
+ List<PropertyBase> allProperties = new ArrayList<PropertyBase>(attributes.size() + properties.size());
+ allProperties.addAll(attributes);
+ allProperties.addAll(properties);
+ return allProperties;
+ }
+
+ public void setAllProperties(List<PropertyBase> allProperties) {
+ for (PropertyBase propertyBase : allProperties) {
+ if (propertyBase instanceof Property) {
+ properties.add((Property) propertyBase);
+ }
+ if (propertyBase instanceof AttributeModel) {
+ attributes.add((AttributeModel) propertyBase);
+ }
+ }
+ }
+}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyAdapter.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyAdapter.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyAdapter.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -30,7 +30,7 @@
* @author asmirnov(a)exadel.com
*
*/
-public class PropertyAdapter extends AdapterBase<PropertyBean , Property> {
+public class PropertyAdapter extends AdapterBase<PropertyBean, Property> {
@Override
protected Class<? extends PropertyBean> getBeanClass(Property prop) {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBase.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBase.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -23,20 +23,18 @@
package org.richfaces.cdk.xmlconfig.model;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConfigExtension;
import org.richfaces.cdk.model.EventName;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.List;
+import java.util.Set;
/**
* <p class="changed_added_4_0"></p>
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBean.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBean.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -23,13 +23,13 @@
package org.richfaces.cdk.xmlconfig.model;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.ComponentLibrary;
+
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.richfaces.cdk.model.ClassName;
-import org.richfaces.cdk.model.ComponentLibrary;
-
/**
* <p class="changed_added_4_0"></p>
*
@@ -38,7 +38,7 @@
@XmlType(name = "faces-config-propertyType",
namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
propOrder = {"name", "type", "defaultValue", "suggestedValue", "extension"})
-(a)XmlJavaTypeAdapter(AttributeAdapter.class)
+(a)XmlJavaTypeAdapter(PropertyAdapter.class)
public class PropertyBean extends PropertyBase {
/**
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorAdapter.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorAdapter.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorAdapter.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -27,7 +27,7 @@
* @author akolonitsky
* @since Jan 13, 2010
*/
-public class ValidatorAdapter extends AdapterBase<ValidatorBean, ValidatorModel> {
+public class ValidatorAdapter extends ElementAdapterBase<ValidatorBean, ValidatorModel> {
@Override
protected Class<? extends ValidatorBean> getBeanClass(ValidatorModel model) {
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -21,33 +21,29 @@
package org.richfaces.cdk.xmlconfig.model;
-import java.util.List;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.FacesId;
+import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.AttributeModel;
import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.List;
-import org.richfaces.cdk.model.ClassName;
-import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.model.FacesId;
-
-import com.google.common.collect.Lists;
-
/**
* @author akolonitsky
* @since Jan 13, 2010
*/
@XmlType(name = "faces-config-validatorType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
- propOrder={"id", "targetClass", "attributes", "extension"})
+ propOrder={"id", "targetClass", "attributes", "properties", "extension"})
@XmlJavaTypeAdapter(ValidatorAdapter.class)
-public class ValidatorBean extends ExtensibleBean<ValidatorBean.ValidatorExtension> {
+public class ValidatorBean extends ElementBeanBase<ValidatorBean.ValidatorExtension> {
private ClassName targetClass;
- private List<PropertyBase> attributes = Lists.newArrayList();
-
private FacesId id;
@XmlElement(name = "validator-id", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
@@ -59,6 +55,21 @@
this.id = id;
}
+
+ @Override
+ @XmlElement(name = "property", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = PropertyBean.class)
+ @XmlJavaTypeAdapter(PropertyAdapter.class)
+ public List<Property> getProperties() {
+ return super.getProperties();
+ }
+
+ @Override
+ @XmlElement(name = "attribute", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = AttributeBean.class)
+ @XmlJavaTypeAdapter(AttributeAdapter.class)
+ public List<AttributeModel> getAttributes() {
+ return super.getAttributes();
+ }
+
@XmlElement(name = "validator-class", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
public ClassName getTargetClass() {
return targetClass;
@@ -68,19 +79,6 @@
this.targetClass = validatorClass;
}
-
- @XmlElements({
- @XmlElement(name = "property", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = PropertyBean.class),
- @XmlElement(name = "attribute", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = AttributeBean.class)
- })
- public List<PropertyBase> getAttributes() {
- return attributes;
- }
-
- public void setAttributes(List<PropertyBase> property) {
- this.attributes = property;
- }
-
@Override
@XmlElement(name = "validator-extension", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
public ValidatorExtension getExtension() {
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -43,7 +43,7 @@
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.xmlconfig.JAXB;
import javax.lang.model.element.TypeElement;
@@ -160,7 +160,7 @@
assertEquals(1, components.size());
ComponentModel component = Iterables.get(components, 0);
- Collection<Property> attributes = component.getAttributes();
+ Collection<PropertyBase> attributes = component.getAttributes();
assertEquals(3, attributes.size());
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/AbstractClassGeneratorTest.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -38,7 +38,7 @@
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.EventName;
import org.richfaces.cdk.model.ModelElementBase;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import java.io.IOException;
import java.io.InputStream;
@@ -69,8 +69,8 @@
@Output(Outputs.RESOURCES)
protected FileManager output;
- protected static Property addAttribute(ModelElementBase model, String attributeName, Class<?> type, boolean generate) {
- Property attribute = model.getOrCreateAttribute(attributeName);
+ protected static PropertyBase addAttribute(ModelElementBase model, String attributeName, Class<?> type, boolean generate) {
+ PropertyBase attribute = model.getOrCreateAttribute(attributeName);
attribute.setType(new ClassName(type));
attribute.setGenerate(generate);
return attribute;
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/BehaviorClassGeneratorTest.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -36,7 +36,7 @@
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.EventName;
import org.richfaces.cdk.model.FacesId;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import java.io.StringWriter;
import java.util.Set;
@@ -65,7 +65,7 @@
// TODO add test with types boolean, int, Integer, String, Object
addAttribute(behavior, "testValue", Object.class, true);
addAttribute(behavior, "testFlag", Boolean.class, true);
- Property attribute = addAttribute(behavior, "id", String.class, false);
+ PropertyBase attribute = addAttribute(behavior, "id", String.class, false);
Set<EventName> eventNames = attribute.getEventNames();
eventNames.add(getEvent("id", false));
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -36,7 +36,7 @@
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.EventName;
import org.richfaces.cdk.model.FacesId;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import javax.el.MethodExpression;
import javax.faces.component.UIOutput;
@@ -89,7 +89,7 @@
component.setTargetClass(ClassName.parseName("org.richfaces.cdk.generate.java.GeneratedComponent"));
component.setBaseClass(ClassName.parseName(UIOutput.class.getName()));
- Property attribute = component.getOrCreateAttribute("testValue");
+ PropertyBase attribute = component.getOrCreateAttribute("testValue");
attribute.setType(new ClassName(Object.class));
attribute.setGenerate(true);
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ValidatorClassGeneratorTest.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -35,7 +35,7 @@
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.EventName;
import org.richfaces.cdk.model.FacesId;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.ValidatorModel;
import java.io.StringWriter;
@@ -65,7 +65,7 @@
addAttribute(validator, "testValue", Object.class, true);
// TODO test with primitiv type 'boolean'
addAttribute(validator, "testFlag", Boolean.class, true);
- Property attribute = addAttribute(validator, "id", String.class, false);
+ PropertyBase attribute = addAttribute(validator, "id", String.class, false);
Set<EventName> eventNames = attribute.getEventNames();
eventNames.add(getEvent("id", false));
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -36,7 +36,6 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.cdk.As;
@@ -49,7 +48,7 @@
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.EventName;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.RenderKitModel;
import org.richfaces.cdk.model.RenderKitModel.Id;
import org.richfaces.cdk.model.RendererModel;
@@ -116,23 +115,23 @@
return renderer;
}
- private void assertNoSignature(Property property) {
+ private void assertNoSignature(PropertyBase property) {
List<ClassName> signature = property.getSignature();
assertNotNull(signature);
assertTrue(signature.isEmpty());
}
- private void assertNoEventNames(Property property) {
+ private void assertNoEventNames(PropertyBase property) {
Set<EventName> eventNames = property.getEventNames();
assertNotNull(eventNames);
assertTrue(eventNames.isEmpty());
}
- private void assertNoDefaultValue(Property property) {
+ private void assertNoDefaultValue(PropertyBase property) {
assertNull(property.getDefaultValue());
}
- private void assertNotRequired(Property property) {
+ private void assertNotRequired(PropertyBase property) {
assertFalse(property.isRequired());
}
@@ -143,7 +142,7 @@
*
* @param onchangeAttr
*/
- private void checkDummyComponentOnchange(Property onchangeAttr) {
+ private void checkDummyComponentOnchange(PropertyBase onchangeAttr) {
assertNotNull(onchangeAttr);
assertNoSignature(onchangeAttr);
@@ -170,7 +169,7 @@
*
* @param onclickAttr
*/
- private void checkDummyComponentOnclick(Property onclickAttr) {
+ private void checkDummyComponentOnclick(PropertyBase onclickAttr) {
assertNotNull(onclickAttr);
assertNoSignature(onclickAttr);
@@ -199,7 +198,7 @@
*
* @param actionProperty
*/
- private void checkDummyComponentAction(Property actionProperty) {
+ private void checkDummyComponentAction(PropertyBase actionProperty) {
assertNotNull(actionProperty);
assertNoEventNames(actionProperty);
@@ -212,7 +211,7 @@
*
* @param actionListenerProperty
*/
- private void checkDummyComponentActionListener(Property actionListenerProperty) {
+ private void checkDummyComponentActionListener(PropertyBase actionListenerProperty) {
assertNotNull(actionListenerProperty);
assertNoEventNames(actionListenerProperty);
@@ -225,7 +224,7 @@
*
* @param coolMethodProperty
*/
- private void checkDummyComponentCoolMethod(Property coolMethodProperty) {
+ private void checkDummyComponentCoolMethod(PropertyBase coolMethodProperty) {
assertNotNull(coolMethodProperty);
assertNoEventNames(coolMethodProperty);
@@ -239,7 +238,7 @@
/**
* @param integerAttribute
*/
- private void checkDummyComponentIntegerAttribute(Property integerAttribute) {
+ private void checkDummyComponentIntegerAttribute(PropertyBase integerAttribute) {
assertNotNull(integerAttribute);
assertNoEventNames(integerAttribute);
assertNoSignature(integerAttribute);
@@ -252,7 +251,7 @@
/**
* @param requiredAttribute
*/
- private void checkDummyComponentRequiredAttribute(Property requiredAttribute) {
+ private void checkDummyComponentRequiredAttribute(PropertyBase requiredAttribute) {
assertNotNull(requiredAttribute);
assertNoEventNames(requiredAttribute);
assertNoSignature(requiredAttribute);
@@ -263,7 +262,7 @@
assertEquals("Required Attribute", requiredAttribute.getDisplayname());
}
- private void checkDummyComponentImportedAttribute(Property importedAttribute, Class<?> type) {
+ private void checkDummyComponentImportedAttribute(PropertyBase importedAttribute, Class<?> type) {
assertNotNull(importedAttribute);
assertNoEventNames(importedAttribute);
assertNoSignature(importedAttribute);
@@ -315,7 +314,7 @@
assertEquals("org.richfaces.Dummy", renderer.getFamily());
assertSame(template, renderer.getTemplate());
- Collection<Property> attributes = renderer.getAttributes();
+ Collection<PropertyBase> attributes = renderer.getAttributes();
assertNotNull(attributes);
checkDummyComponentOnclick(getAttribute(attributes,"onclick"));
@@ -334,8 +333,8 @@
assertEquals(11, attributes.size());
}
- private Property getAttribute(Collection<Property> attributes, String string) {
- for (Property property : attributes) {
+ private PropertyBase getAttribute(Collection<PropertyBase> attributes, String string) {
+ for (PropertyBase property : attributes) {
if(string.equals(property.getName())){
return property;
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/ComponentAdapterTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/ComponentAdapterTest.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/ComponentAdapterTest.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -1,19 +1,18 @@
package org.richfaces.cdk.xmlconfig;
-import static org.junit.Assert.*;
-
-import java.util.Collection;
-
+import com.google.common.collect.Iterables;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.FacesId;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.xmlconfig.model.ComponentAdapter;
import org.richfaces.cdk.xmlconfig.model.ComponentBean;
import org.richfaces.cdk.xmlconfig.model.ComponentBean.ComponentExtension;
-import com.google.common.collect.Iterables;
+import java.util.Collection;
public class ComponentAdapterTest {
private static final String BAZ = "baz";
@@ -35,7 +34,7 @@
ComponentBean componentBean = componentAdapter.marshal(component);
assertEquals(FOO_BAR, componentBean.getType().toString());
- Collection<Property> attributes = componentBean.getAttributes();
+ Collection<PropertyBase> attributes = componentBean.getAllProperties();
assertEquals(1, attributes.size());
assertEquals(BAZ, Iterables.getOnlyElement(attributes).getName());
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -23,12 +23,11 @@
package org.richfaces.cdk.xmlconfig;
-import static org.junit.Assert.*;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
+import com.google.common.collect.Iterables;
+import com.google.inject.Binder;
+import com.google.inject.Inject;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.cdk.As;
@@ -42,15 +41,14 @@
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.FacetModel;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.RenderKitModel;
import org.richfaces.cdk.xmlconfig.model.FacesConfigBean;
import org.richfaces.cdk.xmlconfig.model.RenderKitBean;
import org.xml.sax.ext.EntityResolver2;
-import com.google.common.collect.Iterables;
-import com.google.inject.Binder;
-import com.google.inject.Inject;
+import java.util.Collection;
+import java.util.List;
/**
* <p class="changed_added_4_0">
@@ -111,7 +109,7 @@
assertEquals("Header facet", facet.getDescription());
assertTrue(facet.isGenerate());
- Collection<Property> attributes = component.getAttributes();
+ Collection<PropertyBase> attributes = component.getAttributes();
assertEquals(3, attributes.size());
}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -23,13 +23,11 @@
package org.richfaces.cdk.xmlconfig;
-import static org.junit.Assert.*;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
+import com.google.common.collect.Iterables;
+import com.google.inject.Binder;
+import com.google.inject.Inject;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.cdk.As;
@@ -41,12 +39,12 @@
import org.richfaces.cdk.Source;
import org.richfaces.cdk.Sources;
import org.richfaces.cdk.model.ClassName;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import org.xml.sax.ext.EntityResolver2;
-import com.google.common.collect.Iterables;
-import com.google.inject.Binder;
-import com.google.inject.Inject;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
/**
* <p class="changed_added_4_0">
@@ -86,7 +84,7 @@
@Test
public void parserTest() throws Exception {
- Collection<Property> properties =
+ Collection<PropertyBase> properties =
parser.parseProperties("urn:resource:org/richfaces/cdk/xmlconfig/fragment.xml");
assertEquals(3, properties.size());
@@ -95,7 +93,7 @@
@Test
public void xincludeTest() throws Exception {
- Collection<Property> properties =
+ Collection<PropertyBase> properties =
parser.parseProperties("urn:resource:org/richfaces/cdk/xmlconfig/parent.xml");
assertEquals(2, properties.size());
@@ -104,7 +102,7 @@
@Test
public void nestedXincludeTest() throws Exception {
- Collection<Property> properties =
+ Collection<PropertyBase> properties =
parser.parseProperties("urn:resource:org/richfaces/cdk/xmlconfig/parent2.xml");
assertEquals(2, properties.size());
@@ -113,12 +111,12 @@
@Test
public void propertyTest() throws Exception {
- Collection<Property> properties =
+ Collection<PropertyBase> properties =
parser.parseProperties("urn:resource:org/richfaces/cdk/xmlconfig/properties.xml");
assertEquals(1, properties.size());
- Property property = Iterables.getOnlyElement(properties);
+ PropertyBase property = Iterables.getOnlyElement(properties);
assertEquals("ontest2",property.getName());
assertEquals("int", property.getType().getName());
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/TaglibGeneratorVisitorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/TaglibGeneratorVisitorTest.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/TaglibGeneratorVisitorTest.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -23,10 +23,14 @@
package org.richfaces.cdk.xmlconfig;
import org.junit.Test;
-import org.richfaces.cdk.model.*;
import org.richfaces.cdk.generate.taglib.TaglibGeneratorVisitor;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.EventName;
+import org.richfaces.cdk.model.FacesId;
+import org.richfaces.cdk.model.PropertyBase;
+import org.richfaces.cdk.model.ValidatorModel;
-import javax.faces.component.UIOutput;
import java.util.Set;
/**
@@ -43,7 +47,7 @@
addAttribute(validator, "testValue", Object.class, true);
addAttribute(validator, "testFlag", boolean.class, true);
- Property attribute = addAttribute(validator, "id", String.class, false);
+ PropertyBase attribute = addAttribute(validator, "id", String.class, false);
Set<EventName> eventNames = attribute.getEventNames();
eventNames.add(getEvent("id", false));
@@ -66,8 +70,8 @@
return event;
}
- private Property addAttribute(ValidatorModel validator, String attributeName, Class<?> type, boolean generate) {
- Property attribute = validator.getOrCreateAttribute(attributeName);
+ private PropertyBase addAttribute(ValidatorModel validator, String attributeName, Class<?> type, boolean generate) {
+ PropertyBase attribute = validator.getOrCreateAttribute(attributeName);
attribute.setType(new ClassName(type));
attribute.setGenerate(generate);
return attribute;
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -22,15 +22,17 @@
package org.richfaces.cdk.xmlconfig.testmodel;
-import java.io.StringWriter;
-
import org.junit.Test;
import org.richfaces.cdk.model.BehaviorModel;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.FacesId;
+import org.richfaces.cdk.model.AttributeModel;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.xmlconfig.XmlTest;
+import java.io.StringWriter;
+
/**
* @author akolonitsky
* @since Jan 21, 2010
@@ -43,11 +45,20 @@
BehaviorModel behaviorModel = new BehaviorModel(FacesId.parseId("my_behavior"));
behaviorModel.setTargetClass(ClassName.parseName(Object.class.getName()));
+ PropertyBase prop = behaviorModel.getOrCreateAttribute("attr1");
+ prop.setType(new ClassName(String.class));
+
+ AttributeModel attributeModel = new AttributeModel();
+ attributeModel.setName("attr2");
+ attributeModel.setType(new ClassName(String.class));
+ behaviorModel.getAttributes().add(attributeModel);
+
library.getBehaviors().add(behaviorModel);
// Jaxb marshaling
StringWriter facesConfig = generateFacesConfig(library);
-
+// System.out.println(facesConfig.toString());
+
// Checks
checkXmlStructure(facesConfig);
validateXml(facesConfig);
Modified: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyValidator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyValidator.java 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyValidator.java 2010-03-19 14:50:31 UTC (rev 16636)
@@ -40,7 +40,7 @@
}
}
-@JsfValidator
+@JsfValidator(id = "my_validator1")
class MyValidator01 implements javax.faces.validator.Validator {
@Override
Modified: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml 2010-03-19 14:47:30 UTC (rev 16635)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/BehaviorBeanTest.xml 2010-03-19 14:50:31 UTC (rev 16636)
@@ -3,9 +3,35 @@
<behavior>
<behavior-id>my_behavior</behavior-id>
<behavior-class>java.lang.Object</behavior-class>
+ <attribute>
+ <attribute-name>attr2</attribute-name>
+ <attribute-class>java.lang.String</attribute-class>
+ <attribute-extension>
+ <cdk:generate>false</cdk:generate>
+ <cdk:hidden>false</cdk:hidden>
+ <cdk:literal>false</cdk:literal>
+ <cdk:pass-through>false</cdk:pass-through>
+ <cdk:read-only>false</cdk:read-only>
+ <cdk:required>false</cdk:required>
+ <cdk:signature/>
+ </attribute-extension>
+ </attribute>
+ <property>
+ <property-name>attr1</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>false</cdk:generate>
+ <cdk:hidden>false</cdk:hidden>
+ <cdk:literal>false</cdk:literal>
+ <cdk:pass-through>false</cdk:pass-through>
+ <cdk:read-only>false</cdk:read-only>
+ <cdk:required>false</cdk:required>
+ <cdk:signature/>
+ </property-extension>
+ </property>
<behavior-extension>
<cdk:generate>false</cdk:generate>
</behavior-extension>
</behavior>
<faces-config-extension/>
-</faces-config>
+</faces-config>
\ No newline at end of file
14 years, 9 months
JBoss Rich Faces SVN: r16635 - in root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk: freemarker and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-19 10:47:30 -0400 (Fri, 19 Mar 2010)
New Revision: 16635
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ProcessorBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/ModelElementBaseTemplateModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/PropertyModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/TagTemplateModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ClassGeneratorModule.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
Log:
RF-8232 Tags support
fix core-ui build
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ProcessorBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ProcessorBase.java 2010-03-18 18:39:27 UTC (rev 16634)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ProcessorBase.java 2010-03-19 14:47:30 UTC (rev 16635)
@@ -17,7 +17,7 @@
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.DescriptionGroup;
import org.richfaces.cdk.model.ModelElementBase;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.TagModel;
import org.richfaces.cdk.util.Strings;
import org.richfaces.cdk.xmlconfig.CdkEntityResolver;
@@ -140,7 +140,7 @@
modelElement.setBaseClass(ClassName.parseName(baseClass));
}
- protected Collection<Property> parseProperties(String attributesConfig) {
+ protected Collection<PropertyBase> parseProperties(String attributesConfig) {
return getFragmentParser().parseProperties(CdkEntityResolver.URN_ATTRIBUTES + attributesConfig + ".xml");
}
@@ -180,13 +180,13 @@
// TODO - encapsulate attribute builder into utility class.
for (BeanProperty beanProperty : properties) {
- Property attribute = component.getOrCreateAttribute(beanProperty.getName());
+ PropertyBase attribute = component.getOrCreateAttribute(beanProperty.getName());
processAttribute(beanProperty, attribute);
}
}
- private void processAttribute(BeanProperty beanProperty, Property attribute) {
+ private void processAttribute(BeanProperty beanProperty, PropertyBase attribute) {
attribute.setType(beanProperty.getType());
Attribute attributeAnnotarion = beanProperty.getAnnotation(Attribute.class);
@@ -261,7 +261,7 @@
return null;
}
- private void setBehaviorEvent(Property attribute, EventName eventName) {
+ private void setBehaviorEvent(PropertyBase attribute, EventName eventName) {
if (null != eventName) {
org.richfaces.cdk.model.EventName event = new org.richfaces.cdk.model.EventName();
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/ModelElementBaseTemplateModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/ModelElementBaseTemplateModel.java 2010-03-18 18:39:27 UTC (rev 16634)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/ModelElementBaseTemplateModel.java 2010-03-19 14:47:30 UTC (rev 16635)
@@ -35,7 +35,7 @@
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.EventName;
import org.richfaces.cdk.model.ModelElementBase;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import java.util.ArrayList;
import java.util.Collection;
@@ -86,7 +86,7 @@
public TemplateModel getImportClasses() throws TemplateModelException {
Set<String> result = new TreeSet<String>();
- for (Property entry : model.getAttributes()) {
+ for (PropertyBase entry : model.getAttributes()) {
if (entry.isGenerate() && !isPredefined(entry)) {
result.add(entry.getType().getName());
// System.out.println(entry.getType().getTypeParameters());
@@ -100,7 +100,7 @@
return this.wrapper.wrap(list);
}
- public boolean isPredefined(Property property) {
+ public boolean isPredefined(PropertyBase property) {
return property.isPrimitive() || isFromJavaLang(property.getType());
}
@@ -133,7 +133,7 @@
if (null == eventNames) {
eventNames = Sets.newHashSet();
- for (Property property : model.getAttributes()) {
+ for (PropertyBase property : model.getAttributes()) {
eventNames.addAll(property.getEventNames());
}
}
@@ -142,9 +142,9 @@
}
private TemplateModel generatedAttributes() throws TemplateModelException {
- Collection<Property> attributes = model.getAttributes();
+ Collection<PropertyBase> attributes = model.getAttributes();
Collection<PropertyModel> models = new ArrayList<PropertyModel>(attributes.size());
- for (Property entry : attributes) {
+ for (PropertyBase entry : attributes) {
if (entry.isGenerate()) {
PropertyModel propertyModel = new PropertyModel(entry, wrapper);
models.add(propertyModel);
@@ -153,9 +153,9 @@
return wrapper.wrap(models);
}
private TemplateModel attributes() throws TemplateModelException {
- Collection<Property> attributes = model.getAttributes();
+ Collection<PropertyBase> attributes = model.getAttributes();
Collection<PropertyModel> models = new ArrayList<PropertyModel>(attributes.size());
- for (Property entry : attributes) {
+ for (PropertyBase entry : attributes) {
models.add(new PropertyModel(entry, wrapper));
}
return wrapper.wrap(models);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/PropertyModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/PropertyModel.java 2010-03-18 18:39:27 UTC (rev 16634)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/PropertyModel.java 2010-03-19 14:47:30 UTC (rev 16635)
@@ -30,7 +30,7 @@
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
import org.richfaces.cdk.model.ClassName;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.util.Strings;
/**
@@ -39,14 +39,14 @@
*
*/
public class PropertyModel extends BeanModel implements TemplateModel {
- private final Property property;
+ private final PropertyBase property;
/**
* <p class="changed_added_4_0"></p>
* @param object
* @param wrapper
*/
- public PropertyModel(Property object, BeansWrapper wrapper) {
+ public PropertyModel(PropertyBase object, BeansWrapper wrapper) {
super(object, wrapper);
property = object;
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/TagTemplateModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/TagTemplateModel.java 2010-03-18 18:39:27 UTC (rev 16634)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/TagTemplateModel.java 2010-03-19 14:47:30 UTC (rev 16635)
@@ -119,7 +119,7 @@
if (null == eventNames) {
eventNames = Sets.newHashSet();
- for (Property property : model.getModel().getAttributes()) {
+ for (PropertyBase property : model.getModel().getAttributes()) {
eventNames.addAll(property.getEventNames());
}
}
@@ -128,9 +128,9 @@
}
private TemplateModel generatedAttributes() throws TemplateModelException {
- Collection<Property> attributes = model.getModel().getAttributes();
+ Collection<PropertyBase> attributes = model.getModel().getAttributes();
Collection<PropertyModel> models = new ArrayList<PropertyModel>(attributes.size());
- for (Property entry : attributes) {
+ for (PropertyBase entry : attributes) {
if (entry.isGenerate() && entry.isBindingAttribute()) {
PropertyModel propertyModel = new PropertyModel(entry, wrapper);
models.add(propertyModel);
@@ -139,9 +139,9 @@
return wrapper.wrap(models);
}
private TemplateModel attributes() throws TemplateModelException {
- Collection<Property> attributes = model.getModel().getAttributes();
+ Collection<PropertyBase> attributes = model.getModel().getAttributes();
Collection<PropertyModel> models = new ArrayList<PropertyModel>(attributes.size());
- for (Property entry : attributes) {
+ for (PropertyBase entry : attributes) {
models.add(new PropertyModel(entry, wrapper));
}
return wrapper.wrap(models);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ClassGeneratorModule.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ClassGeneratorModule.java 2010-03-18 18:39:27 UTC (rev 16634)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/ClassGeneratorModule.java 2010-03-19 14:47:30 UTC (rev 16635)
@@ -41,7 +41,7 @@
@Override
protected void configure() {
Multibinder<CdkWriter> setBinder = Multibinder.newSetBinder(binder(), CdkWriter.class);
- setBinder.addBinding().to(ComponentClassGenerator.class);
+// setBinder.addBinding().to(ComponentClassGenerator.class);
setBinder.addBinding().to(ConverterClassGenerator.class);
setBinder.addBinding().to(ValidatorClassGenerator.class);
setBinder.addBinding().to(BehaviorClassGenerator.class);
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-18 18:39:27 UTC (rev 16634)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-03-19 14:47:30 UTC (rev 16635)
@@ -36,7 +36,7 @@
import org.richfaces.cdk.model.ListenerModel;
import org.richfaces.cdk.model.ModelElement;
import org.richfaces.cdk.model.ModelElementBase;
-import org.richfaces.cdk.model.Property;
+import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.RenderKitModel;
import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.model.TagModel;
@@ -142,7 +142,7 @@
private void appendAttributs(Element tag, BeanModelBase model) {
- for (Property entry : model.getAttributes()) {
+ for (PropertyBase entry : model.getAttributes()) {
createAttributeElement(tag, entry.getName(), entry);
}
}
@@ -161,7 +161,7 @@
*
* @return
* */
- private Element createAttributeElement(Element tag, String name, Property attribute) {
+ private Element createAttributeElement(Element tag, String name, PropertyBase attribute) {
Element attr = tag.addElement("attribute");
attr.addElement("name").addText(name);
if (attribute.getDescription() != null) {
@@ -199,7 +199,7 @@
}
- public void visitProperty(Property model) {
+ public void visitProperty(PropertyBase model) {
}
14 years, 9 months
JBoss Rich Faces SVN: r16634 - root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-03-18 14:39:27 -0400 (Thu, 18 Mar 2010)
New Revision: 16634
Added:
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/reorderMarker.gif
Log:
RF-7869
Added: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/reorderMarker.gif
===================================================================
(Binary files differ)
Property changes on: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/reorderMarker.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 9 months
JBoss Rich Faces SVN: r16633 - root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-18 12:02:15 -0400 (Thu, 18 Mar 2010)
New Revision: 16633
Removed:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ComponentLibraryTest.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Deleted: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ComponentLibraryTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ComponentLibraryTest.java 2010-03-18 16:01:28 UTC (rev 16632)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ComponentLibraryTest.java 2010-03-18 16:02:15 UTC (rev 16633)
@@ -1,146 +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.model;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.faces.render.RenderKitFactory;
-
-import org.junit.Test;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-public class ComponentLibraryTest {
-
- /**
- * Test method for
- * {@link org.richfaces.cdk.model.ComponentLibrary#accept(org.richfaces.cdk.model.LibraryVisitor, java.lang.Object)}
- * .
- *
- * @throws Exception
- */
- @Test
- public void testAcceptLibraryVisitorOfRPP() throws Exception {
- ComponentLibrary lib = new ComponentLibrary();
- final ComponentModel component = new ComponentModel(FacesId.parseId("foo.Bar"));
- lib.getComponents().add(component);
- LibraryVisitor<Boolean, Boolean> visitor = new LibraryVisitor<Boolean, Boolean>() {
- @Override
- public Boolean visit(Visitable c, Boolean param) {
- return component == c ? Boolean.TRUE : null;
- }
- };
-
- assertTrue(lib.accept(visitor, null));
- }
-
- /**
- * Test method for
- * {@link org.richfaces.cdk.model.ComponentLibrary#findOrCreateRenderer(java.lang.String, java.lang.String)}.
- */
- @Test
- public void testFindOrCreateRenderKit() {
- ComponentLibrary lib = new ComponentLibrary();
- RenderKitModel renderKit = lib.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT);
-
- assertNotNull(renderKit);
- assertSame(renderKit, lib.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT));
- }
-
- /**
- * Test method for
- * {@link org.richfaces.cdk.model.ComponentLibrary#merge(org.richfaces.cdk.model.Mergeable, org.richfaces.cdk.model.Mergeable)}
- * .
- */
- @Test
- public void testMergeTT() {
- ModelBean foo = new ModelBean("foo");
-
- foo.setResult("Result");
- foo.setDoNotReplace("Important");
-
- ModelBean bar = new ModelBean("bar");
-
- bar.setVizited(true);
-
- Object result = new Object();
-
- bar.setResult(result);
- bar.readOnly = "readOnly";
- bar.writeOnly = "writeOnly";
- bar.setDoNotReplace("Replaced");
- ComponentLibrary.merge(foo, bar);
- assertSame(result, foo.getResult());
- assertEquals(new ModelBean.Type("foo"), foo.getType());
- assertTrue(foo.isVizited());
- assertEquals("Important", foo.getDoNotReplace());
- assertNull(foo.readOnly);
- assertNull(foo.writeOnly);
- }
-
- /**
- * Test method for
- * {@link org.richfaces.cdk.model.ComponentLibrary#accept(java.lang.Iterable, org.richfaces.cdk.model.LibraryVisitor, java.lang.Object, java.lang.Object)}
- * .
- *
- * @throws Exception
- */
- @Test
- public void testAcceptIterableOfTLibraryVisitorOfRPPR() throws Exception {
- List<ModelBean> beans = new ArrayList<ModelBean>();
- ModelBean foo = new ModelBean("foo");
-
- foo.setResult("foo");
- beans.add(foo);
-
- ModelBean bar = new ModelBean("bar");
-
- beans.add(bar);
-
- LibraryVisitor<Object, String> visitor = new LibraryVisitor<Object, String>() {
- @Override
- public Object visit(Visitable c, String param) {
- ModelBean bean = (ModelBean) c;
-
- bean.setDoNotReplace(param);
-
- return bean.getResult();
- }
- };
- Object result = ComponentLibrary.accept(beans, visitor, "visited", null);
-
- assertTrue(foo.isVizited() || bar.isVizited());
- assertFalse(foo.isVizited() && bar.isVizited());
- assertEquals("foo", result);
- assertEquals("visited", foo.getDoNotReplace());
- }
-}
14 years, 9 months
JBoss Rich Faces SVN: r16632 - root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-18 12:01:28 -0400 (Thu, 18 Mar 2010)
New Revision: 16632
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/NameTest.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/NameTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/NameTest.java 2010-03-18 16:00:58 UTC (rev 16631)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/NameTest.java 2010-03-18 16:01:28 UTC (rev 16632)
@@ -23,9 +23,9 @@
package org.richfaces.cdk.model;
-import static org.junit.Assert.*;
-
import org.junit.After;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import org.junit.Before;
import org.junit.Test;
14 years, 9 months
JBoss Rich Faces SVN: r16631 - root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-03-18 12:00:58 -0400 (Thu, 18 Mar 2010)
New Revision: 16631
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ModelBean.java
Log:
RF-8232 Tags support
remove visitor
fix checkstyle errors
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ModelBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ModelBean.java 2010-03-18 16:00:21 UTC (rev 16630)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ModelBean.java 2010-03-18 16:00:58 UTC (rev 16631)
@@ -23,8 +23,6 @@
package org.richfaces.cdk.model;
-import org.richfaces.cdk.CdkException;
-
/**
* <p class="changed_added_4_0">
* </p>
@@ -168,14 +166,9 @@
ComponentLibrary.merge(this, other);
}
- @Override
- public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
- vizited = true;
-
- return visitor.visit(this, param);
- }
-
public void accept(Visitor visitor) {
+ vizited = true;
+
visitor.visit(this);
}
14 years, 9 months