IDEMPIERE-144 Performance: Reduce use of modal dialog. Fixed bug for high volume window with less than 10 records.

This commit is contained in:
Heng Sin Low 2012-06-09 11:57:29 +08:00
parent a07c3048f6
commit 53232346e0
4 changed files with 53 additions and 22 deletions

View File

@ -51,11 +51,15 @@ public class ToolBarButton extends org.zkoss.zul.Toolbarbutton
public void setPressed(boolean pressed) {
this.pressed = pressed; // Elaine 2008/12/09
if (!getMode().equals("toggle"))
setMode("toggle");
if (!isDisabled())
setChecked(pressed);
if (!isDisabled()) {
if (pressed) {
setMode("toggle");
setChecked(true);
} else {
setMode("default");
setChecked(false);
}
}
}
// Elaine 2008/12/09

View File

@ -705,23 +705,30 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
final FindWindow find = new FindWindow(curWindowNo,
mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(),
where.toString(), findFields, 10, mTab.getAD_Tab_ID()); // no query below 10
find.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
if (!find.isCancel())
{
m_findCreateNew = find.isCreateNew();
MQuery result = m_findCreateNew ? query : find.getQuery();
callback.onCallback(result);
}
else
{
m_findCancelled = true;
callback.onCallback(null);
}
}
});
AEnv.showWindow(find);
if (find.isValid())
{
find.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
if (!find.isCancel())
{
m_findCreateNew = find.isCreateNew();
MQuery result = m_findCreateNew ? query : find.getQuery();
callback.onCallback(result);
}
else
{
m_findCancelled = true;
callback.onCallback(null);
}
}
});
AEnv.showWindow(find);
}
else
{
callback.onCallback(query);
}
}
else
{
@ -1530,6 +1537,13 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
curTab.getAD_Table_ID(), curTab.getTableName(),
curTab.getWhereExtended(), findFields, 1, curTab.getAD_Tab_ID());
if (!find.isValid()) {
if (find.getTotalRecords() == 0) {
FDialog.info(curWindowNo, getComponent(), "NoRecordsFound");
}
return;
}
find.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
@ -1547,6 +1561,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
curTab.dataRefresh(false); // Elaine 2008/07/25
}
else
{
toolbar.getButton("Find").setPressed(curTab.isQueryActive());
}
focusToActivePanel();
}
});

View File

@ -153,6 +153,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
private MUserQuery[] userQueries;
private Rows contentSimpleRows;
private boolean m_createNew = false;
private boolean isvalid = true;
/** Index ColumnName = 0 */
public static final int INDEX_COLUMNNAME = 0;
@ -1328,6 +1329,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
//
super.dispose();
isvalid = false;
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
} // dispose
@ -1726,4 +1728,8 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
&& MColumn.isSuggestSelectionColumn(field.getColumnName(), true);
}
public boolean isValid()
{
return isvalid;
}
} // FindPanel

View File

@ -1026,6 +1026,9 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
else
{
final FindWindow find = new FindWindow(m_WindowNo, title, AD_Table_ID, tableName,m_reportEngine.getWhereExtended(), findFields, 1, AD_Tab_ID);
if (!find.isValid())
return;
find.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {