diff --git a/source/RobotAPI/libraries/aron_component_config/RemoteGuiVisitors.cpp b/source/RobotAPI/libraries/aron_component_config/RemoteGuiVisitors.cpp index 89499311e289b0d50bdba2f29637e5b7dc2087d6..fc06569dc1866e8a0dd2a7f82c26cca716b4fef7 100644 --- a/source/RobotAPI/libraries/aron_component_config/RemoteGuiVisitors.cpp +++ b/source/RobotAPI/libraries/aron_component_config/RemoteGuiVisitors.cpp @@ -167,39 +167,62 @@ namespace armarx::aron::component_config MakeConfigGuiVisitor::visitListOnEnter(DataInput& o, TypeInput& t) { in_list_ = true; - auto group = RemoteGui::makeSimpleGridLayout(pathToName(o) + "_grid").cols(20); - auto data = data::List::DynamicCastAndCheck(o); auto type = type::List::DynamicCast(t)->getAcceptedType()->getDescriptor(); - if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) == + + if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) != implementedListDescriptors.end()) { - return; + auto group = RemoteGui::makeSimpleGridLayout(pathToName(o) + "_grid").cols(20); + auto data = data::List::DynamicCastAndCheck(o); + + for (const auto& el : data->getElements()) + { + group.addChild(RemoteGui::makeLineEdit(pathToName(el)) + .value(factories::VariantHelper::make(type)->to_string(el)), + 10); + group.addHSpacer(8); + group.addChild(RemoteGui::makeButton(pathToName(el) + "_button") + .label("-") + .toolTip("Remove List Element"), + 2); + } + group_hierarchy_.back()->addChild( + RemoteGui::makeGroupBox(pathToName(o) + "_grp") + .label(o->getPath().getLastElement()) + .collapsed(true) + .addChild(group) + .addChild(RemoteGui::makeButton(pathToName(o) + "_add") + .label("+") + .toolTip("Add new list entry."))); } - for (const auto& el : data->getElements()) + else { - group.addChild(RemoteGui::makeLineEdit(pathToName(el)) - .value(factories::VariantHelper::make(type)->to_string(el)), - 10); - group.addHSpacer(8); - group.addChild(RemoteGui::makeButton(pathToName(el) + "_button") - .label("-") - .toolTip("Remove List Element"), - 2); + std::string name = pathToName(o); + group_hierarchy_.emplace_back(std::make_shared<RemoteGui::detail::GroupBoxBuilder>( + RemoteGui::makeGroupBox(name))); } - group_hierarchy_.back()->addChild( - RemoteGui::makeGroupBox(pathToName(o) + "_grp") - .label(o->getPath().getLastElement()) - .collapsed(true) - .addChild(group) - .addChild(RemoteGui::makeButton(pathToName(o) + "_add") - .label("+") - .toolTip("Add new list entry."))); } void - MakeConfigGuiVisitor::visitListOnExit(DataInput& /*unused*/, TypeInput& /*unused*/) + MakeConfigGuiVisitor::visitListOnExit(DataInput& /*unused*/, TypeInput& t) { in_list_ = false; + + auto type = type::List::DynamicCast(t)->getAcceptedType()->getDescriptor(); + + if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) != + implementedListDescriptors.end()) + { + } + else + { + auto builder = *group_hierarchy_.back(); + group_hierarchy_.pop_back(); + if (not group_hierarchy_.empty()) + { + group_hierarchy_.back()->addChild(builder); + } + } } void @@ -232,7 +255,7 @@ namespace armarx::aron::component_config group.addChild(RemoteGui::makeLabel(name + "_label").value(q->getPath().getLastElement())); group.addHSpacer(); - if (cols == 4 && rows == 4) + if (cols == 4 and rows == 4) { // Poses const auto& matrix = aron::data::converter::AronEigenConverter::ConvertToMatrix4f(data);