Search in sources :

Example 11 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class MultipleAssignmentSelector method initTablePanel.

private BoxedTablePanel initTablePanel() {
    List<IColumn<SelectableBean<AssignmentEditorDto>, String>> columns = initColumns();
    BoxedTablePanel table = new BoxedTablePanel(ID_TABLE, provider, columns, UserProfileStorage.TableId.TABLE_ROLES, ITEMS_PER_PAGE);
    updateBoxedTablePanelStyles(table);
    //hide footer menu
    table.getFooterMenu().setVisible(false);
    //hide footer count label
    table.getFooterCountLabel().setVisible(false);
    table.setOutputMarkupId(true);
    return table;
}
Also used : IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel)

Example 12 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class ColumnUtils method getDefaultTaskColumns.

public static <T extends ObjectType> List<IColumn<SelectableBean<T>, String>> getDefaultTaskColumns() {
    List<IColumn<SelectableBean<T>, String>> columns = new ArrayList<IColumn<SelectableBean<T>, String>>();
    columns.add(new AbstractColumn<SelectableBean<T>, String>(createStringResource("TaskType.kind")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<T>>> cellItem, String componentId, IModel<SelectableBean<T>> rowModel) {
            SelectableBean<TaskType> object = (SelectableBean<TaskType>) rowModel.getObject();
            PrismProperty<ShadowKindType> pKind = object.getValue() != null ? object.getValue().asPrismObject().findProperty(new ItemPath(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_KIND)) : null;
            if (pKind != null) {
                cellItem.add(new Label(componentId, WebComponentUtil.createLocalizedModelForEnum(pKind.getRealValue(), cellItem)));
            } else {
                cellItem.add(new Label(componentId));
            }
        }
    });
    columns.add(new AbstractColumn<SelectableBean<T>, String>(createStringResource("TaskType.intent")) {

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<T>>> cellItem, String componentId, IModel<SelectableBean<T>> rowModel) {
            SelectableBean<TaskType> object = (SelectableBean<TaskType>) rowModel.getObject();
            PrismProperty<String> pIntent = object.getValue() != null ? object.getValue().asPrismObject().findProperty(new ItemPath(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_INTENT)) : null;
            if (pIntent != null) {
                cellItem.add(new Label(componentId, pIntent.getRealValue()));
            } else {
                cellItem.add(new Label(componentId));
            }
        }
    });
    columns.add(new AbstractColumn<SelectableBean<T>, String>(createStringResource("TaskType.objectClass")) {

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<T>>> cellItem, String componentId, IModel<SelectableBean<T>> rowModel) {
            SelectableBean<TaskType> object = (SelectableBean<TaskType>) rowModel.getObject();
            PrismProperty<QName> pObjectClass = object.getValue() != null ? object.getValue().asPrismObject().findProperty(new ItemPath(TaskType.F_EXTENSION, SchemaConstants.OBJECTCLASS_PROPERTY_NAME)) : null;
            if (pObjectClass != null) {
                cellItem.add(new Label(componentId, pObjectClass.getRealValue().getLocalPart()));
            } else {
                cellItem.add(new Label(componentId, ""));
            }
        }
    });
    List<ColumnTypeDto<String>> columnsDefs = Arrays.asList(new ColumnTypeDto<String>("TaskType.executionStatus", TaskType.F_EXECUTION_STATUS.getLocalPart(), SelectableBean.F_VALUE + ".executionStatus", false));
    columns.addAll(ColumnUtils.<SelectableBean<T>>createColumns(columnsDefs));
    return columns;
}
Also used : ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) PrismProperty(com.evolveum.midpoint.prism.PrismProperty) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 13 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class ResourceListPanel method initColumns.

private List<IColumn> initColumns() {
    List<IColumn> columns = new ArrayList<IColumn>();
    IColumn column = new LinkColumn<SelectableBean<ResourceType>>(createStringResource("ObjectType.name"), "name", "value.name") {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ResourceType>> rowModel) {
            ResourceType resource = rowModel.getObject().getValue();
            resourceSelectedPerformed(target, resource);
        }
    };
    columns.add(column);
    return columns;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ArrayList(java.util.ArrayList) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) LinkColumn(com.evolveum.midpoint.web.component.data.column.LinkColumn)

Example 14 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class OrgTreePanel method initLayout.

private void initLayout() {
    WebMarkupContainer treeHeader = new WebMarkupContainer(ID_TREE_HEADER);
    treeHeader.setOutputMarkupId(true);
    add(treeHeader);
    String title = StringUtils.isEmpty(treeTitleKey) ? "TreeTablePanel.hierarchy" : treeTitleKey;
    Label treeTitle = new Label(ID_TREE_TITLE, createStringResource(title));
    treeHeader.add(treeTitle);
    InlineMenu treeMenu = new InlineMenu(ID_TREE_MENU, new Model<>((Serializable) createTreeMenuInternal()));
    treeHeader.add(treeMenu);
    ISortableTreeProvider provider = new OrgTreeProvider(this, getModel()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected List<InlineMenuItem> createInlineMenuItems(OrgType org) {
            return createTreeChildrenMenu(org);
        }
    };
    List<IColumn<SelectableBean<OrgType>, String>> columns = new ArrayList<>();
    if (selectable) {
        columns.add(new CheckBoxHeaderColumn<SelectableBean<OrgType>>());
    }
    columns.add(new TreeColumn<SelectableBean<OrgType>, String>(createStringResource("TreeTablePanel.hierarchy")));
    columns.add(new InlineMenuHeaderColumn(createTreeChildrenMenu(null)));
    WebMarkupContainer treeContainer = new WebMarkupContainer(ID_TREE_CONTAINER) {

        private static final long serialVersionUID = 1L;

        @Override
        public void renderHead(IHeaderResponse response) {
            super.renderHead(response);
            // method computes height based on document.innerHeight() -
            // screen height;
            Component form = OrgTreePanel.this.getParent().get("memberPanel");
            if (form != null) {
                response.render(OnDomReadyHeaderItem.forScript("updateHeight('" + getMarkupId() + "', ['#" + form.getMarkupId() + "'], ['#" + OrgTreePanel.this.get(ID_TREE_HEADER).getMarkupId() + "'])"));
            }
        }
    };
    add(treeContainer);
    TreeStateModel treeStateMode = new TreeStateModel(this, provider) {

        private static final long serialVersionUID = 1L;

        @Override
        public Set<SelectableBean<OrgType>> getExpandedItems() {
            return OrgTreePanel.this.getExpandedItems(getOrgTreeStateStorage());
        }

        @Override
        public SelectableBean<OrgType> getCollapsedItem() {
            return OrgTreePanel.this.getCollapsedItem(getOrgTreeStateStorage());
        }

        @Override
        public void setCollapsedItem(SelectableBean<OrgType> item) {
            OrgTreePanel.this.setCollapsedItem(null, getOrgTreeStateStorage());
        }
    };
    TableTree<SelectableBean<OrgType>, String> tree = new TableTree<SelectableBean<OrgType>, String>(ID_TREE, columns, provider, Integer.MAX_VALUE, treeStateMode) {

        private static final long serialVersionUID = 1L;

        @Override
        protected Component newContentComponent(String id, IModel<SelectableBean<OrgType>> model) {
            return new SelectableFolderContent(id, this, model, selected) {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onClick(AjaxRequestTarget target) {
                    super.onClick(target);
                    OrgTreePanel.this.setSelectedItem(selected.getObject(), getOrgTreeStateStorage());
                    selectTreeItemPerformed(selected.getObject(), target);
                }
            };
        }

        @Override
        protected Item<SelectableBean<OrgType>> newRowItem(String id, int index, final IModel<SelectableBean<OrgType>> model) {
            Item<SelectableBean<OrgType>> item = super.newRowItem(id, index, model);
            item.add(AttributeModifier.append("class", new AbstractReadOnlyModel<String>() {

                private static final long serialVersionUID = 1L;

                @Override
                public String getObject() {
                    SelectableBean<OrgType> itemObject = model.getObject();
                    if (itemObject != null && itemObject.equals(selected.getObject())) {
                        return "success";
                    }
                    return null;
                }
            }));
            return item;
        }

        @Override
        public void collapse(SelectableBean<OrgType> collapsedItem) {
            super.collapse(collapsedItem);
            Set<SelectableBean<OrgType>> items = OrgTreePanel.this.getExpandedItems(getOrgTreeStateStorage());
            if (items != null && items.contains(collapsedItem)) {
                items.remove(collapsedItem);
            }
            OrgTreePanel.this.setExpandedItems((TreeStateSet) items, getOrgTreeStateStorage());
            OrgTreePanel.this.setCollapsedItem(collapsedItem, getOrgTreeStateStorage());
        }

        @Override
        protected void onModelChanged() {
            super.onModelChanged();
            TreeStateSet<SelectableBean<OrgType>> items = (TreeStateSet) getModelObject();
            if (!items.isInverse()) {
                OrgTreePanel.this.setExpandedItems(items, getOrgTreeStateStorage());
            }
        }
    };
    tree.setItemReuseStrategy(new ReuseIfModelsEqualStrategy());
    tree.getTable().add(AttributeModifier.replace("class", "table table-striped table-condensed"));
    tree.add(new WindowsTheme());
    // tree.add(AttributeModifier.replace("class", "tree-midpoint"));
    treeContainer.add(tree);
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Serializable(java.io.Serializable) InlineMenuHeaderColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuHeaderColumn) TableTree(org.apache.wicket.extensions.markup.html.repeater.tree.TableTree) Label(org.apache.wicket.markup.html.basic.Label) WindowsTheme(org.apache.wicket.extensions.markup.html.repeater.tree.theme.WindowsTheme) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ReuseIfModelsEqualStrategy(org.apache.wicket.markup.repeater.ReuseIfModelsEqualStrategy) InlineMenu(com.evolveum.midpoint.web.component.menu.cog.InlineMenu) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) OrgTreeProvider(com.evolveum.midpoint.web.page.admin.users.component.OrgTreeProvider) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) IHeaderResponse(org.apache.wicket.markup.head.IHeaderResponse) Component(org.apache.wicket.Component) IModel(org.apache.wicket.model.IModel) SelectableFolderContent(com.evolveum.midpoint.web.page.admin.users.component.SelectableFolderContent) TreeStateSet(com.evolveum.midpoint.web.page.admin.users.dto.TreeStateSet) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ISortableTreeProvider(org.apache.wicket.extensions.markup.html.repeater.tree.ISortableTreeProvider) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType)

Example 15 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class MyAccountsPanel method initLayout.

@Override
protected void initLayout() {
    List<IColumn<SimpleAccountDto, String>> columns = new ArrayList<IColumn<SimpleAccountDto, String>>();
    columns.add(new PropertyColumn(createStringResource("MyAccountsPanel.account.name"), "accountName"));
    columns.add(new PropertyColumn(createStringResource("MyAccountsPanel.account.resource"), "resourceName"));
    ISortableDataProvider provider = new ListDataProvider(this, getModel());
    TablePanel accountsTable = new TablePanel<SimpleAccountDto>(ID_ACCOUNTS_TABLE, provider, columns);
    accountsTable.setShowPaging(false);
    add(accountsTable);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) SimpleAccountDto(com.evolveum.midpoint.web.page.admin.home.dto.SimpleAccountDto) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) ISortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Aggregations

IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)58 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)34 ArrayList (java.util.ArrayList)33 IModel (org.apache.wicket.model.IModel)28 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)21 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)19 Label (org.apache.wicket.markup.html.basic.Label)19 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)14 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)13 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)13 Model (org.apache.wicket.model.Model)12 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)9 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)8 Item (org.apache.wicket.markup.repeater.Item)8 PropertyModel (org.apache.wicket.model.PropertyModel)8 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)7 CheckBoxHeaderColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)7 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)7 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)7 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)6