Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sitemap] Accept an optional icon for each value/label mapping #3809

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
* @author Laurent Garnier - Added support for icon color
* @author Mark Herwege - Added pattern and unit fields
* @author Laurent Garnier - Added support for new sitemap element Buttongrid
* @author Laurent Garnier - Added icon field for mappings used for switch element
*/
@Component(service = { RESTResource.class, EventSubscriber.class })
@JaxrsResource
Expand Down Expand Up @@ -558,6 +559,7 @@ private PageDTO createPageBean(String sitemapName, @Nullable String title, @Null
MappingDTO mappingBean = new MappingDTO();
mappingBean.command = mapping.getCmd();
mappingBean.label = mapping.getLabel();
mappingBean.icon = mapping.getIcon();
bean.mappings.add(mappingBean);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Button:
position=INT ':' cmd=Command '=' label=(ID | STRING) ('=' icon=Icon)?;

Mapping:
cmd=Command '=' label=(ID | STRING);
cmd=Command '=' label=(ID | STRING) ('=' icon=Icon)?;

VisibilityRule:
(item=ID) (condition=('==' | '>' | '<' | '>=' | '<=' | '!=')) (sign=('-' | '+'))? (state=XState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
* @author Yannick Schaus - Initial contribution
* @author Laurent Garnier - icon color support for all widgets
* @author Laurent Garnier - Added support for new element Buttongrid
* @author Laurent Garnier - Added icon field for mappings
*/
@NonNullByDefault
@Component(service = SitemapProvider.class)
Expand Down Expand Up @@ -331,11 +332,14 @@ private void addWidgetMappings(EList<Mapping> mappings, UIComponent component) {
if (component.getConfig().get("mappings") instanceof Collection<?>) {
for (Object sourceMapping : (Collection<?>) component.getConfig().get("mappings")) {
if (sourceMapping instanceof String) {
String cmd = sourceMapping.toString().split("=")[0].trim();
String label = sourceMapping.toString().split("=")[1].trim();
String[] splitMapping = sourceMapping.toString().split("=");
String cmd = splitMapping[0].trim();
String label = splitMapping[1].trim();
String icon = splitMapping.length < 3 ? null : splitMapping[2].trim();
MappingImpl mapping = (MappingImpl) SitemapFactory.eINSTANCE.createMapping();
mapping.setCmd(cmd);
mapping.setLabel(label);
mapping.setIcon(icon);
mappings.add(mapping);
}
}
Expand Down