use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class GlobalPolicyRuleTabPanel method initBasicColumns.
private List<IColumn<PrismContainerValueWrapper<GlobalPolicyRuleType>, String>> initBasicColumns() {
List<IColumn<PrismContainerValueWrapper<GlobalPolicyRuleType>, String>> columns = new ArrayList<>();
columns.add(new CheckBoxHeaderColumn<>());
PrismPropertyWrapperColumn<GlobalPolicyRuleType, String> linkColumn = new PrismPropertyWrapperColumn<GlobalPolicyRuleType, String>(getModel(), GlobalPolicyRuleType.F_NAME, ColumnType.LINK, getPageBase()) {
@Override
protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<GlobalPolicyRuleType>> rowModel) {
getMultivalueContainerListPanel().itemDetailsPerformed(target, rowModel);
}
protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<GlobalPolicyRuleType>> rowModel) {
return GuiDisplayTypeUtil.createDisplayType(WebComponentUtil.createDefaultBlackIcon(SystemConfigurationType.COMPLEX_TYPE));
}
};
columns.add(linkColumn);
columns.add(new PrismContainerWrapperColumn<>(getModel(), GlobalPolicyRuleType.F_POLICY_CONSTRAINTS, getPageBase()));
columns.add(new PrismContainerWrapperColumn<>(getModel(), GlobalPolicyRuleType.F_POLICY_ACTIONS, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<GlobalPolicyRuleType, String>(getModel(), GlobalPolicyRuleType.F_POLICY_SITUATION, ColumnType.STRING, getPageBase()));
List<InlineMenuItem> menuActionsList = getMultivalueContainerListPanel().getDefaultMenuActions();
columns.add(new InlineMenuButtonColumn(menuActionsList, getPageBase()) {
private static final long serialVersionUID = 1L;
@Override
public String getCssClass() {
return " col-md-1 ";
}
});
return columns;
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class ExecuteChangeOptionsPanel method createOptionsDropdownButton.
private void createOptionsDropdownButton(List<InlineMenuItem> items) {
DropdownButtonDto model = new DropdownButtonDto(null, GuiStyleConstants.CLASS_OPTIONS_BUTTON_ICON, getPageBase().createStringResource("ExecuteChangeOptionsPanel.options").getString(), items);
DropdownButtonPanel dropdownButtonPanel = new DropdownButtonPanel(ID_OPTIONS, model) {
@Override
protected void populateMenuItem(String componentId, ListItem<InlineMenuItem> menuItem) {
InlineMenuItem item = menuItem.getModelObject();
if (!(item instanceof CheckboxMenuItem)) {
super.populateMenuItem(componentId, menuItem);
return;
}
CheckboxMenuItem checkboxMenuItem = (CheckboxMenuItem) item;
CheckBoxPanel panel = new CheckBoxPanel(componentId, checkboxMenuItem.getCheckBoxModel(), checkboxMenuItem.getLabel(), null) {
@Override
public void onUpdate(AjaxRequestTarget target) {
// checkboxMenuItem.getCheckBoxModel().setObject(!checkboxMenuItem.getCheckBoxModel().getObject());
}
};
panel.setOutputMarkupId(true);
menuItem.add(panel);
}
@Override
protected String getSpecialButtonClass() {
return "btn-sm btn-default btn-margin-right";
}
@Override
protected String getSpecialDropdownMenuClass() {
return "execute-options";
}
@Override
protected String getSpecialLabelClass() {
return "execute-options-label";
}
};
add(dropdownButtonPanel);
dropdownButtonPanel.setOutputMarkupId(true);
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class PageCreatedReports method initInlineMenu.
private List<InlineMenuItem> initInlineMenu() {
List<InlineMenuItem> menuItems = new ArrayList<>();
// menuItems.add(new InlineMenuItem(createStringResource("pageCreatedReports.inlineMenu.deleteAll")) {
// private static final long serialVersionUID = 1L;
//
// @Override
// public InlineMenuItemAction initAction() {
// return new HeaderMenuAction(PageCreatedReports.this) {
// private static final long serialVersionUID = 1L;
//
// @Override
// public void onClick(AjaxRequestTarget target) {
// deleteAllPerformed(target, ReportDeleteDialogDto.Operation.DELETE_ALL);
// }
// };
// }
// });
menuItems.add(new ButtonInlineMenuItem(createStringResource("pageCreatedReports.button.delete")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ReportDataType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ReportDataType report = null;
if (getRowModel() != null) {
SelectableBeanImpl<ReportDataType> rowDto = getRowModel().getObject();
report = rowDto.getValue();
}
deleteSelectedPerformed(target, ReportDeleteDialogDto.Operation.DELETE_SELECTED, report);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder("fa fa-minus");
}
});
boolean canViewTraces;
boolean canReadTraces;
try {
canReadTraces = isAuthorized(ModelAuthorizationAction.READ_TRACE.getUrl());
} catch (Throwable t) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't authorize reading traces", t);
canReadTraces = false;
}
canViewTraces = canReadTraces && WebModelServiceUtils.isEnableExperimentalFeature(this);
ButtonInlineMenuItem item = new ButtonInlineMenuItem(createStringResource("DownloadButtonPanel.download")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ReportDataType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
SelectableBeanImpl<ReportDataType> rowDto = getRowModel().getObject();
currentReport = rowDto.getValue();
downloadPerformed(target, ajaxDownloadBehavior);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder("fa fa-download");
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
};
if (!canReadTraces) {
item.setVisibilityChecker((rowModel, isHeader) -> !isTrace(rowModel));
}
menuItems.add(item);
ButtonInlineMenuItem viewTraceItem = new ButtonInlineMenuItem(createStringResource("DownloadButtonPanel.viewTrace")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ReportDataType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
SelectableBeanImpl<ReportDataType> rowDto = getRowModel().getObject();
currentReport = rowDto.getValue();
PageParameters parameters = new PageParameters();
parameters.add(PageTraceView.PARAM_OBJECT_ID, currentReport.getOid());
navigateToNext(PageTraceView.class, parameters);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder("fa fa-eye");
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
};
menuItems.add(viewTraceItem);
viewTraceItem.setVisibilityChecker((rowModel, isHeader) -> canViewTraces && isTrace(rowModel));
return menuItems;
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class PageReports method createInlineMenu.
private List<InlineMenuItem> createInlineMenu() {
List<InlineMenuItem> menu = new ArrayList<>();
ButtonInlineMenuItem runButton = new ButtonInlineMenuItem(createStringResource("PageReports.button.run")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ReportType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ReportType report = getRowModel().getObject().getValue();
com.evolveum.midpoint.web.page.admin.reports.PageReport.runReportPerformed(target, report.asPrismObject(), PageReports.this);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_START_MENU_ITEM);
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
};
runButton.setVisibilityChecker((rowModel, isHeader) -> !isImportReport((IModel<SelectableBean<ReportType>>) rowModel));
menu.add(runButton);
ButtonInlineMenuItem importButton = new ButtonInlineMenuItem(createStringResource("PageReports.button.import")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ReportType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ReportType report = getRowModel().getObject().getValue();
com.evolveum.midpoint.web.page.admin.reports.PageReport.importReportPerformed(target, report.asPrismObject(), PageReports.this);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_UPLOAD);
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
};
importButton.setVisibilityChecker((rowModel, isHeader) -> isImportReport((IModel<SelectableBean<ReportType>>) rowModel));
menu.add(importButton);
menu.add(new ButtonInlineMenuItem(createStringResource("PageReports.button.configure")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ReportType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ReportType reportObject = getRowModel().getObject().getValue();
configurePerformed(target, reportObject);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_EDIT_MENU_ITEM);
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
menu.add(new ButtonInlineMenuItem(createStringResource("PageReports.button.showOutput")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ReportType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ReportType reportObject = getRowModel().getObject().getValue();
PageParameters pageParameters = new PageParameters();
pageParameters.add(OnePageParameterEncoder.PARAMETER, reportObject.getOid());
navigateToNext(PageCreatedReports.class, pageParameters);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder("fa fa-files-o");
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
return menu;
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class PageReports method initLayout.
private void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<ReportType> table = new MainObjectListPanel<ReportType>(ID_TABLE, ReportType.class) {
private static final long serialVersionUID = 1L;
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_REPORTS;
}
@Override
protected List<IColumn<SelectableBean<ReportType>, String>> createDefaultColumns() {
return ColumnUtils.getDefaultObjectColumns();
}
@Override
protected IColumn<SelectableBean<ReportType>, String> createCheckboxColumn() {
return null;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return PageReports.this.createInlineMenu();
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
}
Aggregations