Search in sources :

Example 81 with WebMarkupContainer

use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.

the class AssignmentEditorPanel method showEmptyPerformed.

private void showEmptyPerformed(AjaxRequestTarget target) {
    AssignmentEditorDto dto = AssignmentEditorPanel.this.getModel().getObject();
    dto.setShowEmpty(!dto.isShowEmpty());
    WebMarkupContainer parent = (WebMarkupContainer) get(createComponentPath(ID_BODY, ID_CONSTRUCTION_CONTAINER));
    target.add(parent.get(ID_ATTRIBUTES), parent.get(createComponentPath(ID_SHOW_EMPTY, ID_SHOW_EMPTY_LABEL)), getPageBase().getFeedbackPanel());
}
Also used : WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 82 with WebMarkupContainer

use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.

the class LockoutStatusPanel method initLayout.

private void initLayout(final IModel<LockoutStatusType> model) {
    WebMarkupContainer container = new WebMarkupContainer(ID_CONTAINER);
    add(container);
    Label label = new Label(ID_LABEL, new IModel<String>() {

        @Override
        public String getObject() {
            LockoutStatusType object = model != null ? model.getObject() : null;
            String labelValue = object == null ? ((PageBase) getPage()).createStringResource("LockoutStatusType.UNDEFINED").getString() : WebComponentUtil.createLocalizedModelForEnum(object, getLabel()).getObject();
            if (!isInitialState) {
                labelValue += " " + ((PageBase) getPage()).createStringResource("LockoutStatusPanel.changesSaving").getString();
            }
            return labelValue;
        }

        @Override
        public void setObject(String s) {
        }

        @Override
        public void detach() {
        }
    });
    label.setOutputMarkupId(true);
    container.add(label);
    AjaxButton button = new AjaxButton(ID_BUTTON, getButtonModel()) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            PrismPropertyValue oldValue = (PrismPropertyValue) valueWrapper.getOldValue();
            if (!isInitialState) {
                model.setObject(initialValue);
                oldValue.setValue(initialValue);
                valueWrapper.setStatus(ValueStatus.NOT_CHANGED);
            } else {
                model.setObject(LockoutStatusType.NORMAL);
                if (oldValue.getValue() != null) {
                    oldValue.setValue(null);
                }
            }
            isInitialState = !isInitialState;
            ajaxRequestTarget.add(getButton());
            ajaxRequestTarget.add(getLabel());
        }
    };
    button.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return true;
        }
    });
    button.setOutputMarkupId(true);
    container.add(button);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Label(org.apache.wicket.markup.html.basic.Label) LockoutStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.LockoutStatusType) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) PrismPropertyValue(com.evolveum.midpoint.prism.PrismPropertyValue)

Example 83 with WebMarkupContainer

use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.

the class AssignmentCatalogPanel method initLayout.

private void initLayout() {
    initModels();
    initProvider();
    setOutputMarkupId(true);
    initHeaderPanel();
    WebMarkupContainer panelContainer = new WebMarkupContainer(ID_CATALOG_ITEMS_PANEL_CONTAINER);
    panelContainer.setOutputMarkupId(true);
    add(panelContainer);
    addOrReplaceLayout(null, panelContainer);
}
Also used : WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 84 with WebMarkupContainer

use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.

the class AssignmentCatalogPanel method addOrReplaceLayout.

public void addOrReplaceLayout(AjaxRequestTarget target, WebMarkupContainer panelContainer) {
    WebMarkupContainer treePanelContainer = new WebMarkupContainer(ID_TREE_PANEL_CONTAINER);
    treePanelContainer.setOutputMarkupId(true);
    panelContainer.addOrReplace(treePanelContainer);
    if (AssignmentViewType.ROLE_CATALOG_VIEW.equals(AssignmentViewType.getViewTypeFromSession(pageBase)) && StringUtils.isNotEmpty(rootOid)) {
        // not let tree panel initializing in case of empty role catalog oid
        OrgTreePanel treePanel = new OrgTreePanel(ID_TREE_PANEL, Model.of(rootOid), false, "AssignmentShoppingCartPanel.treeTitle") {

            private static final long serialVersionUID = 1L;

            @Override
            protected void selectTreeItemPerformed(SelectableBean<OrgType> selected, AjaxRequestTarget target) {
                AssignmentCatalogPanel.this.selectTreeItemPerformed(selected, target);
            }

            protected List<InlineMenuItem> createTreeMenu() {
                return new ArrayList<>();
            }

            @Override
            protected List<InlineMenuItem> createTreeChildrenMenu(OrgType org) {
                return new ArrayList<>();
            }

            @Override
            protected OrgTreeStateStorage getOrgTreeStateStorage() {
                return getRoleCatalogStorage();
            }
        };
        treePanel.setOutputMarkupId(true);
        treePanelContainer.add(new AttributeAppender("class", "col-md-3"));
        treePanelContainer.add(new VisibleEnableBehaviour() {

            private static final long serialVersionUID = 1L;

            @Override
            public boolean isVisible() {
                return !isCatalogOidEmpty();
            }
        });
        treePanelContainer.addOrReplace(treePanel);
    } else {
        WebMarkupContainer treePanel = new WebMarkupContainer(ID_TREE_PANEL);
        treePanel.setVisible(false);
        treePanel.setOutputMarkupId(true);
        treePanelContainer.addOrReplace(treePanel);
    }
    WebMarkupContainer catalogItemsPanelContainer = new WebMarkupContainer(ID_CATALOG_ITEMS_PANEL_CONTAINER);
    catalogItemsPanelContainer.setOutputMarkupId(true);
    panelContainer.addOrReplace(catalogItemsPanelContainer);
    String assignmentsOwnerName = getRoleCatalogStorage().getAssignmentsUserOwner() != null ? getRoleCatalogStorage().getAssignmentsUserOwner().getName().getOrig() : "";
    Label assignmentsOwnerLabel = new Label(ID_ASSIGNMENTS_OWNER_NAME, createStringResource("AssignmentCatalogPanel.assignmentsOwner", assignmentsOwnerName));
    assignmentsOwnerLabel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return AssignmentViewType.USER_TYPE.equals(getRoleCatalogStorage().getViewType());
        }
    });
    catalogItemsPanelContainer.add(assignmentsOwnerLabel);
    CatalogItemsPanel catalogItemsPanel;
    if (AssignmentViewType.USER_TYPE.equals(viewModel.getObject())) {
        PrismObject<UserType> assignmentsOwner = getRoleCatalogStorage().getAssignmentsUserOwner();
        listProviderData = new ArrayList<>();
        if (assignmentsOwner != null) {
            List<AssignmentType> assignments = assignmentsOwner.asObjectable().getAssignment();
            for (AssignmentType assignment : assignments) {
                if (assignment.getTargetRef() == null || !UserType.COMPLEX_TYPE.equals(assignment.getTargetRef().getType())) {
                    assignment.setId(null);
                    listProviderData.add(new AssignmentEditorDto(UserDtoStatus.MODIFY, assignment, pageBase));
                }
            }
            Collections.sort(listProviderData);
        }
        ListDataProvider listDataProvider = new ListDataProvider(this, Model.ofList(listProviderData));
        catalogItemsPanel = new CatalogItemsPanel(ID_CATALOG_ITEMS_PANEL, pageBase, itemsPerRow, listDataProvider);
    } else {
        catalogItemsPanel = new CatalogItemsPanel(ID_CATALOG_ITEMS_PANEL, selectedTreeItemOidModel, pageBase, itemsPerRow, objectProvider);
    }
    if (AssignmentViewType.ROLE_CATALOG_VIEW.equals(AssignmentViewType.getViewTypeFromSession(pageBase))) {
        catalogItemsPanelContainer.add(new AttributeAppender("class", "col-md-9"));
    } else {
        catalogItemsPanelContainer.add(new AttributeAppender("class", "col-md-12"));
    }
    catalogItemsPanel.setOutputMarkupId(true);
    catalogItemsPanelContainer.addOrReplace(catalogItemsPanel);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) Label(org.apache.wicket.markup.html.basic.Label) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) OrgTreePanel(com.evolveum.midpoint.web.page.admin.orgs.OrgTreePanel) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 85 with WebMarkupContainer

use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.

the class AssignmentEditorPanel method initAttributesLayout.

private void initAttributesLayout(WebMarkupContainer constructionContainer) {
    WebMarkupContainer attributes = new WebMarkupContainer(ID_ATTRIBUTES);
    attributes.setOutputMarkupId(true);
    attributes.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            AssignmentEditorDto dto = getModel().getObject();
            return AssignmentEditorDtoType.CONSTRUCTION.equals(dto.getType());
        }
    });
    attributes.setEnabled(getModel().getObject().isEditable());
    constructionContainer.add(attributes);
    ListView<ACAttributeDto> attribute = new ListView<ACAttributeDto>(ID_ATTRIBUTE, attributesModel) {

        @Override
        protected void populateItem(ListItem<ACAttributeDto> listItem) {
            final IModel<ACAttributeDto> attrModel = listItem.getModel();
            ACAttributePanel acAttribute = new ACAttributePanel(ID_AC_ATTRIBUTE, attrModel, ignoreMandatoryAttributes());
            acAttribute.setRenderBodyOnly(true);
            listItem.add(acAttribute);
            listItem.setOutputMarkupId(true);
            listItem.add(new VisibleEnableBehaviour() {

                @Override
                public boolean isVisible() {
                    AssignmentEditorDto editorDto = AssignmentEditorPanel.this.getModel().getObject();
                    if (editorDto.isShowEmpty()) {
                        return true;
                    }
                    ACAttributeDto dto = attrModel.getObject();
                    return !dto.isEmpty();
                }
            });
        }
    };
    attributes.add(attribute);
// todo extension
}
Also used : ListView(org.apache.wicket.markup.html.list.ListView) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ListItem(org.apache.wicket.markup.html.list.ListItem) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Aggregations

WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)227 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)106 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)101 Label (org.apache.wicket.markup.html.basic.Label)98 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)59 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)44 List (java.util.List)43 ListItem (org.apache.wicket.markup.html.list.ListItem)43 ArrayList (java.util.ArrayList)41 ListView (org.apache.wicket.markup.html.list.ListView)39 PropertyModel (org.apache.wicket.model.PropertyModel)34 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)26 TextField (org.apache.wicket.markup.html.form.TextField)25 IModel (org.apache.wicket.model.IModel)22 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)21 AttributeModifier (org.apache.wicket.AttributeModifier)21 Form (org.apache.wicket.markup.html.form.Form)21 Model (org.apache.wicket.model.Model)18 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)17 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)16