Search in sources :

Example 86 with IColumn

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

the class LoggingConfigPanel method initAppenderColumns.

private List<IColumn<AppenderConfiguration, String>> initAppenderColumns() {
    List<IColumn<AppenderConfiguration, String>> columns = new ArrayList<>();
    IColumn column = new CheckBoxHeaderColumn<AppenderConfiguration>();
    columns.add(column);
    //name columns (editable)
    column = new EditableLinkColumn<AppenderConfiguration>(createStringResource("LoggingConfigPanel.appenders.name"), "name") {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<AppenderConfiguration> rowModel) {
            appenderEditPerformed(target, rowModel);
        }

        @Override
        protected Component createInputPanel(String componentId, IModel<AppenderConfiguration> model) {
            TextPanel<String> panel = new TextPanel<String>(componentId, new PropertyModel(model, getPropertyExpression()));
            panel.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
            panel.getBaseFormComponent().add(new NotNullValidator<String>("message.emptyString"));
            addAjaxFormComponentUpdatingBehavior(panel.getBaseFormComponent());
            return panel;
        }
    };
    columns.add(column);
    //pattern column (editable)
    column = new EditablePropertyColumn(createStringResource("LoggingConfigPanel.appenders.pattern"), "pattern") {

        @Override
        protected InputPanel createInputPanel(String componentId, IModel model) {
            InputPanel panel = super.createInputPanel(componentId, model);
            panel.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
            panel.getBaseFormComponent().add(new NotNullValidator<String>("message.emptyString"));
            addAjaxFormComponentUpdatingBehavior(panel.getBaseFormComponent());
            return panel;
        }
    };
    columns.add(column);
    //file path column (editable)
    column = new FileAppenderColumn(createStringResource("LoggingConfigPanel.appenders.filePath"), "filePath");
    columns.add(column);
    //file pattern column (editable)                                                                               jj
    column = new FileAppenderColumn(createStringResource("LoggingConfigPanel.appenders.filePattern"), "filePattern");
    columns.add(column);
    //max history column (editable)
    column = new FileAppenderColumn(createStringResource("LoggingConfigPanel.appenders.maxHistory"), "maxHistory") {

        @Override
        protected InputPanel createInputPanel(String componentId, IModel model) {
            TextPanel panel = new TextPanel<>(componentId, new PropertyModel<String>(model, getPropertyExpression()));
            FormComponent component = panel.getBaseFormComponent();
            component.add(new AttributeModifier("size", 5));
            component.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
            addAjaxFormComponentUpdatingBehavior(component);
            return panel;
        }
    };
    columns.add(column);
    //max file size column (editable)
    column = new FileAppenderColumn(createStringResource("LoggingConfigPanel.appenders.maxFileSize"), "maxFileSize") {

        @Override
        protected InputPanel createInputPanel(String componentId, IModel model) {
            TextPanel<String> panel = new TextPanel<>(componentId, new PropertyModel<String>(model, getPropertyExpression()));
            FormComponent component = panel.getBaseFormComponent();
            component.add(new AttributeModifier("size", 5));
            component.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
            component.add(new NotNullValidator<String>("message.emptyString"));
            addAjaxFormComponentUpdatingBehavior(component);
            return panel;
        }
    };
    columns.add(column);
    CheckBoxColumn check = new EditableCheckboxColumn(createStringResource("LoggingConfigPanel.appenders.appending"), "appending") {

        @Override
        protected InputPanel createInputPanel(String componentId, IModel model) {
            InputPanel panel = super.createInputPanel(componentId, model);
            panel.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
            panel.getBaseFormComponent().add(new NotNullValidator<String>("message.emptyString"));
            addAjaxFormComponentUpdatingBehavior(panel.getBaseFormComponent());
            return panel;
        }
    };
    check.setEnabled(false);
    columns.add(check);
    return columns;
}
Also used : FormComponent(org.apache.wicket.markup.html.form.FormComponent) ArrayList(java.util.ArrayList) TextPanel(com.evolveum.midpoint.web.component.input.TextPanel) AppenderConfiguration(com.evolveum.midpoint.web.page.admin.configuration.dto.AppenderConfiguration) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) EditablePropertyColumn(com.evolveum.midpoint.web.component.data.column.EditablePropertyColumn) Component(org.apache.wicket.Component) FormComponent(org.apache.wicket.markup.html.form.FormComponent) IModel(org.apache.wicket.model.IModel) InputPanel(com.evolveum.midpoint.web.component.prism.InputPanel) PropertyModel(org.apache.wicket.model.PropertyModel) NotNullValidator(com.evolveum.midpoint.web.component.input.validator.NotNullValidator) AttributeModifier(org.apache.wicket.AttributeModifier) CheckBoxColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxColumn) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) EditableCheckboxColumn(com.evolveum.midpoint.web.component.data.column.EditableCheckboxColumn) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)

Example 87 with IColumn

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

the class PageAccounts method createAccountsColumns.

private List<IColumn> createAccountsColumns() {
    List<IColumn> columns = new ArrayList<>();
    columns.add(new PropertyColumn(createStringResource("PageAccounts.accounts.oid"), SelectableBean.F_VALUE + ".oid"));
    columns.add(new PropertyColumn<>(createStringResource("PageAccounts.accounts.name"), ShadowType.F_NAME.getLocalPart(), SelectableBean.F_VALUE + ".name"));
    columns.add(new PropertyColumn<>(createStringResource("PageAccounts.accounts.kind"), ShadowType.F_KIND.getLocalPart(), SelectableBean.F_VALUE + ".kind"));
    columns.add(new PropertyColumn<>(createStringResource("PageAccounts.accounts.intent"), ShadowType.F_INTENT.getLocalPart(), SelectableBean.F_VALUE + ".intent"));
    columns.add(new PropertyColumn<QName, String>(createStringResource("PageAccounts.accounts.objectClass"), ShadowType.F_OBJECT_CLASS.getLocalPart(), SelectableBean.F_VALUE + ".objectClass.localPart"));
    columns.add(new PropertyColumn<>(createStringResource("PageAccounts.accounts.synchronizationSituation"), ShadowType.F_SYNCHRONIZATION_SITUATION.getLocalPart(), SelectableBean.F_VALUE + ".synchronizationSituation"));
    columns.add(new PropertyColumn<>(createStringResource("PageAccounts.accounts.synchronizationTimestamp"), ShadowType.F_SYNCHRONIZATION_TIMESTAMP.getLocalPart(), SelectableBean.F_VALUE + ".synchronizationTimestamp"));
    //        columns.add(new PropertyColumn<>(createStringResource("PageAccounts.accounts.result"),
    //                ShadowType.F_RESULT.getLocalPart(), SelectableBean.F_VALUE + ".result.status"));
    columns.add(new LinkColumn<SelectableBean>(createStringResource("PageAccounts.accounts.result")) {

        @Override
        protected IModel<String> createLinkModel(final IModel<SelectableBean> rowModel) {
            return new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    OperationResultType result = getResult(rowModel);
                    if (result == null) {
                        return "";
                    }
                    return createStringResource("OperationResultStatusType." + result.getStatus()).getObject();
                }
            };
        }

        @Override
        public void onClick(AjaxRequestTarget target, IModel<SelectableBean> rowModel) {
            showShadowResult(target, rowModel);
        }
    });
    columns.add(new LinkColumn<SelectableBean>(createStringResource("PageAccounts.accounts.owner")) {

        @Override
        protected IModel<String> createLinkModel(final IModel<SelectableBean> rowModel) {
            return new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    FocusType focus = loadShadowOwner(rowModel);
                    return WebComponentUtil.getName(focus);
                }
            };
        }

        @Override
        public void onClick(AjaxRequestTarget target, IModel<SelectableBean> rowModel) {
            ownerDetailsPerformed(target, rowModel);
        }
    });
    return columns;
}
Also used : IModel(org.apache.wicket.model.IModel) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) FocusType(com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean)

Example 88 with IColumn

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

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

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

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