tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mindbri...@apache.org
Subject cvs commit: jakarta-tapestry/framework/src/org/apache/tapestry Tapestry.java
Date Wed, 07 Jan 2004 20:29:55 GMT
mindbridge    2004/01/07 12:29:55

  Modified:    contrib/src/org/apache/tapestry/contrib/table/components
                        TableFormRows.java TableColumns.java
                        TableFormRows.jwc FormTable.jwc Table.jwc
                        TableColumns.jwc
               framework/src/org/apache/tapestry Tapestry.java
  Log:
  Minor performance improvements and fixes
  
  Revision  Changes    Path
  1.3       +17 -4     jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/table/components/TableFormRows.java
  
  Index: TableFormRows.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/table/components/TableFormRows.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TableFormRows.java	7 Jan 2004 01:12:59 -0000	1.2
  +++ TableFormRows.java	7 Jan 2004 20:29:54 -0000	1.3
  @@ -117,14 +117,27 @@
    */
   public abstract class TableFormRows extends TableRows
   {
  -    //public abstract IPrimaryKeyConvertor getConvertor();
  +    public abstract IPrimaryKeyConvertor getConvertor();
       public abstract IPrimaryKeyConvertor getConvertorCache();
  +    public abstract void setConvertorCache(IPrimaryKeyConvertor convertor);
       public abstract Map getConvertedValues();
       
  +    public IPrimaryKeyConvertor getCachedConvertor()
  +    {
  +        IPrimaryKeyConvertor objConvertor = getConvertorCache();
  +        
  +        if (objConvertor == null) {
  +            objConvertor = getConvertor();
  +            setConvertorCache(objConvertor);
  +        }
  +        
  +        return objConvertor;
  +    }
  +    
       public Iterator getConvertedTableRowsIterator()
       {
           final Iterator objTableRowsIterator = getTableRowsIterator(); 
  -        final IPrimaryKeyConvertor objConvertor = getConvertorCache();
  +        final IPrimaryKeyConvertor objConvertor = getCachedConvertor();
           if (objConvertor == null)
               return objTableRowsIterator;
               
  @@ -155,7 +168,7 @@
       {
           Object objValue = objConvertedTableRow;
   
  -        IPrimaryKeyConvertor objConvertor = getConvertorCache();
  +        IPrimaryKeyConvertor objConvertor = getCachedConvertor();
           if (objConvertor != null) {
               IRequestCycle objCycle = getPage().getRequestCycle();
               if (objCycle.isRewinding()) {
  
  
  
  1.4       +7 -116    jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/table/components/TableColumns.java
  
  Index: TableColumns.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/table/components/TableColumns.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TableColumns.java	21 May 2003 23:40:22 -0000	1.3
  +++ TableColumns.java	7 Jan 2004 20:29:54 -0000	1.4
  @@ -64,8 +64,6 @@
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.contrib.table.model.ITableColumn;
   import org.apache.tapestry.contrib.table.model.ITableColumnModel;
  -import org.apache.tapestry.event.PageDetachListener;
  -import org.apache.tapestry.event.PageEvent;
   
   /**
    * A low level Table component that renders the column headers in the table.
  @@ -130,7 +128,7 @@
    * @version $Id$
    *
    */
  -public class TableColumns extends AbstractTableViewComponent implements PageDetachListener
  +public abstract class TableColumns extends AbstractTableViewComponent
   {
       public static final String TABLE_COLUMN_ARROW_UP_ATTRIBUTE = 
           "org.apache.tapestry.contrib.table.components.TableColumns.arrowUp";
  @@ -138,35 +136,15 @@
       public static final String TABLE_COLUMN_ARROW_DOWN_ATTRIBUTE = 
           "org.apache.tapestry.contrib.table.components.TableColumns.arrowDown";
       
  -    // Bindings (custom)
  -    private IBinding m_objColumnBinding = null;
  -    private IBinding m_objElementBinding = null;
  -
  -    // Bindings (in)
  -    private IAsset m_objArrowUpAsset;
  -    private IAsset m_objArrowDownAsset;
  -
   	// Transient
   	private ITableColumn m_objTableColumn;
   
  -    public TableColumns()
  -    {
  -        initialize();
  -    }
  +    // Bindings
  +    public abstract IBinding getColumnBinding();
  +    public abstract String getElement();
  +    public abstract IAsset getArrowDownAsset();
  +    public abstract IAsset getArrowUpAsset();
   
  -    /**
  -	 * @see org.apache.tapestry.event.PageDetachListener#pageDetached(PageEvent)
  -	 */
  -	public void pageDetached(PageEvent event)
  -	{
  -        initialize();
  -	}
  -    
  -    protected void initialize()
  -    {
  -        m_objArrowUpAsset = null;
  -        m_objArrowDownAsset = null;
  -    }
   
   	public Iterator getTableColumnIterator()
   	{
  @@ -203,93 +181,6 @@
   			getPage().getRequestCycle(),
   			getTableModelSource());
   	}
  -
  -    /**
  -     * Returns the valueBinding.
  -     * @return IBinding
  -     */
  -    public IBinding getColumnBinding()
  -    {
  -        return m_objColumnBinding;
  -    }
  -
  -    /**
  -     * Sets the valueBinding.
  -     * @param valueBinding The valueBinding to set
  -     */
  -    public void setColumnBinding(IBinding valueBinding)
  -    {
  -        m_objColumnBinding = valueBinding;
  -    }
  -
  -    /**
  -     * Returns the elementBinding.
  -     * @return IBinding
  -     */
  -    public IBinding getElementBinding()
  -    {
  -        return m_objElementBinding;
  -    }
  -
  -    /**
  -     * Sets the elementBinding.
  -     * @param elementBinding The elementBinding to set
  -     */
  -    public void setElementBinding(IBinding elementBinding)
  -    {
  -        m_objElementBinding = elementBinding;
  -    }
  -
  -    /**
  -     * Returns the element.
  -     * @return String
  -     */
  -    public String getElement()
  -    {
  -        IBinding objElementBinding = getElementBinding();
  -        if (objElementBinding == null || objElementBinding.getObject() == null)
  -            return "th";
  -        return objElementBinding.getString();
  -    }
  -
  -	/**
  -	 * Returns the arrowDownAsset.
  -	 * @return IAsset
  -	 */
  -	public IAsset getArrowDownAsset()
  -	{
  -		return m_objArrowDownAsset;
  -	}
  -
  -	/**
  -	 * Returns the arrowUpAsset.
  -	 * @return IAsset
  -	 */
  -	public IAsset getArrowUpAsset()
  -	{
  -		return m_objArrowUpAsset;
  -	}
  -
  -	/**
  -	 * Sets the asset to use to render an image describing a column 
  -     * sorted in a descending order.
  -	 * @param arrowDownAsset The asset of a 'down' arrow image
  -	 */
  -	public void setArrowDownAsset(IAsset arrowDownAsset)
  -	{
  -		m_objArrowDownAsset = arrowDownAsset;
  -	}
  -
  -	/**
  -     * Sets the asset to use to render an image describing a column 
  -     * sorted in an ascending order.
  -	 * @param arrowUpAsset The asset of an 'up' arrow image
  -	 */
  -	public void setArrowUpAsset(IAsset arrowUpAsset)
  -	{
  -		m_objArrowUpAsset = arrowUpAsset;
  -	}
  -
   
       /**
   	 * @see org.apache.tapestry.BaseComponent#renderComponent(IMarkupWriter, IRequestCycle)
  
  
  
  1.3       +2 -2      jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/table/components/TableFormRows.jwc
  
  Index: TableFormRows.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/table/components/TableFormRows.jwc,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TableFormRows.jwc	7 Jan 2004 01:12:59 -0000	1.2
  +++ TableFormRows.jwc	7 Jan 2004 20:29:54 -0000	1.3
  @@ -34,6 +34,6 @@
   	</component>
   
       <property-specification name="convertedValues" type="java.util.Map" initial-value="new
java.util.HashMap()"/>
  -    <property-specification name="convertorCache" type="org.apache.tapestry.contrib.table.model.IPrimaryKeyConvertor"
initial-value="convertor"/>
  +    <property-specification name="convertorCache" type="org.apache.tapestry.contrib.table.model.IPrimaryKeyConvertor"
initial-value="null"/>
         
   </component-specification>
  
  
  
  1.3       +3 -1      jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/table/components/FormTable.jwc
  
  Index: FormTable.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/table/components/FormTable.jwc,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FormTable.jwc	7 Jan 2004 01:12:59 -0000	1.2
  +++ FormTable.jwc	7 Jan 2004 20:29:54 -0000	1.3
  @@ -149,6 +149,8 @@
   	<component id="tableColumns" type="TableColumns">
   		<inherited-binding name="column" parameter-name="column"/>
   		<inherited-binding name="class" parameter-name="columnsClass"/>
  +        <inherited-binding name="arrowUpAsset" parameter-name="arrowUpAsset"/>
  +        <inherited-binding name="arrowDownAsset" parameter-name="arrowDownAsset"/>
   	</component>
   
   	<component id="tableRows" type="TableFormRows">
  
  
  
  1.4       +3 -1      jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/table/components/Table.jwc
  
  Index: Table.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/table/components/Table.jwc,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Table.jwc	29 Dec 2003 00:13:52 -0000	1.3
  +++ Table.jwc	7 Jan 2004 20:29:54 -0000	1.4
  @@ -143,6 +143,8 @@
   	<component id="tableColumns" type="TableColumns">
   		<inherited-binding name="column" parameter-name="column"/>
   		<inherited-binding name="class" parameter-name="columnsClass"/>
  +        <inherited-binding name="arrowUpAsset" parameter-name="arrowUpAsset"/>
  +        <inherited-binding name="arrowDownAsset" parameter-name="arrowDownAsset"/>
   	</component>
   
   	<component id="tableRows" type="TableRows">
  
  
  
  1.3       +3 -2      jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/table/components/TableColumns.jwc
  
  Index: TableColumns.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/table/components/TableColumns.jwc,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TableColumns.jwc	1 Jun 2003 05:05:10 -0000	1.2
  +++ TableColumns.jwc	7 Jan 2004 20:29:54 -0000	1.3
  @@ -18,7 +18,8 @@
   	<parameter name="element" 
   		type="java.lang.String" 
   		required="no"
  -		direction="custom"/>
  +		direction="auto"
  +    	default-value="'th'"/>
   
   	<parameter name="arrowUpAsset" 
   		type="org.apache.tapestry.IAsset" 
  
  
  
  1.21      +7 -17     jakarta-tapestry/framework/src/org/apache/tapestry/Tapestry.java
  
  Index: Tapestry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/Tapestry.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Tapestry.java	7 Jan 2004 01:17:05 -0000	1.20
  +++ Tapestry.java	7 Jan 2004 20:29:55 -0000	1.21
  @@ -507,26 +507,16 @@
               if (s.length() == 0)
                   return false;
   
  +            String ts = s.trim();
  +            if (ts.length() == 0)
  +                return false;
  +
               // Here probably Boolean.getBoolean(s) should be used,
               // but we need the opposite check
  -            if (s.trim().equalsIgnoreCase("false"))
  +            if (ts.equalsIgnoreCase("false"))
                   return false;
   
  -            char[] data = s.toCharArray();
  -
  -            try
  -            {
  -                for (int i = 0;; i++)
  -                {
  -                    char ch = data[i];
  -                    if (!Character.isWhitespace(ch))
  -                        return true;
  -                }
  -            }
  -            catch (IndexOutOfBoundsException ex)
  -            {
  -                return false;
  -            }
  +            return true;
           }
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Mime
View raw message