Search in sources :

Example 6 with IColumn

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

the class DecisionsPanel method initLayout.

protected void initLayout(UserProfileStorage.TableId tableId, int pageSize) {
    List<IColumn<DecisionDto, String>> columns = new ArrayList<>();
    columns.add(new PropertyColumn<>(createStringResource("DecisionsPanel.user"), DecisionDto.F_USER));
    columns.add(new PropertyColumn<>(createStringResource("DecisionsPanel.originalActor"), DecisionDto.F_ORIGINAL_ACTOR));
    columns.add(new PropertyColumn<>(createStringResource("DecisionsPanel.stage"), DecisionDto.F_STAGE));
    columns.add(createOutcomeColumn());
    columns.add(new PropertyColumn<DecisionDto, String>(createStringResource("DecisionsPanel.comment"), DecisionDto.F_COMMENT) {

        @Override
        public void populateItem(Item<ICellPopulator<DecisionDto>> item, String componentId, IModel<DecisionDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            item.add(new AttributeAppender("style", "max-width: 200px; word-wrap: break-word;"));
        }
    });
    columns.add(new PropertyColumn<>(createStringResource("DecisionsPanel.when"), DecisionDto.F_TIME));
    columns.add(new PropertyColumn<>(createStringResource("DecisionsPanel.escalation"), DecisionDto.F_ESCALATION_LEVEL_NUMBER));
    ISortableDataProvider provider = new ListDataProvider<>(this, getModel());
    BoxedTablePanel decisionsTable = new BoxedTablePanel<>(ID_DECISIONS_TABLE, provider, columns, tableId, pageSize);
    add(decisionsTable);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) ArrayList(java.util.ArrayList) ISortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) DecisionDto(com.evolveum.midpoint.web.page.admin.workflow.dto.DecisionDto) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 7 with IColumn

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

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

the class TaskResultTabPanel method initResultColumns.

private List<IColumn<OperationResult, String>> initResultColumns() {
    List<IColumn<OperationResult, String>> columns = new ArrayList<IColumn<OperationResult, String>>();
    columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.opResult.token"), "token"));
    columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.opResult.operation"), "operation"));
    columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.opResult.status"), "status"));
    columns.add(new AbstractColumn<OperationResult, String>(createStringResource("pageTaskEdit.opResult.message"), "message") {

        @Override
        public void populateItem(Item<ICellPopulator<OperationResult>> cellItem, String componentId, IModel<OperationResult> rowModel) {
            Label label = new Label(componentId, new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    return WebComponentUtil.nl2br(rowModel.getObject().getMessage());
                }
            });
            label.setEscapeModelStrings(false);
            cellItem.add(label);
        }
    });
    //columns.add(new PropertyColumn(createStringResource("pageTaskEdit.opResult.message"), "message"));
    return columns;
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)

Example 9 with IColumn

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

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

the class RoleGovernanceRelationsPanel method createMembersColumns.

@Override
protected List<IColumn<SelectableBean<ObjectType>, String>> createMembersColumns() {
    List<IColumn<SelectableBean<ObjectType>, String>> columns = super.createMembersColumns();
    IColumn<SelectableBean<ObjectType>, String> column = new AbstractExportableColumn<SelectableBean<ObjectType>, String>(createStringResource("roleMemberPanel.relation")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ObjectType>>> cellItem, String componentId, IModel<SelectableBean<ObjectType>> rowModel) {
            cellItem.add(new Label(componentId, getRelationValue((FocusType) rowModel.getObject().getValue())));
        }

        @Override
        public IModel<String> getDataModel(IModel<SelectableBean<ObjectType>> rowModel) {
            return Model.of(getRelationValue((FocusType) rowModel.getObject().getValue()));
        }
    };
    columns.add(column);
    return columns;
}
Also used : InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) Item(org.apache.wicket.markup.repeater.Item) IModel(org.apache.wicket.model.IModel) AbstractExportableColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.export.AbstractExportableColumn) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) Label(org.apache.wicket.markup.html.basic.Label)

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