Search in sources :

Example 1 with CertCaseDto

use of com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseDto 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(this);
    final int responses = availableResponses.getCount();
    column = new AbstractColumn<CertCaseDto, String>(new Model<>()) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<CertCaseDto>> cellItem, String componentId, IModel<CertCaseDto> rowModel) {
            cellItem.add(new MultiButtonPanel<CertCaseDto>(componentId, rowModel, responses + 1) {

                private static final long serialVersionUID = 1L;

                @Override
                protected Component createButton(int index, String componentId, IModel<CertCaseDto> model) {
                    AjaxIconButton btn = null;
                    if (index < responses) {
                        btn = buildDefaultButton(componentId, null, new Model(availableResponses.getTitle(index)), new Model<>("btn btn-sm " + getDecisionButtonColor(model, availableResponses.getResponseValues().get(index))), null);
                    } else {
                        btn = buildDefaultButton(componentId, null, new Model(availableResponses.getTitle(index)), new Model<>("btn btn-sm " + ButtonColorClass.DANGER), null);
                        btn.add(new VisibleBehaviour(() -> !availableResponses.isAvailable(model.getObject().getOverallOutcome())));
                    }
                    btn.setEnabled(false);
                    return btn;
                }
            });
        }
    };
    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 : IModel(org.apache.wicket.model.IModel) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) CertCaseDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseDto) AvailableResponses(com.evolveum.midpoint.web.page.admin.certification.helpers.AvailableResponses) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) IModel(org.apache.wicket.model.IModel) 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) AjaxIconButton(com.evolveum.midpoint.web.component.AjaxIconButton) MultiButtonPanel(com.evolveum.midpoint.web.component.data.MultiButtonPanel)

Aggregations

LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 NonEmptyLoadableModel (com.evolveum.midpoint.gui.api.model.NonEmptyLoadableModel)1 AjaxIconButton (com.evolveum.midpoint.web.component.AjaxIconButton)1 MultiButtonPanel (com.evolveum.midpoint.web.component.data.MultiButtonPanel)1 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)1 CertCaseDto (com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseDto)1 AvailableResponses (com.evolveum.midpoint.web.page.admin.certification.helpers.AvailableResponses)1 ArrayList (java.util.ArrayList)1 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)1 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)1 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)1 IModel (org.apache.wicket.model.IModel)1 Model (org.apache.wicket.model.Model)1 PropertyModel (org.apache.wicket.model.PropertyModel)1