X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.spreadsheet.graph%2Fscl%2FSpreadsheet%2FAll.scl;h=b493d65f53b549a5380b52e8b674d4273b395f5b;hb=e3fc307246a9ff226845a93181bc798d03966b14;hp=8898ce10a9a306d58b0ea796e6d96653987fd132;hpb=2993f438f049233534c33dd51a3d2bb381657954;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.spreadsheet.graph/scl/Spreadsheet/All.scl b/bundles/org.simantics.spreadsheet.graph/scl/Spreadsheet/All.scl index 8898ce10a..b493d65f5 100644 --- a/bundles/org.simantics.spreadsheet.graph/scl/Spreadsheet/All.scl +++ b/bundles/org.simantics.spreadsheet.graph/scl/Spreadsheet/All.scl @@ -1,12 +1,45 @@ include "Simantics/DB" include "Simantics/Ontologies" include "Simantics/SCL" +include "Simantics/UI" include "Document/All" include "File" + +effect SpreadsheetTransaction + "spreadsheetTransaction" + "org.simantics.spreadsheet.Transaction" + +importJava "org.simantics.spreadsheet.graph.ExternalRef" where + data ExternalRef + importJava "org.simantics.spreadsheet.common.TableCell" where data TableCell +importJava "java.util.function.Consumer" where + data Consumer + +importJava "org.simantics.spreadsheet.CellEditor" where + data CellEditor + startTransaction :: CellEditor -> OperationMode -> Transaction + @JavaName "edit" + editProperty_ :: CellEditor -> String -> String -> a -> Binding a -> Maybe Consumer -> () + @JavaName "edit" + editContent :: CellEditor -> String -> Variant -> Maybe Consumer -> () + +@inline +editProperty :: Serializable a => CellEditor -> String -> String -> a -> Maybe Consumer -> () +editProperty editor location property value consumer = editProperty_ editor location property value binding consumer + +importJava "org.simantics.spreadsheet.OperationMode" where + data OperationMode + OPERATION :: OperationMode + EDIT_MODE :: OperationMode + +importJava "org.simantics.spreadsheet.Transaction" where + data Transaction + commit :: Transaction -> () + importJava "org.simantics.spreadsheet.common.TreeTableCell" where data TreeTableCell @@ -41,6 +74,14 @@ importJava "org.simantics.spreadsheet.graph.SpreadsheetGraphUtils" where saveInitialCondition :: Variable -> Resource -> String -> Resource findCell :: Variable -> String -> Maybe Variable invalidateAll :: Variable -> () + extRefVariable :: Variable -> Variant + extRefActiveVariable :: Variable -> Variant + cellEditor :: Resource -> CellEditor + syncExec :: CellEditor -> OperationMode -> ( a) -> a + cellColumn :: Variable -> Integer + +importJava "org.simantics.spreadsheet.Spreadsheets" where + cellName :: Integer -> Integer -> String importJava "org.simantics.spreadsheet.util.SpreadsheetUtils" where createSheet :: Resource -> String -> Resource @@ -59,12 +100,20 @@ importJava "org.simantics.spreadsheet.util.SpreadsheetUtils" where setSCLLine :: Resource -> Integer -> String -> () sheetRun :: Resource -> Variable -> Variable +sheetRunDefault :: Resource -> Variable +sheetRunDefault sheet = sheetRun sheet (resourceVariable sheet) + importJava "org.simantics.spreadsheet.graph.SpreadsheetSessionManager" where removeSpreadsheetSession :: Variable -> () importJava "org.simantics.spreadsheet.graph.ExcelImport" where importBook :: Resource -> File -> () +importSpreadsheetBookAction :: Resource -> () +importSpreadsheetBookAction res = match fileDialog "foo" [("Excel file", "*.xls"), ("Excel File", "*.xlsx")] with + Nothing -> () + Just file -> importBook res file + createSpreadsheetBookAction :: Resource -> () createSpreadsheetBookAction res = do syncWrite (\() -> createSpreadsheetBookDefault res)