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) { public void setPressed(boolean pressed) {
this.pressed = pressed; // Elaine 2008/12/09 this.pressed = pressed; // Elaine 2008/12/09
if (!getMode().equals("toggle")) if (!isDisabled()) {
setMode("toggle"); if (pressed) {
setMode("toggle");
if (!isDisabled()) setChecked(true);
setChecked(pressed); } else {
setMode("default");
setChecked(false);
}
}
} }
// Elaine 2008/12/09 // Elaine 2008/12/09

View File

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

View File

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

View File

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