IDEMPIERE-144 Performance: Remove the use of zk event thread. This will break things but it is a necessary step to improve the performance and scalability of the zk client. This is also the first step require to implement clustering support.
This commit is contained in:
parent
b92a635945
commit
09d73d1486
|
@ -76,7 +76,7 @@ public interface IProcessUI {
|
||||||
* @param message
|
* @param message
|
||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
public void ask(String message, Callback<String> callback);
|
public void ask(String message, Callback<Boolean> callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add to list of file available for download after process end
|
* add to list of file available for download after process end
|
||||||
|
|
|
@ -346,12 +346,7 @@ public final class ProcessUtil {
|
||||||
|
|
||||||
public static MWFProcess startWorkFlow(Properties ctx, ProcessInfo pi, int AD_Workflow_ID) {
|
public static MWFProcess startWorkFlow(Properties ctx, ProcessInfo pi, int AD_Workflow_ID) {
|
||||||
MWorkflow wf = MWorkflow.get (ctx, AD_Workflow_ID);
|
MWorkflow wf = MWorkflow.get (ctx, AD_Workflow_ID);
|
||||||
MWFProcess wfProcess = null;
|
MWFProcess wfProcess = wf.start(pi, pi.getTransactionName());
|
||||||
if (pi.isBatch())
|
|
||||||
wfProcess = wf.start(pi, pi.getTransactionName()); // may return null
|
|
||||||
else {
|
|
||||||
wfProcess = wf.startWait(pi); // may return null
|
|
||||||
}
|
|
||||||
log.fine(pi.toString());
|
log.fine(pi.toString());
|
||||||
return wfProcess;
|
return wfProcess;
|
||||||
}
|
}
|
||||||
|
|
|
@ -693,7 +693,7 @@ public class MWorkflow extends X_AD_Workflow
|
||||||
retValue = new MWFProcess (this, pi, trxName != null ? trxName : localTrx.getTrxName());
|
retValue = new MWFProcess (this, pi, trxName != null ? trxName : localTrx.getTrxName());
|
||||||
retValue.saveEx();
|
retValue.saveEx();
|
||||||
pi.setSummary(Msg.getMsg(getCtx(), "Processing"));
|
pi.setSummary(Msg.getMsg(getCtx(), "Processing"));
|
||||||
retValue.startWork();
|
retValue.startWork();
|
||||||
if (localTrx != null)
|
if (localTrx != null)
|
||||||
localTrx.commit(true);
|
localTrx.commit(true);
|
||||||
}
|
}
|
||||||
|
@ -710,6 +710,16 @@ public class MWorkflow extends X_AD_Workflow
|
||||||
if (localTrx != null)
|
if (localTrx != null)
|
||||||
localTrx.close();
|
localTrx.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (retValue != null)
|
||||||
|
{
|
||||||
|
String summary = retValue.getProcessMsg();
|
||||||
|
StateEngine state = retValue.getState();
|
||||||
|
if (summary == null || summary.trim().length() == 0)
|
||||||
|
summary = state.toString();
|
||||||
|
pi.setSummary(summary, state.isTerminated() || state.isAborted());
|
||||||
|
}
|
||||||
|
|
||||||
return retValue;
|
return retValue;
|
||||||
} // MWFProcess
|
} // MWFProcess
|
||||||
|
|
||||||
|
|
|
@ -2972,10 +2972,10 @@ public final class APanel extends CPanel
|
||||||
} // updateToolBarAndMenuWithRestriction
|
} // updateToolBarAndMenuWithRestriction
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ask(String message, Callback<String> callback) {
|
public void ask(String message, Callback<Boolean> callback) {
|
||||||
boolean b = ADialog.ask(m_curWindowNo, this, message);
|
boolean b = ADialog.ask(m_curWindowNo, this, message);
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onCallback(b ? "OK" : "CANCEL");
|
callback.onCallback(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -526,10 +526,10 @@ public class ProcessDialog extends CFrame
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ask(String message, Callback<String> callback) {
|
public void ask(String message, Callback<Boolean> callback) {
|
||||||
boolean b = ADialog.ask(m_WindowNo, this, message);
|
boolean b = ADialog.ask(m_WindowNo, this, message);
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onCallback(b ? "OK" : "CANCEL");
|
callback.onCallback(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -389,10 +389,10 @@ public class VGenPanel extends CPanel implements ActionListener, ChangeListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ask(String message, Callback<String> callback) {
|
public void ask(String message, Callback<Boolean> callback) {
|
||||||
boolean b = ADialog.ask(m_WindowNo, this, message);
|
boolean b = ADialog.ask(m_WindowNo, this, message);
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onCallback(b ? "OK" : "CANCEL");
|
callback.onCallback(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -448,10 +448,10 @@ public class VPaySelect extends PaySelect implements FormPanel, ActionListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ask(String message, Callback<String> callback) {
|
public void ask(String message, Callback<Boolean> callback) {
|
||||||
boolean b = ADialog.ask(m_WindowNo, null, message);
|
boolean b = ADialog.ask(m_WindowNo, null, message);
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onCallback(b ? "OK" : "CANCEL");
|
callback.onCallback(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -905,10 +905,10 @@ public class VInOutInvoiceGen extends CPanel
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ask(String message, Callback<String> callback) {
|
public void ask(String message, Callback<Boolean> callback) {
|
||||||
boolean b = ADialog.ask(m_WindowNo, this, message);
|
boolean b = ADialog.ask(m_WindowNo, this, message);
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onCallback(b ? "OK" : "CANCEL");
|
callback.onCallback(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,8 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
public static final String ZK_DESKTOP_SESSION_KEY = "zk.desktop";
|
public static final String ZK_DESKTOP_SESSION_KEY = "zk.desktop";
|
||||||
|
|
||||||
private static final String CLIENT_INFO = "client.info";
|
private static final String CLIENT_INFO = "client.info";
|
||||||
|
|
||||||
|
private static boolean eventThreadEnabled = false;
|
||||||
|
|
||||||
public AdempiereWebUI()
|
public AdempiereWebUI()
|
||||||
{
|
{
|
||||||
|
@ -133,6 +135,8 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
Executions.getCurrent().getDesktop().addListener(new DrillCommand());
|
Executions.getCurrent().getDesktop().addListener(new DrillCommand());
|
||||||
Executions.getCurrent().getDesktop().addListener(new TokenCommand());
|
Executions.getCurrent().getDesktop().addListener(new TokenCommand());
|
||||||
Executions.getCurrent().getDesktop().addListener(new ZoomCommand());
|
Executions.getCurrent().getDesktop().addListener(new ZoomCommand());
|
||||||
|
|
||||||
|
eventThreadEnabled = Executions.getCurrent().getDesktop().getWebApp().getConfiguration().isEventThreadEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onOk()
|
public void onOk()
|
||||||
|
@ -392,5 +396,9 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
*/
|
*/
|
||||||
public UserPreference getUserPreference() {
|
public UserPreference getUserPreference() {
|
||||||
return userPreference;
|
return userPreference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isEventThreadEnabled() {
|
||||||
|
return eventThreadEnabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,9 @@ public class ValuePreference extends Window implements EventListener
|
||||||
* @param aValue value
|
* @param aValue value
|
||||||
* @return ValuePreference or null
|
* @return ValuePreference or null
|
||||||
*/
|
*/
|
||||||
public static ValuePreference start (GridField mField, Object aValue)
|
public static void start (GridField mField, Object aValue)
|
||||||
{
|
{
|
||||||
return start (mField, aValue, null);
|
start (mField, aValue, null);
|
||||||
} // start
|
} // start
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,12 +79,12 @@ public class ValuePreference extends Window implements EventListener
|
||||||
* @param aDisplayValue display value
|
* @param aDisplayValue display value
|
||||||
* @return ValuePreference or null
|
* @return ValuePreference or null
|
||||||
*/
|
*/
|
||||||
public static ValuePreference start (GridField mField, Object aValue, String aDisplayValue)
|
public static void start (GridField mField, Object aValue, String aDisplayValue)
|
||||||
{
|
{
|
||||||
if (!mField.isEditable(false))
|
if (!mField.isEditable(false))
|
||||||
{
|
{
|
||||||
log.info("Field not editable (R/O)");
|
log.info("Field not editable (R/O)");
|
||||||
return null;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Value/DisplayValue
|
// Set Value/DisplayValue
|
||||||
|
@ -116,7 +116,6 @@ public class ValuePreference extends Window implements EventListener
|
||||||
AD_Client_ID, AD_Org_ID, AD_User_ID, AD_Window_ID,
|
AD_Client_ID, AD_Org_ID, AD_User_ID, AD_Window_ID,
|
||||||
Attribute, DisplayAttribute, Value, DisplayValue,
|
Attribute, DisplayAttribute, Value, DisplayValue,
|
||||||
displayType, AD_Reference_ID);
|
displayType, AD_Reference_ID);
|
||||||
return vp;
|
|
||||||
} // create
|
} // create
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.Callback;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Button;
|
import org.adempiere.webui.component.Button;
|
||||||
import org.adempiere.webui.component.Checkbox;
|
import org.adempiere.webui.component.Checkbox;
|
||||||
|
@ -1295,18 +1296,27 @@ public class WAcctViewer extends Window implements EventListener
|
||||||
private void actionRePost()
|
private void actionRePost()
|
||||||
{
|
{
|
||||||
if (m_data.documentQuery
|
if (m_data.documentQuery
|
||||||
&& m_data.AD_Table_ID != 0 && m_data.Record_ID != 0
|
&& m_data.AD_Table_ID != 0 && m_data.Record_ID != 0)
|
||||||
&& FDialog.ask(m_data.WindowNo, this, "PostImmediate?"))
|
|
||||||
{
|
{
|
||||||
//setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
FDialog.ask(m_data.WindowNo, this, "PostImmediate?", new Callback<Boolean>() {
|
||||||
boolean force = forcePost.isChecked();
|
|
||||||
String error = AEnv.postImmediate (m_data.WindowNo, m_data.AD_Client_ID,
|
@Override
|
||||||
m_data.AD_Table_ID, m_data.Record_ID, force);
|
public void onCallback(Boolean result)
|
||||||
//setCursor(Cursor.getDefaultCursor());
|
{
|
||||||
if (error != null)
|
if (result)
|
||||||
FDialog.error(0, this, "PostingError-N", error);
|
{
|
||||||
|
//setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
|
boolean force = forcePost.isChecked();
|
||||||
|
String error = AEnv.postImmediate (m_data.WindowNo, m_data.AD_Client_ID,
|
||||||
|
m_data.AD_Table_ID, m_data.Record_ID, force);
|
||||||
|
//setCursor(Cursor.getDefaultCursor());
|
||||||
|
if (error != null)
|
||||||
|
FDialog.error(0, WAcctViewer.this, "PostingError-N", error);
|
||||||
|
|
||||||
actionQuery();
|
actionQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} // actionRePost
|
} // actionRePost
|
||||||
|
|
||||||
|
|
|
@ -92,15 +92,6 @@ public final class AEnv
|
||||||
SessionManager.getAppDesktop().showWindow(window, "center");
|
SessionManager.getAppDesktop().showWindow(window, "center");
|
||||||
} // showCenterScreen
|
} // showCenterScreen
|
||||||
|
|
||||||
/**
|
|
||||||
* Position window in center of the screen
|
|
||||||
* @param window Window to position
|
|
||||||
*/
|
|
||||||
public static void positionCenterScreen(Window window)
|
|
||||||
{
|
|
||||||
showCenterScreen(window);
|
|
||||||
} // positionCenterScreen
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show in the center of the screen.
|
* Show in the center of the screen.
|
||||||
* (pack, set location and set visibility)
|
* (pack, set location and set visibility)
|
||||||
|
|
|
@ -462,17 +462,17 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
|
||||||
public void onAfterProcess()
|
public void onAfterProcess()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
afterProcessTask();
|
if (!afterProcessTask()) {
|
||||||
|
// If the process is a silent one and no errors occured, close the dialog
|
||||||
// If the process is a silent one and no errors occured, close the dialog
|
if(m_ShowHelp != null && m_ShowHelp.equals("S"))
|
||||||
if(m_ShowHelp != null && m_ShowHelp.equals("S"))
|
this.dispose();
|
||||||
this.dispose();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Optional Processing Task
|
* Optional Processing Task
|
||||||
*/
|
*/
|
||||||
private void afterProcessTask()
|
private boolean afterProcessTask()
|
||||||
{
|
{
|
||||||
// something to do?
|
// something to do?
|
||||||
if (m_ids != null && m_ids.length > 0)
|
if (m_ids != null && m_ids.length > 0)
|
||||||
|
@ -480,11 +480,21 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
|
||||||
log.config("");
|
log.config("");
|
||||||
// Print invoices
|
// Print invoices
|
||||||
if (m_AD_Process_ID == PROCESS_C_INVOICE_GENERATE)
|
if (m_AD_Process_ID == PROCESS_C_INVOICE_GENERATE)
|
||||||
|
{
|
||||||
printInvoices();
|
printInvoices();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if (m_AD_Process_ID == PROCESS_M_INOUT_GENERATE)
|
else if (m_AD_Process_ID == PROCESS_M_INOUT_GENERATE)
|
||||||
|
{
|
||||||
printShipments();
|
printShipments();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
} // afterProcessTask
|
} // afterProcessTask
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -494,13 +504,17 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
|
||||||
{
|
{
|
||||||
if (m_ids == null)
|
if (m_ids == null)
|
||||||
return;
|
return;
|
||||||
if (!FDialog.ask(m_WindowNo, this, "PrintShipments"))
|
FDialog.ask(m_WindowNo, this, "PrintShipments", new Callback<Boolean>() {
|
||||||
return;
|
@Override
|
||||||
|
public void onCallback(Boolean result) {
|
||||||
m_messageText.append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintShipments")).append("</p>");
|
if (result) {
|
||||||
message.setContent(m_messageText.toString());
|
m_messageText.append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintShipments")).append("</p>");
|
||||||
showBusyDialog();
|
message.setContent(m_messageText.toString());
|
||||||
Clients.response(new AuEcho(this, "onPrintShipments", null));
|
showBusyDialog();
|
||||||
|
Clients.response(new AuEcho(ProcessDialog.this, "onPrintShipments", null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
} // printInvoices
|
} // printInvoices
|
||||||
|
|
||||||
public void onPrintShipments()
|
public void onPrintShipments()
|
||||||
|
@ -559,6 +573,10 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
|
||||||
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the process is a silent one and no errors occured, close the dialog
|
||||||
|
if(m_ShowHelp != null && m_ShowHelp.equals("S"))
|
||||||
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -568,12 +586,19 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
|
||||||
{
|
{
|
||||||
if (m_ids == null)
|
if (m_ids == null)
|
||||||
return;
|
return;
|
||||||
if (!FDialog.ask(m_WindowNo, this, "PrintInvoices"))
|
FDialog.ask(m_WindowNo, this, "PrintInvoices", new Callback<Boolean>() {
|
||||||
return;
|
@Override
|
||||||
m_messageText.append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintInvoices")).append("</p>");
|
public void onCallback(Boolean result)
|
||||||
message.setContent(m_messageText.toString());
|
{
|
||||||
showBusyDialog();
|
if (result)
|
||||||
Clients.response(new AuEcho(this, "onPrintInvoices", null));
|
{
|
||||||
|
m_messageText.append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintInvoices")).append("</p>");
|
||||||
|
message.setContent(m_messageText.toString());
|
||||||
|
showBusyDialog();
|
||||||
|
Clients.response(new AuEcho(ProcessDialog.this, "onPrintInvoices", null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
} // printInvoices
|
} // printInvoices
|
||||||
|
|
||||||
public void onPrintInvoices()
|
public void onPrintInvoices()
|
||||||
|
@ -630,6 +655,10 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
|
||||||
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the process is a silent one and no errors occured, close the dialog
|
||||||
|
if(m_ShowHelp != null && m_ShowHelp.equals("S"))
|
||||||
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
|
@ -661,7 +690,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ask(final String message, final Callback<String> callback) {
|
public void ask(final String message, final Callback<Boolean> callback) {
|
||||||
Executions.schedule(getDesktop(), new EventListener<Event>() {
|
Executions.schedule(getDesktop(), new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
|
||||||
|
|
||||||
if (listener != null)
|
if (listener != null)
|
||||||
{
|
{
|
||||||
addEventListener(ON_MODAL_CLOSE, listener);
|
addEventListener(ON_WINDOW_CLOSE, listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Process=" + pi.getAD_Process_ID());
|
log.info("Process=" + pi.getAD_Process_ID());
|
||||||
|
@ -413,7 +413,6 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
|
||||||
private void onCancel() {
|
private void onCancel() {
|
||||||
m_cancel = true;
|
m_cancel = true;
|
||||||
this.dispose();
|
this.dispose();
|
||||||
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onStatusUpdate(Event event) {
|
private void onStatusUpdate(Event event) {
|
||||||
|
@ -433,7 +432,6 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
|
||||||
Events.postEvent(downloadDialog, new Event(MultiFileDownloadDialog.ON_SHOW));
|
Events.postEvent(downloadDialog, new Event(MultiFileDownloadDialog.ON_SHOW));
|
||||||
}
|
}
|
||||||
dispose();
|
dispose();
|
||||||
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -488,7 +486,7 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ask(final String message, final Callback<String> callback) {
|
public void ask(final String message, final Callback<Boolean> callback) {
|
||||||
Executions.schedule(getDesktop(), new EventListener<Event>() {
|
Executions.schedule(getDesktop(), new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
|
|
|
@ -137,14 +137,12 @@ public class WCreateFromWindow extends Window implements EventListener<Event>, W
|
||||||
{
|
{
|
||||||
FDialog.error(windowNo, this, "Error", ex.getLocalizedMessage());
|
FDialog.error(windowNo, this, "Error", ex.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
|
|
||||||
}
|
}
|
||||||
// Cancel
|
// Cancel
|
||||||
else if (e.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
|
else if (e.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
|
||||||
{
|
{
|
||||||
isCancel = true;
|
isCancel = true;
|
||||||
dispose();
|
dispose();
|
||||||
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
|
|
||||||
}
|
}
|
||||||
// Select All
|
// Select All
|
||||||
// Trifon
|
// Trifon
|
||||||
|
|
|
@ -31,6 +31,7 @@ import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.webui.AdempiereWebUI;
|
||||||
import org.adempiere.webui.component.Button;
|
import org.adempiere.webui.component.Button;
|
||||||
import org.adempiere.webui.component.ConfirmPanel;
|
import org.adempiere.webui.component.ConfirmPanel;
|
||||||
import org.adempiere.webui.component.Label;
|
import org.adempiere.webui.component.Label;
|
||||||
|
@ -53,6 +54,7 @@ import org.zkoss.util.media.Media;
|
||||||
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.event.UploadEvent;
|
||||||
import org.zkoss.zul.Borderlayout;
|
import org.zkoss.zul.Borderlayout;
|
||||||
import org.zkoss.zul.Center;
|
import org.zkoss.zul.Center;
|
||||||
import org.zkoss.zul.North;
|
import org.zkoss.zul.North;
|
||||||
|
@ -116,6 +118,7 @@ public class WFileImport extends ADForm implements EventListener
|
||||||
|
|
||||||
public WFileImport()
|
public WFileImport()
|
||||||
{
|
{
|
||||||
|
this.addEventListener(Events.ON_UPLOAD, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -305,6 +308,11 @@ public class WFileImport extends ADForm implements EventListener
|
||||||
SessionManager.getAppDesktop().closeActiveWindow();
|
SessionManager.getAppDesktop().closeActiveWindow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (e instanceof UploadEvent)
|
||||||
|
{
|
||||||
|
UploadEvent ue = (UploadEvent) e;
|
||||||
|
processUploadMedia(ue.getMedia());
|
||||||
|
}
|
||||||
|
|
||||||
if (m_data != null && m_data.size() > 0 // file loaded
|
if (m_data != null && m_data.size() > 0 // file loaded
|
||||||
&& m_format != null && m_format.getRowCount() > 0) // format loaded
|
&& m_format != null && m_format.getRowCount() > 0) // format loaded
|
||||||
|
@ -319,10 +327,12 @@ public class WFileImport extends ADForm implements EventListener
|
||||||
|
|
||||||
private void cmd_loadFile()
|
private void cmd_loadFile()
|
||||||
{
|
{
|
||||||
Media media = null;
|
Media media = Fileupload.get();
|
||||||
|
if (AdempiereWebUI.isEventThreadEnabled())
|
||||||
media = Fileupload.get();
|
processUploadMedia(media);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processUploadMedia(Media media) {
|
||||||
if (media == null)
|
if (media == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.Callback;
|
||||||
import org.adempiere.webui.LayoutUtils;
|
import org.adempiere.webui.LayoutUtils;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.apps.BusyDialog;
|
import org.adempiere.webui.apps.BusyDialog;
|
||||||
|
@ -339,11 +340,19 @@ public class WGenForm extends ADForm implements EventListener, WTableModelListen
|
||||||
public void onAfterProcess()
|
public void onAfterProcess()
|
||||||
{
|
{
|
||||||
// OK to print
|
// OK to print
|
||||||
if (FDialog.ask(getWindowNo(), this, genForm.getAskPrintMsg()))
|
FDialog.ask(getWindowNo(), this, genForm.getAskPrintMsg(), new Callback<Boolean>() {
|
||||||
{
|
|
||||||
Clients.showBusy("Processing...");
|
@Override
|
||||||
Clients.response(new AuEcho(this, "onPrint", null));
|
public void onCallback(Boolean result)
|
||||||
} // OK to print
|
{
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
Clients.showBusy("Processing...");
|
||||||
|
Clients.response(new AuEcho(WGenForm.this, "onPrint", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPrint()
|
public void onPrint()
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.adempiere.webui.apps.form;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.Callback;
|
||||||
import org.adempiere.webui.apps.BusyDialog;
|
import org.adempiere.webui.apps.BusyDialog;
|
||||||
import org.adempiere.webui.component.ConfirmPanel;
|
import org.adempiere.webui.component.ConfirmPanel;
|
||||||
import org.adempiere.webui.component.Grid;
|
import org.adempiere.webui.component.Grid;
|
||||||
|
@ -238,17 +239,29 @@ public class WMerge extends Merge implements IFormController, EventListener
|
||||||
|
|
||||||
m_msg = Msg.getMsg(Env.getCtx(), "MergeFrom") + " = " + from_Info
|
m_msg = Msg.getMsg(Env.getCtx(), "MergeFrom") + " = " + from_Info
|
||||||
+ "\n" + Msg.getMsg(Env.getCtx(), "MergeTo") + " = " + to_Info;
|
+ "\n" + Msg.getMsg(Env.getCtx(), "MergeTo") + " = " + to_Info;
|
||||||
if (!FDialog.ask(m_WindowNo, form, "MergeQuestion", m_msg))
|
|
||||||
return;
|
|
||||||
|
|
||||||
updateDeleteTable(columnName);
|
final String columnNameRef = columnName;
|
||||||
|
final int fromIdRef = from_ID;
|
||||||
|
final int toIdRef = to_ID;
|
||||||
|
FDialog.ask(m_WindowNo, form, "MergeQuestion", m_msg, new Callback<Boolean>() {
|
||||||
|
|
||||||
progressWindow = new BusyDialog();
|
@Override
|
||||||
progressWindow.setPage(form.getPage());
|
public void onCallback(Boolean result)
|
||||||
progressWindow.doHighlighted();
|
{
|
||||||
|
if (result)
|
||||||
runnable = new MergeRunnable(columnName, from_ID, to_ID);
|
{
|
||||||
Clients.response(new AuEcho(form, "runProcess", null));
|
updateDeleteTable(columnNameRef);
|
||||||
|
|
||||||
|
progressWindow = new BusyDialog();
|
||||||
|
progressWindow.setPage(form.getPage());
|
||||||
|
progressWindow.doHighlighted();
|
||||||
|
|
||||||
|
runnable = new MergeRunnable(columnNameRef, fromIdRef, toIdRef);
|
||||||
|
Clients.response(new AuEcho(form, "runProcess", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
} // actionPerformed
|
} // actionPerformed
|
||||||
|
|
||||||
class MergeRunnable implements Runnable {
|
class MergeRunnable implements Runnable {
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.Callback;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Button;
|
import org.adempiere.webui.component.Button;
|
||||||
import org.adempiere.webui.component.ConfirmPanel;
|
import org.adempiere.webui.component.ConfirmPanel;
|
||||||
|
@ -57,6 +58,7 @@ import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
import org.compiere.util.PaymentExport;
|
import org.compiere.util.PaymentExport;
|
||||||
import org.compiere.util.ValueNamePair;
|
import org.compiere.util.ValueNamePair;
|
||||||
|
import org.python.antlr.ast.Call;
|
||||||
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.zul.Borderlayout;
|
import org.zkoss.zul.Borderlayout;
|
||||||
|
@ -365,12 +367,20 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
||||||
FDialog.info(m_WindowNo, form, "Saved",
|
FDialog.info(m_WindowNo, form, "Saved",
|
||||||
Msg.getMsg(Env.getCtx(), "NoOfLines") + "=" + no);
|
Msg.getMsg(Env.getCtx(), "NoOfLines") + "=" + no);
|
||||||
|
|
||||||
if (FDialog.ask(m_WindowNo, form, "VPayPrintSuccess?"))
|
FDialog.ask(m_WindowNo, form, "VPayPrintSuccess?", new Callback<Boolean>() {
|
||||||
{
|
|
||||||
// int lastDocumentNo =
|
@Override
|
||||||
MPaySelectionCheck.confirmPrint (m_checks, m_batch);
|
public void onCallback(Boolean result)
|
||||||
// document No not updated
|
{
|
||||||
}
|
if (result)
|
||||||
|
{
|
||||||
|
// int lastDocumentNo =
|
||||||
|
MPaySelectionCheck.confirmPrint (m_checks, m_batch);
|
||||||
|
// document No not updated
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
FDialog.error(m_WindowNo, form, "Error", err.toString());
|
FDialog.error(m_WindowNo, form, "Error", err.toString());
|
||||||
}
|
}
|
||||||
|
@ -441,6 +451,7 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
||||||
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final SimplePDFViewer chequeViewerRef = chequeViewer;
|
||||||
|
|
||||||
if (lastDocumentNo != 0)
|
if (lastDocumentNo != 0)
|
||||||
{
|
{
|
||||||
|
@ -451,48 +462,55 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
|
||||||
DB.executeUpdate(sb.toString(), null);
|
DB.executeUpdate(sb.toString(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
SimplePDFViewer remitViewer = null;
|
FDialog.ask(m_WindowNo, form, "VPayPrintPrintRemittance", new Callback<Boolean>() {
|
||||||
if (FDialog.ask(m_WindowNo, form, "VPayPrintPrintRemittance"))
|
|
||||||
{
|
@Override
|
||||||
pdfList = new ArrayList<File>();
|
public void onCallback(Boolean result)
|
||||||
for (int i = 0; i < m_checks.length; i++)
|
{
|
||||||
{
|
SimplePDFViewer remitViewer = null;
|
||||||
MPaySelectionCheck check = m_checks[i];
|
if (result)
|
||||||
ReportEngine re = ReportEngine.get(Env.getCtx(), ReportEngine.REMITTANCE, check.get_ID());
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
File file = File.createTempFile("WPayPrint", null);
|
List<File> pdfList = new ArrayList<File>();
|
||||||
re.getPDF(file);
|
for (int i = 0; i < m_checks.length; i++)
|
||||||
pdfList.add(file);
|
{
|
||||||
}
|
MPaySelectionCheck check = m_checks[i];
|
||||||
catch (Exception e)
|
ReportEngine re = ReportEngine.get(Env.getCtx(), ReportEngine.REMITTANCE, check.get_ID());
|
||||||
{
|
try
|
||||||
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
{
|
||||||
|
File file = File.createTempFile("WPayPrint", null);
|
||||||
|
re.getPDF(file);
|
||||||
|
pdfList.add(file);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File outFile = File.createTempFile("WPayPrint", null);
|
||||||
|
AEnv.mergePdf(pdfList, outFile);
|
||||||
|
String name = Msg.translate(Env.getCtx(), "Remittance");
|
||||||
|
remitViewer = new SimplePDFViewer(form.getFormName() + " - " + name, new FileInputStream(outFile));
|
||||||
|
remitViewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
||||||
|
remitViewer.setWidth("100%");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose();
|
||||||
|
|
||||||
|
if (chequeViewerRef != null)
|
||||||
|
SessionManager.getAppDesktop().showWindow(chequeViewerRef);
|
||||||
|
|
||||||
|
if (remitViewer != null)
|
||||||
|
SessionManager.getAppDesktop().showWindow(remitViewer);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
try
|
|
||||||
{
|
|
||||||
File outFile = File.createTempFile("WPayPrint", null);
|
|
||||||
AEnv.mergePdf(pdfList, outFile);
|
|
||||||
String name = Msg.translate(Env.getCtx(), "Remittance");
|
|
||||||
remitViewer = new SimplePDFViewer(form.getFormName() + " - " + name, new FileInputStream(outFile));
|
|
||||||
remitViewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
|
||||||
remitViewer.setWidth("100%");
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
|
||||||
}
|
|
||||||
} // remittance
|
|
||||||
|
|
||||||
dispose();
|
|
||||||
|
|
||||||
if (chequeViewer != null)
|
|
||||||
SessionManager.getAppDesktop().showWindow(chequeViewer);
|
|
||||||
|
|
||||||
if (remitViewer != null)
|
|
||||||
SessionManager.getAppDesktop().showWindow(remitViewer);
|
|
||||||
} // cmd_print
|
} // cmd_print
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -369,25 +369,33 @@ public class WPaySelect extends PaySelect
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ask to Post it
|
// Ask to Post it
|
||||||
if (!FDialog.ask(m_WindowNo, form, "VPaySelectGenerate?", "(" + m_ps.getName() + ")"))
|
FDialog.ask(m_WindowNo, form, "VPaySelectGenerate?", "(" + m_ps.getName() + ")", new Callback<Boolean>() {
|
||||||
return;
|
|
||||||
|
|
||||||
// Prepare Process
|
|
||||||
int AD_Proces_ID = PROCESS_C_PAYSELECTION_CREATEPAYMENT; // C_PaySelection_CreatePayment
|
|
||||||
|
|
||||||
// Execute Process
|
@Override
|
||||||
ProcessModalDialog dialog = new ProcessModalDialog(this, m_WindowNo,
|
public void onCallback(Boolean result)
|
||||||
AD_Proces_ID, X_C_PaySelection.Table_ID, m_ps.getC_PaySelection_ID(), false);
|
{
|
||||||
if (dialog.isValid()) {
|
if (result)
|
||||||
try {
|
{
|
||||||
dialog.setWidth("500px");
|
// Prepare Process
|
||||||
dialog.setVisible(true);
|
int AD_Proces_ID = PROCESS_C_PAYSELECTION_CREATEPAYMENT; // C_PaySelection_CreatePayment
|
||||||
dialog.setPage(form.getPage());
|
|
||||||
dialog.doModal();
|
// Execute Process
|
||||||
} catch (SuspendNotAllowedException e) {
|
ProcessModalDialog dialog = new ProcessModalDialog(WPaySelect.this, m_WindowNo,
|
||||||
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
AD_Proces_ID, X_C_PaySelection.Table_ID, m_ps.getC_PaySelection_ID(), false);
|
||||||
|
if (dialog.isValid()) {
|
||||||
|
try {
|
||||||
|
dialog.setWidth("500px");
|
||||||
|
dialog.setVisible(true);
|
||||||
|
dialog.setPage(form.getPage());
|
||||||
|
dialog.doHighlighted();
|
||||||
|
} catch (SuspendNotAllowedException e) {
|
||||||
|
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
} // generatePaySelect
|
} // generatePaySelect
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -447,7 +455,7 @@ public class WPaySelect extends PaySelect
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ask(final String message, final Callback<String> callback) {
|
public void ask(final String message, final Callback<Boolean> callback) {
|
||||||
Executions.schedule(form.getDesktop(), new EventListener<Event>() {
|
Executions.schedule(form.getDesktop(), new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
|
|
|
@ -940,13 +940,6 @@ public class WPayment extends Window
|
||||||
}
|
}
|
||||||
} // actionPerformed
|
} // actionPerformed
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void lockUI() {
|
public void lockUI() {
|
||||||
if (m_isLocked) return;
|
if (m_isLocked) return;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.adempiere.webui.apps.form;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.Callback;
|
||||||
import org.adempiere.webui.LayoutUtils;
|
import org.adempiere.webui.LayoutUtils;
|
||||||
import org.adempiere.webui.component.Button;
|
import org.adempiere.webui.component.Button;
|
||||||
import org.adempiere.webui.component.Checkbox;
|
import org.adempiere.webui.component.Checkbox;
|
||||||
|
@ -388,17 +389,26 @@ public class WTreeMaintenance extends TreeMaintenance implements IFormController
|
||||||
*/
|
*/
|
||||||
private void action_treeAddAll()
|
private void action_treeAddAll()
|
||||||
{
|
{
|
||||||
if (FDialog.ask(m_WindowNo, null, "TreeAddAllItems")) { // idempiere-85
|
// idempiere-85
|
||||||
log.info("");
|
FDialog.ask(m_WindowNo, null, "TreeAddAllItems", new Callback<Boolean>() {
|
||||||
ListModel model = centerList.getModel();
|
|
||||||
int size = model.getSize();
|
@Override
|
||||||
int index = -1;
|
public void onCallback(Boolean result)
|
||||||
for (index = 0; index < size; index++)
|
|
||||||
{
|
{
|
||||||
ListItem item = (ListItem)model.getElementAt(index);
|
if (result)
|
||||||
action_treeAdd(item);
|
{
|
||||||
|
log.info("");
|
||||||
|
ListModel model = centerList.getModel();
|
||||||
|
int size = model.getSize();
|
||||||
|
int index = -1;
|
||||||
|
for (index = 0; index < size; index++)
|
||||||
|
{
|
||||||
|
ListItem item = (ListItem)model.getElementAt(index);
|
||||||
|
action_treeAdd(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
} // action_treeAddAll
|
} // action_treeAddAll
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -407,16 +417,26 @@ public class WTreeMaintenance extends TreeMaintenance implements IFormController
|
||||||
private void action_treeDeleteAll()
|
private void action_treeDeleteAll()
|
||||||
{
|
{
|
||||||
log.info("");
|
log.info("");
|
||||||
if (FDialog.ask(m_WindowNo, null, "TreeRemoveAllItems")) { // idempiere-85
|
// idempiere-85
|
||||||
ListModel model = centerList.getModel();
|
FDialog.ask(m_WindowNo, null, "TreeRemoveAllItems", new Callback<Boolean>() {
|
||||||
int size = model.getSize();
|
|
||||||
int index = -1;
|
@Override
|
||||||
for (index = 0; index < size; index++)
|
public void onCallback(Boolean result)
|
||||||
{
|
{
|
||||||
ListItem item = (ListItem)model.getElementAt(index);
|
if (result)
|
||||||
action_treeDelete(item);
|
{
|
||||||
|
ListModel model = centerList.getModel();
|
||||||
|
int size = model.getSize();
|
||||||
|
int index = -1;
|
||||||
|
for (index = 0; index < size; index++)
|
||||||
|
{
|
||||||
|
ListItem item = (ListItem)model.getElementAt(index);
|
||||||
|
action_treeDelete(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
} // action_treeDeleteAll
|
} // action_treeDeleteAll
|
||||||
|
|
||||||
public ADForm getForm()
|
public ADForm getForm()
|
||||||
|
|
|
@ -27,6 +27,8 @@ import org.adempiere.webui.component.Listbox;
|
||||||
import org.adempiere.webui.component.ListboxFactory;
|
import org.adempiere.webui.component.ListboxFactory;
|
||||||
import org.adempiere.webui.component.Textbox;
|
import org.adempiere.webui.component.Textbox;
|
||||||
import org.adempiere.webui.component.ToolBar;
|
import org.adempiere.webui.component.ToolBar;
|
||||||
|
import org.adempiere.webui.component.Window;
|
||||||
|
import org.adempiere.webui.event.DialogEvents;
|
||||||
import org.adempiere.webui.panel.ADForm;
|
import org.adempiere.webui.panel.ADForm;
|
||||||
import org.compiere.apps.wf.WFGraphLayout;
|
import org.compiere.apps.wf.WFGraphLayout;
|
||||||
import org.compiere.apps.wf.WFNodeWidget;
|
import org.compiere.apps.wf.WFNodeWidget;
|
||||||
|
@ -62,7 +64,6 @@ import org.zkoss.zul.Separator;
|
||||||
import org.zkoss.zul.Space;
|
import org.zkoss.zul.Space;
|
||||||
import org.zkoss.zul.Toolbarbutton;
|
import org.zkoss.zul.Toolbarbutton;
|
||||||
import org.zkoss.zul.Vbox;
|
import org.zkoss.zul.Vbox;
|
||||||
import org.zkoss.zul.Window;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -208,24 +209,26 @@ public class WFEditor extends ADForm {
|
||||||
w.onClose();
|
w.onClose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
try {
|
|
||||||
w.setWidth("250px");
|
w.setWidth("250px");
|
||||||
w.setBorder("normal");
|
w.setBorder("normal");
|
||||||
w.setPage(this.getPage());
|
w.setPage(this.getPage());
|
||||||
w.doModal();
|
w.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
} catch (SuspendNotAllowedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
String name = text.getText();
|
@Override
|
||||||
if (name != null && name.length() > 0)
|
public void onEvent(Event event) throws Exception {
|
||||||
{
|
String name = text.getText();
|
||||||
int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
|
if (name != null && name.length() > 0)
|
||||||
MWFNode node = new MWFNode(m_wf, name, name);
|
{
|
||||||
node.setClientOrg(AD_Client_ID, 0);
|
int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
|
||||||
node.saveEx();
|
MWFNode node = new MWFNode(m_wf, name, name);
|
||||||
reload(m_wf.getAD_Workflow_ID());
|
node.setClientOrg(AD_Client_ID, 0);
|
||||||
}
|
node.saveEx();
|
||||||
|
reload(m_wf.getAD_Workflow_ID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
w.doHighlighted();
|
||||||
}
|
}
|
||||||
|
|
||||||
void reload(int workflowId) {
|
void reload(int workflowId) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
import org.compiere.util.Util;
|
import org.compiere.util.Util;
|
||||||
import org.zkoss.zhtml.Text;
|
import org.zkoss.zhtml.Text;
|
||||||
|
import org.zkoss.zk.ui.Page;
|
||||||
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;
|
||||||
|
@ -63,8 +64,7 @@ public class Messagebox extends Window implements EventListener<Event>
|
||||||
private Image img = new Image();
|
private Image img = new Image();
|
||||||
|
|
||||||
private int returnValue;
|
private int returnValue;
|
||||||
private Callback<String> callback;
|
private Callback<Integer> callback;
|
||||||
private String callbackValue;
|
|
||||||
|
|
||||||
/** A OK button. */
|
/** A OK button. */
|
||||||
public static final int OK = 0x0001;
|
public static final int OK = 0x0001;
|
||||||
|
@ -199,7 +199,12 @@ public class Messagebox extends Window implements EventListener<Event>
|
||||||
return show(message, title, buttons, icon, null);
|
return show(message, title, buttons, icon, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int show(String message, String title, int buttons, String icon, Callback<String> callback)
|
public int show(String message, String title, int buttons, String icon, Callback<Integer> callback)
|
||||||
|
{
|
||||||
|
return show(message, title, buttons, icon, callback, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int show(String message, String title, int buttons, String icon, Callback<Integer> callback, boolean modal)
|
||||||
{
|
{
|
||||||
this.msg = message;
|
this.msg = message;
|
||||||
this.imgSrc = icon;
|
this.imgSrc = icon;
|
||||||
|
@ -239,10 +244,7 @@ public class Messagebox extends Window implements EventListener<Event>
|
||||||
this.setTitle(title);
|
this.setTitle(title);
|
||||||
this.setPosition("center");
|
this.setPosition("center");
|
||||||
this.setClosable(true);
|
this.setClosable(true);
|
||||||
if (Events.inEventListener())
|
this.setAttribute(Window.MODE_KEY, modal ? Window.MODE_MODAL : Window.MODE_HIGHLIGHTED);
|
||||||
this.setAttribute(Window.MODE_KEY, Window.MODE_MODAL);
|
|
||||||
else
|
|
||||||
this.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
|
||||||
this.setSizable(true);
|
this.setSizable(true);
|
||||||
|
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
|
@ -251,16 +253,21 @@ public class Messagebox extends Window implements EventListener<Event>
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int showDialog(String message, String title, int buttons, String icon) throws InterruptedException
|
public static int showDialog(String message, String title, int buttons, String icon)
|
||||||
{
|
{
|
||||||
return showDialog(message, title, buttons, icon, null);
|
return showDialog(message, title, buttons, icon, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int showDialog(String message, String title, int buttons, String icon, Callback<String> callback) throws InterruptedException
|
public static int showDialog(String message, String title, int buttons, String icon, Callback<Integer> callback)
|
||||||
|
{
|
||||||
|
return showDialog(message, title, buttons, icon, callback, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int showDialog(String message, String title, int buttons, String icon, Callback<Integer> callback, boolean modal)
|
||||||
{
|
{
|
||||||
Messagebox msg = new Messagebox();
|
Messagebox msg = new Messagebox();
|
||||||
|
|
||||||
return msg.show(message, title, buttons, icon, callback);
|
return msg.show(message, title, buttons, icon, callback, modal);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEvent(Event event) throws Exception
|
public void onEvent(Event event) throws Exception
|
||||||
|
@ -268,53 +275,44 @@ public class Messagebox extends Window implements EventListener<Event>
|
||||||
if (event == null)
|
if (event == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
callbackValue = null;
|
|
||||||
|
|
||||||
if (event.getTarget() == btnOk)
|
if (event.getTarget() == btnOk)
|
||||||
{
|
{
|
||||||
returnValue = OK;
|
returnValue = OK;
|
||||||
callbackValue = "OK";
|
|
||||||
}
|
}
|
||||||
else if (event.getTarget() == btnCancel)
|
else if (event.getTarget() == btnCancel)
|
||||||
{
|
{
|
||||||
returnValue = CANCEL;
|
returnValue = CANCEL;
|
||||||
callbackValue = "CANCEL";
|
|
||||||
}
|
}
|
||||||
else if (event.getTarget() == btnYes)
|
else if (event.getTarget() == btnYes)
|
||||||
{
|
{
|
||||||
returnValue = YES;
|
returnValue = YES;
|
||||||
callbackValue = "YES";
|
|
||||||
}
|
}
|
||||||
else if (event.getTarget() == btnNo)
|
else if (event.getTarget() == btnNo)
|
||||||
{
|
{
|
||||||
returnValue = NO;
|
returnValue = NO;
|
||||||
callbackValue = "NO";
|
|
||||||
}
|
}
|
||||||
else if (event.getTarget() == btnAbort)
|
else if (event.getTarget() == btnAbort)
|
||||||
{
|
{
|
||||||
returnValue = ABORT;
|
returnValue = ABORT;
|
||||||
callbackValue = "ABORT";
|
|
||||||
}
|
}
|
||||||
else if (event.getTarget() == btnRetry)
|
else if (event.getTarget() == btnRetry)
|
||||||
{
|
{
|
||||||
returnValue = RETRY;
|
returnValue = RETRY;
|
||||||
callbackValue = "RETRY";
|
|
||||||
}
|
}
|
||||||
else if (event.getTarget() == btnIgnore)
|
else if (event.getTarget() == btnIgnore)
|
||||||
{
|
{
|
||||||
returnValue = IGNORE;
|
returnValue = IGNORE;
|
||||||
callbackValue = "IGNORE";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.detach();
|
this.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void detach() {
|
public void onPageDetached(Page page) {
|
||||||
super.detach();
|
super.onPageDetached(page);
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
{
|
{
|
||||||
callback.onCallback(callbackValue);
|
callback.onCallback(returnValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,11 @@
|
||||||
|
|
||||||
package org.adempiere.webui.component;
|
package org.adempiere.webui.component;
|
||||||
|
|
||||||
|
import org.adempiere.webui.event.DialogEvents;
|
||||||
|
import org.zkoss.zk.ui.Page;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
|
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
|
||||||
|
@ -62,4 +67,15 @@ public class Window extends org.zkoss.zul.Window
|
||||||
{
|
{
|
||||||
detach();
|
detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.zkoss.zul.Window#onPageDetached(org.zkoss.zk.ui.Page)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onPageDetached(Page page) {
|
||||||
|
super.onPageDetached(page);
|
||||||
|
Events.sendEvent(this, new Event(DialogEvents.ON_WINDOW_CLOSE, this, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,14 +16,18 @@ package org.adempiere.webui.desktop;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.adempiere.webui.AdempiereWebUI;
|
||||||
import org.adempiere.webui.ClientInfo;
|
import org.adempiere.webui.ClientInfo;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
|
import org.adempiere.webui.event.DialogEvents;
|
||||||
import org.adempiere.webui.exception.ApplicationException;
|
import org.adempiere.webui.exception.ApplicationException;
|
||||||
import org.adempiere.webui.part.AbstractUIPart;
|
import org.adempiere.webui.part.AbstractUIPart;
|
||||||
import org.compiere.model.MMenu;
|
import org.compiere.model.MMenu;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for desktop implementation
|
* Base class for desktop implementation
|
||||||
|
@ -142,17 +146,11 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
|
||||||
* @param win
|
* @param win
|
||||||
* @param pos
|
* @param pos
|
||||||
*/
|
*/
|
||||||
public void showWindow(Window win, String pos)
|
public void showWindow(final Window win, final String pos)
|
||||||
{
|
{
|
||||||
win.setPage(page);
|
|
||||||
Object objMode = win.getAttribute(Window.MODE_KEY);
|
Object objMode = win.getAttribute(Window.MODE_KEY);
|
||||||
|
|
||||||
String mode = Window.MODE_MODAL;
|
final String mode = objMode != null ? objMode.toString() : Window.MODE_HIGHLIGHTED;
|
||||||
|
|
||||||
if (objMode != null)
|
|
||||||
{
|
|
||||||
mode = objMode.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Window.MODE_MODAL.equals(mode))
|
if (Window.MODE_MODAL.equals(mode))
|
||||||
{
|
{
|
||||||
|
@ -160,7 +158,27 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
|
||||||
win.setPosition(pos);
|
win.setPosition(pos);
|
||||||
showModal(win);
|
showModal(win);
|
||||||
}
|
}
|
||||||
else if (Window.MODE_POPUP.equals(mode))
|
else
|
||||||
|
{
|
||||||
|
if (Executions.getCurrent() != null)
|
||||||
|
{
|
||||||
|
showNonModalWindow(win, pos, mode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Executions.schedule(getComponent().getDesktop(), new EventListener<Event>() {
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
showNonModalWindow(win, pos, mode);
|
||||||
|
}
|
||||||
|
}, new Event("onExecute"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showNonModalWindow(final Window win, final String pos,
|
||||||
|
final String mode) {
|
||||||
|
if (Window.MODE_POPUP.equals(mode))
|
||||||
{
|
{
|
||||||
showPopup(win, pos);
|
showPopup(win, pos);
|
||||||
}
|
}
|
||||||
|
@ -175,7 +193,7 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
|
||||||
else if (Window.MODE_HIGHLIGHTED.equals(mode))
|
else if (Window.MODE_HIGHLIGHTED.equals(mode))
|
||||||
{
|
{
|
||||||
showHighlighted(win, pos);
|
showHighlighted(win, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void showEmbedded(Window win);
|
protected abstract void showEmbedded(Window win);
|
||||||
|
@ -184,18 +202,47 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
|
||||||
*
|
*
|
||||||
* @param win
|
* @param win
|
||||||
*/
|
*/
|
||||||
protected void showModal(Window win)
|
protected void showModal(final Window win)
|
||||||
{
|
{
|
||||||
//fall back to highlighted if can't execute doModal
|
if (AdempiereWebUI.isEventThreadEnabled())
|
||||||
if (Events.inEventListener())
|
|
||||||
{
|
{
|
||||||
win.doModal();
|
win.setPage(page);
|
||||||
|
win.doModal();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
showHighlighted(win, null);
|
if (Executions.getCurrent() != null)
|
||||||
|
{
|
||||||
|
throw new RuntimeException("When event thread is disabled, you can only show modal window in background thread that doesn't update Desktop.");
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuffer buffer = new StringBuffer();
|
||||||
|
win.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
buffer.append("*");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Executions.schedule(this.getComponent().getDesktop(), new EventListener<Event>() {
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
showHighlighted(win, null);
|
||||||
|
if (win.getPage() == null) {
|
||||||
|
buffer.append("*");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new Event("onExecute"));
|
||||||
|
|
||||||
|
while(buffer.length() == 0)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.interrupted();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -210,6 +257,7 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
|
||||||
else
|
else
|
||||||
win.setPosition(position);
|
win.setPosition(position);
|
||||||
|
|
||||||
|
win.setPage(page);
|
||||||
win.doPopup();
|
win.doPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,6 +273,7 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
|
||||||
else
|
else
|
||||||
win.setPosition(position);
|
win.setPosition(position);
|
||||||
|
|
||||||
|
win.setPage(page);
|
||||||
win.doOverlapped();
|
win.doOverlapped();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,6 +289,7 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
|
||||||
else
|
else
|
||||||
win.setPosition(position);
|
win.setPosition(position);
|
||||||
|
|
||||||
|
win.setPage(page);
|
||||||
win.doHighlighted();
|
win.doHighlighted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.Callback;
|
||||||
import org.adempiere.webui.component.Combinationbox;
|
import org.adempiere.webui.component.Combinationbox;
|
||||||
import org.adempiere.webui.event.ContextMenuEvent;
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
import org.adempiere.webui.event.ContextMenuListener;
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
|
@ -96,18 +97,24 @@ public class WAccountEditor extends WEditor implements ContextMenuListener
|
||||||
{
|
{
|
||||||
C_AcctSchema_ID = Env.getContextAsInt(Env.getCtx(), "$C_AcctSchema_ID");
|
C_AcctSchema_ID = Env.getContextAsInt(Env.getCtx(), "$C_AcctSchema_ID");
|
||||||
}
|
}
|
||||||
WAccountDialog ad = new WAccountDialog (gridField.getHeader(), m_mAccount, C_AcctSchema_ID);
|
new WAccountDialog (gridField.getHeader(), m_mAccount, C_AcctSchema_ID, new Callback<Integer>() {
|
||||||
//
|
|
||||||
Integer newValue = ad.getValue();
|
@Override
|
||||||
if (newValue == null)
|
public void onCallback(Integer result) {
|
||||||
return;
|
Integer newValue = result;
|
||||||
|
|
||||||
|
if (newValue == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Object oldValue = m_value;
|
Object oldValue = m_value;
|
||||||
|
|
||||||
// set & redisplay
|
// set & redisplay
|
||||||
setValue(newValue);
|
setValue(newValue);
|
||||||
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
|
ValueChangeEvent changeEvent = new ValueChangeEvent(WAccountEditor.this, getColumnName(), oldValue, newValue);
|
||||||
fireValueChange(changeEvent);
|
fireValueChange(changeEvent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//
|
||||||
} // cmd_button
|
} // cmd_button
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,13 +21,16 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.webui.AdempiereWebUI;
|
||||||
import org.adempiere.webui.component.FilenameBox;
|
import org.adempiere.webui.component.FilenameBox;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.zkoss.util.media.Media;
|
import org.zkoss.util.media.Media;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
import org.zkoss.zk.ui.event.UploadEvent;
|
||||||
import org.zkoss.zul.Fileupload;
|
import org.zkoss.zul.Fileupload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,6 +110,12 @@ public class WFilenameEditor extends WEditor
|
||||||
cmd_file();
|
cmd_file();
|
||||||
newValue = getComponent().getText();
|
newValue = getComponent().getText();
|
||||||
}
|
}
|
||||||
|
else if (event instanceof UploadEvent)
|
||||||
|
{
|
||||||
|
UploadEvent ue = (UploadEvent) event;
|
||||||
|
processUploadMedia(ue.getMedia());
|
||||||
|
return;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -122,16 +131,30 @@ public class WFilenameEditor extends WEditor
|
||||||
fireValueChange(changeEvent);
|
fireValueChange(changeEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Component parent = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load file
|
* Load file
|
||||||
*/
|
*/
|
||||||
private void cmd_file()
|
private void cmd_file()
|
||||||
{
|
{
|
||||||
|
if (parent == null || getComponent().getParent() != parent)
|
||||||
|
{
|
||||||
|
if (parent != null)
|
||||||
|
{
|
||||||
|
parent.removeEventListener(Events.ON_UPLOAD, this);
|
||||||
|
}
|
||||||
|
parent = getComponent().getParent();
|
||||||
|
parent.addEventListener(Events.ON_UPLOAD, this);
|
||||||
|
}
|
||||||
|
|
||||||
// Show File Open Dialog
|
// Show File Open Dialog
|
||||||
Media file = null;
|
Media media = Fileupload.get(true);
|
||||||
|
if (AdempiereWebUI.isEventThreadEnabled())
|
||||||
file = Fileupload.get(true);
|
processUploadMedia(media);
|
||||||
|
} // cmd_file
|
||||||
|
|
||||||
|
private void processUploadMedia(Media file) {
|
||||||
if (file == null)
|
if (file == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -173,7 +196,7 @@ public class WFilenameEditor extends WEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
getComponent().setText(fileName);
|
getComponent().setText(fileName);
|
||||||
} // cmd_file
|
}
|
||||||
|
|
||||||
public String[] getEvents()
|
public String[] getEvents()
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,6 +16,7 @@ package org.adempiere.webui.editor;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.webui.event.DialogEvents;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.window.WImageDialog;
|
import org.adempiere.webui.window.WImageDialog;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
|
@ -24,6 +25,7 @@ import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.zkoss.image.AImage;
|
import org.zkoss.image.AImage;
|
||||||
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.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
import org.zkoss.zul.Image;
|
import org.zkoss.zul.Image;
|
||||||
|
|
||||||
|
@ -153,20 +155,27 @@ public class WImageEditor extends WEditor
|
||||||
{
|
{
|
||||||
if (Events.ON_CLICK.equals(event.getName()) && readwrite)
|
if (Events.ON_CLICK.equals(event.getName()) && readwrite)
|
||||||
{
|
{
|
||||||
WImageDialog vid = new WImageDialog(m_mImage);
|
final WImageDialog vid = new WImageDialog(m_mImage);
|
||||||
if (!vid.isCancel()) {
|
vid.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
int AD_Image_ID = vid.getAD_Image_ID();
|
|
||||||
Object oldValue = getValue();
|
@Override
|
||||||
Integer newValue = null;
|
public void onEvent(Event event) throws Exception {
|
||||||
if (AD_Image_ID != 0)
|
if (!vid.isCancel()) {
|
||||||
newValue = new Integer (AD_Image_ID);
|
int AD_Image_ID = vid.getAD_Image_ID();
|
||||||
//
|
Object oldValue = getValue();
|
||||||
m_mImage = null; // force reload
|
Integer newValue = null;
|
||||||
setValue(newValue); // set explicitly
|
if (AD_Image_ID != 0)
|
||||||
//
|
newValue = new Integer (AD_Image_ID);
|
||||||
ValueChangeEvent vce = new ValueChangeEvent(this, gridField.getColumnName(), oldValue, newValue);
|
//
|
||||||
fireValueChange(vce);
|
m_mImage = null; // force reload
|
||||||
}
|
setValue(newValue); // set explicitly
|
||||||
|
//
|
||||||
|
ValueChangeEvent vce = new ValueChangeEvent(WImageEditor.this, gridField.getColumnName(), oldValue, newValue);
|
||||||
|
fireValueChange(vce);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.PAttributebox;
|
import org.adempiere.webui.component.PAttributebox;
|
||||||
import org.adempiere.webui.event.ContextMenuEvent;
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
import org.adempiere.webui.event.ContextMenuListener;
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
|
import org.adempiere.webui.event.DialogEvents;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.window.WFieldRecordInfo;
|
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||||
import org.adempiere.webui.window.WPAttributeDialog;
|
import org.adempiere.webui.window.WPAttributeDialog;
|
||||||
|
@ -31,6 +32,7 @@ import org.compiere.model.SystemIDs;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
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.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,7 +152,7 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener, S
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Integer oldValue = (Integer)getValue ();
|
Integer oldValue = (Integer)getValue ();
|
||||||
int oldValueInt = oldValue == null ? 0 : oldValue.intValue ();
|
final int oldValueInt = oldValue == null ? 0 : oldValue.intValue ();
|
||||||
int M_AttributeSetInstance_ID = oldValueInt;
|
int M_AttributeSetInstance_ID = oldValueInt;
|
||||||
int M_Product_ID = 0;
|
int M_Product_ID = 0;
|
||||||
int M_ProductBOM_ID = 0;
|
int M_ProductBOM_ID = 0;
|
||||||
|
@ -167,7 +169,7 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener, S
|
||||||
+ ", AD_Column_ID=" + gridField.getAD_Column_ID());
|
+ ", AD_Column_ID=" + gridField.getAD_Column_ID());
|
||||||
|
|
||||||
// M_Product.M_AttributeSetInstance_ID = 8418
|
// M_Product.M_AttributeSetInstance_ID = 8418
|
||||||
boolean productWindow = (gridField.getAD_Column_ID() == COLUMN_M_PRODUCT_M_ATTRIBUTESETINSTANCE_ID); // HARDCODED
|
final boolean productWindow = (gridField.getAD_Column_ID() == COLUMN_M_PRODUCT_M_ATTRIBUTESETINSTANCE_ID); // HARDCODED
|
||||||
|
|
||||||
// Exclude ability to enter ASI
|
// Exclude ability to enter ASI
|
||||||
boolean exclude = true;
|
boolean exclude = true;
|
||||||
|
@ -183,29 +185,44 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener, S
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean changed = false;
|
|
||||||
if (M_ProductBOM_ID != 0) // Use BOM Component
|
if (M_ProductBOM_ID != 0) // Use BOM Component
|
||||||
M_Product_ID = M_ProductBOM_ID;
|
M_Product_ID = M_ProductBOM_ID;
|
||||||
//
|
//
|
||||||
if (!productWindow && (M_Product_ID == 0 || exclude))
|
if (!productWindow && (M_Product_ID == 0 || exclude))
|
||||||
{
|
{
|
||||||
changed = true;
|
|
||||||
getComponent().setText(null);
|
getComponent().setText(null);
|
||||||
M_AttributeSetInstance_ID = 0;
|
M_AttributeSetInstance_ID = 0;
|
||||||
|
|
||||||
|
processChanges(oldValueInt, M_AttributeSetInstance_ID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WPAttributeDialog vad = new WPAttributeDialog (
|
final WPAttributeDialog vad = new WPAttributeDialog (
|
||||||
M_AttributeSetInstance_ID, M_Product_ID, m_C_BPartner_ID,
|
M_AttributeSetInstance_ID, M_Product_ID, m_C_BPartner_ID,
|
||||||
productWindow, gridField.getAD_Column_ID(), m_WindowNo);
|
productWindow, gridField.getAD_Column_ID(), m_WindowNo);
|
||||||
if (vad.isChanged())
|
vad.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
{
|
|
||||||
getComponent().setText(vad.getM_AttributeSetInstanceName());
|
@Override
|
||||||
M_AttributeSetInstance_ID = vad.getM_AttributeSetInstance_ID();
|
public void onEvent(Event event) throws Exception {
|
||||||
if (m_GridTab != null && !productWindow && vad.getM_Locator_ID() > 0)
|
boolean changed = false;
|
||||||
m_GridTab.setValue("M_Locator_ID", vad.getM_Locator_ID());
|
int M_AttributeSetInstance_ID = 0;
|
||||||
changed = true;
|
if (vad.isChanged())
|
||||||
}
|
{
|
||||||
|
getComponent().setText(vad.getM_AttributeSetInstanceName());
|
||||||
|
M_AttributeSetInstance_ID = vad.getM_AttributeSetInstance_ID();
|
||||||
|
if (m_GridTab != null && !productWindow && vad.getM_Locator_ID() > 0)
|
||||||
|
m_GridTab.setValue("M_Locator_ID", vad.getM_Locator_ID());
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set Value
|
||||||
|
if (changed)
|
||||||
|
{
|
||||||
|
processChanges(oldValueInt, M_AttributeSetInstance_ID);
|
||||||
|
} // change
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
/** Selection
|
/** Selection
|
||||||
{
|
{
|
||||||
|
@ -243,28 +260,26 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener, S
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
**/
|
**/
|
||||||
|
|
||||||
// Set Value
|
|
||||||
if (changed)
|
|
||||||
{
|
|
||||||
log.finest("Changed M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID);
|
|
||||||
m_value = new Object(); // force re-query display
|
|
||||||
if (M_AttributeSetInstance_ID == 0)
|
|
||||||
setValue(null);
|
|
||||||
else
|
|
||||||
setValue(new Integer(M_AttributeSetInstance_ID));
|
|
||||||
|
|
||||||
ValueChangeEvent vce = new ValueChangeEvent(this, gridField.getColumnName(), new Object(), getValue());
|
|
||||||
fireValueChange(vce);
|
|
||||||
if (M_AttributeSetInstance_ID == oldValueInt && m_GridTab != null && gridField != null)
|
|
||||||
{
|
|
||||||
// force Change - user does not realize that embedded object is already saved.
|
|
||||||
m_GridTab.processFieldChange(gridField);
|
|
||||||
}
|
|
||||||
} // change
|
|
||||||
} // cmd_file
|
} // cmd_file
|
||||||
|
|
||||||
|
private void processChanges(int oldValueInt, int M_AttributeSetInstance_ID) {
|
||||||
|
log.finest("Changed M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID);
|
||||||
|
m_value = new Object(); // force re-query display
|
||||||
|
if (M_AttributeSetInstance_ID == 0)
|
||||||
|
setValue(null);
|
||||||
|
else
|
||||||
|
setValue(new Integer(M_AttributeSetInstance_ID));
|
||||||
|
|
||||||
|
ValueChangeEvent vce = new ValueChangeEvent(this, gridField.getColumnName(), new Object(), getValue());
|
||||||
|
fireValueChange(vce);
|
||||||
|
if (M_AttributeSetInstance_ID == oldValueInt && m_GridTab != null && gridField != null)
|
||||||
|
{
|
||||||
|
// force Change - user does not realize that embedded object is already saved.
|
||||||
|
m_GridTab.processFieldChange(gridField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String[] getEvents()
|
public String[] getEvents()
|
||||||
{
|
{
|
||||||
return LISTENER_EVENTS;
|
return LISTENER_EVENTS;
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Searchbox;
|
import org.adempiere.webui.component.Searchbox;
|
||||||
import org.adempiere.webui.event.ContextMenuEvent;
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
import org.adempiere.webui.event.ContextMenuListener;
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
|
import org.adempiere.webui.event.DialogEvents;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.event.ValueChangeListener;
|
import org.adempiere.webui.event.ValueChangeListener;
|
||||||
import org.adempiere.webui.factory.InfoManager;
|
import org.adempiere.webui.factory.InfoManager;
|
||||||
|
@ -46,6 +47,7 @@ import org.compiere.util.DisplayType;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
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.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -476,9 +478,6 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
* - Window closed -> ignore => result == null && !cancalled
|
* - Window closed -> ignore => result == null && !cancalled
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Object result[] = null;
|
|
||||||
boolean cancelled = false;
|
|
||||||
|
|
||||||
// Zoom / Validation
|
// Zoom / Validation
|
||||||
String whereClause = getWhereClause();
|
String whereClause = getWhereClause();
|
||||||
|
|
||||||
|
@ -493,37 +492,41 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
if (m_tableName == null) // sets table name & key column
|
if (m_tableName == null) // sets table name & key column
|
||||||
getDirectAccessSQL("*");
|
getDirectAccessSQL("*");
|
||||||
|
|
||||||
InfoPanel ip = InfoManager.create(lookup, gridField, m_tableName, m_keyColumnName, queryValue, false, whereClause);
|
final InfoPanel ip = InfoManager.create(lookup, gridField, m_tableName, m_keyColumnName, queryValue, false, whereClause);
|
||||||
ip.setVisible(true);
|
ip.setVisible(true);
|
||||||
ip.setStyle("border: 2px");
|
ip.setStyle("border: 2px");
|
||||||
ip.setClosable(true);
|
ip.setClosable(true);
|
||||||
ip.setAttribute("mode", "modal");
|
|
||||||
ip.addValueChangeListener(this);
|
ip.addValueChangeListener(this);
|
||||||
infoPanel = ip;
|
infoPanel = ip;
|
||||||
|
ip.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
boolean cancelled = ip.isCancelled();
|
||||||
|
Object[] result = ip.getSelectedKeys();
|
||||||
|
|
||||||
|
infoPanel = null;
|
||||||
|
// Result
|
||||||
|
if (result != null && result.length > 0)
|
||||||
|
{
|
||||||
|
//ensure data binding happen
|
||||||
|
if (result.length > 1)
|
||||||
|
actionCombo (result);
|
||||||
|
else
|
||||||
|
actionCombo (result[0]);
|
||||||
|
}
|
||||||
|
else if (cancelled)
|
||||||
|
{
|
||||||
|
log.config(getColumnName() + " - Result = null (cancelled)");
|
||||||
|
actionCombo(null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log.config(getColumnName() + " - Result = null (not cancelled)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
AEnv.showWindow(ip);
|
AEnv.showWindow(ip);
|
||||||
cancelled = ip.isCancelled();
|
|
||||||
result = ip.getSelectedKeys();
|
|
||||||
|
|
||||||
infoPanel = null;
|
|
||||||
// Result
|
|
||||||
if (result != null && result.length > 0)
|
|
||||||
{
|
|
||||||
//ensure data binding happen
|
|
||||||
if (result.length > 1)
|
|
||||||
actionCombo (result);
|
|
||||||
else
|
|
||||||
actionCombo (result[0]);
|
|
||||||
}
|
|
||||||
else if (cancelled)
|
|
||||||
{
|
|
||||||
log.config(getColumnName() + " - Result = null (cancelled)");
|
|
||||||
actionCombo(null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log.config(getColumnName() + " - Result = null (not cancelled)");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,8 +21,8 @@ package org.adempiere.webui.event;
|
||||||
public interface DialogEvents {
|
public interface DialogEvents {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* on modal close event, use this for highlight mode modal dialog to perform action after the modal dialog closed.
|
* on window close event, use this for highlight mode window to simulate modal window
|
||||||
*/
|
*/
|
||||||
public final static String ON_MODAL_CLOSE = "onModalClose";
|
public final static String ON_WINDOW_CLOSE = "onWindowClose";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,6 @@
|
||||||
|
|
||||||
package org.adempiere.webui.panel;
|
package org.adempiere.webui.panel;
|
||||||
|
|
||||||
import java.beans.PropertyChangeEvent;
|
|
||||||
import java.beans.PropertyVetoException;
|
|
||||||
import java.beans.VetoableChangeListener;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -55,7 +52,6 @@ import org.compiere.model.DataStatusEvent;
|
||||||
import org.compiere.model.DataStatusListener;
|
import org.compiere.model.DataStatusListener;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.GridTab;
|
import org.compiere.model.GridTab;
|
||||||
import org.compiere.model.GridTable;
|
|
||||||
import org.compiere.model.GridWindow;
|
import org.compiere.model.GridWindow;
|
||||||
import org.compiere.model.MLookup;
|
import org.compiere.model.MLookup;
|
||||||
import org.compiere.model.MTree;
|
import org.compiere.model.MTree;
|
||||||
|
@ -96,7 +92,7 @@ import org.zkoss.zul.impl.XulElement;
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*/
|
*/
|
||||||
public class ADTabpanel extends Div implements Evaluatee, EventListener<Event>,
|
public class ADTabpanel extends Div implements Evaluatee, EventListener<Event>,
|
||||||
DataStatusListener, IADTabpanel, VetoableChangeListener
|
DataStatusListener, IADTabpanel
|
||||||
{
|
{
|
||||||
private static final String ON_DEFER_SET_SELECTED_NODE = "onDeferSetSelectedNode";
|
private static final String ON_DEFER_SET_SELECTED_NODE = "onDeferSetSelectedNode";
|
||||||
|
|
||||||
|
@ -152,8 +148,6 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
|
||||||
|
|
||||||
private Group currentGroup;
|
private Group currentGroup;
|
||||||
|
|
||||||
private boolean m_vetoActive = false;
|
|
||||||
|
|
||||||
public ADTabpanel()
|
public ADTabpanel()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
|
@ -251,7 +245,6 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
|
||||||
listPanel.setWindowNo(windowNo);
|
listPanel.setWindowNo(windowNo);
|
||||||
listPanel.setADWindowPanel(winPanel);
|
listPanel.setADWindowPanel(winPanel);
|
||||||
|
|
||||||
gridTab.getTableModel().addVetoableChangeListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1213,34 +1206,6 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param e
|
|
||||||
* @see VetoableChangeListener#vetoableChange(PropertyChangeEvent)
|
|
||||||
*/
|
|
||||||
public void vetoableChange(PropertyChangeEvent e)
|
|
||||||
throws PropertyVetoException {
|
|
||||||
// Save Confirmation dialog MTable-RowSave
|
|
||||||
if (e.getPropertyName().equals(GridTable.PROPERTY))
|
|
||||||
{
|
|
||||||
// throw new PropertyVetoException will call this listener again to revert to old value
|
|
||||||
if (m_vetoActive)
|
|
||||||
{
|
|
||||||
//ignore
|
|
||||||
m_vetoActive = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!Env.isAutoCommit(Env.getCtx(), getWindowNo()) || gridTab.getCommitWarning().length() > 0)
|
|
||||||
{
|
|
||||||
if (!FDialog.ask(getWindowNo(), this, "SaveChanges?", gridTab.getCommitWarning()))
|
|
||||||
{
|
|
||||||
m_vetoActive = true;
|
|
||||||
throw new PropertyVetoException ("UserDeniedSave", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
} // saveConfirmation
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -494,14 +494,14 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
{
|
{
|
||||||
if (!includedMap.containsKey(gTab.getAD_Tab_ID()))
|
if (!includedMap.containsKey(gTab.getAD_Tab_ID()))
|
||||||
{
|
{
|
||||||
setActiveTab(gridWindow.getTabIndex(gTab));
|
setActiveTab(gridWindow.getTabIndex(gTab), null);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IADTabpanel parent = includedMap.get(gTab.getAD_Tab_ID());
|
IADTabpanel parent = includedMap.get(gTab.getAD_Tab_ID());
|
||||||
int pindex = gridWindow.getTabIndex(parent.getGridTab());
|
int pindex = gridWindow.getTabIndex(parent.getGridTab());
|
||||||
if (pindex >= 0)
|
if (pindex >= 0)
|
||||||
setActiveTab(pindex);
|
setActiveTab(pindex, null);
|
||||||
}
|
}
|
||||||
gTab.navigate(i);
|
gTab.navigate(i);
|
||||||
return true;
|
return true;
|
||||||
|
@ -707,7 +707,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
where.toString(), findFields, 10, mTab.getAD_Tab_ID()); // no query below 10
|
where.toString(), findFields, 10, mTab.getAD_Tab_ID()); // no query below 10
|
||||||
if (find.isValid())
|
if (find.isValid())
|
||||||
{
|
{
|
||||||
find.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
|
find.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
if (!find.isCancel())
|
if (!find.isCancel())
|
||||||
|
@ -750,7 +750,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
int curInd = adTab.getSelectedIndex();
|
int curInd = adTab.getSelectedIndex();
|
||||||
if (curInd < maxInd)
|
if (curInd < maxInd)
|
||||||
{
|
{
|
||||||
setActiveTab(curInd + 1);
|
setActiveTab(curInd + 1, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
focusToActivePanel();
|
focusToActivePanel();
|
||||||
|
@ -764,7 +764,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
int curInd = adTab.getSelectedIndex();
|
int curInd = adTab.getSelectedIndex();
|
||||||
if (curInd > 0)
|
if (curInd > 0)
|
||||||
{
|
{
|
||||||
setActiveTab(curInd - 1);
|
setActiveTab(curInd - 1, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
focusToActivePanel();
|
focusToActivePanel();
|
||||||
|
@ -865,19 +865,39 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
|
|
||||||
if (gridWindow.isTransaction())
|
if (gridWindow.isTransaction())
|
||||||
{
|
{
|
||||||
if (curTab.needSave(true, true) && !onSave(false))
|
final Runnable runnable = new Runnable() {
|
||||||
return;
|
|
||||||
|
|
||||||
final WOnlyCurrentDays ocd = new WOnlyCurrentDays();
|
|
||||||
ocd.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void run() {
|
||||||
m_onlyCurrentDays = ocd.getCurrentDays();
|
final WOnlyCurrentDays ocd = new WOnlyCurrentDays();
|
||||||
history(m_onlyCurrentDays);
|
ocd.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
focusToActivePanel();
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
m_onlyCurrentDays = ocd.getCurrentDays();
|
||||||
|
history(m_onlyCurrentDays);
|
||||||
|
focusToActivePanel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AEnv.showWindow(ocd);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
AEnv.showWindow(ocd);
|
if (curTab.needSave(true, true))
|
||||||
|
{
|
||||||
|
onSave(false, new Callback<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCallback(Boolean result)
|
||||||
|
{
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
runnable.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
runnable.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,13 +937,18 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EventListener<Event> listener = new EventListener<Event>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
curTab.loadAttachments(); // reload
|
||||||
|
toolbar.getButton("Attachment").setPressed(curTab.hasAttachment());
|
||||||
|
focusToActivePanel();
|
||||||
|
}
|
||||||
|
};
|
||||||
// Attachment va =
|
// Attachment va =
|
||||||
new WAttachment ( curWindowNo, curTab.getAD_AttachmentID(),
|
new WAttachment ( curWindowNo, curTab.getAD_AttachmentID(),
|
||||||
curTab.getAD_Table_ID(), record_ID, null);
|
curTab.getAD_Table_ID(), record_ID, null, listener);
|
||||||
|
|
||||||
curTab.loadAttachments(); // reload
|
|
||||||
toolbar.getButton("Attachment").setPressed(curTab.hasAttachment());
|
|
||||||
focusToActivePanel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onChat()
|
public void onChat()
|
||||||
|
@ -953,7 +978,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
String description = infoName + ": " + infoDisplay;
|
String description = infoName + ": " + infoDisplay;
|
||||||
|
|
||||||
WChat chat = new WChat(curWindowNo, curTab.getCM_ChatID(), curTab.getAD_Table_ID(), recordId, description, null);
|
WChat chat = new WChat(curWindowNo, curTab.getCM_ChatID(), curTab.getAD_Table_ID(), recordId, description, null);
|
||||||
chat.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
|
chat.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
curTab.loadChats();
|
curTab.loadChats();
|
||||||
|
@ -1023,34 +1048,43 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
{
|
{
|
||||||
int newTabIndex = tabList.getSelectedIndex();
|
int newTabIndex = tabList.getSelectedIndex();
|
||||||
|
|
||||||
if (setActiveTab(newTabIndex))
|
final IADTabList tabListRef = tabList;
|
||||||
{
|
final int originalTabIndex = curTabIndex;
|
||||||
//force sync model
|
setActiveTab(newTabIndex, new Callback<Boolean>() {
|
||||||
tabList.refresh();
|
|
||||||
}
|
@Override
|
||||||
else
|
public void onCallback(Boolean result) {
|
||||||
{
|
if (result)
|
||||||
//reset to original
|
{
|
||||||
tabList.setSelectedIndex(curTabIndex);
|
//force sync model
|
||||||
}
|
tabListRef.refresh();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//reset to original
|
||||||
|
tabListRef.setSelectedIndex(originalTabIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event.getTarget() instanceof ProcessModalDialog)
|
else if (event.getTarget() instanceof ProcessModalDialog)
|
||||||
{
|
{
|
||||||
ProcessModalDialog dialog = (ProcessModalDialog) event.getTarget();
|
ProcessModalDialog dialog = (ProcessModalDialog) event.getTarget();
|
||||||
onModalClose(dialog.getProcessInfo());
|
onModalClose(dialog.getProcessInfo());
|
||||||
onRefresh(false);
|
onRefresh(false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean setActiveTab(int newTabIndex) {
|
private void setActiveTab(final int newTabIndex, final Callback<Boolean> callback) {
|
||||||
boolean back = false;
|
|
||||||
|
|
||||||
int oldTabIndex = curTabIndex;
|
final int oldTabIndex = curTabIndex;
|
||||||
|
|
||||||
if (oldTabIndex == newTabIndex)
|
if (oldTabIndex == newTabIndex)
|
||||||
{
|
{
|
||||||
return true;
|
if (callback != null)
|
||||||
|
callback.onCallback(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curTab != null)
|
if (curTab != null)
|
||||||
|
@ -1062,6 +1096,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
((ADSortTab)curTabpanel).saveData();
|
((ADSortTab)curTabpanel).saveData();
|
||||||
((ADSortTab)curTabpanel).unregisterPanel();
|
((ADSortTab)curTabpanel).unregisterPanel();
|
||||||
}
|
}
|
||||||
|
setActiveTab0(oldTabIndex, newTabIndex, callback);
|
||||||
}
|
}
|
||||||
else if (curTab.needSave(true, false))
|
else if (curTab.needSave(true, false))
|
||||||
{
|
{
|
||||||
|
@ -1075,40 +1110,73 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
{
|
{
|
||||||
showLastError();
|
showLastError();
|
||||||
// there is a problem, stop here
|
// there is a problem, stop here
|
||||||
return false;
|
if (callback != null)
|
||||||
|
callback.onCallback(false);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
setActiveTab0(oldTabIndex, newTabIndex, callback);
|
||||||
}
|
}
|
||||||
// explicitly ask when changing tabs
|
// explicitly ask when changing tabs
|
||||||
else if (FDialog.ask(curWindowNo, this.getComponent(), "SaveChanges?", curTab.getCommitWarning()))
|
else
|
||||||
{ // yes we want to save
|
|
||||||
if (!curTab.dataSave(true))
|
|
||||||
{
|
|
||||||
showLastError();
|
|
||||||
// there is a problem, stop here
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // Don't save
|
|
||||||
{
|
{
|
||||||
int newRecord= curTab.getTableModel().getNewRow(); //VOSS COM
|
FDialog.ask(curWindowNo, this.getComponent(), "SaveChanges?", curTab.getCommitWarning(), new Callback<Boolean>() {
|
||||||
|
|
||||||
if( newRecord == -1)
|
@Override
|
||||||
curTab.dataIgnore();
|
public void onCallback(Boolean result) {
|
||||||
else
|
if (result)
|
||||||
{
|
{ // yes we want to save
|
||||||
return false;
|
if (!curTab.dataSave(true))
|
||||||
}
|
{
|
||||||
|
showLastError();
|
||||||
|
// there is a problem, stop here
|
||||||
|
if (callback != null)
|
||||||
|
callback.onCallback(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setActiveTab0(oldTabIndex, newTabIndex, callback);
|
||||||
|
}
|
||||||
|
else // Don't save
|
||||||
|
{
|
||||||
|
int newRecord= curTab.getTableModel().getNewRow(); //VOSS COM
|
||||||
|
|
||||||
|
if( newRecord == -1)
|
||||||
|
curTab.dataIgnore();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (callback != null)
|
||||||
|
callback.onCallback(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setActiveTab0(oldTabIndex, newTabIndex, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // new record, but nothing changed
|
else
|
||||||
|
{
|
||||||
|
// new record, but nothing changed
|
||||||
curTab.dataIgnore();
|
curTab.dataIgnore();
|
||||||
|
setActiveTab0(oldTabIndex, newTabIndex, callback);
|
||||||
|
}
|
||||||
} // there is a change
|
} // there is a change
|
||||||
|
else
|
||||||
|
setActiveTab0(oldTabIndex, newTabIndex, callback);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
setActiveTab0(oldTabIndex, newTabIndex, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setActiveTab0(int oldTabIndex, int newTabIndex,
|
||||||
|
final Callback<Boolean> callback) {
|
||||||
|
boolean back = false;
|
||||||
if (!adTab.updateSelectedIndex(oldTabIndex, newTabIndex))
|
if (!adTab.updateSelectedIndex(oldTabIndex, newTabIndex))
|
||||||
{
|
{
|
||||||
FDialog.warn(curWindowNo, "TabSwitchJumpGo", title);
|
FDialog.warn(curWindowNo, "TabSwitchJumpGo", title);
|
||||||
return false;
|
if (callback != null)
|
||||||
|
callback.onCallback(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
IADTabpanel oldTabpanel = curTabpanel;
|
IADTabpanel oldTabpanel = curTabpanel;
|
||||||
|
@ -1164,7 +1232,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
|
|
||||||
updateToolbar();
|
updateToolbar();
|
||||||
|
|
||||||
return true;
|
if (callback != null)
|
||||||
|
callback.onCallback(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateToolbar()
|
private void updateToolbar()
|
||||||
|
@ -1422,12 +1491,36 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
* refresh all row
|
* refresh all row
|
||||||
* @param fireEvent
|
* @param fireEvent
|
||||||
*/
|
*/
|
||||||
public void onRefresh(boolean fireEvent)
|
public void onRefresh(final boolean fireEvent)
|
||||||
{
|
{
|
||||||
onSave(false);
|
onRefresh(fireEvent, true);
|
||||||
curTab.dataRefreshAll(fireEvent, true);
|
}
|
||||||
curTabpanel.dynamicDisplay(0);
|
|
||||||
focusToActivePanel();
|
/**
|
||||||
|
* refresh all row
|
||||||
|
* @param fireEvent
|
||||||
|
* @param saveCurrentRow
|
||||||
|
*/
|
||||||
|
public void onRefresh(final boolean fireEvent, final boolean saveCurrentRow)
|
||||||
|
{
|
||||||
|
if (saveCurrentRow)
|
||||||
|
{
|
||||||
|
onSave(false, new Callback<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCallback(Boolean result) {
|
||||||
|
curTab.dataRefreshAll(fireEvent, true);
|
||||||
|
curTabpanel.dynamicDisplay(0);
|
||||||
|
focusToActivePanel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curTab.dataRefreshAll(fireEvent, true);
|
||||||
|
curTabpanel.dynamicDisplay(0);
|
||||||
|
focusToActivePanel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1458,45 +1551,47 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!autoSave()) {
|
autoSave(new Callback<Boolean>() {
|
||||||
return;
|
@Override
|
||||||
}
|
public void onCallback(Boolean result) {
|
||||||
|
if (result)
|
||||||
newRecord = curTab.dataNew(false);
|
{
|
||||||
if (newRecord)
|
newRecord = curTab.dataNew(false);
|
||||||
{
|
if (newRecord)
|
||||||
curTabpanel.dynamicDisplay(0);
|
{
|
||||||
toolbar.enableChanges(false);
|
curTabpanel.dynamicDisplay(0);
|
||||||
toolbar.enableDelete(false);
|
toolbar.enableChanges(false);
|
||||||
toolbar.enableDeleteSelection(false);
|
toolbar.enableDelete(false);
|
||||||
toolbar.enableNavigation(false);
|
toolbar.enableDeleteSelection(false);
|
||||||
toolbar.enableTabNavigation(false);
|
toolbar.enableNavigation(false);
|
||||||
toolbar.enableIgnore(true);
|
toolbar.enableTabNavigation(false);
|
||||||
toolbar.enablePrint(curTab.isPrinted());
|
toolbar.enableIgnore(true);
|
||||||
toolbar.enableReport(true);
|
toolbar.enablePrint(curTab.isPrinted());
|
||||||
}
|
toolbar.enableReport(true);
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
logger.severe("Could not create new record");
|
{
|
||||||
}
|
logger.severe("Could not create new record");
|
||||||
focusToActivePanel();
|
}
|
||||||
|
focusToActivePanel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean autoSave() {
|
private void autoSave(Callback<Boolean> callback) {
|
||||||
// has anything changed?
|
// has anything changed?
|
||||||
if (curTab.needSave(true, false))
|
if (curTab.needSave(true, false))
|
||||||
{ // do we have real change
|
{ // do we have real change
|
||||||
if (curTab.needSave(true, true))
|
if (curTab.needSave(true, true))
|
||||||
{
|
{
|
||||||
if (!onSave(false))
|
onSave(false, callback);
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // new record, but nothing changed
|
else // new record, but nothing changed
|
||||||
curTab.dataIgnore();
|
curTab.dataIgnore();
|
||||||
} // there is a change
|
} // there is a change
|
||||||
return true;
|
if (callback != null)
|
||||||
|
callback.onCallback(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Elaine 2008/11/19
|
// Elaine 2008/11/19
|
||||||
|
@ -1540,10 +1635,19 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
if (curTab == null)
|
if (curTab == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!onSave(false))
|
onSave(false, new Callback<Boolean>() {
|
||||||
return;
|
|
||||||
|
|
||||||
// Gets Fields from AD_Field_v
|
@Override
|
||||||
|
public void onCallback(Boolean result) {
|
||||||
|
if (result) {
|
||||||
|
doOnFind();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doOnFind() {
|
||||||
|
// Gets Fields from AD_Field_v
|
||||||
GridField[] findFields = GridField.createFields(ctx, curTab.getWindowNo(), 0,curTab.getAD_Tab_ID());
|
GridField[] findFields = GridField.createFields(ctx, curTab.getWindowNo(), 0,curTab.getAD_Tab_ID());
|
||||||
final FindWindow find = new FindWindow (curTab.getWindowNo(), curTab.getName(),
|
final FindWindow find = new FindWindow (curTab.getWindowNo(), curTab.getName(),
|
||||||
curTab.getAD_Table_ID(), curTab.getTableName(),
|
curTab.getAD_Table_ID(), curTab.getTableName(),
|
||||||
|
@ -1556,7 +1660,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
find.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
|
find.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
if (!find.isCancel())
|
if (!find.isCancel())
|
||||||
|
@ -1584,7 +1688,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
AEnv.showWindow(find);
|
AEnv.showWindow(find);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ToolbarListener#onIgnore()
|
* @see ToolbarListener#onIgnore()
|
||||||
|
@ -1611,89 +1715,113 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
*/
|
*/
|
||||||
public void onSave()
|
public void onSave()
|
||||||
{
|
{
|
||||||
if(onSave(true))
|
onSave(true, new Callback<Boolean>() {
|
||||||
{
|
@Override
|
||||||
String statusLine = statusBar.getStatusLine();
|
public void onCallback(Boolean result)
|
||||||
curTab.dataRefreshAll(true, true);
|
{
|
||||||
statusBar.setStatusLine(statusLine);
|
if (result)
|
||||||
}
|
{
|
||||||
focusToActivePanel();
|
String statusLine = statusBar.getStatusLine();
|
||||||
|
curTab.dataRefreshAll(true, true);
|
||||||
|
statusBar.setStatusLine(statusLine);
|
||||||
|
}
|
||||||
|
focusToActivePanel();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param onSaveEvent
|
* @param onSaveEvent
|
||||||
*/
|
*/
|
||||||
private boolean onSave(boolean onSaveEvent)
|
private void onSave(final boolean onSaveEvent, final Callback<Boolean> callback)
|
||||||
{
|
{
|
||||||
boolean newRecord = (curTab.getRecord_ID() <= 0);
|
final boolean newRecord = (curTab.getRecord_ID() <= 0);
|
||||||
boolean wasChanged = toolbar.isSaveEnable();
|
final boolean wasChanged = toolbar.isSaveEnable();
|
||||||
if (curTab.isSortTab())
|
if (curTab.isSortTab())
|
||||||
{
|
{
|
||||||
((ADSortTab)curTabpanel).saveData();
|
((ADSortTab)curTabpanel).saveData();
|
||||||
toolbar.enableSave(false); // set explicitly
|
toolbar.enableSave(false); // set explicitly
|
||||||
toolbar.enableSaveAndCreate(false);
|
toolbar.enableSaveAndCreate(false);
|
||||||
toolbar.enableIgnore(false);
|
toolbar.enableIgnore(false);
|
||||||
return true;
|
if (callback != null)
|
||||||
|
callback.onCallback(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (onSaveEvent && curTab.getCommitWarning() != null && curTab.getCommitWarning().trim().length() > 0)
|
if (onSaveEvent && curTab.getCommitWarning() != null && curTab.getCommitWarning().trim().length() > 0)
|
||||||
{
|
{
|
||||||
if (!FDialog.ask(curWindowNo, this.getComponent(), "SaveChanges?", curTab.getCommitWarning()))
|
FDialog.ask(curWindowNo, this.getComponent(), "SaveChanges?", curTab.getCommitWarning(), new Callback<Boolean>() {
|
||||||
{
|
|
||||||
return false;
|
@Override
|
||||||
}
|
public void onCallback(Boolean result)
|
||||||
|
{
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
doSave(onSaveEvent, newRecord, wasChanged, callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
doSave(onSaveEvent, newRecord, wasChanged, callback);
|
||||||
}
|
}
|
||||||
boolean retValue = curTab.dataSave(onSaveEvent);
|
|
||||||
|
|
||||||
if (!retValue)
|
|
||||||
{
|
|
||||||
showLastError();
|
|
||||||
return false;
|
|
||||||
} else if (!onSaveEvent) //need manual refresh
|
|
||||||
{
|
|
||||||
curTab.setCurrentRow(curTab.getCurrentRow());
|
|
||||||
}
|
|
||||||
curTabpanel.dynamicDisplay(0);
|
|
||||||
curTabpanel.afterSave(onSaveEvent);
|
|
||||||
|
|
||||||
if (wasChanged) {
|
|
||||||
if (newRecord) {
|
|
||||||
if (curTab.getRecord_ID() > 0) {
|
|
||||||
if (curTabIndex == 0) {
|
|
||||||
MRecentItem.addModifiedField(ctx, curTab.getAD_Table_ID(),
|
|
||||||
curTab.getRecord_ID(), Env.getAD_User_ID(ctx),
|
|
||||||
Env.getAD_Role_ID(ctx), curTab.getAD_Window_ID(),
|
|
||||||
curTab.getAD_Tab_ID());
|
|
||||||
} else {
|
|
||||||
/* when a detail record is modified add header to recent items */
|
|
||||||
GridTab mainTab = gridWindow.getTab(0);
|
|
||||||
if (mainTab != null) {
|
|
||||||
MRecentItem.addModifiedField(ctx, mainTab.getAD_Table_ID(),
|
|
||||||
mainTab.getRecord_ID(), Env.getAD_User_ID(ctx),
|
|
||||||
Env.getAD_Role_ID(ctx), mainTab.getAD_Window_ID(),
|
|
||||||
mainTab.getAD_Tab_ID());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (curTabIndex == 0) {
|
|
||||||
MRecentItem.touchUpdatedRecord(ctx, curTab.getAD_Table_ID(),
|
|
||||||
curTab.getRecord_ID(), Env.getAD_User_ID(ctx));
|
|
||||||
} else {
|
|
||||||
GridTab mainTab = gridWindow.getTab(0);
|
|
||||||
if (mainTab != null) {
|
|
||||||
MRecentItem.touchUpdatedRecord(ctx, mainTab.getAD_Table_ID(),
|
|
||||||
mainTab.getRecord_ID(), Env.getAD_User_ID(ctx));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doSave(boolean onSaveEvent, boolean newRecord,
|
||||||
|
boolean wasChanged, Callback<Boolean> callback) {
|
||||||
|
boolean retValue = curTab.dataSave(onSaveEvent);
|
||||||
|
|
||||||
|
if (!retValue)
|
||||||
|
{
|
||||||
|
showLastError();
|
||||||
|
if (callback != null)
|
||||||
|
callback.onCallback(false);
|
||||||
|
} else if (!onSaveEvent) //need manual refresh
|
||||||
|
{
|
||||||
|
curTab.setCurrentRow(curTab.getCurrentRow());
|
||||||
|
}
|
||||||
|
curTabpanel.dynamicDisplay(0);
|
||||||
|
curTabpanel.afterSave(onSaveEvent);
|
||||||
|
|
||||||
|
if (wasChanged) {
|
||||||
|
if (newRecord) {
|
||||||
|
if (curTab.getRecord_ID() > 0) {
|
||||||
|
if (curTabIndex == 0) {
|
||||||
|
MRecentItem.addModifiedField(ctx, curTab.getAD_Table_ID(),
|
||||||
|
curTab.getRecord_ID(), Env.getAD_User_ID(ctx),
|
||||||
|
Env.getAD_Role_ID(ctx), curTab.getAD_Window_ID(),
|
||||||
|
curTab.getAD_Tab_ID());
|
||||||
|
} else {
|
||||||
|
/* when a detail record is modified add header to recent items */
|
||||||
|
GridTab mainTab = gridWindow.getTab(0);
|
||||||
|
if (mainTab != null) {
|
||||||
|
MRecentItem.addModifiedField(ctx, mainTab.getAD_Table_ID(),
|
||||||
|
mainTab.getRecord_ID(), Env.getAD_User_ID(ctx),
|
||||||
|
Env.getAD_Role_ID(ctx), mainTab.getAD_Window_ID(),
|
||||||
|
mainTab.getAD_Tab_ID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (curTabIndex == 0) {
|
||||||
|
MRecentItem.touchUpdatedRecord(ctx, curTab.getAD_Table_ID(),
|
||||||
|
curTab.getRecord_ID(), Env.getAD_User_ID(ctx));
|
||||||
|
} else {
|
||||||
|
GridTab mainTab = gridWindow.getTab(0);
|
||||||
|
if (mainTab != null) {
|
||||||
|
MRecentItem.touchUpdatedRecord(ctx, mainTab.getAD_Table_ID(),
|
||||||
|
mainTab.getRecord_ID(), Env.getAD_User_ID(ctx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback != null)
|
||||||
|
callback.onCallback(true);
|
||||||
|
}
|
||||||
|
|
||||||
private void showLastError() {
|
private void showLastError() {
|
||||||
String msg = CLogger.retrieveErrorString(null);
|
String msg = CLogger.retrieveErrorString(null);
|
||||||
if (msg != null)
|
if (msg != null)
|
||||||
|
@ -1708,12 +1836,18 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
*/
|
*/
|
||||||
public void onSaveCreate()
|
public void onSaveCreate()
|
||||||
{
|
{
|
||||||
boolean retValue = onSave(true);
|
onSave(true, new Callback<Boolean>() {
|
||||||
if(retValue)
|
|
||||||
{
|
@Override
|
||||||
curTab.dataRefreshAll(true, true);
|
public void onCallback(Boolean result)
|
||||||
onNew();
|
{
|
||||||
}
|
if(result)
|
||||||
|
{
|
||||||
|
curTab.dataRefreshAll(true, true);
|
||||||
|
onNew();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1726,13 +1860,21 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FDialog.ask(curWindowNo, null, "DeleteRecord?"))
|
FDialog.ask(curWindowNo, null, "DeleteRecord?", new Callback<Boolean>() {
|
||||||
{
|
|
||||||
//error will be catch in the dataStatusChanged event
|
@Override
|
||||||
curTab.dataDelete();
|
public void onCallback(Boolean result)
|
||||||
}
|
{
|
||||||
curTabpanel.dynamicDisplay(0);
|
if (result)
|
||||||
focusToActivePanel();
|
{
|
||||||
|
//error will be catch in the dataStatusChanged event
|
||||||
|
curTab.dataDelete();
|
||||||
|
|
||||||
|
curTabpanel.dynamicDisplay(0);
|
||||||
|
focusToActivePanel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Elaine 2008/12/01
|
// Elaine 2008/12/01
|
||||||
|
@ -1874,37 +2016,45 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
{
|
{
|
||||||
public void onEvent(Event event) throws Exception
|
public void onEvent(Event event) throws Exception
|
||||||
{
|
{
|
||||||
if (FDialog.ask(curWindowNo, messagePanel, "DeleteSelection"))
|
FDialog.ask(curWindowNo, messagePanel, "DeleteSelection", new Callback<Boolean>() {
|
||||||
{
|
|
||||||
logger.fine("ok");
|
@Override
|
||||||
Set<Listitem> selectedValues = listbox.getSelectedItems();
|
public void onCallback(Boolean result)
|
||||||
if(selectedValues != null)
|
|
||||||
{
|
{
|
||||||
for(Iterator<Listitem> iter = selectedValues.iterator(); iter.hasNext();)
|
if (result)
|
||||||
{
|
{
|
||||||
Listitem li = iter.next();
|
logger.fine("ok");
|
||||||
if(li != null)
|
Set<Listitem> selectedValues = listbox.getSelectedItems();
|
||||||
logger.fine((String) li.getValue());
|
if(selectedValues != null)
|
||||||
|
{
|
||||||
|
for(Iterator<Listitem> iter = selectedValues.iterator(); iter.hasNext();)
|
||||||
|
{
|
||||||
|
Listitem li = iter.next();
|
||||||
|
if(li != null)
|
||||||
|
logger.fine((String) li.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] indices = listbox.getSelectedIndices();
|
||||||
|
Arrays.sort(indices);
|
||||||
|
int offset = 0;
|
||||||
|
for (int i = 0; i < indices.length; i++)
|
||||||
|
{
|
||||||
|
curTab.navigate(indices[i]-offset);
|
||||||
|
if (curTab.dataDelete())
|
||||||
|
{
|
||||||
|
offset++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
curTabpanel.dynamicDisplay(0);
|
||||||
|
|
||||||
|
messagePanel.dispose();
|
||||||
|
} else {
|
||||||
|
logger.fine("cancel");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] indices = listbox.getSelectedIndices();
|
});
|
||||||
Arrays.sort(indices);
|
|
||||||
int offset = 0;
|
|
||||||
for (int i = 0; i < indices.length; i++)
|
|
||||||
{
|
|
||||||
curTab.navigate(indices[i]-offset);
|
|
||||||
if (curTab.dataDelete())
|
|
||||||
{
|
|
||||||
offset++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
curTabpanel.dynamicDisplay(0);
|
|
||||||
|
|
||||||
messagePanel.dispose();
|
|
||||||
} else {
|
|
||||||
logger.fine("cancel");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
hbox.appendChild(btnOk);
|
hbox.appendChild(btnOk);
|
||||||
|
@ -1933,7 +2083,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
*/
|
*/
|
||||||
public void onPrint() {
|
public void onPrint() {
|
||||||
//Get process defined for this tab
|
//Get process defined for this tab
|
||||||
int AD_Process_ID = curTab.getAD_Process_ID();
|
final int AD_Process_ID = curTab.getAD_Process_ID();
|
||||||
//log.info("ID=" + AD_Process_ID);
|
//log.info("ID=" + AD_Process_ID);
|
||||||
|
|
||||||
// No report defined
|
// No report defined
|
||||||
|
@ -1944,18 +2094,23 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!onSave(false))
|
onSave(false, new Callback<Boolean>() {
|
||||||
return;
|
@Override
|
||||||
//
|
public void onCallback(Boolean result) {
|
||||||
int table_ID = curTab.getAD_Table_ID();
|
if (result) {
|
||||||
int record_ID = curTab.getRecord_ID();
|
//
|
||||||
|
int table_ID = curTab.getAD_Table_ID();
|
||||||
|
int record_ID = curTab.getRecord_ID();
|
||||||
|
|
||||||
ProcessModalDialog dialog = new ProcessModalDialog(this, getWindowNo(), AD_Process_ID,table_ID, record_ID, true);
|
ProcessModalDialog dialog = new ProcessModalDialog(AbstractADWindowPanel.this, getWindowNo(), AD_Process_ID,table_ID, record_ID, true);
|
||||||
if (dialog.isValid()) {
|
if (dialog.isValid()) {
|
||||||
dialog.setPosition("center");
|
dialog.setPosition("center");
|
||||||
dialog.setPage(this.getComponent().getPage());
|
dialog.setPage(AbstractADWindowPanel.this.getComponent().getPage());
|
||||||
dialog.doHighlighted();
|
dialog.doHighlighted();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1968,9 +2123,18 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!onSave(false))
|
onSave(false, new Callback<Boolean>() {
|
||||||
return;
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCallback(Boolean result) {
|
||||||
|
if (result) {
|
||||||
|
doOnReport();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doOnReport() {
|
||||||
// Query
|
// Query
|
||||||
MQuery query = new MQuery(curTab.getTableName());
|
MQuery query = new MQuery(curTab.getTableName());
|
||||||
// Link for detail records
|
// Link for detail records
|
||||||
|
@ -2005,7 +2169,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
}
|
}
|
||||||
|
|
||||||
new WReport (curTab.getAD_Table_ID(), query, toolbar.getEvent().getTarget(), curWindowNo, curTab.getWhereExtended());
|
new WReport (curTab.getAD_Table_ID(), query, toolbar.getEvent().getTarget(), curWindowNo, curTab.getWhereExtended());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2123,8 +2286,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
|
|
||||||
logger.info(wButton.toString());
|
logger.info(wButton.toString());
|
||||||
|
|
||||||
boolean startWOasking = false;
|
final String col = wButton.getColumnName();
|
||||||
String col = wButton.getColumnName();
|
|
||||||
|
|
||||||
// Zoom
|
// Zoom
|
||||||
if (col.equals("Record_ID"))
|
if (col.equals("Record_ID"))
|
||||||
|
@ -2140,10 +2302,29 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
|
|
||||||
if (curTab.needSave(true, false))
|
if (curTab.needSave(true, false))
|
||||||
{
|
{
|
||||||
if (!onSave(false))
|
onSave(false, new Callback<Boolean>() {
|
||||||
return;
|
@Override
|
||||||
|
public void onCallback(Boolean result) {
|
||||||
|
if (result) {
|
||||||
|
actionButton0(col, wButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
actionButton0(col, wButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* Start Button Process
|
||||||
|
* @param col
|
||||||
|
* @param wButton
|
||||||
|
*/
|
||||||
|
private void actionButton0 (String col, final WButtonEditor wButton)
|
||||||
|
{
|
||||||
|
boolean startWOasking = false;
|
||||||
final int table_ID = curTab.getAD_Table_ID();
|
final int table_ID = curTab.getAD_Table_ID();
|
||||||
|
|
||||||
// Record_ID
|
// Record_ID
|
||||||
|
@ -2181,13 +2362,19 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
if (vp.isInitOK()) // may not be allowed
|
if (vp.isInitOK()) // may not be allowed
|
||||||
{
|
{
|
||||||
vp.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
vp.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
||||||
vp.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
|
vp.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
if (vp.needSave())
|
if (vp.needSave())
|
||||||
{
|
{
|
||||||
onSave(false);
|
onSave(false, new Callback<Boolean>() {
|
||||||
onRefresh(false);
|
|
||||||
|
@Override
|
||||||
|
public void onCallback(Boolean result) {
|
||||||
|
onRefresh(false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2211,7 +2398,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
final int recordIdParam = record_ID;
|
final int recordIdParam = record_ID;
|
||||||
win.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
win.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
||||||
win.setPosition("center");
|
win.setPosition("center");
|
||||||
win.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
|
win.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
if (!win.isStartProcess()) {
|
if (!win.isStartProcess()) {
|
||||||
return;
|
return;
|
||||||
|
@ -2238,7 +2425,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
{
|
{
|
||||||
final WCreateFromWindow window = (WCreateFromWindow) cf.getWindow();
|
final WCreateFromWindow window = (WCreateFromWindow) cf.getWindow();
|
||||||
window.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
window.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
||||||
window.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
|
window.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
if (!window.isCancel()) {
|
if (!window.isCancel()) {
|
||||||
|
@ -2288,7 +2475,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Post Status
|
// Check Post Status
|
||||||
Object ps = curTab.getValue("Posted");
|
final Object ps = curTab.getValue("Posted");
|
||||||
|
|
||||||
if (ps != null && ps.equals("Y"))
|
if (ps != null && ps.equals("Y"))
|
||||||
{
|
{
|
||||||
|
@ -2297,18 +2484,27 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (FDialog.ask(curWindowNo, null, "PostImmediate?"))
|
final int tableIdRef = tableId;
|
||||||
{
|
final int recordIdRef = recordId;
|
||||||
boolean force = ps != null && !ps.equals ("N"); // force when problems
|
FDialog.ask(curWindowNo, null, "PostImmediate?", new Callback<Boolean>() {
|
||||||
|
|
||||||
String error = AEnv.postImmediate (curWindowNo, Env.getAD_Client_ID(ctx),
|
@Override
|
||||||
tableId, recordId, force);
|
public void onCallback(Boolean result)
|
||||||
|
{
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
boolean force = ps != null && !ps.equals ("N"); // force when problems
|
||||||
|
|
||||||
if (error != null)
|
String error = AEnv.postImmediate (curWindowNo, Env.getAD_Client_ID(ctx),
|
||||||
statusBar.setStatusLine(error, true, true);
|
tableIdRef, recordIdRef, force);
|
||||||
|
|
||||||
onRefresh(false);
|
if (error != null)
|
||||||
}
|
statusBar.setStatusLine(error, true, true);
|
||||||
|
|
||||||
|
onRefresh(false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} // Posted
|
} // Posted
|
||||||
|
@ -2318,7 +2514,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
} // actionButton
|
} // actionButton
|
||||||
|
|
||||||
private void executeButtonProcess(final WButtonEditor wButton,
|
private void executeButtonProcess(final WButtonEditor wButton,
|
||||||
boolean startWOasking, int table_ID, int record_ID,
|
final boolean startWOasking, final int table_ID, final int record_ID,
|
||||||
boolean isProcessMandatory) {
|
boolean isProcessMandatory) {
|
||||||
/**
|
/**
|
||||||
* Start Process ----
|
* Start Process ----
|
||||||
|
@ -2339,10 +2535,24 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
|
|
||||||
if (curTab.needSave(true, false))
|
if (curTab.needSave(true, false))
|
||||||
{
|
{
|
||||||
if (!onSave(false))
|
onSave(false, new Callback<Boolean>() {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCallback(Boolean result) {
|
||||||
|
if (result) {
|
||||||
|
executeButtonProcess0(wButton, startWOasking, table_ID, record_ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
executeButtonProcess0(wButton, startWOasking, table_ID, record_ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeButtonProcess0(final WButtonEditor wButton,
|
||||||
|
boolean startWOasking, int table_ID, int record_ID) {
|
||||||
// call form
|
// call form
|
||||||
MProcess pr = new MProcess(ctx, wButton.getProcess_ID(), null);
|
MProcess pr = new MProcess(ctx, wButton.getProcess_ID(), null);
|
||||||
int adFormID = pr.getAD_Form_ID();
|
int adFormID = pr.getAD_Form_ID();
|
||||||
|
@ -2359,7 +2569,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
form.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
form.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
||||||
form.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
|
form.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
|
||||||
SessionManager.getAppDesktop().showWindow(form);
|
SessionManager.getAppDesktop().showWindow(form);
|
||||||
onRefresh(false);
|
onRefresh(false, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2375,7 +2585,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
onRefresh(false);
|
onRefresh(false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2518,7 +2728,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
public void onCustomize() {
|
public void onCustomize() {
|
||||||
ADTabpanel tabPanel = (ADTabpanel) getADTab().getSelectedTabpanel();
|
ADTabpanel tabPanel = (ADTabpanel) getADTab().getSelectedTabpanel();
|
||||||
Columns columns = tabPanel.getGridView().getListbox().getColumns();
|
Columns columns = tabPanel.getGridView().getListbox().getColumns();
|
||||||
List columnList = columns.getChildren();
|
List<Component> columnList = columns.getChildren();
|
||||||
GridField[] fields = tabPanel.getGridView().getFields();
|
GridField[] fields = tabPanel.getGridView().getFields();
|
||||||
Map<Integer, String> columnsWidth = new HashMap<Integer, String>();
|
Map<Integer, String> columnsWidth = new HashMap<Integer, String>();
|
||||||
ArrayList<Integer> gridFieldIds = new ArrayList<Integer>();
|
ArrayList<Integer> gridFieldIds = new ArrayList<Integer>();
|
||||||
|
|
|
@ -271,7 +271,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
||||||
{
|
{
|
||||||
if (isLookup())
|
if (isLookup())
|
||||||
{
|
{
|
||||||
setAttribute(Window.MODE_KEY, Window.MODE_MODAL);
|
setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
||||||
setBorder("normal");
|
setBorder("normal");
|
||||||
setClosable(true);
|
setClosable(true);
|
||||||
int height = SessionManager.getAppDesktop().getClientInfo().desktopHeight * 85 / 100;
|
int height = SessionManager.getAppDesktop().getClientInfo().desktopHeight * 85 / 100;
|
||||||
|
|
|
@ -61,6 +61,7 @@ import org.adempiere.webui.component.Tabpanels;
|
||||||
import org.adempiere.webui.component.Tabs;
|
import org.adempiere.webui.component.Tabs;
|
||||||
import org.adempiere.webui.component.Textbox;
|
import org.adempiere.webui.component.Textbox;
|
||||||
import org.adempiere.webui.component.WListbox;
|
import org.adempiere.webui.component.WListbox;
|
||||||
|
import org.adempiere.webui.event.DialogEvents;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.compiere.minigrid.ColumnInfo;
|
import org.compiere.minigrid.ColumnInfo;
|
||||||
import org.compiere.minigrid.IDColumn;
|
import org.compiere.minigrid.IDColumn;
|
||||||
|
@ -1119,13 +1120,20 @@ public class InfoProductPanel extends InfoPanel implements EventListener
|
||||||
*/
|
*/
|
||||||
private void cmd_InfoPAttribute()
|
private void cmd_InfoPAttribute()
|
||||||
{
|
{
|
||||||
InfoPAttributePanel ia = new InfoPAttributePanel(this);
|
final InfoPAttributePanel ia = new InfoPAttributePanel(this);
|
||||||
m_pAttributeWhere = ia.getWhereClause();
|
ia.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
if (m_pAttributeWhere != null)
|
|
||||||
{
|
@Override
|
||||||
executeQuery();
|
public void onEvent(Event event) throws Exception {
|
||||||
renderItems();
|
m_pAttributeWhere = ia.getWhereClause();
|
||||||
}
|
if (m_pAttributeWhere != null)
|
||||||
|
{
|
||||||
|
executeQuery();
|
||||||
|
renderItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
} // cmdInfoAttribute
|
} // cmdInfoAttribute
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1375,12 +1383,19 @@ public class InfoProductPanel extends InfoPanel implements EventListener
|
||||||
M_Warehouse_ID = ((Integer)warehouse.getValue()).intValue();
|
M_Warehouse_ID = ((Integer)warehouse.getValue()).intValue();
|
||||||
|
|
||||||
String title = warehouse.getLabel() + " - " + productName;
|
String title = warehouse.getLabel() + " - " + productName;
|
||||||
InfoPAttributeInstancePanel pai = new InfoPAttributeInstancePanel(this, title,
|
final InfoPAttributeInstancePanel pai = new InfoPAttributeInstancePanel(this, title,
|
||||||
M_Warehouse_ID, 0, productInteger.intValue(), m_C_BPartner_ID);
|
M_Warehouse_ID, 0, productInteger.intValue(), m_C_BPartner_ID);
|
||||||
m_M_AttributeSetInstance_ID = pai.getM_AttributeSetInstance_ID();
|
pai.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
m_M_Locator_ID = pai.getM_Locator_ID();
|
|
||||||
if (m_M_AttributeSetInstance_ID != -1)
|
@Override
|
||||||
dispose(true);
|
public void onEvent(Event event) throws Exception {
|
||||||
|
m_M_AttributeSetInstance_ID = pai.getM_AttributeSetInstance_ID();
|
||||||
|
m_M_Locator_ID = pai.getM_Locator_ID();
|
||||||
|
if (m_M_AttributeSetInstance_ID != -1)
|
||||||
|
dispose(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
|
@ -24,6 +24,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.Callback;
|
||||||
|
import org.adempiere.webui.AdempiereWebUI;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Button;
|
import org.adempiere.webui.component.Button;
|
||||||
import org.adempiere.webui.component.Label;
|
import org.adempiere.webui.component.Label;
|
||||||
|
@ -32,6 +34,7 @@ import org.adempiere.webui.component.Listbox;
|
||||||
import org.adempiere.webui.component.Panel;
|
import org.adempiere.webui.component.Panel;
|
||||||
import org.adempiere.webui.component.Textbox;
|
import org.adempiere.webui.component.Textbox;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
|
import org.adempiere.webui.event.DialogEvents;
|
||||||
import org.adempiere.webui.window.FDialog;
|
import org.adempiere.webui.window.FDialog;
|
||||||
import org.compiere.model.MAttachment;
|
import org.compiere.model.MAttachment;
|
||||||
import org.compiere.model.MAttachmentEntry;
|
import org.compiere.model.MAttachmentEntry;
|
||||||
|
@ -42,9 +45,11 @@ import org.zkoss.util.media.AMedia;
|
||||||
import org.zkoss.util.media.Media;
|
import org.zkoss.util.media.Media;
|
||||||
import org.zkoss.zk.au.out.AuScript;
|
import org.zkoss.zk.au.out.AuScript;
|
||||||
import org.zkoss.zk.au.out.AuEcho;
|
import org.zkoss.zk.au.out.AuEcho;
|
||||||
|
import org.zkoss.zk.ui.Page;
|
||||||
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.event.UploadEvent;
|
||||||
import org.zkoss.zk.ui.util.Clients;
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
import org.zkoss.zul.Borderlayout;
|
import org.zkoss.zul.Borderlayout;
|
||||||
import org.zkoss.zul.Center;
|
import org.zkoss.zul.Center;
|
||||||
|
@ -61,7 +66,7 @@ import org.zkoss.zul.Iframe;
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class WAttachment extends Window implements EventListener
|
public class WAttachment extends Window implements EventListener<Event>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* generated serial version Id
|
* generated serial version Id
|
||||||
|
@ -128,13 +133,33 @@ public class WAttachment extends Window implements EventListener
|
||||||
|
|
||||||
public WAttachment( int WindowNo, int AD_Attachment_ID,
|
public WAttachment( int WindowNo, int AD_Attachment_ID,
|
||||||
int AD_Table_ID, int Record_ID, String trxName)
|
int AD_Table_ID, int Record_ID, String trxName)
|
||||||
|
{
|
||||||
|
this(WindowNo, AD_Attachment_ID, AD_Table_ID, Record_ID, trxName, (EventListener<Event>)null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
* loads Attachment, if ID <> 0
|
||||||
|
* @param WindowNo window no
|
||||||
|
* @param AD_Attachment_ID attachment
|
||||||
|
* @param AD_Table_ID table
|
||||||
|
* @param Record_ID record key
|
||||||
|
* @param trxName transaction
|
||||||
|
*/
|
||||||
|
|
||||||
|
public WAttachment( int WindowNo, int AD_Attachment_ID,
|
||||||
|
int AD_Table_ID, int Record_ID, String trxName, EventListener<Event> eventListener)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
||||||
log.config("ID=" + AD_Attachment_ID + ", Table=" + AD_Table_ID + ", Record=" + Record_ID);
|
log.config("ID=" + AD_Attachment_ID + ", Table=" + AD_Table_ID + ", Record=" + Record_ID);
|
||||||
|
|
||||||
m_WindowNo = WindowNo;
|
m_WindowNo = WindowNo;
|
||||||
|
if (eventListener != null)
|
||||||
|
{
|
||||||
|
this.addEventListener(DialogEvents.ON_WINDOW_CLOSE, eventListener);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
staticInit();
|
staticInit();
|
||||||
|
@ -165,7 +190,7 @@ public class WAttachment extends Window implements EventListener
|
||||||
}
|
}
|
||||||
|
|
||||||
//enter modal
|
//enter modal
|
||||||
doModal();
|
doHighlighted();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -268,6 +293,8 @@ public class WAttachment extends Window implements EventListener
|
||||||
confirmPanel.appendChild(bOk);
|
confirmPanel.appendChild(bOk);
|
||||||
|
|
||||||
text.setTooltiptext(Msg.getElement(Env.getCtx(), "TextMsg"));
|
text.setTooltiptext(Msg.getElement(Env.getCtx(), "TextMsg"));
|
||||||
|
|
||||||
|
this.addEventListener(Events.ON_UPLOAD, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -498,6 +525,11 @@ public class WAttachment extends Window implements EventListener
|
||||||
|
|
||||||
else if (e.getTarget() == bRefresh)
|
else if (e.getTarget() == bRefresh)
|
||||||
displayData(cbContent.getSelectedIndex(), true);
|
displayData(cbContent.getSelectedIndex(), true);
|
||||||
|
else if (e instanceof UploadEvent)
|
||||||
|
{
|
||||||
|
UploadEvent ue = (UploadEvent) e;
|
||||||
|
processUploadMedia(ue.getMedia());
|
||||||
|
}
|
||||||
|
|
||||||
} // onEvent
|
} // onEvent
|
||||||
|
|
||||||
|
@ -511,10 +543,12 @@ public class WAttachment extends Window implements EventListener
|
||||||
|
|
||||||
preview.setVisible(false);
|
preview.setVisible(false);
|
||||||
|
|
||||||
Media media = null;
|
Media media = Fileupload.get(true);
|
||||||
|
if (AdempiereWebUI.isEventThreadEnabled())
|
||||||
media = Fileupload.get(true);
|
processUploadMedia(media);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processUploadMedia(Media media) {
|
||||||
if (media != null)
|
if (media != null)
|
||||||
{
|
{
|
||||||
// pdfViewer.setContent(media);
|
// pdfViewer.setContent(media);
|
||||||
|
@ -554,7 +588,7 @@ public class WAttachment extends Window implements EventListener
|
||||||
clearPreview();
|
clearPreview();
|
||||||
m_change = true;
|
m_change = true;
|
||||||
}
|
}
|
||||||
} // getFileName
|
}
|
||||||
|
|
||||||
private byte[] getMediaData(Media media) {
|
private byte[] getMediaData(Media media) {
|
||||||
byte[] bytes = null;
|
byte[] bytes = null;
|
||||||
|
@ -586,8 +620,17 @@ public class WAttachment extends Window implements EventListener
|
||||||
{
|
{
|
||||||
log.info("");
|
log.info("");
|
||||||
|
|
||||||
if (FDialog.ask(m_WindowNo, this, "AttachmentDelete?"))
|
FDialog.ask(m_WindowNo, this, "AttachmentDelete?", new Callback<Boolean>() {
|
||||||
m_attachment.delete(true);
|
|
||||||
|
@Override
|
||||||
|
public void onCallback(Boolean result)
|
||||||
|
{
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
m_attachment.delete(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
} // deleteAttachment
|
} // deleteAttachment
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -598,19 +641,26 @@ public class WAttachment extends Window implements EventListener
|
||||||
{
|
{
|
||||||
log.info("");
|
log.info("");
|
||||||
|
|
||||||
int index = cbContent.getSelectedIndex();
|
final int index = cbContent.getSelectedIndex();
|
||||||
String fileName = getFileName(index);
|
String fileName = getFileName(index);
|
||||||
|
|
||||||
if (fileName == null)
|
if (fileName == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (FDialog.ask(m_WindowNo, this, "AttachmentDeleteEntry?"))
|
FDialog.ask(m_WindowNo, this, "AttachmentDeleteEntry?", new Callback<Boolean>() {
|
||||||
{
|
|
||||||
if (m_attachment.deleteEntry(index))
|
|
||||||
cbContent.removeItemAt(index);
|
|
||||||
|
|
||||||
m_change = true;
|
@Override
|
||||||
}
|
public void onCallback(Boolean result)
|
||||||
|
{
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
if (m_attachment.deleteEntry(index))
|
||||||
|
cbContent.removeItemAt(index);
|
||||||
|
|
||||||
|
m_change = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
} // deleteAttachment
|
} // deleteAttachment
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -639,5 +689,4 @@ public class WAttachment extends Window implements EventListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // saveAttachmentToFile
|
} // saveAttachmentToFile
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,9 +90,6 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
|
||||||
dynInit();
|
dynInit();
|
||||||
|
|
||||||
init();
|
init();
|
||||||
this.setAttribute("mode","modal");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -300,13 +297,11 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
|
||||||
m_OKpressed = true;
|
m_OKpressed = true;
|
||||||
setValue();
|
setValue();
|
||||||
this.detach();
|
this.detach();
|
||||||
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
|
|
||||||
}
|
}
|
||||||
else if (confirmPanel.getButton("Cancel").equals(event.getTarget()))
|
else if (confirmPanel.getButton("Cancel").equals(event.getTarget()))
|
||||||
{
|
{
|
||||||
m_OKpressed = false;
|
m_OKpressed = false;
|
||||||
this.detach();
|
this.detach();
|
||||||
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Events.ON_SELECT.equals(event.getName()))
|
else if (Events.ON_SELECT.equals(event.getName()))
|
||||||
|
|
|
@ -146,10 +146,4 @@ public class WOnlyCurrentDays extends Window implements EventListener<Event>, Di
|
||||||
|
|
||||||
this.detach();
|
this.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void detach() {
|
|
||||||
super.detach();
|
|
||||||
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,16 +134,8 @@ public class FDialog
|
||||||
newTitle = title;
|
newTitle = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
String s = out.toString().replace("\n", "<br>");
|
||||||
{
|
Messagebox.showDialog(s, newTitle, Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
String s = out.toString().replace("\n", "<br>");
|
|
||||||
Messagebox.showDialog(s, newTitle, Messagebox.OK, Messagebox.EXCLAMATION);
|
|
||||||
}
|
|
||||||
catch (InterruptedException exception)
|
|
||||||
{
|
|
||||||
// Restore the interrupted status
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -233,16 +225,8 @@ public class FDialog
|
||||||
|
|
||||||
out = constructMessage(adMessage, message);
|
out = constructMessage(adMessage, message);
|
||||||
|
|
||||||
try
|
String s = out.toString().replace("\n", "<br>");
|
||||||
{
|
Messagebox.showDialog(s, AEnv.getDialogHeader(ctx, windowNo), Messagebox.OK, Messagebox.ERROR);
|
||||||
String s = out.toString().replace("\n", "<br>");
|
|
||||||
Messagebox.showDialog(s, AEnv.getDialogHeader(ctx, windowNo), Messagebox.OK, Messagebox.ERROR);
|
|
||||||
}
|
|
||||||
catch (InterruptedException exception)
|
|
||||||
{
|
|
||||||
// Restore the interrupted status
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -258,6 +242,21 @@ public class FDialog
|
||||||
* @return true, if OK
|
* @return true, if OK
|
||||||
*/
|
*/
|
||||||
public static boolean ask(int windowNo, Component comp, String adMessage, String msg)
|
public static boolean ask(int windowNo, Component comp, String adMessage, String msg)
|
||||||
|
{
|
||||||
|
return ask(windowNo, comp, adMessage, msg, (Callback<Boolean>)null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* Ask Question with question icon and (OK) (Cancel) buttons
|
||||||
|
*
|
||||||
|
* @param WindowNo Number of Window
|
||||||
|
* @param c Container (owner)
|
||||||
|
* @param AD_Message Message to be translated
|
||||||
|
* @param msg Additional clear text message
|
||||||
|
*
|
||||||
|
* @return true, if OK
|
||||||
|
*/
|
||||||
|
public static boolean ask(int windowNo, Component comp, String adMessage, String msg, Callback<Boolean> callback)
|
||||||
{
|
{
|
||||||
StringBuffer out = new StringBuffer();
|
StringBuffer out = new StringBuffer();
|
||||||
if (adMessage != null && !adMessage.equals(""))
|
if (adMessage != null && !adMessage.equals(""))
|
||||||
|
@ -265,7 +264,7 @@ public class FDialog
|
||||||
if (msg != null && msg.length() > 0)
|
if (msg != null && msg.length() > 0)
|
||||||
out.append("\n").append(msg);
|
out.append("\n").append(msg);
|
||||||
String s = out.toString().replace("\n", "<br>");
|
String s = out.toString().replace("\n", "<br>");
|
||||||
return ask(windowNo, comp, s);
|
return ask(windowNo, comp, s, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -280,7 +279,7 @@ public class FDialog
|
||||||
|
|
||||||
public static boolean ask(int windowNo, Component comp, String adMessage)
|
public static boolean ask(int windowNo, Component comp, String adMessage)
|
||||||
{
|
{
|
||||||
return ask(windowNo, comp, adMessage, (Callback<String>)null);
|
return ask(windowNo, comp, adMessage, (Callback<Boolean>)null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -293,23 +292,24 @@ public class FDialog
|
||||||
* @return true, if OK
|
* @return true, if OK
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static boolean ask(int windowNo, Component comp, String adMessage, Callback<String> callback)
|
public static boolean ask(int windowNo, Component comp, String adMessage, final Callback<Boolean> callback)
|
||||||
{
|
{
|
||||||
try
|
Callback<Integer> msgCallback = null;
|
||||||
{
|
if (callback != null)
|
||||||
String s = Msg.getMsg(Env.getCtx(), adMessage).replace("\n", "<br>");
|
{
|
||||||
int response = Messagebox.showDialog(s, AEnv.getDialogHeader(Env.getCtx(), windowNo),
|
msgCallback = new Callback<Integer>() {
|
||||||
Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION, callback);
|
@Override
|
||||||
|
public void onCallback(Integer result) {
|
||||||
|
boolean b = result != null && result.intValue() == Messagebox.OK;
|
||||||
|
callback.onCallback(b);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
String s = Msg.getMsg(Env.getCtx(), adMessage).replace("\n", "<br>");
|
||||||
|
int response = Messagebox.showDialog(s, AEnv.getDialogHeader(Env.getCtx(), windowNo),
|
||||||
|
Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION, msgCallback, (msgCallback == null));
|
||||||
|
|
||||||
return (response == Messagebox.OK);
|
return (response == Messagebox.OK);
|
||||||
}
|
|
||||||
catch (InterruptedException ex)
|
|
||||||
{
|
|
||||||
// Restore the interrupted status
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -356,16 +356,8 @@ public class FDialog
|
||||||
|
|
||||||
out = constructMessage(adMessage, message);
|
out = constructMessage(adMessage, message);
|
||||||
|
|
||||||
try
|
String s = out.toString().replace("\n", "<br>");
|
||||||
{
|
Messagebox.showDialog(s, AEnv.getDialogHeader(ctx, windowNo), Messagebox.OK, Messagebox.INFORMATION);
|
||||||
String s = out.toString().replace("\n", "<br>");
|
|
||||||
Messagebox.showDialog(s, AEnv.getDialogHeader(ctx, windowNo), Messagebox.OK, Messagebox.INFORMATION);
|
|
||||||
}
|
|
||||||
catch (InterruptedException exception)
|
|
||||||
{
|
|
||||||
// Restore the interrupted status
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1326,7 +1326,6 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
|
||||||
isvalid = false;
|
isvalid = false;
|
||||||
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
|
|
||||||
} // dispose
|
} // dispose
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.Callback;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.ConfirmPanel;
|
import org.adempiere.webui.component.ConfirmPanel;
|
||||||
import org.adempiere.webui.component.Grid;
|
import org.adempiere.webui.component.Grid;
|
||||||
|
@ -54,6 +55,7 @@ import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
import org.zkoss.zk.ui.Executions;
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.Page;
|
||||||
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;
|
||||||
|
@ -77,6 +79,7 @@ public final class WAccountDialog extends Window
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = 7999516267209766287L;
|
private static final long serialVersionUID = 7999516267209766287L;
|
||||||
|
private Callback<Integer> m_callback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -85,7 +88,7 @@ public final class WAccountDialog extends Window
|
||||||
* @param C_AcctSchema_ID as
|
* @param C_AcctSchema_ID as
|
||||||
*/
|
*/
|
||||||
public WAccountDialog (String title,
|
public WAccountDialog (String title,
|
||||||
MAccountLookup mAccount, int C_AcctSchema_ID)
|
MAccountLookup mAccount, int C_AcctSchema_ID, Callback<Integer> callback)
|
||||||
{
|
{
|
||||||
super ();
|
super ();
|
||||||
this.setTitle(title);
|
this.setTitle(title);
|
||||||
|
@ -96,6 +99,7 @@ public final class WAccountDialog extends Window
|
||||||
+ ", C_ValidCombination_ID=" + mAccount.C_ValidCombination_ID);
|
+ ", C_ValidCombination_ID=" + mAccount.C_ValidCombination_ID);
|
||||||
m_mAccount = mAccount;
|
m_mAccount = mAccount;
|
||||||
m_C_AcctSchema_ID = C_AcctSchema_ID;
|
m_C_AcctSchema_ID = C_AcctSchema_ID;
|
||||||
|
m_callback = callback;
|
||||||
m_WindowNo = SessionManager.getAppDesktop().registerWindow(this);
|
m_WindowNo = SessionManager.getAppDesktop().registerWindow(this);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -242,7 +246,6 @@ public final class WAccountDialog extends Window
|
||||||
|
|
||||||
this.setBorder("normal");
|
this.setBorder("normal");
|
||||||
this.setClosable(false);
|
this.setClosable(false);
|
||||||
this.setAttribute("modal", Boolean.TRUE);
|
|
||||||
|
|
||||||
this.setSizable(true);
|
this.setSizable(true);
|
||||||
} // jbInit
|
} // jbInit
|
||||||
|
@ -581,6 +584,18 @@ public final class WAccountDialog extends Window
|
||||||
this.onClose();
|
this.onClose();
|
||||||
} // dispose
|
} // dispose
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.adempiere.webui.component.Window#onPageDetached(org.zkoss.zk.ui.Page)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onPageDetached(Page page) {
|
||||||
|
super.onPageDetached(page);
|
||||||
|
if (m_callback != null) {
|
||||||
|
m_callback.onCallback(getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save Selection
|
* Save Selection
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -351,9 +351,4 @@ public class WChat extends Window implements EventListener<Event>, DialogEvents
|
||||||
actionPerformed(event);
|
actionPerformed(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void detach() {
|
|
||||||
super.detach();
|
|
||||||
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
|
|
||||||
}
|
|
||||||
} // AChat
|
} // AChat
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.adempiere.webui.window;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.webui.AdempiereWebUI;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Button;
|
import org.adempiere.webui.component.Button;
|
||||||
import org.adempiere.webui.component.ConfirmPanel;
|
import org.adempiere.webui.component.ConfirmPanel;
|
||||||
|
@ -34,6 +35,7 @@ import org.zkoss.util.media.Media;
|
||||||
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.event.UploadEvent;
|
||||||
import org.zkoss.zul.Borderlayout;
|
import org.zkoss.zul.Borderlayout;
|
||||||
import org.zkoss.zul.Center;
|
import org.zkoss.zul.Center;
|
||||||
import org.zkoss.zul.North;
|
import org.zkoss.zul.North;
|
||||||
|
@ -50,7 +52,7 @@ import org.zkoss.zul.Separator;
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class WImageDialog extends Window implements EventListener
|
public class WImageDialog extends Window implements EventListener<Event>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -148,12 +150,20 @@ public class WImageDialog extends Window implements EventListener
|
||||||
//
|
//
|
||||||
fileButton.addEventListener(Events.ON_CLICK, this);
|
fileButton.addEventListener(Events.ON_CLICK, this);
|
||||||
confirmPanel.addActionListener(Events.ON_CLICK, this);
|
confirmPanel.addActionListener(Events.ON_CLICK, this);
|
||||||
|
|
||||||
|
addEventListener(Events.ON_UPLOAD, this);
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
public void onEvent(Event e) throws Exception {
|
public void onEvent(Event e) throws Exception {
|
||||||
if (e.getTarget() == fileButton)
|
if (e instanceof UploadEvent)
|
||||||
|
{
|
||||||
|
UploadEvent ue = (UploadEvent) e;
|
||||||
|
processUploadMedia(ue.getMedia());
|
||||||
|
}
|
||||||
|
else if (e.getTarget() == fileButton)
|
||||||
|
{
|
||||||
cmd_file();
|
cmd_file();
|
||||||
|
}
|
||||||
else if (e.getTarget().getId().equals(ConfirmPanel.A_OK))
|
else if (e.getTarget().getId().equals(ConfirmPanel.A_OK))
|
||||||
{
|
{
|
||||||
if (image.getContent() != null)
|
if (image.getContent() != null)
|
||||||
|
@ -192,10 +202,12 @@ public class WImageDialog extends Window implements EventListener
|
||||||
private void cmd_file()
|
private void cmd_file()
|
||||||
{
|
{
|
||||||
// Show File Open Dialog
|
// Show File Open Dialog
|
||||||
Media imageFile = null;
|
Media media = Fileupload.get();
|
||||||
|
if (AdempiereWebUI.isEventThreadEnabled())
|
||||||
imageFile = Fileupload.get();
|
processUploadMedia(media);
|
||||||
|
} // cmd_file
|
||||||
|
|
||||||
|
private void processUploadMedia(Media imageFile) {
|
||||||
if (imageFile == null)
|
if (imageFile == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -230,7 +242,7 @@ public class WImageDialog extends Window implements EventListener
|
||||||
m_mImage.setBinaryData(image.getContent().getByteData());
|
m_mImage.setBinaryData(image.getContent().getByteData());
|
||||||
else
|
else
|
||||||
m_mImage.setBinaryData(null);
|
m_mImage.setBinaryData(null);
|
||||||
} // cmd_file
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Image ID
|
* Get Image ID
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.sql.Clob;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.webui.AdempiereWebUI;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Button;
|
import org.adempiere.webui.component.Button;
|
||||||
import org.adempiere.webui.component.Panel;
|
import org.adempiere.webui.component.Panel;
|
||||||
|
@ -33,6 +34,7 @@ import org.zkoss.util.media.Media;
|
||||||
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.event.UploadEvent;
|
||||||
import org.zkoss.zul.Borderlayout;
|
import org.zkoss.zul.Borderlayout;
|
||||||
import org.zkoss.zul.Center;
|
import org.zkoss.zul.Center;
|
||||||
import org.zkoss.zul.North;
|
import org.zkoss.zul.North;
|
||||||
|
@ -47,7 +49,7 @@ import org.zkoss.zul.Iframe;
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class WMediaDialog extends Window implements EventListener
|
public class WMediaDialog extends Window implements EventListener<Event>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -186,6 +188,8 @@ public class WMediaDialog extends Window implements EventListener
|
||||||
|
|
||||||
confirmPanel.appendChild(bCancel);
|
confirmPanel.appendChild(bCancel);
|
||||||
confirmPanel.appendChild(bOk);
|
confirmPanel.appendChild(bOk);
|
||||||
|
|
||||||
|
addEventListener(Events.ON_UPLOAD, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -307,6 +311,11 @@ public class WMediaDialog extends Window implements EventListener
|
||||||
{
|
{
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
else if (e instanceof UploadEvent)
|
||||||
|
{
|
||||||
|
UploadEvent ue = (UploadEvent) e;
|
||||||
|
processUploadMedia(ue.getMedia());
|
||||||
|
}
|
||||||
} // onEvent
|
} // onEvent
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -315,12 +324,12 @@ public class WMediaDialog extends Window implements EventListener
|
||||||
|
|
||||||
private void loadFile()
|
private void loadFile()
|
||||||
{
|
{
|
||||||
log.info("");
|
Media media = Fileupload.get();
|
||||||
|
if (AdempiereWebUI.isEventThreadEnabled())
|
||||||
Media media = null;
|
processUploadMedia(media);
|
||||||
|
} // getFileName
|
||||||
media = Fileupload.get();
|
|
||||||
|
private void processUploadMedia(Media media) {
|
||||||
if (media == null)
|
if (media == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -330,8 +339,7 @@ public class WMediaDialog extends Window implements EventListener
|
||||||
m_change = true;
|
m_change = true;
|
||||||
m_data = media.getByteData();
|
m_data = media.getByteData();
|
||||||
displayData();
|
displayData();
|
||||||
|
}
|
||||||
} // getFileName
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* download
|
* download
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.adempiere.webui.component.Row;
|
||||||
import org.adempiere.webui.component.Rows;
|
import org.adempiere.webui.component.Rows;
|
||||||
import org.adempiere.webui.component.Textbox;
|
import org.adempiere.webui.component.Textbox;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
|
import org.adempiere.webui.event.DialogEvents;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.compiere.model.MAttribute;
|
import org.compiere.model.MAttribute;
|
||||||
import org.compiere.model.MAttributeInstance;
|
import org.compiere.model.MAttributeInstance;
|
||||||
|
@ -101,7 +102,6 @@ public class WPAttributeDialog extends Window implements EventListener, SystemID
|
||||||
{
|
{
|
||||||
super ();
|
super ();
|
||||||
this.setTitle(Msg.translate(Env.getCtx(), "M_AttributeSetInstance_ID"));
|
this.setTitle(Msg.translate(Env.getCtx(), "M_AttributeSetInstance_ID"));
|
||||||
this.setAttribute("modal", Boolean.TRUE);
|
|
||||||
this.setBorder("normal");
|
this.setBorder("normal");
|
||||||
this.setWidth("500px");
|
this.setWidth("500px");
|
||||||
this.setHeight("600px");
|
this.setHeight("600px");
|
||||||
|
@ -627,8 +627,7 @@ public class WPAttributeDialog extends Window implements EventListener, SystemID
|
||||||
// Select Instance
|
// Select Instance
|
||||||
if (e.getTarget() == bSelect)
|
if (e.getTarget() == bSelect)
|
||||||
{
|
{
|
||||||
if (cmd_select())
|
cmd_select();
|
||||||
dispose();
|
|
||||||
}
|
}
|
||||||
// New/Edit
|
// New/Edit
|
||||||
else if (e.getTarget() == cbNewEdit)
|
else if (e.getTarget() == cbNewEdit)
|
||||||
|
@ -778,7 +777,7 @@ public class WPAttributeDialog extends Window implements EventListener, SystemID
|
||||||
* Instance Selection Button
|
* Instance Selection Button
|
||||||
* @return true if selected
|
* @return true if selected
|
||||||
*/
|
*/
|
||||||
private boolean cmd_select()
|
private void cmd_select()
|
||||||
{
|
{
|
||||||
log.config("");
|
log.config("");
|
||||||
|
|
||||||
|
@ -826,17 +825,22 @@ public class WPAttributeDialog extends Window implements EventListener, SystemID
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
WPAttributeInstance pai = new WPAttributeInstance(title,
|
final WPAttributeInstance pai = new WPAttributeInstance(title,
|
||||||
M_Warehouse_ID, M_Locator_ID, m_M_Product_ID, m_C_BPartner_ID);
|
M_Warehouse_ID, M_Locator_ID, m_M_Product_ID, m_C_BPartner_ID);
|
||||||
if (pai.getM_AttributeSetInstance_ID() != -1)
|
pai.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
{
|
|
||||||
m_M_AttributeSetInstance_ID = pai.getM_AttributeSetInstance_ID();
|
@Override
|
||||||
m_M_AttributeSetInstanceName = pai.getM_AttributeSetInstanceName();
|
public void onEvent(Event event) throws Exception {
|
||||||
m_M_Locator_ID = pai.getM_Locator_ID();
|
if (pai.getM_AttributeSetInstance_ID() != -1)
|
||||||
m_changed = true;
|
{
|
||||||
return true;
|
m_M_AttributeSetInstance_ID = pai.getM_AttributeSetInstance_ID();
|
||||||
}
|
m_M_AttributeSetInstanceName = pai.getM_AttributeSetInstanceName();
|
||||||
return false;
|
m_M_Locator_ID = pai.getM_Locator_ID();
|
||||||
|
m_changed = true;
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
} // cmd_select
|
} // cmd_select
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -70,7 +70,6 @@ public class WPAttributeInstance extends Window implements EventListener
|
||||||
{
|
{
|
||||||
super ();
|
super ();
|
||||||
this.setTitle(Msg.getMsg(Env.getCtx(), "PAttributeInstance") + title);
|
this.setTitle(Msg.getMsg(Env.getCtx(), "PAttributeInstance") + title);
|
||||||
this.setAttribute("modal", Boolean.TRUE);
|
|
||||||
this.setBorder("normal");
|
this.setBorder("normal");
|
||||||
this.setWidth("500px");
|
this.setWidth("500px");
|
||||||
this.setHeight("550px");
|
this.setHeight("550px");
|
||||||
|
|
|
@ -1039,7 +1039,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
||||||
if (!find.isValid())
|
if (!find.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
find.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
|
find.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
if (!find.isCancel())
|
if (!find.isCancel())
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
</device-config>
|
</device-config>
|
||||||
|
|
||||||
<system-config>
|
<system-config>
|
||||||
<disable-event-thread>false</disable-event-thread>
|
<disable-event-thread>true</disable-event-thread>
|
||||||
</system-config>
|
</system-config>
|
||||||
|
|
||||||
<!-- Configure the progress message to show in the center -->
|
<!-- Configure the progress message to show in the center -->
|
||||||
|
|
Loading…
Reference in New Issue