[ 2479495 ] Match PO-Receipt, PO selection should be using radio button

This commit is contained in:
Heng Sin Low 2008-12-31 20:14:23 +00:00
parent fc507deedc
commit 0c8cecc3d2
2 changed files with 33 additions and 22 deletions

View File

@ -334,23 +334,11 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
// if ID column make it invisible
else if (field instanceof IDColumn)
{
listcell.setValue(((IDColumn) field).getRecord_ID());
Checkbox checkbox = new Checkbox();
checkbox.setChecked(((IDColumn) field).isSelected());
if (isCellEditable)
{
checkbox.setEnabled(true);
checkbox.addEventListener(Events.ON_CHECK, this);
}
else
{
checkbox.setEnabled(false);
}
listcell.appendChild(checkbox);
ZkCssHelper.appendStyle(listcell, "text-align:center");
listcell.setValue(((IDColumn) field).getRecord_ID());
if (!table.isCheckmark())
table.setCheckmark(true);
table.removeEventListener(Events.ON_SELECT, this);
table.addEventListener(Events.ON_SELECT, this);
}
else
{
@ -587,6 +575,34 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
fireTableValueChange(vcEvent);
}
}
else if (event.getTarget() instanceof WListbox && Events.ON_SELECT.equals(event.getName()))
{
WListbox table = (WListbox) event.getTarget();
if (table.isCheckmark()) {
int cnt = table.getRowCount();
if (cnt == 0 || !(table.getValueAt(0, 0) instanceof IDColumn))
return;
//update IDColumn
tableColumn = m_tableColumns.get(0);
for (int i = 0; i < cnt; i++) {
IDColumn idcolumn = (IDColumn) table.getValueAt(i, 0);
Listitem item = table.getItemAtIndex(i);
value = item.isSelected();
Boolean old = idcolumn.isSelected();
if (!old.equals(value)) {
vcEvent = new TableValueChangeEvent(source,
tableColumn.getHeaderValue().toString(),
i, 0,
old, value);
fireTableValueChange(vcEvent);
}
}
}
}
return;

View File

@ -375,11 +375,6 @@ public class WListbox extends Listbox implements TableValueChangeListener, WTabl
sql.append( " FROM ").append(from);
sql.append(" WHERE ").append(where);
// Table Selection
// TODO
//setRowSelectionAllowed(true);
// org.compiere.apps.form.VMatch.dynInit calls routine for initial init only
if (from.length() == 0)
{
return sql.toString();