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<SelectableBeanImpl<ObjectType>, String>> columns = initColumns();
ObjectQuery query = getDataProviderQuery();
ObjectDataProvider provider = new ObjectDataProvider(getPageBase(), null) {
@Override
public ObjectQuery getQuery() {
return query;
}
@Override
public Class getType() {
return OrgType.class;
}
};
TablePanel table = new TablePanel<>(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);
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.
the class ChildCasesPanel method initLayout.
protected void initLayout() {
setOutputMarkupId(true);
MainObjectListPanel<CaseType> table = new MainObjectListPanel<CaseType>(ID_CHILD_CASES_PANEL, CaseType.class, Collections.emptyList()) {
@Override
protected List<IColumn<SelectableBean<CaseType>, String>> createDefaultColumns() {
List<IColumn<SelectableBean<CaseType>, String>> columns = new ArrayList<IColumn<SelectableBean<CaseType>, String>>();
IColumn column = new PropertyColumn(createStringResource("pageCases.table.description"), "value.description");
columns.add(column);
columns.add(ColumnUtils.createCaseActorsColumn(ChildCasesPanel.this.getPageBase()));
column = new PropertyColumn<SelectableBeanImpl<CaseType>, String>(createStringResource("pageCases.table.state"), CaseType.F_STATE.getLocalPart(), "value.state") {
@Override
public String getCssClass() {
return "col-sm-2 col-md-1";
}
};
columns.add(column);
column = new AbstractExportableColumn<SelectableBean<CaseType>, String>(createStringResource("pageCases.table.workitems")) {
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<CaseType>>> cellItem, String componentId, IModel<SelectableBean<CaseType>> model) {
cellItem.add(new Label(componentId, model.getObject().getValue() != null && model.getObject().getValue().getWorkItem() != null ? model.getObject().getValue().getWorkItem().size() : null));
}
@Override
public IModel<String> getDataModel(IModel<SelectableBean<CaseType>> rowModel) {
return Model.of(rowModel.getObject().getValue() != null && rowModel.getObject().getValue().getWorkItem() != null ? Integer.toString(rowModel.getObject().getValue().getWorkItem().size()) : "");
}
@Override
public String getCssClass() {
return "col-md-2 col-lg-1";
}
};
columns.add(column);
return (List) columns;
}
@Override
protected boolean isCreateNewObjectEnabled() {
return false;
}
@Override
protected ISelectableDataProvider<CaseType, SelectableBean<CaseType>> createProvider() {
return createSelectableBeanObjectDataProvider(() -> getChildCasesQuery(), null);
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_CASE_CHILD_CASES_TAB;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return new ArrayList<>();
}
@Override
protected IColumn<SelectableBean<CaseType>, String> createCheckboxColumn() {
return null;
}
};
table.setOutputMarkupId(true);
add(table);
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.
the class AssignmentPanel method initLayout.
private void initLayout() {
MultivalueContainerListPanelWithDetailsPanel<AssignmentType> multivalueContainerListPanel = new MultivalueContainerListPanelWithDetailsPanel<>(ID_ASSIGNMENTS, AssignmentType.class) {
private static final long serialVersionUID = 1L;
@Override
protected boolean isCreateNewObjectVisible() {
return isNewObjectButtonVisible(getFocusObject());
}
@Override
protected IModel<PrismContainerWrapper<AssignmentType>> getContainerModel() {
return AssignmentPanel.this.getModel();
}
@Override
protected void cancelItemDetailsPerformed(AjaxRequestTarget target) {
AssignmentPanel.this.cancelAssignmentDetailsPerformed(target);
}
protected List<IColumn<PrismContainerValueWrapper<AssignmentType>, String>> createDefaultColumns() {
if (AssignmentPanel.this.getModelObject() == null) {
return new ArrayList<>();
}
return initBasicColumns();
}
@Override
protected List<Component> createToolbarButtonsList(String idButton) {
List<Component> bar = new ArrayList<>();
AjaxIconButton newObjectButton = new AjaxIconButton(idButton, new Model<>(GuiStyleConstants.EVO_ASSIGNMENT_ICON), createStringResource("MainObjectListPanel.newObject")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
newAssignmentClickPerformed(target);
}
};
newObjectButton.add(AttributeAppender.append("class", "btn btn-default btn-sm"));
bar.add(newObjectButton);
newObjectButton.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return isNewObjectButtonVisible(getFocusObject());
}
@Override
public boolean isEnabled() {
return !isAssignmentsLimitReached();
}
});
return bar;
}
@Override
public void deleteItemPerformed(AjaxRequestTarget target, List<PrismContainerValueWrapper<AssignmentType>> toDeleteList) {
int countAddedAssignments = 0;
for (PrismContainerValueWrapper<AssignmentType> assignment : toDeleteList) {
if (ValueStatus.ADDED.equals(assignment.getStatus())) {
countAddedAssignments++;
}
}
boolean isLimitReached = isAssignmentsLimitReached(toDeleteList.size() - countAddedAssignments, true);
if (isLimitReached) {
warn(getParentPage().getString("AssignmentPanel.assignmentsLimitReachedWarning", assignmentsRequestsLimit));
target.add(getPageBase().getFeedbackPanel());
return;
}
super.deleteItemPerformed(target, toDeleteList);
}
@Override
protected AssignmentListProvider createProvider() {
PageStorage pageStorage = getPageStorage(getAssignmentsTabStorageKey());
return createAssignmentProvider(pageStorage, getSearchModel(), loadValuesModel());
}
@Override
protected MultivalueContainerDetailsPanel<AssignmentType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<AssignmentType>> item) {
return createMultivalueContainerDetailsPanel(item);
}
@Override
protected UserProfileStorage.TableId getTableId() {
return AssignmentPanel.this.getTableId();
}
@Override
protected List<SearchItemDefinition> initSearchableItems(PrismContainerDefinition<AssignmentType> containerDef) {
return createSearchableItems(containerDef);
}
@Override
public void refreshTable(AjaxRequestTarget ajaxRequestTarget) {
super.refreshTable(ajaxRequestTarget);
AssignmentPanel.this.refreshTable(ajaxRequestTarget);
}
@Override
protected boolean isCollectionViewPanel() {
return config != null && config.getListView() != null;
}
@Override
protected CompiledObjectCollectionView getObjectCollectionView() {
if (config == null) {
return super.getObjectCollectionView();
}
GuiObjectListViewType listView = config.getListView();
if (listView == null) {
return null;
}
CollectionRefSpecificationType collectionRefSpecificationType = listView.getCollection();
if (collectionRefSpecificationType == null) {
return null;
}
Task task = getPageBase().createSimpleTask("Compile collection");
OperationResult result = task.getResult();
try {
return getPageBase().getModelInteractionService().compileObjectCollectionView(collectionRefSpecificationType, AssignmentType.class, task, result);
} catch (Throwable e) {
e.printStackTrace();
}
return null;
}
};
multivalueContainerListPanel.add(new VisibleBehaviour(() -> getModel() != null && getModelObject() != null));
add(multivalueContainerListPanel);
setOutputMarkupId(true);
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.
the class PageDebugList method createColumns.
private List<IColumn<DebugObjectItem, String>> createColumns() {
List<IColumn<DebugObjectItem, String>> columns = new ArrayList<>();
IColumn<DebugObjectItem, String> column = new CheckBoxHeaderColumn<>();
columns.add(column);
column = new AjaxLinkColumn<>(createStringResource("pageDebugList.name"), DebugObjectItem.F_NAME, DebugObjectItem.F_NAME) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<DebugObjectItem>> cellItem, String componentId, final IModel<DebugObjectItem> rowModel) {
TwoValueLinkPanel panel = new TwoValueLinkPanel(componentId, new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
DebugObjectItem object = rowModel.getObject();
if (object == null) {
return null;
}
StringBuilder sb = new StringBuilder();
sb.append(object.getName());
if (object.getStatus() != null && object.getStatus() != OperationResultStatusType.SUCCESS && object.getStatus() != OperationResultStatusType.HANDLED_ERROR) {
sb.append(" (");
sb.append(object.getStatus());
sb.append(")");
}
return sb.toString();
}
}, new PropertyModel<String>(rowModel, DebugObjectItem.F_OID)) {
@Override
public void onClick(AjaxRequestTarget target) {
DebugObjectItem object = rowModel.getObject();
objectEditPerformed(object.getOid(), object.getType());
}
@Override
public boolean isEnabled() {
return rowModel.getObject().getOid() != null;
}
};
cellItem.add(panel);
cellItem.add(new AttributeModifier("class", "col-md-3"));
}
};
columns.add(column);
columns.add(new PropertyColumn<>(createStringResource("pageDebugList.description"), DebugObjectItem.F_DESCRIPTION));
if (ShadowType.class.equals(getType())) {
columns.add(new PropertyColumn<>(createStringResource("pageDebugList.resourceName"), DebugObjectItem.F_RESOURCE_NAME));
columns.add(new PropertyColumn<>(createStringResource("pageDebugList.resourceType"), DebugObjectItem.F_RESOURCE_TYPE));
}
column = new AbstractColumn<>(new Model<>(), null) {
private static final long serialVersionUID = 1L;
@Override
public String getCssClass() {
return "debug-list-buttons";
}
@Override
public void populateItem(Item<ICellPopulator<DebugObjectItem>> cellItem, String componentId, IModel<DebugObjectItem> rowModel) {
cellItem.add(new DebugButtonPanel<>(componentId, rowModel) {
private static final long serialVersionUID = 1L;
@Override
public void deletePerformed(AjaxRequestTarget target, IModel<DebugObjectItem> model) {
deleteSelected(target, model.getObject());
}
@Override
public void exportPerformed(AjaxRequestTarget target, IModel<DebugObjectItem> model) {
exportSelected(target, model.getObject());
}
});
}
};
columns.add(column);
columns.add(new InlineMenuHeaderColumn(initInlineMenu()));
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn 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);
}
Aggregations