Search in sources :

Example 6 with RepeatingView

use of org.apache.wicket.markup.repeater.RepeatingView in project midpoint by Evolveum.

the class ColumnUtils method createPropertyColumn.

private static <T> PropertyColumn<T, String> createPropertyColumn(String name, String sortableProperty, final String expression, final boolean multivalue) {
    return new PropertyColumn<T, String>(createStringResource(name), sortableProperty, expression) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item item, String componentId, IModel rowModel) {
            if (multivalue) {
                IModel<List> values = new PropertyModel<List>(rowModel, expression);
                RepeatingView repeater = new RepeatingView(componentId);
                for (final Object task : values.getObject()) {
                    repeater.add(new Label(repeater.newChildId(), task.toString()));
                }
                item.add(repeater);
                return;
            }
            super.populateItem(item, componentId, rowModel);
        }
    };
}
Also used : Item(org.apache.wicket.markup.repeater.Item) IModel(org.apache.wicket.model.IModel) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) PropertyModel(org.apache.wicket.model.PropertyModel) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) Label(org.apache.wicket.markup.html.basic.Label) ArrayList(java.util.ArrayList) List(java.util.List)

Example 7 with RepeatingView

use of org.apache.wicket.markup.repeater.RepeatingView in project midpoint by Evolveum.

the class PageAuditLogDetails method initDeltasPanel.

private void initDeltasPanel(WebMarkupContainer eventPanel) {
    List<ObjectDeltaOperationType> deltas = recordModel.getObject().getDelta();
    RepeatingView deltaScene = new RepeatingView(ID_DELTA_LIST_PANEL);
    for (ObjectDeltaOperationType deltaOp : deltas) {
        ObjectDeltaOperationPanel deltaPanel = new ObjectDeltaOperationPanel(deltaScene.newChildId(), Model.of(deltaOp), this);
        deltaPanel.setOutputMarkupId(true);
        deltaScene.add(deltaPanel);
    }
    eventPanel.addOrReplace(deltaScene);
}
Also used : ObjectDeltaOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) ObjectDeltaOperationPanel(com.evolveum.midpoint.gui.api.component.delta.ObjectDeltaOperationPanel)

Example 8 with RepeatingView

use of org.apache.wicket.markup.repeater.RepeatingView in project midpoint by Evolveum.

the class MultiStateHorizontalButton method initLayout.

private void initLayout() {
    WebMarkupContainer buttonsPanel = new WebMarkupContainer(ID_BUTTONS_CONTAINER);
    buttonsPanel.setOutputMarkupId(true);
    add(buttonsPanel);
    RepeatingView buttons = new RepeatingView(ID_BUTTON);
    buttons.setOutputMarkupId(true);
    buttonsPanel.add(buttons);
    for (String propertyKey : propertyKeysList) {
        AjaxSubmitButton button = new AjaxSubmitButton(buttons.newChildId(), pageBase.createStringResource(propertyKey)) {

            @Override
            public void onSubmit(AjaxRequestTarget ajaxRequestTarget, Form form) {
                MultiStateHorizontalButton.this.onStateChanged(propertyKeysList.indexOf(propertyKey), ajaxRequestTarget);
            }

            @Override
            public void onError(AjaxRequestTarget ajaxRequestTarget, Form form) {
                MultiStateHorizontalButton.this.onStateChanged(propertyKeysList.indexOf(propertyKey), ajaxRequestTarget);
            }
        };
        button.add(getActiveButtonClassAppender(propertyKeysList.indexOf(propertyKey)));
        button.setOutputMarkupId(true);
        buttons.add(button);
    }
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) Form(org.apache.wicket.markup.html.form.Form) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 9 with RepeatingView

use of org.apache.wicket.markup.repeater.RepeatingView 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 10 with RepeatingView

use of org.apache.wicket.markup.repeater.RepeatingView in project midpoint by Evolveum.

the class ResourceContentPanel method initColumns.

private List<IColumn<SelectableBean<ShadowType>, String>> initColumns() {
    List<ColumnTypeDto<String>> columnDefs = Arrays.asList(new ColumnTypeDto<String>("ShadowType.synchronizationSituation", SelectableBean.F_VALUE + ".synchronizationSituation", ShadowType.F_SYNCHRONIZATION_SITUATION.getLocalPart()), new ColumnTypeDto<String>("ShadowType.intent", SelectableBean.F_VALUE + ".intent", ShadowType.F_INTENT.getLocalPart()));
    List<IColumn<SelectableBean<ShadowType>, String>> columns = new ArrayList<>();
    IColumn<SelectableBean<ShadowType>, String> identifiersColumn = new AbstractColumn<SelectableBean<ShadowType>, String>(createStringResource("pageContentAccounts.identifiers")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ShadowType>>> cellItem, String componentId, IModel<SelectableBean<ShadowType>> rowModel) {
            SelectableBean<ShadowType> dto = rowModel.getObject();
            RepeatingView repeater = new RepeatingView(componentId);
            ShadowType value = dto.getValue();
            if (value != null) {
                for (ResourceAttribute<?> attr : ShadowUtil.getAllIdentifiers(value)) {
                    repeater.add(new Label(repeater.newChildId(), attr.getElementName().getLocalPart() + ": " + attr.getRealValue()));
                }
            }
            cellItem.add(repeater);
        }
    };
    columns.add(identifiersColumn);
    columns.addAll((Collection) ColumnUtils.createColumns(columnDefs));
    ObjectLinkColumn<SelectableBean<ShadowType>> ownerColumn = new ObjectLinkColumn<SelectableBean<ShadowType>>(createStringResource("pageContentAccounts.owner")) {

        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

                @Override
                public FocusType getObject() {
                    FocusType owner = loadShadowOwner(rowModel);
                    if (owner == null) {
                        return null;
                    }
                    return owner;
                }
            };
        }

        @Override
        public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ShadowType>> rowModel, ObjectType targetObjectType) {
            ownerDetailsPerformed(target, (FocusType) targetObjectType);
        }
    };
    columns.add(ownerColumn);
    columns.add(new LinkColumn<SelectableBean<ShadowType>>(createStringResource("PageAccounts.accounts.result")) {

        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

                @Override
                public String getObject() {
                    return getResultLabel(rowModel);
                }
            };
        }

        @Override
        public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ShadowType>> rowModel) {
            OperationResultType resultType = getResult(rowModel);
            OperationResult result = OperationResult.createOperationResult(resultType);
            OperationResultPanel body = new OperationResultPanel(ResourceContentPanel.this.getPageBase().getMainPopupBodyId(), new Model<OpResult>(OpResult.getOpResult(pageBase, result)), getPage());
            body.setOutputMarkupId(true);
            ResourceContentPanel.this.getPageBase().showMainPopup(body, target);
        }
    });
    return columns;
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) ArrayList(java.util.ArrayList) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) Label(org.apache.wicket.markup.html.basic.Label) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ColumnTypeDto(com.evolveum.midpoint.web.component.data.column.ColumnTypeDto) Item(org.apache.wicket.markup.repeater.Item) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) 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) IModel(org.apache.wicket.model.IModel) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResultPanel(com.evolveum.midpoint.gui.api.component.result.OperationResultPanel) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectLinkColumn(com.evolveum.midpoint.web.component.data.column.ObjectLinkColumn) 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) StringResourceModel(org.apache.wicket.model.StringResourceModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel)

Aggregations

RepeatingView (org.apache.wicket.markup.repeater.RepeatingView)19 Label (org.apache.wicket.markup.html.basic.Label)10 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)8 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)7 IModel (org.apache.wicket.model.IModel)5 Model (org.apache.wicket.model.Model)5 ArrayList (java.util.ArrayList)4 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)3 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)3 Item (org.apache.wicket.markup.repeater.Item)3 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)2 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 Task (com.evolveum.midpoint.task.api.Task)2 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)2 ColumnTypeDto (com.evolveum.midpoint.web.component.data.column.ColumnTypeDto)2 ObjectWrapper (com.evolveum.midpoint.web.component.prism.ObjectWrapper)2 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)2 List (java.util.List)2 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)2