Backed out changeset a596f28e6b06

This commit is contained in:
Carlos Ruiz 2015-01-14 10:07:31 -05:00
parent 6652d787b8
commit 8cac1b86f5
17 changed files with 78 additions and 450 deletions

View File

@ -1,33 +0,0 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Sep 17, 2014 11:44:24 AM ICT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,FKConstraintName,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES (0,'N',0,211766,'N','N','N',0,'N',10,'N','N','N','Y','d32e78d0-660c-4e82-9797-52a00ce3042f','N','AD_InfoWindow_ID','Info and search/select Window','The Info window is used to search and select records as well as display information relevant to the selection.','Info Window','Y',TO_DATE('2014-09-17 11:44:23','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2014-09-17 11:44:23','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N','ad_infowindow_preference','N',3068,19,195)
;
-- Sep 17, 2014 11:44:56 AM ICT
UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_DATE('2014-09-17 11:44:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211766
;
-- Sep 17, 2014 11:47:56 AM ICT
ALTER TABLE AD_Preference ADD AD_InfoWindow_ID NUMBER(10) DEFAULT NULL
;
-- Sep 17, 2014 11:47:57 AM ICT
ALTER TABLE AD_Preference ADD CONSTRAINT ad_infowindow_preference FOREIGN KEY (AD_InfoWindow_ID) REFERENCES ad_infowindow(ad_infowindow_id) DEFERRABLE INITIALLY DEFERRED
;
-- Sep 17, 2014 11:48:37 AM ICT
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,IsActive,Updated,UpdatedBy,AD_TableIndex_ID,SeqNo,AD_Column_ID,EntityType) VALUES (0,0,201253,'c07256ab-8778-4487-978a-d9aa59ef165f',TO_DATE('2014-09-17 11:48:36','YYYY-MM-DD HH24:MI:SS'),100,'Y',TO_DATE('2014-09-17 11:48:36','YYYY-MM-DD HH24:MI:SS'),100,200141,0,211766,'D')
;
-- Sep 17, 2014 11:48:56 AM ICT
DROP INDEX ad_preference_attribute
;
-- Sep 17, 2014 11:48:56 AM ICT
CREATE UNIQUE INDEX ad_preference_attribute ON AD_Preference (PreferenceFor,AD_InfoWindow_ID,AD_Process_ID,AD_Client_ID,AD_Org_ID,AD_Window_ID,AD_User_ID,Attribute)
;
SELECT register_migration_script('201417091982-IDEMPIERE-1969.sql') FROM dual
;

View File

@ -1,30 +0,0 @@
-- Sep 17, 2014 11:44:24 AM ICT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,FKConstraintName,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES (0,'N',0,211766,'N','N','N',0,'N',10,'N','N','N','Y','d32e78d0-660c-4e82-9797-52a00ce3042f','N','AD_InfoWindow_ID','Info and search/select Window','The Info window is used to search and select records as well as display information relevant to the selection.','Info Window','Y',TO_TIMESTAMP('2014-09-17 11:44:23','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2014-09-17 11:44:23','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N','ad_infowindow_preference','N',3068,19,195)
;
-- Sep 17, 2014 11:44:56 AM ICT
UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_TIMESTAMP('2014-09-17 11:44:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211766
;
-- Sep 17, 2014 11:47:56 AM ICT
ALTER TABLE AD_Preference ADD COLUMN AD_InfoWindow_ID NUMERIC(10) DEFAULT NULL
;
-- Sep 17, 2014 11:47:57 AM ICT
ALTER TABLE AD_Preference ADD CONSTRAINT ad_infowindow_preference FOREIGN KEY (AD_InfoWindow_ID) REFERENCES ad_infowindow(ad_infowindow_id) DEFERRABLE INITIALLY DEFERRED
;
-- Sep 17, 2014 11:48:37 AM ICT
INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,IsActive,Updated,UpdatedBy,AD_TableIndex_ID,SeqNo,AD_Column_ID,EntityType) VALUES (0,0,201253,'c07256ab-8778-4487-978a-d9aa59ef165f',TO_TIMESTAMP('2014-09-17 11:48:36','YYYY-MM-DD HH24:MI:SS'),100,'Y',TO_TIMESTAMP('2014-09-17 11:48:36','YYYY-MM-DD HH24:MI:SS'),100,200141,0,211766,'D')
;
-- Sep 17, 2014 11:48:56 AM ICT
DROP INDEX ad_preference_attribute
;
-- Sep 17, 2014 11:48:56 AM ICT
CREATE UNIQUE INDEX ad_preference_attribute ON AD_Preference (PreferenceFor,AD_InfoWindow_ID,AD_Process_ID,AD_Client_ID,AD_Org_ID,AD_Window_ID,AD_User_ID,Attribute)
;
SELECT register_migration_script('201417091982-IDEMPIERE-1969.sql') FROM dual
;

View File

@ -81,7 +81,7 @@ public class GridField
/**
*
*/
private static final long serialVersionUID = 8596059010377209016L;
private static final long serialVersionUID = -757531553169088955L;
/**
* Field Constructor.
@ -660,51 +660,12 @@ public class GridField
} // Default value
if (getAD_Process_ID_Of_Panel() > 0){
defStr = Env.getPreference (m_vo.ctx, getAD_Window_ID_Of_Panel(), getAD_Infowindow_ID(), getAD_Process_ID_Of_Panel(), m_vo.ColumnName);
// when have no preference set for field, and field lie in process dialog call from infoWindow
if (defStr.equals("") && getAD_Infowindow_ID() > 0){
// try get preference for current infoWindow but all process
defStr = Env.getPreference (m_vo.ctx, Env.adWindowDummyID, getAD_Infowindow_ID(), 0, m_vo.ColumnName);
if (defStr.equals("")){
// try get preference for current process but all infoWindow
defStr = Env.getPreference (m_vo.ctx, Env.adWindowDummyID, 0, getAD_Process_ID_Of_Panel(), m_vo.ColumnName);
}
if (defStr.equals("")){
// try get preference for all infoWindow and all process
defStr = Env.getPreference (m_vo.ctx, Env.adWindowDummyID, 0, 0, m_vo.ColumnName);
}
}
if (defStr.equals("")){
// try get preference apply for all process and current window
defStr = Env.getPreference (m_vo.ctx, getAD_Window_ID_Of_Panel(), 0, 0, m_vo.ColumnName);
}
if (defStr.equals("")){
// try get preference apply for all window and this process
defStr = Env.getPreference (m_vo.ctx, 0, 0, getAD_Process_ID_Of_Panel(), m_vo.ColumnName);
}
if (defStr.equals("")){
// try get preference apply for all process and all window
defStr = Env.getPreference (m_vo.ctx, 0, 0, 0, m_vo.ColumnName);
}
if (!defStr.equals("")){
defStr = Env.getPreference (m_vo.ctx, getAD_Window_ID_Of_Panel(), getAD_Process_ID_Of_Panel(), m_vo.ColumnName);
if (!defStr.equals(""))
{
if (log.isLoggable(Level.FINE)) log.fine("[Process Parameter Preference] " + m_vo.ColumnName + "=" + defStr);
return createDefault(defStr);
}
// <- End of suggested changes
} else if (getAD_Infowindow_ID() > 0){
defStr = Env.getPreference (m_vo.ctx, getAD_Window_ID_Of_Panel(), getAD_Infowindow_ID(), m_vo.ColumnName);
if (!defStr.equals(""))
{
if (log.isLoggable(Level.FINE)) log.fine("[Process Parameter Preference] " + m_vo.ColumnName + "=" + defStr);
return createDefault(defStr);
}
} else {
/**
* (d) Preference (user) - P|
@ -1119,10 +1080,6 @@ public class GridField
return m_vo.AD_Window_ID_Of_Panel > 0 ? m_vo.AD_Window_ID_Of_Panel : m_vo.AD_Window_ID;
}
public int getAD_Infowindow_ID(){
return m_vo.AD_Infowindow_ID;
}
/** get AD_Chart_ID
* @return chart id
*/

View File

@ -47,7 +47,7 @@ public class GridFieldVO implements Serializable
/**
*
*/
private static final long serialVersionUID = -7001013190366328211L;
private static final long serialVersionUID = 4367399601545064219L;
/**
* Return the SQL statement used for the MFieldVO.create
@ -318,7 +318,7 @@ public class GridFieldVO implements Serializable
* @param rs result set AD_Process_Para
* @return MFieldVO
*/
public static GridFieldVO createParameter (Properties ctx, int WindowNo, int ProcessIDOfPanel, int WindowIDOfPanel, int adInfoPaneId, ResultSet rs)
public static GridFieldVO createParameter (Properties ctx, int WindowNo, int ProcessIDOfPanel, int WindowIDOfPanel, ResultSet rs)
{
GridFieldVO vo = new GridFieldVO (ctx, WindowNo, 0, 0, 0, false);
vo.isProcess = true;
@ -327,8 +327,7 @@ public class GridFieldVO implements Serializable
vo.IsUpdateable = true;
vo.AD_Process_ID_Of_Panel = ProcessIDOfPanel;
vo.AD_Window_ID_Of_Panel = WindowIDOfPanel;
vo.AD_Infowindow_ID = adInfoPaneId;
try
{
vo.AD_Table_ID = 0;
@ -412,20 +411,7 @@ public class GridFieldVO implements Serializable
return voT;
} // createParameter
/**
* Create parameter for infoWindow
* @param ctx
* @param WindowNo
* @param AD_Column_ID
* @param ColumnName
* @param Name
* @param AD_Reference_ID
* @param AD_Reference_Value_ID
* @param IsMandatory
* @param IsEncrypted
* @return
*/
public static GridFieldVO createParameter (Properties ctx, int WindowNo, int WindowIDOfPanel, int infoWindowID,
public static GridFieldVO createParameter (Properties ctx, int WindowNo,
int AD_Column_ID, String ColumnName, String Name, int AD_Reference_ID, int AD_Reference_Value_ID,
boolean IsMandatory, boolean IsEncrypted)
{
@ -442,8 +428,6 @@ public class GridFieldVO implements Serializable
vo.AD_Reference_Value_ID = AD_Reference_Value_ID;
vo.IsMandatory = IsMandatory;
vo.IsEncryptedField= IsEncrypted;
vo.AD_Infowindow_ID = infoWindowID;
vo.AD_Window_ID_Of_Panel = WindowIDOfPanel;
//
vo.initFinish();
return vo;
@ -515,14 +499,7 @@ public class GridFieldVO implements Serializable
* it's difference with AD_Process_ID
*/
public int AD_Process_ID_Of_Panel;
/**
* ad_window_id of window show process dialog or infoWindow dialog
*/
public int AD_Window_ID_Of_Panel;
/**
* AD_Infowindow_ID call process. user in case from info window call process.
*/
public int AD_Infowindow_ID;
/** AD_Tab_ID */
public int AD_Tab_ID;
/** Is the Tab Read Only */
@ -794,7 +771,6 @@ public class GridFieldVO implements Serializable
clone.DefaultValue2 = DefaultValue2;
clone.AD_Process_ID_Of_Panel = AD_Process_ID_Of_Panel;
clone.AD_Window_ID_Of_Panel = AD_Window_ID_Of_Panel;
clone.AD_Infowindow_ID = AD_Infowindow_ID;
return clone;
} // clone

View File

@ -49,21 +49,6 @@ public interface I_AD_Preference
*/
public int getAD_Client_ID();
/** Column name AD_InfoWindow_ID */
public static final String COLUMNNAME_AD_InfoWindow_ID = "AD_InfoWindow_ID";
/** Set Info Window.
* Info and search/select Window
*/
public void setAD_InfoWindow_ID (int AD_InfoWindow_ID);
/** Get Info Window.
* Info and search/select Window
*/
public int getAD_InfoWindow_ID();
public org.compiere.model.I_AD_InfoWindow getAD_InfoWindow() throws RuntimeException;
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";

View File

@ -74,34 +74,6 @@ public class X_AD_Preference extends PO implements I_AD_Preference, I_Persistent
return sb.toString();
}
public org.compiere.model.I_AD_InfoWindow getAD_InfoWindow() throws RuntimeException
{
return (org.compiere.model.I_AD_InfoWindow)MTable.get(getCtx(), org.compiere.model.I_AD_InfoWindow.Table_Name)
.getPO(getAD_InfoWindow_ID(), get_TrxName()); }
/** Set Info Window.
@param AD_InfoWindow_ID
Info and search/select Window
*/
public void setAD_InfoWindow_ID (int AD_InfoWindow_ID)
{
if (AD_InfoWindow_ID < 1)
set_Value (COLUMNNAME_AD_InfoWindow_ID, null);
else
set_Value (COLUMNNAME_AD_InfoWindow_ID, Integer.valueOf(AD_InfoWindow_ID));
}
/** Get Info Window.
@return Info and search/select Window
*/
public int getAD_InfoWindow_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_InfoWindow_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Preference.
@param AD_Preference_ID
Personal Value Preference

View File

@ -43,7 +43,7 @@ public class ProcessInfo implements Serializable
/**
*
*/
private static final long serialVersionUID = -1084726411940456050L;
private static final long serialVersionUID = -3654748247858779823L;
/**
* Constructor
@ -94,7 +94,6 @@ public class ProcessInfo implements Serializable
/** Process Instance ID */
private int m_AD_PInstance_ID = 0;
private int m_InfoWindowID = 0;
/** Summary of Execution */
private String m_Summary = "";
/** Execution had an error */
@ -344,23 +343,6 @@ public class ProcessInfo implements Serializable
m_AD_PInstance_ID = AD_PInstance_ID;
}
/**
*
* @return int
*/
public int getAD_InfoWindow_ID()
{
return m_InfoWindowID;
}
/**
*
* @param AD_PInstance_ID int
*/
public void setAD_InfoWindow_ID(int infoWindowID)
{
m_InfoWindowID = infoWindowID;
}
/**
* Method getAD_Process_ID
* @return int

View File

@ -96,8 +96,6 @@ public final class Env
private static List<IEnvEventListener> eventListeners = new ArrayList<IEnvEventListener>();
public static int adWindowDummyID =200054;
/** Logger */
private static CLogger log = CLogger.getCLogger(Env.class);
@ -962,41 +960,13 @@ public final class Env
return (retValue == null ? "" : retValue);
} // getPreference
/**
* get preference of process from env
* @param ctx
* @param AD_Window_ID
* @param AD_InfoWindow
* @param AD_Process_ID_Of_Panel
* @param context
* @return
*/
public static String getPreference (Properties ctx, int AD_Window_ID, int AD_InfoWindow, int AD_Process_ID_Of_Panel, String context)
public static String getPreference (Properties ctx, int AD_Window_ID, int AD_Process_ID_Of_Panel, String context)
{
if (ctx == null || context == null)
throw new IllegalArgumentException ("Require Context");
String retValue = null;
retValue = ctx.getProperty("P"+AD_Window_ID+"|"+ AD_InfoWindow + "|" + AD_Process_ID_Of_Panel + "|" + context);
return (retValue == null ? "" : retValue);
} // getPreference
/**
* get preference of info window from env
* @param ctx
* @param AD_Window_ID
* @param AD_InfoWindow
* @param context
* @return
*/
public static String getPreference (Properties ctx, int AD_Window_ID, int AD_InfoWindow, String context)
{
if (ctx == null || context == null)
throw new IllegalArgumentException ("Require Context");
String retValue = null;
retValue = ctx.getProperty("P"+AD_Window_ID+"|"+ AD_InfoWindow + "|" + context);
retValue = ctx.getProperty("P"+AD_Window_ID+"|"+ AD_Process_ID_Of_Panel + "|" + context);
return (retValue == null ? "" : retValue);
} // getPreference

View File

@ -928,7 +928,7 @@ public class Login
// This reads all relevant window neutral defaults
// overwriting superseeded ones. Window specific is read in Mainain
sql = "SELECT Attribute, Value, AD_Window_ID, AD_Process_ID, AD_InfoWindow_ID, PreferenceFor "
sql = "SELECT Attribute, Value, AD_Window_ID, AD_Process_ID, PreferenceFor "
+ "FROM AD_Preference "
+ "WHERE AD_Client_ID IN (0, @#AD_Client_ID@)"
+ " AND AD_Org_ID IN (0, @#AD_Org_ID@)"
@ -948,8 +948,7 @@ public class Login
int AD_Window_ID = rs.getInt(3);
boolean isAllWindow = rs.wasNull();
int AD_Process_ID = rs.getInt(4);
int AD_InfoWindow_ID = rs.getInt(5);
String PreferenceFor = rs.getString(6);
String PreferenceFor = rs.getString(5);
String at = "";
// preference for window
@ -959,10 +958,8 @@ public class Login
else
at = "P" + AD_Window_ID + "|" + rs.getString(1);
}else if ("P".equals(PreferenceFor)){ // preference for processs
// when apply for all window or all process format is "P0|0|m_Attribute;
at = "P" + AD_Window_ID + "|" + AD_InfoWindow_ID + "|" + AD_Process_ID + "|" + rs.getString(1);
}else if ("I".equals(PreferenceFor)){ // preference for infoWindow
at = "P" + AD_Window_ID + "|" + AD_InfoWindow_ID + "|" + rs.getString(1);
// when apply for all window or all process format is "P0|0|m_Attribute;
at = "P" + AD_Window_ID + "|" + AD_Process_ID + "|" + rs.getString(1);
}
String va = rs.getString(2);

View File

@ -296,7 +296,7 @@ public class ProcessParameter extends CDialog
private void createField (ResultSet rs)
{
// Create Field
GridFieldVO voF = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, m_processInfo.getAD_Process_ID(), m_AD_Window_ID, 0, rs);
GridFieldVO voF = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, m_processInfo.getAD_Process_ID(), m_AD_Window_ID, rs);
GridField mField = new GridField (voF);
m_mFields.add(mField); // add to Fields

View File

@ -63,8 +63,7 @@ import org.compiere.util.Msg;
* @version 2006-12-01
*/
public class ProcessParameterPanel extends CPanel implements VetoableChangeListener, IProcessParameter {
/**
/**
*
*/
private static final long serialVersionUID = -8583999032745045111L;
@ -287,7 +286,7 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe
private void createField (ResultSet rs)
{
// Create Field
GridFieldVO voF = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, m_processInfo.getAD_Process_ID(), m_AD_Window_ID, m_processInfo.getAD_InfoWindow_ID(),rs);
GridFieldVO voF = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, m_processInfo.getAD_Process_ID(), m_AD_Window_ID, rs);
GridField mField = new GridField (voF);
m_mFields.add(mField); // add to Fields

View File

@ -42,7 +42,6 @@ import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Login;
import org.compiere.util.Msg;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Page;
@ -122,7 +121,7 @@ public class ValuePreference extends Window implements EventListener<Event>
// Create Editor
@SuppressWarnings("unused")
ValuePreference vp = new ValuePreference (WindowNo,
AD_Client_ID, AD_Org_ID, AD_User_ID, AD_Window_ID, mField.getAD_Process_ID_Of_Panel(), mField.getAD_Infowindow_ID(),
AD_Client_ID, AD_Org_ID, AD_User_ID, AD_Window_ID, mField.getAD_Process_ID_Of_Panel(),
Attribute, DisplayAttribute, Value, DisplayValue,
displayType, AD_Reference_ID, ref);
} // create
@ -184,7 +183,7 @@ public class ValuePreference extends Window implements EventListener<Event>
* @param ref
*/
public ValuePreference (int WindowNo,
int AD_Client_ID, int AD_Org_ID, int AD_User_ID, int AD_Window_ID, int AD_Process_ID_Of_Panel, int AD_Infowindow_ID,
int AD_Client_ID, int AD_Org_ID, int AD_User_ID, int AD_Window_ID, int AD_Process_ID_Of_Panel,
String Attribute, String DisplayAttribute, String Value, String DisplayValue,
int displayType, int AD_Reference_ID, Component ref)
{
@ -208,13 +207,8 @@ public class ValuePreference extends Window implements EventListener<Event>
m_DisplayValue = DisplayValue;
m_DisplayType = displayType;
m_AD_Process_ID_Of_Panel = AD_Process_ID_Of_Panel;
m_AD_Infowindow_ID = AD_Infowindow_ID;
//
m_role = MRole.getDefault();
if (m_AD_Infowindow_ID > 0 && m_AD_Process_ID_Of_Panel > 0)
isProcessInIW = true;
try
{
init();
@ -235,7 +229,6 @@ public class ValuePreference extends Window implements EventListener<Event>
} else {
AEnv.showCenterScreen(this);
}
} // ValuePreference
private AbstractADWindowContent findADWindowContent(Component comp) {
@ -256,7 +249,6 @@ public class ValuePreference extends Window implements EventListener<Event>
private int m_DisplayType;
private MRole m_role;
private int m_AD_Process_ID_Of_Panel;
private int m_AD_Infowindow_ID;
// Display
private Panel setPanel = new Panel();
@ -273,16 +265,10 @@ public class ValuePreference extends Window implements EventListener<Event>
private Checkbox cbUser = new Checkbox();
private Checkbox cbWindow = new Checkbox();
private Checkbox cbProcess = new Checkbox();
private Checkbox cbInfowindow = new Checkbox();
private Label lExplanation = new Label();
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
private Button bDelete;
/**
* is true when value preference for a field of process call by info window
*/
private boolean isProcessInIW = false;
/**
* Static Layout
@ -302,8 +288,6 @@ public class ValuePreference extends Window implements EventListener<Event>
cbWindow.setChecked(true);
cbProcess.setLabel(Msg.translate(m_ctx, "AD_Process_ID"));
cbProcess.setChecked(true);
cbInfowindow.setLabel(Msg.translate(m_ctx, "AD_InfoWindow_ID"));
cbInfowindow.setChecked(true);
//
setPanel.appendChild(setLayout);
setPanel.setHflex("1");
@ -350,23 +334,10 @@ public class ValuePreference extends Window implements EventListener<Event>
chlayout.appendChild(cbClient);
chlayout.appendChild(cbOrg);
chlayout.appendChild(cbUser);
if(isProcessInIW){
// in case show process in info window, don't show checkbox window in value preference dialog.
// must set is checked to save current windowID (dummy) with value preference other it will save null,
// make data conflic with case save for all window
cbWindow.setChecked(true);
}else{
chlayout.appendChild(cbWindow);
}
if(m_AD_Infowindow_ID > 0){
chlayout.appendChild(cbInfowindow);
}
chlayout.appendChild(cbWindow);
if(m_AD_Process_ID_Of_Panel > 0){
chlayout.appendChild(cbProcess);
}
row.appendCellChild(chlayout, 5);
rows.appendChild(row);
@ -431,7 +402,6 @@ public class ValuePreference extends Window implements EventListener<Event>
// Can change all/specific
cbWindow.addEventListener(Events.ON_CHECK, this);
cbProcess.addEventListener(Events.ON_CHECK, this);
cbInfowindow.addEventListener(Events.ON_CHECK, this);
// Other
confirmPanel.addComponentsLeft(confirmPanel.createButton("Delete"));
@ -503,13 +473,6 @@ public class ValuePreference extends Window implements EventListener<Event>
else
expl.append(" and all Process");
}
//
if (m_AD_Infowindow_ID > 0){
if (cbInfowindow.isChecked())
expl.append(" and this Info Window");
else
expl.append(" and all Info Window");
}
//
if (Env.getLanguage(Env.getCtx()).isBaseLanguage())
@ -538,33 +501,17 @@ public class ValuePreference extends Window implements EventListener<Event>
else
sql.append(" AND AD_Window_ID IS NULL");
// set where for Process
if (m_AD_Process_ID_Of_Panel > 0 && cbProcess.isChecked()){
// case set for a process
sql.append(" AND AD_Process_ID=").append(m_AD_Process_ID_Of_Panel);
}else{
// case set for a all process or non set for process (set for window or infowindow)
sql.append(" AND AD_Process_ID IS NULL");
}
// set where for infoWindow
if (m_AD_Infowindow_ID > 0 && cbInfowindow.isChecked()){
// case set for a info window
sql.append(" AND AD_InfoWindow_ID=").append(m_AD_Infowindow_ID);
}else{
// case set for a all process or non set for process (set for window or infowindow)
sql.append(" AND AD_InfoWindow_ID IS NULL");
}
if (m_AD_Process_ID_Of_Panel > 0){
// in case Preference for process, set PreferenceFor = P
// preference for process parameter
sql.append(" AND PreferenceFor = 'P'");
}else if (m_AD_Infowindow_ID > 0){
// in case Preference for info window, set PreferenceFor = I
sql.append(" AND PreferenceFor = 'I'");
}else {
// in case Preference for window, set PreferenceFor = W
if (cbProcess.isChecked())
sql.append(" AND AD_Process_ID=").append(m_AD_Process_ID_Of_Panel);
else
sql.append(" AND AD_Process_ID IS NULL");
}else{
// preference for process window
sql.append(" AND PreferenceFor = 'W'");
sql.append(" AND AD_Process_ID IS NULL");
}
sql.append(" AND Attribute='").append(m_Attribute).append("'");
@ -578,44 +525,21 @@ public class ValuePreference extends Window implements EventListener<Event>
/**
* Get Context Key
* preferences in context update follow key.
* they load when login, and update when change.
* @see Login#loadPreferences(org.compiere.util.KeyNamePair, org.compiere.util.KeyNamePair, java.sql.Timestamp, String)
* and set to field when display field, {@link GridField#getDefault()}
* @return Context Key
*/
private String getContextKey()
{
// add window id info in case have process or field in info window parameter
StringBuilder preferencesContextKey = new StringBuilder ("P") ;
if (m_AD_Window_ID > 0){
preferencesContextKey.append(m_AD_Window_ID);
}else{
preferencesContextKey.append("0");
}
// add info window info in case have process or field in info window parameter
if (cbInfowindow.isChecked()){
preferencesContextKey.append("|").append(m_AD_Infowindow_ID);
}else{
preferencesContextKey.append("|0");
}
if (m_AD_Process_ID_Of_Panel > 0){
// add info process info and field info in case have process
if (cbProcess.isChecked())
return preferencesContextKey.append("|").append(m_AD_Process_ID_Of_Panel).append("|").append(m_Attribute).toString();
return "P" + m_AD_Window_ID + "|" + m_AD_Process_ID_Of_Panel + "|" + m_Attribute;
else{
return preferencesContextKey.append("|0|").append(m_Attribute).toString();
return "P" + m_AD_Window_ID + "|0|" + m_Attribute;
}
}else if (m_AD_Infowindow_ID > 0){
// add field info in case lie in info window parameter
return preferencesContextKey.append("|").append(m_Attribute).toString();
}else{
// key in case lie in standard window
if (cbWindow.isChecked())
return "P" + m_AD_Window_ID + "|" + m_Attribute;
else
return "P|" + m_Attribute;
if (cbWindow.isChecked())
return "P" + m_AD_Window_ID + "|" + m_Attribute;
else
return "P|" + m_Attribute;
}
} // getContextKey
@ -651,7 +575,7 @@ public class ValuePreference extends Window implements EventListener<Event>
//
StringBuilder sql = new StringBuilder ("INSERT INTO AD_Preference ("
+ "AD_Preference_ID, AD_Preference_UU, AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy,Updated,UpdatedBy,"
+ "AD_Window_ID, AD_Process_ID, AD_InfoWindow_ID, PreferenceFor, AD_User_ID, Attribute, Value) VALUES (");
+ "AD_Window_ID, AD_Process_ID, PreferenceFor, AD_User_ID, Attribute, Value) VALUES (");
sql.append(AD_Preference_ID).append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(",").append(Client_ID).append(",").append(Org_ID)
.append(", 'Y',SysDate,").append(m_AD_User_ID).append(",SysDate,").append(m_AD_User_ID).append(", ");
@ -661,30 +585,18 @@ public class ValuePreference extends Window implements EventListener<Event>
sql.append("NULL,") ;
// set value for AD_Process_ID and PreferenceFor
if(m_AD_Process_ID_Of_Panel > 0 && cbProcess.isChecked()){
sql.append(m_AD_Process_ID_Of_Panel).append(",");
if(m_AD_Process_ID_Of_Panel > 0){
if (cbProcess.isChecked()){
sql.append(m_AD_Process_ID_Of_Panel).append(",");
}else{
sql.append("NULL,");
}
// in case Preference for process, set PreferenceFor = P
sql.append("'P',");
}else{
// in case Preference for window, AD_Process_ID always null
sql.append("NULL,");
}
// set info window id
if (m_AD_Infowindow_ID > 0 && cbInfowindow.isChecked()){
sql.append(m_AD_Infowindow_ID).append(",");
}else {
sql.append("NULL,");
}
if (m_AD_Process_ID_Of_Panel > 0){
// in case Preference for process, set PreferenceFor = P
sql.append("'P',");
}else if (m_AD_Infowindow_ID > 0){
// in case Preference for info window, set PreferenceFor = I
sql.append("'I',");
}else {
// in case Preference for window, set PreferenceFor = W
// in case Preference for window, set PreferenceFor = P
sql.append("'W',");
}

View File

@ -34,10 +34,8 @@ import java.util.logging.Level;
import javax.servlet.ServletRequest;
import org.adempiere.webui.adwindow.ADWindow;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.desktop.IDesktop;
import org.adempiere.webui.info.InfoWindow;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.IServerPushCallback;
@ -84,7 +82,7 @@ import com.lowagie.text.pdf.PdfWriter;
public final class AEnv
{
public static final String LOCALE = "#Locale";
/**
* Show in the center of the screen.
* (pack, set location and set visibility)
@ -762,29 +760,4 @@ public final class AEnv
IDesktop appDesktop = SessionManager.getAppDesktop();
return appDesktop != null ? appDesktop.getClientInfo().tablet : false;
}
/**
* Get adWindowId below gridField
* when field lie in window, it's id of this window
* when field lie in process parameter dialog it's ad_window_id of window open this process
* when field lie in process parameter open in a standalone window (run process from menu) return id of dummy window
* @param mField
* @return
*/
public static int getADWindowID (int windowNo){
int adWindowID = 0;
// form process parameter panel
Object window = SessionManager.getAppDesktop().findWindow(windowNo);
// case show a process dialog, window is below window of process dialog
if (window != null && window instanceof ADWindow){
adWindowID = ((ADWindow)window).getAD_Window_ID();
}else if (window != null && (window instanceof ProcessDialog || window instanceof InfoWindow)){
// dummy window is use in case process or infoWindow open in stand-alone window
// it help we separate case save preference for all window (windowId = 0, null) and case open in stand-alone (windowId = 200054)
adWindowID = Env.adWindowDummyID;// dummy window
}
return adWindowID;
}
} // AEnv

View File

@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import org.adempiere.webui.adwindow.ADWindow;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.Columns;
import org.adempiere.webui.component.EditorBox;
@ -105,13 +106,35 @@ public class ProcessParameterPanel extends Panel implements
//
m_WindowNo = WindowNo;
m_processInfo = pi;
m_AD_Window_ID = AEnv.getADWindowID (WindowNo);
m_AD_Window_ID = getADWindowID (WindowNo);
this.width = width;
this.m_InfoWindowID = pi.getAD_InfoWindow_ID();
//
initComponent();
addEventListener("onDynamicDisplay", this);
} // ProcessParameterPanel
/**
* Get adWindowId below gridField
* when field lie in window, it's id of this window
* when field lie in process parameter dialog it's ad_window_id of window open this process
* when field lie in process parameter open in a standalone window (run process from menu) return id of dummy window
* @param mField
* @return
*/
public static int getADWindowID (int windowNo){
int adWindowID = 0;
// form process parameter panel
Object window = SessionManager.getAppDesktop().findWindow(windowNo);
// case show a process dialog, window is below window of process dialog
if (window != null && window instanceof ADWindow){
adWindowID = ((ADWindow)window).getAD_Window_ID();
}else if (window != null && window instanceof ProcessDialog){
adWindowID = 200054;// dummy window
}
return adWindowID;
}
private void initComponent() {
centerPanel = GridFactory.newGridLayout();
@ -133,8 +156,6 @@ public class ProcessParameterPanel extends Panel implements
private ProcessInfo m_processInfo;
// AD_Window of window below this dialog in case show parameter dialog panel
private int m_AD_Window_ID = 0;
// infoWindowID of infoWindow below this dialog in case call process from infoWindow
private int m_InfoWindowID = 0;
/** Logger */
private static CLogger log = CLogger
.getCLogger(ProcessParameterPanel.class);
@ -286,7 +307,7 @@ public class ProcessParameterPanel extends Panel implements
*/
private void createField(ResultSet rs, Rows rows) {
// Create Field
GridFieldVO voF = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, m_processInfo.getAD_Process_ID(), m_AD_Window_ID, m_InfoWindowID,
GridFieldVO voF = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, m_processInfo.getAD_Process_ID(), m_AD_Window_ID,
rs);
GridField mField = new GridField(voF);
m_mFields.add(mField); // add to Fields

View File

@ -32,7 +32,6 @@ import org.adempiere.webui.component.EditorBox;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.NumberBox;
import org.adempiere.webui.component.Paymentbox;
import org.adempiere.webui.event.ContextMenuListener;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.theme.ThemeManager;
@ -54,7 +53,6 @@ import org.zkoss.zul.Image;
import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.impl.InputElement;
import org.zkoss.zul.impl.XulElement;
/**
*
@ -96,53 +94,11 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
private boolean isProcessParameter;
/**
* call to show context menu of this field.
* must call after append component of this field to parent
*/
public void showMenu() {
if (popupMenu == null)
return;
// handle standard menu item (log, preference) reply to data type of this field.
if (ContextMenuListener.class.isInstance(this))
popupMenu.addMenuListener((ContextMenuListener)this);
//popupMenu.setId(mField.getColumnName()+"-popup");
this.component.getParent().appendChild(popupMenu);
// when field have label, add action zoom when click to label, and show menu when right click to label
if (!gridField.isFieldOnly())
{
if (popupMenu.isZoomEnabled() && this instanceof IZoomableEditor)
{
// add action zoom when click to label
label.addEventListener(Events.ON_CLICK, new EventListener<Event> (){
public void onEvent(Event event) throws Exception {
if (Events.ON_CLICK.equals(event.getName())) {
((IZoomableEditor)WEditor.this).actionZoom();
}
}
});
}
// show menu when right click to label
popupMenu.addContextElement(label);
if (component instanceof XulElement)
{
popupMenu.addContextElement((XulElement) component);
}
}
}
public WEditor(Component comp, GridField gridField) {
this(comp, gridField, -1);
}
/**
/**
*
* @param comp
* @param gridField

View File

@ -18,7 +18,6 @@ import org.adempiere.model.IInfoColumn;
import org.adempiere.model.MInfoProcess;
import org.adempiere.model.MInfoRelated;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Borderlayout;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Column;
@ -476,7 +475,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
String columnName = infoColumn.getColumnName();
/*!m_lookup && infoColumn.isMandatory():apply Mandatory only case open as window and only for criteria field*/
boolean isMandatory = !m_lookup && infoColumn.isMandatory() && infoColumn.isQueryCriteria();
GridFieldVO vo = GridFieldVO.createParameter(infoContext, p_WindowNo, AEnv.getADWindowID(p_WindowNo), infoWindow.getAD_InfoWindow_ID(), 0,
GridFieldVO vo = GridFieldVO.createParameter(infoContext, p_WindowNo, 0,
columnName, infoColumn.get_Translation("Name"), infoColumn.getAD_Reference_ID(),
infoColumn.getAD_Reference_Value_ID(), isMandatory, false);
if (infoColumn.getAD_Val_Rule_ID() > 0) {
@ -1222,9 +1221,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
addSearchParameter(label, fieldEditor);
editors.add(editor);
editor.showMenu();
if (infoColumn.isIdentifier()) {
identifiers.add(editor);
}
@ -1233,9 +1229,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
mField.addPropertyChangeListener(editor);
if (!Util.isEmpty(mField.getVO().DefaultValue, true)) {
if (! Util.isEmpty(mField.getVO().DefaultValue, true)) {
// set default value
mField.setValue(mField.getDefault(), true);
mField.setValue(mField.getDefault(), true);
}
} // addSelectionColumn
@ -1276,11 +1272,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} else {
panel.appendChild(new Space());
}
// add out parent to add menu for this field, without outerDiv, a new cell will auto make for menu.
Div outerParent = new Div();
outerParent.appendChild(fieldEditor);
panel.appendChild(outerParent);
panel.appendChild(fieldEditor);
}
protected void createAndCheckbox() {
@ -1751,7 +1743,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
*/
protected GridField getGridField(MInfoColumn infoColumn){
String columnName = infoColumn.getColumnName();
GridFieldVO vo = GridFieldVO.createParameter(infoContext, p_WindowNo, AEnv.getADWindowID(p_WindowNo), AD_InfoWindow_ID, 0,
GridFieldVO vo = GridFieldVO.createParameter(infoContext, p_WindowNo, 0,
columnName, infoColumn.get_Translation("Name"), infoColumn.getAD_Reference_ID(),
infoColumn.getAD_Reference_Value_ID(), false, false);
if (infoColumn.getAD_Val_Rule_ID() > 0) {

View File

@ -1531,7 +1531,6 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
final int pInstanceID = instance.getAD_PInstance_ID();
// Execute Process
m_pi.setAD_PInstance_ID(pInstanceID);
m_pi.setAD_InfoWindow_ID(infoWindow.getAD_InfoWindow_ID());
//HengSin - to let process end with message and requery
WProcessCtl.process(p_WindowNo, m_pi, (Trx)null, new EventListener<Event>() {