X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.document.server%2Fscl%2FDocument%2FAll.scl;h=a90a24bcb62c30c55cad163eb3d242f869bec690;hb=3772b8c75d61b4617bddc8cba49c3e37d0b0e749;hp=23896814224bdeed738e03fb32723c466fc5d367;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.document.server/scl/Document/All.scl b/bundles/org.simantics.document.server/scl/Document/All.scl index 238968142..a90a24bcb 100644 --- a/bundles/org.simantics.document.server/scl/Document/All.scl +++ b/bundles/org.simantics.document.server/scl/Document/All.scl @@ -2,6 +2,9 @@ import "Simantics/DB" import "Simantics/Variables" import "JavaBuiltin" as Java +importJava "org.simantics.document.server.DocumentProperties" where + data DocumentProperties + importJava "org.simantics.document.server.io.IConsole" where data IConsole addMessage :: IConsole -> String -> () @@ -21,6 +24,13 @@ importJava "org.simantics.document.server.io.ITreeTableCell" where importJava "org.simantics.document.server.io.IFont" where data IFont + + @JavaName getFamily + fontFamily :: IFont -> Maybe String + @JavaName getStyle + fontStyle :: IFont -> Maybe String + @JavaName getHeight + fontHeight :: IFont -> Integer importJava "org.simantics.document.server.io.IColor" where data IColor @@ -78,6 +88,9 @@ instance Coercible CommandContextMutable CommandContext where cloneCommandContext :: CommandContext -> CommandContextMutable cloneCommandContext context = merge (commandContext ()) context +instance Show CommandContext where + show ctx = printContext ctx + importJava "org.simantics.document.server.io.CommandResult" where data CommandResult @@ -92,7 +105,7 @@ importJava "org.simantics.document.server.Functions" where putTuple :: CommandContextMutable -> String -> a -> CommandContextMutable @JavaName getTuples - getTuples :: CommandContext -> String -> [a] + getTuples :: CommandContext -> String -> [Dynamic] printContext :: CommandContext -> String @@ -100,6 +113,9 @@ importJava "org.simantics.document.server.Functions" where dataDefinitions :: Variable -> [DataDefinition] + @JavaName "dataDefinitions" + computeDataDefinitions :: Variable -> [DataDefinition] + emptyOnClick :: () -> AbstractEventHandler writeEventHandler :: Variable -> (Variable -> (String -> Maybe String) -> String) -> AbstractEventHandler @@ -127,6 +143,11 @@ importJava "org.simantics.document.server.Functions" where stateVariable :: Variable -> Variable + compileDocumentSCLValueExpression :: Variable -> String + compileDocumentSCLHandlerValueExpression :: Variable -> String + + primitiveProperties :: DocumentProperties + propertyValueCached :: Serializable a => Typeable a => Variable -> String -> a propertyValueCached var prop = propertyValueCached_ var prop binding @@ -136,10 +157,10 @@ displayValue var str = propertyValue (property var str) "HasDisplayValue" displayValue0 :: Variable -> String displayValue0 var = propertyValue var "HasDisplayValue" -consoleLog :: Variable -> String -> () -consoleLog state message = do - console = state#console - runProc $ addMessage console message +consoleLog :: CommandContext -> String -> () +consoleLog context message = match possibleValue context "console" with + Nothing -> () + Just console -> runProc $ addMessage console message contextDocument :: CommandContext -> IDocument contextDocument ctx = justValue ctx "__document__"