Project

General

Profile

Download (2.71 KB) Statistics
| Branch: | Revision:

git_sitools_idoc / flarecast / workspace / client-user-3.0 / app / core / Component.js @ master

1
/*******************************************************************************
2
 * Copyright 2010-2014 CNES - CENTRE NATIONAL d'ETUDES SPATIALES
3
 * 
4
 * This file is part of SITools2.
5
 * 
6
 * SITools2 is free software: you can redistribute it and/or modify it under the
7
 * terms of the GNU General Public License as published by the Free Software
8
 * Foundation, either version 3 of the License, or (at your option) any later
9
 * version.
10
 * 
11
 * SITools2 is distributed in the hope that it will be useful, but WITHOUT ANY
12
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13
 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14
 * 
15
 * You should have received a copy of the GNU General Public License along with
16
 * SITools2. If not, see <http://www.gnu.org/licenses/>.
17
 ******************************************************************************/
18

    
19
/*global Ext, sitools, i18n, projectGlobal, alertFailure, showResponse*/
20

    
21
Ext.namespace('sitools.user.core.Component');
22
/**
23
 * Abstract Component class
24
 * @class sitools.user.core.Component
25
 */
26
Ext.define('sitools.user.core.Component', {
27
    extend : 'Ext.util.Observable',
28

    
29
    config : {
30
        componentView : null,
31
        project : null,
32
        controllers : [],
33
        application : null
34
    },
35
    
36
    /**
37
     * Show the following view with the following windowSettings
38
     */
39
    show : function (view, windowSettings) {
40
            
41
            if (Ext.isEmpty(windowSettings.name)) {
42
                    windowSettings.name = "name_" + Ext.id()
43
            }
44
            view.componentClazz = this.$className;
45
            
46
        var navMode = this.getApplication().getController('core.NavigationModeFactory').getNavigationMode(this.getProject().get("navigationMode"));
47
        navMode.openComponent(view, windowSettings);
48
    },
49
    
50
    /**
51
     * Initialize the component
52
     * 
53
     * @param application
54
     *            the application
55
     */
56
    create : function (application, callback, scope) {
57
        this.setApplication(application);
58
        this.setProject(Ext.getStore("ProjectStore").getProject());
59
        // initialize all controllers
60
        if (!Ext.isEmpty(this.getControllers())) {
61
            Ext.each(this.getControllers(), function (controller) {
62
                this.getApplication().getController(controller).onLaunch();
63
            }, this);
64
        }
65
        if (!Ext.isEmpty(callback)) {
66
            Ext.callback(callback, scope);
67
        }
68
    },
69
    
70
    getFormOpenMode : function () {
71
        this.getApplication().getController('core.NavigationMode').getFormOpenMode(this.getProject().get("navigationMode"));
72
    },
73
    
74
    init : Ext.emptyFn,
75
    
76
    /**
77
     * method called when trying to save preference
78
     * @returns
79
     */
80
    _getSettings : Ext.emptyFn
81
});