FR [ 1982448 ] GridTab context, use constants instead of literal strings
This commit is contained in:
parent
7a34172016
commit
ba1ac65ecf
|
@ -338,7 +338,7 @@ public class GridField
|
|||
}
|
||||
|
||||
// Field is the Link Column of the tab
|
||||
if (m_vo.ColumnName.equals(Env.getContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, "LinkColumnName")))
|
||||
if (m_vo.ColumnName.equals(Env.getContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, GridTab.CTX_LinkColumnName)))
|
||||
{
|
||||
log.finest(m_vo.ColumnName + " NO - LinkColumn");
|
||||
return false;
|
||||
|
@ -349,7 +349,7 @@ public class GridField
|
|||
{
|
||||
int AD_Client_ID = Env.getContextAsInt(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, "AD_Client_ID");
|
||||
int AD_Org_ID = Env.getContextAsInt(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, "AD_Org_ID");
|
||||
String keyColumn = Env.getContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, "KeyColumnName");
|
||||
String keyColumn = Env.getContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, GridTab.CTX_KeyColumnName);
|
||||
if ("EntityType".equals(keyColumn))
|
||||
keyColumn = "AD_EntityType_ID";
|
||||
if (!keyColumn.endsWith("_ID"))
|
||||
|
@ -450,14 +450,14 @@ public class GridField
|
|||
}
|
||||
|
||||
// Set Client & Org to System, if System access
|
||||
if (X_AD_Table.ACCESSLEVEL_SystemOnly.equals(Env.getContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, "AccessLevel"))
|
||||
if (X_AD_Table.ACCESSLEVEL_SystemOnly.equals(Env.getContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, GridTab.CTX_AccessLevel))
|
||||
&& (m_vo.ColumnName.equals("AD_Client_ID") || m_vo.ColumnName.equals("AD_Org_ID")))
|
||||
{
|
||||
log.fine("[SystemAccess] " + m_vo.ColumnName + "=0");
|
||||
return new Integer(0);
|
||||
}
|
||||
// Set Org to System, if Client access
|
||||
else if (X_AD_Table.ACCESSLEVEL_SystemPlusClient.equals(Env.getContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, "AccessLevel"))
|
||||
else if (X_AD_Table.ACCESSLEVEL_SystemPlusClient.equals(Env.getContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, GridTab.CTX_AccessLevel))
|
||||
&& m_vo.ColumnName.equals("AD_Org_ID"))
|
||||
{
|
||||
log.fine("[ClientAccess] " + m_vo.ColumnName + "=0");
|
||||
|
@ -1081,7 +1081,7 @@ public class GridField
|
|||
m_parentValue = Boolean.FALSE;
|
||||
else
|
||||
{
|
||||
String LinkColumnName = Env.getContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, "LinkColumnName");
|
||||
String LinkColumnName = Env.getContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, GridTab.CTX_LinkColumnName);
|
||||
if (LinkColumnName == null || LinkColumnName.length() == 0)
|
||||
m_parentValue = Boolean.FALSE; // teo_sarca, [ 1673886 ]
|
||||
else
|
||||
|
@ -1559,16 +1559,16 @@ public class GridField
|
|||
{
|
||||
boolean result = false;
|
||||
int tabNo = m_vo.TabNo;
|
||||
int currentLevel = Env.getContextAsInt(m_vo.ctx, m_vo.WindowNo, tabNo, "TabLevel");
|
||||
int currentLevel = Env.getContextAsInt(m_vo.ctx, m_vo.WindowNo, tabNo, GridTab.CTX_TabLevel);
|
||||
if (tabNo > 1 && currentLevel > 1)
|
||||
{
|
||||
while ( tabNo >= 1 && !result)
|
||||
{
|
||||
tabNo--;
|
||||
int level = Env.getContextAsInt(m_vo.ctx, m_vo.WindowNo, tabNo, "TabLevel");
|
||||
int level = Env.getContextAsInt(m_vo.ctx, m_vo.WindowNo, tabNo, GridTab.CTX_TabLevel);
|
||||
if (level > 0 && level < currentLevel)
|
||||
{
|
||||
String linkColumn = Env.getContext(m_vo.ctx, m_vo.WindowNo, tabNo, "LinkColumnName");
|
||||
String linkColumn = Env.getContext(m_vo.ctx, m_vo.WindowNo, tabNo, GridTab.CTX_LinkColumnName);
|
||||
if (m_vo.ColumnName.equals(linkColumn))
|
||||
{
|
||||
result = true;
|
||||
|
|
|
@ -68,7 +68,8 @@ import org.compiere.util.ValueNamePair;
|
|||
* @author Jorg Janke
|
||||
* @version $Id: GridTab.java,v 1.10 2006/10/02 05:18:39 jjanke Exp $
|
||||
*
|
||||
* @author Teo Sarca - BF [ 1742159 ]
|
||||
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||
* <li>BF [ 1742159 ] Editable number field for inactive record
|
||||
* @author Victor Perez , e-Evolution.SC [1877902] Implement JSR 223 Scripting APIs to Callout
|
||||
* @author Carlos Ruiz, qss FR [1877902]
|
||||
* @see http://sourceforge.net/tracker/?func=detail&atid=879335&aid=1877902&group_id=176962 to FR [1877902]
|
||||
|
@ -144,6 +145,16 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
protected CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
private boolean m_parentNeedSave = false;
|
||||
|
||||
// Context property names:
|
||||
public static final String CTX_KeyColumnName = "KeyColumnName";
|
||||
public static final String CTX_LinkColumnName = "LinkColumnName";
|
||||
public static final String CTX_TabLevel = "TabLevel";
|
||||
public static final String CTX_AccessLevel = "AccessLevel";
|
||||
public static final String CTX_AD_Tab_ID = "AD_Tab_ID";
|
||||
public static final String CTX_Name = "Name";
|
||||
public static final String CTX_AD_Table_ID = "AD_Table_ID";
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -298,8 +309,9 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
voF.IsReadOnly = true;
|
||||
}*/
|
||||
// Record Info
|
||||
if (field.isKey())
|
||||
m_keyColumnName = columnName;
|
||||
if (field.isKey()) {
|
||||
setKeyColumnName(columnName);
|
||||
}
|
||||
// Parent Column(s)
|
||||
if (field.isParentColumn())
|
||||
m_parents.add(columnName);
|
||||
|
@ -1030,6 +1042,15 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
{
|
||||
return m_keyColumnName;
|
||||
} // getKeyColumnName
|
||||
|
||||
/**
|
||||
* Set Name of the Key Column
|
||||
* @param keyColumnName
|
||||
*/
|
||||
private void setKeyColumnName(String keyColumnName) {
|
||||
this.m_keyColumnName = keyColumnName;
|
||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, CTX_KeyColumnName, m_keyColumnName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Name of link column
|
||||
|
@ -1076,7 +1097,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
log.fine("AD_Column_ID=" + m_vo.AD_Column_ID + " - " + m_linkColumnName);
|
||||
}
|
||||
}
|
||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, "LinkColumnName", m_linkColumnName);
|
||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, CTX_LinkColumnName, m_linkColumnName);
|
||||
} // setLinkColumnName
|
||||
|
||||
/**
|
||||
|
|
|
@ -96,9 +96,9 @@ public class GridTabVO implements Evaluatee, Serializable
|
|||
try
|
||||
{
|
||||
vo.AD_Tab_ID = rs.getInt("AD_Tab_ID");
|
||||
Env.setContext(vo.ctx, vo.WindowNo, vo.TabNo, "AD_Tab_ID", String.valueOf(vo.AD_Tab_ID));
|
||||
Env.setContext(vo.ctx, vo.WindowNo, vo.TabNo, GridTab.CTX_AD_Tab_ID, String.valueOf(vo.AD_Tab_ID));
|
||||
vo.Name = rs.getString("Name");
|
||||
Env.setContext(vo.ctx, vo.WindowNo, vo.TabNo, "Name", vo.Name);
|
||||
Env.setContext(vo.ctx, vo.WindowNo, vo.TabNo, GridTab.CTX_Name, vo.Name);
|
||||
|
||||
// Translation Tab **
|
||||
if (rs.getString("IsTranslationTab").equals("Y"))
|
||||
|
@ -142,11 +142,11 @@ public class GridTabVO implements Evaluatee, Serializable
|
|||
CLogger.get().fine("No Role Access - AD_Tab_ID=" + vo.AD_Tab_ID + " " + vo. Name);
|
||||
return false;
|
||||
} // Used by MField.getDefault
|
||||
Env.setContext(vo.ctx, vo.WindowNo, vo.TabNo, "AccessLevel", vo.AccessLevel);
|
||||
Env.setContext(vo.ctx, vo.WindowNo, vo.TabNo, GridTab.CTX_AccessLevel, vo.AccessLevel);
|
||||
|
||||
// Table Access
|
||||
vo.AD_Table_ID = rs.getInt("AD_Table_ID");
|
||||
Env.setContext(vo.ctx, vo.WindowNo, vo.TabNo, "AD_Table_ID", String.valueOf(vo.AD_Table_ID));
|
||||
Env.setContext(vo.ctx, vo.WindowNo, vo.TabNo, GridTab.CTX_AD_Table_ID, String.valueOf(vo.AD_Table_ID));
|
||||
if (!role.isTableAccess(vo.AD_Table_ID, true))
|
||||
{
|
||||
CLogger.get().config("No Table Access - AD_Tab_ID="
|
||||
|
@ -526,11 +526,11 @@ public class GridTabVO implements Evaluatee, Serializable
|
|||
GridTabVO clone = new GridTabVO(Ctx, windowNo);
|
||||
clone.AD_Window_ID = AD_Window_ID;
|
||||
clone.TabNo = TabNo;
|
||||
Env.setContext(Ctx, windowNo, clone.TabNo, "AD_Tab_ID", String.valueOf(clone.AD_Tab_ID));
|
||||
Env.setContext(Ctx, windowNo, clone.TabNo, GridTab.CTX_AD_Tab_ID, String.valueOf(clone.AD_Tab_ID));
|
||||
//
|
||||
clone.AD_Tab_ID = AD_Tab_ID;
|
||||
clone.Name = Name;
|
||||
Env.setContext(Ctx, windowNo, clone.TabNo, "Name", clone.Name);
|
||||
Env.setContext(Ctx, windowNo, clone.TabNo, GridTab.CTX_Name, clone.Name);
|
||||
clone.Description = Description;
|
||||
clone.Help = Help;
|
||||
clone.IsSingleRow = IsSingleRow;
|
||||
|
@ -555,8 +555,8 @@ public class GridTabVO implements Evaluatee, Serializable
|
|||
clone.AD_Image_ID = AD_Image_ID;
|
||||
clone.Included_Tab_ID = Included_Tab_ID;
|
||||
clone.ReplicationType = ReplicationType;
|
||||
Env.setContext(Ctx, windowNo, clone.TabNo, "AccessLevel", clone.AccessLevel);
|
||||
Env.setContext(Ctx, windowNo, clone.TabNo, "AD_Table_ID", String.valueOf(clone.AD_Table_ID));
|
||||
Env.setContext(Ctx, windowNo, clone.TabNo, GridTab.CTX_AccessLevel, clone.AccessLevel);
|
||||
Env.setContext(Ctx, windowNo, clone.TabNo, GridTab.CTX_AD_Table_ID, String.valueOf(clone.AD_Table_ID));
|
||||
|
||||
//
|
||||
clone.IsSortTab = IsSortTab;
|
||||
|
|
|
@ -137,9 +137,6 @@ public class GridWindow implements Serializable
|
|||
if (mTabVO != null)
|
||||
{
|
||||
GridTab mTab = new GridTab(mTabVO);
|
||||
Env.setContext(mTabVO.ctx, mTabVO.WindowNo, mTabVO.TabNo,
|
||||
"KeyColumnName", mTab.getKeyColumnName());
|
||||
|
||||
m_tabs.add(mTab);
|
||||
}
|
||||
} // for all tabs
|
||||
|
|
|
@ -641,7 +641,7 @@ public final class APanel extends CPanel
|
|||
// MTab
|
||||
if (tab == 0) mWindow.initTab(0);
|
||||
GridTab gTab = mWindow.getTab(tab);
|
||||
Env.setContext(m_ctx, m_curWindowNo, tab, "TabLevel", Integer.toString(gTab.getTabLevel()));
|
||||
Env.setContext(m_ctx, m_curWindowNo, tab, GridTab.CTX_TabLevel, Integer.toString(gTab.getTabLevel()));
|
||||
// Query first tab
|
||||
if (tab == 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue