use of com.evolveum.midpoint.web.page.admin.configuration.component.DebugButtonPanel in project midpoint by Evolveum.
the class PageDebugList method initColumns.
private List<IColumn> initColumns(final Class<? extends ObjectType> type) {
List<IColumn> columns = new ArrayList<>();
IColumn column = new CheckBoxHeaderColumn<ObjectType>();
columns.add(column);
column = new LinkColumn<DebugObjectItem>(createStringResource("pageDebugList.name"), DebugObjectItem.F_NAME, DebugObjectItem.F_NAME) {
@Override
public void populateItem(Item<ICellPopulator<DebugObjectItem>> cellItem, String componentId, final IModel<DebugObjectItem> rowModel) {
TwoValueLinkPanel panel = new TwoValueLinkPanel(componentId, new AbstractReadOnlyModel<String>() {
@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(target, object.getOid(), type);
}
@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.isAssignableFrom(type)) {
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<DebugObjectItem, String>(new Model(), null) {
@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<DebugObjectItem>(componentId, rowModel) {
@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);
column = new InlineMenuHeaderColumn<InlineMenuable>(initInlineMenu()) {
@Override
public void populateItem(Item<ICellPopulator<InlineMenuable>> cellItem, String componentId, IModel<InlineMenuable> rowModel) {
// we don't need row inline menu
cellItem.add(new Label(componentId));
}
};
columns.add(column);
return columns;
}
use of com.evolveum.midpoint.web.page.admin.configuration.component.DebugButtonPanel 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;
}
Aggregations