Search in sources :

Example 6 with PropertyColumn

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

the class PageCreatedReports method initColumns.

//TODO - consider adding Author name, File Type and ReportType to columns
private List<IColumn<SelectableBean<ReportOutputType>, String>> initColumns(final AjaxDownloadBehaviorFromStream ajaxDownloadBehavior) {
    List<IColumn<SelectableBean<ReportOutputType>, String>> columns = new ArrayList<>();
    IColumn column;
    column = new CheckBoxHeaderColumn();
    columns.add(column);
    column = new PropertyColumn(createStringResource("pageCreatedReports.table.name"), "name", "value.name");
    columns.add(column);
    column = new PropertyColumn(createStringResource("pageCreatedReports.table.description"), "value.description");
    columns.add(column);
    column = new AbstractColumn<SelectableBean<ReportOutputType>, String>(createStringResource("pageCreatedReports.table.time"), "createTimestamp") {

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ReportOutputType>>> cellItem, String componentId, final IModel<SelectableBean<ReportOutputType>> rowModel) {
            cellItem.add(new DateLabelComponent(componentId, new AbstractReadOnlyModel<Date>() {

                @Override
                public Date getObject() {
                    ReportOutputType object = rowModel.getObject().getValue();
                    MetadataType metadata = object != null ? object.getMetadata() : null;
                    if (metadata == null) {
                        return null;
                    }
                    return XmlTypeConverter.toDate(metadata.getCreateTimestamp());
                }
            }, DateLabelComponent.LONG_MEDIUM_STYLE));
        }
    };
    columns.add(column);
    column = new AbstractColumn<SelectableBean<ReportOutputType>, String>(new Model(), null) {

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ReportOutputType>>> cellItem, String componentId, final IModel<SelectableBean<ReportOutputType>> model) {
            DownloadButtonPanel panel = new DownloadButtonPanel(componentId) {

                @Override
                protected void deletePerformed(AjaxRequestTarget target) {
                    deleteSelectedPerformed(target, ReportDeleteDialogDto.Operation.DELETE_SINGLE, model.getObject().getValue());
                }

                @Override
                protected void downloadPerformed(AjaxRequestTarget target) {
                    currentReport = model.getObject().getValue();
                    PageCreatedReports.this.downloadPerformed(target, model.getObject().getValue(), ajaxDownloadBehavior);
                }
            };
            cellItem.add(panel);
        }
    };
    columns.add(column);
    column = new InlineMenuHeaderColumn<InlineMenuable>(initInlineMenu()) {

        @Override
        public void populateItem(Item<ICellPopulator<InlineMenuable>> cellItem, String componentId, IModel<InlineMenuable> rowModel) {
            cellItem.add(new Label(componentId));
        }
    };
    columns.add(column);
    return columns;
}
Also used : PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) Label(org.apache.wicket.markup.html.basic.Label) ReportOutputType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) DateLabelComponent(com.evolveum.midpoint.web.component.DateLabelComponent) InlineMenuable(com.evolveum.midpoint.web.component.data.column.InlineMenuable) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DownloadButtonPanel(com.evolveum.midpoint.web.page.admin.reports.component.DownloadButtonPanel) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel)

Example 7 with PropertyColumn

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

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

the class PageResources method initResourceColumns.

private List<IColumn<SelectableBean<ResourceType>, String>> initResourceColumns() {
    List<IColumn<SelectableBean<ResourceType>, String>> columns = new ArrayList<>();
    columns.add(new PropertyColumn(createStringResource("pageResources.connectorType"), SelectableBean.F_VALUE + ".connector.connectorType"));
    columns.add(new PropertyColumn(createStringResource("pageResources.version"), SelectableBean.F_VALUE + ".connector.connectorVersion"));
    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) ArrayList(java.util.ArrayList) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)

Example 9 with PropertyColumn

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

the class PageCertCampaign method initColumns.

private List<IColumn<CertCaseDto, String>> initColumns() {
    List<IColumn<CertCaseDto, String>> columns = new ArrayList<>();
    IColumn column;
    column = helper.createTypeColumn(OBJECT, this);
    columns.add(column);
    column = helper.createObjectNameColumn(this, "PageCertCampaign.table.objectName");
    columns.add(column);
    column = helper.createTypeColumn(TARGET, this);
    columns.add(column);
    column = helper.createTargetNameColumn(this, "PageCertCampaign.table.targetName");
    columns.add(column);
    column = helper.createDetailedInfoColumn(this);
    columns.add(column);
    if (AccessCertificationApiConstants.EXCLUSION_HANDLER_URI.equals(campaignModel.getObject().getHandlerUri())) {
        column = helper.createConflictingNameColumn(this, "PageCertCampaign.table.conflictingTargetName");
        columns.add(column);
    }
    column = new PropertyColumn(createStringResource("PageCertCampaign.table.reviewers"), CertCaseDto.F_CURRENT_REVIEWERS);
    columns.add(column);
    column = new PropertyColumn(createStringResource("PageCertCampaign.table.reviewedAt"), CertCaseDto.F_REVIEWED_AT);
    columns.add(column);
    column = new PropertyColumn(createStringResource("PageCertCampaign.table.reviewedBy"), CertCaseDto.F_REVIEWED_BY);
    columns.add(column);
    column = new PropertyColumn(createStringResource("PageCertCampaign.table.reviewedInStage"), CertCaseDto.F_CURRENT_RESPONSE_STAGE_NUMBER);
    columns.add(column);
    final AvailableResponses availableResponses = new AvailableResponses(getPage());
    final int responses = availableResponses.getCount();
    column = new MultiButtonColumn<CertCaseDto>(new Model(), responses + 1) {

        @Override
        public String getCaption(int id) {
            return availableResponses.getCaption(id);
        }

        @Override
        public boolean isButtonEnabled(int id, IModel<CertCaseDto> model) {
            return false;
        }

        @Override
        public boolean isButtonVisible(int id, IModel<CertCaseDto> model) {
            if (id < responses) {
                return true;
            } else {
                return !availableResponses.isAvailable(model.getObject().getOverallOutcome());
            }
        }

        @Override
        public String getButtonColorCssClass(int id) {
            if (id < responses) {
                return getDecisionButtonColor(getRowModel(), availableResponses.getResponseValues().get(id));
            } else {
                return BUTTON_COLOR_CLASS.DANGER.toString();
            }
        }
    };
    columns.add(column);
    column = new PropertyColumn(createStringResource("PageCertCampaign.table.comments"), CertCaseDto.F_COMMENTS);
    columns.add(column);
    column = new PropertyColumn(createStringResource("PageCertCampaign.table.remediedAt"), CertCaseDto.F_REMEDIED_AT);
    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) ArrayList(java.util.ArrayList) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) NonEmptyLoadableModel(com.evolveum.midpoint.gui.api.model.NonEmptyLoadableModel) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) CertCaseDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseDto) AvailableResponses(com.evolveum.midpoint.web.page.admin.certification.helpers.AvailableResponses)

Example 10 with PropertyColumn

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

the class PageCertDefinitions method initColumns.

private List<IColumn<SelectableBean<AccessCertificationDefinitionType>, String>> initColumns() {
    List<IColumn<SelectableBean<AccessCertificationDefinitionType>, String>> columns = new ArrayList<>();
    IColumn column;
    column = new PropertyColumn(createStringResource("PageCertDefinitions.table.description"), "value.description");
    columns.add(column);
    column = new MultiButtonColumn<SelectableBean<AccessCertificationDefinitionType>>(new Model(), 3) {

        private final String[] captionKeys = { "PageCertDefinitions.button.createCampaign", "PageCertDefinitions.button.showCampaigns", "PageCertDefinitions.button.deleteDefinition" };

        private final DoubleButtonColumn.BUTTON_COLOR_CLASS[] colors = { DoubleButtonColumn.BUTTON_COLOR_CLASS.PRIMARY, DoubleButtonColumn.BUTTON_COLOR_CLASS.DEFAULT, DoubleButtonColumn.BUTTON_COLOR_CLASS.DANGER };

        @Override
        public String getCaption(int id) {
            return PageCertDefinitions.this.createStringResource(captionKeys[id]).getString();
        }

        @Override
        public String getButtonColorCssClass(int id) {
            return colors[id].toString();
        }

        @Override
        public void clickPerformed(int id, AjaxRequestTarget target, IModel<SelectableBean<AccessCertificationDefinitionType>> model) {
            switch(id) {
                case 0:
                    createCampaignPerformed(target, model.getObject().getValue());
                    break;
                case 1:
                    showCampaignsPerformed(target, model.getObject().getValue());
                    break;
                case 2:
                    deleteConfirmation(target, model.getObject().getValue());
                    break;
            }
        }
    };
    columns.add(column);
    return columns;
}
Also used : AccessCertificationDefinitionType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationDefinitionType) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model)

Aggregations

PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)21 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)19 ArrayList (java.util.ArrayList)15 IModel (org.apache.wicket.model.IModel)14 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)11 Label (org.apache.wicket.markup.html.basic.Label)9 Model (org.apache.wicket.model.Model)8 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)7 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)7 PropertyModel (org.apache.wicket.model.PropertyModel)6 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)5 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)5 Item (org.apache.wicket.markup.repeater.Item)5 CheckBoxHeaderColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)3 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)3 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)2 CheckBoxColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxColumn)2 EnumPropertyColumn (com.evolveum.midpoint.web.component.data.column.EnumPropertyColumn)2 InlineMenuHeaderColumn (com.evolveum.midpoint.web.component.data.column.InlineMenuHeaderColumn)2