Search in sources :

Example 26 with ICellPopulator

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

the class PageTasks method initNodeColumns.

private List<IColumn<NodeDto, String>> initNodeColumns() {
    List<IColumn<NodeDto, String>> columns = new ArrayList<>();
    IColumn column = new CheckBoxHeaderColumn<>();
    columns.add(column);
    column = new PropertyColumn<>(createStringResource("pageTasks.node.name"), "name", "name");
    columns.add(column);
    columns.add(new EnumPropertyColumn<NodeDto>(createStringResource("pageTasks.node.executionStatus"), "executionStatus") {

        @Override
        protected String translate(Enum en) {
            return createStringResource(en).getString();
        }
    });
    columns.add(new PropertyColumn(createStringResource("pageTasks.node.managementPort"), "managementPort"));
    columns.add(new AbstractColumn<NodeDto, String>(createStringResource("pageTasks.node.lastCheckInTime")) {

        @Override
        public void populateItem(Item<ICellPopulator<NodeDto>> item, String componentId, final IModel<NodeDto> rowModel) {
            item.add(new Label(componentId, new AbstractReadOnlyModel<Object>() {

                @Override
                public Object getObject() {
                    return createLastCheckInTime(rowModel);
                }
            }));
        }
    });
    CheckBoxColumn check = new CheckBoxColumn(createStringResource("pageTasks.node.clustered"), "clustered");
    check.setEnabled(false);
    columns.add(check);
    columns.add(new PropertyColumn(createStringResource("pageTasks.node.statusMessage"), "statusMessage"));
    IColumn<NodeDto, String> menuColumn = new InlineMenuButtonColumn<NodeDto>(createNodesInlineMenu(false), 2, PageTasks.this) {

        @Override
        protected int getHeaderNumberOfButtons() {
            return 2;
        }

        @Override
        protected List<InlineMenuItem> getHeaderMenuItems() {
            return createNodesInlineMenu(true);
        }
    };
    columns.add(menuColumn);
    return columns;
}
Also used : PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) Label(org.apache.wicket.markup.html.basic.Label) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PrismObject(com.evolveum.midpoint.prism.PrismObject) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Example 27 with ICellPopulator

use of org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator in project syncope by apache.

the class AccessTokenDirectoryPanel method getColumns.

@Override
protected List<IColumn<AccessTokenTO, String>> getColumns() {
    List<IColumn<AccessTokenTO, String>> columns = new ArrayList<>();
    columns.add(new KeyPropertyColumn<>(new StringResourceModel(Constants.KEY_FIELD_NAME, this), Constants.KEY_FIELD_NAME, Constants.KEY_FIELD_NAME));
    columns.add(new PropertyColumn<>(new ResourceModel("owner"), "owner", "owner"));
    columns.add(new AbstractColumn<AccessTokenTO, String>(new ResourceModel("issuedAt", "")) {

        private static final long serialVersionUID = -1822504503325964706L;

        @Override
        public void populateItem(final Item<ICellPopulator<AccessTokenTO>> cellItem, final String componentId, final IModel<AccessTokenTO> model) {
            JwsJwtCompactConsumer consumer = new JwsJwtCompactConsumer(model.getObject().getBody());
            cellItem.add(new Label(componentId, SyncopeConsoleSession.get().getDateFormat().format(new Date(consumer.getJwtClaims().getIssuedAt()))));
        }
    });
    columns.add(new DatePropertyColumn<>(new ResourceModel("expiryTime"), "expiryTime", "expiryTime"));
    return columns;
}
Also used : AccessTokenTO(org.apache.syncope.common.lib.to.AccessTokenTO) ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) Date(java.util.Date) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) StringResourceModel(org.apache.wicket.model.StringResourceModel) ResourceModel(org.apache.wicket.model.ResourceModel) JwsJwtCompactConsumer(org.apache.cxf.rs.security.jose.jws.JwsJwtCompactConsumer) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Example 28 with ICellPopulator

use of org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator in project syncope by apache.

the class ParametersDirectoryPanel method getColumns.

@Override
protected List<IColumn<AttrTO, String>> getColumns() {
    final List<IColumn<AttrTO, String>> columns = new ArrayList<>();
    columns.add(new PropertyColumn<>(new ResourceModel("schema"), "schema"));
    columns.add(new PropertyColumn<AttrTO, String>(new ResourceModel("values"), "values") {

        private static final long serialVersionUID = -1822504503325964706L;

        @Override
        public void populateItem(final Item<ICellPopulator<AttrTO>> item, final String componentId, final IModel<AttrTO> rowModel) {
            PlainSchemaTO modelSchemaTO = (PlainSchemaTO) rowModel.getObject().getSchemaInfo();
            AttrSchemaType type = modelSchemaTO.getType();
            if (type == AttrSchemaType.Binary || type == AttrSchemaType.Encrypted) {
                item.add(new Label(componentId, type.name()).add(new AttributeModifier("style", "font-style:italic")));
            } else {
                super.populateItem(item, componentId, rowModel);
            }
        }
    });
    return columns;
}
Also used : ArrayList(java.util.ArrayList) AttrTO(org.apache.syncope.common.lib.to.AttrTO) Label(org.apache.wicket.markup.html.basic.Label) AttributeModifier(org.apache.wicket.AttributeModifier) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) PlainSchemaTO(org.apache.syncope.common.lib.to.PlainSchemaTO) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) AttrSchemaType(org.apache.syncope.common.lib.types.AttrSchemaType) StringResourceModel(org.apache.wicket.model.StringResourceModel) ResourceModel(org.apache.wicket.model.ResourceModel)

Example 29 with ICellPopulator

use of org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator in project syncope by apache.

the class ReportDirectoryPanel method getColumns.

@Override
protected List<IColumn<ReportTO, String>> getColumns() {
    final List<IColumn<ReportTO, 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 DatePropertyColumn<>(new StringResourceModel("lastExec", this), "lastExec", "lastExec"));
    columns.add(new DatePropertyColumn<>(new StringResourceModel("nextExec", this), "nextExec", "nextExec"));
    columns.add(new DatePropertyColumn<>(new StringResourceModel("start", this), "start", "start"));
    columns.add(new DatePropertyColumn<>(new StringResourceModel("end", this), "end", "end"));
    columns.add(new PropertyColumn<>(new StringResourceModel("latestExecStatus", this), "latestExecStatus", "latestExecStatus"));
    columns.add(new BooleanPropertyColumn<>(new StringResourceModel("active", this), "active", "active"));
    columns.add(new AbstractColumn<ReportTO, String>(new Model<>(""), "running") {

        private static final long serialVersionUID = 4209532514416998046L;

        @Override
        public void populateItem(final Item<ICellPopulator<ReportTO>> cellItem, final String componentId, final IModel<ReportTO> rowModel) {
            JobTO jobTO = restClient.getJob(rowModel.getObject().getKey());
            JobActionPanel panel = new JobActionPanel(componentId, jobTO, false, ReportDirectoryPanel.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 : ArrayList(java.util.ArrayList) ReportTO(org.apache.syncope.common.lib.to.ReportTO) 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) StringResourceModel(org.apache.wicket.model.StringResourceModel) CompoundPropertyModel(org.apache.wicket.model.CompoundPropertyModel) 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 30 with ICellPopulator

use of org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator 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)

Aggregations

ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)37 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)34 IModel (org.apache.wicket.model.IModel)25 Label (org.apache.wicket.markup.html.basic.Label)24 ArrayList (java.util.ArrayList)22 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)14 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)12 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)10 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)10 Model (org.apache.wicket.model.Model)9 PrismObject (com.evolveum.midpoint.prism.PrismObject)7 StringResourceModel (org.apache.wicket.model.StringResourceModel)6 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)5 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)5 TooltipBehavior (com.evolveum.midpoint.web.util.TooltipBehavior)5 AttributeModifier (org.apache.wicket.AttributeModifier)5 PropertyModel (org.apache.wicket.model.PropertyModel)5 CheckBoxHeaderColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)4 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)4 List (java.util.List)4