JBoss Rich Faces SVN: r15737 - root.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-10-20 13:59:58 -0400 (Tue, 20 Oct 2009)
New Revision: 15737
Modified:
root/pom.xml
Log:
"sandbox" profile added
Modified: root/pom.xml
===================================================================
--- root/pom.xml 2009-10-20 17:38:13 UTC (rev 15736)
+++ root/pom.xml 2009-10-20 17:59:58 UTC (rev 15737)
@@ -64,6 +64,14 @@
</profile>
<profile>
+ <id>sandbox</id>
+ <modules>
+ <module>ui-sandbox/${ui-sandbox.svn.dir}</module>
+ <module>examples-sandbox/${examples-sandbox.svn.dir}</module>
+ </modules>
+ </profile>
+
+ <profile>
<id>release</id>
<build>
15 years, 2 months
JBoss Rich Faces SVN: r15736 - root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-10-20 13:38:13 -0400 (Tue, 20 Oct 2009)
New Revision: 15736
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/EventBean.java
Log:
Fixed misplaced annotation in EventBean.java
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/EventBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/EventBean.java 2009-10-20 12:19:42 UTC (rev 15735)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/EventBean.java 2009-10-20 17:38:13 UTC (rev 15736)
@@ -61,7 +61,6 @@
* <p class="changed_added_4_0"></p>
* @param type the type to set
*/
- @XmlElement(name="description",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
public void setType(String type) {
this.type = type;
}
@@ -70,6 +69,7 @@
* <p class="changed_added_4_0"></p>
* @return the description
*/
+ @XmlElement(name="description",namespace=ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
public String getDescription() {
return description;
}
15 years, 2 months
JBoss Rich Faces SVN: r15735 - root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-10-20 08:19:42 -0400 (Tue, 20 Oct 2009)
New Revision: 15735
Modified:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Row.java
Log:
Modified: root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Row.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Row.java 2009-10-20 12:18:54 UTC (rev 15734)
+++ root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Row.java 2009-10-20 12:19:42 UTC (rev 15735)
@@ -23,7 +23,7 @@
import java.util.Iterator;
-import javax.faces.component.UIComponent;
+import javax.faces.component.UIColumn;
/**
* Marker interface for table columns, rendered as entire row.
@@ -36,6 +36,6 @@
* Get iterator for all columns contained in this row.
* @return
*/
- public Iterator<UIComponent> columns();
+ public Iterator<UIColumn> columns();
}
15 years, 2 months
JBoss Rich Faces SVN: r15734 - root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-10-20 08:18:54 -0400 (Tue, 20 Oct 2009)
New Revision: 15734
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/ColumnsIterator.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/DataIterator.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/FixedChildrenIterator.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java
Log:
refactot iterators impls, separate DataIterator form columnIterator
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/ColumnsIterator.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/ColumnsIterator.java 2009-10-20 12:17:56 UTC (rev 15733)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/ColumnsIterator.java 2009-10-20 12:18:54 UTC (rev 15734)
@@ -23,6 +23,7 @@
import java.util.Iterator;
import java.util.NoSuchElementException;
+import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
/**
@@ -30,10 +31,10 @@
* @author asmirnov
*
*/
-class ColumnsIterator implements Iterator<UIComponent> {
+class ColumnsIterator implements Iterator <javax.faces.component.UIColumn> {
- private UIComponent next;
+ private javax.faces.component.UIColumn next;
private boolean initialized = false;
@@ -52,11 +53,11 @@
return null != next;
}
- public UIComponent next() {
+ public javax.faces.component.UIColumn next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
- UIComponent result = next;
+ javax.faces.component.UIColumn result = next;
next = nextColumn();
return result;
}
@@ -65,11 +66,11 @@
throw new UnsupportedOperationException("Iterator is read-only");
}
- protected UIComponent nextColumn(){
+ protected javax.faces.component.UIColumn nextColumn(){
while (childrenIterator != null && childrenIterator.hasNext()) {
UIComponent child = childrenIterator.next();
- if(child instanceof UIColumn || child instanceof Column){
- return child;
+ if(child instanceof javax.faces.component.UIColumn){
+ return (UIColumn)child;
}
}
return null;
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/DataIterator.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/DataIterator.java 2009-10-20 12:17:56 UTC (rev 15733)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/DataIterator.java 2009-10-20 12:18:54 UTC (rev 15734)
@@ -22,57 +22,53 @@
import java.util.Iterator;
-import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
-class DataIterator extends ColumnsIterator {
+class DataIterator implements Iterator <UIComponent> {
- protected Iterator<UIComponent> facetsIterator;
+ private Iterator<UIComponent> facetsIterator;
+
+ private Iterator<UIComponent> childrenIterator;
+
- public DataIterator(UIComponent dataTable) {
- super(dataTable);
- facetsIterator = dataTable.getFacets().values().iterator();
+ public DataIterator(UIDataTable dataTable) {
+ this.childrenIterator = dataTable.getChildren().iterator();
+ this.facetsIterator = dataTable.getFacets().values().iterator();
}
- @Override
- protected UIComponent nextColumn() {
- UIComponent nextColumn = null;
- while (null == nextColumn && childrenIterator.hasNext()) {
- UIComponent child = childrenIterator.next();
- if (child.isRendered()) {
- if (child instanceof UIColumn || child instanceof Column) {
- nextColumn = child;
- } /*else if (checkAjaxComponent(child)) {
- nextColumn = child;
- } */
+ public boolean hasNext() {
+ return (facetsIterator.hasNext() || childrenIterator.hasNext());
+ }
+
+ public UIComponent next() {
+ UIComponent next = null;
+
+ while (next == null && childrenIterator.hasNext()) {
+ UIComponent child = (UIComponent) childrenIterator.next();
+ if((child instanceof UIColumn) && child.isRendered()) {
+ next = child;
}
}
- /*
- while (null == nextColumn && facetsIterator.hasNext()) {
- UIComponent child = facetsIterator.next();
- if (checkAjaxComponent(child)) {
- nextColumn = child;
- break;
+
+ while (next == null && facetsIterator.hasNext()) {
+ UIComponent child = (UIComponent) facetsIterator.next();
+ if(child.isRendered()) {
+ next = child;
}
- }*/
- return nextColumn;
+ }
+
+ return next;
}
-
- /**
- * @param child
- * @return
- */
- protected Iterator<UIComponent> getColumnChildrenIterator(UIComponent child) {
- return child.getChildren().iterator();
+
+ protected Iterator<UIComponent> getFacetsIterator() {
+ return this.facetsIterator;
}
-
- /**
- * @param child
- * @return
- */
- /*
- protected boolean checkAjaxComponent(UIComponent child) {
- return child instanceof AjaxSupport || child instanceof Dropzone;
+
+ protected Iterator<UIComponent> getChildrenIterator() {
+ return this.childrenIterator;
}
- */
+
+ public void remove() {
+ throw new UnsupportedOperationException("Iterator is read-only");
+ }
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/FixedChildrenIterator.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/FixedChildrenIterator.java 2009-10-20 12:17:56 UTC (rev 15733)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/FixedChildrenIterator.java 2009-10-20 12:18:54 UTC (rev 15734)
@@ -22,85 +22,60 @@
import java.util.Iterator;
-import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
-class FixedChildrenIterator extends DataIterator {
+class FixedChildrenIterator extends DataIterator {
+
private Iterator<UIComponent> currentColumnIterator;
-
- public FixedChildrenIterator(UIComponent dataTable) {
+
+ public FixedChildrenIterator(UIDataTable dataTable) {
super(dataTable);
}
-
+
@Override
- protected UIComponent nextColumn() {
- UIComponent nextColumn = null;
- if (null != currentColumnIterator) {
- nextColumn = currentColumnIterator.next();
- checkNextColumnChild();
- } else {
- while (null == nextColumn && childrenIterator.hasNext()) {
+ public UIComponent next() {
+ UIComponent next = null;
+
+ if(currentColumnIterator != null && currentColumnIterator.hasNext()) {
+ next = currentColumnIterator.next();
+ checkColumnIterator();
+ }
+
+ if(next == null) {
+ Iterator <UIComponent> childrenIterator = getChildrenIterator();
+ while(childrenIterator.hasNext()) {
UIComponent child = childrenIterator.next();
- if (child instanceof UIColumn || child instanceof Column) {
- boolean rendered = true;
- try {
- rendered = child.isRendered();
- } catch (Exception e) {
- // This exception can be thrown for a header/footer
- // facets
- // there column rendered attribute was binded to a row
- // variable.
- }
- if (rendered) {
- Iterator<UIComponent> iterator = getColumnChildrenIterator(child);
- if (iterator.hasNext()) {
- currentColumnIterator = iterator;
- nextColumn = currentColumnIterator.next();
- checkNextColumnChild();
- }
-
- }
- } /*else if (checkAjaxComponent(child)) {
- nextColumn = child;
- }*/
+ if((child instanceof UIColumn) && child.isRendered()) {
+ currentColumnIterator = getChildrenIterator(child);
+ next = next();
+ }
}
}
- if (null == nextColumn) {
- nextColumn = getNextFacet();
+
+ if (next == null) {
+ next = getNextFacet();
}
- return nextColumn;
+
+ return next;
}
-
- /**
- * @param nextColumn
- * @return
- */
+
protected UIComponent getNextFacet() {
- UIComponent nextColumn = null;
- /*while (null == nextColumn && facetsIterator.hasNext()) {
- UIComponent child = facetsIterator.next();
- if (checkAjaxComponent(child)) {
- nextColumn = child;
- }
- }*/
- return nextColumn;
+ Iterator<UIComponent> facetsIterator = getFacetsIterator();
+ while(facetsIterator.hasNext()) {
+ return facetsIterator.next();
+ }
+ return null;
}
-
- /*@Override
- protected boolean checkAjaxComponent(UIComponent child) {
- return !super.checkAjaxComponent(child);
- }*/
-
- @Override
- protected Iterator<UIComponent> getColumnChildrenIterator(UIComponent child) {
- return child.getFacets().values().iterator();
- }
-
- protected void checkNextColumnChild() {
+
+ protected void checkColumnIterator() {
if (!currentColumnIterator.hasNext()) {
currentColumnIterator = null;
}
}
+
+ protected Iterator<UIComponent> getChildrenIterator(UIComponent component) {
+ return component.getChildren().iterator();
+ }
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java 2009-10-20 12:17:56 UTC (rev 15733)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java 2009-10-20 12:18:54 UTC (rev 15734)
@@ -28,7 +28,7 @@
*/
public class SubtableFixedChildrenIterator extends FixedChildrenIterator {
- public SubtableFixedChildrenIterator(UIComponent dataTable) {
+ public SubtableFixedChildrenIterator(UIDataTable dataTable) {
super(dataTable);
}
15 years, 2 months
JBoss Rich Faces SVN: r15733 - root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-10-20 08:17:56 -0400 (Tue, 20 Oct 2009)
New Revision: 15733
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumnGroup.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java
Log:
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumnGroup.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumnGroup.java 2009-10-20 12:16:48 UTC (rev 15732)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumnGroup.java 2009-10-20 12:17:56 UTC (rev 15733)
@@ -23,6 +23,7 @@
import java.util.Iterator;
+import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
import javax.faces.component.UIPanel;
@@ -36,7 +37,7 @@
public static final String COMPONENT_FAMILY = "org.richfaces.Colgroup";
- public Iterator<UIComponent> columns(){
+ public Iterator<UIColumn> columns(){
return new ColumnsIterator(this);
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java 2009-10-20 12:16:48 UTC (rev 15732)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java 2009-10-20 12:17:56 UTC (rev 15733)
@@ -2,11 +2,12 @@
import java.util.Iterator;
+import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
public class UIDataTable extends UISequence{
- public Iterator<UIComponent> columns() {
+ public Iterator<UIColumn> columns() {
return new ColumnsIterator(this);
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java 2009-10-20 12:16:48 UTC (rev 15732)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java 2009-10-20 12:17:56 UTC (rev 15733)
@@ -23,6 +23,7 @@
import java.util.Iterator;
+import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
@@ -59,9 +60,9 @@
/* (non-Javadoc)
* @see org.richfaces.component.UIDataTable#columns()
*/
- public Iterator<UIComponent> columns() {
- return super.columns();
- }
+// public Iterator<UIComponent> columns() {
+// return super.columns();
+// }
/**
* @return the sortExpression
15 years, 2 months
JBoss Rich Faces SVN: r15732 - root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-10-20 08:16:48 -0400 (Tue, 20 Oct 2009)
New Revision: 15732
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
Log:
move encodeTableHederFacet, encodeCaption methods to the table spec renderer
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2009-10-20 12:14:56 UTC (rev 15731)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2009-10-20 12:16:48 UTC (rev 15732)
@@ -31,8 +31,9 @@
import org.ajax4jsf.model.DataVisitResult;
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.Row;
+import org.richfaces.component.Column;
import org.richfaces.component.UIDataAdaptor;
import org.richfaces.component.UIDataTable;
@@ -52,44 +53,33 @@
{"onmouseout","onRowMouseOut"}
};
+ public static final String ROW_CLASS_KEY = AbstractRowsRenderer.class.getName() + ".rowClass";
- public static final String ROW_CLASS_KEY =
- AbstractRowsRenderer.class.getName() + ".rowClass";
+ public static final String SKIN_ROW_CLASS_KEY = AbstractRowsRenderer.class.getName() + ".skinRowClass";
- public static final String SKIN_ROW_CLASS_KEY =
- AbstractRowsRenderer.class.getName() + ".skinRowClass";
+ public static final String CELL_CLASS_KEY = AbstractRowsRenderer.class.getName() + ".cellClass";
- public static final String CELL_CLASS_KEY =
- AbstractRowsRenderer.class.getName() + ".cellClass";
+ public static final String SKIN_CELL_CLASS_KEY = AbstractRowsRenderer.class.getName() + ".skinCellClass";
- public static final String SKIN_CELL_CLASS_KEY =
- AbstractRowsRenderer.class.getName() + ".skinCellClass";
+ public static final String SKIN_FIRST_ROW_CLASS_KEY = AbstractRowsRenderer.class.getName() + ".firstRowSkinClass";
- public static final String SKIN_FIRST_ROW_CLASS_KEY =
- AbstractRowsRenderer.class.getName() + ".firstRowSkinClass";
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.ajax.repeat.DataVisitor#process(javax.faces.context.FacesContext,
- * java.lang.Object, java.lang.Object)
- */
+ public abstract void doProcess(FacesContext facesContext, TableHolder holder) throws IOException;
+
+ public abstract void encodeOneRow(FacesContext context, TableHolder holder) throws IOException;
+
+ public abstract void encodeCell(FacesContext context, UIComponent cell) throws IOException;
public DataVisitResult process(FacesContext facesContext, Object rowKey, Object argument) {
TableHolder holder = (TableHolder) argument;
UIDataAdaptor table = holder.getTable();
table.setRowKey(facesContext, rowKey);
-
- ResponseWriter writer = facesContext.getResponseWriter();
try {
- writer.startElement(HTML.TR_ELEMENT, table);
- encodeOneRow(facesContext, holder);
- writer.endElement(HTML.TR_ELEMENT);
+ doProcess(facesContext, holder);
}catch (IOException e) {
//TODO: seems we need add throws IOException ???
}
holder.nextRow();
-
return DataVisitResult.CONTINUE;
}
@@ -97,17 +87,7 @@
encodeRows(facesContext, table, new TableHolder(table));
}
-
-
- /**
- * Iterate over all rows for this table.
- *
- * @param context
- * @param component
- * @throws IOException
- */
- protected void encodeRows(FacesContext context, UIDataTable component, TableHolder tableHolder)
- throws IOException {
+ protected void encodeRows(FacesContext context, UIDataTable component, TableHolder tableHolder) throws IOException {
UIDataTable table = component;
Object key = table.getRowKey();
table.captureOrigValue(context);
@@ -119,25 +99,10 @@
table.restoreOrigValue(context);
}
- /**
- * @param context
- * TODO
- * @param tableHolder
- * @throws IOException
- */
- protected void doCleanup(FacesContext context, TableHolder tableHolder)
- throws IOException {
+ protected void doCleanup(FacesContext context, TableHolder tableHolder) throws IOException {
// Hoock method for perform encoding after all rows is rendered
-
}
- public abstract void encodeOneRow(FacesContext context, TableHolder holder)
- throws IOException;
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.render.Renderer#getRendersChildren()
- */
public boolean getRendersChildren() {
return true;
}
@@ -148,49 +113,14 @@
}
}
- public void encodeCaption(FacesContext context, UIDataTable table) throws IOException {
-
- UIComponent caption = table.getCaption();
- if (caption == null) {
- return;
- }
-
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement("caption", table);
-
- String captionClass = (String) table.getAttributes().get("captionClass");
- if (captionClass != null) {
- captionClass = "rich-table-caption " + captionClass;
- } else {
- captionClass = "rich-table-caption";
- }
- writer.writeAttribute("class", captionClass, "captionClass");
-
- String captionStyle = (String) table.getAttributes().get("captionStyle");
- if (captionStyle != null) {
- writer.writeAttribute("style", captionStyle, "captionStyle");
- }
-
- renderChild(context, caption);
-
- writer.endElement("caption");
-
- }
-
- /**
- * @param context
- * @param table
- * @throws IOException
- */
-
protected void encodeRowEvents(FacesContext context, UIDataAdaptor table) throws IOException {
- /*
+
RendererUtils utils2 = getUtils();
for (int i = 0; i < TABLE_EVENT_ATTRS.length; i++) {
String[] attrs = TABLE_EVENT_ATTRS[i];
utils2.encodeAttribute(context, table, attrs[1], attrs[0]);
}
- */
+
}
/**
@@ -304,9 +234,13 @@
requestMap.put(SKIN_CELL_CLASS_KEY, skinCellClass);
}
+
+ if(cell instanceof Column) {
+ encodeCell(context, cell);
+ } else {
+ renderChild(context, cell);
+ }
- renderChild(context, cell);
-
// Restore original values.
requestMap.put(ROW_CLASS_KEY, savedRowClass);
requestMap.put(CELL_CLASS_KEY, savedCellClass);
@@ -315,27 +249,28 @@
requestMap.put(SKIN_CELL_CLASS_KEY, savedSkinCellClass);
}
+
+ protected String cellStyleClass(FacesContext context , UIComponent component){
- protected void encodeTableHeaderFacet(FacesContext context, int columns, ResponseWriter writer, UIComponent footer, String skinFirstRowClass, String skinRowClass, String skinCellClass, String footerClass, String element) throws IOException {
- boolean isColgroup = footer instanceof Row;
- if (!isColgroup) {
- writer.startElement("tr", footer);
- encodeStyleClass(writer, null, skinFirstRowClass, footerClass, null);
- writer.startElement(element, footer);
- encodeStyleClass(writer, null, skinCellClass, footerClass, null);
- if (columns > 0) {
- writer.writeAttribute("colspan", String.valueOf(columns), null);
- }
- writer.writeAttribute("scope", "colgroup", null);
+ StringBuffer styleClass = new StringBuffer();
+ // Construct predefined classes
+ Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
+ Object parentPredefined = requestMap.get(AbstractRowsRenderer.SKIN_CELL_CLASS_KEY);
+ if (null != parentPredefined) {
+ styleClass.append(parentPredefined).append(" ");
+ } else {
+ styleClass.append("rich-table-cell ");
}
-
- encodeCellChildren(context, footer, skinFirstRowClass, skinRowClass,
- footerClass, skinCellClass, null);
-
- if (!isColgroup) {
- writer.endElement(element);
- writer.endElement("tr");
+ // Append class from parent component.
+ Object parent = requestMap.get(AbstractRowsRenderer.CELL_CLASS_KEY);
+ if (null != parent) {
+ styleClass.append(parent).append(" ");
}
+ Object custom = component.getAttributes().get("styleClass");
+ if (null != custom) {
+ styleClass.append(custom);
+ }
+ return styleClass.toString();
}
}
15 years, 2 months
JBoss Rich Faces SVN: r15731 - root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-10-20 08:14:56 -0400 (Tue, 20 Oct 2009)
New Revision: 15731
Removed:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/CellRenderer.java
Log:
render for the column moved to the table renderer
Deleted: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/CellRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/CellRenderer.java 2009-10-20 12:14:05 UTC (rev 15730)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/CellRenderer.java 2009-10-20 12:14:56 UTC (rev 15731)
@@ -1,133 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import java.util.Map;
-
-import javax.faces.component.UIColumn;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.renderkit.RendererBase;
-
-/**
- * @author shur
- * modified by Alexej Kushunin
- *
- */
-public class CellRenderer extends RendererBase {
-
- public String styleClass(FacesContext context , UIComponent component){
- StringBuffer styleClass = new StringBuffer();
- // Construct predefined classes
- Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
- Object parentPredefined = requestMap.get(AbstractRowsRenderer.SKIN_CELL_CLASS_KEY);
- if (null != parentPredefined) {
- styleClass.append(parentPredefined).append(" ");
- } else {
- styleClass.append("rich-table-cell ");
- }
- // Append class from parent component.
- Object parent = requestMap.get(AbstractRowsRenderer.CELL_CLASS_KEY);
- if (null != parent) {
- styleClass.append(parent).append(" ");
- }
- Object custom = component.getAttributes().get("styleClass");
- if (null != custom) {
- styleClass.append(custom);
- }
- return styleClass.toString();
- }
-
- protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
-
- super.doEncodeBegin(writer, context, component);
- java.lang.String clientId = component.getClientId(context);
- boolean isHeader = (styleClass(context, component)).contains("header");
- if(isHeader)
- {
- writer.startElement("th", component);
-
- }else{
-
- writer.startElement("td", component);
- }
-
-
- getUtils().writeAttribute(writer, "class", styleClass(context,component) );
- getUtils().writeAttribute(writer, "id", clientId );
- getUtils().encodeAttributesFromArray(context,component,new String[] {
- "abbr" ,
- "align" ,
- "axis" ,
- "bgcolor" ,
- "char" ,
- "charoff" ,
- "colspan" ,
- "dir" ,
- "headers" ,
- "height" ,
- "lang" ,
- "nowrap" ,
- "onclick" ,
- "ondblclick" ,
- "onkeydown" ,
- "onkeypress" ,
- "onkeyup" ,
- "onmousedown" ,
- "onmousemove" ,
- "onmouseout" ,
- "onmouseover" ,
- "onmouseup" ,
- "rowspan" ,
- "scope" ,
- "style" ,
- "title" ,
- "valign" ,
- "width" ,
- "xml:lang" });
-
- }
-
-
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- // TODO Auto-generated method stub
- super.doEncodeEnd(writer, context, component);
- boolean isHeader = (styleClass(context, component)).contains("header");
- if(isHeader)
- {
- writer.endElement("th");
-
- }else{
-
- writer.endElement("td");
- }
- }
-
- protected Class<? extends UIComponent> getComponentClass() {
-
- return UIColumn.class;
- }
-
-}
15 years, 2 months
JBoss Rich Faces SVN: r15730 - root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-10-20 08:14:05 -0400 (Tue, 20 Oct 2009)
New Revision: 15730
Added:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SimpleDataTableRendererBase.java
Log:
leave renderer specific html code in the SimpleDataTable, move common dataTables renderer code to AbstractDataTableRenderer
Added: 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 (rev 0)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2009-10-20 12:14:05 UTC (rev 15730)
@@ -0,0 +1,120 @@
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.Column;
+import org.richfaces.component.Row;
+import org.richfaces.component.UIDataTable;
+
+
+@ResourceDependencies({
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js")
+})
+public abstract class AbstractTableRenderer extends AbstractRowsRenderer {
+
+ public abstract void encodeTBody (FacesContext context, UIDataTable table) throws IOException;
+
+ public boolean isColumnFacetPresent(UIDataTable table, String facetName) {
+ Iterator<UIColumn> columns = table.columns();
+ boolean result = false;
+ while(columns.hasNext() && !result) {
+ UIColumn component = columns.next();
+ 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
+ * @param table - rendered UIDataTable
+ * @param attributeName - attribute name
+ * @return true if specified attribute should generate header on the table
+ */
+ public boolean isHeaderFactoryColumnAttributePresent(UIDataTable table,String attributeName) {
+ Iterator<UIColumn> columns = table.columns();
+ boolean result = false;
+ while (columns.hasNext() && !result) {
+ UIColumn component = columns.next();
+ result = (component.isRendered() && (null != component.getValueExpression(attributeName)));
+ }
+ return result;
+ }
+
+ protected boolean isEncodeHeaders(UIDataTable table) {
+ return isColumnFacetPresent(table, "header") ||
+ isHeaderFactoryColumnAttributePresent(table, "sortBy") ||
+ isHeaderFactoryColumnAttributePresent(table, "comparator") ||
+ isHeaderFactoryColumnAttributePresent(table, "filterBy");
+ }
+
+ protected int getColumnsCount(UIDataTable table) {
+ // check for exact value in component
+ Integer span = (Integer) table.getAttributes().get("columns");
+ int count = (null != span && span.intValue() != Integer.MIN_VALUE) ?
+ span.intValue() : calculateRowColumns(table.columns());
+ return count;
+ }
+
+ protected int calculateRowColumns(Iterator<UIColumn> col) {
+ int count = 0;
+ int currentLength = 0;
+ while (col.hasNext()) {
+ UIComponent component = (UIComponent) col.next();
+ if (component.isRendered()) {
+ if (component instanceof Row) {
+ // Store max calculated value of previsous rows.
+ if (currentLength > count) {
+ count = currentLength;
+ }
+ // Calculate number of columns in row.
+ currentLength = calculateRowColumns(((Row) component).columns());
+ // Store max calculated value
+ if (currentLength > count) {
+ count = currentLength;
+ }
+ currentLength = 0;
+ } else if (component instanceof Column) {
+ Column column = (Column) component;
+ // For new row, save length of previsous.
+ if (column.isBreakBefore()) {
+ if (currentLength > count) {
+ count = currentLength;
+ }
+ currentLength = 0;
+ }
+ Integer colspan = (Integer) component.getAttributes().get("colspan");
+ // Append colspan of this column
+ if (null != colspan && colspan.intValue() != Integer.MIN_VALUE) {
+ currentLength += colspan.intValue();
+ } else {
+ currentLength++;
+ }
+ } else if (component instanceof UIColumn) {
+ // UIColumn always have colspan == 1.
+ currentLength++;
+ }
+ }
+ }
+
+ if (currentLength > count) {
+ count = currentLength;
+ }
+ return count;
+ }
+
+ @Override
+ public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
+ encodeTBody(context, (UIDataTable) component);
+ }
+
+}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SimpleDataTableRendererBase.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SimpleDataTableRendererBase.java 2009-10-20 12:11:09 UTC (rev 15729)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SimpleDataTableRendererBase.java 2009-10-20 12:14:05 UTC (rev 15730)
@@ -16,14 +16,39 @@
import org.richfaces.component.UIDataTable;
@ResourceDependencies({
- @ResourceDependency(library = "javax.faces", name = "jsf.js"),
- @ResourceDependency(name = "jquery.js"),
- @ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "simple-datatable.js"),
- @ResourceDependency(name = "table.css")
+ @ResourceDependency(name = "simple-table.css")
})
+public abstract class SimpleDataTableRendererBase extends AbstractTableRenderer {
+
+ public static String [] CELL_ATTRIBUTES = {
+ "abbr" , "align" , "axis" , "bgcolor" , "char" , "charoff" , "colspan" , "dir" ,
+ "headers" , "height" , "lang" , "nowrap" , "onclick" , "ondblclick" , "onkeydown" ,
+ "onkeypress" , "onkeyup" , "onmousedown" , "onmousemove" , "onmouseout" , "onmouseover" ,
+ "onmouseup" , "rowspan" , "scope" , "style" , "title" , "valign" , "width" , "xml:lang" };
+
+
+ @Override
+ public void encodeCell(FacesContext context, UIComponent component) throws IOException {
+
+ ResponseWriter writer = context.getResponseWriter();
+
+ java.lang.String clientId = component.getClientId(context);
+ String styleClasses = cellStyleClass(context, component);
+ boolean isHeader = styleClasses.contains("header");
+
+ String element = isHeader ? HTML.th_ELEM : HTML.td_ELEM;
+ writer.startElement(element, component);
+
+ getUtils().writeAttribute(writer, "class",styleClasses);
+ getUtils().writeAttribute(writer, "id", clientId );
+ getUtils().encodeAttributesFromArray(context,component,CELL_ATTRIBUTES);
+
+ renderChildren(context, component);
-public abstract class SimpleDataTableRendererBase extends AbstractRowsRenderer {
+ writer.endElement(element);
+
+ }
public void encodeTableStructure(FacesContext context, UIDataTable table) throws IOException{
@@ -36,7 +61,9 @@
// Encode colgroup definition.
ResponseWriter writer = context.getResponseWriter();
writer.startElement("colgroup", table);
+
int columns = getColumnsCount(table);
+
writer.writeAttribute("span", String.valueOf(columns), null);
String columnsWidth = (String) table.getAttributes().get("columnsWidth");
@@ -57,112 +84,42 @@
table.restoreOrigValue(context);
}
- protected boolean isColumnRendered(UIComponent component) {
- try {
- return component.isRendered();
- } catch(Exception e){
- // DO nothing, rendered binded to row variable;
+ public void encodeCaption(FacesContext context, UIDataTable table) throws IOException {
+
+ UIComponent caption = table.getCaption();
+ if (caption == null) {
+ return;
}
- return true;
- }
-
- public boolean isColumnFacetPresent(UIDataTable table, String facetName) {
- Iterator<UIComponent> columns = table.columns();
- boolean result = false;
- while(columns.hasNext() && !result) {
- UIComponent component = columns.next();
- if(isColumnRendered(component)){
- if(null != component.getFacet(facetName)){
- result = true;
- }
- }
- }
- return result;
- }
-
- protected boolean isEncodeHeaders(UIDataTable table) {
- return isColumnFacetPresent(table, "header") ||
- isHeaderFactoryColumnAttributePresent(table, "sortBy") ||
- isHeaderFactoryColumnAttributePresent(table, "comparator") ||
- isHeaderFactoryColumnAttributePresent(table, "filterBy");
- }
-
- /**
- * Returns true if specified attribute (when present on the column)
- * should generate header even if it is not specified on the table
- * @param table - rendered UIDataTable
- * @param attributeName - attribute name
- * @return true if specified attribute should generate header on the table
- */
- public boolean isHeaderFactoryColumnAttributePresent(UIDataTable table,
- String attributeName) {
- Iterator<UIComponent> columns = table.columns();
- boolean result = false;
-
- while (columns.hasNext() && !result) {
- UIComponent column = columns.next();
- if (isColumnRendered(column)) {
- if (null != column.getValueExpression(attributeName)) {
- result = true;
- }
- }
- }
- return result;
- }
-
- protected void encodeHeaderFacets(FacesContext context, ResponseWriter writer, Iterator<UIComponent> headers,
- String skinCellClass, String headerClass, String facetName, String element, int colCount) throws IOException {
- int t_colCount = 0;
- HeaderEncodeStrategy richEncodeStrategy = new RichHeaderEncodeStrategy();
- HeaderEncodeStrategy simpleEncodeStrategy = new SimpleHeaderEncodeStrategy();
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement("caption", table);
- while (headers.hasNext()) {
- UIComponent column = (UIComponent) headers.next();
- if (!isColumnRendered(column)) {
- continue;
- }
-
- Integer colspan = (Integer) column.getAttributes().get("colspan");
- if (colspan != null && colspan.intValue() > 0) {
- t_colCount += colspan.intValue();
- } else {
- t_colCount++;
- }
-
- if (t_colCount > colCount) {
- break;
- }
-
- String classAttribute = facetName + "Class";
- String columnHeaderClass = (String) column.getAttributes().get(classAttribute);
-
- writer.startElement(element, column);
- encodeStyleClass(writer, null, skinCellClass, headerClass, columnHeaderClass);
- writer.writeAttribute("scope", "col", null);
- getUtils().encodeAttribute(context, column, "colspan");
-
- boolean sortableColumn = column.getValueExpression("comparator") != null
- || column.getValueExpression("sortBy") != null;
-
- HeaderEncodeStrategy strategy = (column instanceof org.richfaces.component.UIColumn
- && "header".equals(facetName)) ? richEncodeStrategy : simpleEncodeStrategy;
-
- strategy.encodeBegin(context, writer, column, facetName, sortableColumn);
-
- UIComponent facet = column.getFacet(facetName);
- if (facet != null && isColumnRendered(facet)) {
- renderChild(context, facet);
- }
-
- strategy.encodeEnd(context, writer, column, facetName, sortableColumn);
-
- writer.endElement(element);
+ String captionClass = (String) table.getAttributes().get("captionClass");
+ captionClass = captionClass != null ? "rich-table-caption " + captionClass : "rich-table-caption";
+ writer.writeAttribute("class", captionClass, "captionClass");
+
+ String captionStyle = (String) table.getAttributes().get("captionStyle");
+ if (captionStyle != null) {
+ writer.writeAttribute("style", captionStyle, "captionStyle");
}
+
+ renderChild(context, caption);
+
+ writer.endElement("caption");
+
}
+
+ @Override
+ public void doProcess(FacesContext facesContext, TableHolder holder) throws IOException {
+ UIDataTable table = holder.getTable();
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ writer.startElement(HTML.TR_ELEMENT, table);
+ encodeOneRow(facesContext, holder);
+ writer.endElement(HTML.TR_ELEMENT);
+ }
public void encodeHeader(FacesContext context, UIDataTable table, int columns) throws IOException {
-
UIComponent header = table.getHeader();
boolean isEncodeHeaders = isEncodeHeaders(table);
@@ -172,6 +129,7 @@
writer.startElement("thead", table);
writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-table-thead", null);
String headerClass = (String) table.getAttributes().get("headerClass");
+
if (header != null) {
encodeTableHeaderFacet(context, columns, writer, header,
"rich-table-header",
@@ -186,13 +144,14 @@
encodeHeaderFacets(context, writer, table.columns(), "rich-table-subheadercell", headerClass, "header", "th", columns);
writer.endElement("tr");
}
+
writer.endElement("thead");
}
}
public void encodeFooter(FacesContext context, UIDataTable table, int columns) throws IOException {
ResponseWriter writer = context.getResponseWriter();
- Iterator<UIComponent> tableColumns = table.columns();
+ Iterator<UIColumn> tableColumns = table.columns();
UIComponent footer = table.getFooter();
boolean columnFacetPresent = isColumnFacetPresent(table,"footer");
@@ -219,70 +178,87 @@
}
}
- protected int getColumnsCount(UIDataTable table) {
- int count = 0;
- // check for exact value in component
- Integer span = (Integer) table.getAttributes().get("columns");
- if (null != span && span.intValue() != Integer.MIN_VALUE) {
- count = span.intValue();
- } else {
- // calculate max html columns count for all columns/rows children.
- Iterator<UIComponent> col = table.columns();
- count = calculateRowColumns(col);
- }
- return count;
- }
-
- protected int calculateRowColumns(Iterator<UIComponent> col) {
- int count = 0;
- int currentLength = 0;
- while (col.hasNext()) {
- UIComponent component = (UIComponent) col.next();
- if (component.isRendered()) {
- if (component instanceof Row) {
- // Store max calculated value of previsous rows.
- if (currentLength > count) {
- count = currentLength;
- }
- // Calculate number of columns in row.
- currentLength = calculateRowColumns(((Row) component).columns());
- // Store max calculated value
- if (currentLength > count) {
- count = currentLength;
- }
- currentLength = 0;
- } else if (component instanceof Column) {
- Column column = (Column) component;
- // For new row, save length of previsous.
- if (column.isBreakBefore()) {
- if (currentLength > count) {
- count = currentLength;
- }
- currentLength = 0;
- }
- Integer colspan = (Integer) component.getAttributes().get("colspan");
- // Append colspan of this column
- if (null != colspan && colspan.intValue() != Integer.MIN_VALUE) {
- currentLength += colspan.intValue();
- } else {
- currentLength++;
- }
- } else if (component instanceof UIColumn) {
- // UIColumn always have colspan == 1.
- currentLength++;
- }
+ protected void encodeTableHeaderFacet(FacesContext context, int columns, ResponseWriter writer, UIComponent footer, String skinFirstRowClass, String skinRowClass, String skinCellClass, String footerClass, String element) throws IOException {
+ boolean isColgroup = footer instanceof Row;
+
+ if (!isColgroup) {
+ writer.startElement("tr", footer);
+ encodeStyleClass(writer, null, skinFirstRowClass, footerClass, null);
+ writer.startElement(element, footer);
+ encodeStyleClass(writer, null, skinCellClass, footerClass, null);
+
+ if (columns > 0) {
+ writer.writeAttribute("colspan", String.valueOf(columns), null);
}
+
+ writer.writeAttribute("scope", "colgroup", null);
}
- if (currentLength > count) {
- count = currentLength;
+ encodeCellChildren(context, footer, skinFirstRowClass, skinRowClass,
+ footerClass, skinCellClass, null);
+
+ if (!isColgroup) {
+ writer.endElement(element);
+ writer.endElement("tr");
}
- return count;
}
- @Override
- public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
- encodeTBody(context, (UIDataTable) component);
+ protected void encodeHeaderFacets(FacesContext context, ResponseWriter writer, Iterator<UIColumn> headers,
+ String skinCellClass, String headerClass, String facetName, String element, int colCount) throws IOException {
+ int t_colCount = 0;
+
+ // HeaderEncodeStrategy richEncodeStrategy = new
+ // RichHeaderEncodeStrategy();
+ // HeaderEncodeStrategy simpleEncodeStrategy = new
+ // SimpleHeaderEncodeStrategy();
+
+ while (headers.hasNext()) {
+ UIColumn column = (UIColumn) headers.next();
+ if (!column.isRendered()) {
+ continue;
+ }
+
+ Integer colspan = (Integer) column.getAttributes().get("colspan");
+ if (colspan != null && colspan.intValue() > 0) {
+ t_colCount += colspan.intValue();
+ } else {
+ t_colCount++;
+ }
+
+ if (t_colCount > colCount) {
+ break;
+ }
+
+ String classAttribute = facetName + "Class";
+ String columnHeaderClass = (String) column.getAttributes().get(classAttribute);
+
+ writer.startElement(element, column);
+ encodeStyleClass(writer, null, skinCellClass, headerClass,columnHeaderClass);
+ writer.writeAttribute("scope", "col", null);
+ getUtils().encodeAttribute(context, column, "colspan");
+
+ // boolean sortableColumn = column.getValueExpression("comparator")
+ // != null
+ // || column.getValueExpression("sortBy") != null;
+
+ // HeaderEncodeStrategy strategy = (column instanceof
+ // org.richfaces.component.UIColumn
+ // && "header".equals(facetName)) ? richEncodeStrategy :
+ // simpleEncodeStrategy;
+ //
+ // strategy.encodeBegin(context, writer, column, facetName,
+ // sortableColumn);
+
+ UIComponent facet = column.getFacet(facetName);
+ if (facet != null && facet.isRendered()) {
+ renderChild(context, facet);
+ }
+
+ // strategy.encodeEnd(context, writer, column, facetName,
+ // sortableColumn);
+
+ writer.endElement(element);
+ }
}
public void encodeTBody (FacesContext context, UIDataTable table) throws IOException {
@@ -294,92 +270,117 @@
writer.endElement("tbody");
}
+ protected String getRowSkinClasses(boolean firstColumn) {
+ String rowSkinClass = getRowSkinClass();
+ if (firstColumn) {
+ String firstRowSkinClass = getFirstRowSkinClass();
+ if (firstRowSkinClass != null && firstRowSkinClass.length() != 0) {
+ rowSkinClass = (rowSkinClass != null && rowSkinClass.trim().length() != 0) ?
+ rowSkinClass + " " + firstRowSkinClass : firstRowSkinClass;
+ }
+ }
+
+ return rowSkinClass;
+ }
+
@Override
public void encodeOneRow(FacesContext context, TableHolder holder) throws IOException {
- UIDataTable table = (UIDataTable) holder.getTable();
- ResponseWriter writer = context.getResponseWriter();
- Iterator<UIComponent> iter = table.columns();
-
boolean firstColumn = true;
boolean firstRow = (holder.getRowCounter() == 0);
-
int currentColumn = 0;
UIComponent column = null;
+
+ ResponseWriter writer = context.getResponseWriter();
+
+ UIDataTable table = (UIDataTable) holder.getTable();
+ Iterator<UIColumn> iter = table.columns();
+
while (iter.hasNext()) {
- column = (UIComponent) iter.next();
+ column = iter.next();
+ boolean isRow = (column instanceof Row);
+
// Start new row for first column - expect a case of the detail
// table, wich will be insert own row.
- if (firstColumn && !(column instanceof Row)) {
- String rowSkinClass = getRowSkinClass();
- if (firstRow) {
- String firstRowSkinClass = getFirstRowSkinClass();
- if (firstRowSkinClass != null && firstRowSkinClass.length() != 0) {
-
- if (rowSkinClass != null && rowSkinClass.length() != 0) {
- rowSkinClass += " " + firstRowSkinClass;
- } else {
- rowSkinClass = firstRowSkinClass;
- }
-
- }
- }
-
+ if (firstColumn && (!isRow)) {
+ String rowSkinClass = getRowSkinClasses(true);
encodeRowStart(context, rowSkinClass, holder.getRowClass(), table, writer);
}
+
if (column instanceof Column) {
- boolean breakBefore = ((Column) column).isBreakBefore()
- || column instanceof Row;
- if (breakBefore && !firstColumn) {
- // close current row
- writer.endElement(HTML.TR_ELEMENT);
- // reset columns counter.
- currentColumn = 0;
- // Start new row, expect a case of the detail table, wich
- // will be insert own row.
- if (!(column instanceof Row)) {
- holder.nextRow();
- encodeRowStart(context, holder.getRowClass(), table, writer);
- }
- }
+ currentColumn = encodeRichColumn(context, writer, holder, column, currentColumn, firstColumn, firstRow, isRow, iter.hasNext());
- encodeCellChildren(context, column,
- firstRow ? getFirstRowSkinClass() : null,
- getRowSkinClass(), holder.getRowClass(),
- getCellSkinClass(), holder.getColumnClass(currentColumn));
- // renderChild(context, column);
- if ((column instanceof Row) && iter.hasNext()) {
- // Start new row for remained columns.
- holder.nextRow();
- encodeRowStart(context, holder.getRowClass(), table, writer);
- // reset columns counter.
- currentColumn = -1;
- }
} else if (column.isRendered()) {
- // UIColumn don't have own renderer
- writer.startElement(HTML.td_ELEM, table);
- getUtils().encodeId(context, column);
- String columnClass = holder.getColumnClass(currentColumn);
- encodeStyleClass(writer, null, getCellSkinClass(), null, columnClass);
-
- // TODO - encode column attributes.
- renderChildren(context, column);
- writer.endElement(HTML.td_ELEM);
+ currentColumn = encodeColumn(context, writer, column, currentColumn, holder);
}
+
currentColumn++;
firstColumn = false;
}
+
// Close row if then is open.
if (!firstColumn && !(column instanceof Row)) {
writer.endElement(HTML.TR_ELEMENT);
}
+
}
-
- protected void encodeRowStart(FacesContext context, String rowClass, UIDataTable table, ResponseWriter writer) throws IOException {
- encodeRowStart(context, getRowSkinClass(), rowClass, table, writer);
+
+ protected int encodeRichColumn(FacesContext context, ResponseWriter writer,
+ TableHolder holder, UIComponent column, int currentColumn,
+ boolean firstColumn, boolean firstRow, boolean isRow,
+ boolean hasNext) throws IOException {
+
+ UIDataTable table = holder.getTable();
+ boolean breakBefore = ((Column) column).isBreakBefore() || isRow;
+
+ if (breakBefore && !firstColumn) {
+ // close current row
+ writer.endElement(HTML.TR_ELEMENT);
+ // reset columns counter.
+ currentColumn = 0;
+ // Start new row, expect a case of the detail table, wich
+ // will be insert own row.
+ if (!isRow) {
+ holder.nextRow();
+ encodeRowStart(context, getRowSkinClass(),
+ holder.getRowClass(), table, writer);
+ }
+ }
+
+ String firstRowSkinClass = firstRow ? getFirstRowSkinClass() : null;
+
+ encodeCellChildren(context, column, firstRowSkinClass,
+ getRowSkinClass(), holder.getRowClass(), getCellSkinClass(),
+ holder.getColumnClass(currentColumn));
+ // renderChild(context, column);
+ if (isRow && hasNext) {
+ // Start new row for remained columns.
+ holder.nextRow();
+ encodeRowStart(context, getRowSkinClass(), holder.getRowClass(),
+ table, writer);
+ // reset columns counter.
+ currentColumn = -1;
+ }
+
+ return currentColumn;
}
-
+ protected int encodeColumn(FacesContext context, ResponseWriter writer,
+ UIComponent column, int currentColumn, TableHolder holder)
+ throws IOException {
+ // UIColumn don't have own renderer
+ UIDataTable table = holder.getTable();
+ writer.startElement(HTML.td_ELEM, table);
+ getUtils().encodeId(context, column);
+ String columnClass = holder.getColumnClass(currentColumn);
+ encodeStyleClass(writer, null, getCellSkinClass(), null, columnClass);
+
+ // TODO - encode column attributes.
+ renderChildren(context, column);
+ writer.endElement(HTML.td_ELEM);
+
+ return currentColumn;
+ }
/**
* @return
*/
@@ -407,18 +408,7 @@
encodeRowEvents(context, table);
}
-// private void encodeRowStart(ResponseWriter writer, UIColumn column) throws IOException {
-// writer.startElement(HTML.td_ELEM, column);
-// }
-//
-// private void encodeRowEnd(ResponseWriter writer, UIColumn column) throws IOException {
-// writer.endElement(HTML.td_ELEM);
-// }
-//
-// private void encodeRow(FacesContext facesContext, ResponseWriter writer, UIColumn column) throws IOException {
-// renderChildren(facesContext, column);
-// }
-
+/*
protected class SimpleHeaderEncodeStrategy implements HeaderEncodeStrategy {
public void encodeBegin(FacesContext context, ResponseWriter writer,
@@ -449,5 +439,5 @@
}
}
-
+*/
}
15 years, 2 months
JBoss Rich Faces SVN: r15729 - root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-10-20 08:11:09 -0400 (Tue, 20 Oct 2009)
New Revision: 15729
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/TableHolder.java
Log:
UIDataAdaptor -> UIDataTable
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/TableHolder.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/TableHolder.java 2009-10-20 07:02:30 UTC (rev 15728)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/TableHolder.java 2009-10-20 12:11:09 UTC (rev 15729)
@@ -23,7 +23,6 @@
import java.util.Map;
-import org.richfaces.component.UIDataAdaptor;
import org.richfaces.component.UIDataTable;
/**
@@ -59,7 +58,7 @@
/**
* @return the table
*/
- public UIDataAdaptor getTable() {
+ public UIDataTable getTable() {
return this.table;
}
15 years, 2 months
JBoss Rich Faces SVN: r15728 - branches/community/3.3.X/samples/richfaces-demo/functional-test.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-10-20 03:02:30 -0400 (Tue, 20 Oct 2009)
New Revision: 15728
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml
Log:
- rf-demo ftest - completed support for tomcat6x in maven build (JBQA-2616)
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml 2009-10-20 02:02:24 UTC (rev 15727)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml 2009-10-20 07:02:30 UTC (rev 15728)
@@ -336,13 +336,15 @@
<container.installer.url>http://www.apache.org/dist/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0....</container.installer.url>
</properties>
<build>
- <plugins>
+ <plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0-beta-2</version>
<configuration>
<configuration>
+ <home>${container.home}</home>
+ <type>existing</type>
</configuration>
</configuration>
</plugin>
15 years, 2 months