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

Christian Bauer christian at hibernate.org
Mon Sep 24 04:23:21 EDT 2007


  User: cbauer  
  Date: 07/09/24 04:23:21

  Modified:    examples/wiki/src/main/org/jboss/seam/wiki/util  
                        Progress.java WikiUtil.java
  Log:
  New help system and improved wiki text editor
  
  Revision  Changes    Path
  1.2       +1 -1      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/util/Progress.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Progress.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/util/Progress.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- Progress.java	12 Jun 2007 12:30:01 -0000	1.1
  +++ Progress.java	24 Sep 2007 08:23:21 -0000	1.2
  @@ -44,7 +44,7 @@
       }
   
       public String toString() {
  -        return getOfOperation() + "(" + getStatus() + "): " + getPercentComplete() + "%";
  +        return "Progress of operation: " + getOfOperation() + ", Status: " + getStatus() + ", Complete: " + getPercentComplete() + "%";
       }
   
   }
  
  
  
  1.16      +28 -2     jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: WikiUtil.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -b -r1.15 -r1.16
  --- WikiUtil.java	15 Sep 2007 17:06:19 -0000	1.15
  +++ WikiUtil.java	24 Sep 2007 08:23:21 -0000	1.16
  @@ -7,6 +7,7 @@
   package org.jboss.seam.wiki.util;
   
   import org.jboss.seam.Component;
  +import org.jboss.seam.core.Conversation;
   import org.jboss.seam.wiki.core.action.prefs.WikiPreferences;
   import org.jboss.seam.wiki.core.model.*;
   
  @@ -88,6 +89,24 @@
       }
   
       // Rendering made easy
  +    public static String renderPlainURL(Node node) {
  +        if (isFile(node)) return renderFileLink((File)node);
  +        WikiPreferences prefs = (WikiPreferences) Component.getInstance("wikiPreferences");
  +        String url = "";
  +        if (isDocument(node)) {
  +            url = prefs.getBaseUrl() + "/docDisplayPlain.seam?documentId=" + node.getId();
  +        } else if (isDirectory(node)) {
  +            Directory dir = (Directory)node;
  +            if (dir.getDefaultDocument() != null) {
  +                url = prefs.getBaseUrl() + "/docDisplayPlain.seam?documentId=" + dir.getDefaultDocument().getId();
  +            } else {
  +                url = prefs.getBaseUrl() + "/dirDisplayPlain.seam?directoryId=" + node.getId();
  +            }
  +        }
  +        if (url.length() > 0) url = url + "&cid=" + Conversation.instance().getId();
  +        return url;
  +    }
  +
       public static String renderURL(Node node) {
           if (isFile(node)) return renderFileLink((File)node);
           WikiPreferences wikiPrefs = (WikiPreferences) Component.getInstance("wikiPreferences");
  @@ -101,9 +120,8 @@
       public static String renderPermLink(Node node) {
           if (node == null || node.getId() == null) return "";
           if (isFile(node)) return renderFileLink((File)node);
  -        WikiPreferences wikiPrefs = (WikiPreferences) Component.getInstance("wikiPreferences");
           WikiPreferences prefs = (WikiPreferences)Component.getInstance("wikiPreferences");
  -        return prefs.getBaseUrl() + "/" + node.getId() + wikiPrefs.getPermlinkSuffix();
  +        return prefs.getBaseUrl() + "/" + node.getId() + prefs.getPermlinkSuffix();
       }
   
       public  static String renderWikiLink(Node node) {
  @@ -260,6 +278,14 @@
           return string == null ? 0 : string.length();
       }
   
  +    public static String repeatString(String s, Integer count) {
  +        StringBuilder spaces = new StringBuilder();
  +        for (int i = 0; i < count; i++) {
  +            spaces.append(s);
  +        }
  +        return spaces.toString();
  +    }
  +
       /**
        * Used for conditional rendering of JSF messages, again, inflexible EL can't take value bindings with arguments
        * or support simple String concat...
  
  
  



More information about the jboss-cvs-commits mailing list