|
Zapatec Utils | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--Zapatec.EventDriven | +--Zapatec.Widget
Field Summary | |
Object |
config
|
Constructor Summary | |
Zapatec.Widget(<object> oArg)
Base widget class. |
Method Summary | |
void
|
addCircularRef(<object> oElement, <string> sProperty)
Saves a property that must be set to null on window unload event. |
void
|
addStandardEventListeners()
Adds standard event listeners. |
void
|
addUserEventListeners()
Adds custom event listeners. |
void
|
configure(<object> oArg)
Configures widget. |
void
|
createProperty(<object> oElement, <string> sProperty, <any> val)
Assigns a value to a custom property of DOM object. |
void
|
defineConfigOption(<string> sOption, <any> val)
Defines config option if it is not defined yet. |
void
|
discard()
Deletes a reference to the object from the internal list and calls method Zapatec.Widget.removeCircularRefs(). |
void
|
editData(<object> oArg)
Loads data passed from other widget to view or edit them. |
void
|
editDataCancel()
Cancels editing. |
any
|
editDataGet()
Returns edited data. |
void
|
editDataReceive(<object> oArg)
Receives data back from other widget previosly passed to it using its Zapatec.Widget.editData() method. |
void
|
editDataReturn(<object> oArg)
Returns edited data back to the widget from which they were received. |
string
|
formElementId(oArg)
Forms unique element id from widget id, unique counter and provided prefix and suffix. |
string
|
getClassName(oArg)
Forms class name from theme name and provided prefix and suffix. |
object
|
getConfiguration()
Returns current configuration of the widget. |
Object
|
hideContainer(<object> effects, <number> animSpeed, onFinish)
Hides widget using given effects and animation speed. |
void
|
init(<object> oArg)
Initializes object. |
void
|
loadData(<object> oArg)
Loads data from the specified source. |
void
|
loadDataHtml(<object> oSource)
Loads data from the HTML source. |
void
|
loadDataHtmlText(<string> sSource)
Loads data from the HTML fragment source. |
void
|
loadDataJson(<object> oSource)
Loads data from the JSON source. |
void
|
loadDataXml(<object> oSource)
Loads data from the XML source. |
void
|
loadTheme()
Loads specified theme. |
void
|
reconfigure(<object> oArg)
Reconfigures the widget with new config options after it was initialized. |
Object
|
showContainer(<object> effects, <number> animSpeed, <function> onFinish)
Shows widget using given effects and animation speed. |
Object
|
showHideContainer(<object> effects, <number> animSpeed, onFinish, <boolean> show)
Show/hides widget using given effects and animation speed. |
<static> any
|
callMethod(<number> iWidgetId, <string> sMethod)
Finds a widget by id and calls specified method with specified arguments and returns value from that method. |
<static> object
|
getElementById(<string> element)
Converts element id to reference. |
<static> string
|
getStyle(<object> element)
Returns style attribute of the specified element. |
<static> object
|
getWidgetById(iId)
Finds a widget by id. |
Methods inherited from class Zapatec.EventDriven |
addEventListener, unshiftEventListener, removeEventListener, getEventListeners, isEventListener, isEvent, removeEvent, fireEvent
|
Field Detail |
Object config
Constructor Detail |
Zapatec.Widget(<object> oArg)
Defines following config options: theme [string] Theme name that will be used to display the widget. Corresponding CSS file will be picked and added into the HTML document automatically. Case insensitive. Default: "default". May also contain relative or absolute URL of themes directory. E.g. "../themes/default.css" or "http://my.web.host/themes/default.css". themePath [string] Relative or absolute URL to themes directory. Trailing slash is required. Default: path to child widget's file + "../themes/". You may also include path into "theme" option instead of using "themePath" option. asyncTheme [boolean] Load theme asynchronously. This means that script execution will not be suspended until theme is loaded. Theme will be applied once it is loaded. Default: false. source Depends on "sourceType" option. Possible sources: ----------------------------------------------------------------------------- sourceType | source ---------------|------------------------------------------------------------- 1) "html" | [object or string] HTMLElement or its id. 2) "html/text" | [string] HTML fragment. 3) "html/url" | [string] URL of HTML fragment. 4) "json" | [object or string] JSON object or string (http://json.org). 5) "json/url" | [string] URL of JSON data source. 6) "xml" | [object or string] XMLDocument object or XML string. 7) "xml/url" | [string] URL of XML data source. ----------------------------------------------------------------------------- sourceType [string] Used together with "source" option to specify how source should be processed. Possible source types: "html", "html/text", "html/url", "json", "json/url", "xml", "xml/url". JSON format is described at http://www.json.org. callbackSource [function] May be used instead of "source" and "sourceType" config options to get source depending on passed arguments. Receives object with passed arguments. Must return following object: { source: [object or string] see table above for possible sources, sourceType: [string] see table above for possible source types } asyncSource [boolean] Load source asynchronously. This means that script execution will not be suspended until source is loaded. Source will be processed once it is loaded. Default: true. reliableSource [boolean] Used together with "json" or "json/url" sourceType to skip JSON format verification. It saves a lot of time for large data sets. Default: true. eventListeners [object] Associative array with event listeners: { [string] event name: [function] event listener, ... } Defines internal property config.
oArg
- User configuration
Method Detail |
void addCircularRef(<object> oElement, <string> sProperty)
Defines internal property widgetCircularRefs.
oElement
- DOM object
sProperty
- Property name
void addStandardEventListeners()
void addUserEventListeners()
void configure(<object> oArg)
oArg
- User configuration
void createProperty(<object> oElement, <string> sProperty, <any> val)
oElement
- DOM object
sProperty
- Property name
val
- Property value
void defineConfigOption(<string> sOption, <any> val)
sOption
- Config option name
val
- Optional. Config option default value
void discard()
void editData(<object> oArg)
Argument object format: { data: [any] data in format specific for each widget } Fires event:
oArg
- Argument object
void editDataCancel()
Fires event:
any editDataGet()
void editDataReceive(<object> oArg)
Argument object format: { data: [any] data in format specific for each widget } Fires event:
oArg
- Argument object
void editDataReturn(<object> oArg)
Argument object format: { widget: [object] widget object } Fires event:
oArg
- Argument object
string formElementId(oArg)
Arguments object format: { prefix: [string, optional] prefix, default: 'zpWidget', suffix: [string, optional] suffix, default: '-' } E.g. if widget id is 0, unique counter is 1 and following object provided { prefix: 'zpWidget', suffix: 'Item' }, id will be 'zpWidget0Item1'. Defines internal property widgetUniqueIdCounter.
oArg
- [object] Arguments object
string getClassName(oArg)
Arguments object format: { prefix: [string, optional] prefix, suffix: [string, optional] suffix } E.g. if this.config.theme == 'default' and following object provided { prefix: 'zpWidget', suffix: 'Container' }, class name will be 'zpWidgetDefaultContainer'.
oArg
- [object] Arguments object
object getConfiguration()
Object hideContainer(<object> effects, <number> animSpeed, onFinish)
effects
- list of effects to apply
animSpeed
- possible values - 1..100. Bigger value - more fast animation.
void init(<object> oArg)
Important: Before calling this method, define config options for the widget. Initially "this.config" object should contain all config options with their default values. Then values of config options will be changed with user configuration in this method. Config options provided by user that were not found in "this.config" object will be ignored. Defines internal property id.
oArg
- User configuration
void loadData(<object> oArg)
If source is URL, fires events:
oArg
- Arguments object passed to callbackSource function
void loadDataHtml(<object> oSource)
oSource
- Source HTMLElement object
void loadDataHtmlText(<string> sSource)
sSource
- Source HTML fragment
void loadDataJson(<object> oSource)
oSource
- Source JSON object
void loadDataXml(<object> oSource)
oSource
- Source XMLDocument object
void loadTheme()
Fires events:
void reconfigure(<object> oArg)
Note: "eventListeners" config option is ignored by this method because it is useful only on initialization. To add event listener after the widget was initialized, use addEventListener method instead.
oArg
- Changes to user configuration
Object showContainer(<object> effects, <number> animSpeed, <function> onFinish)
effects
- list of effects to apply
animSpeed
- possible values - 1..100. Bigger value - more fast animation.
onFinish
- Function to call on effect end.
Object showHideContainer(<object> effects, <number> animSpeed, onFinish, <boolean> show)
effects
- list of effects to apply
animSpeed
- possible values - 1..100. Bigger value - more fast animation.
show
- if true - show widget. Otherwise - hide.
<static> any callMethod(<number> iWidgetId, <string> sMethod)
iWidgetId
- Widget id
sMethod
- Method name
any
- Any number of arguments
<static> object getElementById(<string> element)
element
- Element id
<static> string getStyle(<object> element)
element
- Element
<static> object getWidgetById(iId)
Widget
- id
|
Zapatec Utils | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |