32 unsigned long guiTaskPeriod)
39 const RemoteGui::WidgetPtr& widget,
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;
62 const RemoteGui::WidgetPtr& widget,
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&
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)
182 RemoteGuiComponentPlugin::create(
const std::string& name, RemoteGuiComponentPlugin::TabData& td)
186 if (state != ManagedIceObjectState::eManagedIceObjectStarting &&
187 state != ManagedIceObjectState::eManagedIceObjectStarted)
198 const auto tabname = tabName(name);
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;
ManagedIceObject & parent()
std::string makePropertyName(const std::string &name)
PluginT * addPlugin(const std::string prefix="", ParamsT &&... params)
std::string getName() const
Retrieve name of object.
int getState() const
Retrieve current state of the ManagedIceObject.
RemoteGuiComponentPluginUser()
bool hasRemoteGuiTab(const std::string &name="")
void removeRemoteGuiTab(const std::string &name="")
const armarx::plugins::RemoteGuiComponentPlugin & getRemoteGuiPlugin() const
RemoteGui::TabProxy & getRemoteGuiTab(const std::string &name="")
const RemoteGuiInterfacePrx & getRemoteGui() const
void removeTab(const std::string &name="")
void postOnDisconnectComponent() override
void preOnInitComponent() override
void preOnConnectComponent() override
void postOnConnectComponent() override
void postCreatePropertyDefinitions(PropertyDefinitionsPtr &properties) override
const RemoteGuiInterfacePrx & getRemoteGui() const
std::function< void(RemoteGui::TabProxy &)> TabTask
void createOrUpdateTab(const RemoteGui::WidgetPtr &widget, TabTask guiTaskFnc, unsigned long guiTaskPeriod=10)
bool hasTab(const std::string &name="")
RemoteGui::TabProxy & getTab(const std::string &name="")
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
#define ARMARX_CHECK_IS_NULL(ptr)
This macro evaluates whether ptr is null and if it turns out to be false it will throw an ExpressionE...
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
#define ARMARX_INFO
The normal logging level.
This file is part of ArmarX.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
SimplePeriodicTask(Ts...) -> SimplePeriodicTask< std::function< void(void)> >