[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jboss-cvs-commits
Subject:    [jboss-cvs] applications/forums/src/main/org/jboss/forums/web/tapestry/management/user EditUserPage.
From:       Julien Viet <cooperfbi () users ! sourceforge ! net>
Date:       2002-11-30 17:35:11
[Download RAW message or body]

  User: cooperfbi
  Date: 02/11/30 09:35:11

  Modified:    forums/src/main/org/jboss/forums/web/tapestry/management/user
                        EditUserPage.java
  Log:
  added : user can edit his preferences
  
  Revision  Changes    Path
  1.2       +26 -36    \
applications/forums/src/main/org/jboss/forums/web/tapestry/management/user/EditUserPage.java
  
  Index: EditUserPage.java
  ===================================================================
  RCS file: /cvsroot/jboss/applications/forums/src/main/org/jboss/forums/web/tapestry/management/user/EditUserPage.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EditUserPage.java	29 Nov 2002 14:56:49 -0000	1.1
  +++ EditUserPage.java	30 Nov 2002 17:35:11 -0000	1.2
  @@ -10,9 +10,11 @@
   
   import org.jboss.forums.web.tapestry.AdminPage;
   import org.jboss.forums.web.tapestry.components.SelectorHandler;
  +import org.jboss.forums.web.tapestry.components.UserDetailsEditorHandler;
   import org.jboss.forums.UserEJBLocal;
   import org.jboss.forums.RoleEJBLocal;
   import org.jboss.forums.Constants;
  +import org.apache.commons.collections.BeanMap;
   
   import java.util.Collection;
   import java.util.Map;
  @@ -23,18 +25,16 @@
   
   /**
    * @author <a href="mailto:julien_viet@yahoo.fr">Julien Viet</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class EditUserPage extends AdminPage
   {
   
      private UserEJBLocal user;
   
  -   private String theName, email, location, occupation, homepage;
  -   private boolean nameVisible, emailVisible;
  -   private int threadsPerForum, messagesPerThread;
  -
      private RoleEJBLocal role;
  +   private Map write;
  +   private Map read;
   
      public UserEJBLocal getUser()
      {
  @@ -45,30 +45,13 @@
      {
         this.user = user;
         fireObservedChange("user", user);
  +      write = new HashMap();
  +      read = new BeanMap(user);
      }
   
      public String getUserName() { return user.getUserName(); }
      public void setUserName(String userName) { }
   
  -   public String getTheName() { return user.getName(); }
  -   public void setTheName(String theName) { this.theName = theName; }
  -   public String getEmail() { return user.getEmail(); }
  -   public void setEmail(String email) { this.email = email; }
  -   public String getLocation() { return user.getLocation(); }
  -   public void setLocation(String location) { this.location = location; }
  -   public String getOccupation() { return user.getOccupation(); }
  -   public void setOccupation(String occupation) { this.occupation = occupation; }
  -   public String getHomepage() { return user.getHomepage(); }
  -   public void setHomepage(String homepage) { this.homepage = homepage; }
  -   public boolean isNameVisible() { return user.getNameVisible(); }
  -   public void setNameVisible(boolean nameVisible) { this.nameVisible = \
                nameVisible; }
  -   public boolean isEmailVisible() { return user.getEmailVisible(); }
  -   public void setEmailVisible(boolean emailVisible) { this.emailVisible = \
                emailVisible; }
  -   public int getThreadsPerForum() { return user.getThreadsPerForum(); }
  -   public void setThreadsPerForum(int threadsPerForum) { this.threadsPerForum = \
                threadsPerForum; }
  -   public int getMessagesPerThread() { return user.getMessagesPerThread(); }
  -   public void setMessagesPerThread(int messagesPerThread) { \
                this.messagesPerThread = messagesPerThread; }
  -
      public SelectorHandler getSelectorHandler()
      {
         return new SelectorHandler()
  @@ -96,19 +79,24 @@
         };
      }
   
  -   public void updateUserPrefs(IRequestCycle cycle) throws RequestCycleException
  +   public UserDetailsEditorHandler getUserDetailsEditorHandler()
  +   {
  +      return new UserDetailsEditorHandler()
  +      {
  +         public Object getDetail(String name)
  +         {
  +            return read.get(name);
  +         }
  +         public void updateDetail(String name, Object value)
  +         {
  +            write.put(name, value);
  +         }
  +      };
  +   }
  +
  +   public void updateUserDetails(IRequestCycle cycle) throws RequestCycleException
      {
  -      Map values = new HashMap();
  -      values.put(Constants.USER_NAME, theName);
  -      values.put(Constants.USER_EMAIL, email);
  -      values.put(Constants.USER_LOCATION, location);
  -      values.put(Constants.USER_OCCUPATION, occupation);
  -      values.put(Constants.USER_HOMEPAGE, homepage);
  -      values.put(Constants.USER_NAME_VISIBLE, new Boolean(nameVisible));
  -      values.put(Constants.USER_EMAIL_VISIBLE, new Boolean(emailVisible));
  -      values.put(Constants.USER_THREADS_PER_FORUM, new Integer(threadsPerForum));
  -      values.put(Constants.USER_MESSAGES_PER_THREAD, new \
                Integer(messagesPerThread));
  -      getForumVisit().updateUserPrefs(user, values);
  +      getForumVisit().updateUserDetails(user, write);
      }
   
      public void updateUserInfos(IRequestCycle cycle) throws RequestCycleException
  @@ -119,6 +107,8 @@
      public void detach()
      {
         user = null;
  +      write = null;
  +      read = null;
         super.detach();
      }
   
  
  
  


-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T 
handheld. Power & Color in a compact size! 
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic