2 include "Simantics/Ontologies"
3 include "Simantics/SCL"
6 include "Spreadsheet/Solver"
9 importJava "org.simantics.spreadsheet.common.TableCell" where
13 editProperty :: Serializable a => CellEditor -> String -> String -> a -> Maybe Consumer -> <SpreadsheetTransaction> ()
14 editProperty editor location property value consumer = editProperty_ editor location property value binding consumer
16 importJava "org.simantics.spreadsheet.common.TreeTableCell" where
20 getTreeTableCellData :: TreeTableCell -> <Proc> a
22 createTreeTableCell :: String -> a -> Maybe b -> Integer -> Integer -> Integer -> Boolean -> <Proc> TreeTableCell
24 createTreeTableCell2 :: String -> a -> Maybe b -> a -> Integer -> Integer -> Boolean -> <Proc> TreeTableCell
27 treeTableCellText :: TreeTableCell -> <Proc> String
29 treeTableCellFont :: TreeTableCell -> <Proc> Maybe IFont
31 treeTableCellRow :: TreeTableCell -> <Proc> Integer
33 treeTableCellColumn :: TreeTableCell -> <Proc> Integer
35 importJava "org.simantics.spreadsheet.graph.SCL" where
36 toVariant :: a -> Variant
37 modelsSourceContribution :: Resource -> <ReadGraph> [Variable]
38 modelsSourceContributionLabeler :: Variable -> <ReadGraph> String
40 importJava "org.simantics.spreadsheet.graph.SpreadsheetGraphUtils" where
41 @JavaName "fullSynchronization"
42 fullSynchronizeSheet :: Variable -> <ReadGraph> Boolean
43 evaluateAll :: Variable -> <ReadGraph> ()
44 saveInitialCondition :: Variable -> Resource -> String -> <WriteGraph> Resource
45 findCell :: Variable -> String -> <ReadGraph> Maybe Variable
46 invalidateAll :: Variable -> <ReadGraph> ()
47 extRefVariable :: Variable -> <ReadGraph> Variant
48 extRefActiveVariable :: Variable -> <ReadGraph> Variant
49 forRows :: Variable -> String -> Integer -> Integer -> (Variable -> <ReadGraph,Proc> ()) -> <ReadGraph> ()
50 rowCell :: Variable -> Integer -> <ReadGraph> Maybe Variable
51 offsetCell :: Variable -> Integer -> Integer -> <ReadGraph> Maybe Variable
52 cellEditor :: Resource -> <ReadGraph> CellEditor
53 syncExec :: CellEditor -> OperationMode -> (<SpreadsheetTransaction, Proc> a) -> <Proc> a
54 cellColumn :: Variable -> <ReadGraph> Integer
55 spreadsheetBook :: Variable -> <Proc> SpreadsheetBook
57 importJava "org.simantics.spreadsheet.util.SpreadsheetUtils" where
58 createSheet :: Resource -> String -> <WriteGraph> Resource
59 queryCells :: a -> [TableCell]
60 modifyCells1 :: [TableCell] -> (TableCell -> TableCell) -> [TableCell]
61 modifyCells :: [TableCell] -> [(TableCell -> TableCell)] -> [TableCell]
62 organizeCells :: Integer -> [String] -> [TableCell] -> [TableCell]
63 applyFont :: IFont -> (TableCell -> Boolean) -> TableCell -> TableCell
64 applyAlign :: Integer -> (TableCell -> Boolean) -> TableCell -> TableCell
65 applyForeground :: IColor -> (TableCell -> Boolean) -> TableCell -> TableCell
66 applyBackground :: IColor -> (TableCell -> Boolean) -> TableCell -> TableCell
67 simpleFont :: String -> String -> Integer -> IFont
68 rgbColor :: Integer -> Integer -> Integer -> IColor
69 selectRow :: Integer -> TableCell -> Boolean
70 selectColumn :: Integer -> TableCell -> Boolean
71 setSCLLine :: Resource -> Integer -> String -> <WriteGraph> ()
72 sheetRun :: Resource -> Variable -> <ReadGraph> Variable
74 bookRun :: Resource -> Variable -> <ReadGraph> Variable
76 sheetRunDefault = bookRunDefault
78 bookRunDefault :: Resource -> <ReadGraph> Variable
79 bookRunDefault book = bookRun book (resourceVariable book)
81 importJava "org.simantics.spreadsheet.graph.ExcelImport" where
82 importBook :: Resource -> File -> <Proc> ()
84 importSpreadsheetBookAction :: Resource -> <Proc> ()
85 importSpreadsheetBookAction res = match fileDialog "foo" [("Excel file", "*.xls"), ("Excel File", "*.xlsx")] with
87 Just file -> importBook res file
89 createSpreadsheetBookAction :: Resource -> <Proc> ()
90 createSpreadsheetBookAction res = do
91 syncWrite (\() -> createSpreadsheetBookDefault res)
94 createSpreadsheetSheetAction :: Resource -> <Proc> ()
95 createSpreadsheetSheetAction res = do
96 syncWrite (\() -> createSpreadsheetDefault res)
99 createSpreadsheetDefault :: Resource -> <WriteGraph> Resource
100 createSpreadsheetDefault library = createSheet library $ findFreshEscapedName "Sheet" library
102 createSpreadsheetBookDefault :: Resource -> <WriteGraph> Resource
103 createSpreadsheetBookDefault library = createSpreadsheetBook library $ findFreshEscapedName "Book" library
105 createRange :: Resource -> Resource -> String -> String -> <WriteGraph> Resource
106 createRange library type_ name expression = do
107 range = newResource ()
108 claim range L0.InstanceOf type_
109 claimRelatedValue range L0.HasName name
110 createSCLValue range SHEET.ExpressionRange.cells SHEET.SCLValue expression
111 claim range L0.PartOf library
114 createSpreadsheetBook :: Resource -> String -> <WriteGraph> Resource
115 createSpreadsheetBook library name = do
117 book = newResource ()
118 claim book L0.InstanceOf SHEET.Book
119 claimRelatedValue book L0.HasName name
120 claim book L0.PartOf library
121 createSheet book "Sheet"
122 addCommentMetadata ("Created Spreadsheet Book " + name)