use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn 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 org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn in project midpoint by Evolveum.
the class ChangePasswordPanel method initColumns.
private List<IColumn<PasswordAccountDto, String>> initColumns() {
List<IColumn<PasswordAccountDto, String>> columns = new ArrayList<IColumn<PasswordAccountDto, String>>();
IColumn column = new IconColumn<PasswordAccountDto>(new Model<String>()) {
private static final long serialVersionUID = 1L;
@Override
protected IModel<String> createIconModel(final IModel<PasswordAccountDto> rowModel) {
return new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
PasswordAccountDto item = rowModel.getObject();
if (item.getCssClass() == null || item.getCssClass().trim().equals("")) {
if (item.isMidpoint()) {
item.setCssClass(SELECTED_ACCOUNT_ICON_CSS);
} else if (item.isPasswordOutbound()) {
item.setCssClass(PROPAGATED_ACCOUNT_ICON_CSS);
} else {
item.setCssClass(DESELECTED_ACCOUNT_ICON_CSS);
}
}
return item.getCssClass();
}
};
}
@Override
public void populateItem(Item<ICellPopulator<PasswordAccountDto>> item, String componentId, final IModel<PasswordAccountDto> rowModel) {
super.populateItem(item, componentId, rowModel);
final ImagePanel imagePanel = (ImagePanel) item.get(0);
final PasswordAccountDto passwordAccountDto = rowModel.getObject();
imagePanel.add(new AjaxEventBehavior("click") {
private static final long serialVersionUID = 1L;
protected void onEvent(final AjaxRequestTarget target) {
if (!passwordAccountDto.isMidpoint()) {
if (passwordAccountDto.getCssClass().equals(PROPAGATED_ACCOUNT_ICON_CSS)) {
passwordAccountDto.setCssClass(SELECTED_ACCOUNT_ICON_CSS);
} else if (passwordAccountDto.getCssClass().equals(SELECTED_ACCOUNT_ICON_CSS) && passwordAccountDto.isPasswordOutbound() && midpointAccountSelected) {
passwordAccountDto.setCssClass(PROPAGATED_ACCOUNT_ICON_CSS);
} else if (passwordAccountDto.getCssClass().equals(SELECTED_ACCOUNT_ICON_CSS)) {
passwordAccountDto.setCssClass(DESELECTED_ACCOUNT_ICON_CSS);
} else if (passwordAccountDto.getCssClass().equals(DESELECTED_ACCOUNT_ICON_CSS)) {
passwordAccountDto.setCssClass(SELECTED_ACCOUNT_ICON_CSS);
}
target.add(imagePanel);
} else {
midpointAccountSelected = !midpointAccountSelected;
if (passwordAccountDto.getCssClass().equals(SELECTED_ACCOUNT_ICON_CSS)) {
passwordAccountDto.setCssClass(DESELECTED_ACCOUNT_ICON_CSS);
updatePropagatedAccountIconsCssClass(DESELECTED_ACCOUNT_ICON_CSS);
target.add(imagePanel.findParent(SelectableDataTable.class));
} else if (passwordAccountDto.getCssClass().equals(DESELECTED_ACCOUNT_ICON_CSS)) {
passwordAccountDto.setCssClass(SELECTED_ACCOUNT_ICON_CSS);
updatePropagatedAccountIconsCssClass(PROPAGATED_ACCOUNT_ICON_CSS);
target.add(imagePanel.findParent(SelectableDataTable.class));
}
}
}
});
}
};
columns.add(column);
columns.add(new AbstractColumn<PasswordAccountDto, String>(createStringResource("ChangePasswordPanel.name")) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<PasswordAccountDto>> item, String componentId, final IModel<PasswordAccountDto> rowModel) {
item.add(new Label(componentId, new AbstractReadOnlyModel<Object>() {
private static final long serialVersionUID = 1L;
@Override
public Object getObject() {
PasswordAccountDto dto = rowModel.getObject();
return dto.getDisplayName();
}
}));
}
});
column = new PropertyColumn(createStringResource("ChangePasswordPanel.resourceName"), PasswordAccountDto.F_RESOURCE_NAME);
columns.add(column);
CheckBoxColumn enabled = new CheckBoxColumn(createStringResource("ChangePasswordPanel.enabled"), PasswordAccountDto.F_ENABLED);
enabled.setEnabled(false);
columns.add(enabled);
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn in project midpoint by Evolveum.
the class PageCertCampaigns method initColumns.
private List<IColumn<CertCampaignListItemDto, String>> initColumns() {
List<IColumn<CertCampaignListItemDto, String>> columns = new ArrayList<>();
IColumn column;
column = new CheckBoxHeaderColumn<>();
columns.add(column);
column = new LinkColumn<CertCampaignListItemDto>(createStringResource("PageCertCampaigns.table.name"), AccessCertificationCampaignType.F_NAME.getLocalPart(), CertCampaignListItemDto.F_NAME) {
@Override
public void onClick(AjaxRequestTarget target, IModel<CertCampaignListItemDto> rowModel) {
campaignDetailsPerformed(target, rowModel.getObject().getOid());
}
};
columns.add(column);
column = new PropertyColumn(createStringResource("PageCertCampaigns.table.description"), CertCampaignListItemDto.F_DESCRIPTION);
columns.add(column);
column = new EnumPropertyColumn(createStringResource("PageCertCampaigns.table.state"), CertCampaignListItemDto.F_STATE) {
@Override
protected String translate(Enum en) {
return createStringResourceStatic(getPage(), en).getString();
}
};
columns.add(column);
column = new PropertyColumn(createStringResource("PageCertCampaigns.table.stage"), CertCampaignListItemDto.F_CURRENT_STAGE_NUMBER);
columns.add(column);
column = new PropertyColumn(createStringResource("PageCertCampaigns.table.escalationLevel"), CertCampaignListItemDto.F_ESCALATION_LEVEL_NUMBER);
columns.add(column);
column = new PropertyColumn(createStringResource("PageCertCampaigns.table.stages"), CertCampaignListItemDto.F_NUMBER_OF_STAGES);
columns.add(column);
column = new PropertyColumn(createStringResource("PageCertCampaigns.table.deadline"), CertCampaignListItemDto.F_DEADLINE_AS_STRING);
columns.add(column);
column = new SingleButtonColumn<CertCampaignListItemDto>(new Model(), null) {
@Override
public boolean isButtonEnabled(IModel<CertCampaignListItemDto> model) {
final AccessCertificationCampaignType campaign = model.getObject().getCampaign();
String button = determineAction(campaign);
return button != null;
}
@Override
public boolean isButtonVisible(IModel<CertCampaignListItemDto> model) {
final AccessCertificationCampaignType campaign = model.getObject().getCampaign();
return campaign.getState() != AccessCertificationCampaignStateType.IN_REMEDIATION && campaign.getState() != AccessCertificationCampaignStateType.CLOSED;
}
@Override
public String getCaption() {
AccessCertificationCampaignType campaign = getRowModel().getObject().getCampaign();
String button = determineAction(campaign);
if (button != null) {
return PageCertCampaigns.this.createStringResource(button).getString();
} else {
return "";
}
}
@Override
public String getButtonCssColorClass() {
return DoubleButtonColumn.BUTTON_COLOR_CLASS.PRIMARY.toString();
}
@Override
public String getButtonCssSizeClass() {
return DoubleButtonColumn.BUTTON_SIZE_CLASS.SMALL.toString();
}
@Override
public void clickPerformed(AjaxRequestTarget target, IModel<CertCampaignListItemDto> model) {
AccessCertificationCampaignType campaign = model.getObject().getCampaign();
String action = determineAction(campaign);
switch(action) {
case OP_START_CAMPAIGN:
case OP_OPEN_NEXT_STAGE:
openNextStagePerformed(target, campaign);
break;
case OP_CLOSE_STAGE:
closeStageConfirmation(target, model.getObject());
break;
case OP_START_REMEDIATION:
startRemediationPerformed(target, campaign);
break;
// not used
case OP_CLOSE_CAMPAIGN:
default:
throw new IllegalStateException("Unknown action: " + action);
}
}
};
columns.add(column);
columns.add(new InlineMenuHeaderColumn(createInlineMenu()));
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn in project midpoint by Evolveum.
the class PageTasks method initNodeColumns.
private List<IColumn<NodeDto, String>> initNodeColumns() {
List<IColumn<NodeDto, String>> columns = new ArrayList<>();
IColumn column = new CheckBoxHeaderColumn<>();
columns.add(column);
column = new PropertyColumn<>(createStringResource("pageTasks.node.name"), "name", "name");
columns.add(column);
columns.add(new EnumPropertyColumn<NodeDto>(createStringResource("pageTasks.node.executionStatus"), "executionStatus") {
@Override
protected String translate(Enum en) {
return createStringResource(en).getString();
}
});
columns.add(new PropertyColumn(createStringResource("pageTasks.node.managementPort"), "managementPort"));
columns.add(new AbstractColumn<NodeDto, String>(createStringResource("pageTasks.node.lastCheckInTime")) {
@Override
public void populateItem(Item<ICellPopulator<NodeDto>> item, String componentId, final IModel<NodeDto> rowModel) {
item.add(new Label(componentId, new AbstractReadOnlyModel<Object>() {
@Override
public Object getObject() {
return createLastCheckInTime(rowModel);
}
}));
}
});
CheckBoxColumn check = new CheckBoxColumn(createStringResource("pageTasks.node.clustered"), "clustered");
check.setEnabled(false);
columns.add(check);
columns.add(new PropertyColumn(createStringResource("pageTasks.node.statusMessage"), "statusMessage"));
IColumn<NodeDto, String> menuColumn = new InlineMenuButtonColumn<NodeDto>(createNodesInlineMenu(false), 2, PageTasks.this) {
@Override
protected int getHeaderNumberOfButtons() {
return 2;
}
@Override
protected List<InlineMenuItem> getHeaderMenuItems() {
return createNodesInlineMenu(true);
}
};
columns.add(menuColumn);
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn in project midpoint by Evolveum.
the class PageRoles method initColumns.
private List<IColumn<SelectableBean<RoleType>, String>> initColumns() {
List<IColumn<SelectableBean<RoleType>, String>> columns = new ArrayList<>();
IColumn column = new PropertyColumn(createStringResource("OrgType.displayName"), "value.displayName");
columns.add(column);
column = new PropertyColumn(createStringResource("OrgType.identifier"), "value.identifier");
columns.add(column);
column = new PropertyColumn(createStringResource("ObjectType.description"), "value.description");
columns.add(column);
return columns;
}
Aggregations