use of com.evolveum.midpoint.web.session.RoleCatalogStorage in project midpoint by Evolveum.
the class MultiButtonTable method addAssignmentPerformed.
private void addAssignmentPerformed(AssignmentEditorDto assignment, AjaxRequestTarget target) {
plusIconClicked = true;
RoleCatalogStorage storage = pageBase.getSessionStorage().getRoleCatalog();
if (storage.getAssignmentShoppingCart() == null) {
storage.setAssignmentShoppingCart(new ArrayList<AssignmentEditorDto>());
}
AssignmentEditorDto dto = assignment.clone();
dto.setDefaultRelation();
storage.getAssignmentShoppingCart().add(dto);
AssignmentCatalogPanel parent = MultiButtonTable.this.findParent(AssignmentCatalogPanel.class);
parent.reloadCartButton(target);
}
use of com.evolveum.midpoint.web.session.RoleCatalogStorage in project midpoint by Evolveum.
the class AbstractRoleMainPanel method initShoppingCartPanel.
private void initShoppingCartPanel(PageAdminObjectDetails<R> parentPage) {
RoleCatalogStorage storage = parentPage.getSessionStorage().getRoleCatalog();
WebMarkupContainer shoppingCartButtonsPanel = new WebMarkupContainer(ID_SHOPPING_CART_BUTTONS_PANEL);
shoppingCartButtonsPanel.setOutputMarkupId(true);
shoppingCartButtonsPanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
// Role Catalog page
return PageAssignmentShoppingKart.class.equals(getPreviousPage(parentPage));
}
});
getMainForm().add(shoppingCartButtonsPanel);
AjaxButton addToCartButton = new AjaxButton(ID_ADD_TO_CART_BUTTON, parentPage.createStringResource("PageAssignmentDetails.addToCartButton")) {
private static final long serialVersionUID = 1L;
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
}
@Override
public void onClick(AjaxRequestTarget target) {
AssignmentEditorDto dto = AssignmentEditorDto.createDtoFromObject(getObject().asObjectable(), UserDtoStatus.ADD, parentPage);
storage.getAssignmentShoppingCart().add(dto);
target.add(shoppingCartButtonsPanel);
}
};
addToCartButton.setOutputMarkupId(true);
addToCartButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
AssignmentEditorDto dto = AssignmentEditorDto.createDtoFromObject(getObject().asObjectable(), UserDtoStatus.ADD, parentPage);
return storage.isMultiUserRequest() || dto.isAssignable();
}
});
shoppingCartButtonsPanel.add(addToCartButton);
AjaxButton shoppingCartButton = new AjaxButton(ID_SHOPPING_CART_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
}
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
parentPage.navigateToNext(PageAssignmentsList.class);
}
};
shoppingCartButton.setOutputMarkupId(true);
shoppingCartButtonsPanel.add(shoppingCartButton);
Label cartItemsCount = new Label(ID_ITEMS_COUNT, new LoadableModel<String>(true) {
private static final long serialVersionUID = 1L;
@Override
public String load() {
return Integer.toString(storage.getAssignmentShoppingCart().size());
}
});
cartItemsCount.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
if (storage.getAssignmentShoppingCart().size() == 0) {
return false;
} else {
return true;
}
}
});
cartItemsCount.setOutputMarkupId(true);
shoppingCartButton.add(cartItemsCount);
}
use of com.evolveum.midpoint.web.session.RoleCatalogStorage in project midpoint by Evolveum.
the class PageAssignmentDetails method initLayout.
public void initLayout(final IModel<AssignmentEditorDto> assignmentModel) {
setOutputMarkupId(true);
Form mainForm = new Form(ID_FORM);
mainForm.setOutputMarkupId(true);
add(mainForm);
AssignmentDetailsPanel detailsPanel = new AssignmentDetailsPanel(ID_DETAILS_PANEL, assignmentModel, PageAssignmentDetails.this);
detailsPanel.setOutputMarkupId(true);
mainForm.add(detailsPanel);
AjaxButton back = new AjaxButton(ID_BACK, createStringResource("PageAssignmentDetails.backButton")) {
@Override
public void onClick(AjaxRequestTarget target) {
redirectBack();
}
};
mainForm.add(back);
AjaxButton addToCart = new AjaxButton(ID_ADD_TO_CART, createStringResource("PageAssignmentDetails.addToCartButton")) {
@Override
public void onClick(AjaxRequestTarget target) {
RoleCatalogStorage storage = getSessionStorage().getRoleCatalog();
if (storage.getAssignmentShoppingCart() == null) {
storage.setAssignmentShoppingCart(new ArrayList<AssignmentEditorDto>());
}
AssignmentEditorDto dto = assignmentModel.getObject();
dto.setMinimized(true);
dto.setSimpleView(false);
storage.getAssignmentShoppingCart().add(dto);
redirectBack();
}
};
mainForm.add(addToCart);
}
Aggregations