dingo-core-0.1.0: Dingo is a Rich Internet Application platform based on the Warp web server.

Dingo.Widget

Description

Module which defines the Widget data type and operations which apply to all widgets.

Synopsis

Documentation

class (Typeable c, Typeable s, Show c, FromJSON s, ToJSON s) => Widget c s | c -> s whereSource

Methods

getWidgetId :: c -> WidgetIdSource

Get the widget ID.

renderWidget :: c -> HtmlSource

Render widget to HTML.

encodeClientStateJs :: WidgetType c -> JavascriptUrl TextSource

Return a JavaScript function to encode state in client to JSON. The function returned MUST be a nullary function which is invoked with this set to a jQuery query result containing the widget.

decodeClientStateJs :: WidgetType c -> JavascriptUrl TextSource

Return a JavaScript function to decode state received from the server by the client. The function receives the encoded state and must update the client-side widget. The this reference will be a jQuery query result containing the widget.

showWidget :: c -> s -> StringSource

Print for debugging.

headMergeContent :: WidgetType c -> HtmlSource

Supply content for head merge when a widget of type w is first added to the application.

widgetResources :: WidgetType c -> [ResourceBundle]Source

Resources required by a widget of this type.

Instances

Widget Application ApplicationState 

data WidgetId Source

Widget ID.

Instances

Eq WidgetId 
Ord WidgetId 
Show WidgetId 
ToValue WidgetId 
Hashable WidgetId 
ToJavascript WidgetId

Convert widget ID to Javascript value. The converted value is guaranteed to not contain any characters requiring quoting or escaping in Javascript, nor to contain any non-ASCII characters.

getWidgetState :: Widget w s => w -> CallbackM (Maybe s)Source

Get the current value of widget.

setWidgetState :: Widget w s => w -> s -> CallbackM ()Source

Update the value of a widget. This function pushes the new value to the browser.

widgetSelector :: Widget w s => w -> SimpleSelectorSource

Widget selector.