comparison app/view/form/Ortszuordnung.js @ 1013:75ce503ab296 stammdatengrids

Added a Ortszuordnungwindow and Form
author Dustin Demuth <dustin@intevation.de>
date Tue, 26 Jan 2016 12:29:59 +0100
parents
children 1df6b6210b42
comparison
equal deleted inserted replaced
1012:2adc329d90fe 1013:75ce503ab296
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 /**
10 * Form to edit the Ortszuordnung of a Probe
11 */
12 Ext.define('Lada.view.form.Ortszuordnung', {
13 extend: 'Ext.form.Panel',
14 alias: 'widget.ortszuordnungform',
15
16 model: 'Lada.model.Ortszuordnung',
17 width: '100%',
18 margin: 5,
19 border: 0,
20
21 record: null,
22
23 trackResetOnLoad: true,
24
25 initComponent: function() {
26 var i18n = Lada.getApplication().bundle;
27 this.items = [{
28 xtype: 'fieldset',
29 title: i18n.getMsg('ortszuordnung.form.fset.title'),
30 items: [{
31 border: 0,
32 margin: '0, 0, 10, 0',
33 dockedItems: [{
34 xtype: 'toolbar',
35 dock: 'bottom',
36 border: '0, 1, 1, 1',
37 style: {
38 borderBottom: '1px solid #b5b8c8 !important',
39 borderLeft: '1px solid #b5b8c8 !important',
40 borderRight: '1px solid #b5b8c8 !important'
41 },
42 items: ['->', {
43 text: i18n.getMsg('save'),
44 qtip: i18n.getMsg('save.qtip'),
45 icon: 'resources/img/dialog-ok-apply.png',
46 action: 'save',
47 disabled: true
48 }, {
49 text: i18n.getMsg('discard'),
50 qtip: i18n.getMsg('discard.qtip'),
51 icon: 'resources/img/dialog-cancel.png',
52 action: 'discard',
53 disabled: true
54 }]
55 }],
56 items: [{
57 xtype: 'container',
58 layout: {
59 type: 'hbox'
60 },
61 flex: 1,
62 items: [{
63 xtype: 'tfield',
64 maxLength: 100,
65 name: 'ortszusatztext',
66 fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszusatztext'),
67 width: 280,
68 labelWidth: 80
69 }, {
70 xtype: 'tfield',
71 maxLength: 100,
72 name: 'ortszuordnungTyp',
73 fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszuordnungtyp'),
74 width: 280,
75 labelWidth: 80
76 }]
77 }]
78 }]
79 }];
80 this.callParent(arguments);
81 },
82
83 setRecord: function(record) {
84 this.getForm().loadRecord(record);
85 },
86
87 setMessages: function(errors, warnings) {
88 var key;
89 var element;
90 var content;
91 var i18n = Lada.getApplication().bundle;
92 if (warnings) {
93 for (key in warnings) {
94 element = this.down('component[name=' + key + ']');
95 if (!element) {
96 continue;
97 }
98 content = warnings[key];
99 var warnText = '';
100 for (var i = 0; i < content.length; i++) {
101 warnText += i18n.getMsg(content[i].toString()) + '\n';
102 }
103 element.showWarnings(warnText);
104 }
105 }
106 if (errors) {
107 for (key in errors) {
108 element = this.down('component[name=' + key + ']');
109 if (!element) {
110 continue;
111 }
112 content = errors[key];
113 var errorText = '';
114 for (var i = 0; i < content.length; i++) {
115 errorText += i18n.getMsg(content[i].toString()) + '\n';
116 }
117 element.showErrors(errorText);
118 }
119 }
120 },
121
122 clearMessages: function() {
123 this.down('tfield[name=ortszusatztext]').clearWarningOrError();
124 this.down('tfield[name=ortszuordnungTyp]').clearWarningOrError();
125 },
126
127 setReadOnly: function(value) {
128 this.down('tfield[name=ortszusatztext]').setReadOnly(value);
129 this.down('tfield[name=ortszuordnungTyp]').setReadOnly(value);
130 }
131 });
132

http://lada.wald.intevation.org