Author: ekoneil
Date: Wed Apr 20 16:18:00 2005
New Revision: 162088

URL: http://svn.apache.org/viewcvs?rev=162088&view=rev
Log:
Code cleanup from last checkin.  Also incluldes fixes to the localRelease 
method.

BB: self
BVT: NetUI pass 


Modified:
    
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/cellrepeater/CellRepeater.java

Modified: 
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/cellrepeater/CellRepeater.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/cellrepeater/CellRepeater.java?rev=162088&r1=162087&r2=162088&view=diff
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/cellrepeater/CellRepeater.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/cellrepeater/CellRepeater.java
 Wed Apr 20 16:18:00 2005
@@ -278,6 +278,8 @@
      * @netui:attribute required="false"
      */
     public void setCellClass(String cellClass) {
+        if("".equals(cellClass))
+            return;
         _cellClass = cellClass;
     }
 
@@ -304,6 +306,8 @@
      * @netui:attribute required="false"
      */
     public void setAlternatingCellClass(String alternatingCellClass) {
+        if("".equals(alternatingCellClass))
+            return;
         _altCellClass = alternatingCellClass;
     }
 
@@ -369,6 +373,52 @@
     }
 
     /**
+     * Sets the tag's data source (can be an expression).
+     * @param dataSource - the data source
+     * @jsptagref.attributedescription <p>The <code>dataSource</code> 
attribute determines both
+     * (1) the source of populating data for the tag and
+     * (2) the object to which the tag submits data.
+     *
+     * <p>For example, assume that the Controller file (= JPF file) contains
+     * a Form Bean with the property foo.  Then the following 
&lt;netui:textBox> tag will
+     * (1) draw populating data from the Form Bean's foo property and (2)
+     * submit user defined data to the same property.
+     *
+     * <p>&nbsp;&nbsp;&nbsp;&nbsp;<code>&lt;netui:textBox 
dataSource="{actionForm.foo}" /></code>
+     *
+     * <p>The <code>dataSource</code> attribute takes either a data binding 
expression or
+     * the name of a Form Bean property.  In the
+     * above example, <code>&lt;netui:textBox dataSource="foo" /></code>
+     * would have the exactly same behavior.
+     *
+     * <p>When the tag is used to submit data, the data binding expression must
+     * refer to a Form Bean property.
+     * In cases where the tag is not used to submit data, but is used for
+     * displaying data only, the data
+     * binding expression need not refer to a Form Bean property.  For example,
+     * assume that myIterativeData is a member variable on
+     * the Controller file ( = JPF file).  The following 
&lt;netui-data:repeater>
+     * tag draws its data from myIterativeData.
+     *
+     * <p>&nbsp;&nbsp;&nbsp;&nbsp;<code>&lt;netui-data:repeater 
dataSource="{pageFlow.myIterativeData}"></code>
+     * @jsptagref.databindable Read / Write
+     * @jsptagref.attributesyntaxvalue <i>expression_datasource</i>
+     * @netui:attribute required="true"
+     * @netui.tldx:attribute language="netuiel"
+     */
+    public void setDataSource(String dataSource) {
+        _dataSource = dataSource;
+    }
+
+    /**
+     * Gets the tag's data source (can be an expression).
+     * @return the data source
+     */
+    public String getDataSource() {
+        return "{" + _dataSource + "}";
+    }
+
+    /**
      * Prepare to render the dataset that was specified in the dataSource 
attribute.  The
      * dataSource expression is evaluated and the table's dimensions are 
computed.  If
      * there is no data in the dataset but the rows and columns attributes 
were specified,
@@ -431,7 +481,7 @@
         if(hasErrors())
             return SKIP_BODY;
 
-        renderTableTag(_appender, _tableState);
+        openTableTag(_appender, _tableState);
 
         _currentRow = 0;
         _currentColumn = 0;
@@ -440,30 +490,21 @@
 
         boolean item = ensureItem(0, _dataList);
         if(item) {
-            renderRowTag(_appender, _trState);
-            renderCellTag(_appender, _currentColumn + (_currentRow % 2 == 0 ? 
0 : 1));
-/*
-            addContent(renderRowTag());
-            addContent(renderCellTag(_currentColumn + (_currentRow % 2 == 0 ? 
0 : 1)));
-*/
+            openRowTag(_appender, _trState);
+            openCellTag(_appender, _currentColumn + (_currentRow % 2 == 0 ? 0 
: 1));
             return EVAL_BODY_BUFFERED;
         }
         else {
             // special case -- with no items, render the entire table here
             for(int i = 0; i < _rows; i++) {
-                renderRowTag(_appender, _trState);
+                openRowTag(_appender, _trState);
                 for(int j = 0; j < _columns; j++) {
-                    renderCellTag(_appender, computeStyleIndex(i, j));
+                    openCellTag(_appender, computeStyleIndex(i, j));
                     _appender.append("&nbsp;");
                     _tdRenderer.doEndTag(_appender);
-/*
-                    addContent("&nbsp;");
-                    addContent("</td>");
-*/
                 }
                 _trRenderer.doEndTag(_appender);
                 _appender.append("\n");
-                //addContent("</tr>\n");
             }
             _currentRow = _rows;
             _currentColumn = _columns;
@@ -507,8 +548,7 @@
                 return SKIP_BODY;
 
             if(_currentColumn == 0)
-                renderRowTag(_appender, _trState != null ? _trState : 
TR_STATE);
-                //addContent((renderRowTag()));
+                openRowTag(_appender, _trState != null ? _trState : TR_STATE);
 
             if(_verticalRepeat)
                 haveNext = ensureItem(_currentColumn * _rows + _currentRow, 
_dataList);
@@ -519,18 +559,11 @@
                 LOGGER.debug("missing next at location (" + _currentRow + ", " 
+ _currentColumn + ")");
 
                 // render empty cell
-                renderCellTag(_appender, computeStyleIndex(_currentRow,  
_currentColumn)) ;
+                openCellTag(_appender, computeStyleIndex(_currentRow,  
_currentColumn)) ;
                 _appender.append("&nbsp;");
-/*
-                addContent(renderCellTag(computeStyleIndex(_currentRow, 
_currentColumn)));
-                addContent("&nbsp;");
-*/
             }
             else {
-                renderCellTag(_appender, computeStyleIndex(_currentRow,  
_currentColumn)) ;
-/*
-                addContent(renderCellTag(computeStyleIndex(_currentRow, 
_currentColumn)));
-*/
+                openCellTag(_appender, computeStyleIndex(_currentRow,  
_currentColumn)) ;
                 return EVAL_BODY_AGAIN;
             }
         }
@@ -630,6 +663,7 @@
      */
     protected void localRelease() {
         super.localRelease();
+
         if(bodyContent != null)
             bodyContent.clearBody();
 
@@ -647,13 +681,16 @@
         if(_tdState != null)
             _tdState.clear();
         if(_trState != null)
-            _trState = null;
+            _trState.clear();
         if(_tableState != null)
-            _tableState = null;
+            _tableState.clear();
 
         _tableRenderer = null;
         _tdRenderer = null;
         _trRenderer = null;
+
+        _sb = null;
+        _appender = null;
     }
 
     private void reportBasicError(String message)
@@ -698,38 +735,19 @@
         }
     }
 
-    private final void renderTableTag(AbstractRenderAppender appender, 
TableTag.State tableState) {
+    private final void openTableTag(AbstractRenderAppender appender, 
TableTag.State tableState) {
         if(tableState == null)
             tableState = TABLE_STATE;
         _tableRenderer.doStartTag(appender, tableState);
-/*
-        if(_styleContext == null)
-            return "<table>";
-
-        InternalStringBuilder buf = new InternalStringBuilder("<table");
-        buf.append(_styleContext.renderTableStyle());
-        buf.append(">");
-        return buf.toString();
-*/
     }
 
-    private final void renderRowTag(AbstractRenderAppender appender, 
TrTag.State trState) {
+    private final void openRowTag(AbstractRenderAppender appender, TrTag.State 
trState) {
         if(trState == null)
             trState = TR_STATE;
         _trRenderer.doStartTag(appender, trState);
-/*
-        if(_styleContext == null)
-            return "<tr>";
-
-        InternalStringBuilder buf = new InternalStringBuilder("<tr");
-        buf.append(_styleContext.renderRowStyle());
-        buf.append(">");
-
-        return buf.toString();
-*/
     }
 
-    private final void renderCellTag(AbstractRenderAppender appender, int 
index) {
+    private final void openCellTag(AbstractRenderAppender appender, int index) 
{
         TdTag.State tdState = TD_STATE;
         /* todo: need to clear the TdTag.State here rather than recreate */
         if(_cellClass != null) {
@@ -742,20 +760,6 @@
         _tdRenderer.doStartTag(appender, tdState);
     }
 
-/*
-        if(_styleContext == null)
-            return "<td>";
-
-        InternalStringBuilder buf = new InternalStringBuilder("<td");
-        if(index % 2 == 0)
-            buf.append(_styleContext.renderCellStyle());
-        else
-            buf.append(_styleContext.renderAlternatingCellStyle());
-        buf.append(">");
-
-        return buf.toString();
-*/
-
     private final int computeStyleIndex(int r, int c) {
         return c + (r % 2);
     }
@@ -780,52 +784,6 @@
      */
     protected List getNamingChain() {
         return AbstractClassicTag.DefaultNamingChain;
-    }
-
-    /**
-     * Sets the tag's data source (can be an expression).
-     * @param dataSource - the data source
-     * @jsptagref.attributedescription <p>The <code>dataSource</code> 
attribute determines both
-     * (1) the source of populating data for the tag and
-     * (2) the object to which the tag submits data.
-     *
-     * <p>For example, assume that the Controller file (= JPF file) contains
-     * a Form Bean with the property foo.  Then the following 
&lt;netui:textBox> tag will
-     * (1) draw populating data from the Form Bean's foo property and (2)
-     * submit user defined data to the same property.
-     *
-     * <p>&nbsp;&nbsp;&nbsp;&nbsp;<code>&lt;netui:textBox 
dataSource="{actionForm.foo}" /></code>
-     *
-     * <p>The <code>dataSource</code> attribute takes either a data binding 
expression or
-     * the name of a Form Bean property.  In the
-     * above example, <code>&lt;netui:textBox dataSource="foo" /></code>
-     * would have the exactly same behavior.
-     *
-     * <p>When the tag is used to submit data, the data binding expression must
-     * refer to a Form Bean property.
-     * In cases where the tag is not used to submit data, but is used for
-     * displaying data only, the data
-     * binding expression need not refer to a Form Bean property.  For example,
-     * assume that myIterativeData is a member variable on
-     * the Controller file ( = JPF file).  The following 
&lt;netui-data:repeater>
-     * tag draws its data from myIterativeData.
-     *
-     * <p>&nbsp;&nbsp;&nbsp;&nbsp;<code>&lt;netui-data:repeater 
dataSource="{pageFlow.myIterativeData}"></code>
-     * @jsptagref.databindable Read / Write
-     * @jsptagref.attributesyntaxvalue <i>expression_datasource</i>
-     * @netui:attribute required="true"
-     * @netui.tldx:attribute language="netuiel"
-     */
-    public void setDataSource(String dataSource) {
-        _dataSource = dataSource;
-    }
-
-    /**
-     * Gets the tag's data source (can be an expression).
-     * @return the data source
-     */
-    public String getDataSource() {
-        return "{" + _dataSource + "}";
     }
 
     /**


Reply via email to