 |
Main data model discussion page
jMaki Drawer Data Model
(1.0) Introduction
A drawer is a container widget that allows you to expand or collapse the widget. The widget follows the general dynamic container model which allows you to set the content or URL to include as the content even after you load the widget.
(1.1) Example
Here is a sample:
<a:widget name="dojo.drawer"
value=" { label : 'Drawer',
content : 'Static Drawer Content',
expanded : true,
action:
{ topic : '/jmaki/doSomething',
message : { targetId : 'foo', value : 'gregge'}
}
}"/>
(2.0) Data Model
The model is similar to the previous model with a few added features. We wanted to add an action property which allows users to specify the message to publish and the topic to publish to.
If no topic is specified then the default topic is used that was specified by the publish property on the tag. We want the message to be a string or JavaScript object literal and this may need additional specification.
label ::= "{" "label:" <string>, [<content> | <include> |<action> ] [<lazyload>] <expanded>"},"
expanded ::= "expanded:" "true" | "false" (default is true)
include ::= "include:" <string> ,
lazyload ::= "lazyload:" "true" | "false",
content ::= "content:" <string>,
action ::= "action:" "{" [<topic>] <message> "},"
topic ::= "topic:" <string>,
message ::= "message:" <obj>
obj ::= <string> | <JavaScript object literal>
JSON Schema format:
{
"description" : "jMaki Drawer",
"type":"object",
"properties": {
"id" : {"type": "string", "optional":true},
"label" : {"type": "string"},
"content" : {"type": "string","optional":true},
"include" : {"type": "string","optional":true},
"selected" : {"type": "boolean","optional":true, "default":false},
"lazyload" : {"type": "boolean","optional":true, "default":false},
"expanded" : {"type": "boolean","optional":true, "default":true},
"action" : {"type" : "object","optional":true,
"properties": {
"topic": {"type" : "string", "optional" : true},
"message": {"type" : ["string","object"],, "optional" : true}
}
}
}
}
(2.2) Property Descriptions
label is the property which identifies a particular tab, It is required and there may be more than one.
expanded if set to true then this row is displayed when the widget is rendered.
content describes the static content which will be displayed in the row when the widget is rendered. It indicates that the static content is included inline.
include is the page that should be loaded in the pane
action is the way to override the default events that are fired if no action is specified.
(3.0) Events
Several events are fired in the model. The table below describes the default events and payload published with each event.
(3.1) Publish Events
| Event | Payload | Event |
| onSelect | widget id, topic name, targetId, message if it exists | Published when a user selects an accordion pane. |
(3.2) Subscribe Events
| Event | Payload |
| collapse | |
| expand | |
| setContent | value (string which may include markup) |
| setInclude | targetId, value which is a URL to include (same domain) |
Examples:
Expand the Pane:
jmaki.publish("/dojo/drawer/expand", { });
Collapse the Pane:
jmaki.publish("/dojo/drawer/collapse", { });
Set the content of a pane:
jmaki.publish("/dojo/drawer/setContent, { value : 'content is king'});
Set the include:
jmaki.publish("/dojo/drawer/setInclude", { value : 'foo3.jsp'});
-- Main.gmurray71 - 01 Aug 2007
|