merge revision 6492 from branches/adempiere341

This commit is contained in:
Heng Sin Low 2008-09-21 07:25:00 +00:00
parent 98baad232a
commit b82fc8a241
1 changed files with 25 additions and 1 deletions

View File

@ -29,6 +29,7 @@ import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Listitem;
/**
*
@ -38,7 +39,7 @@ import org.zkoss.zk.ui.event.Events;
*/
public class Listbox extends org.zkoss.zul.Listbox implements EventListener
{
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
private List<EventListener> doubleClickListeners = new ArrayList<EventListener>();
@ -280,5 +281,28 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener
}
}
}
}
@Override
protected void afterInsert(Component comp) {
super.afterInsert(comp);
if ("select".equals(getMold()) && comp instanceof Listitem) {
if (getSelectedIndex() < 0 && getItemCount() > 0) {
setSelectedIndex(0);
}
}
}
@Override
public boolean removeChild(Component child) {
boolean b = super.removeChild(child);
if (b) {
if ("select".equals(getMold()) && child instanceof Listitem) {
if (getSelectedIndex() < 0 && getItemCount() > 0) {
setSelectedIndex(0);
}
}
}
return b;
}
}