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

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


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

  Modified:    examples/wiki/src/main/org/jboss/seam/wiki/plugin/lastmodified   
                        LastModifiedDocuments.java
                        LastModifiedDocumentsPreferences.java
  Added:       examples/wiki/src/main/org/jboss/seam/wiki/plugin/lastmodified   
                        LastModifiedDocumentsPreferencesSupport.java
  Log:
  Complete overhaul of the preferences system
  
  Revision  Changes    Path
  1.4       +16 -9     jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/lastmodified/LastModifiedDocuments.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LastModifiedDocuments.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/lastmodified/LastModifiedDocuments.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- LastModifiedDocuments.java	19 Dec 2007 04:29:29 -0000	1.3
  +++ LastModifiedDocuments.java	30 Dec 2007 02:33:27 -0000	1.4
  @@ -1,3 +1,9 @@
  +/*
  + * JBoss, Home of Professional Open Source
  + *
  + * Distributable under LGPL license.
  + * See terms of license at gnu.org.
  + */
   package org.jboss.seam.wiki.plugin.lastmodified;
   
   import org.jboss.seam.ScopeType;
  @@ -11,26 +17,27 @@
   import java.io.Serializable;
   import java.util.List;
   
  - at Name("lastModifiedDocumentsPlugin")
  + at Name("lastModifiedDocuments")
   @Scope(ScopeType.PAGE)
   public class LastModifiedDocuments implements Serializable {
   
       @In
       WikiNodeDAO wikiNodeDAO;
   
  -    @In("#{lastModifiedDocumentsPreferences.numberOfItems}")
  -    private Long numberOfItems;
  +    @In("#{preferences.get('LastModifiedDocuments', currentMacro)}")
  +    LastModifiedDocumentsPreferences prefs;
   
  -    private List<WikiDocument>lastModifiedDocuments;
  +    private List<WikiDocument> listOfDocuments;
   
  -    public List<WikiDocument> getLastModifiedDocuments() {
  -        if (lastModifiedDocuments == null) loadDocuments();
  -        return lastModifiedDocuments;
  +    public List<WikiDocument> getListOfDocuments() {
  +        if (listOfDocuments == null) loadDocuments();
  +        return listOfDocuments;
       }
   
  -    @Observer("PreferenceComponent.refresh.lastModifiedDocumentsPreferences")
  +    @Observer(value = "Macro.render.lastModifiedDocuments", create = false)
       public void loadDocuments() {
  -        lastModifiedDocuments = wikiNodeDAO.findWikiDocumentsOrderByLastModified(Long.valueOf(numberOfItems).intValue());
  +        listOfDocuments =
  +                wikiNodeDAO.findWikiDocumentsOrderByLastModified(Long.valueOf(prefs.getNumberOfItems()).intValue());
       }
   
   }
  
  
  
  1.5       +19 -21    jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/lastmodified/LastModifiedDocumentsPreferences.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LastModifiedDocumentsPreferences.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/lastmodified/LastModifiedDocumentsPreferences.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- LastModifiedDocumentsPreferences.java	17 Aug 2007 13:00:32 -0000	1.4
  +++ LastModifiedDocumentsPreferences.java	30 Dec 2007 02:33:27 -0000	1.5
  @@ -2,38 +2,36 @@
   
   import org.hibernate.validator.NotNull;
   import org.hibernate.validator.Range;
  -import org.jboss.seam.ScopeType;
  -import org.jboss.seam.annotations.Name;
  -import org.jboss.seam.annotations.Observer;
  -import org.jboss.seam.annotations.Scope;
  -import org.jboss.seam.wiki.preferences.Preference;
  -import org.jboss.seam.wiki.preferences.PreferenceSupport;
   import org.jboss.seam.wiki.preferences.PreferenceVisibility;
  +import org.jboss.seam.wiki.preferences.annotations.PreferenceProperty;
  +import org.jboss.seam.wiki.preferences.annotations.Preferences;
   
   import java.io.Serializable;
   
  - at Name("lastModifiedDocumentsPreferences")
  - at Scope(ScopeType.CONVERSATION)
  - at Preference(description = "Plugin: Last Modified", visibility = PreferenceVisibility.INSTANCE)
  -public class LastModifiedDocumentsPreferences extends PreferenceSupport implements Serializable {
  -
  -    public String getCurrentUserVariable() { return "currentUser"; }
  -    public String getCurrentInstanceVariable() { return "currentDocument"; }
  -
  -    @Observer("PreferenceEditor.refresh.lastModifiedDocumentsPreferences")
  -    public void refreshProperties() {
  -        super.refreshProperties();
  -    }
  + at Preferences(name = "LastModifiedDocuments", description = "#{messages['lastModifiedDocuments.preferences.Name']}")
  +public class LastModifiedDocumentsPreferences implements Serializable {
   
  -    @Preference(description = "01. Number of items shown in list", visibility = PreferenceVisibility.INSTANCE)
  +    @PreferenceProperty(
  +        description = "#{messages['lastModifiedDocuments.preferences.NumberOfItems']}",
  +        visibility = {PreferenceVisibility.SYSTEM, PreferenceVisibility.INSTANCE},
  +        editorIncludeName = "NumberRange"
  +    )
       @Range(min = 3l, max = 25l)
       @NotNull
       private Long numberOfItems;
   
  -    @Preference(description = "02. Show user names", visibility = PreferenceVisibility.INSTANCE)
  +    @PreferenceProperty(
  +        description = "#{messages['lastModifiedDocuments.preferences.ShowUsernames']}",
  +        visibility = {PreferenceVisibility.SYSTEM, PreferenceVisibility.INSTANCE}
  +    )
  +    @NotNull
       private Boolean showUsernames;
   
  -    @Preference(description = "03. Truncate document titles after characters", visibility = PreferenceVisibility.INSTANCE)
  +    @PreferenceProperty(
  +        description = "#{messages['lastModifiedDocuments.preferences.DocumentTitleLength']}",
  +        visibility = {PreferenceVisibility.SYSTEM, PreferenceVisibility.INSTANCE},
  +        editorIncludeName = "NumberRange"
  +    )
       @Range(min = 5l, max = 100l)
       @NotNull
       private Long documentTitleLength;
  
  
  
  1.1      date: 2007/12/30 02:33:27;  author: cbauer;  state: Exp;jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/lastmodified/LastModifiedDocumentsPreferencesSupport.java
  
  Index: LastModifiedDocumentsPreferencesSupport.java
  ===================================================================
  package org.jboss.seam.wiki.plugin.lastmodified;
  
  import org.jboss.seam.annotations.Name;
  import org.jboss.seam.wiki.preferences.metamodel.PreferencesSupport;
  import org.jboss.seam.wiki.preferences.metamodel.PreferenceEntity;
  
  import java.util.HashSet;
  import java.util.Set;
  
  @Name("lastModifiedDocumentsPreferencesSupport")
  public class LastModifiedDocumentsPreferencesSupport extends PreferencesSupport {
  
      public Set<PreferenceEntity> getPreferenceEntities() {
          return new HashSet<PreferenceEntity>() {{
              add( createPreferenceEntity(LastModifiedDocumentsPreferences.class) );
          }};
      }
  
  }
  
  
  



More information about the jboss-cvs-commits mailing list