use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn in project midpoint by Evolveum.
the class PageConnectorHosts method initColumns.
private List<IColumn<SelectableBean<ConnectorHostType>, String>> initColumns() {
List<IColumn<SelectableBean<ConnectorHostType>, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn(createStringResource("pageResources.connector.hostname"), "value.hostname"));
columns.add(new PropertyColumn(createStringResource("pageResources.connector.port"), "value.port"));
columns.add(new PropertyColumn(createStringResource("pageResources.connector.timeout"), "value.timeout"));
columns.add(new CheckBoxColumn(createStringResource("pageResources.connector.protectConnection"), "value.protectConnection"));
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method initLayout.
protected void initLayout() {
PrismObject<ResourceType> resourceObject = getModelObject();
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<>(ResourceDetailsTabPanel.this, new ListModel<>(resourceConfigList));
List<IColumn<SelectableBeanImpl<ResourceType>, String>> tableColumns = new ArrayList<>();
tableColumns.add(ColumnUtils.createPropertyColumn(new ColumnTypeDto<>("ShadowType.kind", "objectTypeDefinition.kind", ShadowType.F_KIND.getLocalPart())));
tableColumns.add(new PropertyColumn<>(createStringResource("ShadowType.objectClass"), "objectTypeDefinition.objectClass") {
@Override
public IModel<?> getDataModel(IModel<SelectableBeanImpl<ResourceType>> rowModel) {
IModel<QName> model = (IModel<QName>) super.getDataModel(rowModel);
if (model.getObject() != null) {
return () -> model.getObject().getLocalPart();
}
return model;
}
});
List<ColumnTypeDto<String>> columns = Arrays.asList(new ColumnTypeDto<>("ShadowType.intent", "objectTypeDefinition.intent", ShadowType.F_INTENT.getLocalPart()), new ColumnTypeDto<>("ResourceType.isSync", "sync", null));
tableColumns.addAll(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 AjaxLinkPanel(repeater.newChildId(), new Model<>(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);
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn in project midpoint by Evolveum.
the class ColumnUtils method getDefaultCaseColumns.
public static List<IColumn<SelectableBean<CaseType>, String>> getDefaultCaseColumns(PageBase pageBase, boolean isDashboard) {
List<IColumn<SelectableBean<CaseType>, String>> columns = new ArrayList<>();
IColumn column = new PropertyColumn(createStringResource("pageCases.table.description"), "value.description");
columns.add(column);
column = new AbstractColumn<SelectableBean<CaseType>, String>(createStringResource("pageCases.table.objectRef")) {
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<CaseType>>> item, String componentId, IModel<SelectableBean<CaseType>> rowModel) {
item.add(new Label(componentId, new IModel<String>() {
@Override
public String getObject() {
CaseType caseModelObject = rowModel.getObject().getValue();
if (caseModelObject == null) {
return "";
}
AssignmentHolderType objectRef = WebComponentUtil.getObjectFromAddDeltyForCase(caseModelObject);
if (objectRef != null) {
return WebComponentUtil.getEffectiveName(objectRef, AbstractRoleType.F_DISPLAY_NAME);
} else if (caseModelObject.getObjectRef() != null && StringUtils.isNotEmpty(caseModelObject.getObjectRef().getOid())) {
if (caseModelObject.getObjectRef().getObject() != null) {
return WebComponentUtil.getEffectiveName(caseModelObject.getObjectRef().getObject(), AbstractRoleType.F_DISPLAY_NAME);
} else {
try {
return WebComponentUtil.getEffectiveName(caseModelObject.getObjectRef(), AbstractRoleType.F_DISPLAY_NAME, pageBase, pageBase.getClass().getSimpleName() + "." + "loadCaseObjectRefName");
} catch (Exception ex) {
LOGGER.error("Unable find the object for reference: {}", caseModelObject.getObjectRef());
}
}
}
return "";
}
}));
}
};
columns.add(column);
if (!isDashboard) {
columns.add(createCaseActorsColumn(pageBase));
}
column = new AbstractColumn<SelectableBean<CaseType>, String>(createStringResource("pageCases.table.openTimestamp"), MetadataType.F_CREATE_TIMESTAMP.getLocalPart()) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<CaseType>>> cellItem, String componentId, final IModel<SelectableBean<CaseType>> rowModel) {
CaseType object = rowModel.getObject().getValue();
MetadataType metadata = object != null ? object.getMetadata() : null;
XMLGregorianCalendar createdCal = metadata != null ? metadata.getCreateTimestamp() : null;
final Date created;
if (createdCal != null) {
created = createdCal.toGregorianCalendar().getTime();
// cellItem.add(AttributeModifier.replace("title", WebComponentUtil.getLocalizedDate(created, DateLabelComponent.LONG_MEDIUM_STYLE)));
// cellItem.add(new TooltipBehavior());
} else {
created = null;
}
cellItem.add(new Label(componentId, new IModel<String>() {
@Override
public String getObject() {
return WebComponentUtil.getShortDateTimeFormattedValue(created, pageBase);
}
}));
}
@Override
public String getCssClass() {
return isDashboard ? "col-sm-2 col-lg-1" : super.getCssClass();
}
};
columns.add(column);
if (!isDashboard) {
column = new PropertyColumn<SelectableBean<CaseType>, String>(createStringResource("pageCases.table.closeTimestamp"), CaseType.F_CLOSE_TIMESTAMP.getLocalPart(), "value.closeTimestamp") {
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<CaseType>>> cellItem, String componentId, final IModel<SelectableBean<CaseType>> rowModel) {
CaseType object = rowModel.getObject().getValue();
XMLGregorianCalendar closedCal = object != null ? object.getCloseTimestamp() : null;
final Date closed;
if (closedCal != null) {
closed = closedCal.toGregorianCalendar().getTime();
cellItem.add(AttributeModifier.replace("title", WebComponentUtil.getLocalizedDate(closed, DateLabelComponent.LONG_MEDIUM_STYLE)));
cellItem.add(new TooltipBehavior());
} else {
closed = null;
}
cellItem.add(new Label(componentId, new IModel<String>() {
@Override
public String getObject() {
return WebComponentUtil.getShortDateTimeFormattedValue(closed, pageBase);
}
}));
}
@Override
public String getCssClass() {
return isDashboard ? "col-sm-2 col-lg-1" : super.getCssClass();
}
};
columns.add(column);
}
column = new CountIconColumn<SelectableBean<CaseType>>(createStringResource("CaseType.outcome")) {
@Override
protected Map<DisplayType, Integer> getIconDisplayType(IModel<SelectableBean<CaseType>> rowModel) {
Map<DisplayType, Integer> map = new HashMap<>();
CaseType caseType = rowModel.getObject().getValue();
if (ObjectTypeUtil.hasArchetype(caseType, SystemObjectsType.ARCHETYPE_OPERATION_REQUEST.value())) {
ObjectQuery queryFilter = pageBase.getPrismContext().queryFor(CaseType.class).item(CaseType.F_PARENT_REF).ref(caseType.getOid()).build();
List<PrismObject<CaseType>> childs = WebModelServiceUtils.searchObjects(CaseType.class, queryFilter, new OperationResult("search_case_child"), pageBase);
for (PrismObject<CaseType> child : childs) {
processCaseOutcome(child.asObjectable(), map, false);
}
} else {
processCaseOutcome(caseType, map, true);
}
return map;
}
@Override
public String getCssClass() {
return "col-lg-1";
}
};
columns.add(column);
column = new PropertyColumn<SelectableBean<CaseType>, String>(createStringResource("pageCases.table.state"), CaseType.F_STATE.getLocalPart(), "value.state") {
@Override
public String getCssClass() {
return "col-lg-1";
}
@Override
public IModel<?> getDataModel(IModel<SelectableBean<CaseType>> rowModel) {
IModel<String> dataModel = (IModel<String>) super.getDataModel(rowModel);
if (StringUtils.isNotBlank(dataModel.getObject())) {
String key = CaseType.COMPLEX_TYPE.getLocalPart() + "." + CaseType.F_STATE.getLocalPart() + "." + dataModel.getObject();
return new StringResourceModel(key, pageBase).setModel(new Model<String>()).setDefaultValue(dataModel.getObject());
}
return dataModel;
}
};
columns.add(column);
if (!isDashboard) {
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-lg-1";
}
};
columns.add(column);
}
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn in project midpoint by Evolveum.
the class PageValuePolicies method initValuePoliciesColumns.
private List<IColumn<SelectableBean<ValuePolicyType>, String>> initValuePoliciesColumns() {
List<IColumn<SelectableBean<ValuePolicyType>, String>> columns = new ArrayList<>();
IColumn column = new PropertyColumn(createStringResource("pageValuePolicies.table.description"), "value.description");
columns.add(column);
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method initLayout.
protected void initLayout() {
// PrismObject<ResourceType> resourceObject = getObjectWrapper().getObject();
// ResourceType resource = resourceObject.asObjectable();
add(createLastAvailabilityStatusInfo());
add(createSourceTargetInfo());
add(createSchemaStatusInfo());
CapabilitiesPanel capabilities = new CapabilitiesPanel(PANEL_CAPABILITIES, capabilitiesModel);
add(capabilities);
ListDataProvider<ResourceConfigurationDto> resourceConfigProvider = new ListDataProvider<>(ResourceDetailsTabPanel.this, createResourceConfigListModel());
List<IColumn<SelectableBeanImpl<ResourceType>, String>> tableColumns = new ArrayList<>();
tableColumns.add(ColumnUtils.createPropertyColumn(new ColumnTypeDto<>("ShadowType.kind", "objectTypeDefinition.kind", ShadowType.F_KIND.getLocalPart())));
tableColumns.add(new PropertyColumn<>(createStringResource("ShadowType.objectClass"), "objectTypeDefinition.objectClass") {
@Override
public IModel<?> getDataModel(IModel<SelectableBeanImpl<ResourceType>> rowModel) {
IModel<QName> model = (IModel<QName>) super.getDataModel(rowModel);
if (model.getObject() != null) {
return () -> model.getObject().getLocalPart();
}
return model;
}
});
List<ColumnTypeDto<String>> columns = Arrays.asList(new ColumnTypeDto<>("ShadowType.intent", "objectTypeDefinition.intent", ShadowType.F_INTENT.getLocalPart()), new ColumnTypeDto<>("ResourceType.isSync", "sync", null));
tableColumns.addAll(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 AjaxLinkPanel(repeater.newChildId(), new Model<>(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);
}
Aggregations