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

Christian Bauer christian at hibernate.org
Thu Apr 26 01:29:18 EDT 2007


  User: cbauer  
  Date: 07/04/26 01:29:18

  Modified:    examples/wiki/src/main/org/jboss/seam/wiki/util 
                        WikiUtil.java
  Log:
  Broken Hibernate Search integration, to debug for Emmanuel
  
  Revision  Changes    Path
  1.6       +15 -0     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.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- WikiUtil.java	9 Apr 2007 08:43:54 -0000	1.5
  +++ WikiUtil.java	26 Apr 2007 05:29:18 -0000	1.6
  @@ -10,6 +10,7 @@
   import javax.servlet.http.HttpSession;
   import java.util.Collection;
   import java.util.List;
  +import java.math.BigDecimal;
   
   /**
    * Adds stuff to and for JSF that should be there but isn't. Also stuff that is exposed
  @@ -105,6 +106,20 @@
   
       }
   
  +    public static String displayFilesize(int fileSizeInBytes) {
  +        // TODO: Yeah, that could be done smarter..
  +        if (fileSizeInBytes >= 1073741824) {
  +            return new BigDecimal(fileSizeInBytes / 1024 / 1024 / 1024) + " GiB";
  +        }else if (fileSizeInBytes >= 1048576) {
  +            return new BigDecimal(fileSizeInBytes / 1024 / 1024) + " MiB";
  +        } else if (fileSizeInBytes >= 1024) {
  +            return new BigDecimal(fileSizeInBytes / 1024) + " KiB";
  +        } else {
  +            return new BigDecimal(fileSizeInBytes) + " Bytes";
  +        }
  +    }
  +
  +
       public static Throwable unwrap(Throwable throwable) throws IllegalArgumentException {
           if (throwable == null) {
               throw new IllegalArgumentException("Cannot unwrap null throwable");
  
  
  



More information about the jboss-cvs-commits mailing list