Calling Dialog from a dialog- size constraints

Hi,
I am using Jdev version 11.1.1.7.1.
I am calling a taskflow and running it as a dialog. I have a requirement to call another taskflow which runs as dialog from this dialog. When I do so, my child dialog is restricted within the parent dialog space. If the size of my child dialog is greater than my parent dialog, I get a scroll bar on the parent dialog, and have to scroll through it to view the child dialog completely.
Is there a way I could avoid the scroll bar or render the child dialog outside the parent space ? What setting could be used?
Thanks in advance,
Punin

You can only make the parent dialog biet to give the child more room.
Timo

Similar Messages

  • Call Dialog from another dialog

    hi everyone
    can anybody tell me how can we call one dialog from another dialog..
    Is it possible...???
    if it is, how we can we do ...please tell me with example
    thanks in advance

    Is it possible...???yes
    if it is, how we can we do ...please tell me with example
    public static void main(String[] args) {
       JDialog parent;
       for (int i = 0; i < 5; i++) {
          JDialog d = new JDialog(parent, true);
          parent = d;
          d.setVisible(true);
    }

  • Couldn't open first dialog from second dialog in a single project (VC++)

    Hai all,
      Good Day. I am very new to Visual C++. I am learning VC++ and doing practice side by side using IDE - Visual Studio 2005. In my project i created two dialogs. In
    first dialog  BARCODE_DIALOG (CBarCodeDlg) if i clicked  a button "password", i want to open a
    second Dialog DIALOG2(CPasswordDlg).  in this if i clicked main button  DIALOG2 closed at same time i want to open first Dialog and have to do changes in first dialog. 
    my problem is i closed the second dialogv by calling OnOK(). but i couldn't open first dialog. How to do?
    //For opening second dialog from first dialog:
    //CBarCodeDlg.cpp
    void CBarCodeDlg::OnBnClickedBpswd()
    // TODO: Add your control notification handler code here
    OnOK();
    m_dPswdDlg.DoModal(); // added variable public CPasswordDlg m_dPswdDlg
    //For close second dialog and do changes in first dialog
    //CPasswordDlg.cpp
    void CPasswordDlg::OnBnClickedBmain()
    OnOK();
    m_dBarCodeDlg.DoModal(); //added varible public CBarCodeDlg m_dBarCodeDlg
    if i added this 
    m_dBarCodeDlg.DoModal(); //added varible public CBarCodeDlg m_dBarCodeDlg
    getting errors.  How to call it and also i have to do changes in BarcodeDlg if clicked main button. can you plese help me to do it.

    yes david. Thanks a lot david.  i got it. but what i am doing in second dialog, i getting a string and comparing with another string. if equal then enabling another button "main". if i clicked main i want enable product number combo box
    in first dialog. how to enable it.
    You are thinking wrong about the second dialog. It should not be trying to control the first dialog. What it should do is set some internal state that the first dialog can interrogate after DoModal() returns. The simplest (bur not best OOP practice) is to
    use a public member variable, say a bool m_bSame. Then you could do
    //CBarCodeDlg.cpp
    void CBarCodeDlg::OnBnClickedBpswd()
    CPasswordDlg dlg;
    if( (dlg.DoModal() == IDOK) && dlg.m_bSame)
    // enable Combo box
    else
    // report some kind of error
    Or, even simpler, you could only allow the second dialog to return IDOK if the two strings are the same. Then you would not need the bool variable.
    Or you could put the user-entered string in a public member variable and do the test in the first dialog. Then you could create the entire second dialog in the designer, without adding any code (just add a public CString variable that is bound to an edit
    control).
    Modal dialogs are usually just information gatherers. They should bot be reaching out into the rest of the application.
    David Wilkinson | Visual C++ MVP

  • How to call a Dialog Program from another Dialog Program

    Dear All,
    How can I call a dialog program with return value from another dialog program?
    Regards,
    Alok.

    Hi Alok,
    1. Insted of creating 2 different Dialog program. It's good to create as many screens as you want in same module pool program. Any way you can use the different TCODE for each screen.
    2. Another and The best way is to create a function group and then inside function group use the function 2 module... In the function group define a global variable which will be present for both the function group if they are getting executed in sequence. and inside the Function Module call the screens using command " call screen <screenno>".
    3. You can use set / get parameter to pass values of a field between two dynpro program.

  • Is it possible to call a JavaScript function from a dialog?

    Hi there,
    At the moment I have created a dialog, that consists of three text fields that a user fills out, and then clicks next.
    What I am attempting to do, is pass the result of these three textboxes to a JavaScript function I have laying in a file in Web Resources. I've done some research, and I can't find anything.
    So my question is - is it possible to call a JavaScript function from a dialog?
    Thanks for your time.

    Hi,
         It is not possible unfortunately. We can start dialog from script but not the other way unfortunately. However, you can always write server side code for this and it will surely execute. So instead of javascript, write plug-in.
    Hope this helps.
     Minal Dahiya
     blog : http://minaldahiya.blogspot.com.au/
     If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"

  • How can i call the certificate selection dialog box from source code?

    How can i call the certificate selection dialog box from source code?
    NB: Of course if i have more than one certificate in the Microsoft Keystore 'My'.
    Thank You in advance

    I found an example of the "TestStand UI Expression Control.ctl" and it works just the way I need it. (check the link)
    Proper use of "TestStand UI ExpressionEdit Control" in LabVIEW http://forums.ni.com/ni/board/message?board.id=330&requireLogin=False&thread.id=10609 
    The "Expression Browser Dialog Box Button" F(x) stays disable while editing the VI, however it become available when the VI is called from TestStand.
    Thank you,
    Hecuba
    Mfg. Test Engineer
    Certified LabVIEW Associate Developer

  • Disable menubar and location from popup dialog in new browser window

    How to hide the toolbar, menubar, location and status for the popup window (not inline, but new browser window style) using ADF 11g?
    Just like HTML javascript:
    window.open ('page.jsp', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')In ADF 11g, I have a jspx refered by a taskflow action with "dialog:" prefix, and I call it from a button like this:
    <af:commandToolbarButton text="Add"
    id="ctbAdd"
    action="dialog:create"
    useWindow="true"
    windowEmbedStyle="window"
    windowModalityType="applicationModal"
    windowHeight="400"
    windowWidth="600"
    />How to control the toolbar, menubar, location and status for the popup window?
    Thanks in advanced,
    Samson Fu

    I tried it but not success. My code as below:
        public void handleAddLaunch(LaunchEvent launchEvent) {
            launchEvent.getWindowProperties().put("toolbar", "no");
            launchEvent.getWindowProperties().put("menubar", "no");
            launchEvent.getWindowProperties().put("scrollbars", "no");
            launchEvent.getWindowProperties().put("resizable", "no");
            launchEvent.getWindowProperties().put("location", "no");
            launchEvent.getWindowProperties().put("status", "no");The popup windows contains all the toolbar, menubar, location...
    Is there any example or reference for the keys and values for getWindowProperties()?
    Regards,
    Samson Fu

  • Open and editor windown from a dialog screen.

    Hi,
    Does anybody know how to open an editor window to write large text notes (1,000 chars or more) from a dialog screen?
    Then how this data is stored on a table?
    I need to save large amounts of text and I have seen this on SAP transactions.
    Any help will be appreciated.
    Thanks,
    Orlando.

    Oh, I see.  I would not suggest using a sapscript editor. I would use the text editor that I mentioned early.  If you really want that functionality of the sapscript editor, you can do that.  Either way you will need to create a custom text object/id to save your text to the db.  Here is an example of using the sapscript editor.
    report zrich_0002.
    data: header type THEAD.
    data: txt_lines type table of tline with header line.
    header-TDOBJECT = 'AUFK'.
    header-TDNAME   = '001000000001'.
    header-TDID     = 'LTXT'.
    header-TDSPRAS  = sy-langu.
    header-TDLINESIZE = 70.
    * First read the text, if there is any.
    call function 'READ_TEXT'
      exporting
    *   CLIENT                        = SY-MANDT
        id                            = header-tdid
        language                      = sy-langu
        name                          = header-tdname
        object                        = header-TDOBJECT
    *   ARCHIVE_HANDLE                = 0
    *   LOCAL_CAT                     = ' '
    * IMPORTING
    *   HEADER                        =
      tables
        lines                         = txt_lines
    * EXCEPTIONS
    *   ID                            = 1
    *   LANGUAGE                      = 2
    *   NAME                          = 3
    *   NOT_FOUND                     = 4
    *   OBJECT                        = 5
    *   REFERENCE_CHECK               = 6
    *   WRONG_ACCESS_TO_ARCHIVE       = 7
    *   OTHERS                        = 8
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    * throw editor, allow user to change
    call function 'EDIT_TEXT'
      exporting
    *   DISPLAY             = ' '
    *   EDITOR_TITLE        = ' '
        header              = header
    *   PAGE                = ' '
    *   WINDOW              = ' '
        SAVE                = 'X'
    *   LINE_EDITOR         = ' '
    *   CONTROL             = ' '
    *   PROGRAM             = ' '
    *   LOCAL_CAT           = ' '
    * IMPORTING
    *   FUNCTION            =
    *   NEWHEADER           =
    *   RESULT              =
      tables
        lines               = txt_lines
    * EXCEPTIONS
    *   ID                  = 1
    *   LANGUAGE            = 2
    *   LINESIZE            = 3
    *   NAME                = 4
    *   OBJECT              = 5
    *   TEXTFORMAT          = 6
    *   COMMUNICATION       = 7
    *   OTHERS              = 8
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    * When user comes back from editor, save the text
    call function 'SAVE_TEXT'
      exporting
        CLIENT                = SY-MANDT
        header                = header
    *   INSERT                = ' '
    *   SAVEMODE_DIRECT       = ' '
    *   OWNER_SPECIFIED       = ' '
    *   LOCAL_CAT             = ' '
    * IMPORTING
    *   FUNCTION              =
    *   NEWHEADER             =
      tables
        lines                 = txt_lines
    * EXCEPTIONS
    *   ID                    = 1
    *   LANGUAGE              = 2
    *   NAME                  = 3
    *   OBJECT                = 4
    *   OTHERS                = 5
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    So for your case, you must create a custom Text Object and ID via SE75.
    REgards,
    Rich Heilman

  • How to stop the Dialog from being dragged

    I was hoping that someone could tell me when calling a Dialog from Jframe, a how to stop the Dialog from being dragged
    while a dialog is showing.
    When it is visible I can still click and drag the Dialog
    I want to set it so you can not drag it until the dialog has be closed.

    If you don't have access to the parent frame, a "hack" that usually works:
    Frame frame = Frame.getFrames()[0];
    if (null != frame && frame instanceof JFrame){
    JFrame jf = (JFrame)frame;
    JDialog jd = new JDialog(jf, "title");
    ... code here ...
    As each JFrame (or Frame) is opened, its stored in the array of Frames that you can get. Same thing with Dialog.getDialogs(). Almost always, at least so far for me I've never had this problem, the [0] index is the main window opened, or the parent/top frame. I'd put the check in there to be safe and make sure its a JFrame and usually you'll only have the one JFrame.

  • CALL TRANSACTION in user dialog

    Hi!
    I'm having problem to use syntax CALL TRANSACTION in user dialog (SE80).  My syntax is as follows:
    CALL TRANSACTION 'F-43' USING BDCDATA MODE 'N' UPDATE 'S'
              MESSAGES INTO t_msg.
    My problem is I cannot execute this syntax in background mode although I set the MODE as N(Do not display) or P(Do not display; debugging possible).
    However, if I set MODE as A(Display screen) or E(Display only if an error occurs), it works but foreground execution.
    Hope to get respond from you guys.
    Thank you and best regards.

    Hi,
    Chk this link if it can help you.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bc_aba/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d3732353531%7d
    Regards,
    Balaji
    *Rewrds for helpful answers

  • Transfering data from a dialog to the parent

    I have an app that calls a dialog from the pull down menu.
    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
        ConnectionBox dialog = new ConnectionBox(new javax.swing.JFrame(), true);
        JFrame mainFrame = DBToolsApp.getApplication().getMainFrame();
        dialog.setLocationRelativeTo(mainFrame);
        dialog.setVisible(true);
    }On that dialog I have several text fields. I want to set some strings in the parent app with the values returned form the text fields on the dialog.
    Does anyone know of an example of how to return data from the dialog back to the parent app?
    Thanks!

    It appears that you are using NetBeans and making a Java Desktop Application. And the code you have given should be in the FrameView which should be named DBToolsView in your case, isn't it?
    So, this is what I usually do:
    1- Frame view has the string fields along with their getters or setters (which you already have).
    2- Make constructor in the dialog which accepts the frame view object also in addition to frame. Also, make a FrameView field in the dialog (in your case it is ConnectionBox)
    3- The dialog should also have OK and Cancel buttons.
    4- On clicking OK set the string in frame view using the frame view reference and various setters and dispose the dialog.
    5- On Cancel just dispose the dialog.
    So, your action performed method in frame view would look like:
    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
        JFrame mainFrame = DBToolsApp.getApplication().getMainFrame();
        ConnectionBox dialog = new ConnectionBox(this, mainFrame, true);
        dialog.setLocationRelativeTo(mainFrame);
        dialog.setVisible(true);
    }The ConnectionBox class should look like this:
    class ConnectionBox extends JDialog
          FrameView view;
          public ConnectionBox (FrameView view, Frame parent, boolean modal){
                super(parent, modal);
                this.view=view;
                initComponents(); // for NetBeans VE
         private okActionPerformed(){
                view.setString1(jtextField1.getText());
                view.setString2(jtextField2.getText());
                // and so on
                dispose();
        private cancelActionPerformed(){
                dispose();
    // other methods..... VE generated code, etc.
    }// end classAlso you could have used JOptionPane if you had to set single string, see this , but I don't know how we can return multiple strings using JOptionPane, though it must be possible because showInputDialog returns Object. Anyway, I don't know about option pane much.
    But the method given in this reply would perhaps work for you, and I find it the easiest.
    Thanks!
    Remark: I was really bored.....the reason for this long reply for simple question ;-)

  • How can I open "Place..." dialog from my plugin?

    Hello All,
    There is a "Place..." item in  "File -> ...". If we can click on "Place...",  "Place" dialog will open and asks for .ai file to place the whatever the art is there in that file in the current document. Right.
    Now what I want is, if I click on one of the button in my plugin UI, "Place" dialog will open and art will be drawn in the current document.
    I looked into the API documentation and found AIPlacedSuite::ExecPlaceRequest( ) function, but no use.
    How can I open "Place" dialog from my plugin?

    The SDK does not provide any calls to open the Place dialog directly.
    You have a few potential solutiuons, however.
    A. Implement your own file dialog box, and use the Place suite. Which I think is perhaps the most elegant solution.
    B. Programitcally create an action that opens the Place dialog. You can record an action that does this to see what file would have to be written (see "Insert Menu Item..." then type "Place", enter while recording). Then you could call the action with the Action suite.
    C. The dialog could be opened using the scripting capabilites (for instance AppleScript). Your program could then write/call the AppleScript. I know it can be done with AppleScript, and I suspect other scripting languages such as Java might be able to do it.
    Hope this helps.

  • Java - best practice for getting values from complex dialogs

    Hi,
    Java is a language I use quite a bit, but much of my work hasn't required GUIs. Now, I'm developing an app which will contain a number of custom-made dialogs (which will obviously extend JDialog). Take a typical Options dialog which typically stores many parameters for a given application.
    Simple dialogs that ship with Java allow to 'get' a given value. As they assume that the dialog only consists of obtaining a single piece of data, think JFileChooser.
    So, what is the best way to cope with a dialog that could potentially hold hundreds of parameters? It's surely unfeasible to implement getters for each field. I was thinking either creating a hashmap object to hold key-value pairs, and 'get' that from the dialog. Or, I could encapsulate that a little more by creating a new class that manages these values, ProgramOptions or such like. That can be passed around between the dialog and the main app.
    I hope this makes sense
    TIA

    sudman1 wrote:
    I doubt it's the most efficient method, but the way I've delt with things like this in the past is to set up the fields in either an Array or ArrayList, then use a for loop that gets the data and drops it into an Array/ArrayList which is then returned.
    class MyDialog extends JDialog {
    // Global variable
    private ArrayList dialogFieldsArray= new ArrayList();
    private void initGUI() {
    for (int i=0 ; i <numRequiredFields ; i++) {
    dialogFieldsArray.add(new JTextField(10));
    private ArrayList getDialogData() {
    ArrayList rval = new ArrayList();
    for (int i=0 ; i < dialogFieldsArray.size() ; i++) {
    String tempString = ((JTextField) dialogFieldsArray.get(i)).getText();
    rval.add(tempString);
    return rval;
    The only thing to remember with the above method is the castings involved, but you could implement your own subclasses of ArrayList that deal only with JTextFields and Strings seperately to get around that.
    I personally wouldn't go for this exact style, instead I'd opt for a Map collection instead. This because you need to know which field is at which exact index. Imagine you make a form that has the fields: forename, surname, date of birth. And so you know that forename is .get(0) of your ArrayList, etc.
    But then, you decide to put a new field, saluation (Mr, Miss, etc) at the beginning. This now shifts all your olds fields along by one, and so you need to edit that code. Sure, no biggie with a handful of fields, but large dialogs could cause headaches.

  • "DEADLOCK" when showing dialog from RMI-callback.

    Hi!
    Today is the 10th day (full time) that I've been searching for a solution in Java Forums and Internet, but I couldn't find anything that helps me. Help is extremely appreciated, otherwise I'll go crazy! :-)
    The problem is that RMI-callback thread "somehow blocks" the Event Dispatch Thread.
    I want to do following:
    1) I push the button in the client (btDoSomething)
    (MOUSE_RELEASED,(39,14),button=1,modifiers=Button1,clickCount=1 is automatically pushed onto EventQueue)
    2) btDoSomethingActionPerformed is invoked
    3) inside of it I make a call to RMI-server (server.doSomething())
    4) from this server method I invoke RMI-callback back to the client (client.askUser())
    5) in the callback I want to display a question to the user (JOptionPane.showConfirmDialog)
    6) user should answers the question
    7) callback returns to server
    8) client call to the server returns
    9) btDoSomethingActionPerformed returns and everybody is happy :-)
    This works normally in normal Client, that means, while a button is pushed, you can show Dialogs, but with RMI callback I get problems.
    I just made a small client-server sample to simulate real project. What I want to achieve is that client invokes server method, server method does something, but if server method doesn't have enough information to make the decision it needs to do call back to the client and wait for input, so the user gets an JOptionPane.
    Here is my callback method:
        /** this is the remote callback method, which is invoked from the sevrer */
        public synchronized String askUser() throws java.rmi.RemoteException {
            System.out.println("askUser() thread group: " + Thread.currentThread().getThreadGroup());
            System.out.println("callback started...");
            try {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        System.out.println("My event started...");
                        JOptionPane.showConfirmDialog(parentFrame, "Are you OK?", "Question", JOptionPane.YES_NO_OPTION);
                        System.out.println("My event finished.");
            }catch (Exception e) {
                e.printStackTrace();
            try {
                Thread.currentThread().sleep(10000);
            }catch (Exception e) {
                e.printStackTrace();
            System.out.println("callback finished.");
            return "Yo!"; // just return anything
        }Here in this sample I let the callback thread sleep for 10 seconds, but in real project I let it sleep infinitely and I want to wake it up after the user has answered JOptionPane. But I have the DEADLOCK, because event queue is waiting for callback to finish and doesn't schedule the "showing dialog" event which contains the command for waking up the callback thread.
    I looked very precisely when the event queue starts again to process events: it is precisely then when btDoSomethingActionPerformed is finished.
    When I'm not accessing GUI inside of the callback, this callback mechanism works perfectly, but as soon as I want to show the dialog from inside of the RMI-callback method, the "AWT Event Dispatch Queue" is somehow frozen until RMI-callback thread is finished (and in turn btDoSomethingActionPerformed terminates) . I cannot explain this weird behaviour!!!
    If I don't use SwingUtilities.invokeLater (I know this shoudn't be done outside of Event Dispatch Thread), but access the GUI directy, my JOptionPane is shown, but is not painted (it is blank gray) until callback thread returns.
    Why showing (or painting) of dialog is not done until btDoSomethingActionPerformed is finished?
    I also tried to spawn a new Thread inside of main RMI-callback thread, but nothing changed.
    I also tried the workaround from some older posting to use myInvokeLater:
        private final static ThreadGroup _applicationThreadGroup = Thread.currentThread().getThreadGroup();
        public void myInvokeLater(final Runnable code) {
            (new Thread(_applicationThreadGroup, new Runnable() {
                public void run() { SwingUtilities.invokeLater(code); }
            ).start();
        }but this didn't help either.
    Then I tried to spawn a new Thread directly from the Client's constructor, so that I'm sure that it belongs to the main appplication thread group. I even started that thread there in the constructor and made it wait for the callback. When callback came in, it would wake up that sleeping thread which should then show the dialog. But this did't help either.
    Now I think that it is IMPOSSIBLE to solve this problem this way.
    Spawning a new Process could work I think, but I'm not really sure if I want do to that.
    I know I could make a solution where server method is invoked and if some information is missing I can raise custom exception, provide the input on client side and call the same server mathod again with this additional data, but for that I need to change server RMI interfaces, etc... to fit in this concept. I thought callback would much easier, but after almost 10 days of trying the callback...I almost regreted it :-(
    Is anyone able to help?
    Thank you very much!
    Please scroll down for the complete sample (with build and run batch files), in case someone wants to try it. Or for the time being for your convenience you can download the whole sample from
    http://www.onlineloop.com/~tornado/download/rmi_callback_blocks_gui.zip
    ######### BEGIN CODE ####################################
    package callbackdialog;
    public interface ICallback extends java.rmi.Remote {
        public String askUser() throws java.rmi.RemoteException;
    package callbackdialog;
    public interface IServer extends java.rmi.Remote {
        public void doSomething() throws java.rmi.RemoteException;
    package callbackdialog;
    import java.rmi.Naming;
    public class Server {
        public Server() {
            try {
                IServer s = new ServerImpl();
                Naming.rebind("rmi://localhost:1099/ServerService", s);
            } catch (Exception e) {
                System.out.println("Trouble: " + e);
        public static void main(String args[]) {
            new Server();
    package callbackdialog;
    import java.rmi.Naming;
    public class ServerImpl extends java.rmi.server.UnicastRemoteObject implements IServer {
        // Implementations must have an explicit constructor
        // in order to declare the RemoteException exception
        public ServerImpl() throws java.rmi.RemoteException {
            super();
        public void doSomething() throws java.rmi.RemoteException {
            System.out.println("doSomething started...");
            try {
                // ask the client for the "missing" value via RMI callback
                ICallback client = (ICallback)Naming.lookup("rmi://localhost/ICallback");
                String clientValue = client.askUser();
                System.out.println("Got value from callback: " + clientValue);
            }catch (Exception e) {
                e.printStackTrace();
            System.out.println("doSomething finished.");
    package callbackdialog;
    import java.rmi.server.RemoteStub;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.registry.Registry;
    import java.rmi.registry.LocateRegistry;
    import java.rmi.Naming;
    import javax.swing.JOptionPane;
    import javax.swing.SwingUtilities;
    import javax.swing.JFrame;
    public class Client extends javax.swing.JFrame implements ICallback {
        private final JFrame parentFrame = this;
        private Registry mRegistry = null;
        private RemoteStub remoteStub = null;
        private IServer server = null;
        private final static ThreadGroup _applicationThreadGroup = Thread.currentThread().getThreadGroup();
        /** Creates new form Client */
        public Client() {
            initComponents();
            System.out.println("Client constructor thread group: " + Thread.currentThread().getThreadGroup());
            try {
                server = (IServer)Naming.lookup("rmi://localhost/ServerService");
                // register client to the registry, so the server can invoke callback on it
                mRegistry = LocateRegistry.getRegistry("localhost", 1099);
                remoteStub = (RemoteStub)UnicastRemoteObject.exportObject((ICallback)this);
                Registry mRegistry = LocateRegistry.getRegistry("localhost", 1099);
                mRegistry.bind("ICallback", remoteStub);
            }catch (java.rmi.AlreadyBoundException e) {
                try {
                    mRegistry.unbind("ICallback");
                    mRegistry.bind("ICallback", remoteStub);
                }catch (Exception ex) {
                    // ignore it
            }catch (Exception e) {
                e.printStackTrace();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            java.awt.GridBagConstraints gridBagConstraints;
            secondTestPanel = new javax.swing.JPanel();
            btDoSomething = new javax.swing.JButton();
            getContentPane().setLayout(new java.awt.GridBagLayout());
            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            setTitle("RMI-Callback-GUI-problem sample");
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    formWindowClosing(evt);
            secondTestPanel.setLayout(new java.awt.GridBagLayout());
            btDoSomething.setText("show dialog");
            btDoSomething.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    btDoSomethingActionPerformed(evt);
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 0;
            gridBagConstraints.gridy = 3;
            gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0);
            secondTestPanel.add(btDoSomething, gridBagConstraints);
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 0;
            gridBagConstraints.gridy = 1;
            gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
            gridBagConstraints.weightx = 1.0;
            gridBagConstraints.weighty = 1.0;
            getContentPane().add(secondTestPanel, gridBagConstraints);
            pack();
        private void btDoSomethingActionPerformed(java.awt.event.ActionEvent evt) {                                             
            System.out.println(java.awt.EventQueue.getCurrentEvent().paramString());
            try {
                server.doSomething(); // invoke server RMI method, which will do the client RMI-Callback
                                      // in order to show the dialog
            }catch (Exception e) {
                e.printStackTrace();
        private void formWindowClosing(java.awt.event.WindowEvent evt) {                                  
            try {
                mRegistry.unbind("ICallback");
            }catch (Exception e) {
                e.printStackTrace();
            setVisible(false);
            dispose();
            System.exit(0);
        /** this is the remote callback method, which is invoked from the sevrer */
        public synchronized String askUser() throws java.rmi.RemoteException {
            System.out.println("askUser() thread group: " + Thread.currentThread().getThreadGroup());
            System.out.println("callback started...");
            try {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        System.out.println("My event started...");
                        JOptionPane.showConfirmDialog(parentFrame, "Are you OK?", "Question", JOptionPane.YES_NO_OPTION);
                        System.out.println("My event finished.");
            }catch (Exception e) {
                e.printStackTrace();
            try {
                Thread.currentThread().sleep(10000);
            }catch (Exception e) {
                e.printStackTrace();
            System.out.println("callback finished.");
            return "Yo!"; // just return anything
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    Client client = new Client();
                    client.setSize(500,300);
                    client.setVisible(true);
        // Variables declaration - do not modify
        private javax.swing.JButton btDoSomething;
        private javax.swing.JPanel secondTestPanel;
        // End of variables declaration
    1_build.bat
    javac -cp . -d . *.java
    rmic callbackdialog.ServerImpl
    rmic callbackdialog.Client
    pause
    2_RunRmiRegistry.bat
    rmiregistry
    pause
    3_RunServer.bat
    rem java -classpath .\ Server
    java callbackdialog.Server
    pause
    4_RunClient.bat
    java callbackdialog.Client
    pause
    ######### END CODE ####################################

    I can understand that only partially, because SwingUtilities.invokeLater puts(redirects) my runnable object directly into AWT thread. The only conclusion I can draw from all things that I have tried until now , is that SwingUtilities.invokeLater(<showing the dialog>) invoked from a RMI thread somehow have lower "priority" than events coming directly from the AWT-thread and therefore it is held back until normal awt event completes (in this case BUTTON_RELEASED).
    But what I don't understand is the fact that the dialog is not shown even If I create and start a new thread from the client's constructor. This thread has nothing to do with RMI as it is in the main thread group:
        private BlockingObject dialogBlocker = new BlockingObject();
        private BlockingObject blocker = new BlockingObject();
        public Client() {
            initComponents();
            (new Thread() {
                public void run() {
                    try {
                        dialogBlocker.sleep(0);
                        System.out.println("My event started...");
                        JOptionPane.showConfirmDialog(parentFrame, "Are you OK?", "Question", JOptionPane.YES_NO_OPTION);
                        blocker.wake();
                        System.out.println("My event finished.");
                    }catch (Exception e) {
                        e.printStackTrace();
            }).start();
            ...Callback is then only used to wake up this thread which should display the dialog:
        public Object askUser() throws java.rmi.RemoteException {
            System.out.println("callback started...");
            dialogBlocker.wake();
            blocker.sleep(0);
            System.out.println("callback finished.");
            return userChoice; // return anything I don't care for now
    class BlockingObject {
        public void sleep(long timeout) {
            synchronized(this){
                try {
                    wait(timeout);
                }catch (InterruptedException e) {}
        public void wake() {
            synchronized(this){
                notifyAll();
        }In this case the dialog is shown, but it is NOT painted, so I have deadlock again. Why it is not painted?!?
    Haven't I uncouple it from RMI-Thread?
    But perhaps I'm looking at the wrong side of the whole thing.
    If I invoke server.doSomething (as ejp proposed) in a separate thread, then everything is fine (except that I cannot use this solution in my project :-( ).
    It seems that the whole problem is NOT AT ALL related to callback itself, but rather to the fact that if client invokes remote call, even dialogs can't be shown until the rmi call returns to the client.
    Thank you, Drindilica

  • BUG: Return listener not being called for manually launched dialog

    Hello all,
    I have found a bug in the dialog framework. To set the stage, I have a ADF Faces page with a command button on it. The partial submit property is set to "true" and the use window property is also set to "true." I also have the returnListener property set to a method in the backing bean. When I set the Action property of the command button to a global navigation rule that launches a dialog, the return listener is being called correctly when I dismiss the dialog.
    However, when I launch the dialog from an action listener, the return listener is not being called. Here is my action listener code:
      public void al (ActionEvent ae)
        FacesContext context = FacesContext.getCurrentInstance();
        ViewHandler vh = context.getApplication().getViewHandler();
        UIViewRoot dialog = vh.createView(context, "/infrastructure/ICConfirmDelete.jspx");
        HashMap properties = new HashMap();
        properties.put("width", new Integer(300));
        properties.put("height", new Integer(300));
        AdfFacesContext.getCurrentInstance().launchDialog(dialog, null, ae.getComponent(), true, properties);
      }and here is my return listener:
      public void rl(ReturnEvent re)
        System.out.println("in return");
        System.out.println((String) re.getReturnValue());
      }OK - here's an update. If the command button is in the Actions facet of the page, everything works as expected. However, if the button is in the selection facet of a table (inside of afTableSelectOne) - it does not work properly as documented here. It also works correctly if the button is in the actions facet of the table. I think that this is a bug and needs to work - my use case (as you might tell from my code) is to do a delete confirmation dialog. My short-term workaround is to use the Action instead of ActionListener property on the command button, but the issue I have is that the pop-up dialog is just a tad too small, and is showing scrollbars.
    Regards,
    John
    Message was edited by:
    John Stegeman
    Added additional information about tableSelectOne

    Gabrielle,
    Sorry for the confusion.
    What does not work:
    Initiating a dialog from the ActionListener attached to a command button (where the command button is inside an afSelectTableOne) will not fire the returnListener when the dialog is closed.
    What does work:
    Initiating a dialog by returning a dialog-based navigation rule (e.g. a string starting with "dialog:") from the Action attached to a command button (even if the command button is inside an afSelectTableOne) - the return listener is called when the dialog is closed
    What also does work:
    Initiating a dialog with either method (Action or ActionListener) when the command button is elsewhere on the Page (e.g. in the Actions facet)
    Hope this clarifies the bug. I could send a test case if desired.
    Kind regards,
    John

Maybe you are looking for