Class: Controller

WebPDF.Toolbar. Controller


<abstract> new Controller()

Defines controller abstract class.

Example
WebPDF.Toolbar.getRegistry().registerController('custom', {
 methods:{
     initialize: function(){
         var self = this;
         this.uber.initialize.apply(this, arguments);
         this.watch(function(){
                        return WebPDF.ViewerInstance.isDocModified();
         }, function(isModified){
             if(isModified) {
                 self.enableComponents();
             } else {
                 self.disableComponents();
             }
             self.updateComponentsPermission();
         });
     },
     handle: function(component, config, data){
         console.info('handle', data);
     }
}
})

Methods


disableComponents()

Disable all components attached to this controller;


enableComponents()

Enable all components attached to this controller;


handle(component, config, data)

toolbar component event handler.

Parameters:
Name Type Description
component WebPDF.Toolbar.Component

event

config WebPDF.Toolbar.Configuration
data object

initialize()

Called after components have been mounted. You should listen to application status change events and update component's status here.


watch(watchFor, listener)

Parameters:
Name Type Description
watchFor function

Function that is evaluated on each cycle. A change in the return value triggers a call to the listener

listener function

Callback caled whenever the value of key watchFor changes.