Mercurial > lada > lada-client
annotate app/view/widget/base/CheckBox.js @ 1420:48c9c7b0ceef 2.6.1
make map panel collapsable in Stammdaten form
author | Michael Stanko <mstanko@bfs.de> |
---|---|
date | Wed, 05 Apr 2017 16:02:45 +0200 |
parents | d6e259e76de6 |
children |
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 | |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
97 setValue: function(value) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
98 this.down('checkbox').setValue(value); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
99 }, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
892
diff
changeset
|
100 |
610 | 101 getName: function() { |
102 return this.name; | |
103 }, | |
104 | |
105 setReadOnly: function(value) { | |
106 this.down('checkbox').setReadOnly(value); | |
107 } | |
108 }); |