]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.spreadsheet.graph/scl/Spreadsheet/All.scl
SCL API for direct access to SpreadsheetBooks
[simantics/platform.git] / bundles / org.simantics.spreadsheet.graph / scl / Spreadsheet / All.scl
index ddfd3bef027adc184773dc43efe6cac5316c94ad..22f8043ff90d6d82c5a24afd3b6058a48eab22dc 100644 (file)
@@ -1,17 +1,36 @@
 include "Simantics/DB"
 include "Simantics/Ontologies"
 include "Simantics/SCL"
+include "Simantics/UI"
 include "Document/All"
+include "Spreadsheet/Solver"
 include "File"
 
 importJava "org.simantics.spreadsheet.common.TableCell" where
     data TableCell
 
+@inline
+editProperty :: Serializable a => CellEditor -> String -> String -> a -> Maybe Consumer -> <SpreadsheetTransaction> ()
+editProperty editor location property value consumer = editProperty_ editor location property value binding consumer
+
 importJava "org.simantics.spreadsheet.common.TreeTableCell" where
     data TreeTableCell
 
-importJava "org.simantics.spreadsheet.common.SpreadsheetCell" where
-    data SpreadsheetCell
+    @JavaName getData
+    getTreeTableCellData :: TreeTableCell -> <Proc> a
+    
+    createTreeTableCell :: String -> a -> Maybe b -> Integer -> Integer -> Integer -> Boolean -> <Proc> TreeTableCell
+
+    createTreeTableCell2 :: String -> a -> Maybe b -> a -> Integer -> Integer -> Boolean -> <Proc> TreeTableCell
+    
+    @JavaName getText
+    treeTableCellText :: TreeTableCell -> <Proc> String
+    @JavaName getFont
+    treeTableCellFont :: TreeTableCell -> <Proc> Maybe IFont
+    @JavaName getRow
+    treeTableCellRow :: TreeTableCell -> <Proc> Integer
+    @JavaName getColumn
+    treeTableCellColumn :: TreeTableCell -> <Proc> Integer
 
 importJava "org.simantics.spreadsheet.graph.SCL" where
     toVariant :: a -> Variant
@@ -25,6 +44,15 @@ importJava "org.simantics.spreadsheet.graph.SpreadsheetGraphUtils" where
     saveInitialCondition :: Variable -> Resource -> String -> <WriteGraph> Resource
     findCell :: Variable -> String -> <ReadGraph> Maybe Variable
     invalidateAll :: Variable -> <ReadGraph> ()
+    extRefVariable :: Variable -> <ReadGraph> Variant
+    extRefActiveVariable :: Variable -> <ReadGraph> Variant
+    forRows :: Variable -> String -> Integer -> Integer -> (Variable -> <ReadGraph,Proc> ()) -> <ReadGraph> ()
+    rowCell :: Variable -> Integer -> <ReadGraph> Maybe Variable
+    offsetCell :: Variable -> Integer -> Integer -> <ReadGraph> Maybe Variable
+    cellEditor :: Resource -> <ReadGraph> CellEditor
+    syncExec :: CellEditor -> OperationMode -> (<SpreadsheetTransaction, Proc> a) -> <Proc> a
+    cellColumn :: Variable -> <ReadGraph> Integer
+    spreadsheetBook :: Variable -> <Proc> SpreadsheetBook
 
 importJava "org.simantics.spreadsheet.util.SpreadsheetUtils" where
     createSheet :: Resource -> String -> <WriteGraph> Resource
@@ -42,10 +70,22 @@ importJava "org.simantics.spreadsheet.util.SpreadsheetUtils" where
     selectColumn :: Integer -> TableCell -> Boolean
     setSCLLine :: Resource -> Integer -> String -> <WriteGraph> ()
     sheetRun :: Resource -> Variable -> <ReadGraph> Variable
-    
+    @JavaName "sheetRun"
+    bookRun :: Resource -> Variable -> <ReadGraph> Variable
+
+sheetRunDefault = bookRunDefault
+
+bookRunDefault :: Resource -> <ReadGraph> Variable
+bookRunDefault book = bookRun book (resourceVariable book)
+
 importJava "org.simantics.spreadsheet.graph.ExcelImport" where
     importBook :: Resource -> File -> <Proc> ()
 
+importSpreadsheetBookAction :: Resource -> <Proc> ()
+importSpreadsheetBookAction res = match fileDialog "foo" [("Excel file", "*.xls"), ("Excel File", "*.xlsx")] with
+  Nothing -> ()
+  Just file -> importBook res file
+
 createSpreadsheetBookAction :: Resource -> <Proc> ()
 createSpreadsheetBookAction res = do
   syncWrite (\() -> createSpreadsheetBookDefault res)