3 'sap/ui/core/ResizeHandler'
4 ],
function (Control, ResizeHandler) {
8 return Control.extend(
"NavExample.Drawing", {
13 "file" : { type:
"sap.ui.model.type.String", defaultValue:
"" },
14 "item" : { type:
"sap.ui.model.type.String", defaultValue:
"" },
15 "drawopt" : { type:
"sap.ui.model.type.String", defaultValue:
"" },
16 "jsonfile" : { type:
"sap.ui.model.type.String", defaultValue:
"" }
21 renderer:
function(oRm, oControl) {
23 oRm.writeControlData(oControl);
25 oRm.addStyle(
"width",
"100%");
26 oRm.addStyle(
"height",
"100%");
27 oRm.addStyle(
"overflow",
"hidden");
34 onBeforeRendering:
function() {
36 ResizeHandler.deregister(this.resizeid);
39 if (this.object_painter) {
40 this.object_painter.Cleanup();
41 delete this.object_painter;
45 drawObject:
function(obj, options, call_back) {
47 this.options = options;
48 JSROOT.draw(this.getDomRef(), obj, options,
function(painter) {
49 this.object_painter = painter;
50 this.resizeid = ResizeHandler.register(
this, painter.CheckResize.bind(painter));
54 onAfterRendering:
function() {
55 var fname = this.getFile();
56 var jsonfile = this.getJsonfile();
61 this.drawObject(this.
object, this.options);
62 }
else if (jsonfile) {
63 JSROOT.NewHttpRequest(jsonfile,
'object',
function(obj) {
64 ctrl.drawObject(obj, ctrl.getDrawopt());
67 JSROOT.OpenFile(fname,
function(file) {
68 file.ReadObject(ctrl.getItem(),
function(obj) {
69 ctrl.drawObject(obj, ctrl.getDrawopt());
75 getPainter:
function() {
76 return this.object_painter;