|
Zapatec Utils | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--Zapatec.EventDriven | +--Zapatec.Widget
Defined in zpwidget.js
Field Summary | |
Object |
config
|
Constructor Summary | |
Zapatec.Widget(<object> oArg)
Base widget class. |
Method Summary | |
void
|
acceptData(<object> oArg)
Receives data back from other widget previously passed to it using its Zapatec.Widget.receiveData() method. |
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(). |
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
|
getMessage(key)
Get message for given key, make substitutions and return. |
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
|
receiveData(<object> oArg)
Loads data passed from other widget for example to view or edit them. |
void
|
reconfigure(<object> oArg)
Reconfigures the widget with new config options after it was initialized. |
any
|
replyData()
Prepares processed data to return them back to the sender in the same format as they were received in Zapatec.Widget.receiveData(). |
void
|
replyDataCancel()
Cancels processing of the data received from the sender in Zapatec.Widget.receiveData(). |
void
|
replyDataReturn(<object> oArg)
Returns processed data back to the specified widget (not necessarily to the same widget from which they were received in Zapatec.Widget.receiveData()). |
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". Special theme "auto" is used to detect theme automatically depending from OS. It is replaced automatically with one of the following values: winvista for Windows Vista winxp for Windows XP win2k for other Windows macosx for Mac OSX default for other OS Make sure all these themes exist before using "auto" theme for the widget. 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. callbackConvertSource [function] May be used to convert input data passed with "source" config option from custom format into internal format of the widget. Must return converted source. eventListeners [object] Associative array with event listeners: { [string] event name: [function or object] event listener or array of event listeners, ... } Defines internal property config.
oArg
- User configuration
Method Detail |
void acceptData(<object> oArg)
Argument object format: { widget: [object] Caller widget instance, data: [any] Data in format specific for each widget } Fires event:
oArg
- Argument object
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()
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 getMessage(key)
key
- {Object} String, object or anything else that can be treated as array key in Javascript. Required.
substitution1
- {String} First substitution to the string. Optional. ...
substitutionN
- {String} Last substitution to the string. Optional.
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 receiveData(<object> oArg)
Argument object format: { widget: [object] Optional. Sender widget instance, data: [any] Data in format specific for each widget } Saves passed widget in private property dataSender for later use in Zapatec.Widget.replyDataReturn(). Fires event:
oArg
- Argument object
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
any replyData()
void replyDataCancel()
Removes private property dataSender. Fires event:
void replyDataReturn(<object> oArg)
Argument object format: { widget: [object] Optional. Receiver widget instance } If receiver widget was not specified, uses widget passed to Zapatec.Widget.receiveData() and saved in private property dataSender. Fires event:
oArg
- Argument object
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 |