* Slightly better focus management

This commit is contained in:
Heng Sin Low 2008-07-21 10:52:50 +00:00
parent ec4a6734e1
commit e09e24a06d
2 changed files with 17 additions and 18 deletions

View File

@ -46,20 +46,5 @@ public class Tabbox extends org.zkoss.zul.Tabbox
public Tabpanel getSelectedTabpanel() public Tabpanel getSelectedTabpanel()
{ {
return getTabpanel(this.getSelectedIndex()); return getTabpanel(this.getSelectedIndex());
} }
/*
public void onEcho()
{
Tabpanel tp = (Tabpanel) this.getSelectedPanel();
Component child = tp.getFirstChild();
if (!child.isVisible())
{
child.setVisible(true);
if (child instanceof Borderlayout)
{
LayoutUtils.sendDeferLayoutEvent((Borderlayout) child, true);
}
}
}*/
} }

View File

@ -60,12 +60,14 @@ import org.compiere.util.Env;
import org.compiere.util.Evaluatee; import org.compiere.util.Evaluatee;
import org.zkoss.zhtml.Span; import org.zkoss.zhtml.Span;
import org.zkoss.zhtml.Text; import org.zkoss.zhtml.Text;
import org.zkoss.zk.au.out.AuFocus;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.HtmlBasedComponent; import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zkex.zul.Borderlayout; import org.zkoss.zkex.zul.Borderlayout;
import org.zkoss.zkex.zul.Center; import org.zkoss.zkex.zul.Center;
import org.zkoss.zkex.zul.West; import org.zkoss.zkex.zul.West;
@ -592,12 +594,24 @@ DataStatusListener, ValueChangeListener, IADTabpanel
else else
listPanel.deactivate(); listPanel.deactivate();
} else { } else {
if (activate) if (activate) {
formComponent.setVisible(activate); formComponent.setVisible(activate);
setInitialFocus();
}
} }
} }
public boolean isEditing() private void setInitialFocus() {
for (WEditor editor : editors) {
if (editor.isVisible() && editor.isReadWrite()) {
Clients.response(new AuFocus(editor.getComponent()));
break;
}
}
}
public boolean isEditing()
{ {
return this.editing; return this.editing;
} }