Search in sources :

Example 1 with AssignmentDetailsPanel

use of com.evolveum.midpoint.web.component.assignment.AssignmentDetailsPanel 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);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) AssignmentEditorDto(com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto) Form(com.evolveum.midpoint.web.component.form.Form) RoleCatalogStorage(com.evolveum.midpoint.web.session.RoleCatalogStorage) AssignmentDetailsPanel(com.evolveum.midpoint.web.component.assignment.AssignmentDetailsPanel)

Aggregations

AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)1 AssignmentDetailsPanel (com.evolveum.midpoint.web.component.assignment.AssignmentDetailsPanel)1 AssignmentEditorDto (com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto)1 Form (com.evolveum.midpoint.web.component.form.Form)1 RoleCatalogStorage (com.evolveum.midpoint.web.session.RoleCatalogStorage)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1