Class: Component

WebPDF.Toolbar. Component


<abstract> new Component()

Defines components abstract class

Example
WebPDF.Toolbar.getRegistry().registerComponent('name', {
 'constructor': function(options){
     this.superclass.call(this, options);
     this.text = options.text;
 },
 methods: {
      doActive: function() {
          this.$element.css('background', '#d7bae7');
      },
      doDeactive: function() {
          this.$element.css('background', 'transparent');
      },
      mounted: function() {
          var self = this;
          this.$element.click(function(){
              self.trigger('handle');
          });
      },
      render: function(){
          return $('<button>').text(this.text);
      }
 }
});

Extends

  • WebPDF.UI.Component

Methods


<static> parser(config, tool)

Parameters:
Name Type Description
config WebPDF.Toolbar.ComponentConfiguration
tool WebPDF.Toolbar.ParserTools

toolkits for component config parser


destroy()

destroy this component


findChildren(callback)

Parameters:
Name Type Description
callback function

Function is predicate, to test each child of this component recursive. Return true to keep the child, false otherwise.

Returns:
Type
Array.<WebPDF.Toolbar.Component>

findParent(callback)

Parameters:
Name Type Description
callback function

Function is a predicate, to test parent of this component. Returns true means this parent component is in line of a condition, otherwise not. taking two arguments:

  • component: an parent component
  • config: configuration of that parent component
Returns:

returns parent component if found, null otherwise.

Type
WebPDF.Toolbar.Component

getChildByName(name)

find child by name

Parameters:
Name Type Description
name string

child component name

Returns:
Type
WebPDF.Toolbar.Component

getConfig()

Get the configuration of this component.

Returns:
Type
WebPDF.Toolbar.ComponentConfiguration

<protected> render()

This function allowing you to leverage the full programmatic power of JavaScript to create your component element.

Returns:
Type
JQuery