From: Antti Villberg Date: Tue, 25 Jul 2017 13:13:25 +0000 (+0300) Subject: TreeGridWidget improvements X-Git-Tag: v1.31.0~264^2~29 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F62%2F762%2F2;p=simantics%2Fplatform.git TreeGridWidget improvements refs #7381 Change-Id: I79a2650fef07142cc95c6bd31e901e062baeba75 --- diff --git a/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/ITreeTableCell.java b/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/ITreeTableCell.java index 9bf10fb3a..1849273d1 100644 --- a/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/ITreeTableCell.java +++ b/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/ITreeTableCell.java @@ -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(); } diff --git a/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/JSONObjectUtils.java b/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/JSONObjectUtils.java index 558ee3204..004166dc0 100644 --- a/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/JSONObjectUtils.java +++ b/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/JSONObjectUtils.java @@ -314,6 +314,26 @@ public class JSONObjectUtils { return Collections.emptyList(); } + @SuppressWarnings("unchecked") + public static Collection 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) tableCells; + } else { + return Collections.emptyList(); + } + } catch (ClassCastException e) { + e.printStackTrace(); + } + return Collections.emptyList(); + } + public static Collection getFiles(IJSONObject object) { try { @SuppressWarnings("unchecked") diff --git a/bundles/org.simantics.spreadsheet.common/src/org/simantics/spreadsheet/common/TreeTableCell.java b/bundles/org.simantics.spreadsheet.common/src/org/simantics/spreadsheet/common/TreeTableCell.java index baf3b83de..299c7c796 100644 --- a/bundles/org.simantics.spreadsheet.common/src/org/simantics/spreadsheet/common/TreeTableCell.java +++ b/bundles/org.simantics.spreadsheet.common/src/org/simantics/spreadsheet/common/TreeTableCell.java @@ -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); }