Search in sources :

Example 1 with CapabilitiesPanel

use of com.evolveum.midpoint.web.page.admin.resources.CapabilitiesPanel in project midpoint by Evolveum.

the class ResourceDetailsTabPanel method initLayout.

protected void initLayout() {
    // PrismObject<ResourceType> resourceObject = getObjectWrapper().getObject();
    // ResourceType resource = resourceObject.asObjectable();
    add(createLastAvailabilityStatusInfo());
    add(createSourceTargetInfo());
    add(createSchemaStatusInfo());
    CapabilitiesPanel capabilities = new CapabilitiesPanel(PANEL_CAPABILITIES, capabilitiesModel);
    add(capabilities);
    ListDataProvider<ResourceConfigurationDto> resourceConfigProvider = new ListDataProvider<>(ResourceDetailsTabPanel.this, createResourceConfigListModel());
    List<IColumn<SelectableBeanImpl<ResourceType>, String>> tableColumns = new ArrayList<>();
    tableColumns.add(ColumnUtils.createPropertyColumn(new ColumnTypeDto<>("ShadowType.kind", "objectTypeDefinition.kind", ShadowType.F_KIND.getLocalPart())));
    tableColumns.add(new PropertyColumn<>(createStringResource("ShadowType.objectClass"), "objectTypeDefinition.objectClass") {

        @Override
        public IModel<?> getDataModel(IModel<SelectableBeanImpl<ResourceType>> rowModel) {
            IModel<QName> model = (IModel<QName>) super.getDataModel(rowModel);
            if (model.getObject() != null) {
                return () -> model.getObject().getLocalPart();
            }
            return model;
        }
    });
    List<ColumnTypeDto<String>> columns = Arrays.asList(new ColumnTypeDto<>("ShadowType.intent", "objectTypeDefinition.intent", ShadowType.F_INTENT.getLocalPart()), new ColumnTypeDto<>("ResourceType.isSync", "sync", null));
    tableColumns.addAll(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 AjaxLinkPanel(repeater.newChildId(), new Model<>(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) SelectableBeanImpl(com.evolveum.midpoint.web.component.util.SelectableBeanImpl) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) 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) Item(org.apache.wicket.markup.repeater.Item) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) IModel(org.apache.wicket.model.IModel) QName(javax.xml.namespace.QName) AjaxLinkPanel(com.evolveum.midpoint.web.component.data.column.AjaxLinkPanel) CapabilitiesPanel(com.evolveum.midpoint.web.page.admin.resources.CapabilitiesPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) IModel(org.apache.wicket.model.IModel) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) Model(org.apache.wicket.model.Model) ResourceDetailsModel(com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel)

Aggregations

LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)1 ResourceDetailsModel (com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel)1 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)1 AjaxLinkPanel (com.evolveum.midpoint.web.component.data.column.AjaxLinkPanel)1 ColumnTypeDto (com.evolveum.midpoint.web.component.data.column.ColumnTypeDto)1 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)1 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)1 CapabilitiesPanel (com.evolveum.midpoint.web.page.admin.resources.CapabilitiesPanel)1 ResourceConfigurationDto (com.evolveum.midpoint.web.page.admin.resources.dto.ResourceConfigurationDto)1 ArrayList (java.util.ArrayList)1 QName (javax.xml.namespace.QName)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)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 Item (org.apache.wicket.markup.repeater.Item)1 RepeatingView (org.apache.wicket.markup.repeater.RepeatingView)1 IModel (org.apache.wicket.model.IModel)1 Model (org.apache.wicket.model.Model)1