2 'rootui5/panel/Controller',
3 'sap/ui/model/json/JSONModel',
5], function (GuiPanelController, JSONModel, MessageToast) {
8 return GuiPanelController.extend("localapp.controller.TestPanel", {
10 // function called from rootui5.panel.Controller
11 onPanelInit : function() {
12 this.setPanelTitle("TestPanel");
15 // function called from rootui5.panel.Controller
16 onPanelExit : function() {
19 onPanelReceive: function(msg, offset) {
20 if (typeof msg != "string") {
21 // binary data transfer not used in this example
22 var arr = new Float32Array(msg, offset);
26 if (msg.indexOf("MODEL:")==0) {
27 var data = JSON.parse(msg.substr(6));
29 this.getView().setModel(new JSONModel(data));
31 MessageToast.show("Receive msg: " + msg.substr(0,30));
35 handleButtonPress: function() {
36 MessageToast.show("Press sample button");
39 // just send model as is to the server back
40 handleSendPress: function() {
41 this.panelSend("MODEL:" + this.getView().getModel().getJSON());
44 handleRefreshPress: function() {
45 this.panelSend("REFRESH");