Solved

Java Applet

Posted on 2011-09-21
1
292 Views
Last Modified: 2012-05-12
Hello,

I am working on a J2SE web application that divides the browser window in 2 frames. The top frame called the powerbarframe has a series of Javascript Object buttons that control the display of various applets in the bottom frame called the display frame.

The bottom frame itself is composed of JOptionPane with several tabs. It has a Java method that prompts the user if he wants to discard changes before loading a new applet in response to a tab change. See function below:

    public void tabWillBeSelected(TabSelectionWillChangeEvent e) {
    //public void tabWillBeSelected(TabSelectionWillChangeEvent e) {
          //EventObject ApplicationEvent TabSelectionWillChangeEvent - ChangeEvent
        // If configuration is modified, show dialog
        if (configurationManager.isModifedConfigurations()) {

            // ask if they really want to discard changes
            int selection = JOptionPane.showConfirmDialog(getView(), messages.getString("ConfigTabChangeConfirmMsg"),
                    messages.getString("ConfigTabChangeConfirmMsgTitle"),
                    JOptionPane.YES_NO_OPTION);

            if (selection != JOptionPane.YES_OPTION) {
            e.setCanceled(true);
            } else { // Discard changes
                configurationManager.setModifedConfigurations(false);
            }
        }
    }

If the user wants to discard changes, the event is cancelled.
I want to implement the same functionality if the user click one of the Javascript Object buttons from the powerbar frame. I am thincking of writing a methode from the applet shutdown() method. The problem is that it does not allow the the user to save he configuration changes if he wants to:

see code snipped below:

    public void shutdown() {
        if (configurationManager.isModifedConfigurations()) {
              int selection = 999;
              
            // ask if they really want to discard changes
            selection = JOptionPane.showConfirmDialog(null, messages.getString("ConfigTabChangeConfirmMsg"),
                    messages.getString("ConfigTabChangeConfirmMsgTitle"),
                    JOptionPane.YES_NO_OPTION);
           
            if (selection == JOptionPane.YES_OPTION) { //Discard Changes
                configurationManager.setModifedConfigurations(false);

                super.shutdown();
                removeBindings();
                stopCurrentApplet();
            } else if (selection == JOptionPane.NO_OPTION) { //Save changes
                  //find way to abort
                  System.out.println("Catch ApplicationEvent !!! Update Mutable Table fields.");
//                  abort();
//                  currentApplet.stop();
                  return;
            }
        }
    }

            currentApplet.stop();
            if (logger.isDebugEnabled()) {
                logger.debug("Destroying prior applet " + currentApplet.getClass());
            }
            currentApplet.destroy();


Any suggestions ??

Paolo
0
Comment
Question by:ptreves
1 Comment
 

Accepted Solution

by:
ptreves earned 0 total points
ID: 36904334
Need to implement proper controller.
0

Featured Post

Make managing Office 365 email signatures a breeze

Are you using Office 365? Having trouble trying to set up email signatures for your users? Getting stressed out managing multiple signatures? Need an easier way to manage? We have a solution for you, try the most-user friendly and powerful signature management tool on the market.

Join & Write a Comment

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
New Relic recently released its Synthetics product that allows for the creation of performance monitors that periodically test a site's performance. If you wish to test an interactive workflow New Relic employs Selenium WebDriverJS to run those test…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now