IDEMPIERE-1232 Zoom condition fixes. 1) Fixed WFEditor.zoom not using zoom condition. 2) Added null check for the query parameter in AEnv.zoom methods 3) Fixed AEnv.zoom(AD_Window_ID, query) not using zoom condition. Added AEnv.showZoomWindow(AD_Window_ID, query) to replace the direct opening of zoom window usage.
This commit is contained in:
parent
6de2833897
commit
288c967594
|
@ -75,6 +75,9 @@ public class MZoomCondition extends X_AD_ZoomCondition
|
|||
|
||||
private static int findZoomWindowByTableId(int AD_Table_ID, MQuery query)
|
||||
{
|
||||
if (query == null)
|
||||
return 0;
|
||||
|
||||
MZoomCondition[] conditions = MZoomCondition.getConditions(AD_Table_ID);
|
||||
if (conditions.length > 0)
|
||||
{
|
||||
|
@ -111,6 +114,9 @@ public class MZoomCondition extends X_AD_ZoomCondition
|
|||
*/
|
||||
public static int findZoomWindowByWindowId(int AD_Window_ID, MQuery query)
|
||||
{
|
||||
if (query == null)
|
||||
return 0;
|
||||
|
||||
int tableID = DB.getSQLValueEx(null,
|
||||
"SELECT t.AD_Table_ID " +
|
||||
"FROM AD_Tab tab JOIN AD_Table t ON t.AD_Table_ID=tab.AD_Table_ID " +
|
||||
|
@ -125,6 +131,7 @@ public class MZoomCondition extends X_AD_ZoomCondition
|
|||
if (tableName != null && tableName.equals(query.getZoomTableName())) {
|
||||
return findZoomWindowByTableId(tableID, query);
|
||||
} else {
|
||||
try {
|
||||
GridWindow window = GridWindow.get(Env.getCtx(), -1, AD_Window_ID);
|
||||
if (window == null || window.getTabCount() == 0)
|
||||
return 0;
|
||||
|
@ -165,6 +172,9 @@ public class MZoomCondition extends X_AD_ZoomCondition
|
|||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
Env.clearWinContext(-1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -387,8 +387,17 @@ public final class AEnv
|
|||
zoomQuery.setRecordCount(1); // guess
|
||||
}
|
||||
int windowId = lookup.getZoom(zoomQuery);
|
||||
int zoomId = MZoomCondition.findZoomWindowByWindowId(windowId, zoomQuery);
|
||||
zoom(zoomId > 0 ? zoomId : windowId, zoomQuery);
|
||||
zoom(windowId, zoomQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* open zoom window with query
|
||||
* @param AD_Window_ID
|
||||
* @param query
|
||||
*/
|
||||
public static void showZoomWindow(int AD_Window_ID, MQuery query)
|
||||
{
|
||||
SessionManager.getAppDesktop().showZoomWindow(AD_Window_ID, query);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -399,7 +408,8 @@ public final class AEnv
|
|||
*/
|
||||
public static void zoom(int AD_Window_ID, MQuery query)
|
||||
{
|
||||
SessionManager.getAppDesktop().showZoomWindow(AD_Window_ID, query);
|
||||
int zoomId = MZoomCondition.findZoomWindowByWindowId(AD_Window_ID, query);
|
||||
showZoomWindow(zoomId > 0 ? zoomId : AD_Window_ID, query);
|
||||
}
|
||||
|
||||
public static void showWindow(Window win)
|
||||
|
@ -421,7 +431,7 @@ public final class AEnv
|
|||
if (AD_Window_ID == 0)
|
||||
return;
|
||||
|
||||
zoom(AD_Window_ID, query);
|
||||
showZoomWindow(AD_Window_ID, query);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.ListItem;
|
||||
|
@ -33,9 +32,7 @@ import org.adempiere.webui.panel.ADForm;
|
|||
import org.adempiere.webui.theme.ThemeManager;
|
||||
import org.compiere.apps.wf.WFGraphLayout;
|
||||
import org.compiere.apps.wf.WFNodeWidget;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
|
@ -445,15 +442,7 @@ public class WFEditor extends ADForm {
|
|||
private void zoom()
|
||||
{
|
||||
if (m_workflowId > 0) {
|
||||
int AD_Window_ID = MTable.get(Env.getCtx(), MWorkflow.Table_ID).getAD_Window_ID();
|
||||
|
||||
if (AD_Window_ID <= 0) {
|
||||
throw new AdempiereException("@NotFound@ @AD_Window_ID@");
|
||||
}
|
||||
|
||||
MQuery query = null;
|
||||
query = MQuery.getEqualQuery("AD_Workflow_ID", m_workflowId);
|
||||
AEnv.zoom(AD_Window_ID, query);
|
||||
AEnv.zoom(MWorkflow.Table_ID, m_workflowId);
|
||||
}
|
||||
} // zoom
|
||||
|
||||
|
|
Loading…
Reference in New Issue