Mercurial > lada > lada-client
annotate app/view/widget/base/CheckBox.js @ 872:91334325149f
no clear button on IE10+
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Mon, 13 Jul 2015 15:08:32 +0200 |
parents | a031b98c7edc |
children | 777bf66dbb11 |
rev | line source |
---|---|
610 | 1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out | |
6 * the documentation coming with IMIS-Labordaten-Application for details. | |
7 */ | |
8 | |
9 Ext.define('Lada.view.widget.base.CheckBox', { | |
10 extend: 'Ext.form.Panel', | |
11 alias: 'widget.chkbox', | |
12 | |
13 layout: 'hbox', | |
14 | |
15 border: 0, | |
16 | |
17 margin: '0, 0, 5, 0', | |
18 | |
19 initComponent: function() { | |
20 this.items = [{ | |
21 xtype: 'checkbox', | |
22 flex: 1, | |
23 name: this.name, | |
24 fieldLabel: this.fieldLabel, | |
25 labelWidth: this.labelWidth, | |
26 listeners: this.listeners, | |
27 triggerAction: this.triggerAction, | |
854
a031b98c7edc
Geplant-Checkbox for Messungen is now ReadOnly
Dustin Demuth <dustin@intevation.de>
parents:
634
diff
changeset
|
28 readOnly: this.readOnly, |
610 | 29 msgTarget: 'none', |
30 tpl: this.tpl | |
31 }, { | |
32 xtype: 'image', | |
33 name: 'warnImg', | |
632
fead63bb5fb4
Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
610
diff
changeset
|
34 src: 'resources/img/dialog-warning.png', |
fead63bb5fb4
Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
610
diff
changeset
|
35 width: 14, |
fead63bb5fb4
Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
610
diff
changeset
|
36 height: 14, |
610 | 37 hidden: true |
38 }, { | |
39 xtype: 'image', | |
40 name: 'errorImg', | |
632
fead63bb5fb4
Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
610
diff
changeset
|
41 src: 'resources/img/emblem-important.png', |
fead63bb5fb4
Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
610
diff
changeset
|
42 width: 14, |
fead63bb5fb4
Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
610
diff
changeset
|
43 height: 14, |
610 | 44 hidden: true |
45 }]; | |
46 this.callParent(arguments); | |
47 }, | |
48 | |
49 showWarnings: function(warnings) { | |
50 var img = this.down('image[name=warnImg]'); | |
51 Ext.create('Ext.tip.ToolTip', { | |
52 target: img.getEl(), | |
53 html: warnings | |
54 }); | |
55 this.down('checkbox').invalidCls = 'x-lada-warning'; | |
56 this.down('checkbox').markInvalid(''); | |
57 img.show(); | |
58 var fieldset = this.up('fieldset[collapsible=true]'); | |
59 if (fieldset) { | |
634
291ac2e2bcf5
Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
632
diff
changeset
|
60 var i18n = Lada.getApplication().bundle; |
291ac2e2bcf5
Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
632
diff
changeset
|
61 var warningText = i18n.getMsg(this.name) + ': ' + warnings; |
291ac2e2bcf5
Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
632
diff
changeset
|
62 fieldset.showWarningOrError(true, warningText); |
610 | 63 } |
64 }, | |
65 | |
66 showErrors: function(errors) { | |
67 var img = this.down('image[name=errorImg]'); | |
68 var warnImg = this.down('image[name=warnImg]'); | |
69 warnImg.hide(); | |
70 Ext.create('Ext.tip.ToolTip', { | |
71 target: img.getEl(), | |
72 html: errors | |
73 }); | |
74 this.down('checkbox').invalidCls = 'x-lada-error'; | |
75 this.down('checkbox').markInvalid(''); | |
76 img.show(); | |
77 var fieldset = this.up('fieldset[collapsible=true]'); | |
78 if (fieldset) { | |
634
291ac2e2bcf5
Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
632
diff
changeset
|
79 var i18n = Lada.getApplication().bundle; |
291ac2e2bcf5
Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
632
diff
changeset
|
80 var errorText = i18n.getMsg(this.name) + ': ' + errors; |
291ac2e2bcf5
Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
632
diff
changeset
|
81 fieldset.showWarningOrError(false, '', true, errorText); |
610 | 82 } |
83 }, | |
84 | |
85 clearWarningOrError: function() { | |
86 this.down('image[name=errorImg]').hide(); | |
87 this.down('image[name=warnImg]').hide(); | |
88 }, | |
89 | |
90 getValue: function() { | |
91 return this.down('checkbox').getValue(); | |
92 }, | |
93 | |
94 getName: function() { | |
95 return this.name; | |
96 }, | |
97 | |
98 setReadOnly: function(value) { | |
99 this.down('checkbox').setReadOnly(value); | |
100 } | |
101 }); |