Author: mmarinschek
Date: Thu Dec 7 09:49:35 2006
New Revision: 483569
URL: http://svn.apache.org/viewvc?view=rev&rev=483569
Log:
added inBodyStart hook for overriding attributes of body (i.e. style and
styleClass)
Modified:
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/ext/HtmlDataTable.java
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlTableRenderer.java
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlDataTableTag.java
Modified:
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
URL:
http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java?view=diff&rev=483569&r1=483568&r2=483569
==============================================================================
---
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
(original)
+++
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
Thu Dec 7 09:49:35 2006
@@ -129,6 +129,7 @@
HtmlRendererUtils.writePrettyLineSeparator(facesContext);
writer.startElement(HTML.TBODY_ELEM, component);
writer.writeAttribute(HTML.ID_ATTR,
component.getClientId(facesContext)+":tbody_element", null);
+ inBodyStart(facesContext, (UIData) component);
encodeInnerHtml(facesContext, component);
@@ -316,8 +317,8 @@
* @param writer the <code>ResponseWriter</code>.
* @param uiData the <code>UIData</code> being rendered.
* @param component the <code>UIComponent</code> to render.
- * @param columnStyleIterator the styleClass of the <code>UIColumn</code> or
<code>null</code> if
- * there is none.
+ * @param styles the styleClasses of rows and columns
+ * @param columnStyleIndex the index of the column
* @throws IOException if an exception occurs.
*/
protected void renderColumnBody(
@@ -342,7 +343,8 @@
* @param facesContext the <code>FacesContext</code>.
* @param writer the <code>ResponseWriter</code>.
* @param uiData the <code>UIData</code> being rendered.
- * @param rowStyleIterator te styleClass of the row or <code>null</code>
if there is none.
+ * @param styles the styleClasses of rows and columns
+ * @param rowStyleIndex the index of the row
* @throws IOException if an exceptoin occurs.
*/
protected void renderRowStart(
@@ -392,6 +394,7 @@
*
* @param facesContext the <code>FacesContext</code>.
* @param uiData the <code>UIData</code> being rendered.
+ * @throws java.io.IOException
*/
protected void beforeTable(FacesContext facesContext, UIData uiData)
throws IOException
{
@@ -478,6 +481,17 @@
protected void afterColumnHeaderOrFooter(FacesContext facesContext, UIData
uiData, boolean header, int columnIndex) throws IOException
{
}
+
+ /**
+ * Perform any operations necessary in the TBODY start tag.
+ *
+ * @param facesContext the <code>FacesContext</code>.
+ * @param uiData the <code>UIData</code> being rendered.
+ */
+ protected void inBodyStart(FacesContext facesContext, UIData uiData)
throws IOException
+ {
+ }
+
/**
* Perform any operations necessary immediately after the TBODY end tag
* is output.
Modified:
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/ext/HtmlDataTable.java
URL:
http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/ext/HtmlDataTable.java?view=diff&rev=483569&r1=483568&r2=483569
==============================================================================
---
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/ext/HtmlDataTable.java
(original)
+++
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/ext/HtmlDataTable.java
Thu Dec 7 09:49:35 2006
@@ -95,6 +95,8 @@
private String _rowGroupStyle = null;
private String _rowGroupStyleClass = null;
private String _varDetailToggler = null;
+ private String _bodyStyleClass = null;
+ private String _bodyStyle = null;
private int _sortColumnIndex = -1;
@@ -769,7 +771,7 @@
{
boolean preserveSort = isPreserveSort();
- Object values[] = new Object[34];
+ Object values[] = new Object[36];
values[0] = super.saveState(context);
values[1] = _preserveDataModel;
@@ -817,6 +819,8 @@
values[32] = new Integer(_newspaperColumns);
values[33] = _newspaperOrientation;
+ values[34] = _bodyStyle;
+ values[35] = _bodyStyleClass;
return values;
}
@@ -947,6 +951,8 @@
_sortColumnIndex = values[31] != null ? ((Integer)
values[31]).intValue() : -1;
_newspaperColumns = ((Integer) values[32]).intValue();
_newspaperOrientation = (String) values[33];
+ _bodyStyle = (String) values[34];
+ _bodyStyleClass = (String) values[35];
}
public _SerializableDataModel getSerializableDataModel()
@@ -1317,12 +1323,41 @@
public String getRowGroupStyleClass()
{
- return _rowGroupStyleClass;
+ if (_rowGroupStyleClass != null)
+ return _rowGroupStyleClass;
+ ValueBinding vb = getValueBinding("rowGroupStyleClass");
+ return vb != null ? (String) vb.getValue(getFacesContext()) : null;
}
public void setRowGroupStyleClass(String rowGroupStyleClass)
{
_rowGroupStyleClass = rowGroupStyleClass;
+ }
+
+ public String getBodyStyle()
+ {
+ if (_bodyStyle != null)
+ return _bodyStyle;
+ ValueBinding vb = getValueBinding("bodyStyle");
+ return vb != null ? (String) vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setBodyStyle(String bodyStyle)
+ {
+ _bodyStyle = bodyStyle;
+ }
+
+ public String getBodyStyleClass()
+ {
+ if (_bodyStyleClass != null)
+ return _bodyStyleClass;
+ ValueBinding vb = getValueBinding("bodyStyleClass");
+ return vb != null ? (String) vb.getValue(getFacesContext()) : null;
+ }
+
+ public void setBodyStyleClass(String bodyStyleClass)
+ {
+ _bodyStyleClass = bodyStyleClass;
}
public HtmlDataTable()
Modified:
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlTableRenderer.java
URL:
http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlTableRenderer.java?view=diff&rev=483569&r1=483568&r2=483569
==============================================================================
---
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlTableRenderer.java
(original)
+++
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlTableRenderer.java
Thu Dec 7 09:49:35 2006
@@ -63,6 +63,8 @@
/** DetailStamp facet name. */
public static final String DETAIL_STAMP_FACET_NAME = "detailStamp";
+ private static final String BODY_STYLE_CLASS = "bodyStyleClass";
+ private static final String BODY_STYLE = "bodyStyle";
/**
* @param component dataTable
@@ -923,4 +925,32 @@
}
return false;
}
+
+
+ /**
+ * Perform any operations necessary in the TBODY start tag.
+ *
+ * @param facesContext the <code>FacesContext</code>.
+ * @param uiData the <code>UIData</code> being rendered.
+ */
+ protected void inBodyStart(FacesContext facesContext, UIData uiData)
throws IOException
+ {
+ String bodyStyleClass;
+ String bodyStyle;
+
+ if(uiData instanceof HtmlDataTable) {
+ bodyStyleClass = ((HtmlDataTable)uiData).getBodyStyleClass();
+ bodyStyle = ((HtmlDataTable)uiData).getBodyStyle();
+ } else {
+ bodyStyleClass =
(String)uiData.getAttributes().get(BODY_STYLE_CLASS);
+ bodyStyle = (String)uiData.getAttributes().get(BODY_STYLE);
+ }
+
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.writeAttribute(HTML.CLASS_ATTR, bodyStyleClass,
BODY_STYLE_CLASS);
+ writer.writeAttribute(HTML.STYLE_ATTR, bodyStyle, BODY_STYLE);
+ }
+
+
+
}
Modified:
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlDataTableTag.java
URL:
http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlDataTableTag.java?view=diff&rev=483569&r1=483568&r2=483569
==============================================================================
---
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlDataTableTag.java
(original)
+++
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlDataTableTag.java
Thu Dec 7 09:49:35 2006
@@ -77,6 +77,9 @@
private String _rowGroupStyle;
private String _rowGroupStyleClass;
+ private String _bodyStyle;
+ private String _bodyStyleClass;
+
/** the number of newspaper columns */
private String _newspaperColumns = null;
/** the orientation of the newspaper table - horizontal/vertical */
@@ -120,6 +123,9 @@
_newspaperColumns = null;
_newspaperOrientation = null;
+
+ _bodyStyle = null;
+ _bodyStyleClass = null;
}
protected void setProperties(UIComponent component)
@@ -158,6 +164,9 @@
setStringProperty(component, "rowGroupStyle", _rowGroupStyle);
setStringProperty(component, "rowGroupStyleClass",
_rowGroupStyleClass);
+ setStringProperty(component, "bodyStyle", _bodyStyle);
+ setStringProperty(component, "bodyStyleClass", _bodyStyleClass);
+
setIntegerProperty(component,
HtmlDataTable.NEWSPAPER_COLUMNS_PROPERTY, _newspaperColumns);
setStringProperty(component,
HtmlDataTable.NEWSPAPER_ORIENTATION_PROPERTY, _newspaperOrientation);
}
@@ -322,5 +331,12 @@
public void setNewspaperOrientation(String newspaperOrientation) {
this._newspaperOrientation = newspaperOrientation;
}
-
+
+ public String getBodyStyle() {
+ return _bodyStyle;
+ }
+
+ public String getBodyStyleClass() {
+ return _bodyStyleClass;
+ }
}