Search in sources :

Example 91 with IColumn

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

the class ProvisioningTaskDirectoryPanel method getFieldColumns.

@Override
protected List<IColumn<T, String>> getFieldColumns() {
    List<IColumn<T, String>> columns = new ArrayList<>();
    columns.add(new KeyPropertyColumn<>(new StringResourceModel("key", this), "key"));
    columns.add(new PropertyColumn<>(new StringResourceModel("name", this), "name", "name"));
    columns.add(new PropertyColumn<>(new StringResourceModel("description", this), "description", "description"));
    if (reference == PullTaskTO.class) {
        columns.add(new PropertyColumn<>(new StringResourceModel("destinationRealm", this), "destinationRealm", "destinationRealm"));
    } else if (reference == PushTaskTO.class) {
        columns.add(new PropertyColumn<>(new StringResourceModel("sourceRealm", this), "sourceRealm", "sourceRealm"));
    }
    columns.add(new DatePropertyColumn<>(new StringResourceModel("lastExec", this), "lastExec", "lastExec"));
    columns.add(new DatePropertyColumn<>(new StringResourceModel("nextExec", this), "nextExec", "nextExec"));
    columns.add(new PropertyColumn<>(new StringResourceModel("latestExecStatus", this), "latestExecStatus", "latestExecStatus"));
    columns.add(new BooleanPropertyColumn<>(new StringResourceModel("active", this), "active", "active"));
    columns.add(new AbstractColumn<T, String>(new Model<>(""), "running") {

        private static final long serialVersionUID = -4008579357070833846L;

        @Override
        public void populateItem(final Item<ICellPopulator<T>> cellItem, final String componentId, final IModel<T> rowModel) {
            JobTO jobTO = restClient.getJob(rowModel.getObject().getKey());
            JobActionPanel panel = new JobActionPanel(componentId, jobTO, false, ProvisioningTaskDirectoryPanel.this, pageRef);
            MetaDataRoleAuthorizationStrategy.authorize(panel, WebPage.ENABLE, String.format("%s,%s", StandardEntitlement.TASK_EXECUTE, StandardEntitlement.TASK_UPDATE));
            cellItem.add(panel);
        }

        @Override
        public String getCssClass() {
            return "col-xs-1";
        }
    });
    return columns;
}
Also used : DatePropertyColumn(org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.DatePropertyColumn) KeyPropertyColumn(org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.KeyPropertyColumn) BooleanPropertyColumn(org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.BooleanPropertyColumn) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) JobActionPanel(org.apache.syncope.client.console.widgets.JobActionPanel) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PushTaskTO(org.apache.syncope.common.lib.to.PushTaskTO) StringResourceModel(org.apache.wicket.model.StringResourceModel) IModel(org.apache.wicket.model.IModel) Model(org.apache.wicket.model.Model) StringResourceModel(org.apache.wicket.model.StringResourceModel) JobTO(org.apache.syncope.common.lib.to.JobTO)

Example 92 with IColumn

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

the class BrowserPanel method createTable.

private BrowserTable createTable(String id, IModel<String> sessionId) {
    PageWindowProvider provider = new PageWindowProvider(sessionId);
    List<IColumn<PageWindowDescription, String>> columns = new ArrayList<>();
    PageWindowColumn pageIdColumn = new PageWindowColumn(Model.of("Id"), "id");
    columns.add(pageIdColumn);
    PageWindowColumn pageNameColumn = new PageWindowColumn(Model.of("Name"), "name");
    columns.add(pageNameColumn);
    PageWindowColumn pageSizeColumn = new PageWindowColumn(Model.of("Size"), "size");
    columns.add(pageSizeColumn);
    BrowserTable browserTable = new BrowserTable(id, columns, provider);
    browserTable.setOutputMarkupId(true);
    browserTable.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));
    return browserTable;
}
Also used : IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ArrayList(java.util.ArrayList) AjaxSelfUpdatingTimerBehavior(org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior)

Example 93 with IColumn

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

the class ContainerableListPanel method getViewColumnsTransformed.

protected List<IColumn<PO, String>> getViewColumnsTransformed(List<GuiObjectColumnType> customColumns, boolean shouldCheckForNameColumn) {
    List<IColumn<PO, String>> columns = new ArrayList<>();
    if (customColumns == null || customColumns.isEmpty()) {
        return columns;
    }
    IColumn<PO, String> column;
    for (GuiObjectColumnType customColumn : customColumns) {
        if (nothingToTransform(customColumn)) {
            continue;
        }
        ItemPath columnPath = customColumn.getPath() == null ? null : customColumn.getPath().getItemPath();
        // TODO this throws an exception for some kinds of invalid paths like e.g. fullName/norm (but we probably should fix prisms in that case!)
        ExpressionType expression = customColumn.getExport() != null ? customColumn.getExport().getExpression() : null;
        if (expression == null && noItemDefinitionFor(columnPath, customColumn)) {
            continue;
        }
        if (WebComponentUtil.getElementVisibility(customColumn.getVisibility())) {
            IModel<String> columnDisplayModel = createColumnDisplayModel(customColumn);
            if (customColumns.indexOf(customColumn) == 0 && shouldCheckForNameColumn) {
                column = createNameColumn(columnDisplayModel, customColumn, columnPath, expression);
            } else {
                column = createCustomExportableColumn(columnDisplayModel, customColumn, columnPath, expression);
            }
            if (column != null) {
                columns.add(column);
            }
        }
    }
    return columns;
}
Also used : IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 94 with IColumn

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

the class ExportingPanel method createTable.

private BoxedTablePanel<SelectableBean<Integer>> createTable(String id, DataTable<?, ?> dataTable) {
    List<? extends IColumn<?, ?>> allColumns = dataTable.getColumns();
    List<Integer> exportableColumnIndex = getExportableColumns(dataTable);
    if (exportableColumnIndex.isEmpty()) {
        throw new IllegalArgumentException("List of exportable columns is empty");
    }
    List<IColumn<SelectableBean<Integer>, String>> columns = new ArrayList<>();
    CheckBoxHeaderColumn<SelectableBean<Integer>> checkboxColumn = new CheckBoxHeaderColumn<>();
    columns.add(checkboxColumn);
    StringResourceModel nameString = getPageBase().createStringResource("ExportingPopupPanel.nameColumn");
    IColumn<SelectableBean<Integer>, String> nameColumn = new AbstractColumn<SelectableBean<Integer>, String>(nameString) {

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<Integer>>> cellItem, String componentId, IModel<SelectableBean<Integer>> rowModel) {
            IModel stringModel = ((IExportableColumn) allColumns.get(rowModel.getObject().getValue())).getDisplayModel();
            cellItem.add(new Label(componentId, stringModel));
        }
    };
    columns.add(nameColumn);
    SelectableListDataProvider<SelectableBean<Integer>, Integer> provider = new SelectableListDataProvider<SelectableBean<Integer>, Integer>(getPageBase(), Model.ofList(exportableColumnIndex)) {

        @Override
        public Iterator<SelectableBean<Integer>> internalIterator(long first, long count) {
            if (getAvailableData().isEmpty()) {
                return super.internalIterator(first, count);
            } else {
                return getAvailableData().iterator();
            }
        }
    };
    BoxedTablePanel<SelectableBean<Integer>> table = new BoxedTablePanel<SelectableBean<Integer>>(id, 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) {
            return new WebMarkupContainer(id);
        }

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

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

        @Override
        public boolean isAutoRefreshEnabled() {
            return false;
        }
    };
    table.setOutputMarkupId(true);
    return table;
}
Also used : IExportableColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.export.IExportableColumn) IModel(org.apache.wicket.model.IModel) ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) Item(org.apache.wicket.markup.repeater.Item) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) SelectableListDataProvider(com.evolveum.midpoint.web.component.util.SelectableListDataProvider) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Example 95 with IColumn

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

the class ExportingPanel method getExportableColumns.

private List<Integer> getExportableColumns(DataTable<?, ?> dataTable) {
    List<? extends IColumn<?, ?>> columns = dataTable.getColumns();
    List<Integer> exportableColumn = new ArrayList<>();
    for (IColumn column : columns) {
        if (column instanceof IExportableColumn) {
            exportableColumn.add(columns.indexOf(column));
        }
    }
    return exportableColumn;
}
Also used : IExportableColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.export.IExportableColumn) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ArrayList(java.util.ArrayList)

Aggregations

IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)131 ArrayList (java.util.ArrayList)80 IModel (org.apache.wicket.model.IModel)73 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)69 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)43 Label (org.apache.wicket.markup.html.basic.Label)43 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)37 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)36 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)31 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)31 Model (org.apache.wicket.model.Model)22 Item (org.apache.wicket.markup.repeater.Item)19 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)18 List (java.util.List)18 Component (org.apache.wicket.Component)18 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)17 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)17 PropertyModel (org.apache.wicket.model.PropertyModel)15 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)14 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)13