use of com.evolveum.midpoint.web.component.util.SelectableListDataProvider in project midpoint by Evolveum.
the class InternalsLoggedInUsersPanel method initLayout.
private void initLayout() {
MainObjectListPanel<F> table = new MainObjectListPanel(ID_TABLE, FocusType.class, null) {
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ObjectType object) {
if (WebComponentUtil.hasDetailsPage(object.getClass())) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, object.getOid());
getPageBase().navigateToNext(WebComponentUtil.getObjectDetailsPage(object.getClass()), parameters);
}
}
@Override
protected List<IColumn<SelectableBean<F>, String>> createDefaultColumns() {
return InternalsLoggedInUsersPanel.this.initColumns();
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return initInlineMenu();
}
@Override
protected UserProfileStorage.TableId getTableId() {
return null;
}
@Override
protected ISelectableDataProvider<UserSessionManagementType, SelectableBean<F>> createProvider() {
LoadableModel<List<UserSessionManagementType>> principals = new LoadableModel<List<UserSessionManagementType>>(true) {
@Override
protected List<UserSessionManagementType> load() {
return loadLoggedInPrincipals();
}
};
return new SelectableListDataProvider<SelectableBean<F>, UserSessionManagementType>(InternalsLoggedInUsersPanel.this, principals) {
@Override
protected SelectableBean<F> createObjectWrapper(UserSessionManagementType principal) {
SelectableBeanImpl<F> user = new SelectableBeanImpl<>((F) principal.getFocus());
user.setActiveSessions(principal.getActiveSessions());
user.setNodes(principal.getNode());
return user;
}
};
}
@Override
protected boolean isCreateNewObjectEnabled() {
return false;
}
@Override
protected List<Component> createToolbarButtonsList(String buttonId) {
return new ArrayList<>();
}
@Override
protected boolean enableSavePageSize() {
return false;
}
};
add(table);
}
use of com.evolveum.midpoint.web.component.util.SelectableListDataProvider in project midpoint by Evolveum.
the class TaskSubtasksAndThreadsTabPanel method initLayout.
private void initLayout() {
Label subtasksLabel = new Label(ID_SUBTASKS_LABEL, new ResourceModel("pageTaskEdit.subtasksLabel"));
add(subtasksLabel);
TaskTablePanel subtasksPanel = new TaskTablePanel(ID_SUBTASKS_PANEL, createOperationOptions()) {
@Override
protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
return createSelectableBeanObjectDataProvider(() -> createSubtasksQuery(), null);
}
@Override
protected List<IColumn<SelectableBean<TaskType>, String>> createDefaultColumns() {
List<IColumn<SelectableBean<TaskType>, String>> columns = super.createDefaultColumns();
// });
return columns;
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_SUBTASKS;
}
@Override
@NotNull
protected TaskInformation getAttachedTaskInformation(SelectableBean<TaskType> selectableTaskBean) {
return TaskInformationUtil.getOrCreateInfo(selectableTaskBean, rootTaskModel.getObject());
}
};
add(subtasksPanel);
Label workerThreadsTableLabel = new Label(ID_WORKER_THREADS_TABLE_LABEL, new ResourceModel("TaskStatePanel.workerThreads"));
add(workerThreadsTableLabel);
TaskTablePanel workerThreadsTable = new TaskTablePanel(ID_WORKER_THREADS_TABLE, null) {
@Override
protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
return new SelectableListDataProvider<>(TaskSubtasksAndThreadsTabPanel.this, createWorkersModel());
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_WORKERS;
}
@Override
protected boolean isHeaderVisible() {
return false;
}
@Override
@NotNull
protected TaskInformation getAttachedTaskInformation(SelectableBean<TaskType> selectableTaskBean) {
return TaskInformationUtil.getOrCreateInfo(selectableTaskBean, rootTaskModel.getObject());
}
};
add(workerThreadsTable);
}
use of com.evolveum.midpoint.web.component.util.SelectableListDataProvider in project midpoint by Evolveum.
the class TaskResultPanel method initLayout.
protected void initLayout() {
IModel<List<OperationResult>> resultModel = new ReadOnlyModel<>(this::createOperationResultList);
SelectableListDataProvider<SelectableBean<OperationResult>, OperationResult> provider = new SelectableListDataProvider<>(this, resultModel);
BoxedTablePanel<SelectableBean<OperationResult>> resultTablePanel = new BoxedTablePanel<>(ID_OPERATION_RESULT, provider, initResultColumns());
resultTablePanel.setOutputMarkupId(true);
add(resultTablePanel);
AjaxFallbackLink<Void> showResult = new AjaxFallbackLink<>(ID_SHOW_RESULT) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(Optional<AjaxRequestTarget> optionalTarget) {
if (optionalTarget.isEmpty()) {
LOGGER.warn("Cannot show result in interactive way, request target not present.");
return;
}
AjaxRequestTarget target = optionalTarget.get();
OperationResultPopupPanel body = new OperationResultPopupPanel(getPageBase().getMainPopupBodyId(), new Model<>(getTaskOperationResult()));
body.setOutputMarkupId(true);
getPageBase().showMainPopup(body, target);
}
};
showResult.add(new VisibleBehaviour(() -> getTaskOperationResult() != null));
showResult.setOutputMarkupId(true);
add(showResult);
}
use of com.evolveum.midpoint.web.component.util.SelectableListDataProvider in project midpoint by Evolveum.
the class TaskSubtasksAndThreadsPanel method initLayout.
protected void initLayout() {
Label subtasksLabel = new Label(ID_SUBTASKS_LABEL, new ResourceModel("pageTaskEdit.subtasksLabel"));
add(subtasksLabel);
TaskTablePanel subtasksPanel = new TaskTablePanel(ID_SUBTASKS_PANEL, createOperationOptions()) {
@Override
protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
return createSelectableBeanObjectDataProvider(() -> createSubtasksQuery(), null);
}
@Override
protected List<Component> createToolbarButtonsList(String buttonId) {
return new ArrayList<>();
}
@Override
protected List<IColumn<SelectableBean<TaskType>, String>> createDefaultColumns() {
List<IColumn<SelectableBean<TaskType>, String>> columns = super.createDefaultColumns();
// });
return columns;
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_SUBTASKS;
}
@Override
@NotNull
protected TaskInformation getAttachedTaskInformation(SelectableBean<TaskType> selectableTaskBean) {
return TaskInformationUtil.getOrCreateInfo(selectableTaskBean, getObjectDetailsModels().getRootTaskModelObject());
}
};
add(subtasksPanel);
Label workerThreadsTableLabel = new Label(ID_WORKER_THREADS_TABLE_LABEL, new ResourceModel("TaskStatePanel.workerThreads"));
add(workerThreadsTableLabel);
TaskTablePanel workerThreadsTable = new TaskTablePanel(ID_WORKER_THREADS_TABLE, null) {
@Override
protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
return new SelectableListDataProvider<>(TaskSubtasksAndThreadsPanel.this, createWorkersModel());
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_WORKERS;
}
@Override
protected boolean isHeaderVisible() {
return false;
}
@Override
protected List<Component> createToolbarButtonsList(String buttonId) {
return new ArrayList<>();
}
@Override
@NotNull
protected TaskInformation getAttachedTaskInformation(SelectableBean<TaskType> selectableTaskBean) {
return TaskInformationUtil.getOrCreateInfo(selectableTaskBean, getObjectDetailsModels().getRootTaskModelObject());
}
};
add(workerThreadsTable);
}
use of com.evolveum.midpoint.web.component.util.SelectableListDataProvider in project midpoint by Evolveum.
the class ExportingPanel method createTable.
private BoxedTablePanel<SelectableBean<Integer>> createTable(String id, DataTable<?, ?> dataTable) {
List<? extends IColumn<?, ?>> allColumns = dataTable.getColumns();
List<Integer> exportableColumnIndex = getExportableColumns(dataTable);
if (exportableColumnIndex.isEmpty()) {
throw new IllegalArgumentException("List of exportable columns is empty");
}
List<IColumn<SelectableBean<Integer>, String>> columns = new ArrayList<>();
CheckBoxHeaderColumn<SelectableBean<Integer>> checkboxColumn = new CheckBoxHeaderColumn<>();
columns.add(checkboxColumn);
StringResourceModel nameString = getPageBase().createStringResource("ExportingPopupPanel.nameColumn");
IColumn<SelectableBean<Integer>, String> nameColumn = new AbstractColumn<SelectableBean<Integer>, String>(nameString) {
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<Integer>>> cellItem, String componentId, IModel<SelectableBean<Integer>> rowModel) {
IModel stringModel = ((IExportableColumn) allColumns.get(rowModel.getObject().getValue())).getDisplayModel();
cellItem.add(new Label(componentId, stringModel));
}
};
columns.add(nameColumn);
SelectableListDataProvider<SelectableBean<Integer>, Integer> provider = new SelectableListDataProvider<SelectableBean<Integer>, Integer>(getPageBase(), Model.ofList(exportableColumnIndex)) {
@Override
public Iterator<SelectableBean<Integer>> internalIterator(long first, long count) {
if (getAvailableData().isEmpty()) {
return super.internalIterator(first, count);
} else {
return getAvailableData().iterator();
}
}
};
BoxedTablePanel<SelectableBean<Integer>> table = new BoxedTablePanel<SelectableBean<Integer>>(id, provider, columns) {
private static final long serialVersionUID = 1L;
@Override
protected WebMarkupContainer createHeader(String headerId) {
return new WebMarkupContainer(headerId);
}
@Override
public String getAdditionalBoxCssClasses() {
return null;
}
@Override
protected WebMarkupContainer createButtonToolbar(String id) {
return new WebMarkupContainer(id);
}
@Override
protected boolean hideFooterIfSinglePage() {
return true;
}
@Override
public int getAutoRefreshInterval() {
return 0;
}
@Override
public boolean isAutoRefreshEnabled() {
return false;
}
};
table.setOutputMarkupId(true);
return table;
}
Aggregations