Search in sources :

Example 1 with TablePanel

use of com.evolveum.midpoint.web.component.data.TablePanel in project midpoint by Evolveum.

the class AddCapabilityDialog method initLayout.

private void initLayout(WebMarkupContainer container) {
    List<IColumn<CapabilityDto<CapabilityType>, String>> columns = initColumns();
    TablePanel<CapabilityDto<CapabilityType>> table = new TablePanel<>(ID_TABLE, createProvider(), columns);
    table.setOutputMarkupId(true);
    table.setShowPaging(false);
    container.add(table);
    AjaxButton cancelButton = new AjaxButton(ID_CANCEL, createStringResource("addCapabilityDialog.button.cancel")) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            cancelPerformed(ajaxRequestTarget);
        }
    };
    container.add(cancelButton);
    AjaxButton addButton = new AjaxButton(ID_ADD, createStringResource("addCapabilityDialog.button.Add")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            addPerformed(target);
        }
    };
    container.add(addButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) CapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CapabilityType) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) CapabilityDto(com.evolveum.midpoint.web.component.wizard.resource.dto.CapabilityDto) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 2 with TablePanel

use of com.evolveum.midpoint.web.component.data.TablePanel in project midpoint by Evolveum.

the class TaskResultTabPanel method initLayout.

private void initLayout(final IModel<TaskDto> taskDtoModel, final PageBase pageBase) {
    SortableDataProvider<OperationResult, String> provider = new ListDataProvider<>(this, new PropertyModel<List<OperationResult>>(taskDtoModel, TaskDto.F_OP_RESULT));
    TablePanel resultTablePanel = new TablePanel<>(ID_OPERATION_RESULT, provider, initResultColumns());
    resultTablePanel.setStyle("padding-top: 0px;");
    resultTablePanel.setShowPaging(false);
    resultTablePanel.setOutputMarkupId(true);
    add(resultTablePanel);
    add(new AjaxFallbackLink(ID_SHOW_RESULT) {

        public void onClick(AjaxRequestTarget target) {
            OperationResult opResult = taskDtoModel.getObject().getTaskOperationResult();
            OperationResultPanel body = new OperationResultPanel(pageBase.getMainPopupBodyId(), new Model<>(OpResult.getOpResult(pageBase, opResult)), pageBase);
            body.setOutputMarkupId(true);
            pageBase.showMainPopup(body, target);
        }
    });
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) OperationResultPanel(com.evolveum.midpoint.gui.api.component.result.OperationResultPanel) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ArrayList(java.util.ArrayList) List(java.util.List) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 3 with TablePanel

use of com.evolveum.midpoint.web.component.data.TablePanel in project midpoint by Evolveum.

the class TaskSubtasksAndThreadsTabPanel method initLayout.

private void initLayout(final IModel<TaskDto> taskDtoModel) {
    WebMarkupContainer threadsConfigurationPanel = new WebMarkupContainer(ID_THREADS_CONFIGURATION_PANEL);
    add(threadsConfigurationPanel);
    threadsConfigurationPanel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return taskDtoModel.getObject().configuresWorkerThreads();
        }
    });
    final TextField<Integer> workerThreads = new TextField<>(ID_WORKER_THREADS, new PropertyModel<Integer>(taskDtoModel, TaskDto.F_WORKER_THREADS));
    workerThreads.setOutputMarkupId(true);
    workerThreads.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return parentPage.isEdit();
        }
    });
    threadsConfigurationPanel.add(workerThreads);
    VisibleEnableBehaviour hiddenWhenEditingOrNoSubtasks = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !parentPage.isEdit() && !taskDtoModel.getObject().getSubtasks().isEmpty();
        }
    };
    Label subtasksLabel = new Label(ID_SUBTASKS_LABEL, new ResourceModel("pageTaskEdit.subtasksLabel"));
    subtasksLabel.add(hiddenWhenEditingOrNoSubtasks);
    add(subtasksLabel);
    SubtasksPanel subtasksPanel = new SubtasksPanel(ID_SUBTASKS_PANEL, new PropertyModel<List<TaskDto>>(taskDtoModel, TaskDto.F_SUBTASKS), parentPage.getWorkflowManager().isEnabled());
    subtasksPanel.add(hiddenWhenEditingOrNoSubtasks);
    add(subtasksPanel);
    VisibleEnableBehaviour hiddenWhenNoSubtasks = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            TaskDto taskDto = taskDtoModel.getObject();
            return taskDto != null && !taskDto.getTransientSubtasks().isEmpty();
        }
    };
    Label workerThreadsTableLabel = new Label(ID_WORKER_THREADS_TABLE_LABEL, new ResourceModel("TaskStatePanel.workerThreads"));
    workerThreadsTableLabel.add(hiddenWhenNoSubtasks);
    add(workerThreadsTableLabel);
    List<IColumn<WorkerThreadDto, String>> columns = new ArrayList<>();
    columns.add(new PropertyColumn(createStringResourceStatic(this, "TaskStatePanel.subtaskName"), WorkerThreadDto.F_NAME));
    columns.add(new EnumPropertyColumn<WorkerThreadDto>(createStringResourceStatic(this, "TaskStatePanel.subtaskState"), WorkerThreadDto.F_EXECUTION_STATUS));
    columns.add(new PropertyColumn(createStringResourceStatic(this, "TaskStatePanel.subtaskObjectsProcessed"), WorkerThreadDto.F_PROGRESS));
    ISortableDataProvider<WorkerThreadDto, String> threadsProvider = new ListDataProvider<>(this, new AbstractReadOnlyModel<List<WorkerThreadDto>>() {

        @Override
        public List<WorkerThreadDto> getObject() {
            List<WorkerThreadDto> rv = new ArrayList<>();
            TaskDto taskDto = taskDtoModel.getObject();
            if (taskDto != null) {
                for (TaskDto subtaskDto : taskDto.getTransientSubtasks()) {
                    rv.add(new WorkerThreadDto(subtaskDto));
                }
            }
            return rv;
        }
    });
    TablePanel<WorkerThreadDto> workerThreadsTablePanel = new TablePanel<>(ID_WORKER_THREADS_TABLE, threadsProvider, columns);
    workerThreadsTablePanel.add(hiddenWhenNoSubtasks);
    add(workerThreadsTablePanel);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) EnumPropertyColumn(com.evolveum.midpoint.web.component.data.column.EnumPropertyColumn) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) Label(org.apache.wicket.markup.html.basic.Label) ArrayList(java.util.ArrayList) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) SubtasksPanel(com.evolveum.midpoint.web.page.admin.server.subtasks.SubtasksPanel) TextField(org.apache.wicket.markup.html.form.TextField) ResourceModel(org.apache.wicket.model.ResourceModel) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) WorkerThreadDto(com.evolveum.midpoint.web.page.admin.server.dto.WorkerThreadDto) TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 4 with TablePanel

use of com.evolveum.midpoint.web.component.data.TablePanel in project midpoint by Evolveum.

the class MyAccountsPanel method initLayout.

@Override
protected void initLayout() {
    List<IColumn<SimpleAccountDto, String>> columns = new ArrayList<IColumn<SimpleAccountDto, String>>();
    columns.add(new PropertyColumn(createStringResource("MyAccountsPanel.account.name"), "accountName"));
    columns.add(new PropertyColumn(createStringResource("MyAccountsPanel.account.resource"), "resourceName"));
    ISortableDataProvider provider = new ListDataProvider(this, getModel());
    TablePanel accountsTable = new TablePanel<SimpleAccountDto>(ID_ACCOUNTS_TABLE, provider, columns);
    accountsTable.setShowPaging(false);
    add(accountsTable);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) SimpleAccountDto(com.evolveum.midpoint.web.page.admin.home.dto.SimpleAccountDto) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) ISortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 5 with TablePanel

use of com.evolveum.midpoint.web.component.data.TablePanel in project midpoint by Evolveum.

the class MyAssignmentsPanel method initLayout.

private void initLayout() {
    List<IColumn<AssignmentItemDto, String>> columns = new ArrayList<IColumn<AssignmentItemDto, String>>();
    columns.add(new IconColumn<AssignmentItemDto>(null) {

        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

                @Override
                public String getObject() {
                    AssignmentItemDto item = rowModel.getObject();
                    if (item.getType() == null) {
                        return OperationResultStatusPresentationProperties.FATAL_ERROR.getIcon() + " fa-lg";
                    }
                    return item.getType().getIconCssClass();
                }
            };
        }

        @Override
        protected IModel<String> createTitleModel(final IModel<AssignmentItemDto> rowModel) {
            return new AbstractReadOnlyModel<String>() {

                private static final long serialVersionUID = 1L;

                @Override
                public String getObject() {
                    AssignmentItemDto item = rowModel.getObject();
                    if (item.getType() == null) {
                        return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.error");
                    }
                    switch(item.getType()) {
                        case CONSTRUCTION:
                            return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.accountConstruction");
                        case ORG_UNIT:
                            return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.orgUnit");
                        case ROLE:
                            return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.role");
                        default:
                            return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.error");
                    }
                }
            };
        }
    });
    columns.add(new AbstractColumn<AssignmentItemDto, String>(createStringResource("MyAssignmentsPanel.assignment.displayName")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<AssignmentItemDto>> cellItem, String componentId, final IModel<AssignmentItemDto> rowModel) {
            AssignmentHeaderPanel panel = new AssignmentHeaderPanel(componentId, rowModel);
            panel.add(new AttributeModifier("class", "dash-assignment-header"));
            cellItem.add(panel);
        }
    });
    ISortableDataProvider provider = new ListDataProvider(this, getModel());
    TablePanel accountsTable = new TablePanel<AssignmentItemDto>(ID_ASSIGNMETNS_TABLE, provider, columns);
    accountsTable.setShowPaging(false);
    add(accountsTable);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) IModel(org.apache.wicket.model.IModel) AssignmentHeaderPanel(com.evolveum.midpoint.web.component.assignment.AssignmentHeaderPanel) ArrayList(java.util.ArrayList) ISortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider) AttributeModifier(org.apache.wicket.AttributeModifier) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) AssignmentItemDto(com.evolveum.midpoint.web.page.admin.home.dto.AssignmentItemDto) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Aggregations

TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)26 ObjectDataProvider (com.evolveum.midpoint.web.component.data.ObjectDataProvider)13 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)9 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)9 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)8 ArrayList (java.util.ArrayList)8 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)7 DataTable (org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable)7 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)6 List (java.util.List)5 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)4 Label (org.apache.wicket.markup.html.basic.Label)4 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)3 LoggingDto (com.evolveum.midpoint.web.page.admin.configuration.dto.LoggingDto)3 ClassLoggerConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType)3 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)2 ObjectSearchDto (com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectSearchDto)2 ConfigurationStorage (com.evolveum.midpoint.web.session.ConfigurationStorage)2 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)2 AttributeModifier (org.apache.wicket.AttributeModifier)2