* ported lock & unlock ui for process.
This commit is contained in:
parent
5a443d4ee9
commit
fded7d0218
|
@ -18,6 +18,7 @@
|
||||||
package org.adempiere.webui.panel;
|
package org.adempiere.webui.panel;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.apps.ProcessModalDialog;
|
import org.adempiere.webui.apps.ProcessModalDialog;
|
||||||
|
@ -48,6 +49,9 @@ import org.compiere.model.GridWindowVO;
|
||||||
import org.compiere.model.MQuery;
|
import org.compiere.model.MQuery;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.process.DocAction;
|
import org.compiere.process.DocAction;
|
||||||
|
import org.compiere.process.ProcessInfo;
|
||||||
|
import org.compiere.process.ProcessInfoUtil;
|
||||||
|
import org.compiere.util.ASyncProcess;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -58,6 +62,7 @@ import org.zkoss.zk.ui.Executions;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -70,7 +75,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
* @version $Revision: 0.10 $
|
* @version $Revision: 0.10 $
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractADWindowPanel extends AbstractUIPart implements ToolbarListener,
|
public abstract class AbstractADWindowPanel extends AbstractUIPart implements ToolbarListener,
|
||||||
EventListener, DataStatusListener, ActionListener
|
EventListener, DataStatusListener, ActionListener, ASyncProcess
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -115,6 +120,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
|
|
||||||
private Component parent;
|
private Component parent;
|
||||||
|
|
||||||
|
private boolean m_uiLocked;
|
||||||
|
|
||||||
public AbstractADWindowPanel(Properties ctx, int windowNo)
|
public AbstractADWindowPanel(Properties ctx, int windowNo)
|
||||||
{
|
{
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
|
@ -880,7 +887,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
int table_ID = curTab.getAD_Table_ID();
|
int table_ID = curTab.getAD_Table_ID();
|
||||||
int record_ID = curTab.getRecord_ID();
|
int record_ID = curTab.getRecord_ID();
|
||||||
|
|
||||||
ProcessModalDialog dialog = new ProcessModalDialog(null,this.getTitle(),null,0,
|
if (!getComponent().getDesktop().isServerPushEnabled())
|
||||||
|
getComponent().getDesktop().enableServerPush(true);
|
||||||
|
|
||||||
|
ProcessModalDialog dialog = new ProcessModalDialog(null,this.getTitle(),this,0,
|
||||||
AD_Process_ID,table_ID, record_ID, true);
|
AD_Process_ID,table_ID, record_ID, true);
|
||||||
if (dialog.isValid()) {
|
if (dialog.isValid()) {
|
||||||
dialog.setPosition("center");
|
dialog.setPosition("center");
|
||||||
|
@ -1153,8 +1163,11 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
ProcessCtl.process(this, m_curWindowNo, pi, null); // calls lockUI, unlockUI
|
ProcessCtl.process(this, m_curWindowNo, pi, null); // calls lockUI, unlockUI
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!getComponent().getDesktop().isServerPushEnabled())
|
||||||
|
getComponent().getDesktop().enableServerPush(true);
|
||||||
|
|
||||||
ProcessModalDialog dialog = new ProcessModalDialog(null,
|
ProcessModalDialog dialog = new ProcessModalDialog(null,
|
||||||
Env.getHeader(ctx, curWindowNo), null, curWindowNo,
|
Env.getHeader(ctx, curWindowNo), this, curWindowNo,
|
||||||
wButton.getProcess_ID(), table_ID, record_ID, startWOasking);
|
wButton.getProcess_ID(), table_ID, record_ID, startWOasking);
|
||||||
|
|
||||||
if (dialog.isValid())
|
if (dialog.isValid())
|
||||||
|
@ -1164,8 +1177,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
dialog.setPosition("center");
|
dialog.setPosition("center");
|
||||||
AEnv.showWindow(dialog);
|
AEnv.showWindow(dialog);
|
||||||
}
|
}
|
||||||
curTab.dataRefresh();
|
// curTab.dataRefresh();
|
||||||
curTabpanel.dynamicDisplay(0);
|
// curTabpanel.dynamicDisplay(0);
|
||||||
} // actionButton
|
} // actionButton
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent event)
|
public void actionPerformed(ActionEvent event)
|
||||||
|
@ -1179,4 +1192,93 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
public IADTab getADTab() {
|
public IADTab getADTab() {
|
||||||
return adTab;
|
return adTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void executeASync(ProcessInfo pi) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUILocked() {
|
||||||
|
return m_uiLocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void lockUI(ProcessInfo pi) {
|
||||||
|
m_uiLocked = true;
|
||||||
|
boolean notPrint = pi != null
|
||||||
|
&& pi.getAD_Process_ID() != curTab.getAD_Process_ID()
|
||||||
|
&& pi.isReportingProcess() == false;
|
||||||
|
//
|
||||||
|
// Process Result
|
||||||
|
if (notPrint) // refresh if not print
|
||||||
|
{
|
||||||
|
if (Executions.getCurrent() != null)
|
||||||
|
Clients.showBusy("Processing...", true);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//get full control of desktop
|
||||||
|
Executions.activate(getComponent().getDesktop());
|
||||||
|
try {
|
||||||
|
Clients.showBusy("Processing...", true);
|
||||||
|
} catch(Error ex){
|
||||||
|
throw ex;
|
||||||
|
} finally{
|
||||||
|
//release full control of desktop
|
||||||
|
Executions.deactivate(getComponent().getDesktop());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.log(Level.WARNING, "Failed to lock UI.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unlockUI(ProcessInfo pi) {
|
||||||
|
boolean notPrint = pi != null
|
||||||
|
&& pi.getAD_Process_ID() != curTab.getAD_Process_ID()
|
||||||
|
&& pi.isReportingProcess() == false;
|
||||||
|
//
|
||||||
|
// Process Result
|
||||||
|
if (notPrint) // refresh if not print
|
||||||
|
{
|
||||||
|
if (Executions.getCurrent() != null)
|
||||||
|
{
|
||||||
|
updateUI(pi);
|
||||||
|
Clients.showBusy(null, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//get full control of desktop
|
||||||
|
Executions.activate(getComponent().getDesktop());
|
||||||
|
try {
|
||||||
|
updateUI(pi);
|
||||||
|
Clients.showBusy(null, false);
|
||||||
|
} catch(Error ex){
|
||||||
|
throw ex;
|
||||||
|
} finally{
|
||||||
|
//release full control of desktop
|
||||||
|
Executions.deactivate(getComponent().getDesktop());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.log(Level.WARNING, "Failed to update UI upon unloc.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateUI(ProcessInfo pi) {
|
||||||
|
// Refresh data
|
||||||
|
curTab.dataRefresh();
|
||||||
|
// Timeout
|
||||||
|
if (pi.isTimeout()) // set temporarily to R/O
|
||||||
|
Env.setContext(ctx, curWindowNo, "Processed", "Y");
|
||||||
|
curTabpanel.dynamicDisplay(0);
|
||||||
|
// Update Status Line
|
||||||
|
statusBar.setStatusLine(pi.getSummary(), pi.isError());
|
||||||
|
// Get Log Info
|
||||||
|
ProcessInfoUtil.setLogFromDB(pi);
|
||||||
|
String logInfo = pi.getLogInfo();
|
||||||
|
if (logInfo.length() > 0)
|
||||||
|
FDialog.info(curWindowNo, this.getComponent(), Env.getHeader(ctx, curWindowNo),
|
||||||
|
pi.getTitle() + "<br>" + logInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package org.adempiere.webui.session;
|
package org.adempiere.webui.session;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import javax.servlet.ServletConfig;
|
import javax.servlet.ServletConfig;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
@ -73,7 +74,7 @@ public class WebUIServlet extends DHtmlLayoutServlet
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
logger.severe("Could not initialize ADempiere logging Management");
|
logger.log(Level.SEVERE, "Could not initialize ADempiere logging Management", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean started = Adempiere.startup(false);
|
boolean started = Adempiere.startup(false);
|
||||||
|
|
Loading…
Reference in New Issue