IDEMPIERE-321 problem creating city in zk6 interface

This commit is contained in:
Heng Sin Low 2012-07-02 10:35:45 +08:00
parent 1ca7cd5112
commit 50511476ec
3 changed files with 53 additions and 4 deletions

View File

@ -0,0 +1,45 @@
/******************************************************************************
* Copyright (C) 2012 Heng Sin Low *
* Copyright (C) 2012 Trek Global *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.util;
import java.util.Properties;
/**
* @author hengsin
*
*/
public abstract class ContextRunnable implements Runnable {
protected Properties context = null;
public ContextRunnable() {
this.context = ServerContext.getCurrentInstance();
}
/* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
try {
ServerContext.setCurrentInstance(context);
doRun();
} finally {
ServerContext.dispose();
}
}
protected abstract void doRun();
}

View File

@ -42,6 +42,7 @@ import javax.swing.event.TableModelListener;
import javax.swing.table.AbstractTableModel; import javax.swing.table.AbstractTableModel;
import org.adempiere.exceptions.DBException; import org.adempiere.exceptions.DBException;
import org.adempiere.util.ContextRunnable;
import org.compiere.Adempiere; import org.compiere.Adempiere;
import org.compiere.util.CLogMgt; import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
@ -3299,7 +3300,7 @@ public class GridTable extends AbstractTableModel
/************************************************************************** /**************************************************************************
* ASync Loader * ASync Loader
*/ */
class Loader implements Serializable, Runnable class Loader extends ContextRunnable implements Serializable
{ {
/** /**
* *
@ -3311,6 +3312,7 @@ public class GridTable extends AbstractTableModel
*/ */
public Loader() public Loader()
{ {
super();
} // Loader } // Loader
private PreparedStatement m_pstmt = null; private PreparedStatement m_pstmt = null;
@ -3399,7 +3401,7 @@ public class GridTable extends AbstractTableModel
/** /**
* Fill Buffer to include Row * Fill Buffer to include Row
*/ */
public void run() protected void doRun()
{ {
log.info(""); log.info("");
if (m_rs == null) if (m_rs == null)

View File

@ -26,6 +26,7 @@ import java.util.LinkedHashMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.util.ContextRunnable;
import org.compiere.Adempiere; import org.compiere.Adempiere;
import org.compiere.util.CLogMgt; import org.compiere.util.CLogMgt;
import org.compiere.util.DB; import org.compiere.util.DB;
@ -639,7 +640,7 @@ public final class MLookup extends Lookup implements Serializable
/************************************************************************** /**************************************************************************
* MLookup Loader * MLookup Loader
*/ */
class MLoader implements Serializable, Runnable class MLoader extends ContextRunnable implements Serializable
{ {
/** /**
* *
@ -651,6 +652,7 @@ public final class MLookup extends Lookup implements Serializable
*/ */
public MLoader() public MLoader()
{ {
super();
} // Loader } // Loader
private long m_startTime = System.currentTimeMillis(); private long m_startTime = System.currentTimeMillis();
@ -658,7 +660,7 @@ public final class MLookup extends Lookup implements Serializable
/** /**
* Load Lookup * Load Lookup
*/ */
public void run() protected void doRun()
{ {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
if (Ini.isClient()) if (Ini.isClient())