* [2308109] WListbox doesn't support editing of non bigdecimal field

* [2308105] WListbox should always re-render when row is select/deselect
This commit is contained in:
Heng Sin Low 2008-11-20 17:18:47 +00:00
parent 1e3610cec4
commit fa599909a2
2 changed files with 11 additions and 4 deletions

View File

@ -275,9 +275,12 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
listcell.appendChild(checkbox);
ZkCssHelper.appendStyle(listcell, "text-align:center");
}
else if (field instanceof BigDecimal)
else if (field instanceof Number)
{
DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
DecimalFormat format = field instanceof BigDecimal
? DisplayType.getNumberFormat(DisplayType.Amount)
: DisplayType.getNumberFormat(DisplayType.Integer);
// set cell value to allow sorting
listcell.setValue(field.toString());
@ -285,7 +288,7 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
{
NumberBox numberbox = new NumberBox(false);
numberbox.setFormat(format);
numberbox.setValue((BigDecimal)field);
numberbox.setValue(field);
numberbox.setWidth("100px");
numberbox.setEnabled(true);
numberbox.setStyle("text-align:right; "
@ -295,7 +298,7 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
}
else
{
listcell.setLabel(format.format(((BigDecimal)field).doubleValue()));
listcell.setLabel(format.format(((Number)field).doubleValue()));
ZkCssHelper.appendStyle(listcell, "text-align:right");
}
}

View File

@ -1008,6 +1008,10 @@ public class WListbox extends Listbox implements TableValueChangeListener, WTabl
{
this.repaint();
}
else
{
this.setModel(this.getModel());
}
return;
}