annotate app/view/widget/base/CheckBox.js @ 1072:78ef9b52510e

Load messprogrammkategorie controller and handle requests correct.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 07 Apr 2016 12:28:17 +0200
parents d6e259e76de6
children
rev   line source
610
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
3 *
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
7 */
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
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
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.widget.base.CheckBox', {
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
13 extend: 'Ext.form.Panel',
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
14 alias: 'widget.chkbox',
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
15
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
16 layout: 'hbox',
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
17
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
18 border: 0,
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
19
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
20 margin: '0, 0, 5, 0',
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
21
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
22 initComponent: function() {
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
23 this.items = [{
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
24 xtype: 'checkbox',
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
25 flex: 1,
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
26 name: this.name,
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
27 fieldLabel: this.fieldLabel,
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
28 labelWidth: this.labelWidth,
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
29 listeners: this.listeners,
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
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
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
32 msgTarget: 'none',
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
33 tpl: this.tpl
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
34 }, {
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
35 xtype: 'image',
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
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
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
40 hidden: true
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
41 }, {
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
42 xtype: 'image',
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
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
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
47 hidden: true
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
48 }];
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
49 this.callParent(arguments);
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
50 },
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
51
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
52 showWarnings: function(warnings) {
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
53 var img = this.down('image[name=warnImg]');
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
54 Ext.create('Ext.tip.ToolTip', {
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
55 target: img.getEl(),
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
56 html: warnings
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
57 });
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
58 this.down('checkbox').invalidCls = 'x-lada-warning';
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
59 this.down('checkbox').markInvalid('');
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
60 img.show();
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
61 var fieldset = this.up('fieldset[collapsible=true]');
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
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
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
66 }
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
67 },
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
68
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
69 showErrors: function(errors) {
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
70 var img = this.down('image[name=errorImg]');
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
71 var warnImg = this.down('image[name=warnImg]');
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
72 warnImg.hide();
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
73 Ext.create('Ext.tip.ToolTip', {
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
74 target: img.getEl(),
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
75 html: errors
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
76 });
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
77 this.down('checkbox').invalidCls = 'x-lada-error';
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
78 this.down('checkbox').markInvalid('');
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
79 img.show();
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
80 var fieldset = this.up('fieldset[collapsible=true]');
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
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
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
85 }
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
86 },
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
87
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
88 clearWarningOrError: function() {
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
89 this.down('image[name=errorImg]').hide();
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
90 this.down('image[name=warnImg]').hide();
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
91 },
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
92
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
93 getValue: function() {
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
94 return this.down('checkbox').getValue();
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
95 },
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
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
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
101 getName: function() {
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
102 return this.name;
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
103 },
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
104
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
105 setReadOnly: function(value) {
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
106 this.down('checkbox').setReadOnly(value);
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
107 }
f240fe19ff5d Added a Checkbox Widget
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
108 });

http://lada.wald.intevation.org