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

Christian Bauer christian at hibernate.org
Mon Apr 2 14:25:05 EDT 2007


  User: cbauer  
  Date: 07/04/02 14:25:05

  Added:       examples/wiki/src/main/org/jboss/seam/wiki/plugin/lastmodified   
                        LastModifiedDocumentsPreferences.java
                        LastModifiedDocuments.java
  Removed:     examples/wiki/src/main/org/jboss/seam/wiki/plugin/lastmodified   
                        LastModified.java
  Log:
  Totally overengineered but definitely cool system/user/instance wiki preferences architecture
  
  Revision  Changes    Path
  1.1      date: 2007/04/02 18:25:05;  author: cbauer;  state: Exp;jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/lastmodified/LastModifiedDocumentsPreferences.java
  
  Index: LastModifiedDocumentsPreferences.java
  ===================================================================
  package org.jboss.seam.wiki.plugin.lastmodified;
  
  import org.jboss.seam.annotations.Name;
  import org.jboss.seam.annotations.Scope;
  import org.jboss.seam.annotations.Observer;
  import org.jboss.seam.wiki.preferences.Preference;
  import org.jboss.seam.wiki.preferences.PreferenceVisibility;
  import org.jboss.seam.wiki.preferences.PreferenceSupport;
  import org.jboss.seam.ScopeType;
  import org.hibernate.validator.Range;
  
  import java.io.Serializable;
  
  @Name("lastModifiedDocumentsPreferences")
  @Scope(ScopeType.CONVERSATION)
  @Preference(description = "B. 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(); }
  
      @Preference(description = "01. Number of items shown in list", visibility = PreferenceVisibility.INSTANCE)
      @Range(min = 3l, max = 25l)
      private Long numberOfItems;
  
      @Preference(description = "02. Show user names", visibility = PreferenceVisibility.INSTANCE)
      private Boolean showUsernames;
  
      @Preference(description = "03. Truncate document titles after characters", visibility = PreferenceVisibility.INSTANCE)
      @Range(min = 5l, max = 100l)
      private Long documentTitleLength;
  
  
  }
  
  
  
  1.1      date: 2007/04/02 18:25:05;  author: cbauer;  state: Exp;jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/lastmodified/LastModifiedDocuments.java
  
  Index: LastModifiedDocuments.java
  ===================================================================
  package org.jboss.seam.wiki.plugin.lastmodified;
  
  import org.jboss.seam.annotations.*;
  import org.jboss.seam.ScopeType;
  import org.jboss.seam.wiki.core.model.Document;
  import org.jboss.seam.wiki.core.dao.NodeDAO;
  
  import java.util.List;
  import java.io.Serializable;
  
  @Name("lastModifiedDocumentsPlugin")
  @Scope(ScopeType.PAGE)
  public class LastModifiedDocuments implements Serializable {
  
      @In
      NodeDAO nodeDAO;
  
      @In("#{lastModifiedDocumentsPreferences.properties['numberOfItems']}")
      private Long numberOfItems;
  
      private List<Document>lastModifiedDocuments;
  
      public List<Document> getLastModifiedDocuments() {
          if (lastModifiedDocuments == null) loadDocuments();
          return lastModifiedDocuments;
      }
  
      @Observer("Preferences.lastModifiedDocumentsPreferences")
      public void loadDocuments() {
          lastModifiedDocuments = nodeDAO.findDocumentsOrderByLastModified(Long.valueOf(numberOfItems).intValue());
      }
  
  }
  
  
  



More information about the jboss-cvs-commits mailing list