Solved

Java Applet

Posted on 2011-09-21
1
301 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Transferring Country Domains 2 52
web design and cms 1 179
spf reocrd not found error 16 115
RESTFul API - actions that don't fit into the world of CRUD operations 16 688
For some reason Google Apps has decided to reserve 'www' for your new domain which results in an error when trying to map the web address 'www' to a certain site in your Google Sites. The error is 'this address is already being used' and after some …
The task of choosing a web design company to build a website for your business should never be taken in a light manner. Provided the fact that your website will act as a representative to your business and will be responsible for imposing an online …
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

809 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