Search in sources :

Example 1 with ListView

use of org.apache.wicket.markup.html.list.ListView in project wiquery by WiQuery.

the class WiQueryTester method getListView.

public ListView<?> getListView(String path) {
    Page renderedPage = getLastRenderedPage();
    assertComponent(path, ListView.class);
    ListView<?> rv = (ListView<?>) renderedPage.get(path);
    return rv;
}
Also used : ListView(org.apache.wicket.markup.html.list.ListView) Page(org.apache.wicket.Page)

Example 2 with ListView

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

the class PrismValuePanel method removeValue.

private void removeValue(AjaxRequestTarget target) {
    ValueWrapper wrapper = valueWrapperModel.getObject();
    ItemWrapper propertyWrapper = wrapper.getItem();
    LOGGER.debug("Removing value of {}", propertyWrapper);
    List<ValueWrapper> values = propertyWrapper.getValues();
    Component inputPanel = this.get(ID_VALUE_CONTAINER).get(ID_INPUT);
    switch(wrapper.getStatus()) {
        case ADDED:
            values.remove(wrapper);
            break;
        case DELETED:
            error("Couldn't delete already deleted item: " + wrapper.toString());
            target.add(((PageBase) getPage()).getFeedbackPanel());
        case NOT_CHANGED:
            if (inputPanel instanceof AssociationValueChoicePanel) {
                ((PropertyWrapper) propertyWrapper).setStatus(ValueStatus.DELETED);
            }
            wrapper.setStatus(ValueStatus.DELETED);
            break;
    }
    //        wrapper.getItem().getContainer().
    int count = countUsableValues(propertyWrapper);
    if (count == 0 && !hasEmptyPlaceholder(propertyWrapper)) {
        if (inputPanel instanceof ValueChoosePanel) {
            values.add(new ValueWrapper(propertyWrapper, new PrismReferenceValue(null), ValueStatus.ADDED));
        } else if (inputPanel instanceof AssociationValueChoicePanel) {
            Item item = propertyWrapper.getItem();
            ItemPath path = item.getPath();
            if (path != null) {
            }
        //                values.add(new ValueWrapper(propertyWrapper, new PrismPropertyValue(null), ValueStatus.ADDED));
        } else {
            values.add(new ValueWrapper(propertyWrapper, new PrismPropertyValue(null), ValueStatus.ADDED));
        }
    }
    ListView parent = findParent(ListView.class);
    target.add(parent.getParent());
}
Also used : ListView(org.apache.wicket.markup.html.list.ListView) AssociationValueChoicePanel(com.evolveum.midpoint.web.page.admin.users.component.AssociationValueChoicePanel) ValueChoosePanel(com.evolveum.midpoint.web.component.form.ValueChoosePanel) Component(org.apache.wicket.Component) FormComponent(org.apache.wicket.markup.html.form.FormComponent) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 3 with ListView

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

the class ScenePanel method initLayout.

private void initLayout() {
    final IModel<SceneDto> model = getModel();
    WebMarkupContainer box = new WebMarkupContainer(ID_BOX);
    box.add(AttributeModifier.append("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            SceneDto dto = model.getObject();
            if (dto.getBoxClassOverride() != null) {
                return dto.getBoxClassOverride();
            }
            if (dto.getChangeType() == null) {
                return null;
            }
            switch(dto.getChangeType()) {
                case ADD:
                    return "box-success";
                case DELETE:
                    return "box-danger";
                case MODIFY:
                    return "box-info";
                default:
                    return null;
            }
        }
    }));
    add(box);
    WebMarkupContainer headerPanel = new WebMarkupContainer(ID_HEADER_PANEL);
    box.add(headerPanel);
    headerPanel.add(new SceneButtonPanel(ID_OPTION_BUTTONS, model) {

        @Override
        public void minimizeOnClick(AjaxRequestTarget target) {
            headerOnClickPerformed(target, model);
        }
    });
    Label headerChangeType = new Label(ID_HEADER_CHANGE_TYPE, new ChangeTypeModel());
    //headerChangeType.setRenderBodyOnly(true);
    Label headerObjectType = new Label(ID_HEADER_OBJECT_TYPE, new ObjectTypeModel());
    //headerObjectType.setRenderBodyOnly(true);
    IModel<String> nameModel = new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return model.getObject().getName(ScenePanel.this);
        }
    };
    Label headerNameLabel = new Label(ID_HEADER_NAME_LABEL, nameModel);
    LinkPanel headerNameLink = new LinkPanel(ID_HEADER_NAME_LINK, nameModel) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            PrismContainerValue<?> value = getModelObject().getScene().getSourceValue();
            if (value != null && value.getParent() instanceof PrismObject) {
                PrismObject<? extends ObjectType> object = (PrismObject<? extends ObjectType>) value.getParent();
                WebComponentUtil.dispatchToObjectDetailsPage(ObjectTypeUtil.createObjectRef(object), getPageBase(), false);
            }
        }
    };
    Label headerDescription = new Label(ID_HEADER_DESCRIPTION, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return model.getObject().getDescription(ScenePanel.this);
        }
    });
    Label headerWrapperDisplayName = new Label(ID_HEADER_WRAPPER_DISPLAY_NAME, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            String key = ((WrapperScene) getModelObject().getScene()).getDisplayNameKey();
            Object[] parameters = ((WrapperScene) getModelObject().getScene()).getDisplayNameParameters();
            return new StringResourceModel(key, this).setModel(null).setDefaultValue(key).setParameters(parameters).getObject();
        }
    });
    headerPanel.add(headerChangeType);
    headerPanel.add(headerObjectType);
    headerPanel.add(headerNameLabel);
    headerPanel.add(headerNameLink);
    headerPanel.add(headerDescription);
    headerPanel.add(headerWrapperDisplayName);
    headerChangeType.add(createHeaderOnClickBehaviour(model));
    headerObjectType.add(createHeaderOnClickBehaviour(model));
    headerNameLabel.add(createHeaderOnClickBehaviour(model));
    headerDescription.add(createHeaderOnClickBehaviour(model));
    headerWrapperDisplayName.add(createHeaderOnClickBehaviour(model));
    VisibleEnableBehaviour visibleIfNotWrapper = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !getModelObject().isWrapper();
        }
    };
    VisibleEnableBehaviour visibleIfWrapper = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getModelObject().isWrapper();
        }
    };
    VisibleEnableBehaviour visibleIfExistingObject = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            if (getModelObject().isWrapper()) {
                return false;
            }
            return isExistingViewableObject();
        }
    };
    VisibleEnableBehaviour visibleIfNotWrapperAndNotExistingObject = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            if (getModelObject().isWrapper()) {
                return false;
            }
            return !isExistingViewableObject();
        }
    };
    headerChangeType.add(visibleIfNotWrapper);
    headerObjectType.add(visibleIfNotWrapper);
    headerNameLabel.add(visibleIfNotWrapperAndNotExistingObject);
    headerNameLink.add(visibleIfExistingObject);
    headerDescription.add(visibleIfNotWrapper);
    headerWrapperDisplayName.add(visibleIfWrapper);
    WebMarkupContainer body = new WebMarkupContainer(ID_BODY);
    body.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            SceneDto wrapper = model.getObject();
            return !wrapper.isMinimized();
        }
    });
    box.add(body);
    WebMarkupContainer itemsTable = new WebMarkupContainer(ID_ITEMS_TABLE);
    itemsTable.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !model.getObject().getItems().isEmpty();
        }
    });
    WebMarkupContainer oldValueLabel = new WebMarkupContainer(ID_OLD_VALUE_LABEL);
    oldValueLabel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return model.getObject().containsDeltaItems();
        }
    });
    itemsTable.add(oldValueLabel);
    WebMarkupContainer newValueLabel = new WebMarkupContainer(ID_NEW_VALUE_LABEL);
    newValueLabel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return model.getObject().containsDeltaItems();
        }
    });
    itemsTable.add(newValueLabel);
    WebMarkupContainer valueLabel = new WebMarkupContainer(ID_VALUE_LABEL);
    valueLabel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !model.getObject().containsDeltaItems();
        }
    });
    itemsTable.add(valueLabel);
    ListView<SceneItemDto> items = new ListView<SceneItemDto>(ID_ITEMS, new PropertyModel<List<SceneItemDto>>(model, SceneDto.F_ITEMS)) {

        @Override
        protected void populateItem(ListItem<SceneItemDto> item) {
            SceneItemPanel panel = new SceneItemPanel(ID_ITEM, item.getModel());
            panel.setRenderBodyOnly(true);
            item.add(panel);
        }
    };
    items.setReuseItems(true);
    itemsTable.add(items);
    body.add(itemsTable);
    ListView<SceneDto> partialScenes = new ListView<SceneDto>(ID_PARTIAL_SCENES, new PropertyModel<List<SceneDto>>(model, SceneDto.F_PARTIAL_SCENES)) {

        @Override
        protected void populateItem(ListItem<SceneDto> item) {
            ScenePanel panel = new ScenePanel(ID_PARTIAL_SCENE, item.getModel());
            panel.setOutputMarkupPlaceholderTag(true);
            item.add(panel);
        }
    };
    partialScenes.setReuseItems(true);
    body.add(partialScenes);
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) LinkPanel(com.evolveum.midpoint.web.component.data.column.LinkPanel) PrismObject(com.evolveum.midpoint.prism.PrismObject) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) ListView(org.apache.wicket.markup.html.list.ListView) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 4 with ListView

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

the class SearchPanel method initLayout.

private void initLayout() {
    moreDialogModel = new LoadableModel<MoreDialogDto>(false) {

        @Override
        protected MoreDialogDto load() {
            MoreDialogDto dto = new MoreDialogDto();
            dto.setProperties(createPropertiesList());
            return dto;
        }
    };
    Form form = new Form(ID_FORM);
    add(form);
    ListView items = new ListView<SearchItem>(ID_ITEMS, new PropertyModel<List<SearchItem>>(getModel(), Search.F_ITEMS)) {

        @Override
        protected void populateItem(ListItem<SearchItem> item) {
            SearchItemPanel searchItem = new SearchItemPanel(ID_ITEM, item.getModel());
            item.add(searchItem);
        }
    };
    items.add(createVisibleBehaviour(SearchBoxModeType.BASIC));
    form.add(items);
    WebMarkupContainer moreGroup = new WebMarkupContainer(ID_MORE_GROUP);
    moreGroup.add(createVisibleBehaviour(SearchBoxModeType.BASIC));
    form.add(moreGroup);
    AjaxLink more = new AjaxLink(ID_MORE) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            Component button = SearchPanel.this.get(createComponentPath(ID_FORM, ID_MORE_GROUP, ID_MORE));
            Component popover = SearchPanel.this.get(createComponentPath(ID_POPOVER));
            togglePopover(target, button, popover, 14);
        }
    };
    more.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            Search search = getModelObject();
            return !search.getAvailableDefinitions().isEmpty();
        }
    });
    more.setOutputMarkupId(true);
    moreGroup.add(more);
    WebMarkupContainer searchContainer = new WebMarkupContainer(ID_SEARCH_CONTAINER);
    searchContainer.setOutputMarkupId(true);
    form.add(searchContainer);
    AjaxSubmitButton searchSimple = new AjaxSubmitButton(ID_SEARCH_SIMPLE) {

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.add(form);
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            searchPerformed(target);
        }
    };
    searchSimple.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            if (SearchBoxModeType.BASIC.equals(getModelObject().getSearchType()) || SearchBoxModeType.FULLTEXT.equals(getModelObject().getSearchType())) {
                return true;
            }
            return false;
        }

        @Override
        public boolean isVisible() {
            return SearchBoxModeType.BASIC.equals(getModelObject().getSearchType()) || SearchBoxModeType.FULLTEXT.equals(getModelObject().getSearchType());
        }
    });
    searchSimple.setOutputMarkupId(true);
    searchContainer.add(searchSimple);
    WebMarkupContainer searchDropdown = new WebMarkupContainer(ID_SEARCH_DROPDOWN);
    searchDropdown.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return SearchBoxModeType.ADVANCED.equals(getModelObject().getSearchType()) && queryPlagroundAccessible;
        }
    });
    searchContainer.add(searchDropdown);
    AjaxSubmitButton searchButtonBeforeDropdown = new AjaxSubmitButton(ID_SEARCH_BUTTON_BEFORE_DROPDOWN) {

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.add(form);
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            searchPerformed(target);
        }
    };
    searchButtonBeforeDropdown.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            if (SearchBoxModeType.BASIC.equals(getModelObject().getSearchType()) || SearchBoxModeType.FULLTEXT.equals(getModelObject().getSearchType())) {
                return true;
            }
            Search search = getModelObject();
            PrismContext ctx = getPageBase().getPrismContext();
            return search.isAdvancedQueryValid(ctx);
        }
    });
    searchDropdown.add(searchButtonBeforeDropdown);
    List<InlineMenuItem> searchItems = new ArrayList<>();
    InlineMenuItem searchItem = new InlineMenuItem(createStringResource("SearchPanel.search"), new InlineMenuItemAction() {

        @Override
        public void onClick(AjaxRequestTarget target) {
            PrismContext ctx = getPageBase().getPrismContext();
            if (getModelObject().isAdvancedQueryValid(ctx)) {
                searchPerformed(target);
            }
        }
    });
    searchItems.add(searchItem);
    searchItem = new InlineMenuItem(createStringResource("SearchPanel.debug"), new InlineMenuItemAction() {

        @Override
        public void onClick(AjaxRequestTarget target) {
            debugPerformed();
        }
    });
    searchItems.add(searchItem);
    ListView<InlineMenuItem> li = new ListView<InlineMenuItem>(ID_MENU_ITEM, Model.ofList(searchItems)) {

        @Override
        protected void populateItem(ListItem<InlineMenuItem> item) {
            WebMarkupContainer menuItemBody = new MenuLinkPanel(ID_MENU_ITEM_BODY, item.getModel());
            menuItemBody.setRenderBodyOnly(true);
            item.add(menuItemBody);
        }
    };
    searchDropdown.add(li);
    WebMarkupContainer linksContainer = new WebMarkupContainer(ID_LINKS_CONTAINER);
    linksContainer.setOutputMarkupId(true);
    form.add(linksContainer);
    AjaxButton advanced = new AjaxButton(ID_ADVANCED, createStringResource("SearchPanel.advanced")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            searchTypeUpdated(target, SearchBoxModeType.ADVANCED);
        }
    };
    advanced.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !SearchBoxModeType.ADVANCED.equals(getModelObject().getSearchType());
        }
    });
    linksContainer.add(advanced);
    AjaxButton fullTextButton = new AjaxButton(ID_FULL_TEXT, createStringResource("SearchPanel.fullText")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            searchTypeUpdated(target, SearchBoxModeType.FULLTEXT);
        }
    };
    fullTextButton.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isFullTextSearchEnabled() && !SearchBoxModeType.FULLTEXT.equals(getModelObject().getSearchType());
        }
    });
    linksContainer.add(fullTextButton);
    AjaxButton basicSearchButton = new AjaxButton(ID_BASIC_SEARCH, createStringResource("SearchPanel.basic")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            searchTypeUpdated(target, SearchBoxModeType.BASIC);
        }
    };
    basicSearchButton.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !SearchBoxModeType.BASIC.equals(getModelObject().getSearchType());
        }
    });
    linksContainer.add(basicSearchButton);
    advanced.add(new AttributeAppender("style", new LoadableModel<String>() {

        @Override
        public String load() {
            return basicSearchButton.isVisible() ? "margin-top: -20px;" : "display: table-cell; vertical-align: top;";
        }
    }));
    initPopover();
    WebMarkupContainer fullTextContainer = new WebMarkupContainer(ID_FULL_TEXT_CONTAINER);
    fullTextContainer.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return isFullTextSearchEnabled() && getModelObject().getSearchType().equals(SearchBoxModeType.FULLTEXT);
        }
    });
    fullTextContainer.setOutputMarkupId(true);
    form.add(fullTextContainer);
    TextField fullTextInput = new TextField(ID_FULL_TEXT_FIELD, new PropertyModel<String>(getModel(), Search.F_FULL_TEXT));
    fullTextInput.add(new AjaxFormComponentUpdatingBehavior("blur") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
        }
    });
    fullTextInput.add(new Behavior() {

        @Override
        public void bind(Component component) {
            super.bind(component);
            component.add(AttributeModifier.replace("onkeydown", Model.of("if(event.keyCode == 13) {$('[about=\"searchSimple\"]').click();}")));
        }
    });
    fullTextInput.setOutputMarkupId(true);
    fullTextInput.add(new AttributeAppender("placeholder", createStringResource("SearchPanel.fullTextSearch")));
    fullTextInput.add(createVisibleBehaviour(SearchBoxModeType.FULLTEXT));
    fullTextContainer.add(fullTextInput);
    WebMarkupContainer advancedGroup = new WebMarkupContainer(ID_ADVANCED_GROUP);
    advancedGroup.add(createVisibleBehaviour(SearchBoxModeType.ADVANCED));
    advancedGroup.add(AttributeAppender.append("class", createAdvancedGroupStyle()));
    advancedGroup.setOutputMarkupId(true);
    form.add(advancedGroup);
    Label advancedCheck = new Label(ID_ADVANCED_CHECK);
    advancedCheck.add(AttributeAppender.append("class", createAdvancedGroupLabelStyle()));
    advancedGroup.add(advancedCheck);
    final TextArea advancedArea = new TextArea(ID_ADVANCED_AREA, new PropertyModel(getModel(), Search.F_ADVANCED_QUERY));
    advancedArea.add(new AjaxFormComponentUpdatingBehavior("keyup") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            updateAdvancedArea(advancedArea, target);
        }

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            super.updateAjaxAttributes(attributes);
            attributes.setThrottlingSettings(new ThrottlingSettings(ID_ADVANCED_AREA, Duration.milliseconds(500), true));
        }
    });
    advancedGroup.add(advancedArea);
    Label advancedError = new Label(ID_ADVANCED_ERROR, new PropertyModel<String>(getModel(), Search.F_ADVANCED_ERROR));
    advancedError.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            Search search = getModelObject();
            if (!search.isShowAdvanced()) {
                return false;
            }
            return StringUtils.isNotEmpty(search.getAdvancedError());
        }
    });
    advancedGroup.add(advancedError);
}
Also used : ThrottlingSettings(org.apache.wicket.ajax.attributes.ThrottlingSettings) Form(org.apache.wicket.markup.html.form.Form) TextArea(org.apache.wicket.markup.html.form.TextArea) PrismContext(com.evolveum.midpoint.prism.PrismContext) ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) ListView(org.apache.wicket.markup.html.list.ListView) TextField(org.apache.wicket.markup.html.form.TextField) ArrayList(java.util.ArrayList) List(java.util.List) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) Behavior(org.apache.wicket.behavior.Behavior) AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) Component(org.apache.wicket.Component) AttributeAppender(org.apache.wicket.behavior.AttributeAppender) AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) PropertyModel(org.apache.wicket.model.PropertyModel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxRequestAttributes(org.apache.wicket.ajax.attributes.AjaxRequestAttributes) MenuLinkPanel(com.evolveum.midpoint.web.component.menu.cog.MenuLinkPanel) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 5 with ListView

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

the class WizardIssuesPanel method initLayout.

private void initLayout() {
    WebMarkupContainer panel = new WebMarkupContainer(ID_PANEL);
    panel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getModelObject().hasIssues();
        }
    });
    panel.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            WizardIssuesDto issuesDto = WizardIssuesPanel.this.getModelObject();
            WizardIssuesDto.Severity severity = issuesDto.getSeverity();
            return severity != null ? "box-" + severity.getColorStyle() : null;
        }
    }));
    add(panel);
    Label title = new Label(ID_TITLE, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            WizardIssuesDto issuesDto = WizardIssuesPanel.this.getModelObject();
            WizardIssuesDto.Severity severity = issuesDto.getSeverity();
            if (severity == null) {
                return "";
            } else if (severity == WizardIssuesDto.Severity.INFO) {
                return getString("Wizard.Notes");
            } else {
                return getString("Wizard.Issues");
            }
        }
    });
    panel.add(title);
    WebMarkupContainer table = new WebMarkupContainer(ID_TABLE);
    panel.add(table);
    ListView<WizardIssuesDto.Issue> issues = new ListView<WizardIssuesDto.Issue>(ID_ROW, new PropertyModel<List<WizardIssuesDto.Issue>>(getModel(), WizardIssuesDto.F_ISSUES)) {

        @Override
        protected void populateItem(ListItem<WizardIssuesDto.Issue> item) {
            WizardIssuesDto.Issue issue = item.getModelObject();
            Label severityLabel = new Label(ID_SEVERITY, "");
            severityLabel.add(AttributeAppender.replace("class", issue.getSeverityClass()));
            item.add(severityLabel);
            item.add(new Label(ID_TEXT, issue.getText()));
        }
    };
    table.add(issues);
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Label(org.apache.wicket.markup.html.basic.Label) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) WizardIssuesDto(com.evolveum.midpoint.web.component.wizard.resource.dto.WizardIssuesDto) ListView(org.apache.wicket.markup.html.list.ListView) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ListItem(org.apache.wicket.markup.html.list.ListItem)

Aggregations

ListView (org.apache.wicket.markup.html.list.ListView)52 ListItem (org.apache.wicket.markup.html.list.ListItem)49 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)37 Label (org.apache.wicket.markup.html.basic.Label)37 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)31 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)25 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)25 List (java.util.List)19 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)17 PropertyModel (org.apache.wicket.model.PropertyModel)15 TextField (org.apache.wicket.markup.html.form.TextField)13 ArrayList (java.util.ArrayList)12 Form (org.apache.wicket.markup.html.form.Form)10 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)9 AttributeModifier (org.apache.wicket.AttributeModifier)8 Model (org.apache.wicket.model.Model)8 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)7 IModel (org.apache.wicket.model.IModel)7 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)5 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)5