[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum ...

Christian Bauer christian at hibernate.org
Sat Dec 29 21:33:26 EST 2007


  User: cbauer  
  Date: 07/12/29 21:33:26

  Modified:    examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum   
                        ForumQuery.java ForumPreferences.java
  Added:       examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum   
                        ForumPreferencesSupport.java
  Log:
  Complete overhaul of the preferences system
  
  Revision  Changes    Path
  1.4       +3 -5      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ForumQuery.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ForumQuery.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ForumQuery.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- ForumQuery.java	19 Dec 2007 04:29:25 -0000	1.3
  +++ ForumQuery.java	30 Dec 2007 02:33:26 -0000	1.4
  @@ -2,7 +2,6 @@
   
   import org.jboss.seam.wiki.core.model.WikiDirectory;
   import org.jboss.seam.wiki.core.model.User;
  -import org.jboss.seam.wiki.core.model.WikiDocument;
   import org.jboss.seam.wiki.core.action.Pager;
   import org.jboss.seam.annotations.*;
   import org.jboss.seam.annotations.Observer;
  @@ -23,12 +22,12 @@
   
       private Pager pager;
   
  -    @In
  -    ForumPreferences forumPreferences;
  +    @In("#{preferences.get('Forum')}")
  +    ForumPreferences prefs;
   
       @RequestParameter
       public void setPage(Integer page) {
  -        if (pager == null) pager = new Pager(forumPreferences.getTopicsPerPage());
  +        if (pager == null) pager = new Pager(prefs.getTopicsPerPage());
           pager.setPage(page);
       }
   
  @@ -56,7 +55,6 @@
           return forums;
       }
   
  -
       @Observer(value = {"Forum.forumListRefresh", "PersistenceContext.filterReset"}, create = false)
       public void loadForums() {
   
  
  
  
  1.2       +11 -21    jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ForumPreferences.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ForumPreferences.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ForumPreferences.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- ForumPreferences.java	20 Nov 2007 08:05:10 -0000	1.1
  +++ ForumPreferences.java	30 Dec 2007 02:33:26 -0000	1.2
  @@ -1,32 +1,22 @@
   package org.jboss.seam.wiki.plugin.forum;
   
  -import org.jboss.seam.wiki.preferences.PreferenceSupport;
  -import org.jboss.seam.wiki.preferences.PreferenceVisibility;
  -import org.jboss.seam.wiki.preferences.Preference;
  -import org.jboss.seam.annotations.Scope;
  -import org.jboss.seam.annotations.Name;
  -import org.jboss.seam.annotations.Observer;
  -import org.jboss.seam.annotations.AutoCreate;
  -import org.jboss.seam.ScopeType;
   import org.hibernate.validator.NotNull;
   import org.hibernate.validator.Range;
  +import org.jboss.seam.wiki.preferences.annotations.Preferences;
  +import org.jboss.seam.wiki.preferences.annotations.PreferenceProperty;
  +import org.jboss.seam.wiki.preferences.PreferenceVisibility;
   
   import java.io.Serializable;
   
  - at Name("forumPreferences")
  - at Scope(ScopeType.CONVERSATION)
  - at AutoCreate
  - at Preference(description = "Plugin: Forum", visibility = PreferenceVisibility.USER)
  -public class ForumPreferences extends PreferenceSupport implements Serializable {
  -
  -    public String getCurrentUserVariable() { return "currentUser"; }
  -    public String getCurrentInstanceVariable() { return "currentDocument"; }
  -
  -    @Observer("PreferenceEditor.refresh.forumPreferences")
  -    public void refreshProperties() { super.refreshProperties(); }
  + at Preferences(name = "Forum", description = "#{messages['forum.preferences.Name']}")
  +public class ForumPreferences implements Serializable {
   
  -    @Preference(description = "01. Number of topics per page", visibility = PreferenceVisibility.USER)
  -    @Range(min = 1l, max = 999l)
  +    @PreferenceProperty(
  +        description = "#{messages['forum.preferences.TopicsPerPage']}",
  +        visibility = {PreferenceVisibility.SYSTEM, PreferenceVisibility.USER},
  +        editorIncludeName = "NumberRange"
  +    )
  +    @Range(min = 3l, max = 100l)
       @NotNull
       private Long topicsPerPage;
   
  
  
  
  1.1      date: 2007/12/30 02:33:26;  author: cbauer;  state: Exp;jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ForumPreferencesSupport.java
  
  Index: ForumPreferencesSupport.java
  ===================================================================
  /*
   * JBoss, Home of Professional Open Source
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jboss.seam.wiki.plugin.forum;
  
  import org.jboss.seam.annotations.Name;
  import org.jboss.seam.wiki.preferences.metamodel.PreferenceEntity;
  import org.jboss.seam.wiki.preferences.metamodel.PreferencesSupport;
  
  import java.util.Set;
  import java.util.HashSet;
  
  /**
   * @author Christian Bauer
   */
  @Name("forumPreferencesSupport")
  public class ForumPreferencesSupport extends PreferencesSupport {
  
      public Set<PreferenceEntity> getPreferenceEntities() {
          return new HashSet<PreferenceEntity>() {{
              add( createPreferenceEntity(ForumPreferences.class) );
          }};
      }
  }
  
  
  



More information about the jboss-cvs-commits mailing list