tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib IActivate.java ActivateCallback.java
Date Tue, 01 Apr 2003 17:00:31 GMT
hlship      2003/04/01 09:00:30

  Modified:    examples/VlibBeans/src/org/apache/tapestry/vlib/ejb/impl
                        OperationsBean.java BookQueryBean.java
               examples/Vlib/src/org/apache/tapestry/vlib/pages
                        ViewPerson.java EditBook.java
                        ConfirmBookDelete.java GiveAwayBooks.java
                        MyLibrary.java BookMatches.java EditProfile.java
                        NewBook.java BorrowedBooks.java
               examples/Vlib/context/WEB-INF BookMatches.page
                        ViewPerson.page Border.jwc Border.html
                        MyLibrary.page BorrowedBooks.page
               examples/Vlib/context Home.html BookMatches.html
                        TransferBooksSelect.html EditUsers.html
                        MyLibrary.html BorrowedBooks.html Login.html
                        EditPublishers.html ViewPerson.html
               examples/Vlib/context/css vlib.css
               examples/VlibBeans/src/org/apache/tapestry/vlib/ejb
                        IBookQuery.java
               examples/Vlib/src/org/apache/tapestry/vlib/components
                        Border.java
               examples/Vlib/src/org/apache/tapestry/vlib/pages/admin
                        TransferBooksTransfer.java
  Added:       examples/Vlib/context/WEB-INF ColumnSorter.jwc
                        ColumnSorter.html
               examples/VlibBeans/src/org/apache/tapestry/vlib/ejb
                        SortColumn.java SortOrdering.java
               examples/Vlib/context/images sort-up_h.png sort-down.png
                        sort-up.png sort-down_h.png
               examples/Vlib/src/org/apache/tapestry/vlib/components
                        ColumnSorter.java
               examples/Vlib/src/org/apache/tapestry/vlib IActivate.java
                        ActivateCallback.java
  Log:
  Add column sorting capability to Vlib pages
  
  Revision  Changes    Path
  1.2       +72 -17    jakarta-tapestry/examples/VlibBeans/src/org/apache/tapestry/vlib/ejb/impl/OperationsBean.java
  
  Index: OperationsBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/VlibBeans/src/org/apache/tapestry/vlib/ejb/impl/OperationsBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OperationsBean.java	5 Mar 2003 23:08:05 -0000	1.1
  +++ OperationsBean.java	1 Apr 2003 17:00:28 -0000	1.2
  @@ -105,6 +105,8 @@
   import org.apache.tapestry.vlib.ejb.Person;
   import org.apache.tapestry.vlib.ejb.Publisher;
   import org.apache.tapestry.vlib.ejb.RegistrationException;
  +import org.apache.tapestry.vlib.ejb.SortColumn;
  +import org.apache.tapestry.vlib.ejb.SortOrdering;
   
   /**
    *  Implementation of the {@link org.apache.tapestry.vlib.ejb.IOperations} 
  @@ -814,7 +816,8 @@
        *
        **/
   
  -    private void moveBooksFromDeletedPersons(Integer deleted[], Integer adminPK) throws RemoveException
  +    private void moveBooksFromDeletedPersons(Integer deleted[], Integer adminPK)
  +        throws RemoveException
       {
           StatementAssembly assembly = new StatementAssembly();
   
  @@ -844,7 +847,9 @@
           }
           catch (SQLException ex)
           {
  -            throw new XRemoveException("Unable to move books from deleted owners: " + ex.getMessage(), ex);
  +            throw new XRemoveException(
  +                "Unable to move books from deleted owners: " + ex.getMessage(),
  +                ex);
           }
           finally
           {
  @@ -869,9 +874,11 @@
           columns[Book.DESCRIPTION_COLUMN] = set.getString(column++);
           columns[Book.ISBN_COLUMN] = set.getString(column++);
           columns[Book.OWNER_PK_COLUMN] = set.getObject(column++);
  -        columns[Book.OWNER_NAME_COLUMN] = buildName(set.getString(column++), set.getString(column++));
  +        columns[Book.OWNER_NAME_COLUMN] =
  +            buildName(set.getString(column++), set.getString(column++));
           columns[Book.HOLDER_PK_COLUMN] = set.getObject(column++);
  -        columns[Book.HOLDER_NAME_COLUMN] = buildName(set.getString(column++), set.getString(column++));
  +        columns[Book.HOLDER_NAME_COLUMN] =
  +            buildName(set.getString(column++), set.getString(column++));
           columns[Book.PUBLISHER_PK_COLUMN] = set.getObject(column++);
           columns[Book.PUBLISHER_NAME_COLUMN] = set.getString(column++);
           columns[Book.AUTHOR_COLUMN] = set.getString(column++);
  @@ -897,7 +904,7 @@
        *
        **/
   
  -    private static final String[] bookSelectColumns =
  +    private static final String[] BOOK_SELECT_COLUMNS =
           {
               "book.BOOK_ID",
               "book.TITLE",
  @@ -916,33 +923,78 @@
               "book.LENDABLE",
               "book.DATE_ADDED" };
   
  -    private static final String[] bookAliasColumns =
  +    private static final String[] BOOK_ALIAS_COLUMNS =
           { "BOOK book", "PERSON owner", "PERSON holder", "PUBLISHER publisher" };
   
  -    private static final String[] bookJoins =
  +    private static final String[] BOOK_JOINS =
           {
               "book.OWNER_ID = owner.PERSON_ID",
               "book.HOLDER_ID = holder.PERSON_ID",
               "book.PUBLISHER_ID = publisher.PUBLISHER_ID" };
   
  +    private static final Map BOOK_SORT_ASCENDING = new HashMap();
  +    private static final Map BOOK_SORT_DESCENDING = new HashMap();
  +
  +    static {
  +        BOOK_SORT_ASCENDING.put(SortColumn.TITLE, "book.TITLE");
  +        BOOK_SORT_ASCENDING.put(SortColumn.HOLDER, "holder.LAST_NAME, holder.FIRST_NAME");
  +        BOOK_SORT_ASCENDING.put(SortColumn.OWNER, "owner.FIRST_NAME, owner.LAST_NAME");
  +        BOOK_SORT_ASCENDING.put(SortColumn.PUBLISHER, "publisher.NAME");
  +        BOOK_SORT_ASCENDING.put(SortColumn.AUTHOR, "book.AUTHOR");
  +
  +        BOOK_SORT_DESCENDING.put(SortColumn.TITLE, "book.TITLE DESC");
  +        BOOK_SORT_DESCENDING.put(
  +            SortColumn.HOLDER,
  +            "holder.LAST_NAME DESC, holder.FIRST_NAME DESC");
  +        BOOK_SORT_DESCENDING.put(SortColumn.OWNER, "owner.FIRST_NAME DESC, owner.LAST_NAME DESC");
  +        BOOK_SORT_DESCENDING.put(SortColumn.PUBLISHER, "publisher.NAME DESC");
  +        BOOK_SORT_DESCENDING.put(SortColumn.AUTHOR, "book.AUTHOR DESC");
  +    }
  +
       protected StatementAssembly buildBaseBookQuery()
       {
  -        StatementAssembly result;
  -
  -        result = new StatementAssembly();
  +        StatementAssembly result = new StatementAssembly();
   
           result.newLine("SELECT ");
  -        result.addList(bookSelectColumns, ", ");
  +        result.addList(BOOK_SELECT_COLUMNS, ", ");
   
           result.newLine("FROM ");
  -        result.addList(bookAliasColumns, ", ");
  +        result.addList(BOOK_ALIAS_COLUMNS, ", ");
   
           result.newLine("WHERE ");
  -        result.addList(bookJoins, " AND ");
  +        result.addList(BOOK_JOINS, " AND ");
   
           return result;
       }
   
  +	/**
  +	 *  Adds a sort ordering clause to the statement.  If ordering is null,
  +	 *  orders by book title.
  +	 * 
  +	 *  @param assembly to update
  +	 *  @param ordering defines the column to sort on, and the order (ascending or descending)
  +	 *  @since 2.4
  +	 * 
  +	 *
  +	 **/
  +	
  +	protected void addSortOrdering(StatementAssembly assembly, SortOrdering ordering)
  +	{
  +		if (ordering == null)
  +		{
  +			assembly.newLine("ORDER BY book.TITLE");
  +			return;
  +		}
  +		
  +		Map sorts =
  +			ordering.isDescending() ? BOOK_SORT_DESCENDING : BOOK_SORT_ASCENDING;
  +			
  +		String term = (String)sorts.get(ordering.getColumn());
  +		
  +		assembly.newLine("ORDER BY ");
  +		assembly.add(term);
  +	}
  +
       protected void addSubstringSearch(StatementAssembly assembly, String column, String value)
       {
           String trimmed;
  @@ -1040,7 +1092,8 @@
               {
                   raw = environment.lookup("ejb/Publisher");
   
  -                publisherHome = (IPublisherHome) PortableRemoteObject.narrow(raw, IPublisherHome.class);
  +                publisherHome =
  +                    (IPublisherHome) PortableRemoteObject.narrow(raw, IPublisherHome.class);
               }
               catch (NamingException e)
               {
  @@ -1235,7 +1288,8 @@
           {
               Context context = new InitialContext();
   
  -            QueueConnectionFactory factory = (QueueConnectionFactory) context.lookup("QueueConnectionFactory");
  +            QueueConnectionFactory factory =
  +                (QueueConnectionFactory) context.lookup("QueueConnectionFactory");
   
               QueueConnection connection = factory.createQueueConnection();
   
  @@ -1259,7 +1313,8 @@
           return mailQueueSender;
       }
   
  -    protected void sendMail(String emailAddress, String subject, String content) throws EJBException
  +    protected void sendMail(String emailAddress, String subject, String content)
  +        throws EJBException
       {
   
           // Sending mail is temporarily disabled
  
  
  
  1.2       +31 -17    jakarta-tapestry/examples/VlibBeans/src/org/apache/tapestry/vlib/ejb/impl/BookQueryBean.java
  
  Index: BookQueryBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/VlibBeans/src/org/apache/tapestry/vlib/ejb/impl/BookQueryBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BookQueryBean.java	5 Mar 2003 23:08:05 -0000	1.1
  +++ BookQueryBean.java	1 Apr 2003 17:00:28 -0000	1.2
  @@ -65,6 +65,7 @@
   import org.apache.tapestry.contrib.jdbc.IStatement;
   import org.apache.tapestry.contrib.jdbc.StatementAssembly;
   import org.apache.tapestry.vlib.ejb.Book;
  +import org.apache.tapestry.vlib.ejb.SortOrdering;
   
   /**
    *  Implementation of a stateful session bean used to query the 
  @@ -152,7 +153,11 @@
        *
        **/
   
  -    public int masterQuery(String title, String author, Object publisherPK)
  +    public int masterQuery(
  +        String title,
  +        String author,
  +        Integer publisherPK,
  +        SortOrdering sortOrdering)
       {
           IStatement statement = null;
           Connection connection = null;
  @@ -167,7 +172,7 @@
   
               try
               {
  -                statement = buildMasterQuery(connection, title, author, publisherPK);
  +                statement = buildMasterQuery(connection, title, author, publisherPK, sortOrdering);
               }
               catch (SQLException ex)
               {
  @@ -190,7 +195,7 @@
        *
        **/
   
  -    public int ownerQuery(Integer ownerPK)
  +    public int ownerQuery(Integer ownerPK, SortOrdering sortOrdering)
       {
           IStatement statement = null;
           Connection connection = null;
  @@ -205,11 +210,11 @@
   
               try
               {
  -                statement = buildPersonQuery(connection, "owner.PERSON_ID", ownerPK);
  +                statement = buildPersonQuery(connection, "owner.PERSON_ID", ownerPK, sortOrdering);
               }
  -            catch (SQLException e)
  +            catch (SQLException ex)
               {
  -                throw new XEJBException("Unable to create query statement.", e);
  +                throw new XEJBException("Unable to create query statement.", ex);
               }
   
               processQuery(statement);
  @@ -228,7 +233,7 @@
        *
        **/
   
  -    public int holderQuery(Integer holderPK)
  +    public int holderQuery(Integer holderPK, SortOrdering sortOrdering)
       {
           IStatement statement = null;
           Connection connection = null;
  @@ -243,7 +248,8 @@
   
               try
               {
  -                statement = buildPersonQuery(connection, "holder.PERSON_ID", holderPK);
  +                statement =
  +                    buildPersonQuery(connection, "holder.PERSON_ID", holderPK, sortOrdering);
               }
               catch (SQLException ex)
               {
  @@ -261,7 +267,7 @@
           return getResultCount();
       }
   
  -    public int borrowerQuery(Integer borrowerPK)
  +    public int borrowerQuery(Integer borrowerPK, SortOrdering sortOrdering)
       {
           IStatement statement = null;
           Connection connection = null;
  @@ -276,7 +282,7 @@
   
               try
               {
  -                statement = buildBorrowerQuery(connection, borrowerPK);
  +                statement = buildBorrowerQuery(connection, borrowerPK, sortOrdering);
               }
               catch (SQLException ex)
               {
  @@ -345,7 +351,8 @@
           Connection connection,
           String title,
           String author,
  -        Object publisherPK)
  +        Integer publisherPK,
  +        SortOrdering ordering)
           throws SQLException
       {
           StatementAssembly assembly;
  @@ -367,12 +374,16 @@
               assembly.addParameter(publisherPK);
           }
   
  -        assembly.newLine("ORDER BY book.TITLE");
  +        addSortOrdering(assembly, ordering);
   
           return assembly.createStatement(connection);
       }
   
  -    private IStatement buildPersonQuery(Connection connection, String personColumn, Integer personPK)
  +    private IStatement buildPersonQuery(
  +        Connection connection,
  +        String personColumn,
  +        Integer personPK,
  +        SortOrdering sortOrdering)
           throws SQLException
       {
           StatementAssembly assembly;
  @@ -384,12 +395,15 @@
           assembly.add(" = ");
           assembly.addParameter(personPK);
   
  -        assembly.newLine("ORDER BY book.TITLE");
  +        addSortOrdering(assembly, sortOrdering);
   
           return assembly.createStatement(connection);
       }
   
  -    private IStatement buildBorrowerQuery(Connection connection, Integer borrowerPK)
  +    private IStatement buildBorrowerQuery(
  +        Connection connection,
  +        Integer borrowerPK,
  +        SortOrdering sortOrdering)
           throws SQLException
       {
           StatementAssembly assembly;
  @@ -404,7 +418,7 @@
           assembly.addSep(" AND ");
           assembly.add("book.HOLDER_ID <> book.OWNER_ID");
   
  -        assembly.newLine("ORDER BY book.TITLE");
  +        addSortOrdering(assembly, sortOrdering);
   
           return assembly.createStatement(connection);
       }
  
  
  
  1.4       +37 -21    jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/ViewPerson.java
  
  Index: ViewPerson.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/ViewPerson.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ViewPerson.java	31 Mar 2003 21:50:06 -0000	1.3
  +++ ViewPerson.java	1 Apr 2003 17:00:28 -0000	1.4
  @@ -67,6 +67,8 @@
   import org.apache.tapestry.vlib.ejb.IBookQuery;
   import org.apache.tapestry.vlib.ejb.IOperations;
   import org.apache.tapestry.vlib.ejb.Person;
  +import org.apache.tapestry.vlib.ejb.SortColumn;
  +import org.apache.tapestry.vlib.ejb.SortOrdering;
   
   /**
    *  Displays the book inventory list for a single {@link IPerson}, showing
  @@ -88,6 +90,10 @@
   
       public abstract void setQuery(IBookQuery value);
   
  +    public abstract SortColumn getSortColumn();
  +
  +    public abstract boolean isDescending();
  +
       private Browser _browser;
   
       public void finishLoad()
  @@ -107,36 +113,47 @@
   
           VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
   
  +        Person person = vengine.readPerson(personPK);
  +
  +        setPerson(person);
  +
  +        runQuery();
  +
  +        // cycle.setPage(this);
  +    }
  +
  +    public void resort(IRequestCycle cycle)
  +    {
  +        runQuery();
  +    }
  +
  +    private void runQuery()
  +    {
  +        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
  +        Person person = getPerson();
  +
  +        SortOrdering ordering = new SortOrdering(getSortColumn(), isDescending());
  +
           int i = 0;
           while (true)
           {
  -            try
  -            {
  -                IBookQuery query = getQuery();
  +            IBookQuery query = getQuery();
   
  -                if (query == null)
  -                {
  -                    query = vengine.createNewQuery();
  +            if (query == null)
  +            {
  +                query = vengine.createNewQuery();
   
  -                    setQuery(query);
  -                }
  +                setQuery(query);
  +            }
   
  -                int count = query.ownerQuery(personPK);
  +            try
  +            {
  +                int count = query.ownerQuery(person.getPrimaryKey(), ordering);
   
                   _browser.initializeForResultCount(count);
   
  -                IOperations operations = vengine.getOperations();
  -
  -                setPerson(operations.getPerson(personPK));
  -
                   break;
               }
  -            catch (FinderException e)
  -            {
  -                vengine.presentError(
  -                    "Person " + personPK + " not found in database.",
  -                    getRequestCycle());
  -            }
               catch (RemoteException ex)
               {
                   vengine.rmiFailure("Remote exception for owner query.", ex, i++);
  @@ -145,7 +162,6 @@
               }
           }
   
  -        cycle.setPage(this);
       }
   
   }
  
  
  
  1.5       +3 -3      jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/EditBook.java
  
  Index: EditBook.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/EditBook.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EditBook.java	31 Mar 2003 21:50:05 -0000	1.4
  +++ EditBook.java	1 Apr 2003 17:00:28 -0000	1.5
  @@ -206,8 +206,8 @@
   
           MyLibrary page = (MyLibrary) cycle.getPage("MyLibrary");
           page.setMessage(formatString("updated-book", attributes.get("title")));
  -
  -        cycle.setPage(page);
  +		page.activate(cycle);
  +      
       }
   
       public void pageBeginRender(PageEvent event)
  
  
  
  1.5       +2 -2      jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/ConfirmBookDelete.java
  
  Index: ConfirmBookDelete.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/ConfirmBookDelete.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ConfirmBookDelete.java	31 Mar 2003 21:50:05 -0000	1.4
  +++ ConfirmBookDelete.java	1 Apr 2003 17:00:28 -0000	1.5
  @@ -159,6 +159,6 @@
   
           myLibrary.setMessage(formatString("book-deleted", book.getTitle()));
   
  -        cycle.setPage(myLibrary);
  +       	myLibrary.activate(cycle);
       }
   }
  
  
  
  1.2       +4 -4      jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/GiveAwayBooks.java
  
  Index: GiveAwayBooks.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/GiveAwayBooks.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GiveAwayBooks.java	31 Mar 2003 21:50:05 -0000	1.1
  +++ GiveAwayBooks.java	1 Apr 2003 17:00:28 -0000	1.2
  @@ -86,12 +86,12 @@
               }
           }
   
  -        IMessageProperty myLibrary = (IMessageProperty) cycle.getPage("MyLibrary");
  +        MyLibrary myLibrary = (MyLibrary) cycle.getPage("MyLibrary");
   
           myLibrary.setMessage(
               formatString("transfered-books", Integer.toString(count), target.getNaturalName()));
   
  -        cycle.setPage(myLibrary);
  +		myLibrary.activate(cycle);
       }
   
       private IPropertySelectionModel buildPersonModel()
  @@ -170,7 +170,7 @@
               {
                   IBookQuery query = vengine.createNewQuery();
   
  -                int count = query.ownerQuery(userPK);
  +                int count = query.ownerQuery(userPK, null);
   
                   if (count > 0)
                       books = query.get(0, count);
  
  
  
  1.7       +51 -19    jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/MyLibrary.java
  
  Index: MyLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/MyLibrary.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MyLibrary.java	31 Mar 2003 21:50:06 -0000	1.6
  +++ MyLibrary.java	1 Apr 2003 17:00:28 -0000	1.7
  @@ -59,16 +59,21 @@
   
   import javax.ejb.FinderException;
   
  -import org.apache.tapestry.IMarkupWriter;
   import org.apache.tapestry.IRequestCycle;
  +import org.apache.tapestry.PageRedirectException;
  +import org.apache.tapestry.html.BasePage;
  +import org.apache.tapestry.vlib.ActivateCallback;
  +import org.apache.tapestry.vlib.IActivate;
  +import org.apache.tapestry.vlib.IErrorProperty;
   import org.apache.tapestry.vlib.IMessageProperty;
  -import org.apache.tapestry.vlib.Protected;
   import org.apache.tapestry.vlib.VirtualLibraryEngine;
   import org.apache.tapestry.vlib.Visit;
   import org.apache.tapestry.vlib.components.Browser;
   import org.apache.tapestry.vlib.ejb.Book;
   import org.apache.tapestry.vlib.ejb.IBookQuery;
   import org.apache.tapestry.vlib.ejb.IOperations;
  +import org.apache.tapestry.vlib.ejb.SortColumn;
  +import org.apache.tapestry.vlib.ejb.SortOrdering;
   
   /**
    *  Shows a list of the user's books, allowing books to be editted or
  @@ -85,8 +90,18 @@
    * 
    **/
   
  -public abstract class MyLibrary extends Protected implements IMessageProperty
  +public abstract class MyLibrary
  +    extends BasePage
  +    implements IMessageProperty, IActivate, IErrorProperty
   {
  +    public abstract void setOwnedQuery(IBookQuery value);
  +
  +    public abstract IBookQuery getOwnedQuery();
  +
  +    public abstract SortColumn getSortColumn();
  +
  +    public abstract boolean isDescending();
  +
       private Browser _browser;
   
       public void finishLoad()
  @@ -94,24 +109,43 @@
           _browser = (Browser) getComponent("browser");
       }
   
  -    /**
  -     *  A dirty little secret of Tapestry and page recorders:  persistent
  -     *  properties must be set before the render (when this method is invoked)
  -     *  and can't change during the render.  We force
  -     *  the creation of the owned book query and re-execute it whenever
  -     *  the MyLibrary page is rendered.
  -     *
  -     **/
  +    public void validate(IRequestCycle cycle)
  +    {
  +        Visit visit = (Visit) getVisit();
  +
  +        if (visit != null && visit.isUserLoggedIn())
  +            return;
  +
  +        // User not logged in ... redirect through the Login page.
  +
  +        Login login = (Login) cycle.getPage("Login");
  +
  +        login.setCallback(new ActivateCallback(this));
   
  -    public void beginResponse(IMarkupWriter writer, IRequestCycle cycle)
  +        throw new PageRedirectException(login);
  +    }
  +
  +    public void activate(IRequestCycle cycle)
       {
  -        super.beginResponse(writer, cycle);
  +        runQuery();
  +
  +        cycle.setPage(this);
  +    }
  +
  +    public void resort(IRequestCycle cycle)
  +    {
  +        runQuery();
  +    }
   
  +    private void runQuery()
  +    {
           Visit visit = (Visit) getVisit();
           Integer userPK = visit.getUserPK();
   
           VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
   
  +        SortOrdering ordering = new SortOrdering(getSortColumn(), isDescending());
  +
           int i = 0;
           while (true)
           {
  @@ -125,7 +159,7 @@
                       setOwnedQuery(query);
                   }
   
  -                int count = query.ownerQuery(userPK);
  +                int count = query.ownerQuery(userPK, ordering);
   
                   if (count != _browser.getResultCount())
                       _browser.initializeForResultCount(count);
  @@ -141,10 +175,6 @@
           }
       }
   
  -    public abstract void setOwnedQuery(IBookQuery value);
  -
  -    public abstract IBookQuery getOwnedQuery();
  -
       /**
        *  Listener invoked to allow a user to edit a book.
        *
  @@ -199,6 +229,8 @@
                   vengine.rmiFailure("Remote exception returning book.", ex, i++);
               }
           }
  +
  +        runQuery();
       }
   
   }
  
  
  
  1.4       +61 -18    jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/BookMatches.java
  
  Index: BookMatches.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/BookMatches.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BookMatches.java	31 Mar 2003 21:50:05 -0000	1.3
  +++ BookMatches.java	1 Apr 2003 17:00:28 -0000	1.4
  @@ -63,6 +63,8 @@
   import org.apache.tapestry.vlib.VirtualLibraryEngine;
   import org.apache.tapestry.vlib.components.Browser;
   import org.apache.tapestry.vlib.ejb.IBookQuery;
  +import org.apache.tapestry.vlib.ejb.SortColumn;
  +import org.apache.tapestry.vlib.ejb.SortOrdering;
   
   /**
    *  Runs queries and displays matches.
  @@ -84,12 +86,60 @@
   
       public abstract void setBookQuery(IBookQuery bookQuery);
   
  +    public abstract SortColumn getSortColumn();
  +
  +    public abstract boolean isDescending();
  +
  +    public abstract void setAuthor(String author);
  +
  +    public abstract String getAuthor();
  +
  +    public abstract void setTitle(String title);
  +
  +    public abstract String getTitle();
  +
  +    public abstract void setPublisherPK(Integer publisherPK);
  +
  +    public abstract Integer getPublisherPK();
  +
       /**
        *  Invoked by the {@link Home} page to perform a query.
        *
        **/
   
  -    public void performQuery(String title, String author, Object publisherPK, IRequestCycle cycle)
  +    public void performQuery(String title, String author, Integer publisherPK, IRequestCycle cycle)
  +    {
  +
  +        // Store these values for later, when we need to redo the same query
  +        // with different sorting.
  +
  +        setTitle(title);
  +        setAuthor(author);
  +        setPublisherPK(publisherPK);
  +
  +        int count = executeQuery(cycle);
  +
  +        if (count == 0)
  +        {
  +            Home home = (Home) cycle.getPage("Home");
  +            home.setMessage(getString("no-matches"));
  +            cycle.setPage(home);
  +            return;
  +        }
  +
  +        _browser.initializeForResultCount(count);
  +        cycle.setPage(this);
  +    }
  +
  +    public void resort(IRequestCycle cycle)
  +    {
  +        int count = executeQuery(cycle);
  +
  +        if (count != _browser.getResultCount())
  +            _browser.initializeForResultCount(count);
  +    }
  +
  +    private int executeQuery(IRequestCycle cycle)
       {
           VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
   
  @@ -101,25 +151,19 @@
               setBookQuery(query);
           }
   
  +        String title = getTitle();
  +        String author = getAuthor();
  +        Integer publisherPK = getPublisherPK();
  +
  +        SortOrdering ordering = new SortOrdering(getSortColumn(), isDescending());
  +
           int i = 0;
           while (true)
           {
   
               try
               {
  -                int count = query.masterQuery(title, author, publisherPK);
  -
  -                if (count == 0)
  -                {
  -                    Home home = (Home) cycle.getPage("Home");
  -                    home.setMessage(getString("no-matches"));
  -                    cycle.setPage(home);
  -                    return;
  -                }
  -
  -                _browser.initializeForResultCount(count);
  -
  -                break;
  +                return query.masterQuery(title, author, publisherPK, ordering);
               }
               catch (RemoteException ex)
               {
  @@ -134,12 +178,11 @@
   
                       IErrorProperty page = (IErrorProperty) cycle.getPage();
                       page.setError(message);
  -                    return;
  +                    return 0;
                   }
               }
  -        }
   
  -        cycle.setPage(this);
  +        }
       }
   
   }
  
  
  
  1.6       +4 -3      jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/EditProfile.java
  
  Index: EditProfile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/EditProfile.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EditProfile.java	31 Mar 2003 21:50:05 -0000	1.5
  +++ EditProfile.java	1 Apr 2003 17:00:28 -0000	1.6
  @@ -68,6 +68,7 @@
   import org.apache.tapestry.event.PageRenderListener;
   import org.apache.tapestry.form.IFormComponent;
   import org.apache.tapestry.valid.IValidationDelegate;
  +import org.apache.tapestry.vlib.IActivate;
   import org.apache.tapestry.vlib.Protected;
   import org.apache.tapestry.vlib.VirtualLibraryEngine;
   import org.apache.tapestry.vlib.Visit;
  @@ -81,7 +82,7 @@
    * 
    **/
   
  -public abstract class EditProfile extends Protected implements PageRenderListener
  +public abstract class EditProfile extends Protected implements PageRenderListener, IActivate
   {
       public abstract String getPassword1();
   
  @@ -105,7 +106,7 @@
        *
        **/
   
  -    public void beginEdit(IRequestCycle cycle)
  +    public void activate(IRequestCycle cycle)
       {
           Visit visit = (Visit) getVisit();
           VirtualLibraryEngine vengine = visit.getEngine();
  
  
  
  1.6       +2 -2      jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/NewBook.java
  
  Index: NewBook.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/NewBook.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- NewBook.java	31 Mar 2003 21:50:05 -0000	1.5
  +++ NewBook.java	1 Apr 2003 17:00:28 -0000	1.6
  @@ -154,7 +154,7 @@
   
           myLibrary.setMessage(formatString("added-book", attributes.get("title")));
   
  -        cycle.setPage(myLibrary);
  +		myLibrary.activate(cycle);
       }
   
       public void pageBeginRender(PageEvent event)
  
  
  
  1.6       +70 -53    jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/BorrowedBooks.java
  
  Index: BorrowedBooks.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/BorrowedBooks.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BorrowedBooks.java	31 Mar 2003 21:50:06 -0000	1.5
  +++ BorrowedBooks.java	1 Apr 2003 17:00:28 -0000	1.6
  @@ -60,8 +60,8 @@
   import javax.ejb.FinderException;
   
   import org.apache.tapestry.ApplicationRuntimeException;
  -import org.apache.tapestry.IMarkupWriter;
   import org.apache.tapestry.IRequestCycle;
  +import org.apache.tapestry.vlib.IActivate;
   import org.apache.tapestry.vlib.IMessageProperty;
   import org.apache.tapestry.vlib.Protected;
   import org.apache.tapestry.vlib.VirtualLibraryEngine;
  @@ -70,23 +70,20 @@
   import org.apache.tapestry.vlib.ejb.Book;
   import org.apache.tapestry.vlib.ejb.IBookQuery;
   import org.apache.tapestry.vlib.ejb.IOperations;
  +import org.apache.tapestry.vlib.ejb.SortColumn;
  +import org.apache.tapestry.vlib.ejb.SortOrdering;
   
   /**
  - *  Shows a list of the user's books, allowing books to be editted or
  - *  even deleted.
  - *
  - *  <p>Note that, unlike elsewhere, book titles do not link to the
  - *  {@link ViewBook} page.  It seems to me there would be a conflict between
  - *  that behavior and the edit behavior; making the book titles not be links
  - *  removes the ambiguity over what happens when the book title is clicked
  - *  (view vs. edit).
  + *  Shows a list of books the user has borrowed.
    *
    *  @author Howard Lewis Ship
    *  @version $Id$
    * 
    **/
   
  -public abstract class BorrowedBooks extends Protected implements IMessageProperty
  +public abstract class BorrowedBooks
  +    extends Protected
  +    implements IMessageProperty, IActivate
   {
       private Browser _browser;
   
  @@ -94,56 +91,73 @@
   
       public abstract IBookQuery getBorrowedQuery();
   
  +    public abstract SortColumn getSortColumn();
  +
  +    public abstract boolean isDescending();
  +
       public void finishLoad()
       {
           _browser = (Browser) getComponent("browser");
       }
   
  -    /**
  -     *  A dirty little secret of Tapestry and page recorders:  persistent
  -     *  properties must be set before the render (when this method is invoked)
  -     *  and can't change during the render.  We force
  -     *  the creation of the borrowed books query and re-execute it whenever
  -     *  the BorrowedBooks page is rendered.
  -     *
  -     **/
  -
  -    public void beginResponse(IMarkupWriter writer, IRequestCycle cycle)
  +	public void activate(IRequestCycle cycle)
  +	{
  +		runQuery();
  +		
  +		cycle.setPage(this);
  +	}
  +
  +	/**
  +	 *  Invoked as listener method after the sortColumn or
  +	 *  descending properties are changed.
  +	 * 
  +	 *  @param cycle
  +	 *  @since 2.4
  +	 * 
  +	 *
  +	 **/
  +	
  +    public void resort(IRequestCycle cycle)
       {
  -        super.beginResponse(writer, cycle);
  +        runQuery();
  +    }
   
  +    private void runQuery()
  +    {
           Visit visit = (Visit) getVisit();
  -        Integer userPK = visit.getUserPK();
  -
  -        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
  -
  -        int i = 0;
  -        while (true)
  -        {
  -            try
  -            {
  -                IBookQuery query = getBorrowedQuery();
  -
  -                if (query == null)
  -                {
  -                    query = vengine.createNewQuery();
  -                    setBorrowedQuery(query);
  -                }
  -
  -                int count = query.borrowerQuery(userPK);
  -
  -                if (count != _browser.getResultCount())
  -                    _browser.initializeForResultCount(count);
  -
  -                break;
  -            }
  -            catch (RemoteException ex)
  -            {
  -                vengine.rmiFailure("Remote exception finding borrowed books.", ex, i++);
  -
  -                setBorrowedQuery(null);
  -            }
  -        }
  +         Integer userPK = visit.getUserPK();
  +        
  +         VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
  +        
  +         SortOrdering ordering = new SortOrdering(getSortColumn(), isDescending());
  +        
  +         int i = 0;
  +         while (true)
  +         {
  +        	 try
  +        	 {
  +        		 IBookQuery query = getBorrowedQuery();
  +        
  +        		 if (query == null)
  +        		 {
  +        			 query = vengine.createNewQuery();
  +        			 setBorrowedQuery(query);
  +        		 }
  +        
  +        		 int count = query.borrowerQuery(userPK, ordering);
  +        
  +        		 if (count != _browser.getResultCount())
  +        			 _browser.initializeForResultCount(count);
  +        
  +        		 break;
  +        	 }
  +        	 catch (RemoteException ex)
  +        	 {
  +        		 vengine.rmiFailure("Remote exception finding borrowed books.", ex, i++);
  +        
  +        		 setBorrowedQuery(null);
  +        	 }
  +         }
       }
   
       /**
  @@ -164,6 +178,8 @@
               Book book = operations.returnBook(bookPK);
   
               setMessage(formatString("returned-book", book.getTitle()));
  +            
  +            runQuery();
           }
           catch (FinderException ex)
           {
  @@ -175,5 +191,6 @@
               throw new ApplicationRuntimeException(ex);
           }
       }
  +
   
   }
  
  
  
  1.4       +33 -1     jakarta-tapestry/examples/Vlib/context/WEB-INF/BookMatches.page
  
  Index: BookMatches.page
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/WEB-INF/BookMatches.page,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BookMatches.page	31 Mar 2003 21:50:07 -0000	1.3
  +++ BookMatches.page	1 Apr 2003 17:00:28 -0000	1.4
  @@ -11,6 +11,38 @@
     <property-specification name="bookQuery" type="org.apache.tapestry.vlib.ejb.IBookQuery" persistent="yes"/>
     <property-specification name="currentMatch" type="org.apache.tapestry.vlib.ejb.Book"/>
      
  +  <property-specification name="author" type="java.lang.String" persistent="yes"/>
  +  <property-specification name="title" type="java.lang.String" persistent="yes"/>
  +  <property-specification name="publisherPK" type="java.lang.Integer" persistent="yes"/>
  +  
  +  <property-specification name="sortColumn" type="org.apache.tapestry.vlib.ejb.SortColumn" persistent="yes">
  +  	@org.apache.tapestry.vlib.ejb.SortColumn@TITLE
  +  </property-specification>
  +  <property-specification name="descending" type="boolean" persistent="yes"/>
  +   
  +  <component id="sortTitle" type="ColumnSorter">
  +    <binding name="selected" expression="sortColumn"/>
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@TITLE"/>
  +    <binding name="descending" expression="descending"/>
  +    <binding name="listener" expression="listeners.resort"/>
  +  </component> 
  +  
  +  <component id="sortAuthor" copy-of="sortTitle">
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@AUTHOR"/>
  +  </component>
  +  
  +  <component id="sortPublisher" copy-of="sortTitle">
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@PUBLISHER"/>	
  +  </component>
  +  
  +  <component id="sortOwner" copy-of="sortTitle">
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@OWNER"/>
  +  </component>
  + 
  +  <component id="sortBorrower" copy-of="sortTitle">
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@HOLDER"/>
  +  </component>
  +  
     <component id="ownerLink" type="PersonLink">
       <binding name="primaryKey" expression="currentMatch.ownerPrimaryKey"/>
       <binding name="name" expression="currentMatch.ownerName"/>
  
  
  
  1.7       +25 -1     jakarta-tapestry/examples/Vlib/context/WEB-INF/ViewPerson.page
  
  Index: ViewPerson.page
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/WEB-INF/ViewPerson.page,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ViewPerson.page	31 Mar 2003 21:50:07 -0000	1.6
  +++ ViewPerson.page	1 Apr 2003 17:00:28 -0000	1.7
  @@ -12,6 +12,30 @@
     <property-specification name="person" type="org.apache.tapestry.vlib.ejb.Person" persistent="yes"/>
     <property-specification name="currentMatch" type="org.apache.tapestry.vlib.ejb.Book"/>
   
  +  <property-specification name="sortColumn" type="org.apache.tapestry.vlib.ejb.SortColumn" persistent="yes">
  +  	@org.apache.tapestry.vlib.ejb.SortColumn@TITLE
  +  </property-specification>
  +  <property-specification name="descending" type="boolean" persistent="yes"/>
  +
  +  <component id="sortTitle" type="ColumnSorter">
  +    <binding name="selected" expression="sortColumn"/>
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@TITLE"/>
  +    <binding name="descending" expression="descending"/>
  +    <binding name="listener" expression="listeners.resort"/>
  +  </component>   
  +    
  +  <component id="sortAuthor" copy-of="sortTitle">
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@AUTHOR"/>
  +  </component>
  +  
  +  <component id="sortPublisher" copy-of="sortTitle">
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@PUBLISHER"/>	
  +  </component>
  +  
  +  <component id="sortBorrower" copy-of="sortTitle">
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@HOLDER"/>
  +  </component>
  +  
     <component id="mailLink" type="Any">
       <binding name="href">
       	"mailto:" + person.email
  
  
  
  1.9       +10 -7     jakarta-tapestry/examples/Vlib/context/WEB-INF/Border.jwc
  
  Index: Border.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/WEB-INF/Border.jwc,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Border.jwc	31 Mar 2003 21:50:07 -0000	1.8
  +++ Border.jwc	1 Apr 2003 17:00:28 -0000	1.9
  @@ -21,8 +21,9 @@
       <binding name="focus" expression="searchRolloverImage"/>	
     </component>
          
  -  <component id="myLibrary" type="PageLink">
  -    <static-binding name="page" value="MyLibrary"/>	
  +  <component id="myLibrary" type="DirectLink">
  +    <binding name="listener" expression="listeners.viewMyLibrary"/>	
  +    <binding name="stateful" expression="false"/>
     </component>    
     
     <component id="myLibraryRollover" type="Rollover">
  @@ -30,8 +31,8 @@
       <binding name="focus" expression="myLibraryRolloverImage"/>
     </component>
     
  -  <component id="borrowedBooks" type="PageLink">
  -  	<static-binding name="page" value="BorrowedBooks"/>	
  +  <component id="borrowedBooks" type="DirectLink">
  +  	<binding name="listener" expression="listeners.viewBorrowedBooks"/>	
     </component>
     
     <component id="borrowedBooksRollover" type="Rollover">
  @@ -95,6 +96,7 @@
      
     <component id="logout" type="DirectLink">
       <binding name="listener" expression="listeners.logout"/>
  +    <binding name="stateful" expression="false"/>
     </component>
     
     <!-- Since there is no "Logout" page, the images for the Logout
  @@ -105,8 +107,9 @@
       <binding name="focus" expression="assets.logout_h"/>	
     </component>
     
  -  <component id="login" type="PageLink">
  -    <static-binding name="page" value="Login"/>	
  +  <component id="login" type="DirectLink">
  +    <binding name="listener" expression="listeners.login"/>
  +    <binding name="stateful" expression="false"/>
     </component>
     
     <component id="loginRollover" type="Rollover">
  
  
  
  1.9       +17 -17    jakarta-tapestry/examples/Vlib/context/WEB-INF/Border.html
  
  Index: Border.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/WEB-INF/Border.html,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Border.html	31 Mar 2003 21:50:07 -0000	1.8
  +++ Border.html	1 Apr 2003 17:00:29 -0000	1.9
  @@ -21,23 +21,23 @@
       <td>
       <table border="0" cellpadding="0" cellspacing="0" width="178">
         <tr>
  -        <td rowspan="1" colspan="1" width="178" height="29"><a href="#" jwcid="search"><img jwcid="searchRollover" src="images/nav/nav_1x1.png" width="178" height="29" border="0" alt="[Search]"/></a></td>
  +        <td rowspan="1" colspan="1" width="178" height="29"><a href="#" jwcid="search"><img jwcid="searchRollover" src="images/nav/nav_1x1.png" width="178" height="29" border="0" alt="Search"/></a></td>
         </tr>
         <tr>
  -        <td rowspan="1" colspan="1" width="178" height="22"><a href="#" jwcid="myLibrary"><img jwcid="myLibraryRollover" src="images/nav/nav_2x1.png" width="178" height="22" border="0" alt="[My Library]"/></a></td>
  +        <td rowspan="1" colspan="1" width="178" height="22"><a href="#" jwcid="myLibrary"><img jwcid="myLibraryRollover" src="images/nav/nav_2x1.png" width="178" height="22" border="0" alt="My Library"/></a></td>
         </tr>
   <span jwcid="@Conditional" condition="ognl:loggedIn">
         <tr>
  -        <td rowspan="1" colspan="1" width="178" height="18"><a href="#" jwcid="borrowedBooks"><img jwcid="borrowedBooksRollover" src="images/nav/nav_3x1.png" width="178" height="18" border="0" alt="[Borrowed Books]"/></a></td>
  +        <td rowspan="1" colspan="1" width="178" height="18"><a href="#" jwcid="borrowedBooks"><img jwcid="borrowedBooksRollover" src="images/nav/nav_3x1.png" width="178" height="18" border="0" alt="Borrowed Books"/></a></td>
         </tr>
         <tr>
  -        <td rowspan="1" colspan="1" width="178" height="20"><a href="#" jwcid="newBook"><img jwcid="newBookRollover" src="images/nav/nav_4x1.png" width="178" height="20" border="0" alt="[Add New Book]"/></a></td>
  +        <td rowspan="1" colspan="1" width="178" height="20"><a href="#" jwcid="newBook"><img jwcid="newBookRollover" src="images/nav/nav_4x1.png" width="178" height="20" border="0" alt="Add New Book"/></a></td>
         </tr>
         <tr>
  -        <td rowspan="1" colspan="1" width="178" height="22"><a href="#" jwcid="editProfile"><img jwcid="editProfileRollover" src="images/nav/nav_5x1_editprofile.png" width="178" height="22" border="0" alt="[Edit Profile]"/></a></td>
  +        <td rowspan="1" colspan="1" width="178" height="22"><a href="#" jwcid="editProfile"><img jwcid="editProfileRollover" src="images/nav/nav_5x1_editprofile.png" width="178" height="22" border="0" alt="Edit Profile"/></a></td>
         </tr>
         <tr>
  -        <td rowspan="1" colspan="1" width="178" height="22"><a href="#" jwcid="giveAway"><img jwcid="giveAwayRollover" src="images/nav/nav_5x1.png" width="178" height="22" border="0" alt="[Give Away Books]"/></a></td>
  +        <td rowspan="1" colspan="1" width="178" height="22"><a href="#" jwcid="giveAway"><img jwcid="giveAwayRollover" src="images/nav/nav_5x1.png" width="178" height="22" border="0" alt="Give Away Books"/></a></td>
         </tr>
   </span>
   
  @@ -46,25 +46,25 @@
           <td rowspan="1" colspan="1" width="178" height="19"><img src="images/nav/nav_6x1.png" width="178" height="19" border="0" alt="[Admin]"></td>
         </tr>
         <tr>
  -        <td rowspan="1" colspan="1" width="178" height="20"><a href="#" jwcid="editUsers"><img jwcid="editUsersRollover" src="images/nav/nav_7x1.png" width="178" height="20" border="0" alt="[Edit Users]"/></a></td>
  +        <td rowspan="1" colspan="1" width="178" height="20"><a href="#" jwcid="editUsers"><img jwcid="editUsersRollover" src="images/nav/nav_7x1.png" width="178" height="20" border="0" alt="Edit Users"/></a></td>
         </tr>
         <tr>
  -        <td rowspan="1" colspan="1" width="178" height="20"><a href="#" jwcid="editPublishers"><img jwcid="editPublishersRollover" src="images/nav/nav_8x1.png" width="178" height="20" border="0" alt="[Edit Publishers]"/></a></td>
  +        <td rowspan="1" colspan="1" width="178" height="20"><a href="#" jwcid="editPublishers"><img jwcid="editPublishersRollover" src="images/nav/nav_8x1.png" width="178" height="20" border="0" alt="Edit Publishers"/></a></td>
         </tr>
         <tr>
  -        <td rowspan="1" colspan="1" width="178" height="21"><a href="#" jwcid="transferBooks"><img jwcid="transferBooksRollover" src="images/nav/nav_9x1.png" width="178" height="21" border="0" alt="[Transfer Books]"/></a></td>
  +        <td rowspan="1" colspan="1" width="178" height="21"><a href="#" jwcid="transferBooks"><img jwcid="transferBooksRollover" src="images/nav/nav_9x1.png" width="178" height="21" border="0" alt="Transfer Books"/></a></td>
         </tr>
   </span>
   	
   <span jwcid="@Conditional" condition="ognl:loggedIn">
         <tr>
  -        <td rowspan="1" colspan="1" width="178" height="29"><a href="#" jwcid="logout"><img jwcid="logoutRollover" src="images/nav/nav_10x1.png" width="178" height="29" border="0" alt="[Logout]"/></a></td>
  +        <td rowspan="1" colspan="1" width="178" height="29"><a href="#" jwcid="logout"><img jwcid="logoutRollover" src="images/nav/nav_10x1.png" width="178" height="29" border="0" alt="Logout"/></a></td>
         </tr>
   </span>
   
   <span jwcid="@Conditional" condition="ognl:!loggedIn">
         <tr>
  -        <td rowspan="1" colspan="1" width="178" height="29"><a href="#" jwcid="login"><img jwcid="loginRollover" src="images/nav/nav_10x1.png" width="178" height="29" border="0" alt="[Login]"/></a></td>
  +        <td rowspan="1" colspan="1" width="178" height="29"><a href="#" jwcid="login"><img jwcid="loginRollover" src="images/nav/nav_10x1.png" width="178" height="29" border="0" alt="Login"/></a></td>
         </tr>
   </span>
       </table>
  @@ -85,11 +85,11 @@
         </tr>
         <tr>
           <td rowspan="1" colspan="2" width="25" height="33"><img src="images/browser/browser_4x1.png" width="25" height="33" border="0"/></td>
  -        <td rowspan="1" colspan="1" width="35" height="33"><a href="#" jwcid="first"><img jwcid="firstRollover" src="images/browser/browser_4x2.png" width="35" height="33" border="0"/></a></td>
  -        <td rowspan="1" colspan="1" width="22" height="33"><a href="#" jwcid="previous"><img jwcid="previousRollover" src="images/browser/browser_4x3.png" width="22" height="33" border="0"/></a></td>
  +        <td rowspan="1" colspan="1" width="35" height="33"><a href="#" jwcid="first"><img jwcid="firstRollover" src="images/browser/browser_4x2.png" width="35" height="33" border="0" alt="First"/></a></td>
  +        <td rowspan="1" colspan="1" width="22" height="33"><a href="#" jwcid="previous"><img jwcid="previousRollover" src="images/browser/browser_4x3.png" width="22" height="33" border="0" alt="Previous"/></a></td>
           <td rowspan="1" colspan="1" width="12" height="33"><img src="images/browser/browser_4x4.png" width="12" height="33" border="0"/></td>
  -        <td rowspan="1" colspan="1" width="24" height="33"><a href="#" jwcid="next"><img jwcid="nextRollover" src="images/browser/browser_4x5.png" width="24" height="33" border="0"/></a></td>
  -        <td rowspan="1" colspan="1" width="35" height="33"><a href="#" jwcid="last"><img jwcid="lastRollover" src="images/browser/browser_4x6.png" width="35" height="33" border="0"/></a></td>
  +        <td rowspan="1" colspan="1" width="24" height="33"><a href="#" jwcid="next"><img jwcid="nextRollover" src="images/browser/browser_4x5.png" width="24" height="33" border="0" alt="Next"/></a></td>
  +        <td rowspan="1" colspan="1" width="35" height="33"><a href="#" jwcid="last"><img jwcid="lastRollover" src="images/browser/browser_4x6.png" width="35" height="33" border="0" alt="Last"/></a></td>
           <td rowspan="1" colspan="2" width="25" height="33"><img src="images/browser/browser_4x7.png" width="25" height="33" border="0"></td>
         </tr>
         <tr>
  @@ -105,7 +105,7 @@
           <td width="35" height="1"><img name="blank" src="images/spacer.png" width="35" height="1" border="0"></td>
           <td width="16" height="1"><img name="blank" src="images/spacer.png" width="16" height="1" border="0"></td>
           <td width="9" height="1"><img name="blank" src="images/spacer.png" width="9" height="1" border="0"></td>
  -      </tr>
  +      </tr> 
       </table>
   </span></td>
       <td><span jwcid="@RenderBody">
  
  
  
  1.8       +24 -1     jakarta-tapestry/examples/Vlib/context/WEB-INF/MyLibrary.page
  
  Index: MyLibrary.page
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/WEB-INF/MyLibrary.page,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MyLibrary.page	31 Mar 2003 21:50:07 -0000	1.7
  +++ MyLibrary.page	1 Apr 2003 17:00:29 -0000	1.8
  @@ -11,7 +11,30 @@
     <property-specification name="currentBook" type="org.apache.tapestry.vlib.ejb.Book"/>
     <property-specification name="ownedQuery" type="org.apache.tapestry.vlib.ejb.IBookQuery" persistent="yes"/>
     
  +  <property-specification name="sortColumn" type="org.apache.tapestry.vlib.ejb.SortColumn" persistent="yes">
  +  	@org.apache.tapestry.vlib.ejb.SortColumn@TITLE
  +  </property-specification>
  +  <property-specification name="descending" type="boolean" persistent="yes"/>
   
  +  <component id="sortTitle" type="ColumnSorter">
  +    <binding name="selected" expression="sortColumn"/>
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@TITLE"/>
  +    <binding name="descending" expression="descending"/>
  +    <binding name="listener" expression="listeners.resort"/>
  +  </component>   
  +    
  +  <component id="sortAuthor" copy-of="sortTitle">
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@AUTHOR"/>
  +  </component>
  +  
  +  <component id="sortPublisher" copy-of="sortTitle">
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@PUBLISHER"/>	
  +  </component>
  +  
  +  <component id="sortBorrower" copy-of="sortTitle">
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@HOLDER"/>
  +  </component>
  +  
     <component id="holderLink" type="PersonLink">
       <binding name="primaryKey" expression="currentBook.holderPrimaryKey"/>
       <binding name="name" expression="currentBook.holderName"/>
  
  
  
  1.8       +25 -1     jakarta-tapestry/examples/Vlib/context/WEB-INF/BorrowedBooks.page
  
  Index: BorrowedBooks.page
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/WEB-INF/BorrowedBooks.page,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BorrowedBooks.page	31 Mar 2003 21:50:07 -0000	1.7
  +++ BorrowedBooks.page	1 Apr 2003 17:00:29 -0000	1.8
  @@ -10,6 +10,30 @@
     <property-specification name="message" type="java.lang.String"/>
     <property-specification name="currentBook" type="org.apache.tapestry.vlib.ejb.Book"/>
     <property-specification name="borrowedQuery" type="org.apache.tapestry.vlib.ejb.IBookQuery" persistent="yes"/>
  +
  +  <property-specification name="sortColumn" type="org.apache.tapestry.vlib.ejb.SortColumn" persistent="yes">
  +  	@org.apache.tapestry.vlib.ejb.SortColumn@TITLE
  +  </property-specification>
  +  <property-specification name="descending" type="boolean" persistent="yes"/>
  +  
  +  <component id="sortTitle" type="ColumnSorter">
  +    <binding name="selected" expression="sortColumn"/>
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@TITLE"/>
  +    <binding name="descending" expression="descending"/>
  +    <binding name="listener" expression="listeners.resort"/>
  +  </component>   
  +    
  +  <component id="sortAuthor" copy-of="sortTitle">
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@AUTHOR"/>
  +  </component>
  +  
  +  <component id="sortPublisher" copy-of="sortTitle">
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@PUBLISHER"/>	
  +  </component>
  +  
  +  <component id="sortOwner" copy-of="sortTitle">
  +    <binding name="sortColumn" expression="@org.apache.tapestry.vlib.ejb.SortColumn@OWNER"/>
  +  </component>
     
     <component id="returnRollover" type="Rollover">
       <binding name="image" expression="assets.return"/>
  
  
  
  1.1                  jakarta-tapestry/examples/Vlib/context/WEB-INF/ColumnSorter.jwc
  
  Index: ColumnSorter.jwc
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!-- $Id: Borrow.jwc,v 1.7 2003/03/29 18:49:07 hlship Exp $ -->
  <!DOCTYPE component-specification PUBLIC 
    "-//Apache Software Foundation//Tapestry Specification 1.4//EN" 
    "http://jakarta.apache.org/tapestry/dtd/Tapestry_1_4.dtd">
  
  <component-specification
  	class="org.apache.tapestry.vlib.components.ColumnSorter"
    allow-body="yes" allow-informal-parameters="no">
  
    <parameter name="selected" type="org.apache.tapestry.vlib.ejb.SortColumn" required="yes" direction="auto"/>
    <parameter name="descending" type="boolean" required="yes" direction="auto"/>
    <parameter name="sortColumn" type="org.apache.tapestry.vlib.ejb.SortColumn" required="yes" direction="auto"/>
    <parameter name="listener" type="org.apache.tapestry.IActionListener" required="yes" direction="auto"/>
    
    <component id="link1" type="DirectLink">
    	<binding name="listener" expression="listeners.handleClick"/>	
    </component>
    
    <component id="link2" copy-of="link1"/>
    
    <component id="rollover" type="Rollover">
    		<binding name="image">
    			descending ? assets.down : assets.up	
    		</binding>
    		<binding name="focus">
    			descending ? assets.down_h : assets.up_h
    		</binding>
    </component>
    
    <context-asset name="up" path="images/sort-up.png"/>
    <context-asset name="up_h" path="images/sort-up_h.png"/>
    <context-asset name="down" path="images/sort-down.png"/>
    <context-asset name="down_h" path="images/sort-down_h.png"/>
    
  </component-specification>
  
  
  1.1                  jakarta-tapestry/examples/Vlib/context/WEB-INF/ColumnSorter.html
  
  Index: ColumnSorter.html
  ===================================================================
  <!-- $Id: ColumnSorter.html,v 1.1 2003/04/01 17:00:28 hlship Exp $ -->
  
  <span jwcid="$content$">
  <a jwcid="link1"><span jwcid="@RenderBody"/></a>
  <span jwcid="@Conditional" condition="ognl:sortColumn == selected">
  <a jwcid="link2"><img jwcid="rollover" width="17" height="16" alt="Resort Column"/></a>
  </span>
  
  
  1.6       +2 -2      jakarta-tapestry/examples/Vlib/context/Home.html
  
  Index: Home.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/Home.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Home.html	29 Mar 2003 18:49:09 -0000	1.5
  +++ Home.html	1 Apr 2003 17:00:29 -0000	1.6
  @@ -12,7 +12,7 @@
   <span jwcid="@ShowError"/>
   <span jwcid="@ShowMessage"/>
   
  -<form jwcid="@Form" listener="ognl:listeners.search">
  +<form jwcid="@Form" listener="ognl:listeners.search" stateful="ognl:false">
     <table class="form">
       <tr>
         <th>Title</th>
  
  
  
  1.4       +6 -6      jakarta-tapestry/examples/Vlib/context/BookMatches.html
  
  Index: BookMatches.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/BookMatches.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BookMatches.html	31 Mar 2003 21:50:07 -0000	1.3
  +++ BookMatches.html	1 Apr 2003 17:00:29 -0000	1.4
  @@ -4,11 +4,11 @@
   
   <table class="data">
     <tr>
  -    <th>Title</th>
  -    <th>Author</th>
  -    <th>Publisher</th>
  -    <th>Owner</th>
  -    <th>Borrowed&nbsp;By</th>
  +    <th><span jwcid="sortTitle">Title</span></th>
  +    <th><span jwcid="sortAuthor">Author</span></th>
  +    <th><span jwcid="sortPublisher">Publisher</span></th>
  +    <th><span jwcid="sortOwner">Owner</span></th>
  +    <th><span jwcid="sortBorrower">Borrowed&nbsp;By</span></th>
       <th>Borrow</th>
     </tr>
       <tr jwcid="browser@Browser" query="ognl:bookQuery" value="ognl:currentMatch">
  
  
  
  1.2       +3 -3      jakarta-tapestry/examples/Vlib/context/TransferBooksSelect.html
  
  Index: TransferBooksSelect.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/TransferBooksSelect.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TransferBooksSelect.html	29 Mar 2003 18:49:09 -0000	1.1
  +++ TransferBooksSelect.html	1 Apr 2003 17:00:29 -0000	1.2
  @@ -14,6 +14,7 @@
   	
   <br clear="left"/>
   
  +<span jwcid="@ShowMessage"/>
   <span jwcid="@ShowError"/>
   
   <form jwcid="@Form" listener="ognl:listeners.formSubmit">
  @@ -35,8 +36,7 @@
       <tr>
         <td>
         </td>
  -      <td><input type="image" src="images/continue.png" alt="Continue" height="20" width="58" border="0"/>&nbsp;
  -      	<a href="#" jwcid="@PageLink" page="MyLibrary"><img src="images/cancel.png" height="20" width="51" border="0"/></a>
  +      <td><input type="image" src="images/continue.png" alt="Continue" height="20" width="58" border="0"/>
         </td>
       </tr>
     </table>
  
  
  
  1.5       +2 -2      jakarta-tapestry/examples/Vlib/context/EditUsers.html
  
  Index: EditUsers.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/EditUsers.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EditUsers.html	29 Mar 2003 18:49:10 -0000	1.4
  +++ EditUsers.html	1 Apr 2003 17:00:29 -0000	1.5
  @@ -44,7 +44,7 @@
         </td>
       </tr>
       <tr>
  -    <td class="control"><input type="image" src="images/update.png" width="52" height="20"/>
  +    <td class="control"><input type="image" src="images/update.png" width="52" height="20" alt="Update"/>
       </td>	
       </tr>
     </table>
  
  
  
  1.6       +5 -5      jakarta-tapestry/examples/Vlib/context/MyLibrary.html
  
  Index: MyLibrary.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/MyLibrary.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MyLibrary.html	31 Mar 2003 21:50:07 -0000	1.5
  +++ MyLibrary.html	1 Apr 2003 17:00:29 -0000	1.6
  @@ -20,10 +20,10 @@
   <table class="data">
   
     <tr>
  -    <th>Title</th>
  -    <th>Author</th>
  -    <th>Publisher</th>
  -    <th>Borrowed By</th>
  +    <th><span jwcid="sortTitle">Title</span></th>
  +    <th><span jwcid="sortAuthor">Author</span></th>
  +    <th><span jwcid="sortPublisher">Publisher</span></th>
  +    <th><span jwcid="sortBorrower">Borrowed By</span></th>
       <th>Edit/Delete</th>
     </tr>
     <tr jwcid="browser@Browser" query="ognl:ownedQuery" value="ognl:currentBook">
  
  
  
  1.7       +5 -5      jakarta-tapestry/examples/Vlib/context/BorrowedBooks.html
  
  Index: BorrowedBooks.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/BorrowedBooks.html,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BorrowedBooks.html	31 Mar 2003 21:50:07 -0000	1.6
  +++ BorrowedBooks.html	1 Apr 2003 17:00:29 -0000	1.7
  @@ -16,10 +16,10 @@
   
   <table class="data">
     <tr>
  -    <th>Title</th>
  -    <th>Author</th>
  -    <th>Publisher</th>
  -    <th>Owner</th>
  +    <th><span jwcid="sortTitle">Title</span></th>
  +    <th><span jwcid="sortAuthor">Author</span></th>
  +    <th><span jwcid="sortPublisher">Publisher</span></th>
  +    <th><span jwcid="sortOwner">Owner</span></th>
       <th>Return</th>
     </tr>
     <tr jwcid="browser@Browser" query="ognl:borrowedQuery" value="ognl:currentBook">
  
  
  
  1.5       +2 -2      jakarta-tapestry/examples/Vlib/context/Login.html
  
  Index: Login.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/Login.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Login.html	29 Mar 2003 18:49:10 -0000	1.4
  +++ Login.html	1 Apr 2003 17:00:29 -0000	1.5
  @@ -2,7 +2,7 @@
   <html jwcid="$content$">
   <body jwcid="@Border">
   <span jwcid="@ShowError"/><span jwcid="@ShowValidationError" delegate="ognl:beans.delegate"/>
  -<form jwcid="@Form" listener="ognl:listeners.attemptLogin" delegate="ognl:beans.delegate">
  +<form jwcid="@Form" listener="ognl:listeners.attemptLogin" delegate="ognl:beans.delegate" stateful="ognl:false">
     <table class="form">
       <tr>
         <th><span jwcid="@FieldLabel" field="ognl:components.inputEmail">Email Address</span>
  
  
  
  1.5       +2 -2      jakarta-tapestry/examples/Vlib/context/EditPublishers.html
  
  Index: EditPublishers.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/EditPublishers.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EditPublishers.html	29 Mar 2003 18:49:10 -0000	1.4
  +++ EditPublishers.html	1 Apr 2003 17:00:29 -0000	1.5
  @@ -19,7 +19,7 @@
         </td>
       </tr>
       <tr>
  -    <td class="control"><input type="image" src="images/update.png" width="52" height="20"/>
  +    <td class="control"><input type="image" src="images/update.png" width="52" height="20" alt="Update"/>
       </td>	
       </tr>
     </table>
  
  
  
  1.4       +5 -8      jakarta-tapestry/examples/Vlib/context/ViewPerson.html
  
  Index: ViewPerson.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/ViewPerson.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ViewPerson.html	31 Mar 2003 21:50:07 -0000	1.3
  +++ ViewPerson.html	1 Apr 2003 17:00:29 -0000	1.4
  @@ -24,14 +24,13 @@
   
   <span jwcid="@Conditional" condition="ognl:components.browser.resultCount != 0">
   
  -<span >
   						 
   <table class="data">
     <tr>
  -    <th>Title</th>
  -    <th>Author</th>
  -    <th>Publisher</th>
  -    <th>Borrowed&nbsp;By</th>
  +    <th><span jwcid="sortTitle">Title</span></th>
  +    <th><span jwcid="sortAuthor">Author</span></th>
  +    <th><span jwcid="sortPublisher">Publisher</span></th>
  +    <th><span jwcid="sortBorrower">Borrowed&nbsp;By</span></th>
       <th>Borrow</th>
     </tr>
     <tr jwcid="browser@Browser" query="ognl:query" value="ognl:currentMatch">
  @@ -48,8 +47,6 @@
     </tr>
   </table>
   
  -
  -</span>
   
   </span>
   </body>
  
  
  
  1.3       +14 -1     jakarta-tapestry/examples/Vlib/context/css/vlib.css
  
  Index: vlib.css
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/context/css/vlib.css,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- vlib.css	31 Mar 2003 21:50:08 -0000	1.2
  +++ vlib.css	1 Apr 2003 17:00:30 -0000	1.3
  @@ -47,6 +47,9 @@
     padding-right: 8px;
   }
   
  +
  +
  +
   TABLE.form TD, TABLE.form TH {
     border-width: 1px;
     border-color: #c0c0c0;
  @@ -75,12 +78,22 @@
     border-style: none;
   }
   
  -TABLE.data TR TH
  +TABLE.data TH
   {
     font-weight: bold;
     text-align: center;
     background-color: Blue;
     color: White;
  +}
  +
  +TABLE.data TH A
  +{
  +	color: white;
  +}
  +
  +TABLE.data TH A:hover
  +{
  +  color: #e6ae19;
   }
   
   
  
  
  
  1.2       +6 -7      jakarta-tapestry/examples/VlibBeans/src/org/apache/tapestry/vlib/ejb/IBookQuery.java
  
  Index: IBookQuery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/VlibBeans/src/org/apache/tapestry/vlib/ejb/IBookQuery.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IBookQuery.java	5 Mar 2003 23:08:15 -0000	1.1
  +++ IBookQuery.java	1 Apr 2003 17:00:30 -0000	1.2
  @@ -85,7 +85,6 @@
   
       /**
        *  Performs a query of books with the matching title and (optionally) publisher.
  -     *  The results will be sorted by book title.
        *
        *  @param title The title to be search for.  Any book with that contains this
        *  value in its title attribute will be returned.  Use null to not limit the
  @@ -97,26 +96,26 @@
        *
        **/
   
  -    public int masterQuery(String title, String author, Object publisherPK) throws RemoteException;
  +    public int masterQuery(String title, String author, Integer publisherPK, SortOrdering sortOrdering) throws RemoteException;
   
       /**
        *  Queries on books owned by a given person, sorted by title.
        *
        **/
   
  -    public int ownerQuery(Integer ownerPK) throws RemoteException;
  +    public int ownerQuery(Integer ownerPK, SortOrdering sortOrdering) throws RemoteException;
   
       /**
        *  Queries on books held by a given person, sorted by title.
        *
        **/
   
  -    public int holderQuery(Integer holderPK) throws RemoteException;
  +    public int holderQuery(Integer holderPK, SortOrdering sortOrdering) throws RemoteException;
   
       /**
  -     *  Queries the list of books held by the borrower but not owned by the borrower..
  +     *  Queries the list of books held by the borrower but not owned by the borrower.
        *
        **/
   
  -    public int borrowerQuery(Integer borrowerPK) throws RemoteException;
  +    public int borrowerQuery(Integer borrowerPK, SortOrdering sortOrdering) throws RemoteException;
   }
  
  
  
  1.1                  jakarta-tapestry/examples/VlibBeans/src/org/apache/tapestry/vlib/ejb/SortColumn.java
  
  Index: SortColumn.java
  ===================================================================
  package org.apache.tapestry.vlib.ejb;
  
  import org.apache.commons.lang.enum.Enum;
  
  /**
   *  Represents the different columns which may be sorted.
   *
   *  @author Howard Lewis Ship
   *  @version $Id: SortColumn.java,v 1.1 2003/04/01 17:00:30 hlship Exp $
   *  @since 2.4
   *
   **/
  
  public class SortColumn extends Enum
  {
  	/**
  	 *  Sort by book title.
  	 * 
  	 **/
  	
  	public static final SortColumn TITLE = new SortColumn("TITLE");
  	
  	/**
  	 *  Sort by author name.
  	 *  
  	 **/
  	
  	public static final SortColumn AUTHOR = new SortColumn("AUTHOR");
  
  	/**
  	 *  Sort by publisher name.
  	 * 
  	 **/
  	
  	public static final SortColumn PUBLISHER = new SortColumn("PUBLISHER");
  	
  	/**
  	 *  Sort by holder name (last name, then first).  Not applicable
  	 *  to all queries.
  	 * 
  	 **/
  	
  	public static final SortColumn HOLDER = new SortColumn("HOLDER");
  
  	/**
  	 *  Sort by book owner (last name, then first).  Not applicable
  	 *  to all queries.
  	 * 
  	 **/
  	
  	public static final SortColumn OWNER = new SortColumn("OWNER");
  	
      private SortColumn(String name)
      {
          super(name);
      }
  
  }
  
  
  
  1.1                  jakarta-tapestry/examples/VlibBeans/src/org/apache/tapestry/vlib/ejb/SortOrdering.java
  
  Index: SortOrdering.java
  ===================================================================
  package org.apache.tapestry.vlib.ejb;
  
  import java.io.Serializable;
  
  import org.apache.commons.lang.builder.ToStringBuilder;
  
  /**
   *  Used with {@link org.apache.tapestry.vlib.ejb.IBookQuery} to represent
   *  the order in which columns are sorted in the result set.  SortOrdering
   *  is immutable.
   *
   *  @author Howard Lewis Ship
   *  @version $Id: SortOrdering.java,v 1.1 2003/04/01 17:00:30 hlship Exp $
   *  @since 2.4
   *
   **/
  
  public class SortOrdering implements Serializable
  {
      private SortColumn _column;
      private boolean _descending;
  
      public SortOrdering(SortColumn column)
      {
          this(column, false);
      }
  
      public SortOrdering(SortColumn column, boolean descending)
      {
          _column = column;
          _descending = descending;
      }
  
      public boolean isDescending()
      {
          return _descending;
      }
  
      public SortColumn getColumn()
      {
          return _column;
      }
  
      public String toString()
      {
          ToStringBuilder builder = new ToStringBuilder(this);
          builder.append("column", _column);
          builder.append("descending", _descending);
  
          return builder.toString();
      }
  
  }
  
  
  
  1.1                  jakarta-tapestry/examples/Vlib/context/images/sort-up_h.png
  
  	<<Binary file>>
  
  
  1.1                  jakarta-tapestry/examples/Vlib/context/images/sort-down.png
  
  	<<Binary file>>
  
  
  1.1                  jakarta-tapestry/examples/Vlib/context/images/sort-up.png
  
  	<<Binary file>>
  
  
  1.1                  jakarta-tapestry/examples/Vlib/context/images/sort-down_h.png
  
  	<<Binary file>>
  
  
  1.6       +38 -5     jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/components/Border.java
  
  Index: Border.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/components/Border.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Border.java	31 Mar 2003 21:50:08 -0000	1.5
  +++ Border.java	1 Apr 2003 17:00:30 -0000	1.6
  @@ -63,10 +63,13 @@
   import org.apache.tapestry.IPage;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
  +import org.apache.tapestry.callback.ICallback;
  +import org.apache.tapestry.callback.PageCallback;
  +import org.apache.tapestry.vlib.IActivate;
   import org.apache.tapestry.vlib.IMessageProperty;
   import org.apache.tapestry.vlib.VirtualLibraryEngine;
   import org.apache.tapestry.vlib.Visit;
  -import org.apache.tapestry.vlib.pages.EditProfile;
  +import org.apache.tapestry.vlib.pages.Login;
   
   /**
    *  The standard Border component, which provides the title of the page,
  @@ -208,10 +211,40 @@
   
       public void editProfile(IRequestCycle cycle)
       {
  -        EditProfile page = (EditProfile) cycle.getPage("EditProfile");
  -
  -        page.beginEdit(cycle);
  +    	activate("EditProfile", cycle);
       }
  +
  +	public void viewBorrowedBooks(IRequestCycle cycle)
  +	{
  +		activate("BorrowedBooks", cycle);
  +	}
  +	
  +	public void viewMyLibrary(IRequestCycle cycle)
  +	{
  +		activate("MyLibrary", cycle);
  +	}
  +	
  +	private void activate(String pageName, IRequestCycle cycle)
  +	{
  +		IActivate page = (IActivate)cycle.getPage(pageName);
  +		
  +		page.validate(cycle);
  +		
  +		page.activate(cycle);
  +	}
  +
  +	public void login(IRequestCycle cycle)
  +	{
  +		Visit visit = (Visit)cycle.getEngine().getVisit();
  +
  +		if (visit != null && visit.isUserLoggedIn())
  +			return;
  +			
  +		ICallback callback = new PageCallback(getPage().getPageName());
  +		Login loginPage = (Login)cycle.getPage("Login");
  +		loginPage.setCallback(callback);
  +		cycle.setPage(loginPage);
  +	}
   
       public void logout(IRequestCycle cycle)
       {
  
  
  
  1.1                  jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/components/ColumnSorter.java
  
  Index: ColumnSorter.java
  ===================================================================
  package org.apache.tapestry.vlib.components;
  
  import org.apache.tapestry.BaseComponent;
  import org.apache.tapestry.IActionListener;
  import org.apache.tapestry.IAsset;
  import org.apache.tapestry.IRequestCycle;
  import org.apache.tapestry.Tapestry;
  import org.apache.tapestry.vlib.ejb.SortColumn;
  
  /**
   *  Comopnent for allowing a column to be sorted.
   *
   *  @author Howard Lewis Ship
   *  @version $Id: ColumnSorter.java,v 1.1 2003/04/01 17:00:30 hlship Exp $
   *  @since 2.4
   *
   **/
  
  public abstract class ColumnSorter extends BaseComponent
  {
      public abstract SortColumn getSortColumn();
  
      public abstract SortColumn getSelected();
      public abstract void setSelected(SortColumn selected);
  
      public abstract boolean isDescending();
      public abstract void setDescending(boolean descending);
  
      public abstract IActionListener getListener();
  
      public void handleClick(IRequestCycle cycle)
      {
          SortColumn selected = getSelected();
          SortColumn sortColumn = getSortColumn();
  
          if (selected != sortColumn)
          {
              setSelected(sortColumn);
              setDescending(false);
          }
          else
          {
              boolean current = isDescending();
              setDescending(!current);
          }
  
          IActionListener listener = getListener();
          if (listener == null)
              throw Tapestry.createRequiredParameterException(this, "listener");
  
          listener.actionTriggered(this, cycle);
      }
  
      public IAsset getImage()
      {
          return getAsset(isDescending() ? "up" : "down");
  
      }
  
      public IAsset getFocus()
      {
          return getAsset(isDescending() ? "up_h" : "down_h");
      }
  }
  
  
  
  1.4       +2 -2      jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/admin/TransferBooksTransfer.java
  
  Index: TransferBooksTransfer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/pages/admin/TransferBooksTransfer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TransferBooksTransfer.java	31 Mar 2003 21:50:08 -0000	1.3
  +++ TransferBooksTransfer.java	1 Apr 2003 17:00:30 -0000	1.4
  @@ -228,7 +228,7 @@
               {
                   IBookQuery query = vengine.createNewQuery();
   
  -                int count = query.ownerQuery(user.getPrimaryKey());
  +                int count = query.ownerQuery(user.getPrimaryKey(), null);
   
                   if (count > 0)
                       books = query.get(0, count);
  
  
  
  1.1                  jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/IActivate.java
  
  Index: IActivate.java
  ===================================================================
  package org.apache.tapestry.vlib;
  
  import org.apache.tapestry.IPage;
  import org.apache.tapestry.IRequestCycle;
  
  /**
   *  Interface used for pages that may be activated by the Border component.
   *
   *  @author Howard Lewis Ship
   *  @version $Id: IActivate.java,v 1.1 2003/04/01 17:00:30 hlship Exp $
   *  @since 2.4
   *
   **/
  
  public interface IActivate extends IPage
  {
  	public void activate(IRequestCycle cycle);
  }
  
  
  
  1.1                  jakarta-tapestry/examples/Vlib/src/org/apache/tapestry/vlib/ActivateCallback.java
  
  Index: ActivateCallback.java
  ===================================================================
  package org.apache.tapestry.vlib;
  
  import org.apache.tapestry.IRequestCycle;
  import org.apache.tapestry.callback.ICallback;
  
  /**
   *  Callback implementation for pages which implement
   *  the {@link org.apache.tapestry.vlib.IActivate}
   *  interface.
   *
   *  @author Howard Lewis Ship
   *  @version $Id: ActivateCallback.java,v 1.1 2003/04/01 17:00:30 hlship Exp $
   *  @since 2.4
   *
   **/
  
  public class ActivateCallback implements ICallback
  {
      private String _pageName;
  
      public ActivateCallback(IActivate page)
      {
          this(page.getPageName());
      }
  
      public ActivateCallback(String pageName)
      {
          _pageName = pageName;
      }
  
      public void performCallback(IRequestCycle cycle)
      {
          IActivate page = (IActivate) cycle.getPage(_pageName);
  
  		page.validate(cycle);
          page.activate(cycle);
      }
  }
  
  

Mime
View raw message