Page 1 of 1

Wait Cursor -from a customized DITA (inert Image dialog)

Posted: Thu Sep 29, 2022 10:21 am
by vishwavaranasi
Hello Team,

We have our own customized framework where we have customized the "Insert Image " Dialog , which will will talk to our oxygen plugin to get the image details , during this process we have implemented a wait cursor functionality as below.

and the showWaitCursor() method called inside the custom code of insert image as below

Code: Select all

JFrame oxygenFrame = (JFrame) authorAccess.getWorkspaceAccess().getParentFrame();
        final InsertImageDialog dialog = new InsertImageDialog(oxygenFrame);

        dialog.addURLButtonActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        try {
                          
                            ourCusrsorJavaClass.showWaitCursor();
                        
                            xxxxDTO xxxdto=xxxx.methodInvokingtogetImagetoInsert();
                        
                            dialog.setURL(xxxdto.getImageId());
                        }
                        catch (Exception var5) {
                     
                      
                        }
                        finally {
                            ourCusrsorJavaClass.showDefaultCursor();
                        }
                    }
                });
            }
        });

public static void showWaitCursor() {
        JFrame mainFrame =(JFrame)  ro.sync.exml.workspace.api.PluginWorkspaceProvider.getPluginWorkspace().getParentFrame();
        System.out.println("1--"+ mainFrame .getName());
     
        mainFrame .setCursor(Cursor.getPredefinedCursor(3));
        Component[] components = mainFrame .getComponents();
        Component[] allCoponents = components;
        int allCoponentsLength = components.length;

        for(int eachComponent = 0; eachComponent < allCoponentsLength; ++eachComponent) {
            Component component = allCoponents[eachcomponentonent];
            component.setEnabled(false);
            System.out.println("2---"+ component.getName());
        }

    }
the method showWaitCursor(); being called and printing the sysouts
the first sysout printed as --------------> 1--frame0
the second sysout printed as ---------> 2---null


but this never Showing Waitcursor or busy cursor until the operation finishing.

please suggest what are we doing wrong here?

Re: Wait Cursor -from a customized DITA (inert Image dialog)

Posted: Thu Sep 29, 2022 10:36 am
by Radu
Hi,

How about if instead of setting the wait cursor on the Oxygen main frame, you set it directly on the dialog which is opened on top of Oxygen?
So something like "dialog .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));"?

Re: Wait Cursor -from a customized DITA (inert Image dialog)

Posted: Thu Sep 29, 2022 11:37 am
by vishwavaranasi
Thanks Radu , thats worked for us.