use of com.evolveum.midpoint.web.component.AjaxIconButton in project midpoint by Evolveum.
the class TaskOperationalButtonsPanel method createResumeButton.
private void createResumeButton(RepeatingView repeatingView) {
AjaxIconButton resume = new AjaxIconButton(repeatingView.newChildId(), Model.of(GuiStyleConstants.CLASS_RESUME_MENU_ITEM), createStringResource("pageTaskEdit.button.resume")) {
@Override
public void onClick(AjaxRequestTarget target) {
resumePerformed(target, getPrismObject());
}
};
resume.showTitleAsLabel(true);
resume.add(AttributeAppender.append("class", "btn-primary"));
resume.add(new VisibleBehaviour(() -> WebComponentUtil.canResumeTask(getObjectType(), getPageBase())));
repeatingView.add(resume);
}
use of com.evolveum.midpoint.web.component.AjaxIconButton in project midpoint by Evolveum.
the class FocusOperationalButtonsPanel method createPreviewButton.
private void createPreviewButton(RepeatingView repeatingView) {
AjaxIconButton preview = new AjaxIconButton(repeatingView.newChildId(), Model.of(GuiStyleConstants.CLASS_ICON_PREVIEW), getPageBase().createStringResource("pageAdminFocus.button.previewChanges")) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
previewPerformed(ajaxRequestTarget);
}
};
preview.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_PREVIEW_CHANGES_URL) && !getModelObject().isReadOnly();
}
@Override
public boolean isEnabled() {
return isSavePreviewButtonEnabled();
}
});
preview.showTitleAsLabel(true);
preview.add(AttributeAppender.append("class", "btn btn-info btn-sm"));
repeatingView.add(preview);
}
use of com.evolveum.midpoint.web.component.AjaxIconButton in project midpoint by Evolveum.
the class ResourceOperationalButtonsPanel method initResourceButtons.
private void initResourceButtons(RepeatingView resourceButtons) {
AjaxIconButton test = new AjaxIconButton(resourceButtons.newChildId(), Model.of(GuiStyleConstants.CLASS_TEST_CONNECTION_MENU_ITEM), createStringResource("pageResource.button.test")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
testConnectionPerformed(target);
}
};
test.showTitleAsLabel(true);
test.add(new VisibleBehaviour(() -> isEditingObject()));
test.add(AttributeAppender.append("class", "btn-default btn-sm"));
resourceButtons.add(test);
AjaxIconButton setMaintenance = new AjaxIconButton(resourceButtons.newChildId(), Model.of(GuiStyleConstants.CLASS_ICON_RESOURCE_MAINTENANCE), createStringResource("pageResource.button.toggleMaintenance")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
WebComponentUtil.toggleResourceMaintenance(getPrismObject(), OPERATION_SET_MAINTENANCE, target, getPageBase());
refreshStatus(target);
}
};
setMaintenance.showTitleAsLabel(true);
setMaintenance.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isEditingObject() && canEdit(getObjectType());
}
});
setMaintenance.add(AttributeAppender.append("class", "btn-default btn-sm"));
resourceButtons.add(setMaintenance);
AjaxIconButton refreshSchema = new AjaxIconButton(resourceButtons.newChildId(), Model.of(GuiStyleConstants.CLASS_ICON_RESOURCE_SCHEMA), createStringResource("pageResource.button.refreshSchema")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
WebComponentUtil.refreshResourceSchema(getPrismObject(), OPERATION_REFRESH_SCHEMA, target, getPageBase());
}
};
refreshSchema.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isVisibleRefresSchemaButton(getObjectType());
}
});
refreshSchema.showTitleAsLabel(true);
refreshSchema.add(AttributeAppender.append("class", "btn-default btn-sm"));
resourceButtons.add(refreshSchema);
AjaxIconButton wizardShow = new AjaxIconButton(resourceButtons.newChildId(), Model.of(GuiStyleConstants.CLASS_ICON_WIZARD), createStringResource("pageResource.button.wizardShow")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
startWizard(false, true);
}
};
wizardShow.showTitleAsLabel(true);
wizardShow.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isEditingObject() && canEdit(getObjectType());
}
});
wizardShow.add(AttributeAppender.append("class", "btn-default btn-sm"));
resourceButtons.add(wizardShow);
AjaxIconButton wizardEdit = new AjaxIconButton(resourceButtons.newChildId(), Model.of(GuiStyleConstants.CLASS_ICON_WIZARD), createStringResource("pageResource.button.wizardEdit")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
startWizard(false, false);
}
};
wizardEdit.showTitleAsLabel(true);
wizardEdit.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isEditingObject() && canEdit(getObjectType());
}
});
wizardEdit.add(AttributeAppender.append("class", "btn-default btn-sm"));
resourceButtons.add(wizardEdit);
}
use of com.evolveum.midpoint.web.component.AjaxIconButton in project midpoint by Evolveum.
the class ObjectHistoryTabPanel method initLayout.
private void initLayout() {
AuditLogViewerPanel panel = new AuditLogViewerPanel(ID_MAIN_PANEL) {
private static final long serialVersionUID = 1L;
@Override
protected List<IColumn<SelectableBean<AuditEventRecordType>, String>> createColumns() {
List<IColumn<SelectableBean<AuditEventRecordType>, String>> columns = super.createColumns();
IColumn<SelectableBean<AuditEventRecordType>, String> column = new AbstractColumn<SelectableBean<AuditEventRecordType>, String>(new Model<>()) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<AuditEventRecordType>>> cellItem, String componentId, IModel<SelectableBean<AuditEventRecordType>> rowModel) {
cellItem.add(new MultiButtonPanel<SelectableBean<AuditEventRecordType>>(componentId, rowModel, 2) {
private static final long serialVersionUID = 1L;
@Override
protected Component createButton(int index, String componentId, IModel<SelectableBean<AuditEventRecordType>> model) {
AjaxIconButton btn = null;
switch(index) {
case 0:
btn = buildDefaultButton(componentId, new Model<>("fa fa-circle-o"), createStringResource("ObjectHistoryTabPanel.viewHistoricalObjectDataTitle"), new Model<>("btn btn-sm " + DoubleButtonColumn.ButtonColorClass.INFO), target -> currentStateButtonClicked(target, getReconstructedObject(getObjectWrapper().getOid(), unwrapModel(model).getEventIdentifier(), getObjectWrapper().getCompileTimeClass()), WebComponentUtil.getLocalizedDate(unwrapModel(model).getTimestamp(), DateLabelComponent.SHORT_NOTIME_STYLE)));
break;
case 1:
btn = buildDefaultButton(componentId, new Model<>(GuiStyleConstants.CLASS_FILE_TEXT), createStringResource("ObjectHistoryTabPanel.viewHistoricalObjectXmlTitle"), new Model<>("btn btn-sm " + DoubleButtonColumn.ButtonColorClass.SUCCESS), target -> viewObjectXmlButtonClicked(getObjectWrapper().getOid(), unwrapModel(model).getEventIdentifier(), getObjectWrapper().getCompileTimeClass(), WebComponentUtil.getLocalizedDate(unwrapModel(model).getTimestamp(), DateLabelComponent.SHORT_NOTIME_STYLE)));
break;
}
return btn;
}
});
}
};
columns.add(column);
return columns;
}
@Override
protected ObjectQuery getCustomizeContentQuery() {
return getPageBase().getPrismContext().queryFor(AuditEventRecordType.class).item(AuditEventRecordType.F_TARGET_REF).ref(getObjectWrapper().getOid()).and().item(AuditEventRecordType.F_EVENT_STAGE).eq(AuditEventStageType.EXECUTION).build();
}
@Override
protected String getAuditStorageKey(String collectionNameValue) {
if (StringUtils.isNotEmpty(collectionNameValue)) {
return SessionStorage.KEY_OBJECT_HISTORY_AUDIT_LOG + "." + collectionNameValue + "." + getObjectWrapper().getTypeName().getLocalPart();
}
return SessionStorage.KEY_OBJECT_HISTORY_AUDIT_LOG + "." + getObjectWrapper().getTypeName().getLocalPart();
}
@Override
protected boolean isObjectHistoryPanel() {
return true;
}
};
panel.setOutputMarkupId(true);
add(panel);
}
use of com.evolveum.midpoint.web.component.AjaxIconButton in project midpoint by Evolveum.
the class OperationalButtonsPanel method createBackButton.
private void createBackButton(RepeatingView repeatingView) {
AjaxIconButton back = new AjaxIconButton(repeatingView.newChildId(), Model.of(GuiStyleConstants.ARROW_LEFT), getPageBase().createStringResource("pageAdminFocus.button.back")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
backPerformed(ajaxRequestTarget);
}
};
back.showTitleAsLabel(true);
back.add(AttributeAppender.append("class", "btn btn-default btn-sm"));
repeatingView.add(back);
}
Aggregations