-
addClassName(classNames, affectCustomProp)
-
Add class name(s) to widget element. If affectCustomProp is true, this method will change customHtmlClassName property.
Parameters:
Name |
Type |
Description |
classNames |
Variant
|
Can be a simple name, or a series of name separated by space ('name1 name2')
or an array of strings. |
affectCustomProp |
Bool
|
Whether change customHtmlClassName property of widget. |
- Source:
-
addIaController(id, controller, asDefault)
-
Link a controller with this component.
Parameters:
Name |
Type |
Description |
id |
String
|
Unique id of controller |
controller |
Kekule.Widget.InteractionController
|
|
asDefault |
Bool
|
Whether set this controller as the default one to handle events. |
- Source:
-
appendToElem(parentElem)
-
Append current widget to parentElem.
Parameters:
Name |
Type |
Description |
parentElem |
HTMLElement
|
|
- Source:
-
-
Append widget as a child to parentWidget.
Parameters:
- Source:
-
blur()
-
Move focus out of widget.
- Source:
-
canUsePlaceHolderOnElem(elem) → {Bool}
-
Returns whether a placeholder widget can be bind to element to represent this widget.
This method is used when auto-launching widget on HTML element. Descendants can override this method.
Parameters:
Name |
Type |
Description |
elem |
HTMLElement
|
|
- Source:
Returns:
-
Type
-
Bool
-
createDecorationContent(parentElem, refElem) → {HTMLElement}
-
Create a decoration content element and insert it to parentElem before refElem.
Parameters:
Name |
Type |
Description |
parentElem |
HTMLElement
|
|
refElem |
HTMLElement
|
|
- Source:
Returns:
Element created.
-
Type
-
HTMLElement
-
createElement() → {HTMLElement}
-
Create an HTML element to represent the widget.
//@param {HTMLElement} parentElement
- Source:
Returns:
-
Type
-
HTMLElement
-
createGlyphContent(parentElem, refElem, htmlClassName) → {HTMLElement}
-
Create a glyph content container and insert it to parentElem before refElem.
Parameters:
Name |
Type |
Description |
parentElem |
HTMLElement
|
|
refElem |
HTMLElement
|
|
htmlClassName |
String
|
Class name added to content element. |
- Source:
Returns:
Element created.
-
Type
-
HTMLElement
-
createTextContent(text, parentElem, refElem) → {HTMLElement}
-
Create an text content element and insert it to parentElem before refElem.
Parameters:
Name |
Type |
Description |
text |
String
|
|
parentElem |
HTMLElement
|
|
refElem |
HTMLElement
|
|
- Source:
Returns:
Element created.
-
Type
-
HTMLElement
-
defineElemAttribMappingProp(propName, elemAttribName, options) → {Object}
-
Create a property that read/write attribute of HTML element.
Parameters:
Name |
Type |
Description |
propName |
String
|
|
elemAttribName |
String
|
Attribute name of HTML element. |
options |
Hash
|
Options to define property. If not set, default option will be used. |
- Source:
Returns:
Property info object added to property list.
-
Type
-
Object
-
defineElemStyleMappingProp(propName, stylePropName, options) → {Object}
-
Create a property that read/write style property of HTML element.
Parameters:
Name |
Type |
Description |
propName |
String
|
|
stylePropName |
String
|
Property name of element.style. |
options |
Hash
|
Options to define property. If not set, default option will be used. |
- Source:
Returns:
Property info object added to property list.
-
Type
-
Object
-
destroyElement(elem)
-
Remove the binding element from DOM tree.
Parameters:
Name |
Type |
Description |
elem |
HTMLElement
|
|
- Source:
-
dismiss(caller, callback, hideType,)
-
Dismiss a widget and cancel its modified value.
Here we simply hide the widget.Descendant may override this method to do more complex job.
Parameters:
Name |
Type |
Description |
caller |
Kekule.Widget.BaseWidget
|
Who calls the hide method and make this widget invisible. |
callback |
Func
|
This callback function will be called when the widget is totally hidden. |
hideType, |
Int
|
value from Kekule.Widget.ShowHideType.
* @param {Hash} extraOptions Extra transition options.
It may contains two special fields. One is "instantly". If this field is set to true, the showing process will be executed without transition.
The other is "useVisible", if true, when hiding the widget, visible property will be setted to false, otherwise the displayed property will be setted to false. |
- Source:
-
doBindElement(element)
-
Do actual work of bindElement for descendents' overriding.
Parameters:
Name |
Type |
Description |
element |
HTMLElement
|
|
- Source:
-
domElemAdded(elem)
-
Called when additional element inserted inside widget.
Parameters:
Name |
Type |
Description |
elem |
HTMLElement
|
|
- Source:
-
domElemRemoved(elem)
-
Called when element removed from widget.
Parameters:
Name |
Type |
Description |
elem |
HTMLElement
|
|
- Source:
-
doUnbindElement(element)
-
Do actual work of unbindElement for descendents' overriding.
Parameters:
Name |
Type |
Description |
element |
HTMLElement
|
|
- Source:
-
execute(invokerHtmlEvent)
-
This method should be called when the primary action is taken on widge
(such as click on button, select on menu and so on).
Parameters:
Name |
Type |
Description |
invokerHtmlEvent |
Object
|
HTML event object that invokes executing process. |
- Source:
-
flash(time, caller, callback, showType,)
-
Show widget then hide it after a period of time.
Parameters:
Name |
Type |
Description |
time |
Int
|
In milliseconds. |
caller |
Kekule.Widget.BaseWidget
|
Who calls the show method and make this widget visible. |
callback |
Func
|
This callback function will be called when the widget is totally shown. |
showType, |
Int
|
value from Kekule.Widget.ShowHideType. |
- Source:
-
focus()
-
Focus on widget.
- Source:
-
getBindableElemTagNames() → {Array}
-
Returns the tag names of element can be binded with widget. Tag names should be all lowercased.
The return value of null means widget can bind to any element.
On the contrary, if [](empty array) is returned, the widget will be regarded as unbindable to any element.
Defaultly, this method will return widget.BINDABLE_TAG_NAMES.
Descendants can overwrite that variable to meet their own needs.
- Source:
Returns:
-
Type
-
Array
-
getBoundingClientRect(elem, includeScroll) → {Hash}
-
Returns bounding client rectangle of widget.
Parameters:
Name |
Type |
Description |
elem |
HTMLElement
|
|
includeScroll |
Bool
|
If this value is true, scrollTop/Left of documentElement will be added to result. |
- Source:
Returns:
{top, left, bottom, right, width, height}
-
Type
-
Hash
-
getChildActionClass(actionName, checkSupClasses) → {Class}
-
Returns child action class associated with name for this widget.
Parameters:
Name |
Type |
Description |
actionName |
String
|
|
checkSupClasses |
Bool
|
When true, if action is not found in current widget class, super classes will also be checked. |
- Source:
Returns:
-
Type
-
Class
-
-
Returns child widget at index
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Source:
Returns:
-
Type
-
Kekule.Widget.BaseWidget
-
getChildrenHolderElement() → {HTMLElement}
-
Returns the element that be used as root to insert child widgets.
Descendants can override this method to reflect that situation.
- Source:
Returns:
-
Type
-
HTMLElement
-
-
Returns widget instance of configurator.
- Source:
Returns:
-
Type
-
Kekule.Widget.BaseWidget
-
getCoreElement() → {HTMLElement}
-
Returns core element of widget.
Usually core element is the element widget binded to, but in some
cases, core element may be a child of widget element. Descendants
can override this method to reflect that situation.
- Source:
Returns:
-
Type
-
HTMLElement
-
getDimension() → {Hash}
-
Returns dimension in px of this widget.
- Source:
Returns:
{width, height}.
-
Type
-
Hash
-
getGlobalManager() → {Object}
-
Returns global widget manager in current document.
- Source:
Returns:
-
Type
-
Object
-
-
Returns controller by id.
Parameters:
Name |
Type |
Description |
id |
String
|
|
- Source:
Returns:
-
Type
-
Kekule.Widget.InteractionController
-
getNextSibling()
-
Returns next sibling widget under the same parent widget.
- Source:
-
-
Returns rectangle of widget in HTML page.
Parameters:
Name |
Type |
Description |
elem |
HTMLElement
|
|
relToViewport |
Bool
|
If this value is true, scrollTop/Left of documentElement will be substracted from result. |
- Source:
Returns:
{top, left, bottom, right, width, height}
-
Type
-
Hash
-
getPrevSibling()
-
Returns previous sibling widget under the same parent widget.
- Source:
-
getStateClassName(state) → {String}
-
Get class name to set the outlook of current state.
Descendants can override this method.
Parameters:
Name |
Type |
Description |
state |
Int
|
|
- Source:
Returns:
-
Type
-
String
-
getStyleProperty(cssPropName, element) → {Variant}
-
Get CSS property value or a style resource linked to element.
Parameters:
Name |
Type |
Description |
cssPropName |
String
|
CSS property name in JavaScript form. |
element |
HTMLElement
|
If not set, widget element will be used. |
- Source:
Returns:
-
Type
-
Variant
-
getTextSelectable() → {Bool}
-
Whether the text content inside widget element can be user selected.
Most widget (like tree, button) should return false, but form controls (like textbox) should return true.
Descendants may override this method.
- Source:
Returns:
-
Type
-
Bool
-
-
Returns widget identity class name(s) need to add to HTML element.
- Source:
Returns:
-
Type
-
string
-
hasChild(widget) → {Bool}
-
Check if widget is a child of current widget.
Parameters:
- Source:
Returns:
-
Type
-
Bool
-
hasClassName(className) → {Bool}
-
Check if a class is associate with element of this widget.
Parameters:
Name |
Type |
Description |
className |
String
|
|
- Source:
Returns:
-
Type
-
Bool
-
hide(caller, callback, hideType,, extraOptions)
-
Hide widget.
Parameters:
Name |
Type |
Description |
caller |
Kekule.Widget.BaseWidget
|
Who calls the hide method and make this widget invisible. |
callback |
Func
|
This callback function will be called when the widget is totally hidden. |
hideType, |
Int
|
value from Kekule.Widget.ShowHideType. |
extraOptions |
Hash
|
Extra transition options.
It may contains two special fields. One is "instantly". If this field is set to true, the showing process will be executed without transition.
The other is "useVisible", if true, when hiding the widget, visible property will be setted to false, otherwise the displayed property will be setted to false. |
- Source:
-
indexOfChild(widget) → {Int}
-
Returns index of child widget. If widget is not a child, -1 will be returned.
Parameters:
- Source:
Returns:
-
Type
-
Int
-
insertedToDom()
-
Called when widget is inserted into DOM tree.
- Source:
-
insertToElem(parentElem, refElem)
-
Insert current widget to parentElem, before refElem.
Parameters:
Name |
Type |
Description |
parentElem |
HTMLElement
|
|
refElem |
HTMLElement
|
|
- Source:
-
-
Insert this widget as child to parentWidget, before refWidget. If refWidget not set, widget will be appended to parent.
Parameters:
- Source:
-
isCaptureMouse() → {Bool}
-
Returns whether this widget is currently capturing mouse/touch event.
- Source:
Returns:
-
Type
-
Bool
-
isElementBindable(element) → {Bool}
-
Check if widget can bind to an element.
Descendants can override this method to do some further check on element.
Parameters:
Name |
Type |
Description |
element |
HTMLElement
|
|
- Source:
Returns:
-
Type
-
Bool
-
isInDomTree() → {Bool}
-
Check if widget is in document DOM tree.
- Source:
Returns:
-
Type
-
Bool
-
isPeriodicalExecuting() → {Bool}
-
Check if periodical executing is on process.
- Source:
Returns:
-
Type
-
Bool
-
isShown(ignoreDom) → {Bool}
-
Check if widget element is visible to user.
Parameters:
Name |
Type |
Description |
ignoreDom |
Bool
|
If true, this method will only check CSS visibility and display property. |
- Source:
Returns:
-
Type
-
Bool
-
linkStyleResource(resOrName, element)
-
Apply style resource to self or an element.
Parameters:
Name |
Type |
Description |
resOrName |
Variant
|
An instance of Kekule.Widget.StyleResource or resource name. |
element |
HTMLElement
|
If not set, style will be set to widget element. |
- Source:
-
openConfigurator(callerWidget)
-
Open a popup configurator to modify settings of displayer.
Parameters:
- Source:
-
removeClassName(classNames, affectCustomProp)
-
remove class(es) from widget element. This method not also change customHtmlClassName property.
Parameters:
Name |
Type |
Description |
classNames |
Variant
|
Can be a simple name, or a series of name separated by space ('name1 name2')
or an array of strings. |
affectCustomProp |
Bool
|
Whether change customHtmlClassName property of widget. |
- Source:
-
removedFromDom()
-
Called when widget is removed from DOM tree.
- Source:
-
removeFromDom()
-
Remove current widget from DOM temporarily.
- Source:
-
removeIaController(id)
-
Unlink a controller with this component.
Parameters:
Name |
Type |
Description |
id |
String
|
Unique id of controller |
- Source:
-
removeStyleProperty(cssPropName, element)
-
Clear CSS property to widget or another element.
Parameters:
Name |
Type |
Description |
cssPropName |
String
|
CSS property name in JavaScript form. |
element |
HTMLElement
|
If not set, style will be set to widget element. |
- Source:
-
setDimension(width, height, suppressResize)
-
Set width and height of current widget. Width and height value can be number (how many pixels)
or a CSS string value directly.
Parameters:
Name |
Type |
Description |
width |
Variant
|
|
height |
Variant
|
|
suppressResize |
Bool
|
If this value is true, resized method will not be called. |
- Source:
-
setMouseCapture(capture)
-
Set or unset mouse capture feature of current widget.
Parameters:
Name |
Type |
Description |
capture |
Bool
|
|
- Source:
-
setStyleProperty(cssPropName, value, element)
-
Set CSS property value to widget or another element.
Parameters:
Name |
Type |
Description |
cssPropName |
String
|
CSS property name in JavaScript form. |
value |
Variant
|
A simple css value or an instance of Kekule.Widget.StyleResource
or a style resource name. |
element |
HTMLElement
|
If not set, style will be set to widget element.
UNFINISHED yet |
- Source:
-
show(caller, callback, showType,, extraOptions)
-
Make widget visible.
Parameters:
Name |
Type |
Description |
caller |
Kekule.Widget.BaseWidget
|
Who calls the show method and make this widget visible. |
callback |
Func
|
This callback function will be called when the widget is totally shown. |
showType, |
Int
|
value from Kekule.Widget.ShowHideType. |
extraOptions |
Hash
|
Extra transition options.
It may contains a field "instantly". If this field is set to true, the showing process will be executed without transition. |
- Source:
-
startObservingGestureEvents(eventNames)
-
Start observing gesture events.
Parameters:
Name |
Type |
Description |
eventNames |
Array
|
Events need to be observed. |
- Source:
-
startPeriodicalExec(htmlEvent)
-
Begin periodical execution.
Parameters:
Name |
Type |
Description |
htmlEvent |
Object
|
HTML event that starts periodical execution. |
- Source:
-
stopObservingGestureEvents(eventNames)
-
Stop observing gesture events.
Parameters:
Name |
Type |
Description |
eventNames |
Array
|
Events need to be stopped. |
- Source:
-
stopPeriodicalExec()
-
Stop periodical execution.
- Source:
-
testMouseCursor(coord, e) → {Variant}
-
Get mouse cursor at a certain coord.
Component can implement this function, or dispatch it to controllers.
Parameters:
Name |
Type |
Description |
coord |
Hash
|
2D mouse coord |
e |
Object
|
event arg passed from mouse move event |
- Source:
Returns:
CSS cursor property value. Return '' to use default one.
The return value can also be a array of cursor key words, the first legal one in current browser will be used.
-
Type
-
Variant
-
toggleClassName(className, affectCustomProp)
-
Toggle class(es) from element. This method not also change customHtmlClassName property.
Parameters:
Name |
Type |
Description |
className |
Variant
|
Can be a simple name, or a series of name separated by space ('name1 name2')
or an array of strings. |
affectCustomProp |
Bool
|
Whether change customHtmlClassName property of widget. |
- Source:
-
unlinkStyleResource(resOrName, element)
-
Remove style resource from self or an element.
Parameters:
Name |
Type |
Description |
resOrName |
Variant
|
An instance of Kekule.Widget.StyleResource or resource name. |
element |
HTMLElement
|
If not set, style will be removed from widget element. |
- Source:
-
-
Update widget transform based on current dimension.
- Source:
-
-
Called when widget is inserted in or removed from HTML page DOM.
Parameters:
Name |
Type |
Description |
isInDom |
Bool
|
|
- Source: