1sap.ui.define([ 'rootui5/panel/Controller', 'sap/ui/model/json/JSONModel', 'sap/m/MessageToast' ],
2 function(GuiPanelController, JSONModel, MessageToast) {
5 return GuiPanelController.extend("localapp.controller.TestPanel", {
7 // function called from rootui5.panel.Controller
8 onPanelInit : function() { this.setPanelTitle("TestPanel"); },
10 // function called from rootui5.panel.Controller
11 onPanelExit : function() {},
13 onPanelReceive : function(msg, offset) {
14 if (typeof msg != "string") {
15 // binary data transfer not used in this example
16 var arr = new Float32Array(msg, offset);
20 if (msg.indexOf("MODEL:") == 0) {
21 var data = JSON.parse(msg.substr(6));
23 this.getView().setModel(new JSONModel(data));
25 MessageToast.show("Receive msg: " + msg.substr(0, 30));
29 handleButtonPress : function() { MessageToast.show("Press sample button"); },
31 // just send model as is to the server back
32 handleSendPress : function() { this.panelSend("MODEL:" + this.getView().getModel().getJSON()); },
34 handleRefreshPress : function() { this.panelSend("REFRESH"); }