Module Document/All

This module is undocumented. This is a list of its definitions.

addMessage :: IConsole -> String -> <Proc> ()

Writes a message into the console of the document session.

cloneCommandContext :: CommandContext -> <Proc> CommandContextMutable

Returns a mutable copy of the given command context. It copies through merge, so only the keys that hold a single value survive.

commandContext :: () -> CommandContextMutable

Creates an empty mutable command context.

commandList :: Variable -> <ReadGraph> [Command]

Returns the commands that the document component owning variable triggers. Broadcast command relations are left out.

commandResult :: Integer -> String -> CommandContextMutable -> CommandResult

commandResult code status assignments builds a command result out of a return code, a status message and the values to assign back in the client.

compileDocumentSCLHandlerValueExpression :: Variable -> <ReadGraph> String

As compileDocumentSCLValueExpression, but for the expression of an event handler.

compileDocumentSCLValueExpression :: Variable -> <ReadGraph> String

Compiles the SCL value expression of the given property variable and returns the empty string when it compiles. Otherwise the result is the message of the problem, which is what the issue shown to the user says. A failure to import a module is reported as no problem.

computeDataDefinitions :: Variable -> <ReadGraph> [DataDefinition]

The same function as dataDefinitions under a second name.

consoleLog :: CommandContext -> String -> ()

consoleLog context message writes message into the console that context carries under the key console. It does nothing when the context has no console.

containsKey :: CommandContext -> String -> Boolean

Tells whether the command context has an entry under the given key. A key can be there and still give Nothing from possibleValue, if what it holds is not a single value.

contextDocument :: CommandContext -> <Proc> IDocument

Returns the document that the command context carries under the key __document__, that is, the document the event came from. The result is null if the context has no such entry.

contextVariable :: Variable -> <ReadGraph> Variable

contextVariable var returns the value of the input property of the parent of var. When var is a property of a document component, the parent is the component and the result is the variable the document is being shown for.

dataDefinitions :: Variable -> <ReadGraph> [DataDefinition]

Returns the data definitions of the document component owning variable, that is, the bindings that feed values of other components into this one.

displayValue :: Variable -> String -> <ReadGraph> String

displayValue var property returns the HasDisplayValue of the named property of var, that is, the string the user interface shows for that property rather than its raw value.

displayValue0 :: Variable -> <ReadGraph> String

Returns the HasDisplayValue of var itself, for when var already is the property variable.

documentModelContribution :: Resource -> <ReadGraph> [Variable]

Returns a variable for every model of the current project, as the models a document can be shown for. The resource argument is not used.

documentModelContributionLabel :: Variable -> <ReadGraph> String

Names a contribution of documentModelContribution by the name of its variable.

elementIdToObjectId :: IDocument -> String -> <Proc> String
emptyOnClick :: () -> <ReadGraph> AbstractEventHandler

Returns an event handler that does nothing and answers nothing. Deprecated.

eventHandler :: ((String -> Maybe String) -> String) -> <ReadGraph> AbstractEventHandler

As writeEventHandler but runs f outside any transaction, so f only gets the parameter lookup function. Deprecated.

eventHandler2 :: (CommandContext -> <Proc> Maybe CommandResult) -> <ReadGraph> AbstractEventHandler

As readEventHandler2 but runs f outside any transaction. Deprecated.

fontFamily :: IFont -> <Proc> Maybe String

Returns the family name of the font, or Nothing if it has none.

fontHeight :: IFont -> <Proc> Integer

Returns the height of the font in points.

fontStyle :: IFont -> <Proc> Maybe String

Returns the style name of the font, such as Bold or Italic, or Nothing if it has none.

getDocumentURI :: IDocument -> <Proc> String

Returns the URI the document was built from.

getKeys :: CommandContext -> [String]

Returns the keys of the command context, in no particular order.

getSessionGUID :: IDocument -> <Proc> String

Returns the GUID of the document session the document belongs to.

getTuples :: CommandContext -> String -> [Dynamic]

Returns the rows stored under the given key, one tuple per row. A row of zero or of two to five elements becomes a tuple of that size, a longer row is dropped, and a row of one element currently fails with an index error. An absent key gives an empty list.

getTuples3 :: CommandContext -> String -> [(a, b, c)]

The same as getTuples with the result typed as triples. Nothing checks that the rows really hold three elements.

justValue :: CommandContext -> String -> a

The same as possibleValue without the Maybe: the result is null wherever possibleValue gives Nothing, which the signature does not show. Use it only for keys that are known to be there.

merge :: CommandContextMutable -> CommandContext -> <Proc> CommandContextMutable

merge target source copies every key of source into target and returns target. Only single values survive the copy: a key of source that holds anything other than one row of two elements arrives in target as a null value.

objectIdToElementId :: IDocument -> String -> <Proc> String
possibleString :: CommandContext -> String -> Maybe String

Returns the value stored under the given key as a string. Nothing if possibleValue would give Nothing, and a failure if the value is not a string. Deprecated: possibleValue does the same without the cast.

possibleValue :: CommandContext -> String -> Maybe a

Returns the value stored under the given key. The result is Nothing unless the key holds exactly one row of exactly two elements, which is the shape putValue writes; the value is then the second element of that row.

primitiveProperties :: <Proc> DocumentProperties

Returns the standard implementation of DocumentProperties, which computes the attributes of a document component from the properties it has in the graph and collects the ones that fail into an exception map instead of failing the component.

printContext :: CommandContext -> String

Returns a readable listing of the command context, one line per key with what it holds. Keys whose name begins with __ are left out.

projectComponentState :: Variable -> String -> a -> <ReadGraph> a

projectComponentState self ref default is sclStateValueOrDefault with the current project as the base and the parent of self as the component, so the state belongs to the project rather than to a document session.

propertyValueCached :: Serializable a => Typeable a => Variable -> String -> <ReadGraph> a

propertyValueCached var name reads the named property of var through the query cache, as propertyValueCached_ does, taking the binding from the expected type.

propertyValueCached_ :: Variable -> String -> Binding a -> <ReadGraph> a

propertyValueCached_ var name binding reads the named property of var with the given binding through the query cache, so that repeated reads of the same property share one computation. propertyValueCached picks the binding from the expected type instead of taking one.

putString :: CommandContextMutable -> String -> String -> <Proc> CommandContextMutable

Stores a string under the given key and returns the same context, so that calls can be chained. Deprecated: putValue does the same for a value of any type.

putTuple :: CommandContextMutable -> String -> a -> CommandContextMutable

putTuple context key tuple adds a row under key holding the components of tuple, and returns the same context so that calls can be chained. Unlike putValue it appends, so one key can collect many rows, and the rows are read back with getTuples. A value that is not a tuple becomes a row of one element.

putValue :: CommandContextMutable -> String -> a -> <Proc> CommandContextMutable

Stores a value under the given key, replacing whatever the key held before, and returns the same context so that calls can be chained. The value is read back with possibleValue.

readEventHandler :: Variable -> (Variable -> (String -> Maybe String) -> <ReadGraph> String) -> <ReadGraph> AbstractEventHandler

As writeEventHandler but runs f in a read transaction. Deprecated.

readEventHandler2 :: (CommandContext -> <ReadGraph,Proc> Maybe CommandResult) -> <ReadGraph> AbstractEventHandler

readEventHandler2 f returns an event handler that runs f in a read transaction with the command context of the event and answers with the command result f returns. A failure is logged and answered as an error response with code 400. Deprecated.

responseHandler :: Variable -> String -> <ReadGraph> AbstractEventHandler

responseHandler self function returns an event handler that calls the SCL handler expression held by the property function of self. The effects the expression declares decide how it is run: a handler that writes the graph runs in a write transaction and any other in a read transaction. A console carried by the command context under the key __console__ receives what the handler prints. A failure is answered as an error response whose message names the handler and its expression and carries the stack trace.

The result is null if self has no such property, which the signature does not show.

sclStateValueOrDefault :: Variable -> Variable -> String -> a -> <ReadGraph> a

sclStateValueOrDefault base self ref default returns the value of the state that sclStateVariable names, or default if that state has never been set.

sclStateVariable :: Variable -> Variable -> String -> <ReadGraph> Variable

sclStateVariable base self ref returns the variable holding the SCL state named ref for the component self, kept under the __scl__ state child of base. The key of the state is built from the URI of self relative to base with the proxy context part cut out, so the same component reached through different contexts shares one state. The result is null if base has no state child, which the signature does not show.

sendEvent :: IConsole -> String -> String -> Vector Dynamic -> <Proc> ()

sendEvent console id event parameters sends the named event to the document element id, with parameters carrying the values that belong to the event.

sendEventCtx :: IConsole -> String -> String -> CommandContext -> <Proc> ()

As sendEvent, but the values that belong to the event are given as a command context rather than as a flat vector.

setProjectComponentState :: Variable -> String -> a -> <WriteGraph> ()

Sets the state that projectComponentState reads. Needs a write transaction.

setSclStateValue :: Variable -> Variable -> String -> a -> <WriteGraph> ()

setSclStateValue base self ref value sets the state that sclStateVariable names. Needs a write transaction.

stateVariable :: Variable -> <ReadGraph> Variable

Returns the __scl__ state child of the document session that self belongs to. Fails if self is not inside a document session, and the result is null if that session has no state child.

writeEventHandler :: Variable -> (Variable -> (String -> Maybe String) -> <WriteGraph> String) -> <ReadGraph> AbstractEventHandler

writeEventHandler variable f returns an event handler that runs f in a write transaction, passing it variable and a function that looks up the string parameters of the event, and answers with the string f returns as a successful response. A failure is logged and answered as an error response. Deprecated: it can only answer a string, while writeEventHandler2 sees the whole command context and chooses its own result.

writeEventHandler2 :: (CommandContext -> <WriteGraph,Proc> Maybe CommandResult) -> <ReadGraph> AbstractEventHandler

As readEventHandler2 but runs f in a write transaction. Deprecated.