Merge with db4bbc33f63a882e9f663967e5b11e38183bbb5c
This commit is contained in:
commit
26ad4c070e
|
@ -0,0 +1,32 @@
|
|||
'''IDEMPIERE-520 Master/Detail bugs found using Production window'''
|
||||
|
||||
!include -c ZkGardenAdminLogin
|
||||
|
||||
!define windowId {$Production__Single_Product__1}
|
||||
|
||||
|''open window''|!-Production (Single Product)-!|
|
||||
|''wait response''|
|
||||
|''window''|${windowId}|''click toolbar''|!-BtnNew-!|
|
||||
|''wait response''|
|
||||
|''element exists''|${windowId} $detailPane @tabbox|
|
||||
|''lookup''|${windowId} $Production $M_Product_ID|''search''|!-PatioSet-!|
|
||||
|''wait response''|
|
||||
|''with''|${windowId} $Production $ProductionQty @decimalbox|''set text''|!-1-!|
|
||||
|''window''|${windowId}|''click toolbar''|!-BtnSave-!|
|
||||
|''wait response''|
|
||||
|''window message''|${windowId}|is|!-Record saved-!|
|
||||
|''window''|${windowId}|''click detail toolbar''|!-BtnNew-!|
|
||||
|''wait response''|
|
||||
|''text of''|${windowId} $recordInfo|is|!-+*1/1-!|
|
||||
|''window''|${windowId}|''click toolbar''|!-BtnParentRecord-!|
|
||||
|''wait response''|
|
||||
|''window''|${windowId}|''click process button''|!-CreateFrom-!|
|
||||
|''wait response''|
|
||||
|''click''|${windowId} @window[title="Create Production"] $Ok|
|
||||
|''wait response''|
|
||||
|''window''|${windowId}|''click detail toolbar''|!-BtnEdit-!|
|
||||
|''wait response''|
|
||||
|''element visible''|${windowId} $detailPane @tab|
|
||||
|''window''|${windowId}|''next record''|
|
||||
|''wait response''|
|
||||
|''element invisible''|${windowId} $detailPane @tab|
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<properties>
|
||||
<Edit>true</Edit>
|
||||
<Files>true</Files>
|
||||
<Properties>true</Properties>
|
||||
<RecentChanges>true</RecentChanges>
|
||||
<Refactor>true</Refactor>
|
||||
<Search>true</Search>
|
||||
<Test/>
|
||||
<Versions>true</Versions>
|
||||
<WhereUsed>true</WhereUsed>
|
||||
</properties>
|
|
@ -0,0 +1,31 @@
|
|||
'''IDEMPIERE-520 Master/Detail bugs found using Production window'''
|
||||
|
||||
!include -c ZkGardenAdminLogin
|
||||
|
||||
!define windowId {$Production__Single_Product__1}
|
||||
|
||||
|''open window''|!-Production (Single Product)-!|
|
||||
|''wait response''|
|
||||
|''element exists''|${windowId} $detailPane @tabbox|
|
||||
|''lookup''|${windowId} $Production $M_Product_ID|''search''|!-PatioSet-!|
|
||||
|''wait response''|
|
||||
|''with''|${windowId} $Production $ProductionQty @decimalbox|''set text''|!-1-!|
|
||||
|''window''|${windowId}|''click toolbar''|!-BtnSave-!|
|
||||
|''wait response''|
|
||||
|''window message''|${windowId}|is|!-Record saved-!|
|
||||
|''window''|${windowId}|''click detail toolbar''|!-BtnNew-!|
|
||||
|''wait response''|
|
||||
|''text of''|${windowId} $recordInfo|is|!-+*1/1-!|
|
||||
|''window''|${windowId}|''click toolbar''|!-BtnParentRecord-!|
|
||||
|''wait response''|
|
||||
|''window''|${windowId}|''click process button''|!-CreateFrom-!|
|
||||
|''wait response''|
|
||||
|''click''|${windowId} @window[title="Create Production"] $Ok|
|
||||
|''wait response''|
|
||||
|''window''|${windowId}|''click detail toolbar''|!-BtnEdit-!|
|
||||
|''wait response''|
|
||||
|''element visible''|${windowId} $detailPane @tab|
|
||||
|''window''|${windowId}|''next record''|
|
||||
|''wait response''|
|
||||
|''element invisible''|${windowId} $detailPane @tab|
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<properties>
|
||||
<Edit>true</Edit>
|
||||
<Files>true</Files>
|
||||
<Properties>true</Properties>
|
||||
<RecentChanges>true</RecentChanges>
|
||||
<Refactor>true</Refactor>
|
||||
<Search>true</Search>
|
||||
<Test/>
|
||||
<Versions>true</Versions>
|
||||
<WhereUsed>true</WhereUsed>
|
||||
</properties>
|
|
@ -18,7 +18,11 @@ public class FitServerServletInvoker extends ServletInvoker {
|
|||
CommandLine commandLine = new CommandLine("url host port socketToken");
|
||||
if (commandLine.parse(argv)) {
|
||||
servletUrl = commandLine.getArgument("url");
|
||||
fitnesseHostAddress = commandLine.getArgument("host");
|
||||
String host = System.getProperty("FITNESSE_HOST");
|
||||
if (host == null || host.trim().length() == 0)
|
||||
fitnesseHostAddress = commandLine.getArgument("host");
|
||||
else
|
||||
fitnesseHostAddress = host;
|
||||
fitnessePort = Integer.parseInt(commandLine.getArgument("port"));
|
||||
socketToken = Integer.parseInt(commandLine.getArgument("socketToken"));
|
||||
} else {
|
||||
|
|
|
@ -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
|
||||
;
|
||||
|
|
@ -254,7 +254,6 @@ ALTER TABLE WS_WebServiceTypeAccess ADD COLUMN WS_WebServiceTypeAccess_UU VARCHA
|
|||
|
||||
|
||||
|
||||
|
||||
-- Dec 12, 2012 11:49:01 PM IST
|
||||
-- IDEMPIERE-460 Adding support for composite service
|
||||
UPDATE AD_Column SET MandatoryLogic='@AD_Column_ID@=0',Updated=TO_TIMESTAMP('2012-12-12 23:49:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=202041
|
||||
|
|
|
@ -66,7 +66,7 @@ public class DocManager {
|
|||
return documentsTableName;
|
||||
}
|
||||
|
||||
private static void fillDocumentsTableArrays() {
|
||||
private synchronized static void fillDocumentsTableArrays() {
|
||||
if (documentsTableID == null) {
|
||||
String sql = "SELECT t.AD_Table_ID, t.TableName " +
|
||||
"FROM AD_Table t, AD_Column c " +
|
||||
|
|
|
@ -48,7 +48,7 @@ public class CConnection implements Serializable, Cloneable
|
|||
*/
|
||||
private static final long serialVersionUID = -7893119456331485444L;
|
||||
/** Connection */
|
||||
private static CConnection s_cc = null;
|
||||
private volatile static CConnection s_cc = null;
|
||||
/** Logger */
|
||||
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
|
||||
* @return Connection Descriptor
|
||||
*/
|
||||
public static CConnection get (String apps_host)
|
||||
public synchronized static CConnection get (String apps_host)
|
||||
{
|
||||
if (s_cc == null)
|
||||
{
|
||||
|
@ -1418,7 +1418,7 @@ public class CConnection implements Serializable, Cloneable
|
|||
* Get Last Exception of Apps Server Connection attempt
|
||||
* @return Exception or null
|
||||
*/
|
||||
public Exception getAppsServerException ()
|
||||
public synchronized Exception getAppsServerException ()
|
||||
{
|
||||
return m_appsException;
|
||||
} // getAppsServerException
|
||||
|
|
|
@ -432,7 +432,7 @@ public abstract class Convert
|
|||
*/
|
||||
public abstract boolean isOracle();
|
||||
|
||||
public static void logMigrationScript(String oraStatement, String pgStatement) {
|
||||
public synchronized static void logMigrationScript(String oraStatement, String pgStatement) {
|
||||
// Check AdempiereSys
|
||||
// check property Log migration script
|
||||
boolean logMigrationScript = false;
|
||||
|
|
|
@ -28,7 +28,6 @@ import java.sql.SQLException;
|
|||
import java.sql.Timestamp;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
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";
|
||||
|
||||
|
@ -163,10 +162,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
|
||||
private String m_parentColumnName = "";
|
||||
private String m_extendedWhere;
|
||||
/** Attachments */
|
||||
private HashMap<Integer,Integer> m_Attachments = null;
|
||||
/** Chats */
|
||||
private HashMap<Integer,Integer> m_Chats = null;
|
||||
/** Locks */
|
||||
private ArrayList<Integer> m_Lock = null;
|
||||
|
||||
|
@ -333,12 +328,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
//
|
||||
m_depOnField.clear();
|
||||
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())
|
||||
m_vo.getFields().clear();
|
||||
|
@ -2034,43 +2023,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
|
||||
} // 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?.
|
||||
* <p>
|
||||
|
@ -2091,13 +2043,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
*/
|
||||
public boolean hasAttachment()
|
||||
{
|
||||
if (m_Attachments == null)
|
||||
loadAttachments();
|
||||
if (m_Attachments == null || m_Attachments.isEmpty())
|
||||
return false;
|
||||
//
|
||||
Integer key = new Integer(m_mTable.getKeyID (m_currentRow));
|
||||
return m_Attachments.containsKey(key);
|
||||
return getAD_AttachmentID() > 0;
|
||||
} // hasAttachment
|
||||
|
||||
/**
|
||||
|
@ -2106,54 +2052,11 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
*/
|
||||
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())
|
||||
return;
|
||||
|
||||
String sql = "SELECT CM_Chat_ID, Record_ID FROM CM_Chat "
|
||||
+ "WHERE AD_Table_ID=?";
|
||||
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
|
||||
return 0;
|
||||
int recordID = m_mTable.getKeyID(m_currentRow);
|
||||
return MAttachment.getID(m_vo.AD_Table_ID, recordID);
|
||||
} // getAttachmentID
|
||||
|
||||
/**
|
||||
* Returns true, if current row has a Chat
|
||||
|
@ -2161,13 +2064,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
*/
|
||||
public boolean hasChat()
|
||||
{
|
||||
if (m_Chats == null)
|
||||
loadChats();
|
||||
if (m_Chats == null || m_Chats.isEmpty())
|
||||
return false;
|
||||
//
|
||||
Integer key = new Integer(m_mTable.getKeyID (m_currentRow));
|
||||
return m_Chats.containsKey(key);
|
||||
return getCM_ChatID() > 0;
|
||||
} // hasChat
|
||||
|
||||
/**
|
||||
|
@ -2176,17 +2073,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
*/
|
||||
public int getCM_ChatID()
|
||||
{
|
||||
if (m_Chats == null)
|
||||
loadChats();
|
||||
if (m_Chats.isEmpty())
|
||||
if (!canHaveAttachment())
|
||||
return 0;
|
||||
//
|
||||
Integer key = new Integer(m_mTable.getKeyID (m_currentRow));
|
||||
Integer value = (Integer)m_Chats.get(key);
|
||||
if (value == null)
|
||||
return 0;
|
||||
else
|
||||
return value.intValue();
|
||||
int recordID = m_mTable.getKeyID(m_currentRow);
|
||||
return MChat.getID(m_vo.AD_Table_ID, recordID);
|
||||
} // getCM_ChatID
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Properties;
|
|||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
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)
|
||||
|
@ -94,9 +95,7 @@ public class MAttachment extends X_AD_Attachment
|
|||
*/
|
||||
public MAttachment(Properties ctx, int AD_Table_ID, int Record_ID, String trxName)
|
||||
{
|
||||
this (ctx
|
||||
, MAttachment.get(ctx, AD_Table_ID, Record_ID) == null ? 0 : MAttachment.get(ctx, AD_Table_ID, Record_ID).get_ID()
|
||||
, trxName);
|
||||
this (ctx, MAttachment.getID(AD_Table_ID, Record_ID) > 0 ? MAttachment.getID(AD_Table_ID, Record_ID) : 0, trxName);
|
||||
if (get_ID() == 0) {
|
||||
setAD_Table_ID (AD_Table_ID);
|
||||
setRecord_ID (Record_ID);
|
||||
|
@ -598,4 +597,17 @@ public class MAttachment extends X_AD_Attachment
|
|||
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
|
||||
|
|
|
@ -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
|
||||
|
@ -240,7 +239,19 @@ public class MChat extends X_CM_Chat
|
|||
} // entry
|
||||
//
|
||||
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
|
||||
|
|
|
@ -51,7 +51,7 @@ public class MEXPProcessor extends X_EXP_Processor {
|
|||
/** Static Logger */
|
||||
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;
|
||||
|
||||
public static MEXPProcessor get(Properties ctx, int EXP_Processor_ID, String trxName)
|
||||
|
|
|
@ -186,7 +186,7 @@ public class MLocator extends X_M_Locator
|
|||
} // get
|
||||
|
||||
/** Cache */
|
||||
private static CCache<Integer,MLocator> s_cache;
|
||||
private volatile static CCache<Integer,MLocator> s_cache;
|
||||
|
||||
/** Logger */
|
||||
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
|
||||
* @return no
|
||||
*/
|
||||
public int getTotalNo()
|
||||
public synchronized int getTotalNo()
|
||||
{
|
||||
updateStatistics();
|
||||
return m_totalNo;
|
||||
|
@ -206,7 +206,7 @@ public class MRequestType extends X_R_RequestType
|
|||
* Get Open No of requests of type
|
||||
* @return no
|
||||
*/
|
||||
public int getOpenNo()
|
||||
public synchronized int getOpenNo()
|
||||
{
|
||||
updateStatistics();
|
||||
return m_openNo;
|
||||
|
@ -216,7 +216,7 @@ public class MRequestType extends X_R_RequestType
|
|||
* Get Closed in last 30 days of type
|
||||
* @return no
|
||||
*/
|
||||
public int getClosed30No()
|
||||
public synchronized int getClosed30No()
|
||||
{
|
||||
updateStatistics();
|
||||
return m_closed30No;
|
||||
|
@ -226,7 +226,7 @@ public class MRequestType extends X_R_RequestType
|
|||
* Get New in the last 30 days of type
|
||||
* @return no
|
||||
*/
|
||||
public int getNew30No()
|
||||
public synchronized int getNew30No()
|
||||
{
|
||||
updateStatistics();
|
||||
return m_new30No;
|
||||
|
|
|
@ -62,7 +62,7 @@ public class MSystem extends X_AD_System
|
|||
* @param ctx context
|
||||
* @return System
|
||||
*/
|
||||
public static MSystem get (Properties ctx)
|
||||
public synchronized static MSystem get (Properties ctx)
|
||||
{
|
||||
if (s_system != null)
|
||||
return s_system;
|
||||
|
|
|
@ -35,7 +35,7 @@ public class MUserDefWin extends X_AD_UserDef_Win
|
|||
*/
|
||||
private static final long serialVersionUID = -5775251886672840324L;
|
||||
|
||||
private static List<MUserDefWin> m_fullList = null;
|
||||
private volatile static List<MUserDefWin> m_fullList = null;
|
||||
|
||||
/**
|
||||
* Standard constructor.
|
||||
|
|
|
@ -65,7 +65,7 @@ public class TranslationTable
|
|||
* @param requery requery
|
||||
* @return number of active Translations
|
||||
*/
|
||||
public static int getActiveLanguages (boolean requery)
|
||||
public synchronized static int getActiveLanguages (boolean requery)
|
||||
{
|
||||
if (s_activeLanguages != null && !requery)
|
||||
return s_activeLanguages.intValue();
|
||||
|
|
|
@ -195,7 +195,7 @@ public class ArchiveEngine
|
|||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(ArchiveEngine.class);
|
||||
/** Singleton */
|
||||
private static ArchiveEngine s_engine = null;
|
||||
private volatile static ArchiveEngine s_engine = null;
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
|
|
|
@ -171,7 +171,7 @@ public class SwapFile
|
|||
freeBlocks(segment.getOffsets());
|
||||
}
|
||||
|
||||
private void verifyOpen() {
|
||||
private synchronized void verifyOpen() {
|
||||
if (randomAccessFile == null) {
|
||||
throw new RuntimeException("Swap file not open for read write access");
|
||||
}
|
||||
|
|
|
@ -108,8 +108,10 @@ public abstract class SvrProcess implements ProcessCall
|
|||
|
||||
boolean success = false;
|
||||
|
||||
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
|
||||
try
|
||||
{
|
||||
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
|
||||
m_ctx.put(PROCESS_INFO_CTX_KEY, m_pi);
|
||||
if (processUI != null)
|
||||
m_ctx.put(PROCESS_UI_CTX_KEY, processUI);
|
||||
|
@ -143,6 +145,8 @@ public abstract class SvrProcess implements ProcessCall
|
|||
|
||||
// outside transaction processing [ teo_sarca, 1646891 ]
|
||||
postProcess(!m_pi.isError());
|
||||
|
||||
Thread.currentThread().setContextClassLoader(contextLoader);
|
||||
}
|
||||
|
||||
return !m_pi.isError();
|
||||
|
|
|
@ -52,7 +52,7 @@ public class CCachedRowSet extends CachedRowSetImpl implements CachedRowSet
|
|||
* @return Cached Row Set
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static CCachedRowSet get() throws SQLException
|
||||
public synchronized static CCachedRowSet get() throws SQLException
|
||||
{
|
||||
CCachedRowSet crs = null;
|
||||
// only first time call
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.net.InetAddress;
|
|||
import java.sql.DriverManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -35,9 +36,12 @@ import java.util.logging.Level;
|
|||
import java.util.logging.LogManager;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.adempiere.base.Service;
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.db.CConnection;
|
||||
import org.compiere.model.MClient;
|
||||
import org.idempiere.distributed.IClusterMember;
|
||||
import org.idempiere.distributed.IClusterService;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -542,6 +546,24 @@ public class CLogMgt
|
|||
//thread info
|
||||
sb.append("Active Threads = " + Thread.activeCount());
|
||||
//
|
||||
//cluster info
|
||||
if (Env.getAD_Client_ID(Env.getCtx()) == 0) {
|
||||
IClusterService service = Service.locator().locate(IClusterService.class).getService();
|
||||
if (service != null) {
|
||||
IClusterMember local = service.getLocalMember();
|
||||
Collection<IClusterMember> members = service.getMembers();
|
||||
if (!members.isEmpty())
|
||||
sb.append(NL).append("Cluster Nodes:").append(NL);
|
||||
for(IClusterMember member : members) {
|
||||
sb.append(member.toString());
|
||||
if (local != null && member.getId().equals(local.getId())) {
|
||||
sb.append(" *");
|
||||
}
|
||||
sb.append(NL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sb;
|
||||
} // getInfo
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ public class CLogger extends Logger implements Serializable
|
|||
} // get
|
||||
|
||||
/** 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
|
||||
* @param cc connection
|
||||
*/
|
||||
public static void setDBTarget (CConnection cc)
|
||||
public synchronized static void setDBTarget (CConnection cc)
|
||||
{
|
||||
if (cc == null)
|
||||
throw new IllegalArgumentException("Connection is NULL");
|
||||
|
|
|
@ -232,7 +232,8 @@ public final class Env
|
|||
}
|
||||
|
||||
/**
|
||||
* Set Context
|
||||
* Replace the contents of the current session/process context.
|
||||
* Don't use this to setup a new session/process context, use ServerContext.setCurrentInstance instead.
|
||||
* @param ctx context
|
||||
*/
|
||||
public static void setCtx (Properties ctx)
|
||||
|
|
|
@ -224,7 +224,7 @@ public final class Ini implements Serializable
|
|||
};
|
||||
|
||||
/** Container for Properties */
|
||||
private static Properties s_prop = new Properties();
|
||||
private volatile static Properties s_prop = new Properties();
|
||||
|
||||
private static String s_propertyFileName = null;
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ public class SecureEngine
|
|||
/** Test String */
|
||||
private static final String TEST = "This is a 0123456789 .,; -= Test!";
|
||||
/** Secure Engine */
|
||||
private static SecureEngine s_engine = null;
|
||||
private volatile static SecureEngine s_engine = null;
|
||||
|
||||
/** The real Engine */
|
||||
private SecureInterface implementation = null;
|
||||
|
|
|
@ -64,7 +64,7 @@ public class WebInfo
|
|||
} // getGeneral
|
||||
|
||||
/** General Info */
|
||||
private static WebInfo m_general = null;
|
||||
private volatile static WebInfo m_general = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
|
@ -107,7 +107,7 @@ public class WebUser
|
|||
} // get
|
||||
|
||||
/** 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 */
|
||||
private static DocWorkflowManager s_mgr = null;
|
||||
private volatile static DocWorkflowManager s_mgr = null;
|
||||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(DocWorkflowManager.class);
|
||||
|
||||
|
|
|
@ -5,4 +5,5 @@ import java.net.InetAddress;
|
|||
public interface IClusterMember {
|
||||
public String getId();
|
||||
public InetAddress getAddress();
|
||||
public int getPort();
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class HttpServiceImpl implements HttpService, ExtendedHttpService {
|
|||
shutdown = true;
|
||||
}
|
||||
|
||||
private void checkShutdown() {
|
||||
private synchronized void checkShutdown() {
|
||||
if (shutdown)
|
||||
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);
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
public synchronized void destroy() {
|
||||
Activator.removeProxyServlet(this);
|
||||
proxyContext.destroy();
|
||||
proxyContext = null;
|
||||
|
@ -56,7 +56,7 @@ public class ProxyServlet extends HttpServlet implements Filter {
|
|||
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);
|
||||
String alias = HttpServletRequestAdaptor.getDispatchPathInfo(req, filterChain);
|
||||
if (alias == null)
|
||||
|
|
|
@ -35,7 +35,7 @@ public class BridgeServlet extends HttpServlet {
|
|||
private static HttpServlet servletDelegateInstance;
|
||||
private HttpServlet delegate;
|
||||
// true if current HttpServlet is an HTTP Filter and false otherwise.
|
||||
private boolean delegateIsFilter;
|
||||
private static boolean delegateIsFilter;
|
||||
private int delegateReferenceCount;
|
||||
|
||||
/**
|
||||
|
@ -175,7 +175,7 @@ public class BridgeServlet extends HttpServlet {
|
|||
|
||||
try {
|
||||
// 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.
|
||||
servletDelegate.init(instance.getServletConfig());
|
||||
} catch (ServletException e) {
|
||||
|
@ -207,7 +207,7 @@ public class BridgeServlet extends HttpServlet {
|
|||
|
||||
HttpServlet oldProxy = instance.delegate;
|
||||
instance.delegate = null;
|
||||
instance.delegateIsFilter = false;
|
||||
BridgeServlet.delegateIsFilter = false;
|
||||
while (instance.delegateReferenceCount != 0) {
|
||||
try {
|
||||
instance.wait();
|
||||
|
|
|
@ -73,8 +73,8 @@ public class GenericPOElementHandler extends AbstractElementHandler {
|
|||
String uuidColumn = PO.getUUIDColumnName(tableName);
|
||||
String idColumn = tableName + "_ID";
|
||||
MTable table = MTable.get(ctx.ctx, tableName);
|
||||
if ((!element.properties.containsKey(uuidColumn) || element.properties.get(uuidColumn).contents == null || element.properties.get(uuidColumn).contents.toString().trim().length() > 0)
|
||||
&& (!element.properties.containsKey(idColumn) || element.properties.get(idColumn).contents == null || element.properties.get(idColumn).contents.toString().trim().length() > 0)) {
|
||||
if ((!element.properties.containsKey(uuidColumn) || element.properties.get(uuidColumn).contents == null || element.properties.get(uuidColumn).contents.toString().trim().length() == 0)
|
||||
&& (!element.properties.containsKey(idColumn) || element.properties.get(idColumn).contents == null || element.properties.get(idColumn).contents.toString().trim().length() == 0)) {
|
||||
POInfo info = POInfo.getPOInfo(ctx.ctx, table.getAD_Table_ID());
|
||||
MColumn columns[] = table.getColumns(false);
|
||||
StringBuilder whereClause = new StringBuilder();
|
||||
|
|
|
@ -102,8 +102,8 @@ public abstract class AdempiereServer implements Runnable
|
|||
/** Initial nap is seconds */
|
||||
private int m_initialNap = 0;
|
||||
|
||||
/** Milliseconds to sleep - 10 Min default */
|
||||
protected long m_sleepMS = 600000;
|
||||
/** Milliseconds to sleep - 0 Sec default */
|
||||
protected long m_sleepMS = 0;
|
||||
/** Sleeping */
|
||||
private volatile boolean m_sleeping = true;
|
||||
/** Server start time */
|
||||
|
@ -178,6 +178,17 @@ public abstract class AdempiereServer implements Runnable
|
|||
*/
|
||||
public void run ()
|
||||
{
|
||||
final Thread currentThread = Thread.currentThread();
|
||||
final String oldThreadName = currentThread.getName();
|
||||
String newThreadName = getName();
|
||||
boolean renamed = false;
|
||||
if (!oldThreadName.equals(newThreadName)) {
|
||||
try {
|
||||
currentThread.setName(newThreadName);
|
||||
renamed = true;
|
||||
} catch (SecurityException e) {}
|
||||
}
|
||||
|
||||
m_sleeping = false;
|
||||
if (m_start == 0)
|
||||
m_start = System.currentTimeMillis();
|
||||
|
@ -202,7 +213,7 @@ public abstract class AdempiereServer implements Runnable
|
|||
lastRun = new Timestamp(p_startWork);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_nextWork = MSchedule.getNextRunMS(lastRun.getTime(),
|
||||
p_model.getScheduleType(), p_model.getFrequencyType(),
|
||||
p_model.getFrequency(), p_model.getCronPattern());
|
||||
|
@ -214,7 +225,12 @@ public abstract class AdempiereServer implements Runnable
|
|||
p_model.setDateLastRun(lastRun);
|
||||
p_model.setDateNextRun(new Timestamp(m_nextWork));
|
||||
p_model.saveEx();
|
||||
m_sleeping = true;
|
||||
m_sleeping = true;
|
||||
if (renamed) {
|
||||
// Revert the name back if the current thread was renamed.
|
||||
// We do not check the exception here because we know it works.
|
||||
currentThread.setName(oldThreadName);
|
||||
}
|
||||
} // run
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,7 +38,7 @@ public class AdempiereServerGroup extends ThreadGroup
|
|||
} // get
|
||||
|
||||
/** Group */
|
||||
private static AdempiereServerGroup s_group = null;
|
||||
private volatile static AdempiereServerGroup s_group = null;
|
||||
|
||||
/**
|
||||
* AdempiereServerGroup
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.util.ServerContext;
|
||||
import org.compiere.model.MAttachment;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MNote;
|
||||
|
@ -106,8 +107,7 @@ public class Scheduler extends AdempiereServer
|
|||
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
||||
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Env.setContext(m_schedulerctx, "#Date", dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
||||
Properties currentctx = Env.getCtx();
|
||||
Env.setCtx(m_schedulerctx);
|
||||
ServerContext.setCurrentInstance(m_schedulerctx);
|
||||
|
||||
MProcess process = new MProcess(m_schedulerctx, m_model.getAD_Process_ID(), null);
|
||||
try
|
||||
|
@ -129,8 +129,8 @@ public class Scheduler extends AdempiereServer
|
|||
m_trx.close();
|
||||
}
|
||||
|
||||
// Restore system context
|
||||
Env.setCtx(currentctx);
|
||||
// clear thread local context
|
||||
ServerContext.dispose();
|
||||
|
||||
//
|
||||
int no = m_model.deleteLog();
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.Properties;
|
|||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.util.RestletUtil;
|
||||
import org.adempiere.util.ServerContext;
|
||||
import org.compiere.interfaces.impl.ServerBean;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
|
@ -61,12 +62,9 @@ public class ExecuteProcessCommand extends ServerResource {
|
|||
}
|
||||
|
||||
ServerBean bean = new ServerBean();
|
||||
//back up properties
|
||||
Properties backup = new Properties();
|
||||
backup.putAll(Env.getCtx());
|
||||
try
|
||||
{
|
||||
Env.setCtx(context);
|
||||
ServerContext.setCurrentInstance(context);
|
||||
if (procedureName != null && procedureName.trim().length() > 0)
|
||||
return bean.dbProcess(context, pi, procedureName);
|
||||
else
|
||||
|
@ -74,7 +72,7 @@ public class ExecuteProcessCommand extends ServerResource {
|
|||
}
|
||||
finally
|
||||
{
|
||||
Env.setCtx(backup);
|
||||
ServerContext.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.Properties;
|
|||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.util.RestletUtil;
|
||||
import org.adempiere.util.ServerContext;
|
||||
import org.compiere.interfaces.impl.ServerBean;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -57,17 +58,14 @@ public class ExecuteTaskCommand extends ServerResource {
|
|||
}
|
||||
|
||||
ServerBean bean = new ServerBean();
|
||||
//back up properties
|
||||
Properties backup = new Properties();
|
||||
backup.putAll(Env.getCtx());
|
||||
try
|
||||
{
|
||||
Env.setCtx(context);
|
||||
ServerContext.setCurrentInstance(context);
|
||||
return bean.executeTask(context, AD_Task_ID);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Env.setCtx(backup);
|
||||
ServerContext.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.Properties;
|
|||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.util.RestletUtil;
|
||||
import org.adempiere.util.ServerContext;
|
||||
import org.compiere.interfaces.impl.ServerBean;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
|
@ -60,17 +61,14 @@ public class ExecuteWorkflowCommand extends ServerResource {
|
|||
}
|
||||
|
||||
ServerBean bean = new ServerBean();
|
||||
//back up properties
|
||||
Properties backup = new Properties();
|
||||
backup.putAll(Env.getCtx());
|
||||
try
|
||||
{
|
||||
Env.setCtx(context);
|
||||
ServerContext.setCurrentInstance(context);
|
||||
return bean.workflow(context, pi, AD_Workflow_ID);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Env.setCtx(backup);
|
||||
ServerContext.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.Properties;
|
|||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.util.RestletUtil;
|
||||
import org.adempiere.util.ServerContext;
|
||||
import org.compiere.interfaces.impl.ServerBean;
|
||||
import org.compiere.util.Env;
|
||||
import org.restlet.representation.Representation;
|
||||
|
@ -57,17 +58,14 @@ public class PostDocumentCommand extends ServerResource {
|
|||
boolean force = (Boolean) entity.get("force");
|
||||
|
||||
ServerBean bean = new ServerBean();
|
||||
//back up properties
|
||||
Properties backup = new Properties();
|
||||
backup.putAll(Env.getCtx());
|
||||
try
|
||||
{
|
||||
Env.setCtx(context);
|
||||
ServerContext.setCurrentInstance(context);
|
||||
msg = bean.postImmediate(context, AD_Client_ID, AD_Table_ID, Record_ID, force);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Env.setCtx(backup);
|
||||
ServerContext.dispose();
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.Properties;
|
|||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.util.RestletUtil;
|
||||
import org.adempiere.util.ServerContext;
|
||||
import org.compiere.interfaces.impl.ServerBean;
|
||||
import org.compiere.util.Env;
|
||||
import org.restlet.representation.Representation;
|
||||
|
@ -53,17 +54,14 @@ public class ResetCacheCommand extends ServerResource {
|
|||
String tableName = (String) entity.get("tableName");
|
||||
|
||||
ServerBean bean = new ServerBean();
|
||||
//back up properties
|
||||
Properties backup = new Properties();
|
||||
backup.putAll(Env.getCtx());
|
||||
try
|
||||
{
|
||||
Env.setCtx(context);
|
||||
ServerContext.setCurrentInstance(context);
|
||||
return bean.cacheReset(context, tableName, Record_ID);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Env.setCtx(backup);
|
||||
ServerContext.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.Properties;
|
|||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.util.RestletUtil;
|
||||
import org.adempiere.util.ServerContext;
|
||||
import org.compiere.interfaces.impl.ServerBean;
|
||||
import org.compiere.util.EMail;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -53,17 +54,14 @@ public class SendEmailCommand extends ServerResource {
|
|||
EMail email = (EMail) entity.get("email");
|
||||
|
||||
ServerBean bean = new ServerBean();
|
||||
//back up properties
|
||||
Properties backup = new Properties();
|
||||
backup.putAll(Env.getCtx());
|
||||
try
|
||||
{
|
||||
Env.setCtx(context);
|
||||
ServerContext.setCurrentInstance(context);
|
||||
return bean.sendEMail(context, email);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Env.setCtx(backup);
|
||||
ServerContext.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,11 +94,11 @@ public class AdempiereMonitor extends HttpServlet
|
|||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(AdempiereMonitor.class);
|
||||
/** The Server */
|
||||
private AdempiereServerMgr m_serverMgr = null;
|
||||
private static AdempiereServerMgr m_serverMgr = null;
|
||||
/** 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
|
||||
|
|
|
@ -2304,11 +2304,10 @@ public final class APanel extends CPanel
|
|||
return;
|
||||
}
|
||||
|
||||
// Attachment va =
|
||||
new Attachment (AEnv.getFrame(this), m_curWindowNo,
|
||||
@SuppressWarnings("unused")
|
||||
Attachment va = new Attachment (AEnv.getFrame(this), m_curWindowNo,
|
||||
m_curTab.getAD_AttachmentID(), m_curTab.getAD_Table_ID(), record_ID, null);
|
||||
//
|
||||
m_curTab.loadAttachments(); // reload
|
||||
aAttachment.setPressed(m_curTab.hasAttachment());
|
||||
} // attachment
|
||||
|
||||
|
@ -2345,7 +2344,6 @@ public final class APanel extends CPanel
|
|||
m_curTab.getCM_ChatID(), m_curTab.getAD_Table_ID(), record_ID,
|
||||
description, null);
|
||||
//
|
||||
m_curTab.loadChats(); // reload
|
||||
aChat.setPressed(m_curTab.hasChat());
|
||||
} // chat
|
||||
|
||||
|
@ -2368,7 +2366,6 @@ public final class APanel extends CPanel
|
|||
else
|
||||
{
|
||||
m_curTab.lock (Env.getCtx(), record_ID, aLock.getButton().isSelected());
|
||||
m_curTab.loadAttachments(); // reload
|
||||
}
|
||||
aLock.setPressed(m_curTab.isLocked());
|
||||
} // lock
|
||||
|
|
|
@ -78,7 +78,7 @@ public final class Attachment extends CDialog
|
|||
int AD_Table_ID, int Record_ID, String trxName)
|
||||
{
|
||||
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
|
||||
+ ", Table=" + AD_Table_ID + ", Record=" + Record_ID);
|
||||
//
|
||||
|
@ -93,10 +93,10 @@ public final class Attachment extends CDialog
|
|||
log.log(Level.SEVERE, "", ex);
|
||||
}
|
||||
// Create Model
|
||||
if (AD_Attachment_ID == 0)
|
||||
m_attachment = new MAttachment (Env.getCtx(), AD_Table_ID, Record_ID, trxName);
|
||||
else
|
||||
if (AD_Attachment_ID > 0)
|
||||
m_attachment = new MAttachment (Env.getCtx(), AD_Attachment_ID, trxName);
|
||||
else
|
||||
m_attachment = new MAttachment (Env.getCtx(), AD_Table_ID, Record_ID, trxName);
|
||||
loadAttachments();
|
||||
//
|
||||
try
|
||||
|
@ -112,7 +112,7 @@ public final class Attachment extends CDialog
|
|||
/** Window No */
|
||||
private int m_WindowNo;
|
||||
/** Attachment */
|
||||
private MAttachment m_attachment;
|
||||
private MAttachment m_attachment = null;
|
||||
/** Change */
|
||||
private boolean m_change = false;
|
||||
/** Logger */
|
||||
|
@ -380,7 +380,10 @@ public final class Attachment extends CDialog
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_attachment.delete(true);
|
||||
m_attachment = null;
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
// Cancel
|
||||
|
@ -468,8 +471,10 @@ public final class Attachment extends CDialog
|
|||
private void deleteAttachment()
|
||||
{
|
||||
log.info("");
|
||||
if (ADialog.ask(m_WindowNo, this, "AttachmentDelete?"))
|
||||
if (ADialog.ask(m_WindowNo, this, "AttachmentDelete?")) {
|
||||
m_attachment.delete(true);
|
||||
m_attachment = null;
|
||||
}
|
||||
} // deleteAttachment
|
||||
|
||||
/**
|
||||
|
|
|
@ -361,20 +361,14 @@ public class VAllocation extends Allocation
|
|||
// Organization
|
||||
if (name.equals("AD_Org_ID"))
|
||||
{
|
||||
if (value == null)
|
||||
m_AD_Org_ID = 0;
|
||||
else
|
||||
m_AD_Org_ID = ((Integer) value).intValue();
|
||||
m_AD_Org_ID = ((Integer) value).intValue();
|
||||
|
||||
loadBPartner();
|
||||
}
|
||||
// Charge
|
||||
else if (name.equals("C_Charge_ID") )
|
||||
{
|
||||
if ( value == null )
|
||||
m_C_Charge_ID = 0;
|
||||
else
|
||||
m_C_Charge_ID = ((Integer) value).intValue();
|
||||
m_C_Charge_ID = ((Integer) value).intValue();
|
||||
|
||||
setAllocateButton();
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ public final class VAccountDialog extends CDialog
|
|||
protected boolean m_changed = false;
|
||||
|
||||
/** Accounting Schema */
|
||||
private static MAcctSchema s_AcctSchema = null;
|
||||
private volatile static MAcctSchema s_AcctSchema = null;
|
||||
/** MWindow for AccountCombination */
|
||||
private GridWindow m_mWindow = null;
|
||||
/** MTab for AccountCombination */
|
||||
|
|
|
@ -39,6 +39,7 @@ Export-Package: metainfo.zk,
|
|||
org.adempiere.webui.editor,
|
||||
org.adempiere.webui.event,
|
||||
org.adempiere.webui.exception,
|
||||
org.adempiere.webui.factory,
|
||||
org.adempiere.webui.grid,
|
||||
org.adempiere.webui.install,
|
||||
org.adempiere.webui.panel,
|
||||
|
|
|
@ -90,7 +90,7 @@ public class AtmosphereServerPush implements ServerPush {
|
|||
|
||||
synchronized (info) {
|
||||
info.nActive = 1; //granted
|
||||
info.notify();
|
||||
info.notifyAll();
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -145,7 +145,7 @@ public class AtmosphereServerPush implements ServerPush {
|
|||
_active = null;
|
||||
|
||||
synchronized (_mutex) {
|
||||
_mutex.notify();
|
||||
_mutex.notifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,13 @@ public class AdempiereIdGenerator implements IdGenerator {
|
|||
public String nextComponentUuid(Desktop desktop, Component comp, ComponentInfo compInfo) {
|
||||
String prefix = comp.getId();
|
||||
|
||||
if (prefix == null || prefix.length() == 0) {
|
||||
String attribute = comp.getWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME);
|
||||
if (attribute != null && attribute.length() > 0) {
|
||||
prefix = getWidgetName(comp.getWidgetClass())+"0"+attribute;
|
||||
}
|
||||
}
|
||||
|
||||
if (prefix == null || prefix.length() == 0) {
|
||||
prefix = DEFAULT_ZK_COMP_PREFIX;
|
||||
}
|
||||
|
@ -54,8 +61,15 @@ public class AdempiereIdGenerator implements IdGenerator {
|
|||
//only include id space owner to ease converting test case to use zk id selector instead of uuid
|
||||
if (parent instanceof IdSpace) {
|
||||
String id = parent.getId();
|
||||
if (id != null && id.length() > 0)
|
||||
builder.insert(0, id+"_");
|
||||
if (id != null && id.length() > 0) {
|
||||
builder.insert(0, id+"_");
|
||||
} else {
|
||||
String attribute = parent.getWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME);
|
||||
if (attribute != null && attribute.length() > 0) {
|
||||
id = getWidgetName(parent.getWidgetClass())+"0"+attribute;
|
||||
builder.insert(0, id+"_");
|
||||
}
|
||||
}
|
||||
}
|
||||
parent = parent.getParent();
|
||||
}
|
||||
|
@ -85,6 +99,11 @@ public class AdempiereIdGenerator implements IdGenerator {
|
|||
return prefix + i;
|
||||
}
|
||||
|
||||
private String getWidgetName(String widgetClass) {
|
||||
String name = widgetClass.substring(widgetClass.lastIndexOf(".")+1);
|
||||
return name.toLowerCase();
|
||||
}
|
||||
|
||||
public static String escapeId(String prefix) {
|
||||
Pattern pattern = Pattern.compile("[^a-zA-Z_0-9]");
|
||||
Matcher matcher = pattern.matcher(prefix);
|
||||
|
|
|
@ -82,6 +82,7 @@ import org.zkoss.zul.Div;
|
|||
import org.zkoss.zul.Separator;
|
||||
import org.zkoss.zul.Space;
|
||||
import org.zkoss.zul.Style;
|
||||
import org.zkoss.zul.TreeModel;
|
||||
import org.zkoss.zul.Treeitem;
|
||||
import org.zkoss.zul.Vlayout;
|
||||
import org.zkoss.zul.West;
|
||||
|
@ -1051,10 +1052,10 @@ DataStatusListener, IADTabpanel, IdSpace
|
|||
private void deleteNode(int recordId) {
|
||||
if (recordId <= 0) return;
|
||||
|
||||
SimpleTreeModel model = (SimpleTreeModel) treePanel.getTree().getModel();
|
||||
SimpleTreeModel model = (SimpleTreeModel)(TreeModel<?>) treePanel.getTree().getModel();
|
||||
|
||||
if (treePanel.getTree().getSelectedItem() != null) {
|
||||
DefaultTreeNode<Object> treeNode = (DefaultTreeNode<Object>) treePanel.getTree().getSelectedItem().getValue();
|
||||
DefaultTreeNode<Object> treeNode = treePanel.getTree().getSelectedItem().getValue();
|
||||
MTreeNode data = (MTreeNode) treeNode.getData();
|
||||
if (data.getNode_ID() == recordId) {
|
||||
model.removeNode(treeNode);
|
||||
|
@ -1075,7 +1076,7 @@ DataStatusListener, IADTabpanel, IdSpace
|
|||
boolean summary = gridTab.getValueAsBoolean("IsSummary");
|
||||
String imageIndicator = (String)gridTab.getValue("Action"); // Menu - Action
|
||||
//
|
||||
SimpleTreeModel model = (SimpleTreeModel) treePanel.getTree().getModel();
|
||||
SimpleTreeModel model = (SimpleTreeModel)(TreeModel<?>) treePanel.getTree().getModel();
|
||||
DefaultTreeNode<Object> treeNode = model.getRoot();
|
||||
MTreeNode root = (MTreeNode) treeNode.getData();
|
||||
MTreeNode node = new MTreeNode (gridTab.getRecord_ID(), 0, name, description,
|
||||
|
@ -1096,9 +1097,9 @@ DataStatusListener, IADTabpanel, IdSpace
|
|||
treePanel.getTree().onInitRender();
|
||||
}
|
||||
|
||||
SimpleTreeModel model = (SimpleTreeModel) treePanel.getTree().getModel();
|
||||
SimpleTreeModel model = (SimpleTreeModel)(TreeModel<?>) treePanel.getTree().getModel();
|
||||
if (treePanel.getTree().getSelectedItem() != null) {
|
||||
DefaultTreeNode<Object> treeNode = (DefaultTreeNode<Object>) treePanel.getTree().getSelectedItem().getValue();
|
||||
DefaultTreeNode<Object> treeNode = treePanel.getTree().getSelectedItem().getValue();
|
||||
MTreeNode data = (MTreeNode) treeNode.getData();
|
||||
if (data.getNode_ID() == recordId) {
|
||||
int[] path = model.getPath(treeNode);
|
||||
|
|
|
@ -92,6 +92,7 @@ public class ADWindowContent extends AbstractADWindowContent
|
|||
toolbar.setWindowNo(getWindowNo());
|
||||
breadCrumb = new BreadCrumb(getWindowNo());
|
||||
breadCrumb.setToolbarListener(this);
|
||||
breadCrumb.setId("breadCrumb");
|
||||
div.appendChild(breadCrumb);
|
||||
|
||||
//status bar
|
||||
|
|
|
@ -33,6 +33,7 @@ import java.util.TreeMap;
|
|||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.util.Callback;
|
||||
import org.adempiere.webui.AdempiereIdGenerator;
|
||||
import org.adempiere.webui.AdempiereWebUI;
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.WArchive;
|
||||
|
@ -232,6 +233,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
{
|
||||
/** Initalise toolbar */
|
||||
toolbar = new ADWindowToolbar(getWindowNo());
|
||||
toolbar.setId("windowToolbar");
|
||||
toolbar.addListener(this);
|
||||
|
||||
statusBar = new StatusBar();
|
||||
|
@ -801,7 +803,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
public void onEvent(Event event) throws Exception
|
||||
{
|
||||
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());
|
||||
}
|
||||
|
@ -850,8 +852,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
EventListener<Event> listener = new EventListener<Event>() {
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
adTabbox.getSelectedGridTab().loadAttachments(); // reload
|
||||
public void onEvent(Event event) throws Exception {
|
||||
toolbar.getButton("Attachment").setPressed(adTabbox.getSelectedGridTab().hasAttachment());
|
||||
focusToActivePanel();
|
||||
}
|
||||
|
@ -899,8 +900,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);
|
||||
chat.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
adTabbox.getSelectedGridTab().loadChats();
|
||||
public void onEvent(Event event) throws Exception {
|
||||
toolbar.getButton("Chat").setPressed(adTabbox.getSelectedGridTab().hasChat());
|
||||
focusToActivePanel();
|
||||
Clients.clearBusy(getComponent());
|
||||
|
@ -2376,6 +2376,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
{
|
||||
Clients.showBusy(getComponent(), " ");
|
||||
final WCreateFromWindow window = (WCreateFromWindow) cf.getWindow();
|
||||
window.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, AdempiereIdGenerator.escapeId(window.getTitle()));
|
||||
window.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
|
|
|
@ -132,6 +132,7 @@ public class BreadCrumb extends Div implements EventListener<Event> {
|
|||
btnRecordInfo.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Who")));
|
||||
btnRecordInfo.addEventListener(Events.ON_CLICK, this);
|
||||
btnRecordInfo.setSclass("breadcrumb-record-info link");
|
||||
btnRecordInfo.setId("recordInfo");
|
||||
toolbar.appendChild(btnRecordInfo);
|
||||
btnNext = createButton("Next", "Next", "Next");
|
||||
toolbar.appendChild(btnNext);
|
||||
|
|
|
@ -12,17 +12,13 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.webui.adwindow;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.adempiere.util.GridRowCtx;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Checkbox;
|
||||
import org.adempiere.webui.component.EditorBox;
|
||||
import org.adempiere.webui.component.NumberBox;
|
||||
|
@ -40,7 +36,6 @@ import org.compiere.model.GridTab;
|
|||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.NamePair;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.zk.au.out.AuFocus;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
|
@ -76,9 +71,9 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
|
|||
private int windowNo;
|
||||
private GridTabDataBinder dataBinder;
|
||||
private Map<GridField, WEditor> editors = new LinkedHashMap<GridField, WEditor>();
|
||||
private Map<GridField, WEditor> readOnlyEditors = new LinkedHashMap<GridField, WEditor>();
|
||||
private Paging paging;
|
||||
|
||||
private Map<String, Map<Object, String>> lookupCache = null;
|
||||
private RowListener rowListener;
|
||||
|
||||
private Grid grid = null;
|
||||
|
@ -157,68 +152,27 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
|
|||
return checkBox;
|
||||
}
|
||||
|
||||
private String getDisplayText(Object value, GridField gridField)
|
||||
private String getDisplayText(Object value, GridField gridField, int rowIndex)
|
||||
{
|
||||
if (value == null)
|
||||
return "";
|
||||
|
||||
if (rowIndex >= 0) {
|
||||
GridRowCtx gridRowCtx = new GridRowCtx(Env.getCtx(), gridTab, rowIndex);
|
||||
if (!gridField.isDisplayed(gridRowCtx, true)) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
if (gridField.isEncryptedField())
|
||||
{
|
||||
return "********";
|
||||
}
|
||||
else if (readOnlyEditors.get(gridField) != null)
|
||||
{
|
||||
WEditor editor = readOnlyEditors.get(gridField);
|
||||
return editor.getDisplayTextForGridView(value);
|
||||
}
|
||||
else if (gridField.isLookup())
|
||||
{
|
||||
if (lookupCache != null)
|
||||
{
|
||||
Map<Object, String> cache = lookupCache.get(gridField.getColumnName());
|
||||
if (cache != null && cache.size() >0)
|
||||
{
|
||||
String text = cache.get(value);
|
||||
if (text != null)
|
||||
{
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
NamePair namepair = gridField.getLookup().get(value);
|
||||
if (namepair != null)
|
||||
{
|
||||
String text = namepair.getName();
|
||||
if (lookupCache != null)
|
||||
{
|
||||
Map<Object, String> cache = lookupCache.get(gridField.getColumnName());
|
||||
if (cache == null)
|
||||
{
|
||||
cache = new HashMap<Object, String>();
|
||||
lookupCache.put(gridField.getColumnName(), cache);
|
||||
}
|
||||
cache.put(value, text);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
else
|
||||
return "";
|
||||
}
|
||||
else if (DisplayType.getClass(gridField.getDisplayType(), false).equals(Timestamp.class))
|
||||
{
|
||||
SimpleDateFormat dateFormat = DisplayType.getDateFormat(gridField.getDisplayType(), AEnv.getLanguage(Env.getCtx()));
|
||||
return dateFormat.format((Timestamp)value);
|
||||
}
|
||||
else if (DisplayType.isNumeric(gridField.getDisplayType()))
|
||||
{
|
||||
return DisplayType.getNumberFormat(gridField.getDisplayType(), AEnv.getLanguage(Env.getCtx())).format(value);
|
||||
}
|
||||
else if (DisplayType.Button == gridField.getDisplayType())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else if (DisplayType.Image == gridField.getDisplayType())
|
||||
{
|
||||
if (value == null || (Integer)value <= 0)
|
||||
return "";
|
||||
else
|
||||
return "...";
|
||||
}
|
||||
else
|
||||
return value.toString();
|
||||
}
|
||||
|
@ -236,7 +190,7 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
|
|||
editor.addActionListener(buttonListener);
|
||||
component = editor.getComponent();
|
||||
} else {
|
||||
String text = getDisplayText(value, gridField);
|
||||
String text = getDisplayText(value, gridField, rowIndex);
|
||||
|
||||
Label label = new Label();
|
||||
setLabelText(text, label);
|
||||
|
@ -310,7 +264,7 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
|
|||
if (component instanceof Label) {
|
||||
Label label = (Label)component;
|
||||
label.getChildren().clear();
|
||||
String text = getDisplayText(entry.getValue().getValue(), entry.getValue().getGridField());
|
||||
String text = getDisplayText(entry.getValue().getValue(), entry.getValue().getGridField(), -1);
|
||||
setLabelText(text, label);
|
||||
} else if (component instanceof Checkbox) {
|
||||
Checkbox checkBox = (Checkbox)component;
|
||||
|
@ -425,6 +379,11 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
|
|||
if (editor instanceof WButtonEditor) {
|
||||
((WButtonEditor)editor).addActionListener(buttonListener);
|
||||
}
|
||||
|
||||
//readonly for display text
|
||||
WEditor readOnlyEditor = WebEditorFactory.getEditor(gridPanelFields[i], true);
|
||||
readOnlyEditor.setReadWrite(false);
|
||||
readOnlyEditors.put(gridPanelFields[i], readOnlyEditor);
|
||||
}
|
||||
|
||||
if (!gridPanelFields[i].isDisplayedGrid() || gridPanelFields[i].isToolbarButton()) {
|
||||
|
@ -583,21 +542,18 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
|
|||
* @see RendererCtrl#doCatch(Throwable)
|
||||
*/
|
||||
public void doCatch(Throwable ex) throws Throwable {
|
||||
lookupCache = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RendererCtrl#doFinally()
|
||||
*/
|
||||
public void doFinally() {
|
||||
lookupCache = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RendererCtrl#doTry()
|
||||
*/
|
||||
public void doTry() {
|
||||
lookupCache = new HashMap<String, Map<Object,String>>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.webui.apps.form;
|
||||
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICE_C_BPARTNER_ID;
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICE_C_CURRENCY_ID;
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_PERIOD_AD_ORG_ID;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
@ -47,18 +51,18 @@ import org.adempiere.webui.window.FDialog;
|
|||
import org.compiere.apps.form.Allocation;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import static org.compiere.model.SystemIDs.*;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Trx;
|
||||
import org.compiere.util.TrxRunnable;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zul.Borderlayout;
|
||||
import org.zkoss.zul.Center;
|
||||
import org.zkoss.zul.North;
|
||||
import org.zkoss.zul.South;
|
||||
import org.zkoss.zul.Separator;
|
||||
import org.zkoss.zul.South;
|
||||
import org.zkoss.zul.Space;
|
||||
|
||||
/**
|
||||
|
@ -409,20 +413,14 @@ public class WAllocation extends Allocation
|
|||
// Organization
|
||||
if (name.equals("AD_Org_ID"))
|
||||
{
|
||||
if (value == null)
|
||||
m_AD_Org_ID = 0;
|
||||
else
|
||||
m_AD_Org_ID = ((Integer) value).intValue();
|
||||
m_AD_Org_ID = ((Integer) value).intValue();
|
||||
|
||||
loadBPartner();
|
||||
}
|
||||
// Charge
|
||||
else if (name.equals("C_Charge_ID") )
|
||||
{
|
||||
if ( value == null )
|
||||
m_C_Charge_ID = 0;
|
||||
else
|
||||
m_C_Charge_ID = ((Integer) value).intValue();
|
||||
m_C_Charge_ID = ((Integer) value).intValue();
|
||||
|
||||
setAllocateButton();
|
||||
}
|
||||
|
@ -535,10 +533,21 @@ public class WAllocation extends Allocation
|
|||
Env.setContext(Env.getCtx(), form.getWindowNo(), "AD_Org_ID", m_AD_Org_ID);
|
||||
else
|
||||
Env.setContext(Env.getCtx(), form.getWindowNo(), "AD_Org_ID", "");
|
||||
Trx trx = Trx.get(Trx.createTrxName("AL"), true);
|
||||
statusBar.setStatusLine(saveData(form.getWindowNo(), dateField.getValue(), paymentTable, invoiceTable, trx.getTrxName()));
|
||||
trx.commit();
|
||||
trx.close();
|
||||
try
|
||||
{
|
||||
Trx.run(new TrxRunnable()
|
||||
{
|
||||
public void run(String trxName)
|
||||
{
|
||||
statusBar.setStatusLine(saveData(form.getWindowNo(), dateField.getValue(), paymentTable, invoiceTable, trxName));
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FDialog.error(form.getWindowNo(), form, "Error", e.getLocalizedMessage());
|
||||
return;
|
||||
}
|
||||
} // saveData
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,6 +16,7 @@ package org.adempiere.webui.apps.form;
|
|||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -82,7 +83,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
private boolean m_isCanExport;
|
||||
|
||||
private ReportEngine m_reportEngine=null;
|
||||
public MPrintFormatItem[] pfi ;
|
||||
public ArrayList<MPrintFormatItem> pfi ;
|
||||
|
||||
private Auxheader headerPanel=new Auxheader();
|
||||
private Listbox comboReport = new Listbox();
|
||||
|
@ -140,7 +141,11 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
|
||||
m_reportEngine = re;
|
||||
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
|
||||
{
|
||||
m_ctx = m_reportEngine.getCtx();
|
||||
|
@ -229,6 +234,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
|
||||
tpsc3.setMPrintFormat(fm);
|
||||
tpsc3.setPrintFormatItems(pfi);
|
||||
tpsc3.setListsColumns();
|
||||
tpsc3.init();
|
||||
tpsc3.refresh();
|
||||
tpsc3.setWReportCustomization(this);
|
||||
|
@ -359,10 +365,12 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
}
|
||||
|
||||
private void onSave() {
|
||||
for (int i=0; i < pfi.length ;i++){
|
||||
pfi[i].saveEx();
|
||||
}
|
||||
setIsChanged(false);
|
||||
|
||||
for (MPrintFormatItem item : pfi)
|
||||
if (item.is_Changed())
|
||||
item.saveEx();
|
||||
|
||||
setIsChanged(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -519,8 +527,10 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
|
||||
public void copyFormat(){
|
||||
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.setPrintFormatItems(pfi);
|
||||
tpdf1.refresh();
|
||||
|
@ -532,6 +542,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
|
||||
tpsc3.setMPrintFormat(newpf);
|
||||
tpsc3.setPrintFormatItems(pfi);
|
||||
tpfo2.setListColumns();
|
||||
tpsc3.refresh();
|
||||
|
||||
tpgc4.setMPrintFormat(newpf);
|
||||
|
|
|
@ -51,6 +51,7 @@ import org.zkoss.zul.DefaultTreeNode;
|
|||
import org.zkoss.zul.Space;
|
||||
import org.zkoss.zul.Splitter;
|
||||
import org.zkoss.zul.Tree;
|
||||
import org.zkoss.zul.TreeModel;
|
||||
import org.zkoss.zul.TreeNode;
|
||||
import org.zkoss.zul.Treeitem;
|
||||
|
||||
|
@ -304,8 +305,8 @@ public class WTreeMaintenance extends TreeMaintenance implements IFormController
|
|||
log.info("Selected=" + selected);
|
||||
if (selected != null) // allow add if not in tree
|
||||
{
|
||||
SimpleTreeModel tm = (SimpleTreeModel) centerTree.getModel();
|
||||
DefaultTreeNode<?> stn = tm.find(tm.getRoot(), selected.id);
|
||||
SimpleTreeModel tm = (SimpleTreeModel)(TreeModel<?>) centerTree.getModel();
|
||||
DefaultTreeNode<Object> stn = tm.find(tm.getRoot(), selected.id);
|
||||
if (stn != null) {
|
||||
int[] path = tm.getPath(stn);
|
||||
Treeitem ti = centerTree.renderItemByPath(path);
|
||||
|
@ -348,7 +349,7 @@ public class WTreeMaintenance extends TreeMaintenance implements IFormController
|
|||
log.info("Item=" + item);
|
||||
if (item != null)
|
||||
{
|
||||
SimpleTreeModel model = (SimpleTreeModel) centerTree.getModel();
|
||||
SimpleTreeModel model = (SimpleTreeModel)(TreeModel<?>) centerTree.getModel();
|
||||
DefaultTreeNode<Object> stn = model.find(model.getRoot(), item.id);
|
||||
if (stn != null) {
|
||||
MTreeNode tNode = (MTreeNode) stn.getData();
|
||||
|
@ -377,7 +378,7 @@ public class WTreeMaintenance extends TreeMaintenance implements IFormController
|
|||
log.info("Item=" + item);
|
||||
if (item != null)
|
||||
{
|
||||
SimpleTreeModel model = (SimpleTreeModel) centerTree.getModel();
|
||||
SimpleTreeModel model = (SimpleTreeModel)(TreeModel<?>) centerTree.getModel();
|
||||
DefaultTreeNode<Object> stn = model.find(model.getRoot(), item.id);
|
||||
if (stn != null)
|
||||
model.removeNode(stn);
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.zkoss.zul.event.ListDataEvent;
|
|||
* @author Andrew Kimball
|
||||
*
|
||||
*/
|
||||
public class ListModelTable extends ListModelList implements ListModelExt
|
||||
public class ListModelTable extends ListModelList<Object> implements ListModelExt<Object>
|
||||
{
|
||||
/**
|
||||
*
|
||||
|
@ -117,7 +117,7 @@ public class ListModelTable extends ListModelList implements ListModelExt
|
|||
*/
|
||||
private void ensureRowSize()
|
||||
{
|
||||
Iterator<List<Object>> rowIterator = (Iterator<List<Object>>)this.getInnerList().iterator();
|
||||
Iterator<List<Object>> rowIterator = (Iterator<List<Object>>)(Object)this.getInnerList().iterator();
|
||||
|
||||
while (rowIterator.hasNext())
|
||||
{
|
||||
|
@ -324,7 +324,7 @@ public class ListModelTable extends ListModelList implements ListModelExt
|
|||
* (non-Javadoc)
|
||||
* @see org.zkoss.zul.ListModelList#sort(java.util.Comparator, boolean)
|
||||
*/
|
||||
public void sort(Comparator cmpr, boolean ascending)
|
||||
public void sort(Comparator<Object> cmpr, boolean ascending)
|
||||
{
|
||||
if (sorter != null)
|
||||
sorter.sort(cmpr, ascending);
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.zkoss.zul.event.TreeDataEvent;
|
|||
* @author Low Heng Sin
|
||||
*
|
||||
*/
|
||||
public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel implements TreeitemRenderer<Object>, EventListener<Event> {
|
||||
public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> implements TreeitemRenderer<Object>, EventListener<Event> {
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -174,7 +174,6 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel implements T
|
|||
return (DefaultTreeNode<Object>) super.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultTreeNode<Object> getChild(Object parent, int index) {
|
||||
return (DefaultTreeNode<Object>) super.getChild((TreeNode<Object>)parent, index);
|
||||
}
|
||||
|
|
|
@ -195,9 +195,11 @@ public class WListItemRenderer implements ListitemRenderer<Object>, EventListene
|
|||
int rowIndex, int columnIndex)
|
||||
{
|
||||
ListCell listcell = new ListCell();
|
||||
WTableColumn column = getColumn(columnIndex);
|
||||
if (column != null && column.getHeaderValue() != null) {
|
||||
listcell.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, column.getHeaderValue().toString());
|
||||
if (m_tableColumns.size() > columnIndex) {
|
||||
WTableColumn column = getColumn(columnIndex);
|
||||
if (column != null && column.getHeaderValue() != null) {
|
||||
listcell.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, column.getHeaderValue().toString());
|
||||
}
|
||||
}
|
||||
boolean isCellEditable = table != null ? table.isCellEditable(rowIndex, columnIndex) : false;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.beans.PropertyChangeEvent;
|
|||
import java.beans.PropertyChangeListener;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.adempiere.webui.AdempiereWebUI;
|
||||
import org.adempiere.webui.component.Bandbox;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.Datebox;
|
||||
|
@ -109,9 +110,10 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
|
|||
|
||||
this.setComponent(comp);
|
||||
this.gridField = gridField;
|
||||
comp.setWidgetAttribute("columnName", gridField.getColumnName());
|
||||
if (gridField.getGridTab() != null) {
|
||||
comp.setWidgetAttribute("qualifiedColumnName", gridField.getGridTab().getTableName()+"."+gridField.getColumnName());
|
||||
comp.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, gridField.getGridTab().getTableName()+"0"+gridField.getColumnName());
|
||||
} else {
|
||||
comp.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, gridField.getColumnName());
|
||||
}
|
||||
this.setMandatory(gridField.isMandatory(false));
|
||||
this.readOnly = gridField.isReadOnly();
|
||||
|
@ -436,6 +438,11 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
|
|||
* @return display text
|
||||
*/
|
||||
abstract public String getDisplay();
|
||||
|
||||
public String getDisplayTextForGridView(Object value) {
|
||||
this.setValue(value);
|
||||
return getDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -145,7 +145,17 @@ public class WImageEditor extends WEditor
|
|||
getComponent().setContent(img);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getDisplayTextForGridView(Object value) {
|
||||
if (value == null) {
|
||||
return "";
|
||||
} else {
|
||||
return "...";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getEvents()
|
||||
{
|
||||
return LISTENER_EVENTS;
|
||||
|
|
|
@ -47,7 +47,7 @@ public class WebEditorFactory
|
|||
|
||||
public static WEditor getEditor(GridField gridField, boolean tableEditor)
|
||||
{
|
||||
return getEditor(null, gridField, tableEditor);
|
||||
return getEditor(gridField.getGridTab(), gridField, tableEditor);
|
||||
}
|
||||
|
||||
public static WEditor getEditor(GridTab gridTab, GridField gridField, boolean tableEditor)
|
||||
|
|
|
@ -408,13 +408,11 @@ public class CustomizeGridViewPanel extends Panel
|
|||
*/
|
||||
void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects)
|
||||
{
|
||||
int length = selObjects.size();
|
||||
int iniIndex =0;
|
||||
Arrays.sort(selObjects.toArray());
|
||||
ListElement endObject = (ListElement)yesModel.getElementAt(endIndex);
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
iniIndex = yesModel.indexOf(selObjects.get(i));
|
||||
for (ListElement selected : selObjects) {
|
||||
iniIndex = yesModel.indexOf(selected);
|
||||
ListElement selObject = (ListElement)yesModel.getElementAt(iniIndex);
|
||||
yesModel.removeElement(selObject);
|
||||
endIndex = yesModel.indexOf(endObject);
|
||||
|
|
|
@ -76,7 +76,7 @@ public class WAttachment extends Window implements EventListener<Event>
|
|||
private int m_WindowNo;
|
||||
|
||||
/** Attachment */
|
||||
private MAttachment m_attachment;
|
||||
private MAttachment m_attachment = null;
|
||||
|
||||
/** Change */
|
||||
private boolean m_change = false;
|
||||
|
@ -168,10 +168,10 @@ public class WAttachment extends Window implements EventListener<Event>
|
|||
|
||||
// Create Model
|
||||
|
||||
if (AD_Attachment_ID == 0)
|
||||
m_attachment = new MAttachment (Env.getCtx(), AD_Table_ID, Record_ID, trxName);
|
||||
else
|
||||
if (AD_Attachment_ID > 0)
|
||||
m_attachment = new MAttachment (Env.getCtx(), AD_Attachment_ID, trxName);
|
||||
else
|
||||
m_attachment = new MAttachment (Env.getCtx(), AD_Table_ID, Record_ID, trxName);
|
||||
|
||||
loadAttachments();
|
||||
|
||||
|
@ -483,7 +483,10 @@ public class WAttachment extends Window implements EventListener<Event>
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_attachment.delete(true);
|
||||
m_attachment = null;
|
||||
}
|
||||
|
||||
dispose();
|
||||
}
|
||||
|
@ -614,6 +617,7 @@ public class WAttachment extends Window implements EventListener<Event>
|
|||
if (result)
|
||||
{
|
||||
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.Window;
|
||||
import org.compiere.print.MPrintFormat;
|
||||
import org.compiere.print.MPrintFormatItem;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
|
@ -59,9 +60,9 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
|||
|
||||
public void init() {
|
||||
|
||||
m_chkboxes = new Checkbox[m_pfi.length];
|
||||
m_textBoxes = new Textbox[m_pfi.length];
|
||||
m_oldLabel = new String[m_pfi.length];
|
||||
m_chkboxes = new Checkbox[m_pfi.size()];
|
||||
m_textBoxes = new Textbox[m_pfi.size()];
|
||||
m_oldLabel = new String[m_pfi.size()];
|
||||
|
||||
Window wind=new Window();
|
||||
wind.setWidth("90%");
|
||||
|
@ -99,20 +100,21 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
|||
int curCol=0;
|
||||
Rows rows = grid.newRows();
|
||||
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){
|
||||
row = new Row();
|
||||
rows.appendChild(row);
|
||||
}
|
||||
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);
|
||||
row.appendChild(m_chkboxes[i]);
|
||||
|
||||
m_textBoxes[i] = new Textbox();
|
||||
String strValue = m_pfi[i].getPrintName();
|
||||
String strValue = printItem.getPrintName();
|
||||
if(strValue ==null || strValue.length()==0){
|
||||
strValue = m_pfi[i].getName();
|
||||
strValue = printItem.getName();
|
||||
}
|
||||
m_oldLabel[i] = strValue;
|
||||
m_textBoxes[i].setText(strValue);
|
||||
|
@ -120,26 +122,26 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
|||
row.appendChild(m_textBoxes[i]);
|
||||
|
||||
curCol++;
|
||||
i++;
|
||||
curCol = curCol%RENDER_IN_COLUMNS;
|
||||
}
|
||||
}
|
||||
|
||||
public void save(){
|
||||
for(int i=0;i<m_pfi.length;i++){
|
||||
m_pfi[i].setIsActive(m_chkboxes[i].isChecked());
|
||||
m_pfi[i].setPrintName(m_textBoxes[i].getText());
|
||||
m_pfi[i].saveEx();
|
||||
}
|
||||
int i=0;
|
||||
for (MPrintFormatItem item : m_pfi){
|
||||
item.setIsActive(m_chkboxes[i].isChecked());
|
||||
item.setPrintName(m_textBoxes[i].getText());
|
||||
item.saveEx();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
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++){
|
||||
if(m_chkboxes[i].isChecked()){
|
||||
int ID=m_pfi[i].get_ID();
|
||||
String name=m_pfi[i].getName();
|
||||
KeyNamePair pair=new KeyNamePair(ID, name);
|
||||
listcheck[i]=pair;
|
||||
listcheck[i]= new KeyNamePair(m_pfi.get(i).get_ID(),m_pfi.get(i).getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -148,8 +150,8 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
|||
|
||||
@Override
|
||||
public void refresh() {
|
||||
for (int i=0 ; i< m_pfi.length ; i++){
|
||||
m_chkboxes[i].setChecked(m_pfi[i].isPrinted());
|
||||
for (int i=0 ; i< m_pfi.size(); i++){
|
||||
m_chkboxes[i].setChecked(m_pfi.get(i).isPrinted());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,21 +159,21 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
|||
public void updatePFI() {
|
||||
for (int i=0 ;i < m_chkboxes.length ;i++){
|
||||
if(m_chkboxes[i].isChecked()){
|
||||
m_pfi[i].setIsPrinted(true);
|
||||
m_pfi.get(i).setIsPrinted(true);
|
||||
}
|
||||
else{
|
||||
m_pfi[i].setIsPrinted(false);
|
||||
m_pfi.get(i).setIsPrinted(false);
|
||||
}
|
||||
String printname = m_textBoxes[i].getValue();
|
||||
if (!Util.isEmpty(printname))
|
||||
if (! printname.equals(m_pfi[i].getPrintName()))
|
||||
m_pfi[i].setPrintName(m_textBoxes[i].getValue());
|
||||
if (! printname.equals(m_pfi.get(i).getPrintName()))
|
||||
m_pfi.get(i).setPrintName(m_textBoxes[i].getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public void updatePrinted(boolean value){
|
||||
for(int j=0 ; j< m_pfi.length ; j++){
|
||||
m_pfi[j].setIsPrinted(value);
|
||||
for(int j=0 ; j< m_pfi.size() ; j++){
|
||||
m_pfi.get(j).setIsPrinted(value);
|
||||
m_chkboxes[j].setChecked(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,10 @@
|
|||
package org.adempiere.webui.panel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.adempiere.webui.component.Button;
|
||||
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 bDown = new Button();
|
||||
|
||||
private ArrayList<MPrintFormatItem> listColumns=new ArrayList<MPrintFormatItem>();
|
||||
SimpleListModel sortModel;
|
||||
private Listbox sortList;
|
||||
|
||||
public WRC2FieldOrderPanel() {
|
||||
super();
|
||||
|
@ -59,13 +61,9 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
|
||||
public void setListColumns() {
|
||||
listColumns = new ArrayList<MPrintFormatItem>();
|
||||
if (m_pfi != null && m_pfi.length > 0) {
|
||||
for (int i = 0; i < m_pfi.length; i++) {
|
||||
if (m_pfi[i] != null && m_pfi[i].isPrinted()) {
|
||||
listColumns.add(m_pfi[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (MPrintFormatItem item : m_pfi)
|
||||
if(item!=null && item.isPrinted())
|
||||
listColumns.add(item);
|
||||
}
|
||||
|
||||
public void init()
|
||||
|
@ -100,37 +98,21 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
ListItem targetItem = (ListItem) me.getTarget();
|
||||
if (draggedItem.getListbox() == targetItem.getListbox() && draggedItem.getListbox() == sortList)
|
||||
{
|
||||
int draggedIndex = sortList.getIndexOfItem(draggedItem);
|
||||
List<ListElement> selObjects = new ArrayList<ListElement>();
|
||||
int targetIndex = sortList.getIndexOfItem(targetItem);
|
||||
ListElement targetElement = (ListElement) sortModel.getElementAt(targetIndex);
|
||||
ListElement draggedElement = (ListElement) sortModel.getElementAt(draggedIndex);
|
||||
|
||||
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);
|
||||
|
||||
if (!draggedItem.isSelected())
|
||||
draggedItem.setSelected(true);
|
||||
|
||||
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);
|
||||
refresh();
|
||||
sortList.setSelectedIndex(targetIndex);
|
||||
if ( sortList.getSelectedItem() != null)
|
||||
{
|
||||
AuFocus focus = new AuFocus(sortList.getSelectedItem());
|
||||
|
@ -168,12 +150,38 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
vbox.appendChild(bDown);
|
||||
vbox.setWidth("50px");
|
||||
vbox.setHflex("60");
|
||||
//vbox.setParent(wind);
|
||||
hlayout.appendChild(vbox);
|
||||
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
|
||||
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) {
|
||||
int seq = 10;
|
||||
sortModel.removeAllElements();
|
||||
for (int i=0; i<listColumns.size(); i++) {
|
||||
MPrintFormatItem pfi = listColumns.get(i);
|
||||
if (pfi != null) {
|
||||
pfi.setSeqNo(seq);
|
||||
for(int j=0 ;j<m_pfi.length;j++){
|
||||
if(m_pfi[j].get_ID()== pfi.get_ID()){
|
||||
m_pfi[j].setSeqNo(seq);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
for (MPrintFormatItem pfi : listColumns){
|
||||
pfi.setSeqNo(seq);
|
||||
m_pfi.get(m_pfi.indexOf(pfi)).setSeqNo(seq);
|
||||
String name= pfi.getPrintName()== null ? pfi.getName(): pfi.getPrintName() ;
|
||||
ListElement element =new ListElement(pfi.get_ID(), name, pfi.getSeqNo(), pfi.getAD_Client_ID(), pfi.getAD_Org_ID());
|
||||
sortModel.addElement(element);
|
||||
sortList.addItem(new KeyNamePair(m_pfi.get(m_pfi.indexOf(pfi)).get_ID(), name));
|
||||
seq = seq + 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,9 +233,8 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
return;
|
||||
//
|
||||
int[] indices = sortList.getSelectedIndices();
|
||||
int firstposition=0, secondposition=0;
|
||||
boolean change = false;
|
||||
//
|
||||
MPrintFormatItem orig = null;
|
||||
Object source = event.getTarget();
|
||||
if (source == bUp)
|
||||
{
|
||||
|
@ -246,26 +242,19 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
int index = indices[i];
|
||||
if (index == 0)
|
||||
break;
|
||||
|
||||
ListElement selObject = (ListElement) sortModel.getElementAt(index);
|
||||
ListElement newObject = (ListElement)sortModel.getElementAt(index - 1);
|
||||
|
||||
sortModel.setElementAt(newObject, index);
|
||||
sortModel.setElementAt(selObject, index - 1);
|
||||
for(int j=0 ;j <m_pfi.length ;j++){
|
||||
if(m_pfi[j].get_ID() == selObject.getKey()){
|
||||
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()-10);
|
||||
firstposition=j;
|
||||
}
|
||||
if(m_pfi[j].get_ID() == newObject.getKey()){
|
||||
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()+10);
|
||||
secondposition=j;
|
||||
}
|
||||
}
|
||||
|
||||
listColumns.get(index).setSeqNo(listColumns.get(index).getSeqNo()-10);
|
||||
orig = listColumns.get(index);
|
||||
listColumns.get(index - 1).setSeqNo(listColumns.get(index - 1).getSeqNo()+10);
|
||||
listColumns.set(index, listColumns.get(index-1));
|
||||
listColumns.set(index-1 , orig);
|
||||
indices[i] = index - 1;
|
||||
change = true;
|
||||
MPrintFormatItem fi=m_pfi[firstposition];
|
||||
m_pfi[firstposition]=m_pfi[secondposition];
|
||||
m_pfi[secondposition]=fi;
|
||||
}
|
||||
} // up
|
||||
|
||||
|
@ -277,36 +266,24 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
break;
|
||||
ListElement selObject = (ListElement) sortModel.getElementAt(index);
|
||||
ListElement newObject = (ListElement)sortModel.getElementAt(index + 1);
|
||||
/*if (!selObject.isUpdateable() || !newObject.isUpdateable())
|
||||
break;*/
|
||||
|
||||
sortModel.setElementAt(newObject, index);
|
||||
sortModel.setElementAt(selObject, index + 1);
|
||||
sortList.setSelectedIndex(index + 1);
|
||||
for(int j=0 ;j <m_pfi.length ;j++){
|
||||
if(m_pfi[j].get_ID() == selObject.getKey()){
|
||||
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()+10);
|
||||
firstposition=j;
|
||||
}
|
||||
if(m_pfi[j].get_ID() == newObject.getKey()){
|
||||
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()-10);
|
||||
secondposition=j;
|
||||
}
|
||||
}
|
||||
//
|
||||
listColumns.get(index).setSeqNo(listColumns.get(index).getSeqNo()+10);
|
||||
orig = m_pfi.get(index);
|
||||
listColumns.get(index + 1).setSeqNo(listColumns.get(index + 1).getSeqNo()-10);
|
||||
listColumns.set(index, listColumns.get(index+1));
|
||||
listColumns.set(index+1,orig);
|
||||
indices[i] = index + 1;
|
||||
change = true;
|
||||
MPrintFormatItem fi=m_pfi[firstposition];
|
||||
m_pfi[firstposition]=m_pfi[secondposition];
|
||||
m_pfi[secondposition]=fi;
|
||||
}
|
||||
} // down
|
||||
|
||||
//
|
||||
if (change) {
|
||||
sortList.setSelectedIndices(indices);
|
||||
int idx = sortList.getSelectedIndex();
|
||||
refresh();
|
||||
wc.setIsChanged(true);
|
||||
sortList.setSelectedIndex(idx);
|
||||
if ( sortList.getSelectedItem() != null)
|
||||
{
|
||||
AuFocus focus = new AuFocus(sortList.getSelectedItem());
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
package org.adempiere.webui.panel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
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.util.Clients;
|
||||
import org.zkoss.zul.Hlayout;
|
||||
|
||||
import org.zkoss.zul.Vbox;
|
||||
|
||||
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 bUp = 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 yesModel = new SimpleListModel();
|
||||
Listbox noList = new Listbox();
|
||||
Listbox yesList = new Listbox();
|
||||
ArrayList<MPrintFormatItem> yesItems =new ArrayList<MPrintFormatItem>();
|
||||
ArrayList<MPrintFormatItem> noItems =new ArrayList<MPrintFormatItem>();
|
||||
|
||||
public WRC3SortCriteriaPanel() {
|
||||
super();
|
||||
|
@ -110,59 +110,7 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
noList.addOnDropListener(crossListMouseListener);
|
||||
yesList.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.setParent(yesList);
|
||||
ListHeader listHeader = new ListHeader();
|
||||
|
@ -219,69 +167,54 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
public void onEvent(Event event) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
|
||||
public void setListsColumns() {
|
||||
yesItems =new ArrayList<MPrintFormatItem>();
|
||||
noItems =new ArrayList<MPrintFormatItem>();
|
||||
if (m_pfi.length > 0 && m_pfi != null ) {
|
||||
int seq = 10;
|
||||
for(int i=0 ; i < m_pfi.length ; i++ ){
|
||||
if (m_pfi[i].isPrinted() && m_pfi[i] != null) {
|
||||
if (m_pfi[i].isOrderBy()) {
|
||||
m_pfi[i].setSortNo(seq);
|
||||
seq=seq+10;
|
||||
yesItems.add(m_pfi[i]);
|
||||
} else{
|
||||
noItems.add(m_pfi[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int i=0 ; i< m_pfi.size();i++){
|
||||
MPrintFormatItem item = m_pfi.get(i);
|
||||
if(item!=null && item.isPrinted()){
|
||||
if(item.isOrderBy()){
|
||||
yesItems.add(item);
|
||||
}else{
|
||||
noItems.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(yesItems, new Comparator<MPrintFormatItem>() {
|
||||
@Override
|
||||
public int compare(MPrintFormatItem o1, MPrintFormatItem o2) {
|
||||
return o1.getSortNo()-o2.getSortNo();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
|
||||
this.setListsColumns();
|
||||
yesList.removeAllItems();
|
||||
noList.removeAllItems();
|
||||
|
||||
if (yesItems.size() > 0 && yesItems != null) {
|
||||
yesModel.removeAllElements();
|
||||
for (int i=0 ; i < yesItems.size() ; i++) {
|
||||
MPrintFormatItem pfi = yesItems.get(i);
|
||||
if (pfi != null) {
|
||||
int ID= pfi.get_ID();
|
||||
String name =pfi.getPrintName();
|
||||
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);
|
||||
}
|
||||
for (int i=0 ; i < yesItems.size() ; i++) {
|
||||
int ID= yesItems.get(i).get_ID();
|
||||
String name = yesItems.get(i).getPrintName()==null? yesItems.get(i).getName():yesItems.get(i).getPrintName();
|
||||
yesList.addItem(new KeyNamePair(ID, name));
|
||||
yesModel.addElement(new ListElement(ID, name, yesItems.get(i).getSortNo(), true, yesItems.get(i).getAD_Client_ID(), yesItems.get(i).getAD_Org_ID()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (noItems.size() > 0 && noItems != null) {
|
||||
noModel.removeAllElements();
|
||||
for (int i=0 ; i < noItems.size() ; i++) {
|
||||
MPrintFormatItem pfi = noItems.get(i);
|
||||
if (pfi != null) {
|
||||
int ID= pfi.get_ID();
|
||||
pfi.setSortNo(0);
|
||||
pfi.setIsOrderBy(false);
|
||||
String name =pfi.getPrintName();
|
||||
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);
|
||||
}
|
||||
int ID= noItems.get(i).get_ID();
|
||||
String name = noItems.get(i).getPrintName()== null ? noItems.get(i).getName() : noItems.get(i).getPrintName();
|
||||
noItems.get(i).setSortNo(0);
|
||||
noItems.get(i).setIsOrderBy(false);
|
||||
noList.addItem(new KeyNamePair(ID, name));
|
||||
noModel.add(i,new ListElement(ID, name, noItems.get(i).getSortNo(), false, noItems.get(i).getAD_Client_ID(), noItems.get(i).getAD_Org_ID()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -302,45 +235,104 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
}
|
||||
Listbox listFrom = (source == bAdd || source == noList) ? noList : yesList;
|
||||
Listbox listTo = (source == bAdd || source == noList) ? yesList : noList;
|
||||
SimpleListModel lmFrom = (source == bAdd || source == noList) ?
|
||||
noModel : yesModel;
|
||||
SimpleListModel lmTo = (lmFrom == yesModel) ? noModel : yesModel;
|
||||
|
||||
int endIndex = yesList.getIndexOfItem(listTo.getSelectedItem());
|
||||
//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();
|
||||
List<ListElement> selObjects = new ArrayList<ListElement>();
|
||||
for (Object obj : selectedItems) {
|
||||
ListItem listItem = (ListItem) obj;
|
||||
int index = listFrom.getIndexOfItem(listItem);
|
||||
index = listFrom.getIndexOfItem(listItem);
|
||||
ListElement selObject = (ListElement)lmFrom.getElementAt(index);
|
||||
selObjects.add(selObject);
|
||||
}
|
||||
index = 0;
|
||||
boolean reOrder = false;
|
||||
Arrays.sort(selObjects.toArray());
|
||||
for (ListElement selObject : selObjects)
|
||||
{
|
||||
if (selObject == null)
|
||||
continue;
|
||||
|
||||
lmFrom.removeElement(selObject);
|
||||
lmTo.addElement(selObject);
|
||||
|
||||
for (int j=0 ; j<m_pfi.length ; j++) {
|
||||
if (m_pfi[j].get_ID() == selObject.m_key) {
|
||||
if (listFrom.equals(noList)) {
|
||||
m_pfi[j].setIsOrderBy(true);
|
||||
} else {
|
||||
m_pfi[j].setIsOrderBy(false);
|
||||
}
|
||||
}
|
||||
lmTo.add(endIndex, selObject);
|
||||
index = m_pfi.indexOf(getPrintFormatItem(selObject.m_key));
|
||||
if(listFrom.equals(noList)) {
|
||||
m_pfi.get(index).setIsOrderBy(true);
|
||||
reOrder =true;
|
||||
}else{
|
||||
m_pfi.get(index).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();
|
||||
if ( listTo.getSelectedItem() != null)
|
||||
{
|
||||
AuFocus focus = new AuFocus(listTo.getSelectedItem());
|
||||
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
|
||||
|
@ -358,7 +350,8 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
int[] indices = yesList.getSelectedIndices();
|
||||
//
|
||||
boolean change = false;
|
||||
//
|
||||
int selectedPI = 0 , targetPI = 0;
|
||||
MPrintFormatItem orig = null;
|
||||
Object source = event.getTarget();
|
||||
if (source == bUp)
|
||||
{
|
||||
|
@ -371,6 +364,18 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
|
||||
yesModel.setElementAt(newObject, index);
|
||||
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;
|
||||
change = true;
|
||||
}
|
||||
|
@ -388,15 +393,30 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
yesModel.setElementAt(newObject, index);
|
||||
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).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;
|
||||
change = true;
|
||||
}
|
||||
} // down
|
||||
|
||||
//
|
||||
if (change) {
|
||||
yesList.setSelectedIndices(indices);
|
||||
updateYesList();
|
||||
if (change) {
|
||||
yesList.removeAllItems();
|
||||
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)
|
||||
{
|
||||
AuFocus focus = new AuFocus(yesList.getSelectedItem());
|
||||
|
@ -405,23 +425,15 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
}
|
||||
} // migrateValueWithinYesList
|
||||
|
||||
public void updateYesList(){
|
||||
yesList.removeAllItems();
|
||||
wc.setIsChanged(true);
|
||||
int sortNo=10;
|
||||
for(int i=0;i<yesModel.getSize();i++){
|
||||
ListElement obj=(ListElement) yesModel.getElementAt(i);
|
||||
for(int j=0;j<m_pfi.length;j++){
|
||||
if(m_pfi[j].get_ID() == obj.getKey()){
|
||||
String name=obj.getName();
|
||||
int ID=obj.getKey();
|
||||
KeyNamePair pair=new KeyNamePair(ID, name);
|
||||
yesList.addItem(pair);
|
||||
m_pfi[j].setSortNo(sortNo);
|
||||
sortNo=sortNo+10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int selIndexPI,int targetIndexPI
|
||||
*/
|
||||
private void updateSortNo(int selIndexPI,int targetIndexPI)
|
||||
{
|
||||
int selSortNo = m_pfi.get(selIndexPI).getSortNo();
|
||||
m_pfi.get(selIndexPI).setSortNo(m_pfi.get(targetIndexPI).getSortNo());
|
||||
m_pfi.get(targetIndexPI).setSortNo(selSortNo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -520,45 +532,36 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
}
|
||||
|
||||
public void onEvent(Event event) throws Exception {
|
||||
int endIndex=0;
|
||||
if (event instanceof DropEvent)
|
||||
{
|
||||
int endIndex = 0;
|
||||
DropEvent me = (DropEvent) event;
|
||||
|
||||
ListItem endItem = (ListItem) me.getTarget();
|
||||
if (!(endItem.getListbox() == yesList))
|
||||
{
|
||||
return; // move within noList
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
int startIndex = noList.getIndexOfItem(startItem);
|
||||
ListElement element = (ListElement) noModel.getElementAt(startIndex);
|
||||
noModel.removeElement(element);
|
||||
endIndex = yesList.getIndexOfItem(endItem);
|
||||
yesModel.add(endIndex, element);
|
||||
|
||||
for (int j=0 ; j<m_pfi.length ; j++) {
|
||||
if (m_pfi[j].get_ID() == element.m_key) {
|
||||
m_pfi[j].setIsOrderBy(true);
|
||||
m_pfi[j].setSortNo(endIndex*10);
|
||||
Listbox listFrom = (Listbox)startItem.getListbox();
|
||||
Listbox listTo = (Listbox)endItem.getListbox();
|
||||
endIndex = yesList.getIndexOfItem(endItem);
|
||||
migrateLists (listFrom,listTo,endIndex);
|
||||
}else if (startItem.getListbox() == endItem.getListbox() && startItem.getListbox() == yesList)
|
||||
{
|
||||
List<ListElement> selObjects = new ArrayList<ListElement>();
|
||||
endIndex = yesList.getIndexOfItem(endItem);
|
||||
for (Object obj : yesList.getSelectedItems()) {
|
||||
ListItem listItem = (ListItem) obj;
|
||||
int index = yesList.getIndexOfItem(listItem);
|
||||
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
|
||||
public void refresh() {
|
||||
orderfield = new ArrayList<MPrintFormatItem>();
|
||||
for(int i=0 ; i < m_pfi.length ; i++){
|
||||
if(m_pfi[i] != null && m_pfi[i].isOrderBy() && m_pfi[i].isPrinted()){
|
||||
orderfield.add(m_pfi[i]);
|
||||
for(int i=0 ; i < m_pfi.size(); i++){
|
||||
if(m_pfi.get(i) != null && m_pfi.get(i).isOrderBy() && m_pfi.get(i).isPrinted()){
|
||||
orderfield.add(m_pfi.get(i));
|
||||
}
|
||||
}
|
||||
dynamicInit();
|
||||
|
@ -59,11 +59,8 @@ public class WRC4GroupingCriteriaPanel extends WRCTabPanel implements EventListe
|
|||
@Override
|
||||
public void updatePFI() {
|
||||
for(int i=0 ; i<orderfield.size() ; i++){
|
||||
for(int j=0 ;j<m_pfi.length ; j++){
|
||||
if(orderfield.get(i).get_ID() == m_pfi[j].get_ID()){
|
||||
m_pfi[j].setIsGroupBy(m_chkboxes[i].isChecked());
|
||||
}
|
||||
}
|
||||
int j = m_pfi.indexOf(getPrintFormatItem(orderfield.get(i).get_ID()));
|
||||
m_pfi.get(j).setIsGroupBy(m_chkboxes[i].isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +99,6 @@ public class WRC4GroupingCriteriaPanel extends WRCTabPanel implements EventListe
|
|||
columns.appendChild(cols[i+1]);
|
||||
}
|
||||
grid.appendChild(columns);
|
||||
|
||||
this.appendChild(wind);
|
||||
wind.appendChild(grid);
|
||||
}
|
||||
|
|
|
@ -84,9 +84,9 @@ public class WRC5SummaryFieldsPanel extends WRCTabPanel implements EventListener
|
|||
@Override
|
||||
public void refresh() {
|
||||
DisplayItems = new ArrayList<MPrintFormatItem>();
|
||||
for(int i=0 ; i<m_pfi.length ; i ++){
|
||||
if(m_pfi[i] != null && m_pfi[i].isPrinted()){
|
||||
DisplayItems.add(m_pfi[i]);
|
||||
for(int i=0 ; i<m_pfi.size() ; i ++){
|
||||
if(m_pfi.get(i) != null && m_pfi.get(i).isPrinted()){
|
||||
DisplayItems.add(m_pfi.get(i));
|
||||
}
|
||||
}
|
||||
dynamicInit();
|
||||
|
@ -95,17 +95,14 @@ public class WRC5SummaryFieldsPanel extends WRCTabPanel implements EventListener
|
|||
@Override
|
||||
public void updatePFI() {
|
||||
for(int i=0 ;i<DisplayItems.size() ; i++){
|
||||
for(int j=0 ; j<m_pfi.length ; j++){
|
||||
if(DisplayItems.get(i).get_ID() == m_pfi[j].get_ID()){
|
||||
m_pfi[j].setIsSummarized(m_chkSum[i].isChecked());
|
||||
m_pfi[j].setIsCounted(m_chkCount[i].isChecked());
|
||||
m_pfi[j].setIsMinCalc(m_chkMin[i].isChecked());
|
||||
m_pfi[j].setIsMaxCalc(m_chkMax[i].isChecked());
|
||||
m_pfi[j].setIsAveraged(m_chkMean[i].isChecked());
|
||||
m_pfi[j].setIsVarianceCalc(m_chkVariance[i].isChecked());
|
||||
m_pfi[j].setIsDeviationCalc(m_chkDesviation[i].isChecked());
|
||||
}
|
||||
}
|
||||
int j = m_pfi.indexOf(getPrintFormatItem(DisplayItems.get(i).get_ID()));
|
||||
m_pfi.get(j).setIsSummarized(m_chkSum[i].isChecked());
|
||||
m_pfi.get(j).setIsCounted(m_chkCount[i].isChecked());
|
||||
m_pfi.get(j).setIsMinCalc(m_chkMin[i].isChecked());
|
||||
m_pfi.get(j).setIsMaxCalc(m_chkMax[i].isChecked());
|
||||
m_pfi.get(j).setIsAveraged(m_chkMean[i].isChecked());
|
||||
m_pfi.get(j).setIsVarianceCalc(m_chkVariance[i].isChecked());
|
||||
m_pfi.get(j).setIsDeviationCalc(m_chkDesviation[i].isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,14 @@
|
|||
|
||||
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.component.Tabpanel;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.MField;
|
||||
import org.compiere.print.MPrintFormat;
|
||||
import org.compiere.print.MPrintFormatItem;
|
||||
|
||||
|
@ -25,9 +31,10 @@ public abstract class WRCTabPanel extends Tabpanel {
|
|||
*/
|
||||
private static final long serialVersionUID = -6858669581232541371L;
|
||||
|
||||
public MPrintFormatItem[] m_pfi;
|
||||
public ArrayList<MPrintFormatItem> m_pfi;
|
||||
public MPrintFormat m_pf;
|
||||
public WReportCustomization wc;
|
||||
public Map<Integer, MPrintFormatItem> mapPFormatItem = new HashMap<Integer, MPrintFormatItem>();
|
||||
|
||||
public abstract void refresh();
|
||||
|
||||
|
@ -35,14 +42,21 @@ public abstract class WRCTabPanel extends Tabpanel {
|
|||
|
||||
public void setMPrintFormat(MPrintFormat 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;
|
||||
}
|
||||
|
||||
public void setWReportCustomization(WReportCustomization 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;
|
||||
|
||||
/** Accounting Schema */
|
||||
private static MAcctSchema s_AcctSchema = null;
|
||||
private volatile static MAcctSchema s_AcctSchema = null;
|
||||
/** MWindow for AccountCombination */
|
||||
private GridWindow m_mWindow = null;
|
||||
/** MTab for AccountCombination */
|
||||
|
|
|
@ -138,9 +138,11 @@ public class Allocation
|
|||
sql = new StringBuilder( MRole.getDefault(Env.getCtx(), false).addAccessSQL( sql.toString(), "p", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO ) );
|
||||
|
||||
log.fine("PaySQL=" + sql.toString());
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
pstmt.setInt(1, m_C_Currency_ID);
|
||||
pstmt.setTimestamp(2, (Timestamp)date);
|
||||
pstmt.setInt(3, m_C_Currency_ID);
|
||||
|
@ -148,7 +150,7 @@ public class Allocation
|
|||
pstmt.setInt(5, m_C_BPartner_ID);
|
||||
if (!isMultiCurrency)
|
||||
pstmt.setInt(6, m_C_Currency_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
Vector<Object> line = new Vector<Object>();
|
||||
|
@ -171,13 +173,15 @@ public class Allocation
|
|||
//
|
||||
data.add(line);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -266,9 +270,11 @@ public class Allocation
|
|||
// role security
|
||||
sql = new StringBuilder( MRole.getDefault(Env.getCtx(), false).addAccessSQL( sql.toString(), "i", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO ) );
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
pstmt.setInt(1, m_C_Currency_ID);
|
||||
pstmt.setTimestamp(2, (Timestamp)date);
|
||||
pstmt.setInt(3, m_C_Currency_ID);
|
||||
|
@ -278,7 +284,7 @@ public class Allocation
|
|||
pstmt.setInt(7, m_C_BPartner_ID);
|
||||
if (!isMultiCurrency)
|
||||
pstmt.setInt(8, m_C_Currency_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
Vector<Object> line = new Vector<Object>();
|
||||
|
@ -309,13 +315,15 @@ public class Allocation
|
|||
if (Env.ZERO.compareTo(open) != 0)
|
||||
data.add(line);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -441,6 +449,7 @@ public class Allocation
|
|||
applied = applied.subtract(discount);
|
||||
writeOff = Env.ZERO; // to be sure
|
||||
overUnder = Env.ZERO;
|
||||
totalDiff = Env.ZERO;
|
||||
|
||||
if (totalDiff.abs().compareTo(applied.abs()) < 0 // where less is available to allocate than open
|
||||
&& totalDiff.signum() == applied.signum() ) // and the available amount has the same sign
|
||||
|
@ -737,11 +746,12 @@ public class Allocation
|
|||
// Allocation Line
|
||||
MAllocationLine aLine = new MAllocationLine (alloc, chargeAmt.negate(),
|
||||
Env.ZERO, Env.ZERO, Env.ZERO);
|
||||
aLine.set_CustomColumn("C_Charge_ID", m_C_Charge_ID);
|
||||
//aLine.set_CustomColumn("ChargeAmt", chargeAmt);
|
||||
aLine.setC_Charge_ID(m_C_Charge_ID);
|
||||
aLine.setC_BPartner_ID(m_C_BPartner_ID);
|
||||
if (!aLine.save(trxName))
|
||||
log.log(Level.SEVERE, "Allocation Line not saved - Charge=" + m_C_Charge_ID);
|
||||
if (!aLine.save(trxName)) {
|
||||
StringBuilder msg = new StringBuilder("Allocation Line not saved - Charge=").append(m_C_Charge_ID);
|
||||
throw new AdempiereException(msg.toString());
|
||||
}
|
||||
unmatchedApplied = unmatchedApplied.add(chargeAmt);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.compiere.util.WebEnv;
|
|||
public class StoreFilter implements javax.servlet.Filter
|
||||
{
|
||||
/** Logging */
|
||||
private static CLogger log = null;
|
||||
private volatile static CLogger log = null;
|
||||
|
||||
/**
|
||||
* Init
|
||||
|
|
|
@ -164,7 +164,7 @@ public class DB_Oracle implements AdempiereDatabase
|
|||
* @return Driver
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Driver getDriver() throws SQLException
|
||||
public synchronized Driver getDriver() throws SQLException
|
||||
{
|
||||
if (s_driver == null)
|
||||
{
|
||||
|
|
|
@ -45,7 +45,7 @@ import fitnesse.fixtures.TableFixture;
|
|||
* @author Carlos Ruiz - globalqss
|
||||
*/
|
||||
public class AssertRecord extends TableFixture {
|
||||
private static Instance adempiereInstance = null;
|
||||
private volatile static Instance adempiereInstance = null;
|
||||
|
||||
@Override
|
||||
protected void doStaticTable(int rows) {
|
||||
|
|
|
@ -36,7 +36,7 @@ import fitnesse.fixtures.TableFixture;
|
|||
* @author Carlos Ruiz - globalqss
|
||||
*/
|
||||
public class AssertVariable extends TableFixture {
|
||||
private static Instance adempiereInstance = null;
|
||||
private volatile static Instance adempiereInstance = null;
|
||||
|
||||
@Override
|
||||
protected void doStaticTable(int rows) {
|
||||
|
|
|
@ -44,7 +44,7 @@ import fitnesse.fixtures.TableFixture;
|
|||
* @author Carlos Ruiz - globalqss
|
||||
*/
|
||||
public class CreateRecord extends TableFixture {
|
||||
private static Instance adempiereInstance = null;
|
||||
private volatile static Instance adempiereInstance = null;
|
||||
|
||||
@Override
|
||||
protected void doStaticTable(int rows) {
|
||||
|
|
|
@ -39,7 +39,7 @@ import fitnesse.fixtures.TableFixture;
|
|||
*/
|
||||
public class Login extends TableFixture {
|
||||
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_password;
|
||||
private String m_language;
|
||||
|
|
|
@ -45,7 +45,7 @@ import fitnesse.fixtures.TableFixture;
|
|||
* @author Carlos Ruiz - globalqss
|
||||
*/
|
||||
public class ReadRecord extends TableFixture {
|
||||
private static Instance adempiereInstance = null;
|
||||
private volatile static Instance adempiereInstance = null;
|
||||
|
||||
@Override
|
||||
protected void doStaticTable(int rows) {
|
||||
|
|
|
@ -58,7 +58,7 @@ import fitnesse.fixtures.TableFixture;
|
|||
* @author Carlos Ruiz - globalqss
|
||||
*/
|
||||
public class RunProcess extends TableFixture {
|
||||
private static Instance adempiereInstance = null;
|
||||
private volatile static Instance adempiereInstance = null;
|
||||
|
||||
private static CLogger log = CLogger.getCLogger(RunProcess.class);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ import fitnesse.fixtures.TableFixture;
|
|||
* @author Carlos Ruiz - globalqss
|
||||
*/
|
||||
public class SetDocAction extends TableFixture {
|
||||
private static Instance adempiereInstance = null;
|
||||
private volatile static Instance adempiereInstance = null;
|
||||
|
||||
@Override
|
||||
protected void doStaticTable(int rows) {
|
||||
|
|
|
@ -38,7 +38,7 @@ import fitnesse.fixtures.TableFixture;
|
|||
* @author Carlos Ruiz - globalqss
|
||||
*/
|
||||
public class SetVariable extends TableFixture {
|
||||
private static Instance adempiereInstance = null;
|
||||
private volatile static Instance adempiereInstance = null;
|
||||
|
||||
@Override
|
||||
protected void doStaticTable(int rows) {
|
||||
|
|
|
@ -32,7 +32,7 @@ package org.idempiere.fitnesse.fixture;
|
|||
* @author Carlos Ruiz - globalqss
|
||||
*/
|
||||
public class Static_iDempiereInstance {
|
||||
private static Instance adempiereInstance;
|
||||
private volatile static Instance adempiereInstance;
|
||||
|
||||
public static Instance getInstance() {
|
||||
if (adempiereInstance == null) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<web-app id="iDempiere" xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
<web-app id="Fitnesse" xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
|
|
|
@ -6,4 +6,5 @@ bin.includes = META-INF/,\
|
|||
lib/fitlibrary-2.0.jar,\
|
||||
lib/log4j-1.2.16.jar,\
|
||||
lib/fitlibraryweb-2.0.jar,\
|
||||
lib/selenium-server-standalone-2.27.0.jar
|
||||
lib/selenium-server-standalone-2.27.0.jar,\
|
||||
WEB-INF/
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
*****************************************************************************/
|
||||
package org.idempiere.hazelcast.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
|
@ -24,6 +28,8 @@ import org.compiere.model.ServerStateChangeListener;
|
|||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
import com.hazelcast.config.Config;
|
||||
import com.hazelcast.config.FileSystemXmlConfig;
|
||||
import com.hazelcast.core.*;
|
||||
|
||||
/**
|
||||
|
@ -39,7 +45,7 @@ public class Activator implements BundleActivator {
|
|||
return context;
|
||||
}
|
||||
|
||||
private static HazelcastInstance hazelcastInstance;
|
||||
private volatile static HazelcastInstance hazelcastInstance;
|
||||
private static AtomicReference<Future<?>> futureRef = new AtomicReference<Future<?>>();
|
||||
|
||||
/*
|
||||
|
@ -68,6 +74,21 @@ public class Activator implements BundleActivator {
|
|||
Future<?> future = executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String dataArea = System.getProperty("osgi.install.area");
|
||||
if (dataArea != null && dataArea.trim().length() > 0) {
|
||||
try {
|
||||
URL url = new URL(dataArea);
|
||||
File file = new File(url.getPath(), "hazelcast.xml");
|
||||
if (file.exists()) {
|
||||
try {
|
||||
Config config = new FileSystemXmlConfig(file);
|
||||
hazelcastInstance = Hazelcast.newHazelcastInstance(config);
|
||||
return;
|
||||
} catch (FileNotFoundException e) {}
|
||||
}
|
||||
} catch (MalformedURLException e1) {
|
||||
}
|
||||
}
|
||||
hazelcastInstance = Hazelcast.newHazelcastInstance(null);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -25,14 +25,16 @@ public class ClusterMember implements IClusterMember {
|
|||
|
||||
private String id;
|
||||
private InetAddress address;
|
||||
private int port;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param address
|
||||
*/
|
||||
public ClusterMember(String id, InetAddress address) {
|
||||
public ClusterMember(String id, InetAddress address, int port) {
|
||||
this.id = id;
|
||||
this.address = address;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -51,4 +53,15 @@ public class ClusterMember implements IClusterMember {
|
|||
return address;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getAddress().getHostAddress()+":"+getPort()+" "+id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ClusterServiceImpl implements IClusterService {
|
|||
Set<Member> members = Activator.getHazelcastInstance().getCluster().getMembers();
|
||||
Set<IClusterMember> clusterMembers = new HashSet<IClusterMember>();
|
||||
for(Member member : members) {
|
||||
clusterMembers.add(new ClusterMember(member.getUuid(), member.getInetSocketAddress().getAddress()));
|
||||
clusterMembers.add(new ClusterMember(member.getUuid(), member.getInetSocketAddress().getAddress(), member.getInetSocketAddress().getPort()));
|
||||
}
|
||||
return clusterMembers;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class ClusterServiceImpl implements IClusterService {
|
|||
@Override
|
||||
public IClusterMember getLocalMember() {
|
||||
Member member = Activator.getHazelcastInstance().getCluster().getLocalMember();
|
||||
return new ClusterMember(member.getUuid(), member.getInetSocketAddress().getAddress());
|
||||
return new ClusterMember(member.getUuid(), member.getInetSocketAddress().getAddress(), member.getInetSocketAddress().getPort());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -98,6 +98,54 @@ public class ZkFixture extends SpiderFixture {
|
|||
return (String) widget.eval(webDriver, "getSelectedTab().getLabel()");
|
||||
}
|
||||
|
||||
//--- Search (lookup) --
|
||||
@SimpleAction(wiki = "|''<i>lookup</i>''|xpath, id or other locator|''<i>search</i>''|value|", tooltip = "Search lookup with value.")
|
||||
public void lookupSearch(String locator, String value) {
|
||||
Widget widget = new Widget(locator + " @textbox");
|
||||
WebElement element = widget.findElement(webDriver);
|
||||
element.click();
|
||||
widget.execute(webDriver, "setValue('"+value+"')");
|
||||
widget.execute(webDriver, "fireOnChange()");
|
||||
}
|
||||
|
||||
// ---- window ( tab ) ---
|
||||
@SimpleAction(wiki = "|''<i>open window</i>''|menu label|", tooltip = "Open window with label.")
|
||||
public void openWindow(String label) {
|
||||
comboboxSelectItem("$treeSearchCombo", label);
|
||||
}
|
||||
|
||||
@SimpleAction(wiki = "|''<i>window</i>''|xpath, id or other locator|''<i>click process button</i>''|button id|", tooltip = "Click a window's process button.")
|
||||
public void windowClickProcessButton(String windowLocator, String btnId) {
|
||||
click(windowLocator + " $windowToolbar $BtnProcess");
|
||||
waitResponse();
|
||||
click("@window[instanceName=\"processButtonPopup\"] $" + btnId);
|
||||
}
|
||||
|
||||
@SimpleAction(wiki = "|''<i>window</i>''|xpath, id or other locator|''<i>click toolbar</i>''|value|", tooltip = "Click a window's toolbar button")
|
||||
public void windowClickToolbar(String windowLocator, String toolbarButtonId) {
|
||||
click(windowLocator + " $windowToolbar $" + toolbarButtonId);
|
||||
}
|
||||
|
||||
@SimpleAction(wiki = "|''<i>window</i>''|xpath, id or other locator|''<i>click detail toolbar</i>''|value|", tooltip = "Click the detailpane's toolbar button")
|
||||
public void windowClickDetailToolbar(String windowLocator, String toolbarButtonId) {
|
||||
click(windowLocator + " $detailPane $" + toolbarButtonId + ":visible");
|
||||
}
|
||||
|
||||
@SimpleAction(wiki = "|''<i>window message</i>''|xpath, id or other locator|", tooltip = "Current status message display for a window")
|
||||
public String windowMessage(String windowLocator) {
|
||||
return webDriver.findElement(Zk.jq(windowLocator +" $messages @label")).getText();
|
||||
}
|
||||
|
||||
@SimpleAction(wiki = "|''<i>window</i>''|xpath, id or other locator|''<i>next record</i>''|value|", tooltip = "Navigate to next record.")
|
||||
public void windowNextRecord(String windowLocator) {
|
||||
click(windowLocator+" $breadCrumb $Next");
|
||||
}
|
||||
|
||||
@SimpleAction(wiki = "|''<i>window</i>''|xpath, id or other locator|''<i>previous record</i>''|value|", tooltip = "Navigate to previous record.")
|
||||
public void windowPreviousRecord(String windowLocator) {
|
||||
click(windowLocator+" $breadCrumb $Previous");
|
||||
}
|
||||
|
||||
// -------- Wait Ajax Response -----
|
||||
@SimpleAction(wiki = "|''<i>wait response</i>''|", tooltip = "Wait for ajax response with default timeout value.")
|
||||
public void waitResponse() {
|
||||
|
|
|
@ -53,6 +53,14 @@ public class AbstractTestCase {
|
|||
element.click();
|
||||
}
|
||||
|
||||
protected void search(String locator, String label) {
|
||||
Widget widget = new Widget(locator + " @textbox");
|
||||
WebElement element = widget.findElement(driver);
|
||||
element.click();
|
||||
widget.execute(driver, "setValue('"+label+"')");
|
||||
widget.execute(driver, "fireOnChange()");
|
||||
}
|
||||
|
||||
protected void selectCheckbox(String locator, boolean select) {
|
||||
final WebElement element = driver.findElement(Zk.jq("$"+locator+" ~ input"));
|
||||
if (element.isSelected()) {
|
||||
|
@ -204,6 +212,36 @@ public class AbstractTestCase {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void openWindow(String label) {
|
||||
comboboxSelectItem("$treeSearchCombo", label);
|
||||
}
|
||||
|
||||
protected void clickProcessButton(String windowId, String btnId) {
|
||||
clickButton("$"+windowId + " $windowToolbar $BtnProcess");
|
||||
waitResponse();
|
||||
clickButton("@window[instanceName=\"processButtonPopup\"] $" + btnId);
|
||||
}
|
||||
|
||||
protected void clickToolbarButton(String windowId, String toolBarButtonId) {
|
||||
clickButton("$" + windowId + " $windowToolbar $" + toolBarButtonId);
|
||||
}
|
||||
|
||||
protected void clickDetailToolbarButton(String windowId, String toolBarButtonId) {
|
||||
clickButton("$" + windowId + " $detailPane $" + toolBarButtonId + ":visible");
|
||||
}
|
||||
|
||||
protected WebElement getWindowMessageLabel(String windowId) {
|
||||
return driver.findElement(Zk.jq("$"+windowId +" $messages @label"));
|
||||
}
|
||||
|
||||
protected void nextRecord(String windowId) {
|
||||
clickButton("$"+windowId+" $breadCrumb $Next");
|
||||
}
|
||||
|
||||
protected void previousRecord(String windowId) {
|
||||
clickButton("$"+windowId+" $breadCrumb $Previous");
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
package test;
|
||||
|
||||
import org.idempiere.ui.zk.selenium.Zk;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
/**
|
||||
* Test case for http://jira.idempiere.com/browse/IDEMPIERE-520
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class ProductionTest extends AbstractTestCase {
|
||||
|
||||
@Test
|
||||
public void testIDempiere520() throws Exception {
|
||||
login();
|
||||
|
||||
String windowId = "Production__Single_Product__1";
|
||||
|
||||
openWindow("Production (Single Product)");
|
||||
|
||||
waitResponse();
|
||||
|
||||
//check detail is shown for new record
|
||||
WebElement element = driver.findElement(Zk.jq("$"+windowId+" $detailPane @tabbox"));
|
||||
|
||||
assertTrue(element != null && element.isDisplayed());
|
||||
|
||||
search("$"+windowId+" $Production $M_Product_ID", "PatioSet");
|
||||
waitResponse();
|
||||
|
||||
type("$"+windowId+" $Production $ProductionQty @decimalbox", "1");
|
||||
|
||||
|
||||
clickToolbarButton(windowId, "BtnSave");
|
||||
waitResponse();
|
||||
|
||||
//verify save successfull
|
||||
element = getWindowMessageLabel(windowId);
|
||||
assertTrue("Record saved".equals(element.getText()));
|
||||
|
||||
clickDetailToolbarButton(windowId, "BtnNew");
|
||||
|
||||
//verify +*1/1 for is shown for new record
|
||||
waitResponse();
|
||||
element = driver.findElement(Zk.jq("$"+windowId+" $recordInfo"));
|
||||
assertEquals("+*1/1", element.getText());
|
||||
|
||||
//test for npe
|
||||
clickToolbarButton(windowId, "BtnParentRecord");
|
||||
waitResponse();
|
||||
|
||||
//create production lines
|
||||
clickProcessButton(windowId, "CreateFrom");
|
||||
waitResponse();
|
||||
clickButton("$"+windowId+" @window[title=\"Create Production\"] $Ok");
|
||||
waitResponse();
|
||||
|
||||
clickDetailToolbarButton(windowId, "BtnEdit");
|
||||
waitResponse();
|
||||
|
||||
//verify qc tab visible for first record
|
||||
element = driver.findElement(Zk.jq("$"+windowId+" $detailPane @tab"));
|
||||
assertTrue(element != null && element.isDisplayed());
|
||||
|
||||
nextRecord(windowId);
|
||||
waitResponse();
|
||||
|
||||
//verify qc tab is invisible for first record
|
||||
element = driver.findElement(Zk.jq("$"+windowId+" $detailPane @tab"));
|
||||
assertTrue(element == null || !element.isDisplayed());
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ public class SelectTabTest extends AbstractTestCase {
|
|||
public void testSelectTab() throws Exception {
|
||||
login();
|
||||
waitResponse();
|
||||
comboboxSelectItem("$treeSearchCombo", "Product");
|
||||
openWindow("Product");
|
||||
waitResponse();
|
||||
clickButton("$findWindow_1 $simpleSearch $btnOk");
|
||||
waitResponse();
|
||||
|
@ -26,7 +26,7 @@ public class SelectTabTest extends AbstractTestCase {
|
|||
selectTab("$Product_1 $detailPane @tabbox", "Business Partner");
|
||||
assertEquals("Business Partner", selectedTab("$Product_1 $detailPane @tabbox"));
|
||||
|
||||
WebElement element = driver.findElement(Zk.jq("$Product_1 $Product @textbox[columnName=\"Name\"]"));
|
||||
WebElement element = driver.findElement(Zk.jq("$Product_1 $Product @textbox[instanceName=\"M_Product0Name\"]"));
|
||||
assertNotNull(element);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="WEB-INF/lib/Idempiere-XMLSBean-1.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="WEB-INF/lib/idempiere-xmlbeans-1.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="WEB-INF/lib/spring-osgi-extender-1.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="WEB-INF/lib/spring-aop-3.0.7.RELEASE.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="WEB-INF/lib/commons-logging-1.1.1.jar"/>
|
||||
|
@ -20,7 +20,6 @@
|
|||
<classpathentry exported="true" kind="lib" path="WEB-INF/lib/spring-web-3.0.7.RELEASE.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="WEB-INF/src"/>
|
||||
<classpathentry kind="output" path="WEB-INF/classes/"/>
|
||||
</classpath>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue