Search in sources :

Example 21 with PropertyColumn

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

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