Module which defines the Widget data type and operations which apply to all widgets.
- class (Typeable c, Typeable s, Show c, FromJSON s, ToJSON s) => Widget c s | c -> s where
- getWidgetId :: c -> WidgetId
- renderWidget :: c -> Html
- encodeClientStateJs :: WidgetType c -> JavascriptUrl Text
- decodeClientStateJs :: WidgetType c -> JavascriptUrl Text
- showWidget :: c -> s -> String
- headMergeContent :: WidgetType c -> Html
- widgetResources :: WidgetType c -> [ResourceBundle]
- data WidgetId
- getWidgetState :: Widget w s => w -> CallbackM (Maybe s)
- setWidgetState :: Widget w s => w -> s -> CallbackM ()
- widgetSelector :: Widget w s => w -> SimpleSelector
Documentation
class (Typeable c, Typeable s, Show c, FromJSON s, ToJSON s) => Widget c s | c -> s whereSource
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.
Widget Application ApplicationState |
Widget ID.
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.