123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
"use strict";
modulum('StretchableScrollGridLineWidget', ['GridWidget', 'WidgetFactory'],
function(context, cls) {
cls.StretchableScrollGridLineWidget = context.oo.Class(cls.GridWidget, function($super) {
return {
__name: "StretchableScrollGridLineWidget",
_current: false,
_rowBoundDecoratorWidget: null,
destroy: function() {
if (this._rowBoundDecoratorWidget) {
this._rowBoundDecoratorWidget.destroy();
this._rowBoundDecoratorWidget = null;
}
$super.destroy.call(this);
},
manageMouseClick: function(domEvent) {
if (domEvent && !domEvent.gbcFocusRequested) {
this.emit(context.constants.widgetEvents.click, domEvent);
}
return true;
},
manageMouseDblClick: function(domEvent) {
this.emit(context.constants.widgetEvents.doubleClick, domEvent);
return true;
},
requestFocus: function(domEvent) {
this.emit(context.constants.widgetEvents.click, domEvent);
},
setCurrent: function(current) {
if (this._current !== current) {
this._current = current;
if (current) {
this._element.addClass("currentRow");
this._children.forEach(function(w) {
w.addClass("currentRow");
});
} else {
this._element.removeClass("currentRow");
this._children.forEach(function(w) {
w.removeClass("currentRow");
});
}
}
var parent = this.getParentWidget();
if (parent) {
this._element.toggleClass("highlight", parent.isHighlightCurrentRow());
this._element.toggleClass("nohighlight", !parent.isHighlightCurrentRow());
}
},
addChildWidget: function(widget, options) {
$super.addChildWidget.call(this, widget, options);
widget.removeClass("gbc_WidgetBase_standalone");
widget.addClass("gbc_WidgetBase_in_array");
},
addRowBoundDecorator: function() {
this._rowBoundDecoratorWidget = cls.WidgetFactory.createWidget("RowBoundDecorator", this.getBuildParameters());
this._rowBoundDecoratorWidget.setParentWidget(this);
this._rowBoundDecoratorWidget.setContextMenuWidget(this.getParentWidget().getRowBoundWidget());
this._rowBoundDecoratorWidget.updateQuickActions();
this._element.appendChild(this._rowBoundDecoratorWidget.getElement());
},
getRowBoundDecoratorWidget: function() {
return this._rowBoundDecoratorWidget;
}
};
});
cls.WidgetFactory.registerBuilder('StretchableScrollGridLine', cls.StretchableScrollGridLineWidget);
});