use of com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder in project midpoint by Evolveum.
the class ReportOperationalButtonsPanel method initOperationalButtons.
private void initOperationalButtons(RepeatingView repeatingView) {
String refreshId = repeatingView.newChildId();
String showPreviewId = repeatingView.newChildId();
String showPreviewInPopupId = repeatingView.newChildId();
IconType iconType = new IconType();
iconType.setCssClass("fa fa-address-card-o");
CompositedIconBuilder iconBuilder = new CompositedIconBuilder().setBasicIcon("fa fa-refresh", IconCssStyle.IN_ROW_STYLE).appendLayerIcon(iconType, IconCssStyle.BOTTOM_RIGHT_STYLE);
AjaxCompositedIconButton refresh = new AjaxCompositedIconButton(refreshId, iconBuilder.build(), createStringResource("pageCreateCollectionReport.button.refresh")) {
@Override
public void onClick(AjaxRequestTarget target) {
ReportObjectsListPanel<?> table = getReportTable();
table.getPageStorage().setSearch(null);
table.resetSearchModel();
table.resetTable(target);
table.refreshTable(target);
table.checkView();
target.add(table);
target.add(getTableBox());
target.add(getTableContainer());
target.add(getPageBase().getFeedbackPanel());
}
};
refresh.add(new VisibleBehaviour(isShowingPreview::getObject));
refresh.add(AttributeAppender.append("class", "btn-default btn-sm"));
refresh.setOutputMarkupId(true);
repeatingView.add(refresh);
iconBuilder = new CompositedIconBuilder().setBasicIcon("fa fa-address-card-o", IconCssStyle.IN_ROW_STYLE);
AjaxCompositedIconButton showPreview = new AjaxCompositedIconButton(showPreviewId, iconBuilder.build(), createStringResource("pageCreateCollectionReport.button.showPreview.${}", isShowingPreview)) {
@Override
public void onClick(AjaxRequestTarget target) {
isShowingPreview.setObject(!isShowingPreview.getObject());
ReportObjectsListPanel<?> table = getReportTable();
if (isShowingPreview.getObject()) {
table.getPageStorage().setSearch(null);
table.resetSearchModel();
table.resetTable(target);
table.refreshTable(target);
table.checkView();
}
target.add(getTableBox());
if (isShowingPreview.getObject() && table.hasView()) {
info(createStringResource("PageReport.message.shownedReportPreview").getString());
}
target.add(getTableContainer());
target.add(this);
target.add(repeatingView.get(showPreviewInPopupId));
target.add(repeatingView.get(refreshId));
target.add(ReportOperationalButtonsPanel.this);
target.add(getPageBase().getFeedbackPanel());
}
};
showPreview.titleAsLabel(true);
showPreview.add(new VisibleBehaviour(this::isCollectionReport));
showPreview.add(AttributeAppender.append("class", "btn-default btn-sm"));
showPreview.setOutputMarkupId(true);
repeatingView.add(showPreview);
iconType = new IconType();
iconType.setCssClass("fa fa-window-maximize");
iconBuilder = new CompositedIconBuilder().setBasicIcon("fa fa-address-card-o", IconCssStyle.IN_ROW_STYLE);
// .appendLayerIcon(iconType, IconCssStyle.BOTTOM_RIGHT_STYLE);
AjaxCompositedIconButton showPreviewInPopup = new AjaxCompositedIconButton(showPreviewInPopupId, iconBuilder.build(), createStringResource("pageCreateCollectionReport.button.showPreviewInPopup")) {
@Override
public void onClick(AjaxRequestTarget target) {
RunReportPopupPanel reportPopup = new RunReportPopupPanel(getPageBase().getMainPopupBodyId(), getReport(), false) {
@Override
public StringResourceModel getTitle() {
return createStringResource("PageReport.reportPreview");
}
};
getPageBase().showMainPopup(reportPopup, target);
target.add(ReportOperationalButtonsPanel.this);
}
};
showPreviewInPopup.titleAsLabel(true);
showPreviewInPopup.add(new VisibleBehaviour(() -> isCollectionReport() && !isShowingPreview.getObject()));
showPreviewInPopup.add(AttributeAppender.append("class", "btn-default btn-sm"));
showPreviewInPopup.setOutputMarkupId(true);
repeatingView.add(showPreviewInPopup);
iconBuilder = new CompositedIconBuilder().setBasicIcon(GuiStyleConstants.CLASS_START_MENU_ITEM, IconCssStyle.IN_ROW_STYLE);
AjaxCompositedIconButton runReport = new AjaxCompositedIconButton(repeatingView.newChildId(), iconBuilder.build(), createStringResource("pageCreateCollectionReport.button.runOriginalReport")) {
@Override
public void onClick(AjaxRequestTarget target) {
runReportPerformed(target, getOriginalReport(), getPageBase());
}
};
runReport.titleAsLabel(true);
runReport.add(new VisibleBehaviour(() -> isEditObject() && !WebComponentUtil.isImportReport(getOriginalReport().asObjectable())));
runReport.add(AttributeAppender.append("class", "btn-default btn-sm"));
runReport.setOutputMarkupId(true);
repeatingView.add(runReport);
iconBuilder = new CompositedIconBuilder().setBasicIcon(GuiStyleConstants.CLASS_UPLOAD, IconCssStyle.IN_ROW_STYLE);
AjaxCompositedIconButton importReport = new AjaxCompositedIconButton(repeatingView.newChildId(), iconBuilder.build(), createStringResource("pageCreateCollectionReport.button.importOriginalReport")) {
@Override
public void onClick(AjaxRequestTarget target) {
importReportPerformed(target, getOriginalReport(), getPageBase());
}
};
importReport.add(new VisibleBehaviour(() -> isEditObject() && WebComponentUtil.isImportReport(getOriginalReport().asObjectable())));
importReport.add(AttributeAppender.append("class", "btn-default btn-sm"));
importReport.setOutputMarkupId(true);
repeatingView.add(importReport);
}
use of com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder in project midpoint by Evolveum.
the class ButtonInlineMenuItem method getDefaultCompositedIconBuilder.
protected CompositedIconBuilder getDefaultCompositedIconBuilder(String basicIcon) {
CompositedIconBuilder builder = new CompositedIconBuilder();
builder.setBasicIcon(basicIcon, IconCssStyle.IN_ROW_STYLE);
return builder;
}
use of com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder in project midpoint by Evolveum.
the class PageCreateFromTemplate method loadButtonDescriptions.
protected LoadableModel<MultiFunctinalButtonDto> loadButtonDescriptions() {
return new LoadableModel<>(false) {
@Override
protected MultiFunctinalButtonDto load() {
List<CompositedIconButtonDto> additionalButtons = new ArrayList<>();
Collection<CompiledObjectCollectionView> compiledObjectCollectionViews = getCompiledGuiProfile().findAllApplicableArchetypeViews(getType(), OperationTypeType.ADD);
if (CollectionUtils.isNotEmpty(compiledObjectCollectionViews)) {
compiledObjectCollectionViews.forEach(collection -> {
CompositedIconButtonDto buttonDesc = new CompositedIconButtonDto();
buttonDesc.setCompositedIcon(createCompositedIcon(collection));
buttonDesc.setOrCreateDefaultAdditionalButtonDisplayType(collection.getDisplay());
buttonDesc.setCollectionView(collection);
additionalButtons.add(buttonDesc);
});
}
if (isGenericNewButtonVisible()) {
CompositedIconButtonDto defaultButton = new CompositedIconButtonDto();
DisplayType defaultButtonDisplayType = getDefaultButtonDisplayType();
defaultButton.setAdditionalButtonDisplayType(defaultButtonDisplayType);
CompositedIconBuilder defaultButtonIconBuilder = new CompositedIconBuilder();
defaultButtonIconBuilder.setBasicIcon(WebComponentUtil.getIconCssClass(defaultButtonDisplayType), IconCssStyle.IN_ROW_STYLE).appendColorHtmlValue(WebComponentUtil.getIconColor(defaultButtonDisplayType));
defaultButton.setCompositedIcon(defaultButtonIconBuilder.build());
additionalButtons.add(defaultButton);
}
MultiFunctinalButtonDto multifunctionalButton = new MultiFunctinalButtonDto();
multifunctionalButton.setAdditionalButtons(additionalButtons);
return multifunctionalButton;
}
};
}
use of com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder in project midpoint by Evolveum.
the class PageCreateFromTemplate method createCompositedIcon.
// TODO copied from MainObjectListPanel
private CompositedIcon createCompositedIcon(CompiledObjectCollectionView collectionView) {
DisplayType additionalButtonDisplayType = GuiDisplayTypeUtil.getNewObjectDisplayTypeFromCollectionView(collectionView, PageCreateFromTemplate.this);
CompositedIconBuilder builder = new CompositedIconBuilder();
builder.setBasicIcon(WebComponentUtil.getIconCssClass(additionalButtonDisplayType), IconCssStyle.IN_ROW_STYLE).appendColorHtmlValue(WebComponentUtil.getIconColor(additionalButtonDisplayType));
return builder.build();
}
use of com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder in project midpoint by Evolveum.
the class PageValuePolicies method createInlineMenu.
private List<InlineMenuItem> createInlineMenu() {
List<InlineMenuItem> menu = new ArrayList<>();
menu.add(new ButtonInlineMenuItem(createStringResource("pageValuePolicies.button.delete")) {
private static final long serialVersionUID = 1L;
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_DELETE_MENU_ITEM);
}
@Override
public InlineMenuItemAction initAction() {
return null;
}
});
return menu;
}
Aggregations