torsten@286: /** torsten@286: * Base Controller torsten@286: * torsten@286: * The controller defines the main logic of the application. It provides torsten@286: * various methods which are bound to listeners and called when the defined torsten@286: * events in the various UI elements occour (e.g User clicks on a button) torsten@286: */ torsten@286: Ext.define('Lada.controller.Base', { torsten@286: extend: 'Ext.app.Controller', torsten@286: /** torsten@286: * Define required views for this controller torsten@286: */ torsten@286: views: [], torsten@286: /** torsten@286: * Define required stores for this controller torsten@286: */ torsten@286: stores: [], torsten@286: /** torsten@286: * Define required models for this controller torsten@286: */ torsten@286: models: [], torsten@286: init: function() { torsten@286: console.log('Initialising the Kommentare controller'); torsten@286: this.addListeners(); torsten@286: }, torsten@286: /** torsten@286: * Function to add listeners for various events in UI items. The UI Items are selected torsten@286: * with a CSS like selector.See ComponentQuery documentation for more torsten@286: * details. The function is called while initializing the controller. torsten@286: * torsten@286: * The function should be overwritten by a specfic implementation. torsten@286: */ torsten@286: addListeners: function() { torsten@286: this.control({}); torsten@286: }, torsten@286: /** torsten@286: * Method to save the kommentar in the database. The method is called when torsten@286: * the user clicks on the "Save" button torsten@286: */ torsten@286: saveItem: function(button) {}, torsten@286: /** torsten@286: * Method to open a window to enter the values for a new kommentar. torsten@286: * The method is called when the user clicks on the "Add" button in the torsten@286: * grid toolbar. torsten@286: */ torsten@286: addItem: function(button) {}, torsten@286: /** torsten@286: * Method to open a window to edit the values for an existing kommentar. torsten@286: * The method is called when the user doubleclicks on the item in the torsten@286: * grid. torsten@286: */ torsten@286: editItem: function(grid, record) {}, torsten@286: /** torsten@286: * Method to delete a kommentar. This will trigger the display of a torsten@286: * Confirmation dialog. After the deletion the related store will be torsten@286: * refreshed. torsten@286: * The method is called when the user selects the item in the grid and torsten@286: * selects the delete button in the grid toolbar. torsten@286: */ torsten@286: deleteItem: function(button) {}, torsten@286: /** torsten@286: * Method to trigger the action after successfull save (create or edit). torsten@286: * In this case the related store is refreshed and the window is closed. torsten@286: */ torsten@286: createSuccess: function(form, record, operation) {}, torsten@286: /** torsten@286: * Method to trigger the action after save (create or edit) fails. torsten@286: * In this case a Message Boss with a general error is shown. torsten@286: */ torsten@286: createFailure: function(form, record, operation) {} torsten@286: });