Project

General

Profile

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

git_sitools_idoc / flarecast / workspace / client-public-3.0 / js / widget / sitoolsFilter / Filter.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
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * SITools2 is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with SITools2.  If not, see <http://www.gnu.org/licenses/>.
18
 ******************************************************************************/
19
/*global Ext, i18n, loadUrl, getDesktop, sitools, SitoolsDesk */
20
Ext.namespace("sitools.public.widget.sitoolsFilter");
21

    
22
Ext.define('sitools.public.widget.sitoolsFilter.Filter', {
23
    extend : 'Ext.Container',
24
    /**
25
     * @cfg {String} columnAlias 
26
     * The {@link Ext.data.Store} columnAlias of the field this filter represents.
27
     */
28
    columnAlias : null,
29
    
30
        layout : {
31
            type : "vbox",
32
            align : "left", 
33
            pack : "center"
34
        },
35
        specificType : "filter",
36
        
37
    constructor : function (config) {
38
        Ext.apply(this, config);
39
                this.columnAlias = config.columnAlias;
40
                this.specificType = "filter";
41
        this.callParent([config]);
42

    
43
        this.init(config);
44
        if(config && config.value){
45
            this.setValue(config.value);
46
            delete config.value;
47
        }
48
    },
49

    
50
    /**
51
     * Template method to be implemented by all subclasses that is to
52
     * initialize the filter and install required menu items.
53
     * Defaults to Ext.emptyFn.
54
     */
55
    init : Ext.emptyFn,
56
    
57
    /**
58
     * Template method to be implemented by all subclasses that is to
59
     * get and return the value of the filter.
60
     * Defaults to Ext.emptyFn.
61
     * @return {Object} The 'serialized' form of this filter
62
     * @methodOf Ext.ux.grid.filter.Filter
63
     */
64
    getValue : Ext.emptyFn,
65
    
66
    /**
67
     * Template method to be implemented by all subclasses that is to
68
     * set the value of the filter and fire the 'update' event.
69
     * Defaults to Ext.emptyFn.
70
     * @param {Object} data The value to set the filter
71
     * @methodOf Ext.ux.grid.filter.Filter
72
     */        
73
    setValue : Ext.emptyFn,
74
    
75
    /**
76
     * Template method to be implemented by all subclasses that is to
77
     * validates the provided Ext.data.Record against the filters configuration.
78
     * Defaults to <tt>return true</tt>.
79
     * @param {Ext.data.Record} record The record to validate
80
     * @return {Boolean} true if the record is valid within the bounds
81
     * of the filter, false otherwise.
82
     */
83
    validateRecord : function(){
84
        return true;
85
    }, 
86
    
87
    _getHeight : Ext.emptyFn,
88
    
89
    getFilterData : function (){
90
        return this.getValue();
91
    }
92

    
93

    
94
});
95