32 unsigned long guiTaskPeriod)
41 unsigned long guiTaskPeriod)
43 std::lock_guard g{_tabsMutex};
46 ARMARX_INFO <<
"Replacing the tab " << tabName(name);
48 auto&
data = _tabs[name];
54 data.fnc = std::move(guiTaskFnc);
55 data.taskPeriod = guiTaskPeriod;
63 unsigned long guiTaskPeriod)
65 std::lock_guard g{_tabsMutex};
68 throw armarx::LocalException(
69 "Can only update Tab with a name for an already existing Tab");
71 auto&
data = _tabs[name];
77 data.taskPeriod = guiTaskPeriod;
86 std::lock_guard g{_tabsMutex};
87 return _tabs.at(name).tab;
93 std::lock_guard g{_tabsMutex};
94 return _tabs.count(name);
100 std::lock_guard g{_tabsMutex};
101 if (_tabs.count(name))
103 auto&
data = _tabs.at(name);
109 const RemoteGuiInterfacePrx&
120 parent<Component>().usingProxyFromProperty(
makePropertyName(_propertyName));
129 parent<Component>().getProxyFromProperty(_remoteGui,
makePropertyName(_propertyName));
136 std::lock_guard g{_tabsMutex};
137 for (
auto& [name,
data] : _tabs)
151 std::lock_guard g{_tabsMutex};
152 for (
auto& [name,
data] : _tabs)
161 _remoteGui =
nullptr;
169 properties->defineOptionalProperty<std::string>(
makePropertyName(_propertyName),
171 "Name of the remote gui provider");
176 RemoteGuiComponentPlugin::tabName(
const std::string& name)
178 return parent<ManagedIceObject>().getName() + (name.empty() ?
"" :
"_" + name);
182 RemoteGuiComponentPlugin::create(
const std::string& name, RemoteGuiComponentPlugin::TabData& td)
185 const auto state = parent<ManagedIceObject>().getState();
186 if (state != ManagedIceObjectState::eManagedIceObjectStarting &&
187 state != ManagedIceObjectState::eManagedIceObjectStarted)
198 const auto tabname = tabName(name);
199 td.task =
new SimplePeriodicTask<>([&td] { td.fnc(td.tab); }, td.taskPeriod);
200 _remoteGui->createTab(tabname, td.widget);
201 td.tab = RemoteGui::TabProxy(_remoteGui, tabname);
206 RemoteGuiComponentPlugin::remove(
const std::string& name, RemoteGuiComponentPlugin::TabData& td)
215 const auto tabname = tabName(name);
217 _remoteGui->removeTab(tabname);
250 const RemoteGuiInterfacePrx&
259 return *_remoteGuiComponentPlugin;
265 return *_remoteGuiComponentPlugin;