[ 2549235 ] Search window - too many records

minor twist to focus logic in form view.
This commit is contained in:
Heng Sin Low 2009-03-10 06:50:13 +00:00
parent 3d373500ff
commit 6101318f3f
3 changed files with 53 additions and 25 deletions

View File

@ -29,10 +29,10 @@ import java.util.logging.Level;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.Columns;
import org.adempiere.webui.component.EditorBox;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridPanel;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.SimpleTreeModel;
@ -730,21 +730,29 @@ DataStatusListener, IADTabpanel
panel.tabPanel.activate(activate);
}
private void setFocusToField() {
WEditor toFocus = null;
/**
* set focus to first active editor
*/
private void setFocusToField() {
WEditor toFocus = null;
for (WEditor editor : editors) {
if (editor.isHasFocus()) {
if (editor.isHasFocus() && editor.isVisible() && editor.getComponent().getParent() != null) {
toFocus = editor;
break;
}
if (toFocus == null) {
if (editor.isVisible() && editor.isReadWrite()) {
toFocus = editor;
if (editor.isVisible() && editor.isReadWrite() && editor.getComponent().getParent() != null) {
toFocus = editor;
}
}
}
}
if (toFocus != null) {
Clients.response(new AuFocus(toFocus.getComponent()));
Component c = toFocus.getComponent();
if (c instanceof EditorBox) {
c = ((EditorBox)c).getTextbox();
}
Clients.response(new AuFocus(c));
}
}

View File

@ -310,8 +310,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
protected CLogger log = CLogger.getCLogger(getClass());
protected WListbox contentPanel = new WListbox();
private Paging paging;
private int pageNo;
protected Paging paging;
protected int pageNo;
private static final String[] lISTENER_EVENTS = {};
@ -475,7 +475,12 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
paging.setTotalSize(line.size());
paging.setDetailed(true);
paging.addEventListener(ZulEvents.ON_PAGING, this);
contentPanel.getParent().insertBefore(paging, contentPanel.getNextSibling());
insertPagingComponent();
}
else
{
paging.setTotalSize(line.size());
paging.setActivePage(0);
}
List<Object> subList = line.subList(0, PAGE_SIZE);
model = new ListModelTable(subList);
@ -489,6 +494,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
if (paging != null)
{
paging.setTotalSize(line.size());
paging.setActivePage(0);
pageNo = 0;
}
model = new ListModelTable(line);
@ -504,7 +510,10 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
contentPanel.renderAll();
}
protected void insertPagingComponent() {
contentPanel.getParent().insertBefore(paging, contentPanel.getNextSibling());
}
public Vector<String> getColumnHeader(ColumnInfo[] p_layout)
{
Vector<String> columnHeader = new Vector<String>();

View File

@ -80,6 +80,7 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zkex.zul.Borderlayout;
import org.zkoss.zkex.zul.Center;
import org.zkoss.zkex.zul.North;
import org.zkoss.zkex.zul.South;
import org.zkoss.zul.Div;
import org.zkoss.zul.Separator;
@ -404,18 +405,15 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
desktopTabPanel.setHeight("100%");
desktopTabPanel.appendChild(m_tableAtp);
tabPanels.appendChild(desktopTabPanel);
//
//
borderlayout.setWidth("100%");
borderlayout.setHeight("400px");
borderlayout.setHeight("100%");
borderlayout.setStyle("border: none; position: relative");
Center center = new Center();
center.setAutoscroll(true);
center.setFlex(true);
borderlayout.appendChild(center);
Div div = new Div();
div.appendChild(contentPanel);
center.appendChild(div);
center.appendChild(contentPanel);
South south = new South();
south.setHeight("120px");
south.setCollapsible(true);
@ -426,18 +424,24 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
borderlayout.appendChild(south);
south.appendChild(tabbedPane);
Panel mainPanel = new Panel();
Borderlayout mainPanel = new Borderlayout();
mainPanel.setWidth("100%");
mainPanel.appendChild(grid);
mainPanel.appendChild(new Separator());
mainPanel.appendChild(borderlayout);
mainPanel.appendChild(new Separator());
mainPanel.appendChild(confirmPanel);
mainPanel.setHeight("100%");
North north = new North();
mainPanel.appendChild(north);
north.appendChild(grid);
center = new Center();
mainPanel.appendChild(center);
center.appendChild(borderlayout);
south = new South();
mainPanel.appendChild(south);
south.appendChild(confirmPanel);
this.appendChild(mainPanel);
this.setClosable(true);
this.setBorder("normal");
this.setWidth("1000px");
this.setHeight("650px");
contentPanel.addActionListener(new EventListener() {
public void onEvent(Event event) throws Exception {
@ -458,7 +462,14 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
}
});
}
@Override
protected void insertPagingComponent() {
North north = new North();
north.appendChild(paging);
borderlayout.appendChild(north);
}
/**
* Refresh Query
*/