IDEMPIERE-1969:Contextual Menu for Info Window Parameters
meged all patch to one
This commit is contained in:
parent
bf81fe07a4
commit
cf32e66554
|
@ -0,0 +1,33 @@
|
||||||
|
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
|
||||||
|
;
|
|
@ -0,0 +1,30 @@
|
||||||
|
-- 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
|
||||||
|
;
|
|
@ -81,7 +81,7 @@ public class GridField
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -757531553169088955L;
|
private static final long serialVersionUID = 8596059010377209016L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Field Constructor.
|
* Field Constructor.
|
||||||
|
@ -660,12 +660,51 @@ public class GridField
|
||||||
} // Default value
|
} // Default value
|
||||||
|
|
||||||
if (getAD_Process_ID_Of_Panel() > 0){
|
if (getAD_Process_ID_Of_Panel() > 0){
|
||||||
defStr = Env.getPreference (m_vo.ctx, getAD_Window_ID_Of_Panel(), getAD_Process_ID_Of_Panel(), m_vo.ColumnName);
|
defStr = Env.getPreference (m_vo.ctx, getAD_Window_ID_Of_Panel(), getAD_Infowindow_ID(), getAD_Process_ID_Of_Panel(), m_vo.ColumnName);
|
||||||
if (!defStr.equals(""))
|
|
||||||
{
|
// 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("")){
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("[Process Parameter Preference] " + m_vo.ColumnName + "=" + defStr);
|
if (log.isLoggable(Level.FINE)) log.fine("[Process Parameter Preference] " + m_vo.ColumnName + "=" + defStr);
|
||||||
return createDefault(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 {
|
} else {
|
||||||
/**
|
/**
|
||||||
* (d) Preference (user) - P|
|
* (d) Preference (user) - P|
|
||||||
|
@ -1080,6 +1119,10 @@ public class GridField
|
||||||
return m_vo.AD_Window_ID_Of_Panel > 0 ? m_vo.AD_Window_ID_Of_Panel : m_vo.AD_Window_ID;
|
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
|
/** get AD_Chart_ID
|
||||||
* @return chart id
|
* @return chart id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class GridFieldVO implements Serializable
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 4367399601545064219L;
|
private static final long serialVersionUID = -7001013190366328211L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the SQL statement used for the MFieldVO.create
|
* 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
|
* @param rs result set AD_Process_Para
|
||||||
* @return MFieldVO
|
* @return MFieldVO
|
||||||
*/
|
*/
|
||||||
public static GridFieldVO createParameter (Properties ctx, int WindowNo, int ProcessIDOfPanel, int WindowIDOfPanel, ResultSet rs)
|
public static GridFieldVO createParameter (Properties ctx, int WindowNo, int ProcessIDOfPanel, int WindowIDOfPanel, int adInfoPaneId, ResultSet rs)
|
||||||
{
|
{
|
||||||
GridFieldVO vo = new GridFieldVO (ctx, WindowNo, 0, 0, 0, false);
|
GridFieldVO vo = new GridFieldVO (ctx, WindowNo, 0, 0, 0, false);
|
||||||
vo.isProcess = true;
|
vo.isProcess = true;
|
||||||
|
@ -327,6 +327,7 @@ public class GridFieldVO implements Serializable
|
||||||
vo.IsUpdateable = true;
|
vo.IsUpdateable = true;
|
||||||
vo.AD_Process_ID_Of_Panel = ProcessIDOfPanel;
|
vo.AD_Process_ID_Of_Panel = ProcessIDOfPanel;
|
||||||
vo.AD_Window_ID_Of_Panel = WindowIDOfPanel;
|
vo.AD_Window_ID_Of_Panel = WindowIDOfPanel;
|
||||||
|
vo.AD_Infowindow_ID = adInfoPaneId;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -411,7 +412,20 @@ public class GridFieldVO implements Serializable
|
||||||
return voT;
|
return voT;
|
||||||
} // createParameter
|
} // createParameter
|
||||||
|
|
||||||
public static GridFieldVO createParameter (Properties ctx, int WindowNo,
|
/**
|
||||||
|
* 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,
|
||||||
int AD_Column_ID, String ColumnName, String Name, int AD_Reference_ID, int AD_Reference_Value_ID,
|
int AD_Column_ID, String ColumnName, String Name, int AD_Reference_ID, int AD_Reference_Value_ID,
|
||||||
boolean IsMandatory, boolean IsEncrypted)
|
boolean IsMandatory, boolean IsEncrypted)
|
||||||
{
|
{
|
||||||
|
@ -428,6 +442,8 @@ public class GridFieldVO implements Serializable
|
||||||
vo.AD_Reference_Value_ID = AD_Reference_Value_ID;
|
vo.AD_Reference_Value_ID = AD_Reference_Value_ID;
|
||||||
vo.IsMandatory = IsMandatory;
|
vo.IsMandatory = IsMandatory;
|
||||||
vo.IsEncryptedField= IsEncrypted;
|
vo.IsEncryptedField= IsEncrypted;
|
||||||
|
vo.AD_Infowindow_ID = infoWindowID;
|
||||||
|
vo.AD_Window_ID_Of_Panel = WindowIDOfPanel;
|
||||||
//
|
//
|
||||||
vo.initFinish();
|
vo.initFinish();
|
||||||
return vo;
|
return vo;
|
||||||
|
@ -499,7 +515,14 @@ public class GridFieldVO implements Serializable
|
||||||
* it's difference with AD_Process_ID
|
* it's difference with AD_Process_ID
|
||||||
*/
|
*/
|
||||||
public int AD_Process_ID_Of_Panel;
|
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;
|
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 */
|
/** AD_Tab_ID */
|
||||||
public int AD_Tab_ID;
|
public int AD_Tab_ID;
|
||||||
/** Is the Tab Read Only */
|
/** Is the Tab Read Only */
|
||||||
|
@ -771,6 +794,7 @@ public class GridFieldVO implements Serializable
|
||||||
clone.DefaultValue2 = DefaultValue2;
|
clone.DefaultValue2 = DefaultValue2;
|
||||||
clone.AD_Process_ID_Of_Panel = AD_Process_ID_Of_Panel;
|
clone.AD_Process_ID_Of_Panel = AD_Process_ID_Of_Panel;
|
||||||
clone.AD_Window_ID_Of_Panel = AD_Window_ID_Of_Panel;
|
clone.AD_Window_ID_Of_Panel = AD_Window_ID_Of_Panel;
|
||||||
|
clone.AD_Infowindow_ID = AD_Infowindow_ID;
|
||||||
return clone;
|
return clone;
|
||||||
} // clone
|
} // clone
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,21 @@ public interface I_AD_Preference
|
||||||
*/
|
*/
|
||||||
public int getAD_Client_ID();
|
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 */
|
/** Column name AD_Org_ID */
|
||||||
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
|
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,34 @@ public class X_AD_Preference extends PO implements I_AD_Preference, I_Persistent
|
||||||
return sb.toString();
|
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.
|
/** Set Preference.
|
||||||
@param AD_Preference_ID
|
@param AD_Preference_ID
|
||||||
Personal Value Preference
|
Personal Value Preference
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class ProcessInfo implements Serializable
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -3654748247858779823L;
|
private static final long serialVersionUID = -1084726411940456050L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -94,6 +94,7 @@ public class ProcessInfo implements Serializable
|
||||||
/** Process Instance ID */
|
/** Process Instance ID */
|
||||||
private int m_AD_PInstance_ID = 0;
|
private int m_AD_PInstance_ID = 0;
|
||||||
|
|
||||||
|
private int m_InfoWindowID = 0;
|
||||||
/** Summary of Execution */
|
/** Summary of Execution */
|
||||||
private String m_Summary = "";
|
private String m_Summary = "";
|
||||||
/** Execution had an error */
|
/** Execution had an error */
|
||||||
|
@ -343,6 +344,23 @@ public class ProcessInfo implements Serializable
|
||||||
m_AD_PInstance_ID = AD_PInstance_ID;
|
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
|
* Method getAD_Process_ID
|
||||||
* @return int
|
* @return int
|
||||||
|
|
|
@ -96,6 +96,8 @@ public final class Env
|
||||||
|
|
||||||
private static List<IEnvEventListener> eventListeners = new ArrayList<IEnvEventListener>();
|
private static List<IEnvEventListener> eventListeners = new ArrayList<IEnvEventListener>();
|
||||||
|
|
||||||
|
public static int adWindowDummyID =200054;
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger log = CLogger.getCLogger(Env.class);
|
private static CLogger log = CLogger.getCLogger(Env.class);
|
||||||
|
|
||||||
|
@ -960,13 +962,41 @@ public final class Env
|
||||||
return (retValue == null ? "" : retValue);
|
return (retValue == null ? "" : retValue);
|
||||||
} // getPreference
|
} // getPreference
|
||||||
|
|
||||||
public static String getPreference (Properties ctx, int AD_Window_ID, int AD_Process_ID_Of_Panel, String context)
|
/**
|
||||||
|
* 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)
|
||||||
{
|
{
|
||||||
if (ctx == null || context == null)
|
if (ctx == null || context == null)
|
||||||
throw new IllegalArgumentException ("Require Context");
|
throw new IllegalArgumentException ("Require Context");
|
||||||
String retValue = null;
|
String retValue = null;
|
||||||
|
|
||||||
retValue = ctx.getProperty("P"+AD_Window_ID+"|"+ AD_Process_ID_Of_Panel + "|" + context);
|
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);
|
||||||
|
|
||||||
return (retValue == null ? "" : retValue);
|
return (retValue == null ? "" : retValue);
|
||||||
} // getPreference
|
} // getPreference
|
||||||
|
|
|
@ -928,7 +928,7 @@ public class Login
|
||||||
|
|
||||||
// This reads all relevant window neutral defaults
|
// This reads all relevant window neutral defaults
|
||||||
// overwriting superseeded ones. Window specific is read in Mainain
|
// overwriting superseeded ones. Window specific is read in Mainain
|
||||||
sql = "SELECT Attribute, Value, AD_Window_ID, AD_Process_ID, PreferenceFor "
|
sql = "SELECT Attribute, Value, AD_Window_ID, AD_Process_ID, AD_InfoWindow_ID, PreferenceFor "
|
||||||
+ "FROM AD_Preference "
|
+ "FROM AD_Preference "
|
||||||
+ "WHERE AD_Client_ID IN (0, @#AD_Client_ID@)"
|
+ "WHERE AD_Client_ID IN (0, @#AD_Client_ID@)"
|
||||||
+ " AND AD_Org_ID IN (0, @#AD_Org_ID@)"
|
+ " AND AD_Org_ID IN (0, @#AD_Org_ID@)"
|
||||||
|
@ -948,7 +948,8 @@ public class Login
|
||||||
int AD_Window_ID = rs.getInt(3);
|
int AD_Window_ID = rs.getInt(3);
|
||||||
boolean isAllWindow = rs.wasNull();
|
boolean isAllWindow = rs.wasNull();
|
||||||
int AD_Process_ID = rs.getInt(4);
|
int AD_Process_ID = rs.getInt(4);
|
||||||
String PreferenceFor = rs.getString(5);
|
int AD_InfoWindow_ID = rs.getInt(5);
|
||||||
|
String PreferenceFor = rs.getString(6);
|
||||||
String at = "";
|
String at = "";
|
||||||
|
|
||||||
// preference for window
|
// preference for window
|
||||||
|
@ -958,8 +959,10 @@ public class Login
|
||||||
else
|
else
|
||||||
at = "P" + AD_Window_ID + "|" + rs.getString(1);
|
at = "P" + AD_Window_ID + "|" + rs.getString(1);
|
||||||
}else if ("P".equals(PreferenceFor)){ // preference for processs
|
}else if ("P".equals(PreferenceFor)){ // preference for processs
|
||||||
// when apply for all window or all process format is "P0|0|m_Attribute;
|
// 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);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
String va = rs.getString(2);
|
String va = rs.getString(2);
|
||||||
|
|
|
@ -296,7 +296,7 @@ public class ProcessParameter extends CDialog
|
||||||
private void createField (ResultSet rs)
|
private void createField (ResultSet rs)
|
||||||
{
|
{
|
||||||
// Create Field
|
// Create Field
|
||||||
GridFieldVO voF = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, m_processInfo.getAD_Process_ID(), m_AD_Window_ID, rs);
|
GridFieldVO voF = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, m_processInfo.getAD_Process_ID(), m_AD_Window_ID, 0, rs);
|
||||||
GridField mField = new GridField (voF);
|
GridField mField = new GridField (voF);
|
||||||
m_mFields.add(mField); // add to Fields
|
m_mFields.add(mField); // add to Fields
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,8 @@ import org.compiere.util.Msg;
|
||||||
* @version 2006-12-01
|
* @version 2006-12-01
|
||||||
*/
|
*/
|
||||||
public class ProcessParameterPanel extends CPanel implements VetoableChangeListener, IProcessParameter {
|
public class ProcessParameterPanel extends CPanel implements VetoableChangeListener, IProcessParameter {
|
||||||
/**
|
|
||||||
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -8583999032745045111L;
|
private static final long serialVersionUID = -8583999032745045111L;
|
||||||
|
@ -286,7 +287,7 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe
|
||||||
private void createField (ResultSet rs)
|
private void createField (ResultSet rs)
|
||||||
{
|
{
|
||||||
// Create Field
|
// Create Field
|
||||||
GridFieldVO voF = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, m_processInfo.getAD_Process_ID(), m_AD_Window_ID, rs);
|
GridFieldVO voF = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, m_processInfo.getAD_Process_ID(), m_AD_Window_ID, m_processInfo.getAD_InfoWindow_ID(),rs);
|
||||||
GridField mField = new GridField (voF);
|
GridField mField = new GridField (voF);
|
||||||
m_mFields.add(mField); // add to Fields
|
m_mFields.add(mField); // add to Fields
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Login;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.Page;
|
import org.zkoss.zk.ui.Page;
|
||||||
|
@ -121,7 +122,7 @@ public class ValuePreference extends Window implements EventListener<Event>
|
||||||
// Create Editor
|
// Create Editor
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
ValuePreference vp = new ValuePreference (WindowNo,
|
ValuePreference vp = new ValuePreference (WindowNo,
|
||||||
AD_Client_ID, AD_Org_ID, AD_User_ID, AD_Window_ID, mField.getAD_Process_ID_Of_Panel(),
|
AD_Client_ID, AD_Org_ID, AD_User_ID, AD_Window_ID, mField.getAD_Process_ID_Of_Panel(), mField.getAD_Infowindow_ID(),
|
||||||
Attribute, DisplayAttribute, Value, DisplayValue,
|
Attribute, DisplayAttribute, Value, DisplayValue,
|
||||||
displayType, AD_Reference_ID, ref);
|
displayType, AD_Reference_ID, ref);
|
||||||
} // create
|
} // create
|
||||||
|
@ -183,7 +184,7 @@ public class ValuePreference extends Window implements EventListener<Event>
|
||||||
* @param ref
|
* @param ref
|
||||||
*/
|
*/
|
||||||
public ValuePreference (int WindowNo,
|
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_Client_ID, int AD_Org_ID, int AD_User_ID, int AD_Window_ID, int AD_Process_ID_Of_Panel, int AD_Infowindow_ID,
|
||||||
String Attribute, String DisplayAttribute, String Value, String DisplayValue,
|
String Attribute, String DisplayAttribute, String Value, String DisplayValue,
|
||||||
int displayType, int AD_Reference_ID, Component ref)
|
int displayType, int AD_Reference_ID, Component ref)
|
||||||
{
|
{
|
||||||
|
@ -207,8 +208,13 @@ public class ValuePreference extends Window implements EventListener<Event>
|
||||||
m_DisplayValue = DisplayValue;
|
m_DisplayValue = DisplayValue;
|
||||||
m_DisplayType = displayType;
|
m_DisplayType = displayType;
|
||||||
m_AD_Process_ID_Of_Panel = AD_Process_ID_Of_Panel;
|
m_AD_Process_ID_Of_Panel = AD_Process_ID_Of_Panel;
|
||||||
|
m_AD_Infowindow_ID = AD_Infowindow_ID;
|
||||||
//
|
//
|
||||||
m_role = MRole.getDefault();
|
m_role = MRole.getDefault();
|
||||||
|
|
||||||
|
if (m_AD_Infowindow_ID > 0 && m_AD_Process_ID_Of_Panel > 0)
|
||||||
|
isProcessInIW = true;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
|
@ -229,6 +235,7 @@ public class ValuePreference extends Window implements EventListener<Event>
|
||||||
} else {
|
} else {
|
||||||
AEnv.showCenterScreen(this);
|
AEnv.showCenterScreen(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ValuePreference
|
} // ValuePreference
|
||||||
|
|
||||||
private AbstractADWindowContent findADWindowContent(Component comp) {
|
private AbstractADWindowContent findADWindowContent(Component comp) {
|
||||||
|
@ -249,6 +256,7 @@ public class ValuePreference extends Window implements EventListener<Event>
|
||||||
private int m_DisplayType;
|
private int m_DisplayType;
|
||||||
private MRole m_role;
|
private MRole m_role;
|
||||||
private int m_AD_Process_ID_Of_Panel;
|
private int m_AD_Process_ID_Of_Panel;
|
||||||
|
private int m_AD_Infowindow_ID;
|
||||||
|
|
||||||
// Display
|
// Display
|
||||||
private Panel setPanel = new Panel();
|
private Panel setPanel = new Panel();
|
||||||
|
@ -265,11 +273,17 @@ public class ValuePreference extends Window implements EventListener<Event>
|
||||||
private Checkbox cbUser = new Checkbox();
|
private Checkbox cbUser = new Checkbox();
|
||||||
private Checkbox cbWindow = new Checkbox();
|
private Checkbox cbWindow = new Checkbox();
|
||||||
private Checkbox cbProcess = new Checkbox();
|
private Checkbox cbProcess = new Checkbox();
|
||||||
|
private Checkbox cbInfowindow = new Checkbox();
|
||||||
private Label lExplanation = new Label();
|
private Label lExplanation = new Label();
|
||||||
|
|
||||||
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
||||||
private Button bDelete;
|
private Button bDelete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* is true when value preference for a field of process call by info window
|
||||||
|
*/
|
||||||
|
private boolean isProcessInIW = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static Layout
|
* Static Layout
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
@ -288,6 +302,8 @@ public class ValuePreference extends Window implements EventListener<Event>
|
||||||
cbWindow.setChecked(true);
|
cbWindow.setChecked(true);
|
||||||
cbProcess.setLabel(Msg.translate(m_ctx, "AD_Process_ID"));
|
cbProcess.setLabel(Msg.translate(m_ctx, "AD_Process_ID"));
|
||||||
cbProcess.setChecked(true);
|
cbProcess.setChecked(true);
|
||||||
|
cbInfowindow.setLabel(Msg.translate(m_ctx, "AD_InfoWindow_ID"));
|
||||||
|
cbInfowindow.setChecked(true);
|
||||||
//
|
//
|
||||||
setPanel.appendChild(setLayout);
|
setPanel.appendChild(setLayout);
|
||||||
setPanel.setHflex("1");
|
setPanel.setHflex("1");
|
||||||
|
@ -334,10 +350,23 @@ public class ValuePreference extends Window implements EventListener<Event>
|
||||||
chlayout.appendChild(cbClient);
|
chlayout.appendChild(cbClient);
|
||||||
chlayout.appendChild(cbOrg);
|
chlayout.appendChild(cbOrg);
|
||||||
chlayout.appendChild(cbUser);
|
chlayout.appendChild(cbUser);
|
||||||
chlayout.appendChild(cbWindow);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
if(m_AD_Process_ID_Of_Panel > 0){
|
if(m_AD_Process_ID_Of_Panel > 0){
|
||||||
chlayout.appendChild(cbProcess);
|
chlayout.appendChild(cbProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
row.appendCellChild(chlayout, 5);
|
row.appendCellChild(chlayout, 5);
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
|
||||||
|
@ -402,6 +431,7 @@ public class ValuePreference extends Window implements EventListener<Event>
|
||||||
// Can change all/specific
|
// Can change all/specific
|
||||||
cbWindow.addEventListener(Events.ON_CHECK, this);
|
cbWindow.addEventListener(Events.ON_CHECK, this);
|
||||||
cbProcess.addEventListener(Events.ON_CHECK, this);
|
cbProcess.addEventListener(Events.ON_CHECK, this);
|
||||||
|
cbInfowindow.addEventListener(Events.ON_CHECK, this);
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
confirmPanel.addComponentsLeft(confirmPanel.createButton("Delete"));
|
confirmPanel.addComponentsLeft(confirmPanel.createButton("Delete"));
|
||||||
|
@ -473,6 +503,13 @@ public class ValuePreference extends Window implements EventListener<Event>
|
||||||
else
|
else
|
||||||
expl.append(" and all Process");
|
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())
|
if (Env.getLanguage(Env.getCtx()).isBaseLanguage())
|
||||||
|
@ -501,19 +538,35 @@ public class ValuePreference extends Window implements EventListener<Event>
|
||||||
else
|
else
|
||||||
sql.append(" AND AD_Window_ID IS NULL");
|
sql.append(" AND AD_Window_ID IS NULL");
|
||||||
|
|
||||||
if (m_AD_Process_ID_Of_Panel > 0){
|
// set where for Process
|
||||||
// preference for process parameter
|
if (m_AD_Process_ID_Of_Panel > 0 && cbProcess.isChecked()){
|
||||||
sql.append(" AND PreferenceFor = 'P'");
|
// case set for a process
|
||||||
if (cbProcess.isChecked())
|
sql.append(" AND AD_Process_ID=").append(m_AD_Process_ID_Of_Panel);
|
||||||
sql.append(" AND AD_Process_ID=").append(m_AD_Process_ID_Of_Panel);
|
|
||||||
else
|
|
||||||
sql.append(" AND AD_Process_ID IS NULL");
|
|
||||||
}else{
|
}else{
|
||||||
// preference for process window
|
// case set for a all process or non set for process (set for window or infowindow)
|
||||||
sql.append(" AND PreferenceFor = 'W'");
|
|
||||||
sql.append(" AND AD_Process_ID IS NULL");
|
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
|
||||||
|
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
|
||||||
|
sql.append(" AND PreferenceFor = 'W'");
|
||||||
|
}
|
||||||
|
|
||||||
sql.append(" AND Attribute='").append(m_Attribute).append("'");
|
sql.append(" AND Attribute='").append(m_Attribute).append("'");
|
||||||
//
|
//
|
||||||
if (log.isLoggable(Level.FINE)) log.fine( sql.toString());
|
if (log.isLoggable(Level.FINE)) log.fine( sql.toString());
|
||||||
|
@ -525,21 +578,44 @@ public class ValuePreference extends Window implements EventListener<Event>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Context Key
|
* 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
|
* @return Context Key
|
||||||
*/
|
*/
|
||||||
private String getContextKey()
|
private String getContextKey()
|
||||||
{
|
{
|
||||||
if (m_AD_Process_ID_Of_Panel > 0){
|
// add window id info in case have process or field in info window parameter
|
||||||
if (cbProcess.isChecked())
|
StringBuilder preferencesContextKey = new StringBuilder ("P") ;
|
||||||
return "P" + m_AD_Window_ID + "|" + m_AD_Process_ID_Of_Panel + "|" + m_Attribute;
|
if (m_AD_Window_ID > 0){
|
||||||
else{
|
preferencesContextKey.append(m_AD_Window_ID);
|
||||||
return "P" + m_AD_Window_ID + "|0|" + m_Attribute;
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
if (cbWindow.isChecked())
|
preferencesContextKey.append("0");
|
||||||
return "P" + m_AD_Window_ID + "|" + m_Attribute;
|
}
|
||||||
else
|
// add info window info in case have process or field in info window parameter
|
||||||
return "P|" + m_Attribute;
|
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();
|
||||||
|
else{
|
||||||
|
return preferencesContextKey.append("|0|").append(m_Attribute).toString();
|
||||||
|
}
|
||||||
|
}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;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // getContextKey
|
} // getContextKey
|
||||||
|
@ -575,7 +651,7 @@ public class ValuePreference extends Window implements EventListener<Event>
|
||||||
//
|
//
|
||||||
StringBuilder sql = new StringBuilder ("INSERT INTO AD_Preference ("
|
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_Preference_ID, AD_Preference_UU, AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy,Updated,UpdatedBy,"
|
||||||
+ "AD_Window_ID, AD_Process_ID, PreferenceFor, AD_User_ID, Attribute, Value) VALUES (");
|
+ "AD_Window_ID, AD_Process_ID, AD_InfoWindow_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)
|
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(", ");
|
.append(", 'Y',SysDate,").append(m_AD_User_ID).append(",SysDate,").append(m_AD_User_ID).append(", ");
|
||||||
|
|
||||||
|
@ -585,18 +661,30 @@ public class ValuePreference extends Window implements EventListener<Event>
|
||||||
sql.append("NULL,") ;
|
sql.append("NULL,") ;
|
||||||
|
|
||||||
// set value for AD_Process_ID and PreferenceFor
|
// set value for AD_Process_ID and PreferenceFor
|
||||||
if(m_AD_Process_ID_Of_Panel > 0){
|
if(m_AD_Process_ID_Of_Panel > 0 && cbProcess.isChecked()){
|
||||||
if (cbProcess.isChecked()){
|
sql.append(m_AD_Process_ID_Of_Panel).append(",");
|
||||||
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{
|
}else{
|
||||||
// in case Preference for window, AD_Process_ID always null
|
// in case Preference for window, AD_Process_ID always null
|
||||||
sql.append("NULL,");
|
sql.append("NULL,");
|
||||||
// in case Preference for window, set PreferenceFor = P
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
sql.append("'W',");
|
sql.append("'W',");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,10 @@ import java.util.logging.Level;
|
||||||
|
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
|
|
||||||
|
import org.adempiere.webui.adwindow.ADWindow;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.adempiere.webui.desktop.IDesktop;
|
import org.adempiere.webui.desktop.IDesktop;
|
||||||
|
import org.adempiere.webui.info.InfoWindow;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.adempiere.webui.theme.ThemeManager;
|
import org.adempiere.webui.theme.ThemeManager;
|
||||||
import org.adempiere.webui.util.IServerPushCallback;
|
import org.adempiere.webui.util.IServerPushCallback;
|
||||||
|
@ -760,4 +762,29 @@ public final class AEnv
|
||||||
IDesktop appDesktop = SessionManager.getAppDesktop();
|
IDesktop appDesktop = SessionManager.getAppDesktop();
|
||||||
return appDesktop != null ? appDesktop.getClientInfo().tablet : false;
|
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
|
} // AEnv
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.webui.adwindow.ADWindow;
|
|
||||||
import org.adempiere.webui.component.Column;
|
import org.adempiere.webui.component.Column;
|
||||||
import org.adempiere.webui.component.Columns;
|
import org.adempiere.webui.component.Columns;
|
||||||
import org.adempiere.webui.component.EditorBox;
|
import org.adempiere.webui.component.EditorBox;
|
||||||
|
@ -106,36 +105,14 @@ public class ProcessParameterPanel extends Panel implements
|
||||||
//
|
//
|
||||||
m_WindowNo = WindowNo;
|
m_WindowNo = WindowNo;
|
||||||
m_processInfo = pi;
|
m_processInfo = pi;
|
||||||
m_AD_Window_ID = getADWindowID (WindowNo);
|
m_AD_Window_ID = AEnv.getADWindowID (WindowNo);
|
||||||
this.width = width;
|
this.width = width;
|
||||||
|
this.m_InfoWindowID = pi.getAD_InfoWindow_ID();
|
||||||
//
|
//
|
||||||
initComponent();
|
initComponent();
|
||||||
addEventListener("onDynamicDisplay", this);
|
addEventListener("onDynamicDisplay", this);
|
||||||
} // ProcessParameterPanel
|
} // 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() {
|
private void initComponent() {
|
||||||
centerPanel = GridFactory.newGridLayout();
|
centerPanel = GridFactory.newGridLayout();
|
||||||
centerPanel.setInnerWidth(width);
|
centerPanel.setInnerWidth(width);
|
||||||
|
@ -156,6 +133,8 @@ public class ProcessParameterPanel extends Panel implements
|
||||||
private ProcessInfo m_processInfo;
|
private ProcessInfo m_processInfo;
|
||||||
// AD_Window of window below this dialog in case show parameter dialog panel
|
// AD_Window of window below this dialog in case show parameter dialog panel
|
||||||
private int m_AD_Window_ID = 0;
|
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 */
|
/** Logger */
|
||||||
private static CLogger log = CLogger
|
private static CLogger log = CLogger
|
||||||
.getCLogger(ProcessParameterPanel.class);
|
.getCLogger(ProcessParameterPanel.class);
|
||||||
|
@ -307,7 +286,7 @@ public class ProcessParameterPanel extends Panel implements
|
||||||
*/
|
*/
|
||||||
private void createField(ResultSet rs, Rows rows) {
|
private void createField(ResultSet rs, Rows rows) {
|
||||||
// Create Field
|
// Create Field
|
||||||
GridFieldVO voF = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, m_processInfo.getAD_Process_ID(), m_AD_Window_ID,
|
GridFieldVO voF = GridFieldVO.createParameter(Env.getCtx(), m_WindowNo, m_processInfo.getAD_Process_ID(), m_AD_Window_ID, m_InfoWindowID,
|
||||||
rs);
|
rs);
|
||||||
GridField mField = new GridField(voF);
|
GridField mField = new GridField(voF);
|
||||||
m_mFields.add(mField); // add to Fields
|
m_mFields.add(mField); // add to Fields
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.adempiere.webui.component.EditorBox;
|
||||||
import org.adempiere.webui.component.Label;
|
import org.adempiere.webui.component.Label;
|
||||||
import org.adempiere.webui.component.NumberBox;
|
import org.adempiere.webui.component.NumberBox;
|
||||||
import org.adempiere.webui.component.Paymentbox;
|
import org.adempiere.webui.component.Paymentbox;
|
||||||
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.event.ValueChangeListener;
|
import org.adempiere.webui.event.ValueChangeListener;
|
||||||
import org.adempiere.webui.theme.ThemeManager;
|
import org.adempiere.webui.theme.ThemeManager;
|
||||||
|
@ -53,6 +54,7 @@ import org.zkoss.zul.Image;
|
||||||
import org.zkoss.zul.Menuitem;
|
import org.zkoss.zul.Menuitem;
|
||||||
import org.zkoss.zul.Textbox;
|
import org.zkoss.zul.Textbox;
|
||||||
import org.zkoss.zul.impl.InputElement;
|
import org.zkoss.zul.impl.InputElement;
|
||||||
|
import org.zkoss.zul.impl.XulElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -94,11 +96,53 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
|
||||||
|
|
||||||
private boolean isProcessParameter;
|
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) {
|
public WEditor(Component comp, GridField gridField) {
|
||||||
this(comp, gridField, -1);
|
this(comp, gridField, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param comp
|
* @param comp
|
||||||
* @param gridField
|
* @param gridField
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.adempiere.model.IInfoColumn;
|
||||||
import org.adempiere.model.MInfoProcess;
|
import org.adempiere.model.MInfoProcess;
|
||||||
import org.adempiere.model.MInfoRelated;
|
import org.adempiere.model.MInfoRelated;
|
||||||
import org.adempiere.webui.AdempiereWebUI;
|
import org.adempiere.webui.AdempiereWebUI;
|
||||||
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Borderlayout;
|
import org.adempiere.webui.component.Borderlayout;
|
||||||
import org.adempiere.webui.component.Button;
|
import org.adempiere.webui.component.Button;
|
||||||
import org.adempiere.webui.component.Column;
|
import org.adempiere.webui.component.Column;
|
||||||
|
@ -475,7 +476,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
String columnName = infoColumn.getColumnName();
|
String columnName = infoColumn.getColumnName();
|
||||||
/*!m_lookup && infoColumn.isMandatory():apply Mandatory only case open as window and only for criteria field*/
|
/*!m_lookup && infoColumn.isMandatory():apply Mandatory only case open as window and only for criteria field*/
|
||||||
boolean isMandatory = !m_lookup && infoColumn.isMandatory() && infoColumn.isQueryCriteria();
|
boolean isMandatory = !m_lookup && infoColumn.isMandatory() && infoColumn.isQueryCriteria();
|
||||||
GridFieldVO vo = GridFieldVO.createParameter(infoContext, p_WindowNo, 0,
|
GridFieldVO vo = GridFieldVO.createParameter(infoContext, p_WindowNo, AEnv.getADWindowID(p_WindowNo), infoWindow.getAD_InfoWindow_ID(), 0,
|
||||||
columnName, infoColumn.get_Translation("Name"), infoColumn.getAD_Reference_ID(),
|
columnName, infoColumn.get_Translation("Name"), infoColumn.getAD_Reference_ID(),
|
||||||
infoColumn.getAD_Reference_Value_ID(), isMandatory, false);
|
infoColumn.getAD_Reference_Value_ID(), isMandatory, false);
|
||||||
if (infoColumn.getAD_Val_Rule_ID() > 0) {
|
if (infoColumn.getAD_Val_Rule_ID() > 0) {
|
||||||
|
@ -1221,6 +1222,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
addSearchParameter(label, fieldEditor);
|
addSearchParameter(label, fieldEditor);
|
||||||
|
|
||||||
editors.add(editor);
|
editors.add(editor);
|
||||||
|
|
||||||
|
editor.showMenu();
|
||||||
|
|
||||||
if (infoColumn.isIdentifier()) {
|
if (infoColumn.isIdentifier()) {
|
||||||
identifiers.add(editor);
|
identifiers.add(editor);
|
||||||
}
|
}
|
||||||
|
@ -1229,9 +1233,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
|
|
||||||
mField.addPropertyChangeListener(editor);
|
mField.addPropertyChangeListener(editor);
|
||||||
|
|
||||||
if (! Util.isEmpty(mField.getVO().DefaultValue, true)) {
|
if (!Util.isEmpty(mField.getVO().DefaultValue, true)) {
|
||||||
// set default value
|
// set default value
|
||||||
mField.setValue(mField.getDefault(), true);
|
mField.setValue(mField.getDefault(), true);
|
||||||
}
|
}
|
||||||
} // addSelectionColumn
|
} // addSelectionColumn
|
||||||
|
|
||||||
|
@ -1272,7 +1276,11 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
} else {
|
} else {
|
||||||
panel.appendChild(new Space());
|
panel.appendChild(new Space());
|
||||||
}
|
}
|
||||||
panel.appendChild(fieldEditor);
|
|
||||||
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createAndCheckbox() {
|
protected void createAndCheckbox() {
|
||||||
|
@ -1743,7 +1751,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
*/
|
*/
|
||||||
protected GridField getGridField(MInfoColumn infoColumn){
|
protected GridField getGridField(MInfoColumn infoColumn){
|
||||||
String columnName = infoColumn.getColumnName();
|
String columnName = infoColumn.getColumnName();
|
||||||
GridFieldVO vo = GridFieldVO.createParameter(infoContext, p_WindowNo, 0,
|
GridFieldVO vo = GridFieldVO.createParameter(infoContext, p_WindowNo, AEnv.getADWindowID(p_WindowNo), AD_InfoWindow_ID, 0,
|
||||||
columnName, infoColumn.get_Translation("Name"), infoColumn.getAD_Reference_ID(),
|
columnName, infoColumn.get_Translation("Name"), infoColumn.getAD_Reference_ID(),
|
||||||
infoColumn.getAD_Reference_Value_ID(), false, false);
|
infoColumn.getAD_Reference_Value_ID(), false, false);
|
||||||
if (infoColumn.getAD_Val_Rule_ID() > 0) {
|
if (infoColumn.getAD_Val_Rule_ID() > 0) {
|
||||||
|
|
|
@ -1531,6 +1531,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
||||||
final int pInstanceID = instance.getAD_PInstance_ID();
|
final int pInstanceID = instance.getAD_PInstance_ID();
|
||||||
// Execute Process
|
// Execute Process
|
||||||
m_pi.setAD_PInstance_ID(pInstanceID);
|
m_pi.setAD_PInstance_ID(pInstanceID);
|
||||||
|
m_pi.setAD_InfoWindow_ID(infoWindow.getAD_InfoWindow_ID());
|
||||||
|
|
||||||
//HengSin - to let process end with message and requery
|
//HengSin - to let process end with message and requery
|
||||||
WProcessCtl.process(p_WindowNo, m_pi, (Trx)null, new EventListener<Event>() {
|
WProcessCtl.process(p_WindowNo, m_pi, (Trx)null, new EventListener<Event>() {
|
||||||
|
|
Loading…
Reference in New Issue