Search in sources :

Example 46 with SelectableBean

use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.

the class OrgTreeProvider method createObjectWrapper.

private SelectableBean<OrgType> createObjectWrapper(SelectableBean<OrgType> parent, PrismObject<OrgType> unit) {
    if (unit == null) {
        return null;
    }
    //todo relation [lazyman]
    //        OrgTreeDto orgDto = new OrgTreeDto(parent, unit);
    OrgType org = unit.asObjectable();
    if (parent != null) {
        org.getParentOrg().clear();
        org.getParentOrg().add(parent.getValue());
    }
    SelectableBean<OrgType> orgDto = new SelectableBean<OrgType>(org);
    orgDto.getMenuItems().addAll(createInlineMenuItems(orgDto.getValue()));
    return orgDto;
}
Also used : OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean)

Example 47 with SelectableBean

use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.

the class MultipleAssignmentSelector method applyQueryToListProvider.

private List<AssignmentEditorDto> applyQueryToListProvider(ObjectQuery query, List<AssignmentEditorDto> providerList) {
    ObjectDataProvider temporaryProvider = new ObjectDataProvider(MultipleAssignmentSelector.this, type);
    List<AssignmentEditorDto> displayAssignmentsList = new ArrayList<>();
    temporaryProvider.setQuery(query);
    Iterator it = temporaryProvider.internalIterator(0, temporaryProvider.size());
    List<SelectableBean<F>> providerDataList = IteratorUtils.toList(it);
    for (AssignmentEditorDto dto : providerList) {
        for (SelectableBean<F> providerDataDto : providerDataList) {
            F object = providerDataDto.getValue();
            if (object != null && object.getOid().equals(dto.getTargetRef().getOid())) {
                displayAssignmentsList.add(dto);
                break;
            }
        }
    }
    return displayAssignmentsList;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) ObjectDataProvider(com.evolveum.midpoint.web.component.data.ObjectDataProvider)

Example 48 with SelectableBean

use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.

the class PageConnectorHosts method initConnectorHostsColumns.

private List<IColumn<ConnectorHostType, String>> initConnectorHostsColumns() {
    List<IColumn<ConnectorHostType, String>> columns = new ArrayList<>();
    IColumn column = new CheckBoxHeaderColumn<ConnectorHostType>();
    columns.add(column);
    column = new LinkColumn<SelectableBean<ConnectorHostType>>(createStringResource("pageResources.connector.name"), "name", "value.name") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ConnectorHostType>> rowModel) {
            ConnectorHostType host = rowModel.getObject().getValue();
        // resourceDetailsPerformed(target, host.getOid());
        }
    };
    columns.add(column);
    columns.add(new PropertyColumn(createStringResource("pageResources.connector.hostname"), "value.hostname"));
    columns.add(new PropertyColumn(createStringResource("pageResources.connector.port"), "value.port"));
    columns.add(new PropertyColumn(createStringResource("pageResources.connector.timeout"), "value.timeout"));
    columns.add(new CheckBoxColumn(createStringResource("pageResources.connector.protectConnection"), "value.protectConnection"));
    InlineMenuHeaderColumn menu = new InlineMenuHeaderColumn(initInlineHostsMenu());
    columns.add(menu);
    return columns;
}
Also used : ConnectorHostType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType) InlineMenuHeaderColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuHeaderColumn) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) CheckBoxColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxColumn) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean)

Example 49 with SelectableBean

use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.

the class ObjectListPanel method getCustomColumnsTransformed.

protected List<IColumn<SelectableBean<O>, String>> getCustomColumnsTransformed(List<GuiObjectColumnType> customColumns) {
    List<IColumn<SelectableBean<O>, String>> columns = new ArrayList<IColumn<SelectableBean<O>, String>>();
    if (customColumns == null || customColumns.size() == 0) {
        return columns;
    }
    IColumn<SelectableBean<O>, String> column;
    for (GuiObjectColumnType customColumn : customColumns) {
        if (WebComponentUtil.getElementVisibility(customColumn.getVisibility())) {
            if (customColumns.indexOf(customColumn) == 0) {
                column = createNameColumn(customColumn.getDisplay() != null && customColumn.getDisplay().getLabel() != null ? Model.of(customColumn.getDisplay().getLabel()) : createStringResource(getItemDisplayName(customColumn)), customColumn.getPath().toString());
            } else {
                column = new PropertyColumn(customColumn.getDisplay() != null && customColumn.getDisplay().getLabel() != null ? Model.of(customColumn.getDisplay().getLabel()) : createStringResource(getItemDisplayName(customColumn)), null, SelectableBean.F_VALUE + "." + customColumn.getPath());
            }
            columns.add(column);
        }
    }
    return columns;
}
Also used : IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean)

Example 50 with SelectableBean

use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.

the class ObjectListPanel method searchPerformed.

@SuppressWarnings("deprecation")
private void searchPerformed(ObjectQuery query, AjaxRequestTarget target) {
    BaseSortableDataProvider<SelectableBean<O>> provider = getDataProvider();
    // note: we ignore 'query' parameter, as the 'customQuery' already contains its content (MID-3271)
    ObjectQuery customQuery = getQuery();
    //		if (customQuery == null){
    //			customQuery = query;
    //		} else {
    //			if (query != null){
    //				customQuery.addFilter(query.getFilter());
    //			}
    //		}
    provider.setQuery(customQuery);
    String storageKey = getStorageKey();
    if (StringUtils.isNotEmpty(storageKey)) {
        PageStorage storage = getPageStorage(storageKey);
        if (storage != null) {
            storage.setSearch(searchModel.getObject());
            storage.setPaging(null);
        }
    }
    Table table = getTable();
    table.setCurrentPage(null);
    target.add((Component) table);
    target.add(parentPage.getFeedbackPanel());
}
Also used : Table(com.evolveum.midpoint.web.component.data.Table) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) PageStorage(com.evolveum.midpoint.web.session.PageStorage)

Aggregations

SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)73 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)39 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)37 IModel (org.apache.wicket.model.IModel)37 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)32 ArrayList (java.util.ArrayList)31 Label (org.apache.wicket.markup.html.basic.Label)22 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)16 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)16 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)15 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)14 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)12 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)12 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)12 Item (org.apache.wicket.markup.repeater.Item)11 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)9 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)8 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)8 List (java.util.List)8 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)7