]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/JSONObjectUtils.java
TreeGridWidget improvements
[simantics/platform.git] / bundles / org.simantics.document.server.io / src / org / simantics / document / server / io / JSONObjectUtils.java
index 558ee320459e519823852eac43d654763e90906f..004166dc0c39bf387dd471b9b8617bb8c8853885 100644 (file)
@@ -314,6 +314,26 @@ public class JSONObjectUtils {
         return Collections.emptyList();
     }
     
+    @SuppressWarnings("unchecked")
+    public static Collection<ITreeTableCell> getTreeTableCells(IJSONObject object) {
+        try {
+            Object tableCells = object.getValue("tableCells");
+            if (tableCells instanceof String) {
+                String tableCellsS = (String) tableCells;
+                if (tableCellsS.length() == 0)
+                    return Collections.emptyList();
+            }
+            if (tableCells != null) {
+               return (List<ITreeTableCell>) tableCells;
+            } else {
+               return Collections.emptyList();
+            }
+        } catch (ClassCastException e) {
+            e.printStackTrace();
+        }
+        return Collections.emptyList();
+    }
+
     public static Collection<FileInfo> getFiles(IJSONObject object) {
         try {
             @SuppressWarnings("unchecked")