hoursInput = new NumberTextField<BigDecimal>(
CKEY_WHOURS_INPUT, new Model<BigDecimal>(workEfforts.getWorkingHours()), BigDecimal.class);
hoursInput.setOutputMarkupId(true);
hoursInput.setMinimum(BigDecimal.ZERO);
hoursInput.setMaximum(BigDecimal.valueOf(Double.MAX_VALUE));
hoursInput.add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
BigDecimal hours = hoursInput.getConvertedInput();
hoursInput.setModelObject(hours);
target.add(totalPriceLabel);
}
});
hoursInput.setOutputMarkupId(true);
add(hoursInput);
//Informational labels
BigDecimal hourPrice = workEfforts.getWorkingHours().setScale(2).equals(BigDecimal.ZERO.setScale(2))
?BigDecimal.ZERO
:workEfforts.getWorkPrice().divide(
workEfforts.getWorkingHours(), RoundingMode.HALF_UP);
hourPriceInput = new NumberTextField<BigDecimal>(
CKEY_HOURPRICE_INPUT, new Model<BigDecimal>(hourPrice), BigDecimal.class);
hourPriceInput.setOutputMarkupId(true);
hourPriceInput.setMinimum(BigDecimal.ZERO);
hourPriceInput.setMaximum(BigDecimal.valueOf(Double.MAX_VALUE));
hourPriceInput.add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
BigDecimal hourPrice = hourPriceInput.getConvertedInput();