Author: abelevich
Date: 2009-11-05 09:25:51 -0500 (Thu, 05 Nov 2009)
New Revision: 15839
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlColumn.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SimpleDataTableRenderer.java
Log:
add breakBefore, rospan, colspan
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java 2009-11-05
13:45:22 UTC (rev 15838)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java 2009-11-05
14:25:51 UTC (rev 15839)
@@ -2,5 +2,13 @@
public abstract class UIColumn extends javax.faces.component.UIColumn implements Column
{
+
+ public abstract int getRowspan();
+ public abstract void setRowspan(int rowspan);
+
+ public abstract int getColspan();
+ public abstract void setColspan(int colspan);
+
+
}
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlColumn.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlColumn.java 2009-11-05
13:45:22 UTC (rev 15838)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlColumn.java 2009-11-05
14:25:51 UTC (rev 15839)
@@ -6,9 +6,44 @@
import org.richfaces.model.Ordering;
public class HtmlColumn extends UIColumn {
+
+ enum PropertyKeys {
+ breakBefore, rowspan, colspan
+ }
+
public static final String COMPONENT_TYPE = "org.richfaces.Column";
public static final String COMPONENT_FAMILY = "org.richfaces.Column";
+
+ public void setBreakBefore(boolean breakBefore) {
+ getStateHelper().put(PropertyKeys.breakBefore, Boolean.valueOf(breakBefore));
+ }
+
+ public boolean isBreakBefore() {
+ Boolean breakBefore = ((Boolean)getStateHelper().eval(PropertyKeys.breakBefore,
Boolean.FALSE));
+ return breakBefore.booleanValue();
+ }
+
+ public int getColspan(){
+ Integer colspan = (Integer)getStateHelper().eval(PropertyKeys.colspan,
Integer.MIN_VALUE);
+ return colspan.intValue();
+ }
+
+ public void setColspan(int colspan) {
+ getStateHelper().put(PropertyKeys.colspan, Integer.valueOf(colspan));
+ }
+
+ public int getRowspan(){
+ Integer rowspan = (Integer)getStateHelper().eval(PropertyKeys.rowspan,
Integer.MIN_VALUE);
+ return rowspan.intValue();
+ }
+
+ public void setRowspan(int rowspan) {
+ getStateHelper().put(PropertyKeys.rowspan, Integer.valueOf(rowspan));
+ }
+
+
+
public MethodExpression getFilterMethod() {
// TODO Auto-generated method stub
return null;
@@ -24,10 +59,7 @@
// TODO Auto-generated method stub
return null;
}
- public boolean isBreakBefore() {
- // TODO Auto-generated method stub
- return false;
- }
+
public boolean isSelfSorted() {
// TODO Auto-generated method stub
return false;
@@ -36,10 +68,6 @@
// TODO Auto-generated method stub
return false;
}
- public void setBreakBefore(boolean newBreakBefore) {
- // TODO Auto-generated method stub
-
- }
public void setFilterMethod(MethodExpression methodExpression) {
// TODO Auto-generated method stub
@@ -63,5 +91,5 @@
public void setSortable(boolean sortable) {
// TODO Auto-generated method stub
}
-
+
}
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SimpleDataTableRenderer.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SimpleDataTableRenderer.java 2009-11-05
13:45:22 UTC (rev 15838)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SimpleDataTableRenderer.java 2009-11-05
14:25:51 UTC (rev 15839)
@@ -102,6 +102,15 @@
} else if(child instanceof UIColumn) {
+ if(child instanceof org.richfaces.component.UIColumn) {
+ org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn)child;
+ if(column.isBreakBefore() && processCell !=0) {
+ encodeRowEnd(writer, context, column);
+ rowHolder.nextRow();
+ rowStart = true;
+ }
+ }
+
if(rowStart) {
if(processRow == 0) {
@@ -125,6 +134,7 @@
}
processCell++;
}
+
}
}
@@ -180,6 +190,20 @@
writer.startElement(HTML.TD_ELEM, component);
String cellClass = holder.getCellClass();
encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, cellClass);
+
+ if(component instanceof org.richfaces.component.UIColumn) {
+ org.richfaces.component.UIColumn column =
(org.richfaces.component.UIColumn)component;
+
+ int rowspan = column.getRowspan();
+ if(rowspan != Integer.MIN_VALUE) {
+ writer.writeAttribute("rowspan", Integer.valueOf(rowspan), null);
+ }
+
+ int colspan = column.getColspan();
+ if(colspan != Integer.MIN_VALUE) {
+ writer.writeAttribute("colspan", Integer.valueOf(colspan), null);
+ }
+ }
renderChildren(context, component);
}
@@ -273,7 +297,7 @@
//TODO nick - rename method "encodeHeaderFacets"
encodeHeaderFacets(context, writer, tableColumns,
"rich-table-subfootercell",
footerClass, "footer", HTML.TD_ELEM, columns);
- writer.endElement("tr");
+ writer.endElement(HTML.TR_ELEMENT);
}
@@ -319,7 +343,7 @@
writer.endElement(HTML.TR_ELEMENT);
}
- writer.endElement("thead");
+ writer.endElement(HTML.THEAD_ELEMENT);
}
}
@@ -363,7 +387,7 @@
renderChild(context, footer);
writer.endElement(element);
- writer.endElement("tr");
+ writer.endElement(HTML.TR_ELEMENT);
}
}