Search in sources :

Example 21 with IColumn

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

the class CertDecisionHelper method createDetailedInfoColumn.

<T extends CertCaseOrWorkItemDto> IColumn<T, String> createDetailedInfoColumn(final PageBase page) {
    IColumn column;
    column = new IconColumn<CertCaseOrWorkItemDto>(page.createStringResource("")) {

        @Override
        protected IModel<String> createIconModel(final IModel<CertCaseOrWorkItemDto> rowModel) {
            return new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    return "fa fa-fw fa-info-circle text-info";
                }
            };
        }

        @Override
        public void populateItem(Item<ICellPopulator<CertCaseOrWorkItemDto>> item, String componentId, IModel<CertCaseOrWorkItemDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            CertCaseOrWorkItemDto aCase = rowModel.getObject();
            String handlerUri;
            if (aCase instanceof CertWorkItemDto) {
                handlerUri = aCase.getHandlerUri();
            } else {
                handlerUri = ((PageCertCampaign) page).getCampaignHandlerUri();
            }
            CertGuiHandler handler = CertGuiHandlerRegistry.instance().getHandler(handlerUri);
            if (handler != null) {
                String title = handler.getCaseInfoButtonTitle(rowModel, page);
                item.add(AttributeModifier.replace("title", title));
                item.add(new TooltipBehavior());
            }
        }
    };
    return column;
}
Also used : IModel(org.apache.wicket.model.IModel) CertGuiHandler(com.evolveum.midpoint.web.page.admin.certification.handlers.CertGuiHandler) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) CertCaseOrWorkItemDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseOrWorkItemDto) TooltipBehavior(com.evolveum.midpoint.web.util.TooltipBehavior) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) CertWorkItemDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertWorkItemDto)

Example 22 with IColumn

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

the class CertDecisionHelper method createTypeColumn.

<T extends CertCaseOrWorkItemDto> IColumn<T, String> createTypeColumn(final WhichObject which, final PageBase page) {
    IColumn column;
    column = new IconColumn<CertCaseOrWorkItemDto>(page.createStringResource("")) {

        @Override
        protected IModel<String> createIconModel(IModel<CertCaseOrWorkItemDto> rowModel) {
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(which, rowModel);
            String icon = guiDescriptor != null ? guiDescriptor.getBlackIcon() : ObjectTypeGuiDescriptor.ERROR_ICON;
            return new Model<>(icon);
        }

        private ObjectTypeGuiDescriptor getObjectTypeDescriptor(WhichObject which, IModel<CertCaseOrWorkItemDto> rowModel) {
            QName targetType = rowModel.getObject().getObjectType(which);
            return ObjectTypeGuiDescriptor.getDescriptor(ObjectTypes.getObjectTypeFromTypeQName(targetType));
        }

        @Override
        public void populateItem(Item<ICellPopulator<CertCaseOrWorkItemDto>> item, String componentId, IModel<CertCaseOrWorkItemDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(which, rowModel);
            if (guiDescriptor != null) {
                item.add(AttributeModifier.replace("title", page.createStringResource(guiDescriptor.getLocalizationKey())));
                item.add(new TooltipBehavior());
            }
        }
    };
    return column;
}
Also used : IModel(org.apache.wicket.model.IModel) QName(javax.xml.namespace.QName) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) CertCaseOrWorkItemDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseOrWorkItemDto) TooltipBehavior(com.evolveum.midpoint.web.util.TooltipBehavior) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ObjectTypeGuiDescriptor(com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor)

Example 23 with IColumn

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

the class OrgUnitAddDeletePopup method initLayout.

public void initLayout(WebMarkupContainer content) {
    List<IColumn<SelectableBean<ObjectType>, String>> columns = initColumns();
    ObjectDataProvider provider = new ObjectDataProvider(getPageBase(), OrgType.class);
    provider.setQuery(getDataProviderQuery());
    TablePanel table = new TablePanel<SelectableBean<ObjectType>>(ID_TABLE, provider, columns);
    table.setOutputMarkupId(true);
    content.add(table);
    AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("orgUnitAddDeletePopup.button.cancel")) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            cancelPerformed(ajaxRequestTarget);
        }
    };
    content.add(cancelButton);
    AjaxButton actionButton = new AjaxButton(ID_BUTTON_ACTION, createActionButtonStringResource()) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            actionPerformed(target);
        }
    };
    actionButton.add(new AttributeAppender("class", getActionButtonClass()));
    content.add(actionButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ObjectDataProvider(com.evolveum.midpoint.web.component.data.ObjectDataProvider) AttributeAppender(org.apache.wicket.behavior.AttributeAppender) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 24 with IColumn

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

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

the class ResourceTasksPanel method initLayout.

private void initLayout(final ListModel<TaskType> tasks) {
    final MainObjectListPanel<TaskType> tasksPanel = new MainObjectListPanel<TaskType>(ID_TASKS_TABLE, TaskType.class, TableId.PAGE_RESOURCE_TASKS_PANEL, null, pageBase) {

        private static final long serialVersionUID = 1L;

        @Override
        protected BaseSortableDataProvider<SelectableBean<TaskType>> initProvider() {
            return new ListDataProvider2(pageBase, tasks);
        }

        @Override
        protected List<InlineMenuItem> createInlineMenu() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public void objectDetailsPerformed(AjaxRequestTarget target, TaskType task) {
            // TODO Auto-generated method stub
            //				super.objectDetailsPerformed(target, task);
            PageParameters parameters = new PageParameters();
            parameters.add(OnePageParameterEncoder.PARAMETER, task.getOid());
            getPageBase().navigateToNext(PageTaskEdit.class, parameters);
        }

        @Override
        protected void newObjectPerformed(AjaxRequestTarget target) {
            getPageBase().navigateToNext(PageTaskAdd.class);
        }

        @Override
        protected List<IColumn<SelectableBean<TaskType>, String>> createColumns() {
            return ColumnUtils.getDefaultTaskColumns();
        }
    };
    //		final ObjectListPanel<TaskType> tasksPanel = new ObjectListPanel<TaskType>(ID_TASKS_TABLE, TaskType.class, pageBase){
    //			
    //			@Override
    //			protected BaseSortableDataProvider<SelectableBean<TaskType>> getProvider() {
    //				return new ListDataProvider2(pageBase, tasks);
    //			}
    //			
    //			@Override
    //			public boolean isEditable() {
    //				return ResourceTasksPanel.this.editable;
    //			}
    //			
    //			@Override
    //			public void objectDetailsPerformed(AjaxRequestTarget target, TaskType task) {
    //				// TODO Auto-generated method stub
    //				super.objectDetailsPerformed(target, task);
    //				PageParameters parameters = new PageParameters();
    //		        parameters.add(OnePageParameterEncoder.PARAMETER, task.getOid());
    //		        setResponsePage(new PageTaskEdit(parameters));
    //			}
    //		};
    //		tasksPanel.setEditable(false);
    tasksPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_TASK_BOX_CSS_CLASSES);
    add(tasksPanel);
    AjaxButton runNow = new AjaxButton(ID_RUN_NOW, pageBase.createStringResource("pageTaskEdit.button.runNow")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            List<String> oids = createOidList(getTaskListPanel().getSelectedObjects());
            if (!oids.isEmpty()) {
                OperationResult result = TaskOperationUtils.runNowPerformed(pageBase.getTaskService(), oids);
                pageBase.showResult(result);
            } else {
                noTasksSelected();
            }
            target.add(pageBase.getFeedbackPanel());
        }
    };
    add(runNow);
    AjaxButton resume = new AjaxButton(ID_RESUME, pageBase.createStringResource("pageTaskEdit.button.resume")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            List<String> oids = createOidList(getTaskListPanel().getSelectedObjects());
            if (!oids.isEmpty()) {
                OperationResult result = TaskOperationUtils.resumePerformed(pageBase.getTaskService(), oids);
                pageBase.showResult(result);
            } else {
                noTasksSelected();
            }
            target.add(pageBase.getFeedbackPanel());
        }
    };
    add(resume);
    AjaxButton suspend = new AjaxButton(ID_SUSPEND, pageBase.createStringResource("pageTaskEdit.button.suspend")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            List<String> oids = createOidList(getTaskListPanel().getSelectedObjects());
            if (!oids.isEmpty()) {
                OperationResult result = TaskOperationUtils.suspendPerformed(pageBase.getTaskService(), oids);
                pageBase.showResult(result);
            } else {
                noTasksSelected();
            }
            target.add(pageBase.getFeedbackPanel());
        }
    };
    add(suspend);
}
Also used : MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) ListDataProvider2(com.evolveum.midpoint.web.component.util.ListDataProvider2) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Aggregations

IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)58 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)34 ArrayList (java.util.ArrayList)33 IModel (org.apache.wicket.model.IModel)28 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)21 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)19 Label (org.apache.wicket.markup.html.basic.Label)19 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)14 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)13 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)13 Model (org.apache.wicket.model.Model)12 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)9 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)8 Item (org.apache.wicket.markup.repeater.Item)8 PropertyModel (org.apache.wicket.model.PropertyModel)8 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)7 CheckBoxHeaderColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)7 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)7 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)7 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)6