Merge e190cdb84c61
This commit is contained in:
commit
96614113b0
|
@ -0,0 +1,6 @@
|
||||||
|
CREATE UNIQUE INDEX cm_chat_record ON cm_chat (ad_table_id, record_id);
|
||||||
|
|
||||||
|
|
||||||
|
SELECT register_migration_script('201212131100_IDEMPIERE-530.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
CREATE UNIQUE INDEX cm_chat_record ON cm_chat (ad_table_id, record_id);
|
||||||
|
|
||||||
|
|
||||||
|
SELECT register_migration_script('201212131100_IDEMPIERE-530.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class DocManager {
|
||||||
return documentsTableName;
|
return documentsTableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void fillDocumentsTableArrays() {
|
private synchronized static void fillDocumentsTableArrays() {
|
||||||
if (documentsTableID == null) {
|
if (documentsTableID == null) {
|
||||||
String sql = "SELECT t.AD_Table_ID, t.TableName " +
|
String sql = "SELECT t.AD_Table_ID, t.TableName " +
|
||||||
"FROM AD_Table t, AD_Column c " +
|
"FROM AD_Table t, AD_Column c " +
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class CConnection implements Serializable, Cloneable
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -7893119456331485444L;
|
private static final long serialVersionUID = -7893119456331485444L;
|
||||||
/** Connection */
|
/** Connection */
|
||||||
private static CConnection s_cc = null;
|
private volatile static CConnection s_cc = null;
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger log = CLogger.getCLogger (CConnection.class);
|
private static CLogger log = CLogger.getCLogger (CConnection.class);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public class CConnection implements Serializable, Cloneable
|
||||||
* @param apps_host optional apps host for new connections
|
* @param apps_host optional apps host for new connections
|
||||||
* @return Connection Descriptor
|
* @return Connection Descriptor
|
||||||
*/
|
*/
|
||||||
public static CConnection get (String apps_host)
|
public synchronized static CConnection get (String apps_host)
|
||||||
{
|
{
|
||||||
if (s_cc == null)
|
if (s_cc == null)
|
||||||
{
|
{
|
||||||
|
@ -1418,7 +1418,7 @@ public class CConnection implements Serializable, Cloneable
|
||||||
* Get Last Exception of Apps Server Connection attempt
|
* Get Last Exception of Apps Server Connection attempt
|
||||||
* @return Exception or null
|
* @return Exception or null
|
||||||
*/
|
*/
|
||||||
public Exception getAppsServerException ()
|
public synchronized Exception getAppsServerException ()
|
||||||
{
|
{
|
||||||
return m_appsException;
|
return m_appsException;
|
||||||
} // getAppsServerException
|
} // getAppsServerException
|
||||||
|
|
|
@ -432,7 +432,7 @@ public abstract class Convert
|
||||||
*/
|
*/
|
||||||
public abstract boolean isOracle();
|
public abstract boolean isOracle();
|
||||||
|
|
||||||
public static void logMigrationScript(String oraStatement, String pgStatement) {
|
public synchronized static void logMigrationScript(String oraStatement, String pgStatement) {
|
||||||
// Check AdempiereSys
|
// Check AdempiereSys
|
||||||
// check property Log migration script
|
// check property Log migration script
|
||||||
boolean logMigrationScript = false;
|
boolean logMigrationScript = false;
|
||||||
|
|
|
@ -28,7 +28,6 @@ import java.sql.SQLException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
@ -111,7 +110,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 336562925897569888L;
|
private static final long serialVersionUID = -1638364577972806113L;
|
||||||
|
|
||||||
public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate";
|
public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate";
|
||||||
|
|
||||||
|
@ -163,10 +162,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
|
|
||||||
private String m_parentColumnName = "";
|
private String m_parentColumnName = "";
|
||||||
private String m_extendedWhere;
|
private String m_extendedWhere;
|
||||||
/** Attachments */
|
|
||||||
private HashMap<Integer,Integer> m_Attachments = null;
|
|
||||||
/** Chats */
|
|
||||||
private HashMap<Integer,Integer> m_Chats = null;
|
|
||||||
/** Locks */
|
/** Locks */
|
||||||
private ArrayList<Integer> m_Lock = null;
|
private ArrayList<Integer> m_Lock = null;
|
||||||
|
|
||||||
|
@ -333,12 +328,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
//
|
//
|
||||||
m_depOnField.clear();
|
m_depOnField.clear();
|
||||||
m_depOnField = null;
|
m_depOnField = null;
|
||||||
if (m_Attachments != null)
|
|
||||||
m_Attachments.clear();
|
|
||||||
m_Attachments = null;
|
|
||||||
if (m_Chats != null)
|
|
||||||
m_Chats.clear();
|
|
||||||
m_Chats = null;
|
|
||||||
//
|
//
|
||||||
if (m_vo.isInitFields())
|
if (m_vo.isInitFields())
|
||||||
m_vo.getFields().clear();
|
m_vo.getFields().clear();
|
||||||
|
@ -2034,43 +2023,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
|
|
||||||
} // loadDependentInfo
|
} // loadDependentInfo
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Load Attachments for this table
|
|
||||||
*/
|
|
||||||
public void loadAttachments()
|
|
||||||
{
|
|
||||||
log.fine("#" + m_vo.TabNo);
|
|
||||||
if (!canHaveAttachment())
|
|
||||||
return;
|
|
||||||
|
|
||||||
String SQL = "SELECT AD_Attachment_ID, Record_ID FROM AD_Attachment "
|
|
||||||
+ "WHERE AD_Table_ID=?";
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (m_Attachments == null)
|
|
||||||
m_Attachments = new HashMap<Integer,Integer>();
|
|
||||||
else
|
|
||||||
m_Attachments.clear();
|
|
||||||
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
|
|
||||||
pstmt.setInt(1, m_vo.AD_Table_ID);
|
|
||||||
ResultSet rs = pstmt.executeQuery();
|
|
||||||
while (rs.next())
|
|
||||||
{
|
|
||||||
Integer key = new Integer(rs.getInt(2));
|
|
||||||
Integer value = new Integer(rs.getInt(1));
|
|
||||||
m_Attachments.put(key, value);
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
|
||||||
catch (SQLException e)
|
|
||||||
{
|
|
||||||
log.log(Level.SEVERE, "loadAttachments", e);
|
|
||||||
}
|
|
||||||
log.config("#" + m_Attachments.size());
|
|
||||||
} // loadAttachment
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can this tab have Attachments?.
|
* Can this tab have Attachments?.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -2091,13 +2043,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
*/
|
*/
|
||||||
public boolean hasAttachment()
|
public boolean hasAttachment()
|
||||||
{
|
{
|
||||||
if (m_Attachments == null)
|
return getAD_AttachmentID() > 0;
|
||||||
loadAttachments();
|
|
||||||
if (m_Attachments == null || m_Attachments.isEmpty())
|
|
||||||
return false;
|
|
||||||
//
|
|
||||||
Integer key = new Integer(m_mTable.getKeyID (m_currentRow));
|
|
||||||
return m_Attachments.containsKey(key);
|
|
||||||
} // hasAttachment
|
} // hasAttachment
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2106,54 +2052,11 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
*/
|
*/
|
||||||
public int getAD_AttachmentID()
|
public int getAD_AttachmentID()
|
||||||
{
|
{
|
||||||
if (m_Attachments == null)
|
|
||||||
loadAttachments();
|
|
||||||
if (m_Attachments.isEmpty())
|
|
||||||
return 0;
|
|
||||||
//
|
|
||||||
Integer key = new Integer(m_mTable.getKeyID (m_currentRow));
|
|
||||||
Integer value = (Integer)m_Attachments.get(key);
|
|
||||||
if (value == null)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return value.intValue();
|
|
||||||
} // getAttachmentID
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Load Chats for this table
|
|
||||||
*/
|
|
||||||
public void loadChats()
|
|
||||||
{
|
|
||||||
log.fine("#" + m_vo.TabNo);
|
|
||||||
if (!canHaveAttachment())
|
if (!canHaveAttachment())
|
||||||
return;
|
return 0;
|
||||||
|
int recordID = m_mTable.getKeyID(m_currentRow);
|
||||||
String sql = "SELECT CM_Chat_ID, Record_ID FROM CM_Chat "
|
return MAttachment.getID(m_vo.AD_Table_ID, recordID);
|
||||||
+ "WHERE AD_Table_ID=?";
|
} // getAttachmentID
|
||||||
try
|
|
||||||
{
|
|
||||||
if (m_Chats == null)
|
|
||||||
m_Chats = new HashMap<Integer,Integer>();
|
|
||||||
else
|
|
||||||
m_Chats.clear();
|
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
|
||||||
pstmt.setInt(1, m_vo.AD_Table_ID);
|
|
||||||
ResultSet rs = pstmt.executeQuery();
|
|
||||||
while (rs.next())
|
|
||||||
{
|
|
||||||
Integer key = new Integer(rs.getInt(2)); // Record_ID
|
|
||||||
Integer value = new Integer(rs.getInt(1)); // CM_Chat_ID
|
|
||||||
m_Chats.put(key, value);
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
|
||||||
catch (SQLException e)
|
|
||||||
{
|
|
||||||
log.log(Level.SEVERE, sql, e);
|
|
||||||
}
|
|
||||||
log.config("#" + m_Chats.size());
|
|
||||||
} // loadChats
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true, if current row has a Chat
|
* Returns true, if current row has a Chat
|
||||||
|
@ -2161,13 +2064,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
*/
|
*/
|
||||||
public boolean hasChat()
|
public boolean hasChat()
|
||||||
{
|
{
|
||||||
if (m_Chats == null)
|
return getCM_ChatID() > 0;
|
||||||
loadChats();
|
|
||||||
if (m_Chats == null || m_Chats.isEmpty())
|
|
||||||
return false;
|
|
||||||
//
|
|
||||||
Integer key = new Integer(m_mTable.getKeyID (m_currentRow));
|
|
||||||
return m_Chats.containsKey(key);
|
|
||||||
} // hasChat
|
} // hasChat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2176,17 +2073,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
*/
|
*/
|
||||||
public int getCM_ChatID()
|
public int getCM_ChatID()
|
||||||
{
|
{
|
||||||
if (m_Chats == null)
|
if (!canHaveAttachment())
|
||||||
loadChats();
|
|
||||||
if (m_Chats.isEmpty())
|
|
||||||
return 0;
|
return 0;
|
||||||
//
|
int recordID = m_mTable.getKeyID(m_currentRow);
|
||||||
Integer key = new Integer(m_mTable.getKeyID (m_currentRow));
|
return MChat.getID(m_vo.AD_Table_ID, recordID);
|
||||||
Integer value = (Integer)m_Chats.get(key);
|
|
||||||
if (value == null)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return value.intValue();
|
|
||||||
} // getCM_ChatID
|
} // getCM_ChatID
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.MimeType;
|
import org.compiere.util.MimeType;
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ public class MAttachment extends X_AD_Attachment
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -8013716602070647299L;
|
private static final long serialVersionUID = -8261865873158774665L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Attachment (if there are more than one attachment it gets the first in no specific order)
|
* Get Attachment (if there are more than one attachment it gets the first in no specific order)
|
||||||
|
@ -94,9 +95,7 @@ public class MAttachment extends X_AD_Attachment
|
||||||
*/
|
*/
|
||||||
public MAttachment(Properties ctx, int AD_Table_ID, int Record_ID, String trxName)
|
public MAttachment(Properties ctx, int AD_Table_ID, int Record_ID, String trxName)
|
||||||
{
|
{
|
||||||
this (ctx
|
this (ctx, MAttachment.getID(AD_Table_ID, Record_ID) > 0 ? MAttachment.getID(AD_Table_ID, Record_ID) : 0, trxName);
|
||||||
, MAttachment.get(ctx, AD_Table_ID, Record_ID) == null ? 0 : MAttachment.get(ctx, AD_Table_ID, Record_ID).get_ID()
|
|
||||||
, trxName);
|
|
||||||
if (get_ID() == 0) {
|
if (get_ID() == 0) {
|
||||||
setAD_Table_ID (AD_Table_ID);
|
setAD_Table_ID (AD_Table_ID);
|
||||||
setRecord_ID (Record_ID);
|
setRecord_ID (Record_ID);
|
||||||
|
@ -598,4 +597,17 @@ public class MAttachment extends X_AD_Attachment
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IDEMPIERE-530
|
||||||
|
* Get the attachment ID based on table_id and record_id
|
||||||
|
* @param AD_Table_ID
|
||||||
|
* @param Record_ID
|
||||||
|
* @return AD_Attachment_ID
|
||||||
|
*/
|
||||||
|
public static int getID(int Table_ID, int Record_ID) {
|
||||||
|
String sql="SELECT AD_Attachment_ID FROM AD_Attachment WHERE AD_Table_ID=? AND Record_ID=?";
|
||||||
|
int attachid = DB.getSQLValue(null, sql, Table_ID, Record_ID);
|
||||||
|
return attachid;
|
||||||
|
}
|
||||||
|
|
||||||
} // MAttachment
|
} // MAttachment
|
||||||
|
|
|
@ -44,8 +44,7 @@ public class MChat extends X_CM_Chat
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -5053130533036069784L;
|
private static final long serialVersionUID = 9165439123618441913L;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Chats Of Table - of client in context
|
* Get Chats Of Table - of client in context
|
||||||
|
@ -240,7 +239,19 @@ public class MChat extends X_CM_Chat
|
||||||
} // entry
|
} // entry
|
||||||
//
|
//
|
||||||
return history;
|
return history;
|
||||||
} // getHistory
|
} // getHistory
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IDEMPIERE-530
|
||||||
|
* Get the chat ID based on table_id and record_id
|
||||||
|
* @param AD_Table_ID
|
||||||
|
* @param Record_ID
|
||||||
|
* @return CM_Chat_ID
|
||||||
|
*/
|
||||||
|
public static int getID(int Table_ID, int Record_ID) {
|
||||||
|
String sql="SELECT CM_Chat_ID FROM CM_Chat WHERE AD_Table_ID=? AND Record_ID=?";
|
||||||
|
int chatID = DB.getSQLValueEx(null, sql, Table_ID, Record_ID);
|
||||||
|
return chatID;
|
||||||
|
}
|
||||||
|
|
||||||
} // MChat
|
} // MChat
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class MEXPProcessor extends X_EXP_Processor {
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MEXPProcessor.class);
|
private static CLogger s_log = CLogger.getCLogger (MEXPProcessor.class);
|
||||||
|
|
||||||
private static MEXPProcessor processor= null;
|
private volatile static MEXPProcessor processor= null;
|
||||||
private X_EXP_ProcessorParameter[] parameters = null;
|
private X_EXP_ProcessorParameter[] parameters = null;
|
||||||
|
|
||||||
public static MEXPProcessor get(Properties ctx, int EXP_Processor_ID, String trxName)
|
public static MEXPProcessor get(Properties ctx, int EXP_Processor_ID, String trxName)
|
||||||
|
|
|
@ -186,7 +186,7 @@ public class MLocator extends X_M_Locator
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Cache */
|
/** Cache */
|
||||||
private static CCache<Integer,MLocator> s_cache;
|
private volatile static CCache<Integer,MLocator> s_cache;
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MLocator.class);
|
private static CLogger s_log = CLogger.getCLogger (MLocator.class);
|
||||||
|
|
|
@ -196,7 +196,7 @@ public class MRequestType extends X_R_RequestType
|
||||||
* Get Total No of requests of type
|
* Get Total No of requests of type
|
||||||
* @return no
|
* @return no
|
||||||
*/
|
*/
|
||||||
public int getTotalNo()
|
public synchronized int getTotalNo()
|
||||||
{
|
{
|
||||||
updateStatistics();
|
updateStatistics();
|
||||||
return m_totalNo;
|
return m_totalNo;
|
||||||
|
@ -206,7 +206,7 @@ public class MRequestType extends X_R_RequestType
|
||||||
* Get Open No of requests of type
|
* Get Open No of requests of type
|
||||||
* @return no
|
* @return no
|
||||||
*/
|
*/
|
||||||
public int getOpenNo()
|
public synchronized int getOpenNo()
|
||||||
{
|
{
|
||||||
updateStatistics();
|
updateStatistics();
|
||||||
return m_openNo;
|
return m_openNo;
|
||||||
|
@ -216,7 +216,7 @@ public class MRequestType extends X_R_RequestType
|
||||||
* Get Closed in last 30 days of type
|
* Get Closed in last 30 days of type
|
||||||
* @return no
|
* @return no
|
||||||
*/
|
*/
|
||||||
public int getClosed30No()
|
public synchronized int getClosed30No()
|
||||||
{
|
{
|
||||||
updateStatistics();
|
updateStatistics();
|
||||||
return m_closed30No;
|
return m_closed30No;
|
||||||
|
@ -226,7 +226,7 @@ public class MRequestType extends X_R_RequestType
|
||||||
* Get New in the last 30 days of type
|
* Get New in the last 30 days of type
|
||||||
* @return no
|
* @return no
|
||||||
*/
|
*/
|
||||||
public int getNew30No()
|
public synchronized int getNew30No()
|
||||||
{
|
{
|
||||||
updateStatistics();
|
updateStatistics();
|
||||||
return m_new30No;
|
return m_new30No;
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class MSystem extends X_AD_System
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
* @return System
|
* @return System
|
||||||
*/
|
*/
|
||||||
public static MSystem get (Properties ctx)
|
public synchronized static MSystem get (Properties ctx)
|
||||||
{
|
{
|
||||||
if (s_system != null)
|
if (s_system != null)
|
||||||
return s_system;
|
return s_system;
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class MUserDefWin extends X_AD_UserDef_Win
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -5775251886672840324L;
|
private static final long serialVersionUID = -5775251886672840324L;
|
||||||
|
|
||||||
private static List<MUserDefWin> m_fullList = null;
|
private volatile static List<MUserDefWin> m_fullList = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard constructor.
|
* Standard constructor.
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class TranslationTable
|
||||||
* @param requery requery
|
* @param requery requery
|
||||||
* @return number of active Translations
|
* @return number of active Translations
|
||||||
*/
|
*/
|
||||||
public static int getActiveLanguages (boolean requery)
|
public synchronized static int getActiveLanguages (boolean requery)
|
||||||
{
|
{
|
||||||
if (s_activeLanguages != null && !requery)
|
if (s_activeLanguages != null && !requery)
|
||||||
return s_activeLanguages.intValue();
|
return s_activeLanguages.intValue();
|
||||||
|
|
|
@ -195,7 +195,7 @@ public class ArchiveEngine
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger log = CLogger.getCLogger(ArchiveEngine.class);
|
private static CLogger log = CLogger.getCLogger(ArchiveEngine.class);
|
||||||
/** Singleton */
|
/** Singleton */
|
||||||
private static ArchiveEngine s_engine = null;
|
private volatile static ArchiveEngine s_engine = null;
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -171,7 +171,7 @@ public class SwapFile
|
||||||
freeBlocks(segment.getOffsets());
|
freeBlocks(segment.getOffsets());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyOpen() {
|
private synchronized void verifyOpen() {
|
||||||
if (randomAccessFile == null) {
|
if (randomAccessFile == null) {
|
||||||
throw new RuntimeException("Swap file not open for read write access");
|
throw new RuntimeException("Swap file not open for read write access");
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class CCachedRowSet extends CachedRowSetImpl implements CachedRowSet
|
||||||
* @return Cached Row Set
|
* @return Cached Row Set
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
*/
|
*/
|
||||||
public static CCachedRowSet get() throws SQLException
|
public synchronized static CCachedRowSet get() throws SQLException
|
||||||
{
|
{
|
||||||
CCachedRowSet crs = null;
|
CCachedRowSet crs = null;
|
||||||
// only first time call
|
// only first time call
|
||||||
|
|
|
@ -116,7 +116,7 @@ public class CLogger extends Logger implements Serializable
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Default Logger */
|
/** Default Logger */
|
||||||
private static CLogger s_logger = null;
|
private volatile static CLogger s_logger = null;
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -255,7 +255,7 @@ public final class DB
|
||||||
* Set connection
|
* Set connection
|
||||||
* @param cc connection
|
* @param cc connection
|
||||||
*/
|
*/
|
||||||
public static void setDBTarget (CConnection cc)
|
public synchronized static void setDBTarget (CConnection cc)
|
||||||
{
|
{
|
||||||
if (cc == null)
|
if (cc == null)
|
||||||
throw new IllegalArgumentException("Connection is NULL");
|
throw new IllegalArgumentException("Connection is NULL");
|
||||||
|
|
|
@ -224,7 +224,7 @@ public final class Ini implements Serializable
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Container for Properties */
|
/** Container for Properties */
|
||||||
private static Properties s_prop = new Properties();
|
private volatile static Properties s_prop = new Properties();
|
||||||
|
|
||||||
private static String s_propertyFileName = null;
|
private static String s_propertyFileName = null;
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ public class SecureEngine
|
||||||
/** Test String */
|
/** Test String */
|
||||||
private static final String TEST = "This is a 0123456789 .,; -= Test!";
|
private static final String TEST = "This is a 0123456789 .,; -= Test!";
|
||||||
/** Secure Engine */
|
/** Secure Engine */
|
||||||
private static SecureEngine s_engine = null;
|
private volatile static SecureEngine s_engine = null;
|
||||||
|
|
||||||
/** The real Engine */
|
/** The real Engine */
|
||||||
private SecureInterface implementation = null;
|
private SecureInterface implementation = null;
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class WebInfo
|
||||||
} // getGeneral
|
} // getGeneral
|
||||||
|
|
||||||
/** General Info */
|
/** General Info */
|
||||||
private static WebInfo m_general = null;
|
private volatile static WebInfo m_general = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class WebUser
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Short term Cache for immediate re-query/post (hit rate 20%) */
|
/** Short term Cache for immediate re-query/post (hit rate 20%) */
|
||||||
private static WebUser s_cache = null;
|
private volatile static WebUser s_cache = null;
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class DocWorkflowManager implements DocWorkflowMgr
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Document Workflow Manager */
|
/** Document Workflow Manager */
|
||||||
private static DocWorkflowManager s_mgr = null;
|
private volatile static DocWorkflowManager s_mgr = null;
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger log = CLogger.getCLogger(DocWorkflowManager.class);
|
private static CLogger log = CLogger.getCLogger(DocWorkflowManager.class);
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class HttpServiceImpl implements HttpService, ExtendedHttpService {
|
||||||
shutdown = true;
|
shutdown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkShutdown() {
|
private synchronized void checkShutdown() {
|
||||||
if (shutdown)
|
if (shutdown)
|
||||||
throw new IllegalStateException("Service instance is already shutdown"); //$NON-NLS-1$
|
throw new IllegalStateException("Service instance is already shutdown"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class ProxyServlet extends HttpServlet implements Filter {
|
||||||
Activator.addProxyServlet(this);
|
Activator.addProxyServlet(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public synchronized void destroy() {
|
||||||
Activator.removeProxyServlet(this);
|
Activator.removeProxyServlet(this);
|
||||||
proxyContext.destroy();
|
proxyContext.destroy();
|
||||||
proxyContext = null;
|
proxyContext = null;
|
||||||
|
@ -56,7 +56,7 @@ public class ProxyServlet extends HttpServlet implements Filter {
|
||||||
process(req, resp, null);
|
process(req, resp, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void process(HttpServletRequest req, HttpServletResponse resp, FilterChain filterChain) throws ServletException, IOException {
|
protected synchronized void process(HttpServletRequest req, HttpServletResponse resp, FilterChain filterChain) throws ServletException, IOException {
|
||||||
proxyContext.initializeServletPath(req, filterChain);
|
proxyContext.initializeServletPath(req, filterChain);
|
||||||
String alias = HttpServletRequestAdaptor.getDispatchPathInfo(req, filterChain);
|
String alias = HttpServletRequestAdaptor.getDispatchPathInfo(req, filterChain);
|
||||||
if (alias == null)
|
if (alias == null)
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class BridgeServlet extends HttpServlet {
|
||||||
private static HttpServlet servletDelegateInstance;
|
private static HttpServlet servletDelegateInstance;
|
||||||
private HttpServlet delegate;
|
private HttpServlet delegate;
|
||||||
// true if current HttpServlet is an HTTP Filter and false otherwise.
|
// true if current HttpServlet is an HTTP Filter and false otherwise.
|
||||||
private boolean delegateIsFilter;
|
private static boolean delegateIsFilter;
|
||||||
private int delegateReferenceCount;
|
private int delegateReferenceCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -175,7 +175,7 @@ public class BridgeServlet extends HttpServlet {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// cache the flag if HttpServlet servlet delegate is an HTTP Filter.
|
// cache the flag if HttpServlet servlet delegate is an HTTP Filter.
|
||||||
instance.delegateIsFilter = (servletDelegate instanceof Filter);
|
BridgeServlet.delegateIsFilter = (servletDelegate instanceof Filter);
|
||||||
// initialize the servlet delegate.
|
// initialize the servlet delegate.
|
||||||
servletDelegate.init(instance.getServletConfig());
|
servletDelegate.init(instance.getServletConfig());
|
||||||
} catch (ServletException e) {
|
} catch (ServletException e) {
|
||||||
|
@ -207,7 +207,7 @@ public class BridgeServlet extends HttpServlet {
|
||||||
|
|
||||||
HttpServlet oldProxy = instance.delegate;
|
HttpServlet oldProxy = instance.delegate;
|
||||||
instance.delegate = null;
|
instance.delegate = null;
|
||||||
instance.delegateIsFilter = false;
|
BridgeServlet.delegateIsFilter = false;
|
||||||
while (instance.delegateReferenceCount != 0) {
|
while (instance.delegateReferenceCount != 0) {
|
||||||
try {
|
try {
|
||||||
instance.wait();
|
instance.wait();
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class AdempiereServerGroup extends ThreadGroup
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Group */
|
/** Group */
|
||||||
private static AdempiereServerGroup s_group = null;
|
private volatile static AdempiereServerGroup s_group = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AdempiereServerGroup
|
* AdempiereServerGroup
|
||||||
|
|
|
@ -94,11 +94,11 @@ public class AdempiereMonitor extends HttpServlet
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger log = CLogger.getCLogger(AdempiereMonitor.class);
|
private static CLogger log = CLogger.getCLogger(AdempiereMonitor.class);
|
||||||
/** The Server */
|
/** The Server */
|
||||||
private AdempiereServerMgr m_serverMgr = null;
|
private static AdempiereServerMgr m_serverMgr = null;
|
||||||
/** Message */
|
/** Message */
|
||||||
private p m_message = null;
|
private static p m_message = null;
|
||||||
|
|
||||||
private ArrayList<File> m_dirAccessList = null;
|
private volatile static ArrayList<File> m_dirAccessList = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get
|
* Get
|
||||||
|
|
|
@ -2304,11 +2304,10 @@ public final class APanel extends CPanel
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attachment va =
|
@SuppressWarnings("unused")
|
||||||
new Attachment (AEnv.getFrame(this), m_curWindowNo,
|
Attachment va = new Attachment (AEnv.getFrame(this), m_curWindowNo,
|
||||||
m_curTab.getAD_AttachmentID(), m_curTab.getAD_Table_ID(), record_ID, null);
|
m_curTab.getAD_AttachmentID(), m_curTab.getAD_Table_ID(), record_ID, null);
|
||||||
//
|
//
|
||||||
m_curTab.loadAttachments(); // reload
|
|
||||||
aAttachment.setPressed(m_curTab.hasAttachment());
|
aAttachment.setPressed(m_curTab.hasAttachment());
|
||||||
} // attachment
|
} // attachment
|
||||||
|
|
||||||
|
@ -2345,7 +2344,6 @@ public final class APanel extends CPanel
|
||||||
m_curTab.getCM_ChatID(), m_curTab.getAD_Table_ID(), record_ID,
|
m_curTab.getCM_ChatID(), m_curTab.getAD_Table_ID(), record_ID,
|
||||||
description, null);
|
description, null);
|
||||||
//
|
//
|
||||||
m_curTab.loadChats(); // reload
|
|
||||||
aChat.setPressed(m_curTab.hasChat());
|
aChat.setPressed(m_curTab.hasChat());
|
||||||
} // chat
|
} // chat
|
||||||
|
|
||||||
|
@ -2368,7 +2366,6 @@ public final class APanel extends CPanel
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_curTab.lock (Env.getCtx(), record_ID, aLock.getButton().isSelected());
|
m_curTab.lock (Env.getCtx(), record_ID, aLock.getButton().isSelected());
|
||||||
m_curTab.loadAttachments(); // reload
|
|
||||||
}
|
}
|
||||||
aLock.setPressed(m_curTab.isLocked());
|
aLock.setPressed(m_curTab.isLocked());
|
||||||
} // lock
|
} // lock
|
||||||
|
|
|
@ -78,7 +78,7 @@ public final class Attachment extends CDialog
|
||||||
int AD_Table_ID, int Record_ID, String trxName)
|
int AD_Table_ID, int Record_ID, String trxName)
|
||||||
{
|
{
|
||||||
super (frame, Msg.getMsg(Env.getCtx(), "Attachment"), true);
|
super (frame, Msg.getMsg(Env.getCtx(), "Attachment"), true);
|
||||||
// needs to be modal otherwise APanel does not recongize change.
|
// needs to be modal otherwise APanel does not recognize change.
|
||||||
log.config("ID=" + AD_Attachment_ID
|
log.config("ID=" + AD_Attachment_ID
|
||||||
+ ", Table=" + AD_Table_ID + ", Record=" + Record_ID);
|
+ ", Table=" + AD_Table_ID + ", Record=" + Record_ID);
|
||||||
//
|
//
|
||||||
|
@ -93,10 +93,10 @@ public final class Attachment extends CDialog
|
||||||
log.log(Level.SEVERE, "", ex);
|
log.log(Level.SEVERE, "", ex);
|
||||||
}
|
}
|
||||||
// Create Model
|
// Create Model
|
||||||
if (AD_Attachment_ID == 0)
|
if (AD_Attachment_ID > 0)
|
||||||
m_attachment = new MAttachment (Env.getCtx(), AD_Table_ID, Record_ID, trxName);
|
|
||||||
else
|
|
||||||
m_attachment = new MAttachment (Env.getCtx(), AD_Attachment_ID, trxName);
|
m_attachment = new MAttachment (Env.getCtx(), AD_Attachment_ID, trxName);
|
||||||
|
else
|
||||||
|
m_attachment = new MAttachment (Env.getCtx(), AD_Table_ID, Record_ID, trxName);
|
||||||
loadAttachments();
|
loadAttachments();
|
||||||
//
|
//
|
||||||
try
|
try
|
||||||
|
@ -112,7 +112,7 @@ public final class Attachment extends CDialog
|
||||||
/** Window No */
|
/** Window No */
|
||||||
private int m_WindowNo;
|
private int m_WindowNo;
|
||||||
/** Attachment */
|
/** Attachment */
|
||||||
private MAttachment m_attachment;
|
private MAttachment m_attachment = null;
|
||||||
/** Change */
|
/** Change */
|
||||||
private boolean m_change = false;
|
private boolean m_change = false;
|
||||||
/** Logger */
|
/** Logger */
|
||||||
|
@ -380,7 +380,10 @@ public final class Attachment extends CDialog
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_attachment.delete(true);
|
m_attachment.delete(true);
|
||||||
|
m_attachment = null;
|
||||||
|
}
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
// Cancel
|
// Cancel
|
||||||
|
@ -468,8 +471,10 @@ public final class Attachment extends CDialog
|
||||||
private void deleteAttachment()
|
private void deleteAttachment()
|
||||||
{
|
{
|
||||||
log.info("");
|
log.info("");
|
||||||
if (ADialog.ask(m_WindowNo, this, "AttachmentDelete?"))
|
if (ADialog.ask(m_WindowNo, this, "AttachmentDelete?")) {
|
||||||
m_attachment.delete(true);
|
m_attachment.delete(true);
|
||||||
|
m_attachment = null;
|
||||||
|
}
|
||||||
} // deleteAttachment
|
} // deleteAttachment
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -146,7 +146,7 @@ public final class VAccountDialog extends CDialog
|
||||||
protected boolean m_changed = false;
|
protected boolean m_changed = false;
|
||||||
|
|
||||||
/** Accounting Schema */
|
/** Accounting Schema */
|
||||||
private static MAcctSchema s_AcctSchema = null;
|
private volatile static MAcctSchema s_AcctSchema = null;
|
||||||
/** MWindow for AccountCombination */
|
/** MWindow for AccountCombination */
|
||||||
private GridWindow m_mWindow = null;
|
private GridWindow m_mWindow = null;
|
||||||
/** MTab for AccountCombination */
|
/** MTab for AccountCombination */
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class AtmosphereServerPush implements ServerPush {
|
||||||
|
|
||||||
synchronized (info) {
|
synchronized (info) {
|
||||||
info.nActive = 1; //granted
|
info.nActive = 1; //granted
|
||||||
info.notify();
|
info.notifyAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -145,7 +145,7 @@ public class AtmosphereServerPush implements ServerPush {
|
||||||
_active = null;
|
_active = null;
|
||||||
|
|
||||||
synchronized (_mutex) {
|
synchronized (_mutex) {
|
||||||
_mutex.notify();
|
_mutex.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -801,7 +801,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
public void onEvent(Event event) throws Exception
|
public void onEvent(Event event) throws Exception
|
||||||
{
|
{
|
||||||
adTabbox.getSelectedGridTab().lock(Env.getCtx(), adTabbox.getSelectedGridTab().getRecord_ID(), !toolbar.getButton("Lock").isPressed());
|
adTabbox.getSelectedGridTab().lock(Env.getCtx(), adTabbox.getSelectedGridTab().getRecord_ID(), !toolbar.getButton("Lock").isPressed());
|
||||||
adTabbox.getSelectedGridTab().loadAttachments(); // reload
|
adTabbox.getSelectedGridTab().loadLocks(); // reload
|
||||||
|
|
||||||
toolbar.lock(adTabbox.getSelectedGridTab().isLocked());
|
toolbar.lock(adTabbox.getSelectedGridTab().isLocked());
|
||||||
}
|
}
|
||||||
|
@ -850,8 +850,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
EventListener<Event> listener = new EventListener<Event>() {
|
EventListener<Event> listener = new EventListener<Event>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
adTabbox.getSelectedGridTab().loadAttachments(); // reload
|
|
||||||
toolbar.getButton("Attachment").setPressed(adTabbox.getSelectedGridTab().hasAttachment());
|
toolbar.getButton("Attachment").setPressed(adTabbox.getSelectedGridTab().hasAttachment());
|
||||||
focusToActivePanel();
|
focusToActivePanel();
|
||||||
}
|
}
|
||||||
|
@ -899,8 +898,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
WChat chat = new WChat(curWindowNo, adTabbox.getSelectedGridTab().getCM_ChatID(), adTabbox.getSelectedGridTab().getAD_Table_ID(), recordId, description, null);
|
WChat chat = new WChat(curWindowNo, adTabbox.getSelectedGridTab().getCM_ChatID(), adTabbox.getSelectedGridTab().getAD_Table_ID(), recordId, description, null);
|
||||||
chat.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
chat.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
adTabbox.getSelectedGridTab().loadChats();
|
|
||||||
toolbar.getButton("Chat").setPressed(adTabbox.getSelectedGridTab().hasChat());
|
toolbar.getButton("Chat").setPressed(adTabbox.getSelectedGridTab().hasChat());
|
||||||
focusToActivePanel();
|
focusToActivePanel();
|
||||||
Clients.clearBusy(getComponent());
|
Clients.clearBusy(getComponent());
|
||||||
|
|
|
@ -16,6 +16,7 @@ package org.adempiere.webui.apps.form;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
@ -82,7 +83,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
||||||
private boolean m_isCanExport;
|
private boolean m_isCanExport;
|
||||||
|
|
||||||
private ReportEngine m_reportEngine=null;
|
private ReportEngine m_reportEngine=null;
|
||||||
public MPrintFormatItem[] pfi ;
|
public ArrayList<MPrintFormatItem> pfi ;
|
||||||
|
|
||||||
private Auxheader headerPanel=new Auxheader();
|
private Auxheader headerPanel=new Auxheader();
|
||||||
private Listbox comboReport = new Listbox();
|
private Listbox comboReport = new Listbox();
|
||||||
|
@ -140,7 +141,11 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
||||||
|
|
||||||
m_reportEngine = re;
|
m_reportEngine = re;
|
||||||
m_isCanExport=MRole.getDefault().isCanExport();
|
m_isCanExport=MRole.getDefault().isCanExport();
|
||||||
pfi= m_reportEngine.getPrintFormat().getAllItems("IsPrinted DESC, NULLIF(SeqNo,0), Name");
|
pfi = new ArrayList<MPrintFormatItem>() ;
|
||||||
|
for (MPrintFormatItem item : m_reportEngine.getPrintFormat().getAllItems("IsPrinted DESC, NULLIF(SeqNo,0), Name")) {
|
||||||
|
pfi.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_ctx = m_reportEngine.getCtx();
|
m_ctx = m_reportEngine.getCtx();
|
||||||
|
@ -229,6 +234,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
||||||
|
|
||||||
tpsc3.setMPrintFormat(fm);
|
tpsc3.setMPrintFormat(fm);
|
||||||
tpsc3.setPrintFormatItems(pfi);
|
tpsc3.setPrintFormatItems(pfi);
|
||||||
|
tpsc3.setListsColumns();
|
||||||
tpsc3.init();
|
tpsc3.init();
|
||||||
tpsc3.refresh();
|
tpsc3.refresh();
|
||||||
tpsc3.setWReportCustomization(this);
|
tpsc3.setWReportCustomization(this);
|
||||||
|
@ -359,10 +365,12 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSave() {
|
private void onSave() {
|
||||||
for (int i=0; i < pfi.length ;i++){
|
|
||||||
pfi[i].saveEx();
|
for (MPrintFormatItem item : pfi)
|
||||||
}
|
if (item.is_Changed())
|
||||||
setIsChanged(false);
|
item.saveEx();
|
||||||
|
|
||||||
|
setIsChanged(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -519,8 +527,10 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
||||||
|
|
||||||
public void copyFormat(){
|
public void copyFormat(){
|
||||||
MPrintFormat newpf=MPrintFormat.copyToClient(m_ctx, m_reportEngine.getPrintFormat().get_ID() ,Env.getAD_Client_ID(m_ctx));
|
MPrintFormat newpf=MPrintFormat.copyToClient(m_ctx, m_reportEngine.getPrintFormat().get_ID() ,Env.getAD_Client_ID(m_ctx));
|
||||||
pfi = newpf.getAllItems("IsPrinted DESC, NULLIF(SeqNo,0), Name");
|
|
||||||
|
for (MPrintFormatItem item : newpf.getAllItems("IsPrinted DESC, NULLIF(SeqNo,0), Name"))
|
||||||
|
pfi.add(item);
|
||||||
|
|
||||||
tpdf1.setMPrintFormat(newpf);
|
tpdf1.setMPrintFormat(newpf);
|
||||||
tpdf1.setPrintFormatItems(pfi);
|
tpdf1.setPrintFormatItems(pfi);
|
||||||
tpdf1.refresh();
|
tpdf1.refresh();
|
||||||
|
@ -532,6 +542,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
||||||
|
|
||||||
tpsc3.setMPrintFormat(newpf);
|
tpsc3.setMPrintFormat(newpf);
|
||||||
tpsc3.setPrintFormatItems(pfi);
|
tpsc3.setPrintFormatItems(pfi);
|
||||||
|
tpfo2.setListColumns();
|
||||||
tpsc3.refresh();
|
tpsc3.refresh();
|
||||||
|
|
||||||
tpgc4.setMPrintFormat(newpf);
|
tpgc4.setMPrintFormat(newpf);
|
||||||
|
|
|
@ -408,13 +408,11 @@ public class CustomizeGridViewPanel extends Panel
|
||||||
*/
|
*/
|
||||||
void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects)
|
void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects)
|
||||||
{
|
{
|
||||||
int length = selObjects.size();
|
|
||||||
int iniIndex =0;
|
int iniIndex =0;
|
||||||
Arrays.sort(selObjects.toArray());
|
Arrays.sort(selObjects.toArray());
|
||||||
ListElement endObject = (ListElement)yesModel.getElementAt(endIndex);
|
ListElement endObject = (ListElement)yesModel.getElementAt(endIndex);
|
||||||
|
for (ListElement selected : selObjects) {
|
||||||
for (int i = 0; i < length; i++) {
|
iniIndex = yesModel.indexOf(selected);
|
||||||
iniIndex = yesModel.indexOf(selObjects.get(i));
|
|
||||||
ListElement selObject = (ListElement)yesModel.getElementAt(iniIndex);
|
ListElement selObject = (ListElement)yesModel.getElementAt(iniIndex);
|
||||||
yesModel.removeElement(selObject);
|
yesModel.removeElement(selObject);
|
||||||
endIndex = yesModel.indexOf(endObject);
|
endIndex = yesModel.indexOf(endObject);
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class WAttachment extends Window implements EventListener<Event>
|
||||||
private int m_WindowNo;
|
private int m_WindowNo;
|
||||||
|
|
||||||
/** Attachment */
|
/** Attachment */
|
||||||
private MAttachment m_attachment;
|
private MAttachment m_attachment = null;
|
||||||
|
|
||||||
/** Change */
|
/** Change */
|
||||||
private boolean m_change = false;
|
private boolean m_change = false;
|
||||||
|
@ -168,10 +168,10 @@ public class WAttachment extends Window implements EventListener<Event>
|
||||||
|
|
||||||
// Create Model
|
// Create Model
|
||||||
|
|
||||||
if (AD_Attachment_ID == 0)
|
if (AD_Attachment_ID > 0)
|
||||||
m_attachment = new MAttachment (Env.getCtx(), AD_Table_ID, Record_ID, trxName);
|
|
||||||
else
|
|
||||||
m_attachment = new MAttachment (Env.getCtx(), AD_Attachment_ID, trxName);
|
m_attachment = new MAttachment (Env.getCtx(), AD_Attachment_ID, trxName);
|
||||||
|
else
|
||||||
|
m_attachment = new MAttachment (Env.getCtx(), AD_Table_ID, Record_ID, trxName);
|
||||||
|
|
||||||
loadAttachments();
|
loadAttachments();
|
||||||
|
|
||||||
|
@ -483,7 +483,10 @@ public class WAttachment extends Window implements EventListener<Event>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_attachment.delete(true);
|
m_attachment.delete(true);
|
||||||
|
m_attachment = null;
|
||||||
|
}
|
||||||
|
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
|
@ -614,6 +617,7 @@ public class WAttachment extends Window implements EventListener<Event>
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
m_attachment.delete(true);
|
m_attachment.delete(true);
|
||||||
|
m_attachment = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.adempiere.webui.component.Rows;
|
||||||
import org.adempiere.webui.component.Textbox;
|
import org.adempiere.webui.component.Textbox;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.compiere.print.MPrintFormat;
|
import org.compiere.print.MPrintFormat;
|
||||||
|
import org.compiere.print.MPrintFormatItem;
|
||||||
import org.compiere.util.KeyNamePair;
|
import org.compiere.util.KeyNamePair;
|
||||||
import org.compiere.util.Util;
|
import org.compiere.util.Util;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
@ -59,9 +60,9 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
|
|
||||||
m_chkboxes = new Checkbox[m_pfi.length];
|
m_chkboxes = new Checkbox[m_pfi.size()];
|
||||||
m_textBoxes = new Textbox[m_pfi.length];
|
m_textBoxes = new Textbox[m_pfi.size()];
|
||||||
m_oldLabel = new String[m_pfi.length];
|
m_oldLabel = new String[m_pfi.size()];
|
||||||
|
|
||||||
Window wind=new Window();
|
Window wind=new Window();
|
||||||
wind.setWidth("90%");
|
wind.setWidth("90%");
|
||||||
|
@ -99,20 +100,21 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
||||||
int curCol=0;
|
int curCol=0;
|
||||||
Rows rows = grid.newRows();
|
Rows rows = grid.newRows();
|
||||||
org.zkoss.zul.Row row = null;
|
org.zkoss.zul.Row row = null;
|
||||||
for(int i=0;i<m_pfi.length;i++){
|
int i=0;
|
||||||
|
for (MPrintFormatItem printItem : m_pfi){
|
||||||
if(curCol==0){
|
if(curCol==0){
|
||||||
row = new Row();
|
row = new Row();
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
}
|
}
|
||||||
m_chkboxes[i] = new Checkbox();
|
m_chkboxes[i] = new Checkbox();
|
||||||
m_chkboxes[i].setChecked(m_pfi[i].isPrinted());
|
m_chkboxes[i].setChecked(printItem.isPrinted());
|
||||||
m_chkboxes[i].addEventListener(Events.ON_CHECK,this);
|
m_chkboxes[i].addEventListener(Events.ON_CHECK,this);
|
||||||
row.appendChild(m_chkboxes[i]);
|
row.appendChild(m_chkboxes[i]);
|
||||||
|
|
||||||
m_textBoxes[i] = new Textbox();
|
m_textBoxes[i] = new Textbox();
|
||||||
String strValue = m_pfi[i].getPrintName();
|
String strValue = printItem.getPrintName();
|
||||||
if(strValue ==null || strValue.length()==0){
|
if(strValue ==null || strValue.length()==0){
|
||||||
strValue = m_pfi[i].getName();
|
strValue = printItem.getName();
|
||||||
}
|
}
|
||||||
m_oldLabel[i] = strValue;
|
m_oldLabel[i] = strValue;
|
||||||
m_textBoxes[i].setText(strValue);
|
m_textBoxes[i].setText(strValue);
|
||||||
|
@ -120,26 +122,26 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
||||||
row.appendChild(m_textBoxes[i]);
|
row.appendChild(m_textBoxes[i]);
|
||||||
|
|
||||||
curCol++;
|
curCol++;
|
||||||
|
i++;
|
||||||
curCol = curCol%RENDER_IN_COLUMNS;
|
curCol = curCol%RENDER_IN_COLUMNS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(){
|
public void save(){
|
||||||
for(int i=0;i<m_pfi.length;i++){
|
int i=0;
|
||||||
m_pfi[i].setIsActive(m_chkboxes[i].isChecked());
|
for (MPrintFormatItem item : m_pfi){
|
||||||
m_pfi[i].setPrintName(m_textBoxes[i].getText());
|
item.setIsActive(m_chkboxes[i].isChecked());
|
||||||
m_pfi[i].saveEx();
|
item.setPrintName(m_textBoxes[i].getText());
|
||||||
}
|
item.saveEx();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyNamePair[] getChecked(){
|
public KeyNamePair[] getChecked(){
|
||||||
KeyNamePair [] listcheck=new KeyNamePair[m_pfi.length];
|
KeyNamePair [] listcheck=new KeyNamePair[m_pfi.size()];
|
||||||
for(int i=0;i<m_chkboxes.length;i++){
|
for(int i=0;i<m_chkboxes.length;i++){
|
||||||
if(m_chkboxes[i].isChecked()){
|
if(m_chkboxes[i].isChecked()){
|
||||||
int ID=m_pfi[i].get_ID();
|
listcheck[i]= new KeyNamePair(m_pfi.get(i).get_ID(),m_pfi.get(i).getName());
|
||||||
String name=m_pfi[i].getName();
|
|
||||||
KeyNamePair pair=new KeyNamePair(ID, name);
|
|
||||||
listcheck[i]=pair;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -148,8 +150,8 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
for (int i=0 ; i< m_pfi.length ; i++){
|
for (int i=0 ; i< m_pfi.size(); i++){
|
||||||
m_chkboxes[i].setChecked(m_pfi[i].isPrinted());
|
m_chkboxes[i].setChecked(m_pfi.get(i).isPrinted());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,21 +159,21 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
||||||
public void updatePFI() {
|
public void updatePFI() {
|
||||||
for (int i=0 ;i < m_chkboxes.length ;i++){
|
for (int i=0 ;i < m_chkboxes.length ;i++){
|
||||||
if(m_chkboxes[i].isChecked()){
|
if(m_chkboxes[i].isChecked()){
|
||||||
m_pfi[i].setIsPrinted(true);
|
m_pfi.get(i).setIsPrinted(true);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
m_pfi[i].setIsPrinted(false);
|
m_pfi.get(i).setIsPrinted(false);
|
||||||
}
|
}
|
||||||
String printname = m_textBoxes[i].getValue();
|
String printname = m_textBoxes[i].getValue();
|
||||||
if (!Util.isEmpty(printname))
|
if (!Util.isEmpty(printname))
|
||||||
if (! printname.equals(m_pfi[i].getPrintName()))
|
if (! printname.equals(m_pfi.get(i).getPrintName()))
|
||||||
m_pfi[i].setPrintName(m_textBoxes[i].getValue());
|
m_pfi.get(i).setPrintName(m_textBoxes[i].getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePrinted(boolean value){
|
public void updatePrinted(boolean value){
|
||||||
for(int j=0 ; j< m_pfi.length ; j++){
|
for(int j=0 ; j< m_pfi.size() ; j++){
|
||||||
m_pfi[j].setIsPrinted(value);
|
m_pfi.get(j).setIsPrinted(value);
|
||||||
m_chkboxes[j].setChecked(value);
|
m_chkboxes[j].setChecked(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,10 @@
|
||||||
package org.adempiere.webui.panel;
|
package org.adempiere.webui.panel;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.adempiere.webui.component.Button;
|
import org.adempiere.webui.component.Button;
|
||||||
import org.adempiere.webui.component.ListHead;
|
import org.adempiere.webui.component.ListHead;
|
||||||
|
@ -46,12 +48,12 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private Listbox sortList;
|
|
||||||
private Button bUp = new Button();
|
private Button bUp = new Button();
|
||||||
private Button bDown = new Button();
|
private Button bDown = new Button();
|
||||||
|
|
||||||
private ArrayList<MPrintFormatItem> listColumns=new ArrayList<MPrintFormatItem>();
|
private ArrayList<MPrintFormatItem> listColumns=new ArrayList<MPrintFormatItem>();
|
||||||
SimpleListModel sortModel;
|
SimpleListModel sortModel;
|
||||||
|
private Listbox sortList;
|
||||||
|
|
||||||
public WRC2FieldOrderPanel() {
|
public WRC2FieldOrderPanel() {
|
||||||
super();
|
super();
|
||||||
|
@ -59,13 +61,9 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
||||||
|
|
||||||
public void setListColumns() {
|
public void setListColumns() {
|
||||||
listColumns = new ArrayList<MPrintFormatItem>();
|
listColumns = new ArrayList<MPrintFormatItem>();
|
||||||
if (m_pfi != null && m_pfi.length > 0) {
|
for (MPrintFormatItem item : m_pfi)
|
||||||
for (int i = 0; i < m_pfi.length; i++) {
|
if(item!=null && item.isPrinted())
|
||||||
if (m_pfi[i] != null && m_pfi[i].isPrinted()) {
|
listColumns.add(item);
|
||||||
listColumns.add(m_pfi[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init()
|
public void init()
|
||||||
|
@ -100,37 +98,21 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
||||||
ListItem targetItem = (ListItem) me.getTarget();
|
ListItem targetItem = (ListItem) me.getTarget();
|
||||||
if (draggedItem.getListbox() == targetItem.getListbox() && draggedItem.getListbox() == sortList)
|
if (draggedItem.getListbox() == targetItem.getListbox() && draggedItem.getListbox() == sortList)
|
||||||
{
|
{
|
||||||
int draggedIndex = sortList.getIndexOfItem(draggedItem);
|
List<ListElement> selObjects = new ArrayList<ListElement>();
|
||||||
int targetIndex = sortList.getIndexOfItem(targetItem);
|
int targetIndex = sortList.getIndexOfItem(targetItem);
|
||||||
ListElement targetElement = (ListElement) sortModel.getElementAt(targetIndex);
|
|
||||||
ListElement draggedElement = (ListElement) sortModel.getElementAt(draggedIndex);
|
if (!draggedItem.isSelected())
|
||||||
|
draggedItem.setSelected(true);
|
||||||
int firstposition=0, secondposition=0;
|
|
||||||
MPrintFormatItem targetPFI = null;
|
|
||||||
MPrintFormatItem draggedPFI = null;
|
|
||||||
for(int j=0 ;j <m_pfi.length ;j++){
|
|
||||||
if(m_pfi[j].get_ID() == targetElement.getKey()){
|
|
||||||
targetPFI = m_pfi[j];
|
|
||||||
firstposition=j;
|
|
||||||
}
|
|
||||||
if(m_pfi[j].get_ID() == draggedElement.getKey()){
|
|
||||||
draggedPFI = m_pfi[j];
|
|
||||||
secondposition=j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
draggedPFI.setSeqNo(targetPFI.getSeqNo()-5);
|
|
||||||
|
|
||||||
MPrintFormatItem fi=m_pfi[firstposition];
|
|
||||||
m_pfi[firstposition]=m_pfi[secondposition];
|
|
||||||
m_pfi[secondposition]=fi;
|
|
||||||
|
|
||||||
sortModel.removeElement(draggedElement);
|
|
||||||
targetIndex = sortModel.indexOf(targetElement);
|
|
||||||
sortModel.add(targetIndex, draggedElement);
|
|
||||||
|
|
||||||
|
for (Object obj : sortList.getSelectedItems()) {
|
||||||
|
ListItem listItem = (ListItem) obj;
|
||||||
|
int index = sortList.getIndexOfItem(listItem);
|
||||||
|
ListElement selObject = (ListElement)sortModel.getElementAt(index);
|
||||||
|
selObjects.add(selObject);
|
||||||
|
}
|
||||||
|
migrateValueWithinYesList (targetIndex, selObjects);
|
||||||
wc.setIsChanged(true);
|
wc.setIsChanged(true);
|
||||||
refresh();
|
refresh();
|
||||||
sortList.setSelectedIndex(targetIndex);
|
|
||||||
if ( sortList.getSelectedItem() != null)
|
if ( sortList.getSelectedItem() != null)
|
||||||
{
|
{
|
||||||
AuFocus focus = new AuFocus(sortList.getSelectedItem());
|
AuFocus focus = new AuFocus(sortList.getSelectedItem());
|
||||||
|
@ -168,12 +150,38 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
||||||
vbox.appendChild(bDown);
|
vbox.appendChild(bDown);
|
||||||
vbox.setWidth("50px");
|
vbox.setWidth("50px");
|
||||||
vbox.setHflex("60");
|
vbox.setHflex("60");
|
||||||
//vbox.setParent(wind);
|
|
||||||
hlayout.appendChild(vbox);
|
hlayout.appendChild(vbox);
|
||||||
this.appendChild(hlayout);
|
this.appendChild(hlayout);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move within Yes List with Drag Event and Multiple Choice
|
||||||
|
* @param event event
|
||||||
|
*/
|
||||||
|
void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects)
|
||||||
|
{
|
||||||
|
int iniIndex =0;
|
||||||
|
Arrays.sort(selObjects.toArray());
|
||||||
|
ListElement selObject= null;
|
||||||
|
ListElement endObject = (ListElement)sortModel.getElementAt(endIndex);
|
||||||
|
int targetPFISeq = 0;
|
||||||
|
MPrintFormatItem draggedPFI = null;
|
||||||
|
|
||||||
|
for (ListElement selected : selObjects) {
|
||||||
|
iniIndex = sortModel.indexOf(selected);
|
||||||
|
selObject = (ListElement)sortModel.getElementAt(iniIndex);
|
||||||
|
draggedPFI =listColumns.get(iniIndex);
|
||||||
|
sortModel.removeElement(selObject);
|
||||||
|
listColumns.remove(draggedPFI);
|
||||||
|
endIndex = sortModel.indexOf(endObject);
|
||||||
|
targetPFISeq = listColumns.get(endIndex).getSeqNo();
|
||||||
|
listColumns.add(endIndex, draggedPFI);
|
||||||
|
sortModel.add(endIndex, selObject);
|
||||||
|
draggedPFI.setSeqNo(targetPFISeq - 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
|
|
||||||
|
@ -194,26 +202,15 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
||||||
if (listColumns.size() > 0 && listColumns != null) {
|
if (listColumns.size() > 0 && listColumns != null) {
|
||||||
int seq = 10;
|
int seq = 10;
|
||||||
sortModel.removeAllElements();
|
sortModel.removeAllElements();
|
||||||
for (int i=0; i<listColumns.size(); i++) {
|
for (MPrintFormatItem pfi : listColumns){
|
||||||
MPrintFormatItem pfi = listColumns.get(i);
|
pfi.setSeqNo(seq);
|
||||||
if (pfi != null) {
|
m_pfi.get(m_pfi.indexOf(pfi)).setSeqNo(seq);
|
||||||
pfi.setSeqNo(seq);
|
String name= pfi.getPrintName()== null ? pfi.getName(): pfi.getPrintName() ;
|
||||||
for(int j=0 ;j<m_pfi.length;j++){
|
ListElement element =new ListElement(pfi.get_ID(), name, pfi.getSeqNo(), pfi.getAD_Client_ID(), pfi.getAD_Org_ID());
|
||||||
if(m_pfi[j].get_ID()== pfi.get_ID()){
|
sortModel.addElement(element);
|
||||||
m_pfi[j].setSeqNo(seq);
|
sortList.addItem(new KeyNamePair(m_pfi.get(m_pfi.indexOf(pfi)).get_ID(), name));
|
||||||
}
|
seq = seq + 10;
|
||||||
}
|
}
|
||||||
seq = seq + 10;
|
|
||||||
int ID = pfi.get_ID();
|
|
||||||
String name=pfi.getPrintName();
|
|
||||||
if(name == null)
|
|
||||||
name=pfi.getName();
|
|
||||||
ListElement element =new ListElement(ID, name, pfi.getSeqNo(), pfi.getAD_Client_ID(), pfi.getAD_Org_ID());
|
|
||||||
sortModel.addElement(element);
|
|
||||||
KeyNamePair pair=new KeyNamePair(ID, name);
|
|
||||||
sortList.addItem(pair);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,9 +233,8 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
||||||
return;
|
return;
|
||||||
//
|
//
|
||||||
int[] indices = sortList.getSelectedIndices();
|
int[] indices = sortList.getSelectedIndices();
|
||||||
int firstposition=0, secondposition=0;
|
|
||||||
boolean change = false;
|
boolean change = false;
|
||||||
//
|
MPrintFormatItem orig = null;
|
||||||
Object source = event.getTarget();
|
Object source = event.getTarget();
|
||||||
if (source == bUp)
|
if (source == bUp)
|
||||||
{
|
{
|
||||||
|
@ -246,26 +242,19 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
||||||
int index = indices[i];
|
int index = indices[i];
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ListElement selObject = (ListElement) sortModel.getElementAt(index);
|
ListElement selObject = (ListElement) sortModel.getElementAt(index);
|
||||||
ListElement newObject = (ListElement)sortModel.getElementAt(index - 1);
|
ListElement newObject = (ListElement)sortModel.getElementAt(index - 1);
|
||||||
|
|
||||||
sortModel.setElementAt(newObject, index);
|
sortModel.setElementAt(newObject, index);
|
||||||
sortModel.setElementAt(selObject, index - 1);
|
sortModel.setElementAt(selObject, index - 1);
|
||||||
for(int j=0 ;j <m_pfi.length ;j++){
|
|
||||||
if(m_pfi[j].get_ID() == selObject.getKey()){
|
listColumns.get(index).setSeqNo(listColumns.get(index).getSeqNo()-10);
|
||||||
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()-10);
|
orig = listColumns.get(index);
|
||||||
firstposition=j;
|
listColumns.get(index - 1).setSeqNo(listColumns.get(index - 1).getSeqNo()+10);
|
||||||
}
|
listColumns.set(index, listColumns.get(index-1));
|
||||||
if(m_pfi[j].get_ID() == newObject.getKey()){
|
listColumns.set(index-1 , orig);
|
||||||
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()+10);
|
|
||||||
secondposition=j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
indices[i] = index - 1;
|
indices[i] = index - 1;
|
||||||
change = true;
|
change = true;
|
||||||
MPrintFormatItem fi=m_pfi[firstposition];
|
|
||||||
m_pfi[firstposition]=m_pfi[secondposition];
|
|
||||||
m_pfi[secondposition]=fi;
|
|
||||||
}
|
}
|
||||||
} // up
|
} // up
|
||||||
|
|
||||||
|
@ -277,36 +266,24 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
||||||
break;
|
break;
|
||||||
ListElement selObject = (ListElement) sortModel.getElementAt(index);
|
ListElement selObject = (ListElement) sortModel.getElementAt(index);
|
||||||
ListElement newObject = (ListElement)sortModel.getElementAt(index + 1);
|
ListElement newObject = (ListElement)sortModel.getElementAt(index + 1);
|
||||||
/*if (!selObject.isUpdateable() || !newObject.isUpdateable())
|
|
||||||
break;*/
|
|
||||||
sortModel.setElementAt(newObject, index);
|
sortModel.setElementAt(newObject, index);
|
||||||
sortModel.setElementAt(selObject, index + 1);
|
sortModel.setElementAt(selObject, index + 1);
|
||||||
sortList.setSelectedIndex(index + 1);
|
//
|
||||||
for(int j=0 ;j <m_pfi.length ;j++){
|
listColumns.get(index).setSeqNo(listColumns.get(index).getSeqNo()+10);
|
||||||
if(m_pfi[j].get_ID() == selObject.getKey()){
|
orig = m_pfi.get(index);
|
||||||
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()+10);
|
listColumns.get(index + 1).setSeqNo(listColumns.get(index + 1).getSeqNo()-10);
|
||||||
firstposition=j;
|
listColumns.set(index, listColumns.get(index+1));
|
||||||
}
|
listColumns.set(index+1,orig);
|
||||||
if(m_pfi[j].get_ID() == newObject.getKey()){
|
|
||||||
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()-10);
|
|
||||||
secondposition=j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
indices[i] = index + 1;
|
indices[i] = index + 1;
|
||||||
change = true;
|
change = true;
|
||||||
MPrintFormatItem fi=m_pfi[firstposition];
|
|
||||||
m_pfi[firstposition]=m_pfi[secondposition];
|
|
||||||
m_pfi[secondposition]=fi;
|
|
||||||
}
|
}
|
||||||
} // down
|
} // down
|
||||||
|
|
||||||
//
|
|
||||||
if (change) {
|
if (change) {
|
||||||
sortList.setSelectedIndices(indices);
|
sortList.setSelectedIndices(indices);
|
||||||
int idx = sortList.getSelectedIndex();
|
|
||||||
refresh();
|
refresh();
|
||||||
wc.setIsChanged(true);
|
wc.setIsChanged(true);
|
||||||
sortList.setSelectedIndex(idx);
|
|
||||||
if ( sortList.getSelectedItem() != null)
|
if ( sortList.getSelectedItem() != null)
|
||||||
{
|
{
|
||||||
AuFocus focus = new AuFocus(sortList.getSelectedItem());
|
AuFocus focus = new AuFocus(sortList.getSelectedItem());
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
package org.adempiere.webui.panel;
|
package org.adempiere.webui.panel;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -37,6 +38,7 @@ import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
import org.zkoss.zk.ui.util.Clients;
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
import org.zkoss.zul.Hlayout;
|
import org.zkoss.zul.Hlayout;
|
||||||
|
|
||||||
import org.zkoss.zul.Vbox;
|
import org.zkoss.zul.Vbox;
|
||||||
|
|
||||||
public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener<Event>
|
public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener<Event>
|
||||||
|
@ -53,15 +55,13 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
||||||
private Button bRemove = new Button();
|
private Button bRemove = new Button();
|
||||||
private Button bUp = new Button();
|
private Button bUp = new Button();
|
||||||
private Button bDown = new Button();
|
private Button bDown = new Button();
|
||||||
|
|
||||||
public ArrayList<MPrintFormatItem> yesItems=new ArrayList<MPrintFormatItem>();
|
|
||||||
public ArrayList<MPrintFormatItem> noItems=new ArrayList<MPrintFormatItem>();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
SimpleListModel noModel = new SimpleListModel();
|
SimpleListModel noModel = new SimpleListModel();
|
||||||
SimpleListModel yesModel = new SimpleListModel();
|
SimpleListModel yesModel = new SimpleListModel();
|
||||||
Listbox noList = new Listbox();
|
Listbox noList = new Listbox();
|
||||||
Listbox yesList = new Listbox();
|
Listbox yesList = new Listbox();
|
||||||
|
ArrayList<MPrintFormatItem> yesItems =new ArrayList<MPrintFormatItem>();
|
||||||
|
ArrayList<MPrintFormatItem> noItems =new ArrayList<MPrintFormatItem>();
|
||||||
|
|
||||||
public WRC3SortCriteriaPanel() {
|
public WRC3SortCriteriaPanel() {
|
||||||
super();
|
super();
|
||||||
|
@ -110,59 +110,7 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
||||||
noList.addOnDropListener(crossListMouseListener);
|
noList.addOnDropListener(crossListMouseListener);
|
||||||
yesList.setItemDraggable(true);
|
yesList.setItemDraggable(true);
|
||||||
noList.setItemDraggable(true);
|
noList.setItemDraggable(true);
|
||||||
|
|
||||||
EventListener<Event> yesListMouseMotionListener = new EventListener<Event>()
|
|
||||||
{
|
|
||||||
public void onEvent(Event event) throws Exception {
|
|
||||||
if (event instanceof DropEvent)
|
|
||||||
{
|
|
||||||
DropEvent me = (DropEvent) event;
|
|
||||||
ListItem startItem = (ListItem) me.getDragged();
|
|
||||||
ListItem endItem = (ListItem) me.getTarget();
|
|
||||||
if (startItem.getListbox() == endItem.getListbox() && startItem.getListbox() == yesList)
|
|
||||||
{
|
|
||||||
int startIndex = yesList.getIndexOfItem(startItem);
|
|
||||||
int endIndex = yesList.getIndexOfItem(endItem);
|
|
||||||
ListElement endElement = (ListElement) yesModel.getElementAt(endIndex);
|
|
||||||
ListElement startElement = (ListElement) yesModel.getElementAt(startIndex);
|
|
||||||
yesModel.removeElement(startElement);
|
|
||||||
endIndex = yesModel.indexOf(endElement);
|
|
||||||
yesModel.add(endIndex, startElement);
|
|
||||||
yesList.setSelectedIndex(endIndex);
|
|
||||||
|
|
||||||
int firstposition=0, secondposition=0;
|
|
||||||
MPrintFormatItem targetPFI = null;
|
|
||||||
MPrintFormatItem draggedPFI = null;
|
|
||||||
for(int j=0 ;j <m_pfi.length ;j++){
|
|
||||||
if(m_pfi[j].get_ID() == endElement.getKey()){
|
|
||||||
targetPFI = m_pfi[j];
|
|
||||||
firstposition=j;
|
|
||||||
}
|
|
||||||
if(m_pfi[j].get_ID() == startElement.getKey()){
|
|
||||||
draggedPFI = m_pfi[j];
|
|
||||||
secondposition=j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
draggedPFI.setSeqNo(targetPFI.getSeqNo()-5);
|
|
||||||
|
|
||||||
wc.setIsChanged(true);
|
|
||||||
updateYesList();
|
|
||||||
MPrintFormatItem fi=m_pfi[firstposition];
|
|
||||||
m_pfi[firstposition]=m_pfi[secondposition];
|
|
||||||
m_pfi[secondposition]=fi;
|
|
||||||
|
|
||||||
if ( yesList.getSelectedItem() != null)
|
|
||||||
{
|
|
||||||
AuFocus focus = new AuFocus(yesList.getSelectedItem());
|
|
||||||
Clients.response(focus);
|
|
||||||
}
|
|
||||||
//setIsChanged(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
yesList.addOnDropListener(yesListMouseMotionListener);
|
|
||||||
|
|
||||||
ListHead listHead = new ListHead();
|
ListHead listHead = new ListHead();
|
||||||
listHead.setParent(yesList);
|
listHead.setParent(yesList);
|
||||||
ListHeader listHeader = new ListHeader();
|
ListHeader listHeader = new ListHeader();
|
||||||
|
@ -219,69 +167,54 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void setListsColumns() {
|
||||||
public void refresh() {
|
|
||||||
yesItems =new ArrayList<MPrintFormatItem>();
|
yesItems =new ArrayList<MPrintFormatItem>();
|
||||||
noItems =new ArrayList<MPrintFormatItem>();
|
noItems =new ArrayList<MPrintFormatItem>();
|
||||||
if (m_pfi.length > 0 && m_pfi != null ) {
|
for(int i=0 ; i< m_pfi.size();i++){
|
||||||
int seq = 10;
|
MPrintFormatItem item = m_pfi.get(i);
|
||||||
for(int i=0 ; i < m_pfi.length ; i++ ){
|
if(item!=null && item.isPrinted()){
|
||||||
if (m_pfi[i].isPrinted() && m_pfi[i] != null) {
|
if(item.isOrderBy()){
|
||||||
if (m_pfi[i].isOrderBy()) {
|
yesItems.add(item);
|
||||||
m_pfi[i].setSortNo(seq);
|
}else{
|
||||||
seq=seq+10;
|
noItems.add(item);
|
||||||
yesItems.add(m_pfi[i]);
|
}
|
||||||
} else{
|
}
|
||||||
noItems.add(m_pfi[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(yesItems, new Comparator<MPrintFormatItem>() {
|
Collections.sort(yesItems, new Comparator<MPrintFormatItem>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(MPrintFormatItem o1, MPrintFormatItem o2) {
|
public int compare(MPrintFormatItem o1, MPrintFormatItem o2) {
|
||||||
return o1.getSortNo()-o2.getSortNo();
|
return o1.getSortNo()-o2.getSortNo();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void refresh() {
|
||||||
|
|
||||||
|
this.setListsColumns();
|
||||||
yesList.removeAllItems();
|
yesList.removeAllItems();
|
||||||
noList.removeAllItems();
|
noList.removeAllItems();
|
||||||
|
|
||||||
if (yesItems.size() > 0 && yesItems != null) {
|
if (yesItems.size() > 0 && yesItems != null) {
|
||||||
yesModel.removeAllElements();
|
yesModel.removeAllElements();
|
||||||
for (int i=0 ; i < yesItems.size() ; i++) {
|
for (int i=0 ; i < yesItems.size() ; i++) {
|
||||||
MPrintFormatItem pfi = yesItems.get(i);
|
int ID= yesItems.get(i).get_ID();
|
||||||
if (pfi != null) {
|
String name = yesItems.get(i).getPrintName()==null? yesItems.get(i).getName():yesItems.get(i).getPrintName();
|
||||||
int ID= pfi.get_ID();
|
yesList.addItem(new KeyNamePair(ID, name));
|
||||||
String name =pfi.getPrintName();
|
yesModel.addElement(new ListElement(ID, name, yesItems.get(i).getSortNo(), true, yesItems.get(i).getAD_Client_ID(), yesItems.get(i).getAD_Org_ID()));
|
||||||
if(name == null)
|
|
||||||
name=pfi.getName();
|
|
||||||
KeyNamePair pair =new KeyNamePair(ID, name);
|
|
||||||
yesList.addItem(pair);
|
|
||||||
ListElement element =new ListElement(pfi.get_ID(), pfi.getName(), pfi.getSortNo(), true, pfi.getAD_Client_ID(), pfi.getAD_Org_ID());
|
|
||||||
yesModel.addElement(element);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noItems.size() > 0 && noItems != null) {
|
if (noItems.size() > 0 && noItems != null) {
|
||||||
noModel.removeAllElements();
|
noModel.removeAllElements();
|
||||||
for (int i=0 ; i < noItems.size() ; i++) {
|
for (int i=0 ; i < noItems.size() ; i++) {
|
||||||
MPrintFormatItem pfi = noItems.get(i);
|
int ID= noItems.get(i).get_ID();
|
||||||
if (pfi != null) {
|
String name = noItems.get(i).getPrintName()== null ? noItems.get(i).getName() : noItems.get(i).getPrintName();
|
||||||
int ID= pfi.get_ID();
|
noItems.get(i).setSortNo(0);
|
||||||
pfi.setSortNo(0);
|
noItems.get(i).setIsOrderBy(false);
|
||||||
pfi.setIsOrderBy(false);
|
noList.addItem(new KeyNamePair(ID, name));
|
||||||
String name =pfi.getPrintName();
|
noModel.add(i,new ListElement(ID, name, noItems.get(i).getSortNo(), false, noItems.get(i).getAD_Client_ID(), noItems.get(i).getAD_Org_ID()));
|
||||||
if(name == null)
|
|
||||||
name=pfi.getName();
|
|
||||||
KeyNamePair pair =new KeyNamePair(ID, name);
|
|
||||||
noList.addItem(pair);
|
|
||||||
ListElement element =new ListElement(pfi.get_ID(), pfi.getName(), pfi.getSortNo(), false, pfi.getAD_Client_ID(), pfi.getAD_Org_ID());
|
|
||||||
noModel.add(i,element);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -302,45 +235,104 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
||||||
}
|
}
|
||||||
Listbox listFrom = (source == bAdd || source == noList) ? noList : yesList;
|
Listbox listFrom = (source == bAdd || source == noList) ? noList : yesList;
|
||||||
Listbox listTo = (source == bAdd || source == noList) ? yesList : noList;
|
Listbox listTo = (source == bAdd || source == noList) ? yesList : noList;
|
||||||
SimpleListModel lmFrom = (source == bAdd || source == noList) ?
|
|
||||||
noModel : yesModel;
|
int endIndex = yesList.getIndexOfItem(listTo.getSelectedItem());
|
||||||
SimpleListModel lmTo = (lmFrom == yesModel) ? noModel : yesModel;
|
//Listto is empty.
|
||||||
|
if (endIndex<0 )
|
||||||
|
endIndex=0;
|
||||||
|
|
||||||
|
migrateLists (listFrom,listTo,endIndex);
|
||||||
|
} // migrateValueAcrossLists
|
||||||
|
|
||||||
|
void migrateLists (Listbox listFrom , Listbox listTo , int endIndex)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
SimpleListModel lmFrom = (listFrom == yesList) ? yesModel:noModel;
|
||||||
|
SimpleListModel lmTo = (lmFrom == yesModel) ? noModel:yesModel;
|
||||||
Set<?> selectedItems = listFrom.getSelectedItems();
|
Set<?> selectedItems = listFrom.getSelectedItems();
|
||||||
List<ListElement> selObjects = new ArrayList<ListElement>();
|
List<ListElement> selObjects = new ArrayList<ListElement>();
|
||||||
for (Object obj : selectedItems) {
|
for (Object obj : selectedItems) {
|
||||||
ListItem listItem = (ListItem) obj;
|
ListItem listItem = (ListItem) obj;
|
||||||
int index = listFrom.getIndexOfItem(listItem);
|
index = listFrom.getIndexOfItem(listItem);
|
||||||
ListElement selObject = (ListElement)lmFrom.getElementAt(index);
|
ListElement selObject = (ListElement)lmFrom.getElementAt(index);
|
||||||
selObjects.add(selObject);
|
selObjects.add(selObject);
|
||||||
}
|
}
|
||||||
|
index = 0;
|
||||||
|
boolean reOrder = false;
|
||||||
|
Arrays.sort(selObjects.toArray());
|
||||||
for (ListElement selObject : selObjects)
|
for (ListElement selObject : selObjects)
|
||||||
{
|
{
|
||||||
if (selObject == null)
|
if (selObject == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lmFrom.removeElement(selObject);
|
lmFrom.removeElement(selObject);
|
||||||
lmTo.addElement(selObject);
|
lmTo.add(endIndex, selObject);
|
||||||
|
index = m_pfi.indexOf(getPrintFormatItem(selObject.m_key));
|
||||||
for (int j=0 ; j<m_pfi.length ; j++) {
|
if(listFrom.equals(noList)) {
|
||||||
if (m_pfi[j].get_ID() == selObject.m_key) {
|
m_pfi.get(index).setIsOrderBy(true);
|
||||||
if (listFrom.equals(noList)) {
|
reOrder =true;
|
||||||
m_pfi[j].setIsOrderBy(true);
|
}else{
|
||||||
} else {
|
m_pfi.get(index).setIsOrderBy(false);
|
||||||
m_pfi[j].setIsOrderBy(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
wc.setIsChanged(true);
|
|
||||||
}
|
}
|
||||||
|
if(reOrder){
|
||||||
|
int sortNo =10;
|
||||||
|
ArrayList<ListElement> pp = new ArrayList<ListElement>();
|
||||||
|
for(int i=0 ; i<lmTo.getSize(); i++) {
|
||||||
|
ListElement aux = (ListElement)lmTo.getElementAt(i);
|
||||||
|
aux.setSortNo(sortNo);
|
||||||
|
sortNo =+10;
|
||||||
|
pp.add(aux);
|
||||||
|
}
|
||||||
|
Collections.sort(pp, new Comparator<ListElement>() {
|
||||||
|
@Override
|
||||||
|
public int compare(ListElement o1, ListElement o2) {
|
||||||
|
return o1.getSortNo()-o2.getSortNo();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
for(ListElement ele : pp) {
|
||||||
|
int auxIndex = m_pfi.indexOf(getPrintFormatItem(ele.m_key));
|
||||||
|
m_pfi.get(auxIndex).setSortNo(sortNo);
|
||||||
|
sortNo = sortNo + 10;
|
||||||
|
}
|
||||||
|
wc.setIsChanged(true);
|
||||||
|
}
|
||||||
refresh();
|
refresh();
|
||||||
if ( listTo.getSelectedItem() != null)
|
if ( listTo.getSelectedItem() != null)
|
||||||
{
|
{
|
||||||
AuFocus focus = new AuFocus(listTo.getSelectedItem());
|
AuFocus focus = new AuFocus(listTo.getSelectedItem());
|
||||||
Clients.response(focus);
|
Clients.response(focus);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} // migrateValueAcrossLists
|
|
||||||
|
/**
|
||||||
|
* Move within Yes List with Drag Event and Multiple Choice
|
||||||
|
* @param event event
|
||||||
|
*/
|
||||||
|
void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects)
|
||||||
|
{
|
||||||
|
int iniIndex =0;
|
||||||
|
Arrays.sort(selObjects.toArray());
|
||||||
|
ListElement selObject= null;
|
||||||
|
ListElement endObject = (ListElement)yesModel.getElementAt(endIndex);
|
||||||
|
for (ListElement selected : selObjects) {
|
||||||
|
iniIndex = yesModel.indexOf(selected);
|
||||||
|
selObject = (ListElement)yesModel.getElementAt(iniIndex);
|
||||||
|
yesModel.removeElement(selObject);
|
||||||
|
endIndex = yesModel.indexOf(endObject);
|
||||||
|
yesModel.add(endIndex, selObject);
|
||||||
|
}
|
||||||
|
int sortNo = 10;
|
||||||
|
int auxIndex =0;
|
||||||
|
yesList.removeAllItems();
|
||||||
|
for(int i=0 ; i<yesModel.getSize(); i++) {
|
||||||
|
ListElement pp = (ListElement)yesModel.getElementAt(i);
|
||||||
|
auxIndex = m_pfi.indexOf(getPrintFormatItem(pp.m_key));
|
||||||
|
m_pfi.get(auxIndex).setSortNo(sortNo);
|
||||||
|
yesList.addItem(new KeyNamePair(pp.m_key, pp.getName()));
|
||||||
|
sortNo = sortNo + 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move within Yes List
|
* Move within Yes List
|
||||||
|
@ -358,7 +350,8 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
||||||
int[] indices = yesList.getSelectedIndices();
|
int[] indices = yesList.getSelectedIndices();
|
||||||
//
|
//
|
||||||
boolean change = false;
|
boolean change = false;
|
||||||
//
|
int selectedPI = 0 , targetPI = 0;
|
||||||
|
MPrintFormatItem orig = null;
|
||||||
Object source = event.getTarget();
|
Object source = event.getTarget();
|
||||||
if (source == bUp)
|
if (source == bUp)
|
||||||
{
|
{
|
||||||
|
@ -371,6 +364,18 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
||||||
|
|
||||||
yesModel.setElementAt(newObject, index);
|
yesModel.setElementAt(newObject, index);
|
||||||
yesModel.setElementAt(selObject, index - 1);
|
yesModel.setElementAt(selObject, index - 1);
|
||||||
|
yesList.setSelectedIndex(index - 1);
|
||||||
|
|
||||||
|
selectedPI = m_pfi.indexOf(getPrintFormatItem(selObject.m_key));
|
||||||
|
targetPI = m_pfi.indexOf(getPrintFormatItem(newObject.m_key));
|
||||||
|
updateSortNo (selectedPI,targetPI);
|
||||||
|
|
||||||
|
yesItems.get(index).setSortNo(yesItems.get(index).getSortNo()-10);
|
||||||
|
orig = yesItems.get(index);
|
||||||
|
yesItems.get(index - 1).setSeqNo(yesItems.get(index - 1).getSeqNo()+10);
|
||||||
|
yesItems.set(index, yesItems.get(index-1));
|
||||||
|
yesItems.set(index-1 , orig);
|
||||||
|
|
||||||
indices[i] = index - 1;
|
indices[i] = index - 1;
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
|
@ -388,15 +393,30 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
||||||
yesModel.setElementAt(newObject, index);
|
yesModel.setElementAt(newObject, index);
|
||||||
yesModel.setElementAt(selObject, index + 1);
|
yesModel.setElementAt(selObject, index + 1);
|
||||||
yesList.setSelectedIndex(index + 1);
|
yesList.setSelectedIndex(index + 1);
|
||||||
|
|
||||||
|
selectedPI = m_pfi.indexOf(getPrintFormatItem(selObject.m_key));
|
||||||
|
targetPI = m_pfi.indexOf(getPrintFormatItem(newObject.m_key));
|
||||||
|
updateSortNo (selectedPI,targetPI);
|
||||||
|
|
||||||
|
yesItems.get(index).setSeqNo(yesItems.get(index).getSeqNo()+10);
|
||||||
|
orig = m_pfi.get(index);
|
||||||
|
yesItems.get(index + 1).setSeqNo(yesItems.get(index + 1).getSeqNo()-10);
|
||||||
|
yesItems.set(index, yesItems.get(index+1));
|
||||||
|
yesItems.set(index+1,orig);
|
||||||
|
|
||||||
indices[i] = index + 1;
|
indices[i] = index + 1;
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
} // down
|
} // down
|
||||||
|
|
||||||
//
|
//
|
||||||
if (change) {
|
if (change) {
|
||||||
yesList.setSelectedIndices(indices);
|
yesList.removeAllItems();
|
||||||
updateYesList();
|
for(int i=0 ; i<yesModel.getSize(); i++) {
|
||||||
|
ListElement pp = (ListElement)yesModel.getElementAt(i);
|
||||||
|
yesList.addItem(new KeyNamePair(pp.m_key, pp.getName()));
|
||||||
|
}
|
||||||
|
wc.setIsChanged(true);
|
||||||
if ( yesList.getSelectedItem() != null)
|
if ( yesList.getSelectedItem() != null)
|
||||||
{
|
{
|
||||||
AuFocus focus = new AuFocus(yesList.getSelectedItem());
|
AuFocus focus = new AuFocus(yesList.getSelectedItem());
|
||||||
|
@ -405,23 +425,15 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
||||||
}
|
}
|
||||||
} // migrateValueWithinYesList
|
} // migrateValueWithinYesList
|
||||||
|
|
||||||
public void updateYesList(){
|
|
||||||
yesList.removeAllItems();
|
/**
|
||||||
wc.setIsChanged(true);
|
* @param int selIndexPI,int targetIndexPI
|
||||||
int sortNo=10;
|
*/
|
||||||
for(int i=0;i<yesModel.getSize();i++){
|
private void updateSortNo(int selIndexPI,int targetIndexPI)
|
||||||
ListElement obj=(ListElement) yesModel.getElementAt(i);
|
{
|
||||||
for(int j=0;j<m_pfi.length;j++){
|
int selSortNo = m_pfi.get(selIndexPI).getSortNo();
|
||||||
if(m_pfi[j].get_ID() == obj.getKey()){
|
m_pfi.get(selIndexPI).setSortNo(m_pfi.get(targetIndexPI).getSortNo());
|
||||||
String name=obj.getName();
|
m_pfi.get(targetIndexPI).setSortNo(selSortNo);
|
||||||
int ID=obj.getKey();
|
|
||||||
KeyNamePair pair=new KeyNamePair(ID, name);
|
|
||||||
yesList.addItem(pair);
|
|
||||||
m_pfi[j].setSortNo(sortNo);
|
|
||||||
sortNo=sortNo+10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -520,45 +532,36 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
int endIndex=0;
|
|
||||||
if (event instanceof DropEvent)
|
if (event instanceof DropEvent)
|
||||||
{
|
{
|
||||||
|
int endIndex = 0;
|
||||||
DropEvent me = (DropEvent) event;
|
DropEvent me = (DropEvent) event;
|
||||||
|
|
||||||
ListItem endItem = (ListItem) me.getTarget();
|
ListItem endItem = (ListItem) me.getTarget();
|
||||||
if (!(endItem.getListbox() == yesList))
|
|
||||||
{
|
|
||||||
return; // move within noList
|
|
||||||
}
|
|
||||||
|
|
||||||
ListItem startItem = (ListItem) me.getDragged();
|
ListItem startItem = (ListItem) me.getDragged();
|
||||||
if (startItem.getListbox() == endItem.getListbox())
|
|
||||||
|
if (!startItem.isSelected())
|
||||||
|
startItem.setSelected(true);
|
||||||
|
|
||||||
|
if (!(startItem.getListbox() == endItem.getListbox()))
|
||||||
{
|
{
|
||||||
return; //move within same list
|
Listbox listFrom = (Listbox)startItem.getListbox();
|
||||||
}
|
Listbox listTo = (Listbox)endItem.getListbox();
|
||||||
int startIndex = noList.getIndexOfItem(startItem);
|
endIndex = yesList.getIndexOfItem(endItem);
|
||||||
ListElement element = (ListElement) noModel.getElementAt(startIndex);
|
migrateLists (listFrom,listTo,endIndex);
|
||||||
noModel.removeElement(element);
|
}else if (startItem.getListbox() == endItem.getListbox() && startItem.getListbox() == yesList)
|
||||||
endIndex = yesList.getIndexOfItem(endItem);
|
{
|
||||||
yesModel.add(endIndex, element);
|
List<ListElement> selObjects = new ArrayList<ListElement>();
|
||||||
|
endIndex = yesList.getIndexOfItem(endItem);
|
||||||
for (int j=0 ; j<m_pfi.length ; j++) {
|
for (Object obj : yesList.getSelectedItems()) {
|
||||||
if (m_pfi[j].get_ID() == element.m_key) {
|
ListItem listItem = (ListItem) obj;
|
||||||
m_pfi[j].setIsOrderBy(true);
|
int index = yesList.getIndexOfItem(listItem);
|
||||||
m_pfi[j].setSortNo(endIndex*10);
|
ListElement selObject = (ListElement)yesModel.getElementAt(index);
|
||||||
|
selObjects.add(selObject);
|
||||||
}
|
}
|
||||||
|
migrateValueWithinYesList (endIndex, selObjects);
|
||||||
}
|
}
|
||||||
wc.setIsChanged(true);
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
refresh();
|
|
||||||
//
|
|
||||||
noList.clearSelection();
|
|
||||||
yesList.clearSelection();
|
|
||||||
|
|
||||||
yesList.setSelectedIndex(endIndex);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,9 +48,9 @@ public class WRC4GroupingCriteriaPanel extends WRCTabPanel implements EventListe
|
||||||
@Override
|
@Override
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
orderfield = new ArrayList<MPrintFormatItem>();
|
orderfield = new ArrayList<MPrintFormatItem>();
|
||||||
for(int i=0 ; i < m_pfi.length ; i++){
|
for(int i=0 ; i < m_pfi.size(); i++){
|
||||||
if(m_pfi[i] != null && m_pfi[i].isOrderBy() && m_pfi[i].isPrinted()){
|
if(m_pfi.get(i) != null && m_pfi.get(i).isOrderBy() && m_pfi.get(i).isPrinted()){
|
||||||
orderfield.add(m_pfi[i]);
|
orderfield.add(m_pfi.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dynamicInit();
|
dynamicInit();
|
||||||
|
@ -59,11 +59,8 @@ public class WRC4GroupingCriteriaPanel extends WRCTabPanel implements EventListe
|
||||||
@Override
|
@Override
|
||||||
public void updatePFI() {
|
public void updatePFI() {
|
||||||
for(int i=0 ; i<orderfield.size() ; i++){
|
for(int i=0 ; i<orderfield.size() ; i++){
|
||||||
for(int j=0 ;j<m_pfi.length ; j++){
|
int j = m_pfi.indexOf(getPrintFormatItem(orderfield.get(i).get_ID()));
|
||||||
if(orderfield.get(i).get_ID() == m_pfi[j].get_ID()){
|
m_pfi.get(j).setIsGroupBy(m_chkboxes[i].isChecked());
|
||||||
m_pfi[j].setIsGroupBy(m_chkboxes[i].isChecked());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +99,6 @@ public class WRC4GroupingCriteriaPanel extends WRCTabPanel implements EventListe
|
||||||
columns.appendChild(cols[i+1]);
|
columns.appendChild(cols[i+1]);
|
||||||
}
|
}
|
||||||
grid.appendChild(columns);
|
grid.appendChild(columns);
|
||||||
|
|
||||||
this.appendChild(wind);
|
this.appendChild(wind);
|
||||||
wind.appendChild(grid);
|
wind.appendChild(grid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,9 +84,9 @@ public class WRC5SummaryFieldsPanel extends WRCTabPanel implements EventListener
|
||||||
@Override
|
@Override
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
DisplayItems = new ArrayList<MPrintFormatItem>();
|
DisplayItems = new ArrayList<MPrintFormatItem>();
|
||||||
for(int i=0 ; i<m_pfi.length ; i ++){
|
for(int i=0 ; i<m_pfi.size() ; i ++){
|
||||||
if(m_pfi[i] != null && m_pfi[i].isPrinted()){
|
if(m_pfi.get(i) != null && m_pfi.get(i).isPrinted()){
|
||||||
DisplayItems.add(m_pfi[i]);
|
DisplayItems.add(m_pfi.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dynamicInit();
|
dynamicInit();
|
||||||
|
@ -95,17 +95,14 @@ public class WRC5SummaryFieldsPanel extends WRCTabPanel implements EventListener
|
||||||
@Override
|
@Override
|
||||||
public void updatePFI() {
|
public void updatePFI() {
|
||||||
for(int i=0 ;i<DisplayItems.size() ; i++){
|
for(int i=0 ;i<DisplayItems.size() ; i++){
|
||||||
for(int j=0 ; j<m_pfi.length ; j++){
|
int j = m_pfi.indexOf(getPrintFormatItem(DisplayItems.get(i).get_ID()));
|
||||||
if(DisplayItems.get(i).get_ID() == m_pfi[j].get_ID()){
|
m_pfi.get(j).setIsSummarized(m_chkSum[i].isChecked());
|
||||||
m_pfi[j].setIsSummarized(m_chkSum[i].isChecked());
|
m_pfi.get(j).setIsCounted(m_chkCount[i].isChecked());
|
||||||
m_pfi[j].setIsCounted(m_chkCount[i].isChecked());
|
m_pfi.get(j).setIsMinCalc(m_chkMin[i].isChecked());
|
||||||
m_pfi[j].setIsMinCalc(m_chkMin[i].isChecked());
|
m_pfi.get(j).setIsMaxCalc(m_chkMax[i].isChecked());
|
||||||
m_pfi[j].setIsMaxCalc(m_chkMax[i].isChecked());
|
m_pfi.get(j).setIsAveraged(m_chkMean[i].isChecked());
|
||||||
m_pfi[j].setIsAveraged(m_chkMean[i].isChecked());
|
m_pfi.get(j).setIsVarianceCalc(m_chkVariance[i].isChecked());
|
||||||
m_pfi[j].setIsVarianceCalc(m_chkVariance[i].isChecked());
|
m_pfi.get(j).setIsDeviationCalc(m_chkDesviation[i].isChecked());
|
||||||
m_pfi[j].setIsDeviationCalc(m_chkDesviation[i].isChecked());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,14 @@
|
||||||
|
|
||||||
package org.adempiere.webui.panel;
|
package org.adempiere.webui.panel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.adempiere.webui.apps.form.WReportCustomization;
|
import org.adempiere.webui.apps.form.WReportCustomization;
|
||||||
import org.adempiere.webui.component.Tabpanel;
|
import org.adempiere.webui.component.Tabpanel;
|
||||||
|
import org.compiere.model.GridField;
|
||||||
|
import org.compiere.model.MField;
|
||||||
import org.compiere.print.MPrintFormat;
|
import org.compiere.print.MPrintFormat;
|
||||||
import org.compiere.print.MPrintFormatItem;
|
import org.compiere.print.MPrintFormatItem;
|
||||||
|
|
||||||
|
@ -25,9 +31,10 @@ public abstract class WRCTabPanel extends Tabpanel {
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -6858669581232541371L;
|
private static final long serialVersionUID = -6858669581232541371L;
|
||||||
|
|
||||||
public MPrintFormatItem[] m_pfi;
|
public ArrayList<MPrintFormatItem> m_pfi;
|
||||||
public MPrintFormat m_pf;
|
public MPrintFormat m_pf;
|
||||||
public WReportCustomization wc;
|
public WReportCustomization wc;
|
||||||
|
public Map<Integer, MPrintFormatItem> mapPFormatItem = new HashMap<Integer, MPrintFormatItem>();
|
||||||
|
|
||||||
public abstract void refresh();
|
public abstract void refresh();
|
||||||
|
|
||||||
|
@ -35,14 +42,21 @@ public abstract class WRCTabPanel extends Tabpanel {
|
||||||
|
|
||||||
public void setMPrintFormat(MPrintFormat pf) {
|
public void setMPrintFormat(MPrintFormat pf) {
|
||||||
m_pf=pf;
|
m_pf=pf;
|
||||||
|
for (MPrintFormatItem item : m_pf.getAllItems() ){
|
||||||
|
mapPFormatItem.put(item.get_ID(), item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrintFormatItems(MPrintFormatItem[] pfis) {
|
public void setPrintFormatItems(ArrayList<MPrintFormatItem> pfis) {
|
||||||
m_pfi = pfis;
|
m_pfi = pfis;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWReportCustomization(WReportCustomization parent){
|
public void setWReportCustomization(WReportCustomization parent){
|
||||||
wc=parent;
|
wc=parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MPrintFormatItem getPrintFormatItem(int AD_PrintFormatItem_ID) {
|
||||||
|
return mapPFormatItem.get(AD_PrintFormatItem_ID);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ public final class WAccountDialog extends Window
|
||||||
protected boolean m_changed = false;
|
protected boolean m_changed = false;
|
||||||
|
|
||||||
/** Accounting Schema */
|
/** Accounting Schema */
|
||||||
private static MAcctSchema s_AcctSchema = null;
|
private volatile static MAcctSchema s_AcctSchema = null;
|
||||||
/** MWindow for AccountCombination */
|
/** MWindow for AccountCombination */
|
||||||
private GridWindow m_mWindow = null;
|
private GridWindow m_mWindow = null;
|
||||||
/** MTab for AccountCombination */
|
/** MTab for AccountCombination */
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.compiere.util.WebEnv;
|
||||||
public class StoreFilter implements javax.servlet.Filter
|
public class StoreFilter implements javax.servlet.Filter
|
||||||
{
|
{
|
||||||
/** Logging */
|
/** Logging */
|
||||||
private static CLogger log = null;
|
private volatile static CLogger log = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init
|
* Init
|
||||||
|
|
|
@ -164,7 +164,7 @@ public class DB_Oracle implements AdempiereDatabase
|
||||||
* @return Driver
|
* @return Driver
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
*/
|
*/
|
||||||
public Driver getDriver() throws SQLException
|
public synchronized Driver getDriver() throws SQLException
|
||||||
{
|
{
|
||||||
if (s_driver == null)
|
if (s_driver == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@ import fitnesse.fixtures.TableFixture;
|
||||||
* @author Carlos Ruiz - globalqss
|
* @author Carlos Ruiz - globalqss
|
||||||
*/
|
*/
|
||||||
public class AssertRecord extends TableFixture {
|
public class AssertRecord extends TableFixture {
|
||||||
private static Instance adempiereInstance = null;
|
private volatile static Instance adempiereInstance = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doStaticTable(int rows) {
|
protected void doStaticTable(int rows) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ import fitnesse.fixtures.TableFixture;
|
||||||
* @author Carlos Ruiz - globalqss
|
* @author Carlos Ruiz - globalqss
|
||||||
*/
|
*/
|
||||||
public class AssertVariable extends TableFixture {
|
public class AssertVariable extends TableFixture {
|
||||||
private static Instance adempiereInstance = null;
|
private volatile static Instance adempiereInstance = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doStaticTable(int rows) {
|
protected void doStaticTable(int rows) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ import fitnesse.fixtures.TableFixture;
|
||||||
* @author Carlos Ruiz - globalqss
|
* @author Carlos Ruiz - globalqss
|
||||||
*/
|
*/
|
||||||
public class CreateRecord extends TableFixture {
|
public class CreateRecord extends TableFixture {
|
||||||
private static Instance adempiereInstance = null;
|
private volatile static Instance adempiereInstance = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doStaticTable(int rows) {
|
protected void doStaticTable(int rows) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ import fitnesse.fixtures.TableFixture;
|
||||||
*/
|
*/
|
||||||
public class Login extends TableFixture {
|
public class Login extends TableFixture {
|
||||||
private static final String LANGUAGE_EN_US = "en_US";
|
private static final String LANGUAGE_EN_US = "en_US";
|
||||||
private static Instance adempiereInstance = null;
|
private volatile static Instance adempiereInstance = null;
|
||||||
private String m_user;
|
private String m_user;
|
||||||
private String m_password;
|
private String m_password;
|
||||||
private String m_language;
|
private String m_language;
|
||||||
|
|
|
@ -45,7 +45,7 @@ import fitnesse.fixtures.TableFixture;
|
||||||
* @author Carlos Ruiz - globalqss
|
* @author Carlos Ruiz - globalqss
|
||||||
*/
|
*/
|
||||||
public class ReadRecord extends TableFixture {
|
public class ReadRecord extends TableFixture {
|
||||||
private static Instance adempiereInstance = null;
|
private volatile static Instance adempiereInstance = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doStaticTable(int rows) {
|
protected void doStaticTable(int rows) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ import fitnesse.fixtures.TableFixture;
|
||||||
* @author Carlos Ruiz - globalqss
|
* @author Carlos Ruiz - globalqss
|
||||||
*/
|
*/
|
||||||
public class RunProcess extends TableFixture {
|
public class RunProcess extends TableFixture {
|
||||||
private static Instance adempiereInstance = null;
|
private volatile static Instance adempiereInstance = null;
|
||||||
|
|
||||||
private static CLogger log = CLogger.getCLogger(RunProcess.class);
|
private static CLogger log = CLogger.getCLogger(RunProcess.class);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ import fitnesse.fixtures.TableFixture;
|
||||||
* @author Carlos Ruiz - globalqss
|
* @author Carlos Ruiz - globalqss
|
||||||
*/
|
*/
|
||||||
public class SetDocAction extends TableFixture {
|
public class SetDocAction extends TableFixture {
|
||||||
private static Instance adempiereInstance = null;
|
private volatile static Instance adempiereInstance = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doStaticTable(int rows) {
|
protected void doStaticTable(int rows) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ import fitnesse.fixtures.TableFixture;
|
||||||
* @author Carlos Ruiz - globalqss
|
* @author Carlos Ruiz - globalqss
|
||||||
*/
|
*/
|
||||||
public class SetVariable extends TableFixture {
|
public class SetVariable extends TableFixture {
|
||||||
private static Instance adempiereInstance = null;
|
private volatile static Instance adempiereInstance = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doStaticTable(int rows) {
|
protected void doStaticTable(int rows) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ package org.idempiere.fitnesse.fixture;
|
||||||
* @author Carlos Ruiz - globalqss
|
* @author Carlos Ruiz - globalqss
|
||||||
*/
|
*/
|
||||||
public class Static_iDempiereInstance {
|
public class Static_iDempiereInstance {
|
||||||
private static Instance adempiereInstance;
|
private volatile static Instance adempiereInstance;
|
||||||
|
|
||||||
public static Instance getInstance() {
|
public static Instance getInstance() {
|
||||||
if (adempiereInstance == null) {
|
if (adempiereInstance == null) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class Activator implements BundleActivator {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HazelcastInstance hazelcastInstance;
|
private volatile static HazelcastInstance hazelcastInstance;
|
||||||
private static AtomicReference<Future<?>> futureRef = new AtomicReference<Future<?>>();
|
private static AtomicReference<Future<?>> futureRef = new AtomicReference<Future<?>>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue