Adjust the tree default size according to the number of subfolders so that Show more...
[pithos-web-client] / src / gr / grnet / pithos / web / client / foldertree / Resource.java
index b8c230d..9c1a482 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011 GRNET S.A. All rights reserved.
+ * Copyright 2011-2012 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
 
 package gr.grnet.pithos.web.client.foldertree;
 
+import com.google.gwt.core.client.GWT;
 import com.google.gwt.http.client.Response;
 import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
 import com.google.gwt.json.client.JSONNumber;
 import com.google.gwt.json.client.JSONObject;
 import com.google.gwt.json.client.JSONString;
 
+import gr.grnet.pithos.web.client.Invitations;
 import gr.grnet.pithos.web.client.SharingUsers;
 
 import java.util.Date;
 
-public class Resource {
+public abstract class Resource {
 
     protected static String unmarshallString(JSONObject obj, String key){
         if(obj.get(key) != null) {
@@ -83,7 +86,11 @@ public class Resource {
         if(obj.get(key) != null) {
             JSONString s = obj.get(key).isString();
             if (s != null)
-                return DateTimeFormat.getFormat("yyyy-MM-dd'T'HH:mm:ss").parse(s.stringValue());
+                               try {
+                                       return DateTimeFormat.getFormat(PredefinedFormat.ISO_8601).parse(s.stringValue());
+                               } catch (IllegalArgumentException e) {
+                                       GWT.log("", e);
+                               }
         }
         return null;
     }
@@ -110,6 +117,11 @@ public class Resource {
         else if (aClass.equals(FileVersions.class)) {
                result1 = (T) FileVersions.createFromResponse(response);
         }
+        else if (aClass.equals(Invitations.class)) {
+               result1 = (T) Invitations.createFromResponse(response);
+        }
         return result1;
     }
+    
+    public abstract Date getLastModified();
 }