~cdparra/gelee/trunk

« back to all changes in this revision

Viewing changes to webui/ecosystem/workspace/extjs/docs/source/TimeField.html

  • Committer: parra
  • Date: 2010-03-15 15:56:56 UTC
  • Revision ID: svn-v4:ac5bba68-f036-4e09-846e-8f32731cc928:trunk/gelee:1448
merged gelee at svn

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<head>
 
3
  <title>The source code</title>
 
4
    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
 
5
    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
 
6
</head>
 
7
<body  onload="prettyPrint();">
 
8
    <pre class="prettyprint lang-js"><div id="cls-Ext.form.TimeField"></div>/**
 
9
 * @class Ext.form.TimeField
 
10
 * @extends Ext.form.ComboBox
 
11
 * Provides a time input field with a time dropdown and automatic time validation.  Example usage:
 
12
 * <pre><code>
 
13
new Ext.form.TimeField({
 
14
    minValue: '9:00 AM',
 
15
    maxValue: '6:00 PM',
 
16
    increment: 30
 
17
});
 
18
</code></pre>
 
19
 * @constructor
 
20
 * Create a new TimeField
 
21
 * @param {Object} config
 
22
 * @xtype timefield
 
23
 */
 
24
Ext.form.TimeField = Ext.extend(Ext.form.ComboBox, {
 
25
    <div id="cfg-Ext.form.TimeField-minValue"></div>/**
 
26
     * @cfg {Date/String} minValue
 
27
     * The minimum allowed time. Can be either a Javascript date object with a valid time value or a string 
 
28
     * time in a valid format -- see {@link #format} and {@link #altFormats} (defaults to null).
 
29
     */
 
30
    minValue : null,
 
31
    <div id="cfg-Ext.form.TimeField-maxValue"></div>/**
 
32
     * @cfg {Date/String} maxValue
 
33
     * The maximum allowed time. Can be either a Javascript date object with a valid time value or a string 
 
34
     * time in a valid format -- see {@link #format} and {@link #altFormats} (defaults to null).
 
35
     */
 
36
    maxValue : null,
 
37
    <div id="cfg-Ext.form.TimeField-minText"></div>/**
 
38
     * @cfg {String} minText
 
39
     * The error text to display when the date in the cell is before minValue (defaults to
 
40
     * 'The time in this field must be equal to or after {0}').
 
41
     */
 
42
    minText : "The time in this field must be equal to or after {0}",
 
43
    <div id="cfg-Ext.form.TimeField-maxText"></div>/**
 
44
     * @cfg {String} maxText
 
45
     * The error text to display when the time is after maxValue (defaults to
 
46
     * 'The time in this field must be equal to or before {0}').
 
47
     */
 
48
    maxText : "The time in this field must be equal to or before {0}",
 
49
    <div id="cfg-Ext.form.TimeField-invalidText"></div>/**
 
50
     * @cfg {String} invalidText
 
51
     * The error text to display when the time in the field is invalid (defaults to
 
52
     * '{value} is not a valid time').
 
53
     */
 
54
    invalidText : "{0} is not a valid time",
 
55
    <div id="cfg-Ext.form.TimeField-format"></div>/**
 
56
     * @cfg {String} format
 
57
     * The default time format string which can be overriden for localization support.  The format must be
 
58
     * valid according to {@link Date#parseDate} (defaults to 'g:i A', e.g., '3:15 PM').  For 24-hour time
 
59
     * format try 'H:i' instead.
 
60
     */
 
61
    format : "g:i A",
 
62
    <div id="cfg-Ext.form.TimeField-altFormats"></div>/**
 
63
     * @cfg {String} altFormats
 
64
     * Multiple date formats separated by "|" to try when parsing a user input value and it doesn't match the defined
 
65
     * format (defaults to 'g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H').
 
66
     */
 
67
    altFormats : "g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H",
 
68
    <div id="cfg-Ext.form.TimeField-increment"></div>/**
 
69
     * @cfg {Number} increment
 
70
     * The number of minutes between each time value in the list (defaults to 15).
 
71
     */
 
72
    increment: 15,
 
73
 
 
74
    // private override
 
75
    mode: 'local',
 
76
    // private override
 
77
    triggerAction: 'all',
 
78
    // private override
 
79
    typeAhead: false,
 
80
    
 
81
    // private - This is the date to use when generating time values in the absence of either minValue
 
82
    // or maxValue.  Using the current date causes DST issues on DST boundary dates, so this is an 
 
83
    // arbitrary "safe" date that can be any date aside from DST boundary dates.
 
84
    initDate: '1/1/2008',
 
85
 
 
86
    // private
 
87
    initComponent : function(){
 
88
        if(typeof this.minValue == "string"){
 
89
            this.minValue = this.parseDate(this.minValue);
 
90
        }
 
91
        if(typeof this.maxValue == "string"){
 
92
            this.maxValue = this.parseDate(this.maxValue);
 
93
        }
 
94
 
 
95
        if(!this.store){
 
96
            var min = this.parseDate(this.minValue) || new Date(this.initDate).clearTime();
 
97
            var max = this.parseDate(this.maxValue) || new Date(this.initDate).clearTime().add('mi', (24 * 60) - 1);
 
98
            var times = [];
 
99
            while(min <= max){
 
100
                times.push(min.dateFormat(this.format));
 
101
                min = min.add('mi', this.increment);
 
102
            }
 
103
            this.store = times;
 
104
        }
 
105
        Ext.form.TimeField.superclass.initComponent.call(this);
 
106
    },
 
107
 
 
108
    // inherited docs
 
109
    getValue : function(){
 
110
        var v = Ext.form.TimeField.superclass.getValue.call(this);
 
111
        return this.formatDate(this.parseDate(v)) || '';
 
112
    },
 
113
 
 
114
    // inherited docs
 
115
    setValue : function(value){
 
116
        return Ext.form.TimeField.superclass.setValue.call(this, this.formatDate(this.parseDate(value)));
 
117
    },
 
118
 
 
119
    // private overrides
 
120
    validateValue : Ext.form.DateField.prototype.validateValue,
 
121
    parseDate : Ext.form.DateField.prototype.parseDate,
 
122
    formatDate : Ext.form.DateField.prototype.formatDate,
 
123
 
 
124
    // private
 
125
    beforeBlur : function(){
 
126
        var v = this.parseDate(this.getRawValue());
 
127
        if(v){
 
128
            this.setValue(v.dateFormat(this.format));
 
129
        }
 
130
        Ext.form.TimeField.superclass.beforeBlur.call(this);
 
131
    }
 
132
 
 
133
    <div id="cfg-Ext.form.TimeField-grow"></div>/**
 
134
     * @cfg {Boolean} grow @hide
 
135
     */
 
136
    <div id="cfg-Ext.form.TimeField-growMin"></div>/**
 
137
     * @cfg {Number} growMin @hide
 
138
     */
 
139
    <div id="cfg-Ext.form.TimeField-growMax"></div>/**
 
140
     * @cfg {Number} growMax @hide
 
141
     */
 
142
    <div id="method-Ext.form.TimeField-autoSize"></div>/**
 
143
     * @hide
 
144
     * @method autoSize
 
145
     */
 
146
});
 
147
Ext.reg('timefield', Ext.form.TimeField);</pre>    
 
148
</body>
 
149
</html>
 
 
b'\\ No newline at end of file'