Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Java Applet

Posted on 2011-09-21
1
Medium Priority
?
332 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

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

Featured Post

Threat Trends for MSPs to Watch

See the findings.
Despite its humble beginnings, phishing has come a long way since those first crudely constructed emails. Today, phishing sites can appear and disappear in the length of a coffee break, and it takes more than a little know-how to keep your clients secure.

Question has a verified solution.

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

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 …
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

618 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