Mercurial > lada > lada-client
annotate app/view/widget/base/CheckBox.js @ 1012:2adc329d90fe stammdatengrids
Replaced Locations with Ortszuordnung
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Tue, 26 Jan 2016 10:40:48 +0100 |
parents | 777bf66dbb11 |
children | d6e259e76de6 |
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 | |
892
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
854
diff
changeset
|
9 /** |
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
854
diff
changeset
|
10 * This Widget extends a Panel to create a custom Checkbox |
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
854
diff
changeset
|
11 */ |
610 | 12 Ext.define('Lada.view.widget.base.CheckBox', { |
13 extend: 'Ext.form.Panel', | |
14 alias: 'widget.chkbox', | |
15 | |
16 layout: 'hbox', | |
17 | |
18 border: 0, | |
19 | |
20 margin: '0, 0, 5, 0', | |
21 | |
22 initComponent: function() { | |
23 this.items = [{ | |
24 xtype: 'checkbox', | |
25 flex: 1, | |
26 name: this.name, | |
27 fieldLabel: this.fieldLabel, | |
28 labelWidth: this.labelWidth, | |
29 listeners: this.listeners, | |
30 triggerAction: this.triggerAction, | |
854
a031b98c7edc
Geplant-Checkbox for Messungen is now ReadOnly
Dustin Demuth <dustin@intevation.de>
parents:
634
diff
changeset
|
31 readOnly: this.readOnly, |
610 | 32 msgTarget: 'none', |
33 tpl: this.tpl | |
34 }, { | |
35 xtype: 'image', | |
36 name: 'warnImg', | |
632
fead63bb5fb4
Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
610
diff
changeset
|
37 src: 'resources/img/dialog-warning.png', |
fead63bb5fb4
Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
610
diff
changeset
|
38 width: 14, |
fead63bb5fb4
Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
610
diff
changeset
|
39 height: 14, |
610 | 40 hidden: true |
41 }, { | |
42 xtype: 'image', | |
43 name: 'errorImg', | |
632
fead63bb5fb4
Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
610
diff
changeset
|
44 src: 'resources/img/emblem-important.png', |
fead63bb5fb4
Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
610
diff
changeset
|
45 width: 14, |
fead63bb5fb4
Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
610
diff
changeset
|
46 height: 14, |
610 | 47 hidden: true |
48 }]; | |
49 this.callParent(arguments); | |
50 }, | |
51 | |
52 showWarnings: function(warnings) { | |
53 var img = this.down('image[name=warnImg]'); | |
54 Ext.create('Ext.tip.ToolTip', { | |
55 target: img.getEl(), | |
56 html: warnings | |
57 }); | |
58 this.down('checkbox').invalidCls = 'x-lada-warning'; | |
59 this.down('checkbox').markInvalid(''); | |
60 img.show(); | |
61 var fieldset = this.up('fieldset[collapsible=true]'); | |
62 if (fieldset) { | |
634
291ac2e2bcf5
Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
632
diff
changeset
|
63 var i18n = Lada.getApplication().bundle; |
291ac2e2bcf5
Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
632
diff
changeset
|
64 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
|
65 fieldset.showWarningOrError(true, warningText); |
610 | 66 } |
67 }, | |
68 | |
69 showErrors: function(errors) { | |
70 var img = this.down('image[name=errorImg]'); | |
71 var warnImg = this.down('image[name=warnImg]'); | |
72 warnImg.hide(); | |
73 Ext.create('Ext.tip.ToolTip', { | |
74 target: img.getEl(), | |
75 html: errors | |
76 }); | |
77 this.down('checkbox').invalidCls = 'x-lada-error'; | |
78 this.down('checkbox').markInvalid(''); | |
79 img.show(); | |
80 var fieldset = this.up('fieldset[collapsible=true]'); | |
81 if (fieldset) { | |
634
291ac2e2bcf5
Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
632
diff
changeset
|
82 var i18n = Lada.getApplication().bundle; |
291ac2e2bcf5
Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
632
diff
changeset
|
83 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
|
84 fieldset.showWarningOrError(false, '', true, errorText); |
610 | 85 } |
86 }, | |
87 | |
88 clearWarningOrError: function() { | |
89 this.down('image[name=errorImg]').hide(); | |
90 this.down('image[name=warnImg]').hide(); | |
91 }, | |
92 | |
93 getValue: function() { | |
94 return this.down('checkbox').getValue(); | |
95 }, | |
96 | |
97 getName: function() { | |
98 return this.name; | |
99 }, | |
100 | |
101 setReadOnly: function(value) { | |
102 this.down('checkbox').setReadOnly(value); | |
103 } | |
104 }); |