dustin@1004: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz dustin@1004: * Software engineering by Intevation GmbH dustin@1004: * dustin@1004: * This file is Free Software under the GNU GPL (v>=3) dustin@1004: * and comes with ABSOLUTELY NO WARRANTY! Check out dustin@1004: * the documentation coming with IMIS-Labordaten-Application for details. dustin@1004: */ dustin@1004: dustin@1004: /** dustin@1004: * Grid to list Orte Stammdaten dustin@1004: */ dustin@1004: Ext.define('Lada.view.grid.Orte', { dustin@1004: extend: 'Ext.grid.Panel', dustin@1004: alias: 'widget.ortstammdatengrid', dustin@1004: dustin@1004: // minHeight and deferEmptyText are needed to be able to show the dustin@1004: // emptyText message. dustin@1004: minHeight: 110, dustin@1004: viewConfig: { dustin@1004: deferEmptyText: false dustin@1004: }, dustin@1004: dustin@1004: recordId: null, dustin@1004: dustin@1004: warnings: null, dustin@1004: errors: null, dustin@1004: readOnly: true, dustin@1004: allowDeselect: true, dustin@1004: dustin@1004: initComponent: function() { dustin@1004: var i18n = Lada.getApplication().bundle; dustin@1004: this.emptyText = i18n.getMsg('orte.emptyGrid'); dustin@1004: dustin@1004: this.dockedItems = [{ dustin@1004: xtype: 'toolbar', dustin@1004: dock: 'top', dustin@1004: items: [{ dustin@1004: xtype: 'tbtext', dustin@1004: id: 'tbtitle', dustin@1004: text: i18n.getMsg('orte.gridTitle') dustin@1004: }, dustin@1004: '->', dustin@1004: { dustin@1004: text: i18n.getMsg('orte.button.add'), dustin@1004: icon: 'resources/img/list-add.png', dustin@1004: action: 'add', dustin@1004: disabled: true // disabled on startup, will be enabled by setStore dustin@1004: }, { dustin@1004: text: i18n.getMsg('orte.button.delete'), dustin@1004: icon: 'resources/img/list-remove.png', dustin@1004: action: 'delete', dustin@1004: disabled: true // disabled on startup, will be enabled by controller if necessary dustin@1004: }] dustin@1004: }]; dustin@1004: this.columns = [{ dustin@1004: header: i18n.getMsg('orte.ortId'), dustin@1004: dataIndex: 'ortId' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.nutsCode'), dustin@1004: dataIndex: 'nutsCode' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.anlageId'), dustin@1004: dataIndex: 'anlageId' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.gemId'), dustin@1004: dataIndex: 'gemId', dustin@1004: width: 120, dustin@1004: renderer: function(value) { dustin@1004: var store = Ext.data.StoreManager.get('verwaltungseinheiten'); dustin@1004: var record = store.getById(value); dustin@1004: return record.get('bezeichnung'); dustin@1004: } dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.staatId'), dustin@1004: dataIndex: 'staatId', dustin@1004: width: 70, dustin@1004: renderer: function(value) { dustin@1004: var staaten = Ext.data.StoreManager.get('staaten'); dustin@1004: var record = staaten.getById(value); dustin@1004: return record.get('staatIso'); dustin@1004: } dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.kdaId'), dustin@1004: dataIndex: 'kdaId' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.ozId'), dustin@1004: dataIndex: 'ozId' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.ortTyp'), dustin@1004: dataIndex: 'ortTyp' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.mpArt'), dustin@1004: dataIndex: 'mpArt' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.zone'), dustin@1004: dataIndex: 'zone' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.sektor'), dustin@1004: dataIndex: 'sektor' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.zustaendigkeit'), dustin@1004: dataIndex: 'zustaendigkeit' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.berichtstext'), dustin@1004: dataIndex: 'berichtstext' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.kurztext'), dustin@1004: dataIndex: 'kurztext' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.langtext'), dustin@1004: dataIndex: 'langtext' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.beschreibung'), dustin@1004: dataIndex: 'beschreibung' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.unscharf'), dustin@1004: dataIndex: 'unscharf' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.hoeheLand'), dustin@1004: dataIndex: 'hoeheLand' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.koordXExtern'), dustin@1004: dataIndex: 'koordXExtern' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.koordYExtern'), dustin@1004: dataIndex: 'koordYExtern' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.longitude'), dustin@1004: dataIndex: 'longitude' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.latitude'), dustin@1004: dataIndex: 'latitude' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.letzteAenderung'), dustin@1004: dataIndex: 'letzteAenderung' dustin@1004: }]; dustin@1004: this.listeners = { dustin@1004: select: { dustin@1004: fn: this.activateRemoveButton, dustin@1004: scope: this dustin@1004: }, dustin@1004: deselect: { dustin@1004: fn: this.deactivateRemoveButton, dustin@1004: scope: this dustin@1004: } dustin@1004: }; dustin@1004: this.listeners = { dustin@1004: select: { dustin@1004: fn: this.activateRemoveButton, dustin@1004: scope: this dustin@1004: }, dustin@1004: deselect: { dustin@1004: fn: this.deactivateRemoveButton, dustin@1004: scope: this dustin@1004: } dustin@1004: }; dustin@1004: this.callParent(arguments); dustin@1004: }, dustin@1004: dustin@1004: /** dustin@1004: * This sets the Store of this Grid dustin@1004: */ dustin@1004: setStore: function(store){ dustin@1004: var i18n = Lada.getApplication().bundle; dustin@1004: dustin@1004: if (store) { dustin@1004: this.removeDocked(Ext.getCmp('ptbar'), true); dustin@1004: this.reconfigure(store); dustin@1004: this.down('button[action=add]').enable(); dustin@1004: this.addDocked([{ dustin@1004: xtype: 'pagingtoolbar', dustin@1004: id: 'ptbar', dustin@1004: dock: 'bottom', dustin@1004: store: store, dustin@1004: displayInfo: true dustin@1004: }]); dustin@1004: } dustin@1004: } dustin@1004: });