20 ComboBoxItem() =
default;
21 ComboBoxItem(
const std::string &
id,
const std::string &
name) : fId(
id), fName(
name) {}
25struct TestPanelModel {
26 std::string fSampleText;
27 std::vector<ComboBoxItem> fComboItems;
28 std::string fSelectId;
29 std::string fButtonText;
32std::shared_ptr<ROOT::RWebWindow> window;
33std::unique_ptr<TestPanelModel> model;
36void ProcessConnection(
unsigned connid)
38 printf(
"connection established %u\n", connid);
40 window->Send(connid, std::string(
"MODEL:") +
json.Data());
43void ProcessCloseConnection(
unsigned connid)
45 printf(
"connection closed %u\n", connid);
48void ProcessData(
unsigned connid,
const std::string &arg)
50 if (arg ==
"REFRESH") {
52 printf(
"Send model again\n");
53 model->fButtonText =
Form(
"Custom button %d", ++sendcnt);
55 window->Send(connid, std::string(
"MODEL:") +
json.Data());
56 }
else if (arg.find(
"MODEL:") == 0) {
58 auto m = TBufferJSON::FromJSON<TestPanelModel>(arg.substr(6));
60 printf(
"New model, selected: %s\n",
m->fSelectId.c_str());
63 printf(
"Fail to decode model: %s\n", arg.c_str());
71 model = std::make_unique<TestPanelModel>();
72 model->fSampleText =
"This is openui5 widget";
73 model->fComboItems = {{
"item1",
"Text 1"}, {
"item2",
"Text 2"}, {
"item3",
"Text 3"}, {
"item4",
"Text 4"}};
74 model->fSelectId =
"item2";
75 model->fButtonText =
"Custom button";
83 window->SetPanelName(
"localapp.view.TestPanel");
91 window->SetCallBacks(ProcessConnection, ProcessData, ProcessCloseConnection);
93 window->SetGeometry(400, 500);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
static std::shared_ptr< RWebWindow > Create()
Create new RWebWindow Using default RWebWindowsManager.
static TString ToJSON(const T *obj, Int_t compact=0, const char *member_name=nullptr)