Search in sources :

Example 1 with ListItem

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

the class DropdownButtonPanel method initLayout.

private void initLayout(DropdownButtonDto model) {
    Label info = new Label(ID_INFO, model.getInfo());
    add(info);
    Label label = new Label(ID_LABEL, model.getLabel());
    add(label);
    WebMarkupContainer icon = new WebMarkupContainer(ID_ICON);
    icon.add(AttributeModifier.append("class", model.getIcon()));
    add(icon);
    ListView<InlineMenuItem> li = new ListView<InlineMenuItem>(ID_MENU_ITEM, new Model((Serializable) model.getMenuItems())) {

        @Override
        protected void populateItem(ListItem<InlineMenuItem> item) {
            initMenuItem(item);
        }
    };
    add(li);
}
Also used : Serializable(java.io.Serializable) ListView(org.apache.wicket.markup.html.list.ListView) Label(org.apache.wicket.markup.html.basic.Label) Model(org.apache.wicket.model.Model) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ListItem(org.apache.wicket.markup.html.list.ListItem) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 2 with ListItem

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

the class OperationResultPanel method initParams.

private void initParams(WebMarkupContainer operationContent, final IModel<OpResult> model, Page parentPage) {
    Label paramsLabel = new Label("paramsLabel", parentPage.getString("FeedbackAlertMessageDetails.params"));
    paramsLabel.setOutputMarkupId(true);
    paramsLabel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return CollectionUtils.isNotEmpty(model.getObject().getParams());
        }
    });
    operationContent.add(paramsLabel);
    ListView<Param> params = new ListView<Param>(ID_PARAMS, createParamsModel(model)) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<Param> item) {
            item.add(new Label("paramName", new PropertyModel<Object>(item.getModel(), "name")));
            item.add(new Label("paramValue", new PropertyModel<Object>(item.getModel(), "value")));
        }
    };
    params.setOutputMarkupId(true);
    params.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return CollectionUtils.isNotEmpty(model.getObject().getParams());
        }
    });
    operationContent.add(params);
    ListView<OpResult> subresults = new ListView<OpResult>("subresults", createSubresultsModel(model)) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final ListItem<OpResult> item) {
            Panel subresult = new OperationResultPanel("subresult", item.getModel(), getPage());
            subresult.setOutputMarkupId(true);
            item.add(subresult);
        }
    };
    subresults.setOutputMarkupId(true);
    subresults.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return CollectionUtils.isNotEmpty(model.getObject().getSubresults());
        }
    });
    operationContent.add(subresults);
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) PropertyModel(org.apache.wicket.model.PropertyModel) Panel(org.apache.wicket.markup.html.panel.Panel) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) ListView(org.apache.wicket.markup.html.list.ListView) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 3 with ListItem

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

the class OperationResultPanel method initContexts.

private void initContexts(WebMarkupContainer operationContent, final IModel<OpResult> model, Page parentPage) {
    Label contextsLabel = new Label("contextsLabel", parentPage.getString("FeedbackAlertMessageDetails.contexts"));
    contextsLabel.setOutputMarkupId(true);
    contextsLabel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return CollectionUtils.isNotEmpty(model.getObject().getContexts());
        }
    });
    operationContent.add(contextsLabel);
    ListView<Context> contexts = new ListView<Context>("contexts", createContextsModel(model)) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<Context> item) {
            item.add(new Label("contextName", new PropertyModel<Object>(item.getModel(), "name")));
            item.add(new Label("contextValue", new PropertyModel<Object>(item.getModel(), "value")));
        }
    };
    contexts.setOutputMarkupId(true);
    contexts.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return CollectionUtils.isNotEmpty(model.getObject().getContexts());
        }
    });
    operationContent.add(contexts);
}
Also used : ListView(org.apache.wicket.markup.html.list.ListView) Label(org.apache.wicket.markup.html.basic.Label) PropertyModel(org.apache.wicket.model.PropertyModel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 4 with ListItem

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

the class FocusProjectionsTabPanel method initLayout.

private void initLayout(final PageBase page) {
    final WebMarkupContainer shadows = new WebMarkupContainer(ID_SHADOWS);
    shadows.setOutputMarkupId(true);
    add(shadows);
    InlineMenu accountMenu = new InlineMenu(ID_SHADOW_MENU, new Model((Serializable) createShadowMenu()));
    accountMenu.setVisible(!getObjectWrapper().isReadonly());
    shadows.add(accountMenu);
    final ListView<FocusSubwrapperDto<ShadowType>> projectionList = new ListView<FocusSubwrapperDto<ShadowType>>(ID_SHADOW_LIST, projectionModel) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final ListItem<FocusSubwrapperDto<ShadowType>> item) {
            PackageResourceReference packageRef;
            final FocusSubwrapperDto<ShadowType> dto = item.getModelObject();
            final PropertyModel<ObjectWrapper<F>> objectWrapperModel = new PropertyModel<ObjectWrapper<F>>(item.getModel(), "object");
            final Panel shadowPanel;
            if (dto.isLoadedOK()) {
                packageRef = new PackageResourceReference(ImgResources.class, ImgResources.HDD_PRISM);
                shadowPanel = new PrismObjectPanel<F>(ID_SHADOW, new PropertyModel<ObjectWrapper<F>>(item.getModel(), "object"), packageRef, getMainForm(), getPageBase());
            } else {
                shadowPanel = new SimpleErrorPanel<ShadowType>(ID_SHADOW, item.getModel()) {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onShowMorePerformed(AjaxRequestTarget target) {
                        OperationResult fetchResult = dto.getResult();
                        if (fetchResult != null) {
                            showResult(fetchResult);
                            target.add(page.getFeedbackPanel());
                        }
                    }
                };
            }
            shadowPanel.setOutputMarkupId(true);
            shadowPanel.add(new VisibleEnableBehaviour() {

                private static final long serialVersionUID = 1L;

                @Override
                public boolean isVisible() {
                    FocusSubwrapperDto<ShadowType> shadowWrapperDto = item.getModelObject();
                    ObjectWrapper<ShadowType> shadowWrapper = shadowWrapperDto.getObject();
                    return !shadowWrapper.isMinimalized();
                }
            });
            item.add(shadowPanel);
            CheckTableHeader<F> shadowHeader = new CheckTableHeader<F>(ID_SHADOW_HEADER, objectWrapperModel) {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onClickPerformed(AjaxRequestTarget target) {
                    super.onClickPerformed(target);
                    onExpandCollapse(target, item.getModel());
                    target.add(shadows);
                }
            };
            if (item.getModel().getObject().getStatus().equals(UserDtoStatus.DELETE)) {
                shadowHeader.add(new AttributeModifier("class", "box-header with-border delete"));
            }
            item.add(shadowHeader);
        }
    };
    AjaxCheckBox accountCheckAll = new AjaxCheckBox(ID_SHADOW_CHECK_ALL, new Model()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            for (FocusSubwrapperDto<ShadowType> dto : projectionList.getModelObject()) {
                if (dto.isLoadedOK()) {
                    ObjectWrapper<ShadowType> accModel = dto.getObject();
                    accModel.setSelected(getModelObject());
                }
            }
            target.add(shadows);
        }
    };
    shadows.add(accountCheckAll);
    shadows.add(projectionList);
}
Also used : Serializable(java.io.Serializable) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ImgResources(com.evolveum.midpoint.web.resource.img.ImgResources) ListView(org.apache.wicket.markup.html.list.ListView) FocusSubwrapperDto(com.evolveum.midpoint.web.page.admin.users.dto.FocusSubwrapperDto) PackageResourceReference(org.apache.wicket.request.resource.PackageResourceReference) InlineMenu(com.evolveum.midpoint.web.component.menu.cog.InlineMenu) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) PropertyModel(org.apache.wicket.model.PropertyModel) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) AttributeModifier(org.apache.wicket.AttributeModifier) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ConfirmationPanel(com.evolveum.midpoint.web.component.dialog.ConfirmationPanel) Panel(org.apache.wicket.markup.html.panel.Panel) ObjectBrowserPanel(com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 5 with ListItem

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

the class ActionsExecutedInformationPanel method initLayout.

protected void initLayout() {
    WebMarkupContainer tableLinesContainer = new WebMarkupContainer(ID_OBJECTS_TABLE_LINES_CONTAINER);
    ListView tableLines = new ListView<ActionsExecutedObjectsTableLineDto>(ID_OBJECTS_TABLE_LINES, new AbstractReadOnlyModel<List<ActionsExecutedObjectsTableLineDto>>() {

        @Override
        public List<ActionsExecutedObjectsTableLineDto> getObject() {
            final ActionsExecutedInformationDto modelObject = getModelObject();
            if (modelObject == null) {
                return new ArrayList<>();
            }
            if (showResultingActionsOnly) {
                return modelObject.getUniqueObjectsTableLines();
            } else {
                return modelObject.getObjectsTableLines();
            }
        }
    }) {

        protected void populateItem(final ListItem<ActionsExecutedObjectsTableLineDto> item) {
            item.add(new Label(ID_OBJECT_TYPE, new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    String key = item.getModelObject().getObjectTypeLocalizationKey();
                    if (key != null) {
                        return createStringResource(key).getString();
                    } else {
                        return item.getModelObject().getObjectType().getLocalPart();
                    }
                }
            }));
            item.add(new Label(ID_OPERATION, new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    return createStringResource(item.getModelObject().getOperation()).getString();
                }
            }));
            item.add(new Label(ID_CHANNEL, new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    String channel = item.getModelObject().getChannel();
                    if (channel != null && !channel.isEmpty()) {
                        String key = "Channel." + channel;
                        return createStringResource(key).getString();
                    } else {
                        return "";
                    }
                }
            }));
            item.add(new Label(ID_SUCCESS_COUNT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_SUCCESS_COUNT)));
            item.add(new Label(ID_LAST_SUCCESS_OBJECT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_LAST_SUCCESS_OBJECT)));
            item.add(new Label(ID_LAST_SUCCESS_TIMESTAMP, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_LAST_SUCCESS_TIMESTAMP)));
            item.add(new Label(ID_FAILURE_COUNT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_FAILURE_COUNT)));
        }
    };
    tableLinesContainer.add(tableLines);
    tableLinesContainer.setOutputMarkupId(true);
    add(tableLinesContainer);
    final Label showResultingActionsOnlyLabel = new Label(ID_SHOW_RESULTING_ACTIONS_ONLY_LABEL, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return showResultingActionsOnly ? createStringResource("ActionsExecutedInformationPanel.showingResultingActionsOnly").getString() : createStringResource("ActionsExecutedInformationPanel.showingAllActions").getString();
        }
    });
    showResultingActionsOnlyLabel.setOutputMarkupId(true);
    add(showResultingActionsOnlyLabel);
    add(new AjaxFallbackLink<String>(ID_SHOW_RESULTING_ACTIONS_ONLY_LINK) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            showResultingActionsOnly = !showResultingActionsOnly;
            ajaxRequestTarget.add(ActionsExecutedInformationPanel.this);
        }
    });
    add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getModelObject() != null;
        }
    });
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) ActionsExecutedInformationDto(com.evolveum.midpoint.web.page.admin.server.dto.ActionsExecutedInformationDto) Label(org.apache.wicket.markup.html.basic.Label) PropertyModel(org.apache.wicket.model.PropertyModel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ListView(org.apache.wicket.markup.html.list.ListView) ArrayList(java.util.ArrayList) List(java.util.List) ListItem(org.apache.wicket.markup.html.list.ListItem) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Aggregations

ListItem (org.apache.wicket.markup.html.list.ListItem)127 ListView (org.apache.wicket.markup.html.list.ListView)103 Label (org.apache.wicket.markup.html.basic.Label)79 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)70 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)69 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)40 IModel (org.apache.wicket.model.IModel)40 List (java.util.List)38 ArrayList (java.util.ArrayList)37 PropertyModel (org.apache.wicket.model.PropertyModel)28 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)23 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)23 TextField (org.apache.wicket.markup.html.form.TextField)15 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)14 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)14 QName (javax.xml.namespace.QName)13 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)13 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)11 AttributeModifier (org.apache.wicket.AttributeModifier)11 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)10