use of com.evolveum.midpoint.web.component.AjaxIconButton in project midpoint by Evolveum.
the class OperationalButtonsPanel method createEditRawButton.
private void createEditRawButton(RepeatingView repeatingView) {
AjaxIconButton edit = new AjaxIconButton(repeatingView.newChildId(), Model.of(GuiStyleConstants.CLASS_EDIT_MENU_ITEM), getPageBase().createStringResource("AbstractObjectMainPanel.editXmlButton")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
editRawPerformed(ajaxRequestTarget);
}
};
edit.add(new VisibleBehaviour(this::isEditRawButtonVisible));
edit.showTitleAsLabel(true);
edit.add(AttributeAppender.append("class", "btn btn-default btn-sm"));
repeatingView.add(edit);
}
use of com.evolveum.midpoint.web.component.AjaxIconButton in project midpoint by Evolveum.
the class TaskOperationalButtonsPanel method createRefreshNowIconButton.
private void createRefreshNowIconButton(RepeatingView repeatingView) {
AjaxIconButton refreshNow = new AjaxIconButton(repeatingView.newChildId(), new Model<>("fa fa-refresh"), createStringResource("autoRefreshPanel.refreshNow")) {
@Override
public void onClick(AjaxRequestTarget target) {
refresh(target);
}
};
refreshNow.add(AttributeAppender.append("class", ""));
repeatingView.add(refreshNow);
}
use of com.evolveum.midpoint.web.component.AjaxIconButton in project midpoint by Evolveum.
the class SwitchAssignmentTypePanel method initButtonsPanel.
private void initButtonsPanel() {
WebMarkupContainer buttonsContainer = new WebMarkupContainer(ID_ASSIGNMENT_TYPE_BUTTONS);
buttonsContainer.setOutputMarkupId(true);
buttonsContainer.add(new VisibleBehaviour(() -> ID_SHOW_INDIRECT_ASSIGNMENTS.equals(activeButtonId) || getButtonsContainerVisibilityModel().getObject()));
add(buttonsContainer);
List<ContainerPanelConfigurationType> subPanels = config.getPanel();
Map<String, ContainerPanelConfigurationType> panelsMap = new HashMap<>();
for (ContainerPanelConfigurationType subPanel : subPanels) {
panelsMap.put(subPanel.getIdentifier(), subPanel);
}
AjaxButton allAssignmentsButton = new AjaxButton(ID_ALL_ASSIGNMENTS, createStringResource("AssignmentPanel.allLabel")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
AssignmentPanel assignmentPanel = new AssignmentPanel(ID_ASSIGNMENTS, SwitchAssignmentTypePanel.this.getModel(), panelsMap.get("allAssignments")) {
private static final long serialVersionUID = 1L;
@Override
protected void assignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected void cancelAssignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected boolean isNewObjectButtonVisible(PrismObject focusObject) {
return !isReadonly() && super.isNewObjectButtonVisible(focusObject);
}
@Override
protected void refreshTable(AjaxRequestTarget ajaxRequestTarget) {
ajaxRequestTarget.add(SwitchAssignmentTypePanel.this);
}
};
assignmentPanel.setOutputMarkupId(true);
switchAssignmentTypePerformed(target, assignmentPanel, ID_ALL_ASSIGNMENTS);
}
};
allAssignmentsButton.add(AttributeAppender.append("class", getButtonStyleModel(ID_ALL_ASSIGNMENTS)));
allAssignmentsButton.setOutputMarkupId(true);
allAssignmentsButton.setOutputMarkupPlaceholderTag(true);
allAssignmentsButton.add(new VisibleBehaviour(() -> {
ContainerPanelConfigurationType allAssignmentsConfig = panelsMap.get("allAssignments");
if (allAssignmentsConfig == null) {
return true;
}
UserInterfaceElementVisibilityType visibility = allAssignmentsConfig.getVisibility();
if (UserInterfaceElementVisibilityType.HIDDEN == visibility) {
return false;
}
return true;
}));
buttonsContainer.add(allAssignmentsButton);
AjaxButton roleTypeAssignmentsButton = new AjaxButton(ID_ROLE_TYPE_ASSIGNMENTS, createStringResource("ObjectType.RoleType")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
AbstractRoleAssignmentPanel assignmentPanel = new AbstractRoleAssignmentPanel(ID_ASSIGNMENTS, SwitchAssignmentTypePanel.this.getModel(), panelsMap.get("roleAssignments")) {
private static final long serialVersionUID = 1L;
@Override
protected QName getAssignmentType() {
return RoleType.COMPLEX_TYPE;
}
@Override
protected void assignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected void cancelAssignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected boolean isNewObjectButtonVisible(PrismObject focusObject) {
return !isReadonly() && super.isNewObjectButtonVisible(focusObject);
}
@Override
protected void refreshTable(AjaxRequestTarget ajaxRequestTarget) {
ajaxRequestTarget.add(SwitchAssignmentTypePanel.this);
}
};
assignmentPanel.setOutputMarkupId(true);
switchAssignmentTypePerformed(target, assignmentPanel, ID_ROLE_TYPE_ASSIGNMENTS);
}
};
roleTypeAssignmentsButton.add(AttributeAppender.append("class", getButtonStyleModel(ID_ROLE_TYPE_ASSIGNMENTS)));
roleTypeAssignmentsButton.setOutputMarkupId(true);
buttonsContainer.add(roleTypeAssignmentsButton);
AjaxButton orgTypeAssignmentsButton = new AjaxButton(ID_ORG_TYPE_ASSIGNMENTS, createStringResource("ObjectType.OrgType")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
AbstractRoleAssignmentPanel assignmentPanel = new AbstractRoleAssignmentPanel(ID_ASSIGNMENTS, SwitchAssignmentTypePanel.this.getModel(), panelsMap.get("orgAssignments")) {
private static final long serialVersionUID = 1L;
@Override
protected QName getAssignmentType() {
return OrgType.COMPLEX_TYPE;
}
@Override
protected void assignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected void cancelAssignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected boolean isNewObjectButtonVisible(PrismObject focusObject) {
return !isReadonly() && super.isNewObjectButtonVisible(focusObject);
}
@Override
protected void refreshTable(AjaxRequestTarget ajaxRequestTarget) {
ajaxRequestTarget.add(SwitchAssignmentTypePanel.this);
}
};
assignmentPanel.setOutputMarkupId(true);
switchAssignmentTypePerformed(target, assignmentPanel, ID_ORG_TYPE_ASSIGNMENTS);
}
};
orgTypeAssignmentsButton.add(AttributeAppender.append("class", getButtonStyleModel(ID_ORG_TYPE_ASSIGNMENTS)));
orgTypeAssignmentsButton.setOutputMarkupId(true);
buttonsContainer.add(orgTypeAssignmentsButton);
AjaxButton serviceTypeAssignmentsButton = new AjaxButton(ID_SERVICE_TYPE_ASSIGNMENTS, createStringResource("ObjectType.ServiceType")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
AbstractRoleAssignmentPanel assignmentPanel = new AbstractRoleAssignmentPanel(ID_ASSIGNMENTS, SwitchAssignmentTypePanel.this.getModel(), panelsMap.get("serviceAssignments")) {
private static final long serialVersionUID = 1L;
@Override
protected QName getAssignmentType() {
return ServiceType.COMPLEX_TYPE;
}
@Override
protected void assignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected void cancelAssignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected boolean isNewObjectButtonVisible(PrismObject focusObject) {
return !isReadonly() && super.isNewObjectButtonVisible(focusObject);
}
@Override
protected void refreshTable(AjaxRequestTarget ajaxRequestTarget) {
ajaxRequestTarget.add(SwitchAssignmentTypePanel.this);
}
};
assignmentPanel.setOutputMarkupId(true);
switchAssignmentTypePerformed(target, assignmentPanel, ID_SERVICE_TYPE_ASSIGNMENTS);
}
};
serviceTypeAssignmentsButton.add(AttributeAppender.append("class", getButtonStyleModel(ID_SERVICE_TYPE_ASSIGNMENTS)));
serviceTypeAssignmentsButton.setOutputMarkupId(true);
buttonsContainer.add(serviceTypeAssignmentsButton);
AjaxButton resourceTypeAssignmentsButton = new AjaxButton(ID_RESOURCE_TYPE_ASSIGNMENTS, createStringResource("ObjectType.ResourceType")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ConstructionAssignmentPanel constructionsPanel = new ConstructionAssignmentPanel(ID_ASSIGNMENTS, SwitchAssignmentTypePanel.this.getModel(), panelsMap.get("resourceAssignments")) {
private static final long serialVersionUID = 1L;
@Override
protected void assignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected void cancelAssignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected boolean isNewObjectButtonVisible(PrismObject focusObject) {
return !isReadonly() && super.isNewObjectButtonVisible(focusObject);
}
@Override
protected void refreshTable(AjaxRequestTarget ajaxRequestTarget) {
ajaxRequestTarget.add(SwitchAssignmentTypePanel.this);
}
};
constructionsPanel.setOutputMarkupId(true);
switchAssignmentTypePerformed(target, constructionsPanel, ID_RESOURCE_TYPE_ASSIGNMENTS);
}
};
resourceTypeAssignmentsButton.add(AttributeAppender.append("class", getButtonStyleModel(ID_RESOURCE_TYPE_ASSIGNMENTS)));
resourceTypeAssignmentsButton.setOutputMarkupId(true);
buttonsContainer.add(resourceTypeAssignmentsButton);
AjaxButton policyRuleTypeAssignmentsButton = new AjaxButton(ID_POLICY_RULE_TYPE_ASSIGNMENTS, createStringResource("AssignmentType.policyRule")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
PolicyRulesPanel policyRulesPanel = new PolicyRulesPanel(ID_ASSIGNMENTS, SwitchAssignmentTypePanel.this.getModel(), panelsMap.get("policyRuleAssignments")) {
private static final long serialVersionUID = 1L;
@Override
protected void assignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected void cancelAssignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected boolean isNewObjectButtonVisible(PrismObject focusObject) {
return !isReadonly() && super.isNewObjectButtonVisible(focusObject);
}
@Override
protected void refreshTable(AjaxRequestTarget ajaxRequestTarget) {
ajaxRequestTarget.add(SwitchAssignmentTypePanel.this);
}
};
policyRulesPanel.setOutputMarkupId(true);
switchAssignmentTypePerformed(target, policyRulesPanel, ID_POLICY_RULE_TYPE_ASSIGNMENTS);
}
};
policyRuleTypeAssignmentsButton.add(AttributeAppender.append("class", getButtonStyleModel(ID_POLICY_RULE_TYPE_ASSIGNMENTS)));
policyRuleTypeAssignmentsButton.setOutputMarkupId(true);
policyRuleTypeAssignmentsButton.add(new VisibleBehaviour(() -> isAssignmentPanelVisible()));
buttonsContainer.add(policyRuleTypeAssignmentsButton);
AjaxButton dataProtectionButton = new AjaxButton(ID_DATA_PROTECTION_ASSIGNMENTS, createStringResource("pageAdminFocus.dataProtection")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
GenericAbstractRoleAssignmentPanel dataProtectionPanel = new GenericAbstractRoleAssignmentPanel(ID_ASSIGNMENTS, SwitchAssignmentTypePanel.this.getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void assignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected void cancelAssignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected boolean isNewObjectButtonVisible(PrismObject focusObject) {
return !isReadonly() && super.isNewObjectButtonVisible(focusObject);
}
@Override
protected void refreshTable(AjaxRequestTarget ajaxRequestTarget) {
ajaxRequestTarget.add(SwitchAssignmentTypePanel.this);
}
};
dataProtectionPanel.setOutputMarkupId(true);
switchAssignmentTypePerformed(target, dataProtectionPanel, ID_DATA_PROTECTION_ASSIGNMENTS);
}
};
dataProtectionButton.add(AttributeAppender.append("class", getButtonStyleModel(ID_DATA_PROTECTION_ASSIGNMENTS)));
dataProtectionButton.setOutputMarkupId(true);
dataProtectionButton.add(new VisibleBehaviour(() -> WebModelServiceUtils.isEnableExperimentalFeature(SwitchAssignmentTypePanel.this.getPageBase())));
buttonsContainer.add(dataProtectionButton);
AjaxButton entitlementAssignmentsButton = new AjaxButton(ID_ENTITLEMENT_ASSIGNMENTS, createStringResource("AbstractRoleMainPanel.inducedEntitlements")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
InducedEntitlementsPanel entitlementAssignments = new InducedEntitlementsPanel(ID_ASSIGNMENTS, SwitchAssignmentTypePanel.this.getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void assignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected void cancelAssignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected void refreshTable(AjaxRequestTarget ajaxRequestTarget) {
ajaxRequestTarget.add(SwitchAssignmentTypePanel.this);
}
};
entitlementAssignments.setOutputMarkupId(true);
switchAssignmentTypePerformed(target, entitlementAssignments, ID_ENTITLEMENT_ASSIGNMENTS);
}
};
entitlementAssignmentsButton.add(AttributeAppender.append("class", getButtonStyleModel(ID_ENTITLEMENT_ASSIGNMENTS)));
entitlementAssignmentsButton.setOutputMarkupId(true);
entitlementAssignmentsButton.add(new VisibleBehaviour(() -> isAssignmentPanelVisible() && isInducement()));
buttonsContainer.add(entitlementAssignmentsButton);
AjaxButton focusMappingAssignmentsButton = new AjaxButton(ID_FOCUS_MAPPING_ASSIGNMENTS, createStringResource("AssignmentType.focusMappings")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
FocusMappingsAssignmentPanel assignmentPanel = new FocusMappingsAssignmentPanel(ID_ASSIGNMENTS, SwitchAssignmentTypePanel.this.getModel()) {
@Override
protected void assignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected void cancelAssignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected boolean isNewObjectButtonVisible(PrismObject focusObject) {
return false;
}
@Override
protected void refreshTable(AjaxRequestTarget ajaxRequestTarget) {
ajaxRequestTarget.add(SwitchAssignmentTypePanel.this);
}
};
assignmentPanel.setOutputMarkupId(true);
switchAssignmentTypePerformed(target, assignmentPanel, ID_FOCUS_MAPPING_ASSIGNMENTS);
}
};
focusMappingAssignmentsButton.add(AttributeAppender.append("class", getButtonStyleModel(ID_FOCUS_MAPPING_ASSIGNMENTS)));
focusMappingAssignmentsButton.setOutputMarkupId(true);
focusMappingAssignmentsButton.add(new VisibleBehaviour(() -> isAssignmentPanelVisible()));
buttonsContainer.add(focusMappingAssignmentsButton);
// GDPR feature.. temporary disabled MID-4281
AjaxIconButton consentsButton = new AjaxIconButton(ID_CONSENT_ASSIGNMENTS, createStringResource("fa fa-legal"), createStringResource("FocusType.consents")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
GdprAssignmentPanel gdprAssignmentPanel = new GdprAssignmentPanel(ID_ASSIGNMENTS, SwitchAssignmentTypePanel.this.getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void assignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected void cancelAssignmentDetailsPerformed(AjaxRequestTarget target) {
target.add(SwitchAssignmentTypePanel.this);
}
@Override
protected void refreshTable(AjaxRequestTarget ajaxRequestTarget) {
ajaxRequestTarget.add(SwitchAssignmentTypePanel.this);
}
};
gdprAssignmentPanel.setOutputMarkupId(true);
switchAssignmentTypePerformed(target, gdprAssignmentPanel, ID_CONSENT_ASSIGNMENTS);
}
};
consentsButton.setOutputMarkupId(true);
consentsButton.add(AttributeAppender.append("class", getButtonStyleModel(ID_CONSENT_ASSIGNMENTS)));
consentsButton.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return WebModelServiceUtils.isEnableExperimentalFeature(getPageBase());
}
});
buttonsContainer.add(consentsButton);
AjaxIconButton showAllAssignmentsButton = new AjaxIconButton(ID_SHOW_INDIRECT_ASSIGNMENTS, new Model<>("fa fa-address-card"), createStringResource("AssignmentTablePanel.menu.showAllAssignments")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
DirectAndIndirectAssignmentPanel directAndIndirectAssignmentPanel = new DirectAndIndirectAssignmentPanel(ID_ASSIGNMENTS, SwitchAssignmentTypePanel.this.getModel());
directAndIndirectAssignmentPanel.setOutputMarkupId(true);
switchAssignmentTypePerformed(target, directAndIndirectAssignmentPanel, ID_SHOW_INDIRECT_ASSIGNMENTS);
}
};
showAllAssignmentsButton.add(AttributeAppender.append("class", getButtonStyleModel(ID_SHOW_INDIRECT_ASSIGNMENTS)));
showAllAssignmentsButton.setOutputMarkupId(true);
showAllAssignmentsButton.add(new VisibleBehaviour(() -> !isInducement()));
buttonsContainer.add(showAllAssignmentsButton);
}
use of com.evolveum.midpoint.web.component.AjaxIconButton in project midpoint by Evolveum.
the class MultiButtonPanel method buildDefaultButton.
protected AjaxIconButton buildDefaultButton(String componentId, IModel<String> icon, IModel<String> title, IModel<String> cssClass, final AjaxEventProcessor onClickProcessor) {
AjaxIconButton btn = new AjaxIconButton(componentId, icon, title) {
@Override
public void onClick(AjaxRequestTarget target) {
if (onClickProcessor != null) {
onClickProcessor.onEventPerformed(target);
}
}
};
btn.showTitleAsLabel(true);
if (cssClass != null) {
btn.add(AttributeAppender.append("class", cssClass));
}
return btn;
}
use of com.evolveum.midpoint.web.component.AjaxIconButton in project midpoint by Evolveum.
the class AppendersContentPanel method createToolbarButtonsList.
@Override
protected List<Component> createToolbarButtonsList(String idButton) {
Component choice = createNewAppenderChoice(idButton);
AjaxIconButton newObjectIcon = new AjaxIconButton(idButton, Model.of("fa fa-plus"), Model.of("")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
newItemPerformed(target, null);
}
};
newObjectIcon.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isCreateNewObjectVisible();
}
@Override
public boolean isEnabled() {
return isNewObjectButtonEnabled();
}
});
newObjectIcon.add(AttributeModifier.append("class", createStyleClassModelForNewObjectIcon()));
return Arrays.asList(choice, newObjectIcon);
}
Aggregations