@Override
public void populateItem(
Item<ICellPopulator<CreditPaths>> cellItem,
String componentId, IModel<CreditPaths> rowModel) {
CreditPaths twoPartnersPaths = rowModel.getObject();
User creditor = twoPartnersPaths.getCreditor();
cellItem.add(new Label(componentId, creditor == null ? "???" : creditor.getDisplayName()));
}
});
//Available amount
columns.add(new AbstractColumn<CreditPaths, String>(new ResourceModel(MKEY_MAX_AMOUNT)) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<CreditPaths>> cellItem, String componentId,
IModel<CreditPaths> rowModel) {
CreditPaths twoPartnersPaths = rowModel.getObject();
BigDecimal maxAmount = BigDecimal.ZERO;
for(CreditPath path: twoPartnersPaths.getPaths()) {
maxAmount = maxAmount.add(creditLineReader.getAvailableAmount(path.getPath()));
}
cellItem.add(new Label(componentId, maxAmount.toString()));
}
});
//Number of paths between two partners
columns.add(new AbstractColumn<CreditPaths, String>(new ResourceModel(MKEY_PATHS_COUNT)) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<CreditPaths>> cellItem, String componentId,
IModel<CreditPaths> rowModel) {
CreditPaths twoPartnersPaths = rowModel.getObject();
cellItem.add(new Label(componentId, String.valueOf(twoPartnersPaths.getPaths().size())));
}
});
//Amount input column
columns.add(new AbstractColumn<CreditPaths, String>(new ResourceModel(MKEY_AMOUNT)) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<CreditPaths>> cellItem, String componentId,
final IModel<CreditPaths> rowModel) {
final CreditPaths twoPartnersPathsContainer = rowModel.getObject();
cellItem.add(new AttributeAppender("style", ";width:110px;"));//TODO: constant
cellItem.add(new AjaxEditorLink<BigDecimal>(componentId, new Model<BigDecimal>(BigDecimal.ZERO)) {
private static final long serialVersionUID = 1L;
private NumberTextField<BigDecimal> amountInput;