use of com.evolveum.midpoint.gui.impl.component.data.column.CompositedIconPanel in project midpoint by Evolveum.
the class CompositedButtonPanel method initLayout.
private void initLayout() {
WebMarkupContainer buttonContainer = new WebMarkupContainer(ID_COMPOSITED_BUTTON);
add(buttonContainer);
CompositedIconPanel compositedIconPanel = new CompositedIconPanel(ID_COMPOSITED_ICON, new PropertyModel<>(getModel(), CompositedIconButtonDto.F_COMPOSITED_ICON));
buttonContainer.add(compositedIconPanel);
Label label = new Label(ID_LABEL, new ReadOnlyModel<>(() -> {
DisplayType displayType = getModelObject().getAdditionalButtonDisplayType();
return WebComponentUtil.getTranslatedPolyString(displayType.getLabel());
}));
buttonContainer.add(label);
buttonContainer.add(AttributeAppender.append("title", new ReadOnlyModel<>(() -> {
DisplayType displayType = getModelObject().getAdditionalButtonDisplayType();
return WebComponentUtil.getTranslatedPolyString(displayType.getTooltip());
})));
buttonContainer.add(new TooltipBehavior());
buttonContainer.add(new AjaxEventBehavior("click") {
@Override
protected void onEvent(AjaxRequestTarget target) {
onButtonClicked(target, getModelObject());
}
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
attributes.setPreventDefault(true);
super.updateAjaxAttributes(attributes);
}
});
// Label description = new Label(ID_DESCRIPTION, new ReadOnlyModel<>(() -> {
// DisplayType displayType = getModelObject().getAdditionalButtonDisplayType();
// return WebComponentUtil.getTranslatedPolyString(displayType.getTooltip());
// }));
// buttonContainer.add(description);
}
use of com.evolveum.midpoint.gui.impl.component.data.column.CompositedIconPanel 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