FR2778207 Selectable zoom target window

- Modify to work for both swing and zk client
This commit is contained in:
Heng Sin Low 2009-04-24 07:02:27 +00:00
parent a94d18dd27
commit 75eaa4c2c9
2 changed files with 86 additions and 80 deletions

View File

@ -354,7 +354,8 @@ public class MLookupFactory
String sql0 = "SELECT t.TableName,ck.ColumnName AS KeyColumn," // 1..2 String sql0 = "SELECT t.TableName,ck.ColumnName AS KeyColumn," // 1..2
+ "cd.ColumnName AS DisplayColumn,rt.IsValueDisplayed,cd.IsTranslated," // 3..5 + "cd.ColumnName AS DisplayColumn,rt.IsValueDisplayed,cd.IsTranslated," // 3..5
+ "rt.WhereClause,rt.OrderByClause,t.AD_Window_ID,t.PO_Window_ID, " // 6..9 + "rt.WhereClause,rt.OrderByClause,t.AD_Window_ID,t.PO_Window_ID, " // 6..9
+ "t.AD_Table_ID, cd.ColumnSQL as DisplayColumnSQL " // 10..11 + "t.AD_Table_ID, cd.ColumnSQL as DisplayColumnSQL, " // 10..11
+ "rt.AD_Window_ID as RT_AD_Window_ID " // 12
+ "FROM AD_Ref_Table rt" + "FROM AD_Ref_Table rt"
+ " INNER JOIN AD_Table t ON (rt.AD_Table_ID=t.AD_Table_ID)" + " INNER JOIN AD_Table t ON (rt.AD_Table_ID=t.AD_Table_ID)"
+ " INNER JOIN AD_Column ck ON (rt.AD_Key=ck.AD_Column_ID)" + " INNER JOIN AD_Column ck ON (rt.AD_Key=ck.AD_Column_ID)"
@ -368,6 +369,7 @@ public class MLookupFactory
//boolean isSOTrx = !"N".equals(Env.getContext(ctx, WindowNo, "IsSOTrx")); //boolean isSOTrx = !"N".equals(Env.getContext(ctx, WindowNo, "IsSOTrx"));
int ZoomWindow = 0; int ZoomWindow = 0;
int ZoomWindowPO = 0; int ZoomWindowPO = 0;
int overrideZoomWindow = 0;
//int AD_Table_ID = 0; //int AD_Table_ID = 0;
boolean loaded = false; boolean loaded = false;
@ -391,6 +393,7 @@ public class MLookupFactory
ZoomWindowPO = rs.getInt(9); ZoomWindowPO = rs.getInt(9);
//AD_Table_ID = rs.getInt(10); //AD_Table_ID = rs.getInt(10);
displayColumnSQL = rs.getString(11); displayColumnSQL = rs.getString(11);
overrideZoomWindow = rs.getInt(12);
loaded = true; loaded = true;
} }
} }
@ -486,6 +489,11 @@ public class MLookupFactory
realSQL.append(" ORDER BY 3"); realSQL.append(" ORDER BY 3");
s_log.finest("AD_Reference_Value_ID=" + AD_Reference_Value_ID + " - " + realSQL); s_log.finest("AD_Reference_Value_ID=" + AD_Reference_Value_ID + " - " + realSQL);
if (overrideZoomWindow > 0)
{
ZoomWindow = overrideZoomWindow;
ZoomWindowPO = 0;
}
retValue = new MLookupInfo (realSQL.toString(), TableName, retValue = new MLookupInfo (realSQL.toString(), TableName,
TableName + "." + KeyColumn, ZoomWindow, ZoomWindowPO, zoomQuery); TableName + "." + KeyColumn, ZoomWindow, ZoomWindowPO, zoomQuery);
s_cacheRefTable.put(key, retValue.cloneIt()); s_cacheRefTable.put(key, retValue.cloneIt());

View File

@ -1293,7 +1293,6 @@ public class VLookup extends JComponent
Object value = getValue(); Object value = getValue();
if (value == null) if (value == null)
value = selectedItem; value = selectedItem;
int AD_Window_ID = 0;
// If not already exist or exact value // If not already exist or exact value
if (zoomQuery == null || value != null) if (zoomQuery == null || value != null)
{ {
@ -1305,7 +1304,7 @@ public class VLookup extends JComponent
int AD_Reference_ID = ((MLookup)m_lookup).getAD_Reference_Value_ID(); int AD_Reference_ID = ((MLookup)m_lookup).getAD_Reference_Value_ID();
if (AD_Reference_ID != 0) if (AD_Reference_ID != 0)
{ {
String query = "SELECT kc.ColumnName, rt.AD_Window_ID" String query = "SELECT kc.ColumnName"
+ " FROM AD_Ref_Table rt" + " FROM AD_Ref_Table rt"
+ " INNER JOIN AD_Column kc ON (rt.AD_Key=kc.AD_Column_ID)" + " INNER JOIN AD_Column kc ON (rt.AD_Key=kc.AD_Column_ID)"
+ "WHERE rt.AD_Reference_ID=?"; + "WHERE rt.AD_Reference_ID=?";
@ -1320,7 +1319,6 @@ public class VLookup extends JComponent
if (rs.next()) if (rs.next())
{ {
keyColumnName = rs.getString(1); keyColumnName = rs.getString(1);
AD_Window_ID = rs.getInt(2);
} }
} }
catch (Exception e) catch (Exception e)
@ -1342,8 +1340,8 @@ public class VLookup extends JComponent
zoomQuery.setRecordCount(1); // guess zoomQuery.setRecordCount(1); // guess
} }
if ( AD_Window_ID == 0 )
AD_Window_ID = m_lookup.getZoom(zoomQuery); int AD_Window_ID = m_lookup.getZoom(zoomQuery);
// //
log.info(m_columnName + " - AD_Window_ID=" + AD_Window_ID log.info(m_columnName + " - AD_Window_ID=" + AD_Window_ID
+ " - Query=" + zoomQuery + " - Value=" + value); + " - Query=" + zoomQuery + " - Value=" + value);