use of com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon in project midpoint by Evolveum.
the class AjaxCompositedIconButton method onComponentTagBody.
@Override
public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
StringBuilder sb = new StringBuilder();
CompositedIcon icon = this.icon;
if (icon == null) {
icon = buttonModel.getObject().getCompositedIcon();
}
if (icon.hasBasicIcon()) {
sb.append("<i class=\"").append(icon.getBasicIcon()).append("\"");
if (icon.hasBasicIconHtmlColor()) {
sb.append(" style=\"color: " + icon.getBasicIconHtmlColor() + ";\"");
}
sb.append("></i> ");
if (titleAsLabel) {
sb.append("<span class=\"operationalButtonLabel\">").append(title.getObject()).append("</span>");
}
}
if (icon.hasLayerIcons()) {
for (LayerIcon entry : icon.getLayerIcons()) {
if (entry == null) {
continue;
}
if (StringUtils.isNotEmpty(entry.getIconType().getCssClass())) {
sb.append("<i class=\"").append(entry.getIconType().getCssClass()).append("\"");
if (StringUtils.isNotEmpty(entry.getIconType().getColor())) {
sb.append(" style=\"color: ").append(entry.getIconType().getColor()).append(";\"");
}
sb.append(">").append(entry.hasLabel() ? entry.getLabelModel().getObject() : "").append("</i> ");
}
}
}
replaceComponentTagBody(markupStream, openTag, sb.toString());
}
use of com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon in project midpoint by Evolveum.
the class FocusProjectionsPanel method initBasicColumns.
private List<IColumn<PrismContainerValueWrapper<ShadowType>, String>> initBasicColumns() {
IModel<PrismContainerDefinition<ShadowType>> shadowDef = Model.of(getShadowDefinition());
List<IColumn<PrismContainerValueWrapper<ShadowType>, String>> columns = new ArrayList<>();
columns.add(new CheckBoxHeaderColumn<>());
columns.add(new CompositedIconColumn<>(Model.of("")) {
private static final long serialVersionUID = 1L;
@Override
protected CompositedIcon getCompositedIcon(IModel<PrismContainerValueWrapper<ShadowType>> rowModel) {
if (rowModel == null || rowModel.getObject() == null || rowModel.getObject().getRealValue() == null) {
return new CompositedIconBuilder().build();
}
ShadowType shadow = createShadowType(rowModel);
return WebComponentUtil.createAccountIcon(shadow, getPageBase(), true);
}
});
columns.add(new PrismPropertyWrapperColumn<ShadowType, String>(shadowDef, ShadowType.F_NAME, ColumnType.LINK, getPageBase()) {
private static final long serialVersionUID = 1L;
@Override
protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ShadowType>> rowModel) {
getMultivalueContainerListPanel().itemDetailsPerformed(target, rowModel);
target.add(getPageBase().getFeedbackPanel());
}
});
columns.add(new PrismReferenceWrapperColumn<>(shadowDef, ShadowType.F_RESOURCE_REF, ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<ShadowType, String>(shadowDef, ShadowType.F_OBJECT_CLASS, ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<ShadowType, String>(shadowDef, ShadowType.F_KIND, ColumnType.STRING, getPageBase()) {
@Override
public String getCssClass() {
return "col-xs-1";
}
});
columns.add(new PrismPropertyWrapperColumn<ShadowType, String>(shadowDef, ShadowType.F_INTENT, ColumnType.STRING, getPageBase()) {
@Override
public String getCssClass() {
return "col-xs-1";
}
});
columns.add(new PrismContainerWrapperColumn<>(shadowDef, ShadowType.F_PENDING_OPERATION, getPageBase()) {
@Override
public String getCssClass() {
return "col-xs-2";
}
@Override
protected <IW extends ItemWrapper> Component createColumnPanel(String componentId, IModel<IW> rowModel) {
IW object = rowModel.getObject();
if (object == null) {
return new WebMarkupContainer(componentId);
}
List<PrismValueWrapper<PendingOperationType>> values = object.getValues();
List<PendingOperationType> pendingOperations = values.stream().map(operation -> operation.getRealValue()).collect(Collectors.toList());
return new PendingOperationPanel(componentId, Model.ofList(pendingOperations));
}
});
return columns;
}
use of com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon in project midpoint by Evolveum.
the class AssignmentPopup method createCompositedButtonForAssignmentRelation.
private CompositedIconButtonDto createCompositedButtonForAssignmentRelation(AssignmentObjectRelation relation) {
CompositedIconButtonDto buttonDto = new CompositedIconButtonDto();
buttonDto.setAssignmentObjectRelation(relation);
DisplayType additionalButtonDisplayType = GuiDisplayTypeUtil.getAssignmentObjectRelationDisplayType(getPageBase(), relation, "AssignmentPanel.newAssignmentTitle");
// isInducement() ? "AssignmentPanel.newInducementTitle" : "AssignmentPanel.newAssignmentTitle");
buttonDto.setAdditionalButtonDisplayType(additionalButtonDisplayType);
CompositedIconBuilder builder = WebComponentUtil.getAssignmentRelationIconBuilder(getPageBase(), relation, additionalButtonDisplayType.getIcon(), WebComponentUtil.createIconType(GuiStyleConstants.EVO_ASSIGNMENT_ICON, "green"));
CompositedIcon icon = null;
if (builder != null) {
icon = builder.build();
}
buttonDto.setCompositedIcon(icon);
return buttonDto;
}
use of com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon in project midpoint by Evolveum.
the class ChooseMemberPopup method getAssignButtonDescription.
private List<CompositedIconButtonDto> getAssignButtonDescription() {
List<CompositedIconButtonDto> additionalAssignmentButtons = new ArrayList<>();
List<AssignmentObjectRelation> assignmentObjectRelations = WebComponentUtil.divideAssignmentRelationsByAllValues(loadMemberRelationsList());
if (assignmentObjectRelations != null) {
assignmentObjectRelations.forEach(relation -> {
DisplayType additionalDispayType = GuiDisplayTypeUtil.getAssignmentObjectRelationDisplayType(ChooseMemberPopup.this.getPageBase(), relation, "abstractRoleMemberPanel.menu.assignMember");
CompositedIconBuilder builder = WebComponentUtil.getAssignmentRelationIconBuilder(ChooseMemberPopup.this.getPageBase(), relation, additionalDispayType.getIcon(), WebComponentUtil.createIconType(GuiStyleConstants.EVO_ASSIGNMENT_ICON, "green"));
CompositedIcon icon = builder.build();
CompositedIconButtonDto buttonDto = createCompositedIconButtonDto(additionalDispayType, relation, icon);
additionalAssignmentButtons.add(buttonDto);
});
}
additionalAssignmentButtons.add(createCompositedIconButtonDto(getAssignMemberButtonDisplayType(), null, null));
return additionalAssignmentButtons;
}
use of com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon in project midpoint by Evolveum.
the class ColumnResultPanel method initLayout.
private void initLayout() {
LoadableModel<CompositedIcon> compositedIcon = new LoadableModel<CompositedIcon>() {
@Override
protected CompositedIcon load() {
OperationResult result = getModelObject();
if (result == null) {
return null;
}
String basicIconCssClass;
String title;
if (result.isEmpty()) {
DisplayType displayType = getDisplayForEmptyResult();
if (displayType == null || displayType.getIcon() == null || displayType.getIcon().getCssClass() == null) {
return null;
}
basicIconCssClass = displayType.getIcon().getCssClass();
title = WebComponentUtil.getTranslatedPolyString(displayType.getTooltip());
} else {
OperationResultStatusPresentationProperties statusProperties = OperationResultStatusPresentationProperties.parseOperationalResultStatus(result.getStatus());
basicIconCssClass = statusProperties.getIcon() + " fa-lg";
title = getPageBase().createStringResource(statusProperties.getStatusLabelKey()).getString();
}
CompositedIconBuilder builder = new CompositedIconBuilder();
String additionalCssClass = "";
Throwable cause = RepoCommonUtils.getResultExceptionIfExists(getModelObject());
if (OperationResultStatus.IN_PROGRESS.equals(result.getStatus()) && (cause instanceof CommunicationException) && isProjectionResult()) {
IconType icon = new IconType();
icon.setCssClass("fa fa-info-circle " + GuiStyleConstants.BLUE_COLOR);
builder.appendLayerIcon(icon, LayeredIconCssStyle.BOTTOM_RIGHT_STYLE);
builder.setTitle(getPageBase().createStringResource("ColumnResultPanel.message.communicationFail").getString());
additionalCssClass = "change-password-icon-result-center";
} else {
builder.setTitle(title);
}
builder.setBasicIcon(basicIconCssClass, IconCssStyle.IN_ROW_STYLE, additionalCssClass);
return builder.build();
}
};
CompositedIconPanel iconPanel = new CompositedIconPanel(ID_RESULT_ICON, compositedIcon);
iconPanel.setOutputMarkupId(true);
add(iconPanel);
AjaxButton showErrorDetailsButton = new AjaxButton(ID_DETAILS_BUTTON) {
@Override
public void onClick(AjaxRequestTarget target) {
getPageBase().showResult(ColumnResultPanel.this.getModelObject());
target.add(getPageBase().getFeedbackPanel());
}
};
showErrorDetailsButton.setOutputMarkupId(true);
showErrorDetailsButton.add(AttributeAppender.append("title", getPageBase().createStringResource("ColumnResultPanel.showDetails")));
showErrorDetailsButton.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModelObject() != null && RepoCommonUtils.getResultExceptionIfExists(getModelObject()) != null;
}
});
add(showErrorDetailsButton);
}
Aggregations