Search in sources :

Example 31 with PropertyColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn 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)

Aggregations

PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)31 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)30 ArrayList (java.util.ArrayList)23 IModel (org.apache.wicket.model.IModel)21 Label (org.apache.wicket.markup.html.basic.Label)13 Model (org.apache.wicket.model.Model)13 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)12 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)12 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)10 Item (org.apache.wicket.markup.repeater.Item)9 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)7 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)6 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)5 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)5 PropertyModel (org.apache.wicket.model.PropertyModel)5 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)4 CheckBoxHeaderColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)4 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)4 List (java.util.List)4 QName (javax.xml.namespace.QName)4