IDEMPIERE-1248 Performance Optimization: Eliminate the fire and processing of duplicate event. Fixed problem with refresh after process call.

This commit is contained in:
Heng Sin Low 2013-08-06 12:29:19 +08:00
parent 8630ed7597
commit d1dea0fd02
2 changed files with 56 additions and 8 deletions

View File

@ -657,6 +657,25 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
return new Space(); return new Space();
} }
/**
* Turn on/off the processing of dynamic display call for current execution cycle.
* The system will ignore duplicate dynamic display request within the same execution cycle,
* this method can be use to alter that.
* @param enable
*/
public void toggleDynamicDisplay(boolean enable) {
Execution exec = Executions.getCurrent();
int currentRow = getGridTab().isSortTab() ? 0 : getGridTab().getCurrentRow();
StringBuilder builder = new StringBuilder(ON_DYNAMIC_DISPLAY_CALL_EVENT_ATTR)
.append("_").append(getUuid())
.append("_").append(0)
.append("_").append(currentRow);
if (enable)
exec.removeAttribute(builder.toString());
else
exec.setAttribute(builder.toString(), Boolean.TRUE);
}
/** /**
* Validate display properties of fields of current row * Validate display properties of fields of current row
* @param col * @param col
@ -669,8 +688,10 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
col = 0; col = 0;
int currentRow = getGridTab().isSortTab() ? 0 : getGridTab().getCurrentRow(); int currentRow = getGridTab().isSortTab() ? 0 : getGridTab().getCurrentRow();
Execution exec = Executions.getCurrent(); Execution exec = Executions.getCurrent();
StringBuilder builder = new StringBuilder(ON_DYNAMIC_DISPLAY_CALL_EVENT_ATTR).append("_") StringBuilder builder = new StringBuilder(ON_DYNAMIC_DISPLAY_CALL_EVENT_ATTR)
.append(col).append("_").append(currentRow); .append("_").append(getUuid())
.append("_").append(col)
.append("_").append(currentRow);
String key = builder.toString(); String key = builder.toString();
if (exec.getAttribute(key) == null) if (exec.getAttribute(key) == null)
{ {

View File

@ -1559,20 +1559,47 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
@Override @Override
public void onCallback(Boolean result) { public void onCallback(Boolean result) {
adTabbox.getSelectedGridTab().dataRefreshAll(fireEvent, true); afterRefresh(fireEvent);
adTabbox.getSelectedTabpanel().dynamicDisplay(0);
focusToActivePanel();
} }
}); });
} }
else else
{ {
adTabbox.getSelectedGridTab().dataRefreshAll(fireEvent, true); afterRefresh(fireEvent);
adTabbox.getSelectedTabpanel().dynamicDisplay(0);
focusToActivePanel();
} }
} }
/**
* @param fireEvent
*/
protected void afterRefresh(final boolean fireEvent) {
IADTabpanel headerTab = adTabbox.getSelectedTabpanel();
IADTabpanel detailTab = adTabbox.getSelectedDetailADTabpanel();
if (headerTab instanceof ADTabpanel)
{
((ADTabpanel) headerTab).toggleDynamicDisplay(false);
}
if (detailTab != null && detailTab instanceof ADTabpanel)
{
((ADTabpanel) detailTab).toggleDynamicDisplay(false);
}
adTabbox.getSelectedGridTab().dataRefreshAll(fireEvent, true);
if (headerTab instanceof ADTabpanel)
{
((ADTabpanel) headerTab).toggleDynamicDisplay(true);
}
if (detailTab != null && detailTab instanceof ADTabpanel)
{
((ADTabpanel) detailTab).toggleDynamicDisplay(true);
}
headerTab.dynamicDisplay(0);
if (detailTab != null)
{
detailTab.dynamicDisplay(0);
}
focusToActivePanel();
}
/** /**
* @see ToolbarListener#onRefresh() * @see ToolbarListener#onRefresh()
*/ */