CallBackery
view release on metacpan or search on metacpan
lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/Card.js view on Meta::CPAN
/* ************************************************************************
Copyright: 2021 OETIKER+PARTNER AG
License: GPLv3 or later
Authors: Fritz Zaucker <fritz.zaucker@oetiker.ch>
Utf8Check: äöü
************************************************************************ */
/**
* Hin Cred List
*/
qx.Class.define("callbackery.ui.Card", {
extend: qx.ui.core.Widget,
/**
* create a page for the View Tab with the given title
*
* @param vizWidget {Widget} visualization widget to embedd
*/
construct: function(cfg, buttonMap, parentForm) {
this.base(arguments);
this._cardCfg = cfg.cardCfg;
this._updateAction = cfg.updateAction;
this.__pluginName = cfg.name;
this.__buttonMap = buttonMap;
this.__parentForm = parentForm;
this._formCfg = {};
this.__dataCache = {};
this.__actions = [];
cfg.action.forEach(action => {
if (action.addToContextMenu) {
this.__actions.push(action);
}
}, this);
this.__buildForm();
},
properties: {
appearance: {
refine: true,
init: "cred-card"
}
},
members: {
_cardCfg : null,
_formCfg : null,
_updateAction : null,
__actions : null,
__dataCache : null,
__fields : null,
__pluginName : null,
__buttonMap : null,
__parentForm : null,
setData: function(data) {
var cardCfg = this._cardCfg;
var fld = this.__fields;
var last = this.__dataCache;
last.id = data.id;
for (var k in fld) {
if (data[k] !== last[k]) {
if (fld[k].setModelSelection) { // SelectBox
fld[k].setModelSelection([data[k]]);
}
else { // e.g. TextField
if (data[k] == null) {
fld[k].setValue('');
}
else {
fld[k].setValue(this.xtr(data[k]).toString() || '');
}
}
last[k] = data[k];
}
}
},
__createButton: function(label, icon) {
var btn = new qx.ui.form.Button(label, icon).set({
alignY: 'bottom',
height: 32,
width: 30,
allowGrowY: false,
allowGrowX: false,
padding: [8, 8, 8, 8]
});
return btn;
},
__buildForm: function() {
var fld = this.__fields = {};
( run in 0.744 second using v1.01-cache-2.11-cpan-39bf76dae61 )