Mercurial > lada > lada-client
annotate app/controller/Base.js @ 286:c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Fri, 09 Aug 2013 14:21:08 +0200 |
parents | |
children | 12e7f0ef90b6 |
rev | line source |
---|---|
286
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
1 /** |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
2 * Base Controller |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
3 * |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
4 * The controller defines the main logic of the application. It provides |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
5 * various methods which are bound to listeners and called when the defined |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
6 * events in the various UI elements occour (e.g User clicks on a button) |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
7 */ |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
8 Ext.define('Lada.controller.Base', { |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
9 extend: 'Ext.app.Controller', |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
10 /** |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
11 * Define required views for this controller |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
12 */ |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
13 views: [], |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
14 /** |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
15 * Define required stores for this controller |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
16 */ |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
17 stores: [], |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
18 /** |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
19 * Define required models for this controller |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 */ |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
21 models: [], |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
22 init: function() { |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
23 console.log('Initialising the Kommentare controller'); |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
24 this.addListeners(); |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
25 }, |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
26 /** |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
27 * Function to add listeners for various events in UI items. The UI Items are selected |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
28 * with a CSS like selector.See ComponentQuery documentation for more |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
29 * details. The function is called while initializing the controller. |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
30 * |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
31 * The function should be overwritten by a specfic implementation. |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
32 */ |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
33 addListeners: function() { |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
34 this.control({}); |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
35 }, |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
36 /** |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
37 * Method to save the kommentar in the database. The method is called when |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
38 * the user clicks on the "Save" button |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
39 */ |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
40 saveItem: function(button) {}, |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
41 /** |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
42 * Method to open a window to enter the values for a new kommentar. |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
43 * The method is called when the user clicks on the "Add" button in the |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
44 * grid toolbar. |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
45 */ |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
46 addItem: function(button) {}, |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
47 /** |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
48 * Method to open a window to edit the values for an existing kommentar. |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
49 * The method is called when the user doubleclicks on the item in the |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
50 * grid. |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
51 */ |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
52 editItem: function(grid, record) {}, |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
53 /** |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
54 * Method to delete a kommentar. This will trigger the display of a |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
55 * Confirmation dialog. After the deletion the related store will be |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
56 * refreshed. |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
57 * The method is called when the user selects the item in the grid and |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
58 * selects the delete button in the grid toolbar. |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
59 */ |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
60 deleteItem: function(button) {}, |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
61 /** |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
62 * Method to trigger the action after successfull save (create or edit). |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
63 * In this case the related store is refreshed and the window is closed. |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
64 */ |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
65 createSuccess: function(form, record, operation) {}, |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
66 /** |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
67 * Method to trigger the action after save (create or edit) fails. |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
68 * In this case a Message Boss with a general error is shown. |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
69 */ |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
70 createFailure: function(form, record, operation) {} |
c509e9f6d4db
Added BaseController and inherit Kommentar controller from it.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
71 }); |