Search in sources :

Example 6 with BoxedTablePanel

use of com.evolveum.midpoint.web.component.data.BoxedTablePanel in project midpoint by Evolveum.

the class PageCreatedReports method initLayout.

private void initLayout() {
    Form mainForm = new Form(ID_MAIN_FORM);
    add(mainForm);
    final AjaxDownloadBehaviorFromStream ajaxDownloadBehavior = new AjaxDownloadBehaviorFromStream() {

        @Override
        protected InputStream initStream() {
            return createReport(this);
        }

        @Override
        public String getFileName() {
            return getReportFileName();
        }
    };
    mainForm.add(ajaxDownloadBehavior);
    ObjectDataProvider provider = new ObjectDataProvider(PageCreatedReports.this, ReportOutputType.class) {

        @Override
        protected void saveProviderPaging(ObjectQuery query, ObjectPaging paging) {
            ReportsStorage storage = getSessionStorage().getReports();
            storage.setReportOutputsPaging(paging);
        }

        @Override
        public ObjectQuery getQuery() {
            return createQuery();
        }
    };
    BoxedTablePanel table = new BoxedTablePanel(ID_CREATED_REPORTS_TABLE, provider, initColumns(ajaxDownloadBehavior), UserProfileStorage.TableId.PAGE_CREATED_REPORTS_PANEL, (int) getItemsPerPage(UserProfileStorage.TableId.PAGE_CREATED_REPORTS_PANEL)) {

        @Override
        protected WebMarkupContainer createHeader(String headerId) {
            return new SearchFragment(headerId, ID_TABLE_HEADER, PageCreatedReports.this, searchModel);
        }
    };
    table.setShowPaging(true);
    table.setOutputMarkupId(true);
    mainForm.add(table);
}
Also used : Form(org.apache.wicket.markup.html.form.Form) AjaxDownloadBehaviorFromStream(com.evolveum.midpoint.web.component.AjaxDownloadBehaviorFromStream) ReportsStorage(com.evolveum.midpoint.web.session.ReportsStorage) ObjectDataProvider(com.evolveum.midpoint.web.component.data.ObjectDataProvider) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel)

Example 7 with BoxedTablePanel

use of com.evolveum.midpoint.web.component.data.BoxedTablePanel in project midpoint by Evolveum.

the class ObjectListPanel method createTable.

private BoxedTablePanel<SelectableBean<O>> createTable() {
    List<IColumn<SelectableBean<O>, String>> columns;
    if (isCustomColumnsListConfigured()) {
        columns = initCustomColumns();
    } else {
        columns = initColumns();
    }
    BaseSortableDataProvider<SelectableBean<O>> provider = initProvider();
    BoxedTablePanel<SelectableBean<O>> table = new BoxedTablePanel<SelectableBean<O>>(ID_TABLE, provider, columns, tableId, tableId == null ? 10 : parentPage.getSessionStorage().getUserProfile().getPagingSize(tableId)) {

        private static final long serialVersionUID = 1L;

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

        @Override
        public String getAdditionalBoxCssClasses() {
            return ObjectListPanel.this.getAdditionalBoxCssClasses();
        }

        @Override
        protected WebMarkupContainer createButtonToolbar(String id) {
            WebMarkupContainer bar = ObjectListPanel.this.createTableButtonToolbar(id);
            return bar != null ? bar : super.createButtonToolbar(id);
        }
    };
    table.setOutputMarkupId(true);
    String storageKey = getStorageKey();
    if (StringUtils.isNotEmpty(storageKey)) {
        PageStorage storage = getPageStorage(storageKey);
        if (storage != null) {
            table.setCurrentPage(storage.getPaging());
        }
    }
    return table;
}
Also used : 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) PageStorage(com.evolveum.midpoint.web.session.PageStorage)

Example 8 with BoxedTablePanel

use of com.evolveum.midpoint.web.component.data.BoxedTablePanel in project midpoint by Evolveum.

the class ProcessInstancesPanel method initLayout.

private void initLayout(UserProfileStorage.TableId tableId, int pageSize, View view, final IModel<String> currentInstanceIdModel) {
    BoxedTablePanel<ProcessInstanceDto> table = new BoxedTablePanel<ProcessInstanceDto>(ID_REQUESTS_TABLE, provider, initColumns(view), tableId, pageSize) {

        @Override
        protected Item<ProcessInstanceDto> customizeNewRowItem(Item<ProcessInstanceDto> item, final IModel<ProcessInstanceDto> rowModel) {
            item.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    if (currentInstanceIdModel == null || currentInstanceIdModel.getObject() == null) {
                        return "";
                    }
                    ProcessInstanceDto rowDto = rowModel.getObject();
                    if (currentInstanceIdModel.getObject().equals(rowDto.getProcessInstanceId())) {
                        return "info";
                    } else {
                        return "";
                    }
                }
            }));
            return item;
        }
    };
    table.setOutputMarkupId(true);
    table.setAdditionalBoxCssClasses("without-box-header-top-border");
    add(table);
}
Also used : Item(org.apache.wicket.markup.repeater.Item) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) IModel(org.apache.wicket.model.IModel) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 9 with BoxedTablePanel

use of com.evolveum.midpoint.web.component.data.BoxedTablePanel in project midpoint by Evolveum.

the class ResourceDetailsTabPanel method initLayout.

protected void initLayout(IModel model, PageBase parentPage) {
    PrismObject<ResourceType> resourceObject = (PrismObject<ResourceType>) model.getObject();
    ResourceType resource = resourceObject.asObjectable();
    add(createLastAvailabilityStatusInfo(resource));
    add(createSourceTargetInfo(resource));
    add(createSchemaStatusInfo(resource));
    CapabilitiesPanel capabilities = new CapabilitiesPanel(PANEL_CAPABILITIES, capabilitiesModel);
    add(capabilities);
    List<ResourceConfigurationDto> resourceConfigList = createResourceConfigList(resource);
    ListDataProvider<ResourceConfigurationDto> resourceConfigProvider = new ListDataProvider<ResourceConfigurationDto>(ResourceDetailsTabPanel.this, new ListModel<ResourceConfigurationDto>(resourceConfigList));
    List<ColumnTypeDto<String>> columns = Arrays.asList(new ColumnTypeDto<String>("ShadowType.kind", "objectTypeDefinition.kind", ShadowType.F_KIND.getLocalPart()), new ColumnTypeDto<String>("ShadowType.objectClass", "objectTypeDefinition.objectClass.localPart", ShadowType.F_OBJECT_CLASS.getLocalPart()), new ColumnTypeDto<String>("ShadowType.intent", "objectTypeDefinition.intent", ShadowType.F_INTENT.getLocalPart()), new ColumnTypeDto<String>("ResourceType.isSync", "sync", null));
    List<IColumn<SelectableBean<ResourceType>, String>> tableColumns = ColumnUtils.createColumns(columns);
    PropertyColumn tasksColumn = new PropertyColumn(PageBase.createStringResourceStatic(this, "ResourceType.tasks"), "definedTasks") {

        @Override
        public void populateItem(Item item, String componentId, final IModel rowModel) {
            ResourceConfigurationDto conf = (ResourceConfigurationDto) rowModel.getObject();
            RepeatingView repeater = new RepeatingView(componentId);
            for (final TaskType task : conf.getDefinedTasks()) {
                repeater.add(new LinkPanel(repeater.newChildId(), new Model<String>(task.getName().getOrig())) {

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        ResourceDetailsTabPanel.this.taskDetailsPerformed(target, task.getOid());
                    }
                });
            }
            item.add(repeater);
        }
    };
    tableColumns.add(tasksColumn);
    BoxedTablePanel<ResourceConfigurationDto> resourceConfig = new BoxedTablePanel("resourceConfig", resourceConfigProvider, tableColumns);
    resourceConfig.setAdditionalBoxCssClasses("box-success");
    add(resourceConfig);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) ResourceConfigurationDto(com.evolveum.midpoint.web.page.admin.resources.dto.ResourceConfigurationDto) ColumnTypeDto(com.evolveum.midpoint.web.component.data.column.ColumnTypeDto) LinkPanel(com.evolveum.midpoint.web.component.data.column.LinkPanel) PrismObject(com.evolveum.midpoint.prism.PrismObject) Item(org.apache.wicket.markup.repeater.Item) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) IModel(org.apache.wicket.model.IModel) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) IModel(org.apache.wicket.model.IModel) ListModel(org.apache.wicket.model.util.ListModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel)

Example 10 with BoxedTablePanel

use of com.evolveum.midpoint.web.component.data.BoxedTablePanel in project midpoint by Evolveum.

the class PageCertDecisions method initLayout.

//endregion
//region Layout
private void initLayout() {
    Form mainForm = new Form(ID_MAIN_FORM);
    add(mainForm);
    CertWorkItemDtoProvider provider = createProvider();
    int itemsPerPage = (int) getItemsPerPage(UserProfileStorage.TableId.PAGE_CERT_DECISIONS_PANEL);
    BoxedTablePanel<CertWorkItemDto> table = new BoxedTablePanel<CertWorkItemDto>(ID_DECISIONS_TABLE, provider, initColumns(), UserProfileStorage.TableId.PAGE_CERT_DECISIONS_PANEL, itemsPerPage) {

        @Override
        protected WebMarkupContainer createHeader(String headerId) {
            return new SearchFragment(headerId, ID_TABLE_HEADER, PageCertDecisions.this, showNotDecidedOnlyModel);
        }
    };
    table.setShowPaging(true);
    table.setOutputMarkupId(true);
    // really don't know why this is necessary, as e.g. in PageRoles the size setting works without it
    table.setItemsPerPage(itemsPerPage);
    mainForm.add(table);
// adding this on outer feedback panel prevents displaying the error messages
//addVisibleOnWarningBehavior(getMainFeedbackPanel());
//addVisibleOnWarningBehavior(getTempFeedbackPanel());
}
Also used : CertWorkItemDtoProvider(com.evolveum.midpoint.web.page.admin.certification.dto.CertWorkItemDtoProvider) Form(org.apache.wicket.markup.html.form.Form) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) CertWorkItemDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertWorkItemDto)

Aggregations

BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)20 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)6 Form (org.apache.wicket.markup.html.form.Form)6 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)5 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)5 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)5 ArrayList (java.util.ArrayList)4 Item (org.apache.wicket.markup.repeater.Item)4 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)3 List (java.util.List)3 IModel (org.apache.wicket.model.IModel)3 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 ObjectDataProvider (com.evolveum.midpoint.web.component.data.ObjectDataProvider)2 AuditEventRecordProvider (com.evolveum.midpoint.web.page.admin.reports.dto.AuditEventRecordProvider)2 CSVDataExporter (org.apache.wicket.extensions.markup.html.repeater.data.table.export.CSVDataExporter)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 AbstractLink (org.apache.wicket.markup.html.link.AbstractLink)2 ResourceLink (org.apache.wicket.markup.html.link.ResourceLink)2 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)2 ResourceStreamResource (org.apache.wicket.request.resource.ResourceStreamResource)2