Search in sources :

Example 1 with ValueSearchFilterItem

use of com.evolveum.midpoint.web.component.search.filter.ValueSearchFilterItem in project midpoint by Evolveum.

the class SearchPropertiesConfigPanel method initTable.

private void initTable(WebMarkupContainer configPanel) {
    List<IColumn<SelectableBean<ValueSearchFilterItem>, String>> columns = getTableColumns();
    BoxedTablePanel<SelectableBean<ValueSearchFilterItem>> table = new BoxedTablePanel<SelectableBean<ValueSearchFilterItem>>(ID_PROPERTIES_TABLE, provider, columns) {

        private static final long serialVersionUID = 1L;

        @Override
        protected WebMarkupContainer createHeader(String headerId) {
            return new WebMarkupContainer(headerId);
        }

        @Override
        public String getAdditionalBoxCssClasses() {
            return null;
        }

        @Override
        protected WebMarkupContainer createButtonToolbar(String id) {
            AjaxButton addRowButton = new AjaxButton(id) {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget ajaxRequestTarget) {
                    propertyAddedPerformed(ajaxRequestTarget);
                }
            };
            addRowButton.setOutputMarkupId(true);
            addRowButton.add(AttributeAppender.append("class", "btn btn-sm btn-default fa fa-plus"));
            addRowButton.add(AttributeAppender.append("style", "color: green;"));
            return addRowButton;
        }

        @Override
        protected boolean hideFooterIfSinglePage() {
            return true;
        }

        @Override
        public int getAutoRefreshInterval() {
            return 0;
        }

        @Override
        public boolean isAutoRefreshEnabled() {
            return false;
        }
    };
    table.setOutputMarkupId(true);
    configPanel.add(table);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ValueSearchFilterItem(com.evolveum.midpoint.web.component.search.filter.ValueSearchFilterItem)

Example 2 with ValueSearchFilterItem

use of com.evolveum.midpoint.web.component.search.filter.ValueSearchFilterItem in project midpoint by Evolveum.

the class SearchPropertiesConfigPanel method getTableColumns.

private List<IColumn<SelectableBean<ValueSearchFilterItem>, String>> getTableColumns() {
    List<IColumn<SelectableBean<ValueSearchFilterItem>, String>> columns = new ArrayList<>();
    CheckBoxHeaderColumn<SelectableBean<ValueSearchFilterItem>> checkboxColumn = new CheckBoxHeaderColumn<>();
    columns.add(checkboxColumn);
    IColumn<SelectableBean<ValueSearchFilterItem>, String> propertyColumn = new PropertyColumn<SelectableBean<ValueSearchFilterItem>, String>(getPageBase().createStringResource("SearchPropertiesConfigPanel.table.column.property"), "value." + ValueSearchFilterItem.F_PROPERTY_NAME) {

        private static final long serialVersionUID = 1L;

        @Override
        public String getCssClass() {
            return getColumnStyleClass();
        }
    };
    columns.add(propertyColumn);
    IColumn<SelectableBean<ValueSearchFilterItem>, String> valueColumn = new AbstractColumn<SelectableBean<ValueSearchFilterItem>, String>(getPageBase().createStringResource("SearchPropertiesConfigPanel.table.column.value")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ValueSearchFilterItem>>> item, String id, IModel<SelectableBean<ValueSearchFilterItem>> rowModel) {
            item.add(new SwitchablePropertyValuePanel(id, rowModel));
        }

        @Override
        public String getCssClass() {
            return "max-width-column";
        }
    };
    columns.add(valueColumn);
    IColumn<SelectableBean<ValueSearchFilterItem>, String> filterColumn = new AbstractColumn<SelectableBean<ValueSearchFilterItem>, String>(getPageBase().createStringResource("SearchPropertiesConfigPanel.table.column.filter")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ValueSearchFilterItem>>> item, String id, IModel<SelectableBean<ValueSearchFilterItem>> rowModel) {
            List<ValueSearchFilterItem.FilterName> availableFilterNames = rowModel.getObject().getValue().getAvailableFilterNameList();
            DropDownChoicePanel<ValueSearchFilterItem.FilterName> filterPanel = WebComponentUtil.createEnumPanel(id, Model.ofList(availableFilterNames), new PropertyModel<>(rowModel, "value." + ValueSearchFilterItem.F_FILTER_TYPE_NAME), SearchPropertiesConfigPanel.this, false, getPageBase().createStringResource("SearchPropertiesConfigPanel.selectFilter").getString());
            filterPanel.setOutputMarkupId(true);
            filterPanel.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
            filterPanel.getBaseFormComponent().add(new EnableBehaviour(() -> availableFilterNames.size() > 1));
            item.add(filterPanel);
        }

        @Override
        public String getCssClass() {
            return getColumnStyleClass();
        }
    };
    columns.add(filterColumn);
    IColumn<SelectableBean<ValueSearchFilterItem>, String> matchingRuleColumn = new AbstractColumn<SelectableBean<ValueSearchFilterItem>, String>(getPageBase().createStringResource("SearchPropertiesConfigPanel.table.column.matchingRule")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ValueSearchFilterItem>>> item, String id, IModel<SelectableBean<ValueSearchFilterItem>> rowModel) {
            DropDownChoicePanel<ValueSearchFilterItem.MatchingRule> matchingRulePanel = WebComponentUtil.createEnumPanel(id, Model.ofList(rowModel.getObject().getValue().getAvailableMatchingRuleList()), new PropertyModel<>(rowModel, "value." + ValueSearchFilterItem.F_MATCHING_RULE), SearchPropertiesConfigPanel.this, true, getPageBase().createStringResource("SearchPropertiesConfigPanel.selectMatchingRule").getString());
            matchingRulePanel.setOutputMarkupId(true);
            matchingRulePanel.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
            item.add(matchingRulePanel);
        }

        @Override
        public String getCssClass() {
            return getColumnStyleClass();
        }
    };
    columns.add(matchingRuleColumn);
    CheckBoxColumn<SelectableBean<ValueSearchFilterItem>> negationColumn = new CheckBoxColumn<SelectableBean<ValueSearchFilterItem>>(getPageBase().createStringResource("SearchPropertiesConfigPanel.table.column.applyNegotiation"), "value." + ValueSearchFilterItem.F_APPLY_NEGATION) {

        private static final long serialVersionUID = 1L;

        @Override
        public String getCssClass() {
            return "min-width-column";
        }
    };
    columns.add(negationColumn);
    InlineMenuButtonColumn<SelectableBean<ValueSearchFilterItem>> actionsColumn = new InlineMenuButtonColumn<SelectableBean<ValueSearchFilterItem>>(getTableMenuItems(), getPageBase()) {

        private static final long serialVersionUID = 1L;

        @Override
        public String getCssClass() {
            return "min-width-column";
        }
    };
    columns.add(actionsColumn);
    return columns;
}
Also used : PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) EmptyOnBlurAjaxFormUpdatingBehaviour(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) Item(org.apache.wicket.markup.repeater.Item) ValueSearchFilterItem(com.evolveum.midpoint.web.component.search.filter.ValueSearchFilterItem) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) EnableBehaviour(com.evolveum.midpoint.web.component.util.EnableBehaviour) IModel(org.apache.wicket.model.IModel) InlineMenuButtonColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn) CheckBoxColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxColumn) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ValueSearchFilterItem(com.evolveum.midpoint.web.component.search.filter.ValueSearchFilterItem)

Example 3 with ValueSearchFilterItem

use of com.evolveum.midpoint.web.component.search.filter.ValueSearchFilterItem in project midpoint by Evolveum.

the class SwitchablePropertyValuePanel method isReferenceFilterValue.

private boolean isReferenceFilterValue() {
    ValueSearchFilterItem valueSearchFilter = getModelObject().getValue();
    ItemDefinition propertyDef = valueSearchFilter.getPropertyDef();
    return propertyDef instanceof PrismReferenceDefinition;
}
Also used : ValueSearchFilterItem(com.evolveum.midpoint.web.component.search.filter.ValueSearchFilterItem)

Aggregations

ValueSearchFilterItem (com.evolveum.midpoint.web.component.search.filter.ValueSearchFilterItem)3 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)2 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)2 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)1 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)1 CheckBoxColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxColumn)1 CheckBoxHeaderColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)1 InlineMenuButtonColumn (com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn)1 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)1 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)1 EnableBehaviour (com.evolveum.midpoint.web.component.util.EnableBehaviour)1 EmptyOnBlurAjaxFormUpdatingBehaviour (com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour)1 ArrayList (java.util.ArrayList)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 AbstractColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn)1 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1 Item (org.apache.wicket.markup.repeater.Item)1 IModel (org.apache.wicket.model.IModel)1