]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
TreeGridWidget improvements 62/762/2
authorAntti Villberg <antti.villberg@semantum.fi>
Tue, 25 Jul 2017 13:13:25 +0000 (16:13 +0300)
committerHannu Niemistö <hannu.niemisto@semantum.fi>
Tue, 25 Jul 2017 13:31:36 +0000 (16:31 +0300)
refs #7381

Change-Id: I79a2650fef07142cc95c6bd31e901e062baeba75

bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/ITreeTableCell.java
bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/JSONObjectUtils.java
bundles/org.simantics.spreadsheet.common/src/org/simantics/spreadsheet/common/TreeTableCell.java

index 9bf10fb3a67d4ad2c1dc7fb23a4bc56b81be9652..1849273d1d59bf41e693a46ad640dac4800698ac 100644 (file)
@@ -1,11 +1,9 @@
 package org.simantics.document.server.io;
 
 public interface ITreeTableCell extends ITableCell {
-    
-       int getParent();
-       
-        Object getData();
 
-     boolean isEditable();
+       int getParent();
+       Object getData();
+    boolean isEditable();
      
 }
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")
index baf3b83de6873a371a5dddc669c9199f7a0f1194..299c7c7964955e4c47b2aa1beab214342ae35c39 100644 (file)
@@ -36,6 +36,16 @@ public class TreeTableCell extends TableCell implements ITreeTableCell {
                this.data = data;
        }
        
+       @Override
+       public int getRowSpan() {
+               throw new IllegalStateException("Row span is not supported in TreeTableCell");
+       }
+       
+       @Override
+       public int getColumnSpan() {
+               throw new IllegalStateException("Column span is not supported in TreeTableCell");
+       }
+       
        public static TreeTableCell createTreeTableCell(String text, Object data, Object font, int parent, int row, int column, boolean editable) {
                return new TreeTableCell(text, data, extractIFont(font), parent, row, column, editable);
        }