Class Alfresco.component.Base
Defined in: alfresco.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Alfresco.component.Base(name, id, components)
Alfresco.component.Base constructor.
|
| Field Attributes | Field Name and Description |
|---|---|
|
Object container for storing module instances.
|
|
|
Object container for initialization options
|
|
|
Object container for storing service instances.
|
|
|
Object container for storing YUI widget instances.
|
| Method Attributes | Method Name and Description |
|---|---|
|
Add default anchor callbacks for this component based on its id so they are instance specific.
|
|
|
bind(method)
Asserts a method always is called with this component's scope
|
|
|
Will be called after the components onready method adn will search for buttons declared as alfresco-buttons.
|
|
|
destroy()
Destroy method - destroy widgets, dereference modules & services
|
|
|
fire(event, value)
Fires an event
|
|
|
invokeAction(action, value, el)
Helper method to invoke a method or fire an event based on the action.
|
|
|
msg(messageId)
Gets a custom message
|
|
|
onComponentLoaded(response)
Called when this component has been refreshed and the new markup has been loaded.
|
|
|
Fired by YUILoaderHelper when required component script files have
|
|
|
Calls the onReady method and adds default event handling to correctly marked-up anchor tags
|
|
|
refresh(webscript)
Call this to refresh/reload the component.
|
|
|
setMessages(obj)
Set messages for this component.
|
|
|
setOptions(obj)
Set multiple initialization options at once.
|
Constructor Detail
Alfresco.component.Base(name, id, components)
Alfresco.component.Base constructor.
- Parameters:
- {String} name
- The name of the component
- {String} id
- he DOM ID of the parent element
- {Array} components
- Optional: Array of required YAHOO
- Returns:
- {object} The new instance
Field Detail
{object}
modules
Object container for storing module instances.
- Default Value:
- null
{object}
options
Object container for initialization options
{object}
services
Object container for storing service instances.
{object}
widgets
Object container for storing YUI widget instances.
- Default Value:
- null
Method Detail
attachLinkClickListeners()
Add default anchor callbacks for this component based on its id so they are instance specific.
<a href="#" name="{.callback/@event name}" class="{componentId}" rel="{callback parameter/event value}">{label}</a>
Examples #1: Will call the client side component onRenameClick method with the nodeRef as the first parameter and the link as the second:
<a href="#" name".onRenameClick" class="${args.htmlid?js_string}" rel="${nodeRef}">${msg("link.rename")}</a>
Exmaple #2: Will make the client side component fire an event name "metaDataRefresh" with the nodeRef as the value:
<a href="#" name"@metaDataRefresh" class="${args.htmlid?js_string}" rel="${nodeRef}">${msg("link.metaDataRefresh")}</a>
The callback handler specification is:
{callback function name}: function(p_parameter, p_anchor) { ... }
e.g.
onRenameClick: function(pageId, anchor) { ... }
<a href="#" name="{.callback/@event name}" class="{componentId}" rel="{callback parameter/event value}">{label}</a>
Examples #1: Will call the client side component onRenameClick method with the nodeRef as the first parameter and the link as the second:
<a href="#" name".onRenameClick" class="${args.htmlid?js_string}" rel="${nodeRef}">${msg("link.rename")}</a>
Exmaple #2: Will make the client side component fire an event name "metaDataRefresh" with the nodeRef as the value:
<a href="#" name"@metaDataRefresh" class="${args.htmlid?js_string}" rel="${nodeRef}">${msg("link.metaDataRefresh")}</a>
The callback handler specification is:
{callback function name}: function(p_parameter, p_anchor) { ... }
e.g.
onRenameClick: function(pageId, anchor) { ... }
{function}
bind(method)
Asserts a method always is called with this component's scope
- Parameters:
- {function} method
- The function to bind to the scope of this component
- Returns:
- {function} The function bound to a different scope
createYUIButtons()
Will be called after the components onready method adn will search for buttons declared as alfresco-buttons.
Convert these to yui push buttons and make them either fire an event or call a method on the component.
The created yui buttons will be placed inside the components "widgets" attribute with the method as the key.
Examples #1: Will call the client side component onRenameClick method with the nodeRef as the first parameter and the button itself as the second:
<button type="alfresco-button" name=".onRenameClick" value="${nodeRef}">${msg("button.rename")}</button>
Exmaple #2: Will make the client side component fire an event name "metaDataRefresh" with the nodeRef as the value:
<button type="alfresco-button" name="@metaDataRefresh" value="${nodeRef}">${msg("button.metaDataRefresh")}</button>
The callback handler specification is:
callbackFunctionName: function(value, yuiButton) { ... }
e.g.
onRenameClick: function(nodeRef, button) { ... }
The name of the button will also be added as a css class for styling:
.onDownloadDocumentClick button {
background: transparent url(rename-16.png) no-repeat scroll 12px 4px;
padding-left: 32px;
Convert these to yui push buttons and make them either fire an event or call a method on the component.
The created yui buttons will be placed inside the components "widgets" attribute with the method as the key.
Examples #1: Will call the client side component onRenameClick method with the nodeRef as the first parameter and the button itself as the second:
<button type="alfresco-button" name=".onRenameClick" value="${nodeRef}">${msg("button.rename")}</button>
Exmaple #2: Will make the client side component fire an event name "metaDataRefresh" with the nodeRef as the value:
<button type="alfresco-button" name="@metaDataRefresh" value="${nodeRef}">${msg("button.metaDataRefresh")}</button>
The callback handler specification is:
callbackFunctionName: function(value, yuiButton) { ... }
e.g.
onRenameClick: function(nodeRef, button) { ... }
The name of the button will also be added as a css class for styling:
.onDownloadDocumentClick button {
background: transparent url(rename-16.png) no-repeat scroll 12px 4px;
padding-left: 32px;
destroy()
Destroy method - destroy widgets, dereference modules & services
fire(event, value)
Fires an event
- Parameters:
- {String} event
- The event name
- {Object} value
- The event value
invokeAction(action, value, el)
Helper method to invoke a method or fire an event based on the action.
- Parameters:
- {string} action
- If it starts with "." it will be treated as a method,
if starts with "@" it will be treated as an event. - {String} value
- .
- el
- {HTMLElement|YAHOO.util.Button} The element/widget that was clicked/triggered the action.
{string}
msg(messageId)
Gets a custom message
- Parameters:
- {string} messageId
- The messageId to retrieve
- Returns:
- {string} The custom message
onComponentLoaded(response)
Called when this component has been refreshed and the new markup has been loaded.
Will replace the old markup with the new and unregister the old component instance.
Will replace the old markup with the new and unregister the old component instance.
- Parameters:
- response
onComponentsLoaded()
Fired by YUILoaderHelper when required component script files have
been loaded into the browser.
been loaded into the browser.
onReadyWrapper()
Calls the onReady method and adds default event handling to correctly marked-up anchor tags
refresh(webscript)
Call this to refresh/reload the component.
Note that this component's javascript instance will be unregistered and replaced by a new.
Note that this component's javascript instance will be unregistered and replaced by a new.
- Parameters:
- {String} webscript
- The url to this component
{object}
setMessages(obj)
Set messages for this component.
- Parameters:
- {object} obj
- Object literal specifying a set of messages
- Returns:
- {object} returns 'this' for method chaining
{object}
setOptions(obj)
Set multiple initialization options at once.
- Parameters:
- {object} obj
- Object literal specifying a set of options
- Returns:
- {object} returns 'this' for method chaining