You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2005/09/29 15:00:57 UTC
svn commit: r292425 - in /jakarta/tapestry/trunk/examples/Vlib/src:
context/BookMatches.html context/BorrowedBooks.html context/EditBook.html
context/EditProfile.html java/org/apache/tapestry/vlib/pages/EditProfile.java
Author: hlship
Date: Thu Sep 29 06:00:52 2005
New Revision: 292425
URL: http://svn.apache.org/viewcvs?rev=292425&view=rev
Log:
More progress on the Virtual Library
Modified:
jakarta/tapestry/trunk/examples/Vlib/src/context/BookMatches.html
jakarta/tapestry/trunk/examples/Vlib/src/context/BorrowedBooks.html
jakarta/tapestry/trunk/examples/Vlib/src/context/EditBook.html
jakarta/tapestry/trunk/examples/Vlib/src/context/EditProfile.html
jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/EditProfile.java
Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/BookMatches.html
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/BookMatches.html?rev=292425&r1=292424&r2=292425&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/BookMatches.html (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/BookMatches.html Thu Sep 29 06:00:52 2005
@@ -11,7 +11,7 @@
<th>Borrow</th>
</tr>
<tr jwcid="browser@Browser" query="ognl:bookQuery" value="ognl:currentMatch" listener="listener:requery">
- <td><a href="#" jwcid="@BookLink" book="ognl:currentMatch">Swing Second Edition</a>
+ <td><a href="#" jwcid="link@BookLink" book="ognl:currentMatch">Swing Second Edition</a>
</td>
<td><span jwcid="@Insert" value="ognl:currentMatch.author">Robinson and Vorobiev</span>
</td>
@@ -21,7 +21,7 @@
</td>
<td><a jwcid="holderLink" href="#">Howard Lewis Ship</a>
</td>
- <td class="icon"><a jwcid="@Borrow" book="ognl:currentMatch" href="#"><img src="images/checkout.png" alt="Borrow" border="0" vspace="2"></a>
+ <td class="icon"><a jwcid="borrow@Borrow" book="ognl:currentMatch" href="#"><img src="images/checkout.png" alt="Borrow" border="0" vspace="2"></a>
</td>
</tr>
</table>
Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/BorrowedBooks.html
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/BorrowedBooks.html?rev=292425&r1=292424&r2=292425&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/BorrowedBooks.html (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/BorrowedBooks.html Thu Sep 29 06:00:52 2005
@@ -22,13 +22,13 @@
<th>Return</th>
</tr>
<tr jwcid="browser@Browser" query="ognl:borrowedQuery" value="ognl:currentBook" listener="listener:requery">
- <td><a jwcid="@BookLink" book="ognl:currentBook" href="#" class="clsDataBlue">DocBook:The Definitive Guide</a>
+ <td><a jwcid="book@BookLink" book="ognl:currentBook" href="#" class="clsDataBlue">DocBook:The Definitive Guide</a>
</td>
<td><span jwcid="@Insert" value="ognl:currentBook.author">Walsh & Muellner</span>
</td>
<td><span jwcid="@Insert" value="ognl:currentBook.publisherName">O'Reilly</span>
</td>
- <td><a jwcid="@PersonLink" name="ognl:currentBook.ownerName" id="ognl:currentBook.ownerId" href="#">Jim Moran</a>
+ <td><a jwcid="owner@PersonLink" name="ognl:currentBook.ownerName" id="ognl:currentBook.ownerId" href="#">Jim Moran</a>
</td>
<td class="icon"><a jwcid="link@DirectLink" parameters="ognl:currentBook.id" listener="listener:returnBook" href="#"><img jwcid="returnRollover" src="images/return.png" alt="Return" width="25" height="26" border="0"/></a>
</td>
Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/EditBook.html
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/EditBook.html?rev=292425&r1=292424&r2=292425&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/EditBook.html (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/EditBook.html Thu Sep 29 06:00:52 2005
@@ -59,7 +59,7 @@
<tr>
<th>Hidden</th>
<td></td>
- <td><input jwcid="hideden@Checkbox" selected="ognl:attributes.hidden" type="checkbox"/>Check to prevent this book from appearing in searches.
+ <td><input jwcid="hidden@Checkbox" selected="ognl:attributes.hidden" type="checkbox"/>Check to prevent this book from appearing in searches.
</td>
</tr>
<tr>
Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/EditProfile.html
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/EditProfile.html?rev=292425&r1=292424&r2=292425&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/EditProfile.html (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/EditProfile.html Thu Sep 29 06:00:52 2005
@@ -1,5 +1,5 @@
<html jwcid="$content$">
-<body jwcid="@Border">
+<body jwcid="border@Border">
<p>
Update your registration information using the form below. Fields marked with
@@ -9,7 +9,7 @@
<span jwcid="@ShowError"/>
<span jwcid="@ShowValidationError" delegate="ognl:validationDelegate"/>
-<form jwcid="@Form" listener="listener:updateProfile" delegate="ognl:validationDelegate">
+<form jwcid="form@Form" listener="listener:updateProfile" delegate="ognl:validationDelegate">
<table class="form">
<tr>
<th>First Name</th>
@@ -18,32 +18,32 @@
</td>
</tr>
<tr>
- <th><span jwcid="@FieldLabel" field="ognl:components.inputLastName">Last Name</span></th>
+ <th><span jwcid="@FieldLabel" field="component:inputLastName">Last Name</span></th>
<td><span class="required-field">*</span></td>
<td><input jwcid="inputLastName" size="30" maxlength="30" type="text"/>
</td>
</tr>
<tr>
- <th><span jwcid="@FieldLabel" field="ognl:components.inputEmail">E-mail</span></th>
+ <th><span jwcid="@FieldLabel" field="component:inputEmail">E-mail</span></th>
<td><span class="required-field">*</span></td>
<td><input jwcid="inputEmail" type="text" size="30" maxlength="60"/>
</td>
</tr>
<tr>
- <th><span jwcid="@FieldLabel" field="ognl:components.inputPassword1">Password</span></th>
+ <th><span jwcid="@FieldLabel" field="component:inputPassword1">Password</span></th>
<td></td>
<td><input jwcid="inputPassword1" type="password" size="20" maxlength="20"/>
</td>
</tr>
<tr>
- <th><span jwcid="@FieldLabel" field="ognl:components.inputPassword2">Password (again)</span></th>
+ <th><span jwcid="@FieldLabel" field="component:inputPassword2">Password (again)</span></th>
<td></td>
<td><input jwcid="inputPassword2" type="password" size="20" maxlength="20"/>
</td>
</tr>
<tr>
<td colspan="2"></td>
- <td><input type="image" src="images/update.png" height="20" width="52" border="0" alt="Update"></td>
+ <td><input type="image" src="images/update.png" height="20" width="52" border="0" alt="Update"/></td>
</tr>
</table>
</form>
Modified: jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/EditProfile.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/EditProfile.java?rev=292425&r1=292424&r2=292425&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/EditProfile.java (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/EditProfile.java Thu Sep 29 06:00:52 2005
@@ -21,10 +21,14 @@
import javax.ejb.FinderException;
import org.apache.hivemind.ApplicationRuntimeException;
+import org.apache.hivemind.HiveMind;
import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.Tapestry;
+import org.apache.tapestry.annotations.InjectComponent;
+import org.apache.tapestry.annotations.InjectPage;
+import org.apache.tapestry.annotations.InjectState;
+import org.apache.tapestry.annotations.Message;
+import org.apache.tapestry.event.PageBeginRenderListener;
import org.apache.tapestry.event.PageEvent;
-import org.apache.tapestry.event.PageRenderListener;
import org.apache.tapestry.form.IFormComponent;
import org.apache.tapestry.valid.IValidationDelegate;
import org.apache.tapestry.vlib.ActivatePage;
@@ -38,7 +42,7 @@
* @author Howard Lewis Ship
*/
-public abstract class EditProfile extends ActivatePage implements PageRenderListener
+public abstract class EditProfile extends ActivatePage implements PageBeginRenderListener
{
public abstract String getPassword1();
@@ -52,6 +56,24 @@
public abstract void setAttributes(Map attributes);
+ @InjectState("visit")
+ public abstract Visit getVisitState();
+
+ @InjectComponent("inputPassword1")
+ public abstract IFormComponent getInputPassword1();
+
+ @InjectComponent("inputPassword2")
+ public abstract IFormComponent getInputPassword2();
+
+ @Message
+ public abstract String enterPasswordTwice();
+
+ @Message
+ public abstract String passwordMustMatch();
+
+ @InjectPage("MyLibrary")
+ public abstract MyLibrary getMyLibrary();
+
/**
* Invoked (from {@link MyLibrary}) to begin editting the user's profile. We get the entity
* attributes from the {@link org.apache.tapestry.vlib.ejb.IPerson}, and store them in the
@@ -61,7 +83,7 @@
public void activate()
{
- Visit visit = (Visit) getVisit();
+ Visit visit = getVisitState();
VirtualLibraryEngine vengine = (VirtualLibraryEngine) getRequestCycle().getEngine();
Integer userId = visit.getUserId();
@@ -104,10 +126,10 @@
IValidationDelegate delegate = getValidationDelegate();
- delegate.setFormComponent((IFormComponent) getComponent("inputPassword1"));
+ delegate.setFormComponent(getInputPassword1());
delegate.recordFieldInputValue(null);
- delegate.setFormComponent((IFormComponent) getComponent("inputPassword2"));
+ delegate.setFormComponent(getInputPassword2());
delegate.recordFieldInputValue(null);
if (delegate.getHasErrors())
@@ -115,25 +137,25 @@
Map attributes = getAttributes();
- if (Tapestry.isBlank(password1) != Tapestry.isBlank(password2))
+ if (HiveMind.isBlank(password1) != HiveMind.isBlank(password2))
{
- setErrorField("inputPassword1", getMessage("enter-password-twice"));
+ setErrorField("inputPassword1", enterPasswordTwice());
return;
}
- if (Tapestry.isNonBlank(password1))
+ if (HiveMind.isNonBlank(password1))
{
if (!password1.equals(password2))
{
- setErrorField("inputPassword1", getMessage("password-must-match"));
+ setErrorField("inputPassword1", passwordMustMatch());
return;
}
attributes.put("password", password1);
}
- Visit visit = (Visit) getVisit();
+ Visit visit = getVisitState();
VirtualLibraryEngine vengine = (VirtualLibraryEngine) cycle.getEngine();
Integer userId = visit.getUserId();
@@ -164,8 +186,7 @@
vengine.clearCache();
- MyLibrary myLibrary = (MyLibrary) cycle.getPage("MyLibrary");
- myLibrary.activate();
+ getMyLibrary().activate();
}
public void pageBeginRender(PageEvent event)
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org