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

Post here questions and problems related to oXygen frameworks/document types.
vishwavaranasi
Posts: 99
Joined: Fri Feb 28, 2020 4:02 pm

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

Post 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?
Thanks,
vishwa
Radu
Posts: 8283
Joined: Fri Jul 09, 2004 5:18 pm

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

Post 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));"?
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
vishwavaranasi
Posts: 99
Joined: Fri Feb 28, 2020 4:02 pm

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

Post by vishwavaranasi »

Thanks Radu , thats worked for us.
Thanks,
vishwa
Post Reply