IDEMPIERE-1248 Performance Optimization: Eliminate the fire and processing of duplicate event. Backout optimization for dynamic display which is causing some regression.
This commit is contained in:
parent
4be5c4a9da
commit
390c89281c
|
@ -78,7 +78,6 @@ import org.compiere.util.Util;
|
||||||
import org.zkoss.zk.au.out.AuFocus;
|
import org.zkoss.zk.au.out.AuFocus;
|
||||||
import org.zkoss.zk.au.out.AuScript;
|
import org.zkoss.zk.au.out.AuScript;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.Execution;
|
|
||||||
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.IdSpace;
|
import org.zkoss.zk.ui.IdSpace;
|
||||||
|
@ -127,11 +126,6 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
||||||
public static final String ON_SWITCH_VIEW_EVENT = "onSwitchView";
|
public static final String ON_SWITCH_VIEW_EVENT = "onSwitchView";
|
||||||
|
|
||||||
public static final String ON_DYNAMIC_DISPLAY_EVENT = "onDynamicDisplay";
|
public static final String ON_DYNAMIC_DISPLAY_EVENT = "onDynamicDisplay";
|
||||||
|
|
||||||
public static final String ON_DYNAMIC_DISPLAY_CALL_EVENT = "onDynamicDisplayCall";
|
|
||||||
|
|
||||||
public static final String ON_DYNAMIC_DISPLAY_CALL_EVENT_ATTR = "onDynamicDisplayCall.Event.Posted";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -224,7 +218,6 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
||||||
});
|
});
|
||||||
addEventListener(ON_POST_INIT_EVENT, this);
|
addEventListener(ON_POST_INIT_EVENT, this);
|
||||||
addEventListener(ON_SAVE_OPEN_PREFERENCE_EVENT, this);
|
addEventListener(ON_SAVE_OPEN_PREFERENCE_EVENT, this);
|
||||||
addEventListener(ON_DYNAMIC_DISPLAY_CALL_EVENT, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initComponents()
|
private void initComponents()
|
||||||
|
@ -658,49 +651,11 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn on/off the processing of dynamic display call for current execution cycle.
|
* Validate display properties of fields of current row.
|
||||||
* 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
|
|
||||||
* @param col
|
* @param col
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void dynamicDisplay (int col)
|
public void dynamicDisplay (int col)
|
||||||
{
|
|
||||||
//0 and -1 is same
|
|
||||||
if (col < 0)
|
|
||||||
col = 0;
|
|
||||||
int currentRow = getGridTab().isSortTab() ? 0 : getGridTab().getCurrentRow();
|
|
||||||
Execution exec = Executions.getCurrent();
|
|
||||||
StringBuilder builder = new StringBuilder(ON_DYNAMIC_DISPLAY_CALL_EVENT_ATTR)
|
|
||||||
.append("_").append(getUuid())
|
|
||||||
.append("_").append(col)
|
|
||||||
.append("_").append(currentRow);
|
|
||||||
String key = builder.toString();
|
|
||||||
if (exec.getAttribute(key) == null)
|
|
||||||
{
|
|
||||||
exec.setAttribute(key, Boolean.TRUE);
|
|
||||||
Events.sendEvent(ON_DYNAMIC_DISPLAY_CALL_EVENT, this, col);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onDynamicDisplayCall (int col)
|
|
||||||
{
|
{
|
||||||
if (!gridTab.isOpen())
|
if (!gridTab.isOpen())
|
||||||
{
|
{
|
||||||
|
@ -1106,10 +1061,6 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
||||||
Env.getCtx().setProperty("P"+windowId+"|"+adTabId+"|DetailPane.IsOpen", value ? "Y" : "N");
|
Env.getCtx().setProperty("P"+windowId+"|"+adTabId+"|DetailPane.IsOpen", value ? "Y" : "N");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event.getName().equals(ON_DYNAMIC_DISPLAY_CALL_EVENT)) {
|
|
||||||
Integer col = (Integer) event.getData();
|
|
||||||
onDynamicDisplayCall(col);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSouthEvent(SouthEvent event) {
|
private void onSouthEvent(SouthEvent event) {
|
||||||
|
|
|
@ -1575,23 +1575,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
protected void afterRefresh(final boolean fireEvent) {
|
protected void afterRefresh(final boolean fireEvent) {
|
||||||
IADTabpanel headerTab = adTabbox.getSelectedTabpanel();
|
IADTabpanel headerTab = adTabbox.getSelectedTabpanel();
|
||||||
IADTabpanel detailTab = adTabbox.getSelectedDetailADTabpanel();
|
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);
|
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);
|
headerTab.dynamicDisplay(0);
|
||||||
if (detailTab != null)
|
if (detailTab != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue