?
Solved

Java Applet

Posted on 2011-09-21
1
Medium Priority
?
327 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

When coding a Webservice to provide data, the normal way is to create a method that returns a Dataset object.   But a Dataset cannot be used easily from another platform, such as PHP,  FLAS (FLEX) , etc. Solution : Return a XML Document instea…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

801 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