]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Functions for manipulating column beans 44/1944/3
authorAntti Villberg <antti.villberg@semantum.fi>
Mon, 23 Jul 2018 18:50:47 +0000 (21:50 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 31 Jul 2018 18:08:46 +0000 (18:08 +0000)
gitlab #51

Change-Id: I27a62a07324fa3dc48f5d80efa660881f85940a1

bundles/org.simantics.document.swt.core/scl/SWT/All.scl
bundles/org.simantics.document.swt.core/scl/SWT/Types.scl
bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/scl/SCL.java

index 0ef41f97ca0c3e400ed5d1f3fa2c787625b06c79..f87f939ec906a8a8465961fe291f5fb2c4418366 100644 (file)
@@ -28,5 +28,9 @@ importJava "org.simantics.document.swt.core.scl.SCL" where
     propertyDisplayValue :: Variable -> String -> <ReadGraph> String
 
     propertyValueSetter :: Variable -> String -> <ReadGraph> AbstractEventHandler
-   
-  
\ No newline at end of file
+
+    columnsBean :: Resource -> <ReadGraph> ColumnsBean
+    columnBeans :: ColumnsBean -> [ColumnBean]
+
+    columnBeanKey :: ColumnBean -> String
+    columnBeanLabel :: ColumnBean -> String
index 03fd4d9a0cdc34fd662f9a2ad525b1ae9ee2850d..28a942b788e6b5a6649889d2e5c3ed0c6cd25018 100644 (file)
@@ -2,6 +2,9 @@
 importJava "org.simantics.document.swt.core.bean.ColumnBean" where
     data ColumnBean
 
+importJava "org.simantics.document.swt.core.bean.ColumnsBean" where
+    data ColumnsBean
+
 importJava "org.simantics.browsing.ui.StatePersistor" where
     data StatePersistor
 
index ad5cf709169a75f392e0d12165b416949e3501bb..0c3529bfafdc963dacf5ca7df8ebc231d86d6955 100644 (file)
@@ -1,5 +1,6 @@
 package org.simantics.document.swt.core.scl;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.simantics.databoard.Bindings;
@@ -17,6 +18,8 @@ import org.simantics.document.server.io.CommandContext;
 import org.simantics.document.server.io.CommandResult;
 import org.simantics.document.server.serverResponse.ServerResponse;
 import org.simantics.document.swt.core.SWTViews;
+import org.simantics.document.swt.core.bean.ColumnBean;
+import org.simantics.document.swt.core.bean.ColumnsBean;
 import org.simantics.scl.runtime.SCLContext;
 import org.simantics.scl.runtime.function.Function1;
 import org.simantics.scl.runtime.reporting.SCLReportingHandler;
@@ -108,4 +111,22 @@ public class SCL {
         return WorkbenchSelectionUtils.getPossibleResource(wse);
     }
 
+    public static ColumnsBean columnsBean(ReadGraph graph, Resource value) throws DatabaseException {
+        return graph.getValue(value, ColumnsBean.BINDING);
+    }
+
+    public static List<ColumnBean> columnBeans(ColumnsBean bean) {
+        ArrayList<ColumnBean> result = new ArrayList<>();
+        for(ColumnBean b : bean.columns) result.add(b);
+        return result;
+    }
+
+    public static String columnBeanKey(ColumnBean bean) {
+        return bean.key;
+    }
+
+    public static String columnBeanLabel(ColumnBean bean) {
+        return bean.label;
+    }
+
 }