+ Button first = null;
+ for (String layerId : defaultLayers) {
+ if (layers.containsKey(layerId)) {
+ RankedObject<SuiteLayer> layerObj = layers.get(layerId);
+
+ // TODO deal with i10n
+ String titleStr = (String) layerObj.getProperties().get(SuiteLayer.Property.title.name());
+ Localized title = null;
+ if (titleStr != null)
+ title = new Localized.Untranslated(titleStr);
+
+ String iconName = (String) layerObj.getProperties().get(SuiteLayer.Property.icon.name());
+ SuiteIcon icon = null;
+ if (iconName != null)
+ icon = SuiteIcon.valueOf(iconName);
+
+ Button b = createButton(parent, layerId, title, icon);
+ if (first == null)
+ first = b;
+ }
+ }
+
+ // TODO factorise
+ boolean isAdmin = cmsView.doAs(() -> CurrentUser.isInRole(NodeConstants.ROLE_USER_ADMIN));
+ if (isAdmin)
+ for (String layerId : adminLayers) {
+ if (layers.containsKey(layerId)) {
+ RankedObject<SuiteLayer> layerObj = layers.get(layerId);
+
+ // TODO deal with i10n
+ String titleStr = (String) layerObj.getProperties().get(SuiteLayer.Property.title.name());
+ Localized title = null;
+ if (titleStr != null)
+ title = new Localized.Untranslated(titleStr);
+
+ String iconName = (String) layerObj.getProperties().get(SuiteLayer.Property.icon.name());
+ SuiteIcon icon = null;
+ if (iconName != null)
+ icon = SuiteIcon.valueOf(iconName);
+
+ Button b = createButton(parent, layerId, title, icon);
+ if (first == null)
+ first = b;
+ }
+ }
+
+// Button dashboardB = createButton(parent, SuiteMsg.dashboard.name(), SuiteMsg.dashboard, SuiteIcon.dashboard);