CVS: Tapestry/examples/Vlib/src/net/sf/tapestry/vlib/pages ViewPerson.java,NONE,1.1.2.1 Matches.page,1.3,NONE ViewBook.html,1.2,NONE EditProfile.page,1.4,NONE Login.html,1.2,NONE Home.html,1.2,NONE ViewBook.page,1.5,NONE Login.page,1.5,NONE Home.page,1.4,NONE EditBook.html,1.2,NONE PersonPage.html,1.2,NONE PersonPage.java,1.8,NONE EditBook.page,1.5,NONE PersonPage.page,1.5,NONE NewBook.html,1.2,NONE ConfirmBookDelete.html,1.2,NONE NewBook.page,1.4,NONE ApplicationUnavailable.html,1.2,NONE ConfirmBookDelete.page,1.4,NONE BorrowedBooks.html,1.2,NONE ApplicationUnavailable.page,1.2,NONE Register.html,1.3,NONE MyLibrary.html,1.2,NONE BorrowedBooks.page,1.4,NONE Matches.html,1.2,NONE EditProfile.html,1.2,NONE Register.page,1.4,NONE MyLibrary.page,1.5,NONE
Howard Lewis Ship <[email protected]>
| Newsgroups | gmane.comp.java.tapestry.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tapestry/Tapestry/examples/Vlib/src/net/sf/tapestry/vlib/pages
In directory sc8-pr-cvs1:/tmp/cvs-serv29950/examples/Vlib/src/net/sf/tapestry/vlib/pages
Added Files:
Tag: hship-2-3
ViewPerson.java
Removed Files:
Tag: hship-2-3
Matches.page ViewBook.html EditProfile.page Login.html
Home.html ViewBook.page Login.page Home.page EditBook.html
PersonPage.html PersonPage.java EditBook.page PersonPage.page
NewBook.html ConfirmBookDelete.html NewBook.page
ApplicationUnavailable.html ConfirmBookDelete.page
BorrowedBooks.html ApplicationUnavailable.page Register.html
MyLibrary.html BorrowedBooks.page Matches.html
EditProfile.html Register.page MyLibrary.page
Log Message:
Reorganize the Vlib example to move templates into context, and specifications into WEB-INF.
--- NEW FILE: ViewPerson.java ---
package net.sf.tapestry.vlib.pages;
import java.rmi.RemoteException;
import javax.ejb.FinderException;
import javax.ejb.RemoveException;
import net.sf.tapestry.ApplicationRuntimeException;
import net.sf.tapestry.IExternalPage;
import net.sf.tapestry.IPageLoader;
import net.sf.tapestry.IRequestCycle;
import net.sf.tapestry.PageLoaderException;
import net.sf.tapestry.html.BasePage;
import net.sf.tapestry.spec.ComponentSpecification;
import net.sf.tapestry.vlib.VirtualLibraryEngine;
import net.sf.tapestry.vlib.components.Browser;
import net.sf.tapestry.vlib.ejb.Book;
import net.sf.tapestry.vlib.ejb.IBookQuery;
import net.sf.tapestry.vlib.ejb.IOperations;
import net.sf.tapestry.vlib.ejb.IPerson;
import net.sf.tapestry.vlib.ejb.Person;
/**
* Displays the book inventory list for a single {@link IPerson}, showing
* what books are owned by the person, who has them borrowed, etc. If the
* user is logged in, then books can be borrowed from this page as well.
*
* @author Howard Lewis Ship
* @version $Id: ViewPerson.java,v 1.1.2.1 2002/12/16 19:11:16 hship Exp $
*
**/
public class ViewPerson extends BasePage implements IExternalPage
{
private IBookQuery query;
private Book currentMatch;
private Person person;
private Browser browser;
public void detach()
{
query = null;
currentMatch = null;
person = null;
super.detach();
}
public void finishLoad()
{
browser = (Browser) getComponent("browser");
}
public void setPerson(Person value)
{
person = value;
fireObservedChange("person", value);
}
public Person getPerson()
{
return person;
}
public String getEmailURL()
{
return "mailto:" + person.getEmail();
}
/**
* Gets the {@link IBookQuery} session bean that contains
* the books owned by the user, creating it fresh as needed.
*
**/
public IBookQuery getQuery()
{
if (query == null)
{
VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
setQuery(vengine.createNewQuery());
}
return query;
}
/**
* Sets the query persistent page property.
*
**/
public void setQuery(IBookQuery value)
{
query = value;
fireObservedChange("query", value);
}
/**
* Invoked by the external service to being viewing the
* identified person.
*
**/
public void activateExternalPage(Object[] parameters, IRequestCycle cycle)
{
Integer personPK = (Integer)parameters[0];
VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
for (int i = 0; i < 2; i++)
{
try
{
IBookQuery query = getQuery();
int count = query.ownerQuery(personPK);
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 > 0);
setQuery(null);
}
}
cycle.setPage(this);
}
public Book getCurrentMatch()
{
return currentMatch;
}
public void setCurrentMatch(Book value)
{
currentMatch = value;
}
public boolean getOmitHolderLink()
{
return !currentMatch.isBorrowed();
}
/**
* Removes the book query bean, if the handle to the bean
* is non-null.
*
**/
public void cleanupPage()
{
try
{
if (query != null)
query.remove();
}
catch (RemoveException ex)
{
throw new ApplicationRuntimeException(ex);
}
catch (RemoteException ex)
{
throw new ApplicationRuntimeException(ex);
}
super.cleanupPage();
}
}
--- Matches.page DELETED ---
--- ViewBook.html DELETED ---
--- EditProfile.page DELETED ---
--- Login.html DELETED ---
--- Home.html DELETED ---
--- ViewBook.page DELETED ---
--- Login.page DELETED ---
--- Home.page DELETED ---
--- EditBook.html DELETED ---
--- PersonPage.html DELETED ---
--- PersonPage.java DELETED ---
--- EditBook.page DELETED ---
--- PersonPage.page DELETED ---
--- NewBook.html DELETED ---
--- ConfirmBookDelete.html DELETED ---
--- NewBook.page DELETED ---
--- ApplicationUnavailable.html DELETED ---
--- ConfirmBookDelete.page DELETED ---
--- BorrowedBooks.html DELETED ---
--- ApplicationUnavailable.page DELETED ---
--- Register.html DELETED ---
--- MyLibrary.html DELETED ---
--- BorrowedBooks.page DELETED ---
--- Matches.html DELETED ---
--- EditProfile.html DELETED ---
--- Register.page DELETED ---
--- MyLibrary.page DELETED ---
-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/