/** * Represents a component that is capable of handling intents which are dispatched by {@link MF.intent.IntentManager}. * Normally you wouldn't use methods of this class directly but instead use {@link MF.intent.IntentManager#dispatch} or * {@link MF.intent.IntentManager#queryHandlers}. * * @author Sergei Lissovski <sergei.lissovski@modera.org> */ Ext.define('MF.intent.AbstractIntentHandler', { requires: [ 'MF.Util' ], /** * Returned by this method `ID` will be used to remember a default handler that user can use for a certain action. * * @return string */ getId: function() { MF.Util.throwMethodNotImplementedException(this, 'getId()'); }, /** * Name returned by this handler will be used if an intent handler selection window is shown ( this will happen * if any intent has more than one handler that is capable of handling it and user will need to decide which * one he/she prefers to use ). * * @abstract * @return {String} */ getName: function() { MF.Util.throwMethodNotImplementedException(this, 'getName()'); }, /** * Method is used by {@link MF.intent.IntentManager intent manager} to decide if this handler is capable of handling provided * intent. * * @abstract * @param {MF.intent.DispatchedIntent} intent Use assert methods of dispatched intent to validate if you handler is * is capable of handling given intent type. Even if your handler is not * going to handle intents of this type still invoke * {@link MF.intent.DispatchedIntent#done} method. */ canHandle: function(intent) { MF.Util.throwMethodNotImplementedException(this, 'canHandle(intent)'); }, /** * Method is responsible for handling dispatched intent. * * @abstract * @param {Object} intent An intent object. For details about the structure of the object please see {@link MF.intent.IntentManager} * @param {Function} cb Optional. Callback will be invoked when intent has been dispatched. */ handle: function(intent, cb) { MF.Util.throwMethodNotImplementedException(this, 'handle(intent)'); } });