简体   繁体   中英

Confirm (yes/No) dialog box in Callout Adempiere

I'm trying to get the Confirm Dialog Box in Adempiere. I have used

 JOptionPane.showConfirmDialog(null, msg,"", JOptionPane.YES_NO_OPTION); 
or 
ADialog.ask(WindowNo, null,msg)

instead of 
mTab.fireDataStatusEEvent ("NoQtyAvailable", "0", true); 

I getting the popup (yes /NO ) and working fine in Swing but it doesnt works with WEBUI.

My Code:

if (product.isStocked())
            {               
                if (available == null)
                    available = Env.ZERO;
                if (available.signum() == 0){
                    //mTab.fireDataStatusEEvent ("NoQtyAvailable", "0", false);                                         
                    int response = JOptionPane.showConfirmDialog(null, msg,
                            "", JOptionPane.YES_NO_OPTION);
                    if (response == JOptionPane.YES_OPTION) 
                        mTab.setValue("BC_Qty", mTab.getValue("QtyEntered"));
                    else
                        mTab.setValue("BC_Qty", Env.ZERO);
                }
            }

Buid ERROR:

Buildfile: E:\Adempiere360\svn\base\build.xml
init:
     [echo] =========== Build Base
makedir:
compile:
    [javac] E:\Adempiere360\svn\base\build.xml:56: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 1 source file to E:\Adempiere360\svn\base\build
    [javac] 
E:\Adempiere360\svn\base\src\org\compiere\model\CalloutOrder.java:27: package org.adempiere.webui.window does not exist
    [javac] import org.adempiere.webui.window.FDialog;
    [javac]                                  ^
    [javac] 
E:\Adempiere360\svn\base\src\org\compiere\model\CalloutOrder.java:827: warning: [deprecation] getQtyAvailable(int,int,int,java.lang.String) in org.compiere.model.MStorage has been deprecated
    [javac]                 BigDecimal available = MStorage.getQtyAvailable
    [javac]                                                ^
    [javac]
 E:\Adempiere360\svn\base\src\org\compiere\model\CalloutOrder.java:833: cannot find symbol
    [javac] symbol  : variable FDialog
    [javac] location: class org.compiere.model.CalloutOrder
    [javac]                     if(FDialog.ask(WindowNo, null, msg))
    [javac]                        ^
    [javac] 
E:\Adempiere360\svn\base\src\org\compiere\model\CalloutOrder.java:1309: warning: [deprecation] getQtyAvailable(int,int,int,java.lang.String) in org.compiere.model.MStorage has been deprecated
    [javac]                 BigDecimal available = MStorage.getQtyAvailable
    [javac]                                                ^
    [javac] 2 errors
    [javac] 2 warnings

BUILD FAILED
E:\Adempiere360\svn\base\build.xml:56: Compile failed; see the compiler error output for details.

Ay advice would be appreciated.

ADempiere will build the code in the following order

tools/build.xml
base/build.xml
extend/build.xml
client/build.xml
JasperReports/build.xml
serverRoot/build.xml
serverApps/build.xml
webStore/build.xml
webCM/build.xml
sqlj/build.xml
posterita/posterita/build.xml
zkwebui/build.xml
install/build.xml

The 'FDialog' class is defined in 'zkwebui' folder. You have used the FDialog class in CalloutOrder.java(import org.adempiere.webui.window.FDialog;). So it(FDialog) is not visible while building the 'Base' folder.

You just remove the import org.adempiere.webui.window.FDialog; statemenet from the CalloutOrder.java class. It will refine your build and work properly in webUI.

You can find the build order details from here

I have edited your condition. Just replace your existing condition with this condition:

if (product.isStocked())
{               
    if (available == null) {
        available = Env.ZERO;
    }

    if (available.signum() == 0) {
        //mTab.fireDataStatusEEvent ("NoQtyAvailable", "0", false);                                         
        boolean response = org.adempiere.webui.window.FDialog.ask(1,           
                           null,"message1","Message 2");
        if (response) {
            mTab.setValue("BC_Qty", mTab.getValue("QtyEntered"));
        } else {
            mTab.setValue("BC_Qty", Env.ZERO);
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM