Skip to content

Commit

Permalink
support all used for mappings attribute icons
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Aug 14, 2023
1 parent 1e0ee6b commit 6e095ad
Showing 1 changed file with 38 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
package com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.attributeMapping;

import com.evolveum.midpoint.gui.api.component.wizard.TileEnum;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper;
import com.evolveum.midpoint.gui.api.util.MappingDirection;
import com.evolveum.midpoint.gui.impl.component.data.column.AbstractItemWrapperColumn;
Expand All @@ -25,6 +26,7 @@
import org.apache.wicket.model.Model;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

Expand All @@ -38,6 +40,29 @@ public InboundAttributeMappingsTable(
super(id, valueModel, config);
}

enum UsedFor {
CORRELATION(InboundMappingUseType.CORRELATION,
"text-warning fa fa-code-branch",
"InboundAttributeMappingsTable.usedForCorrelation"),
SYNCHRONIZATION(InboundMappingUseType.SYNCHRONIZATION,
"text-warning fa fa-rotate",
"InboundAttributeMappingsTable.usedForSynchronization"),
ALL(InboundMappingUseType.ALL,
"text-info fa fa-retweet",
"InboundAttributeMappingsTable.usedForAll");

private final InboundMappingUseType type;
private final String icon;

private final String tooltip;

UsedFor(InboundMappingUseType type, String icon, String tooltip) {
this.type = type;
this.icon = icon;
this.tooltip = tooltip;
}
}

@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PANEL_INBOUND_MAPPING_WIZARD;
Expand Down Expand Up @@ -67,13 +92,19 @@ public void populateItem(Item<ICellPopulator<PrismContainerValueWrapper<MappingT
protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<MappingType>> rowModel) {
PrismContainerValueWrapper<MappingType> mapping = rowModel.getObject();
MappingType mappingBean = mapping.getRealValue();
if (mappingBean instanceof InboundMappingType
&& InboundMappingUseType.CORRELATION.equals(((InboundMappingType) mappingBean).getUse())) {
return new DisplayType()
.tooltip("InboundAttributeMappingsTable.usedForCorrelation")
.beginIcon()
.cssClass("text-warning fa fa-code-branch")
.end();

InboundMappingUseType mappingUsed = ((InboundMappingType) mappingBean).getUse();
if (mappingUsed == null) {
mappingUsed = InboundMappingUseType.ALL;
}
for (UsedFor usedFor : Arrays.stream(UsedFor.values()).toList()) {
if (usedFor.type.equals(mappingUsed)) {
return new DisplayType()
.tooltip(usedFor.tooltip)
.beginIcon()
.cssClass(usedFor.icon)
.end();
}
}
return new DisplayType();
}
Expand Down

0 comments on commit 6e095ad

Please sign in to comment.