use of org.compiere.apps.ProcessCtl in project adempiere by adempiere.
the class ProcessPanel method runProcess.
/**
* Run it
*/
protected void runProcess() {
getProcessInfo().setPrintPreview(true);
ProcessCtl worker = new ProcessCtl(this, getWindowNo(), getProcessInfo(), null);
worker.run();
// Run
}
use of org.compiere.apps.ProcessCtl in project adempiere by adempiere.
the class WBrowser method cmd_Ok.
/**
* Ok Action
*/
private void cmd_Ok() {
log.config("OK=" + true);
m_ok = true;
saveResultSelection(detail);
saveSelection(detail);
// Is Process ok
boolean isOk = false;
// Valid Process, Selected Keys and process parameters
if (getAD_Process_ID() > 0 && getSelectedKeys() != null) {
parameterPanel.getProcessInfo().setAD_PInstance_ID(-1);
// FR [ 265 ]
if (parameterPanel.validateParameters() == null) {
// Save Parameters
if (parameterPanel.saveParameters() == null) {
// Get Process Info
ProcessInfo pi = parameterPanel.getProcessInfo();
if (getFieldKey() != null && getFieldKey().get_ID() > 0) {
MViewDefinition viewDefinition = (MViewDefinition) getFieldKey().getAD_View_Column().getAD_View_Definition();
pi.setAliasForTableSelection(viewDefinition.getTableAlias());
pi.setTableSelectionId(viewDefinition.getAD_Table_ID());
}
// Set Selected Values
pi.setSelectionValues(getSelectedValues());
//
setBrowseProcessInfo(pi);
// Execute Process
ProcessCtl worker = new ProcessCtl(this, pi.getWindowNo(), pi, null);
showBusyDialog();
worker.run();
hideBusyDialog();
setStatusLine(pi.getSummary(), pi.isError());
// For Valid Ok
isOk = !pi.isError();
}
}
}
// For when is ok the process
if (isOk) {
// Close
if (getParentWindowNo() > 0) {
// BR [ 394 ]
Env.clearWinContext(getWindowNo());
SessionManager.getAppDesktop().closeActiveWindow();
return;
}
// Else Reset
p_loadedOK = initBrowser();
collapsibleSeach.setOpen(true);
}
}
use of org.compiere.apps.ProcessCtl in project adempiere by adempiere.
the class VGenPanel method generate.
// saveSelection
/**************************************************************************
* Generate Shipments/Invoices
*/
public void generate() {
info.setText(genForm.generate());
ProcessCtl worker = new ProcessCtl(this, Env.getWindowNo(this), genForm.getProcessInfo(), genForm.getTrx());
worker.start();
//
}
use of org.compiere.apps.ProcessCtl in project adempiere by adempiere.
the class VBrowser method cmd_Process.
/**
* Process Action
*/
private void cmd_Process() {
m_frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
m_ok = true;
// End Worker
if (m_worker != null) {
// worker continues, but it does not block UI
if (m_worker.isAlive())
m_worker.interrupt();
log.config("Worker alive=" + m_worker.isAlive());
}
m_worker = null;
saveResultSelection(detail);
saveSelection(detail);
// Is Process ok
boolean isOk = false;
// Valid Process, Selected Keys and process parameters
if (getAD_Process_ID() > 0 && getSelectedKeys() != null) {
processParameterPanel.getProcessInfo().setAD_PInstance_ID(-1);
// BR [ 249 ]
if (processParameterPanel.validateParameters() == null) {
// Save Parameters
if (processParameterPanel.saveParameters() == null) {
// Get Process Info
ProcessInfo pi = processParameterPanel.getProcessInfo();
// Set Selected Values
if (getFieldKey() != null && getFieldKey().get_ID() > 0) {
MViewDefinition viewDefinition = (MViewDefinition) getFieldKey().getAD_View_Column().getAD_View_Definition();
pi.setAliasForTableSelection(viewDefinition.getTableAlias());
pi.setTableSelectionId(viewDefinition.getAD_Table_ID());
}
pi.setSelectionValues(getSelectedValues());
//
setBrowseProcessInfo(pi);
// Execute Process
ProcessCtl worker = new ProcessCtl(this, getWindowNo(), pi, null);
//
String msg = Msg.getMsg(Env.getCtx(), "Processing");
// For Dialog
if (m_frame.isDialog()) {
m_waiting = new Waiting(m_frame.getCDialog(), msg, false, getBrowseProcessInfo().getEstSeconds());
} else {
m_waiting = new Waiting(m_frame.getCFrame(), msg, false, getBrowseProcessInfo().getEstSeconds());
}
// complete tasks in unlockUI /
worker.run();
m_waiting.doNotWait();
setStatusLine(pi.getSummary(), pi.isError());
// For Valid Ok
isOk = !pi.isError();
}
}
}
m_frame.setCursor(Cursor.getDefaultCursor());
// For when is ok the process
if (isOk) {
// Close
if (getParentWindowNo() > 0) {
dispose();
return;
}
// Else Reset
p_loadedOK = initBrowser();
collapsibleSearch.setCollapsed(false);
}
}
Aggregations