jmri.implementation.swing
Class SwingShutDownTask

java.lang.Object
  extended by jmri.implementation.AbstractShutDownTask
      extended by jmri.implementation.swing.SwingShutDownTask
All Implemented Interfaces:
ShutDownTask

public class SwingShutDownTask
extends AbstractShutDownTask

Provides a base for using Swing to ask if shutdown should conditionally continue.

Sequence:

  1. checkPromptNeeded determines if ready to shutdown. If so, return ready.
  2. Issue a prompt, asking if the user wants to continue or do something else
  3. Recheck until something decided.

    If no "action" name is provided, only the continue and cancel options are shown.

    Author:
    Bob Jacobsen Copyright (C) 2008

    Constructor Summary
    SwingShutDownTask(String name, String warning, String action, Component component)
              Constructor specifies the warning message and action to take
     
    Method Summary
    protected  boolean checkPromptNeeded()
              Provide a subclass-specific check as to whether it's OK to shutdown.
    protected  boolean doPrompt()
              Provide a subclass-specific method to handle the request to fix the problem.
     boolean execute()
              Take the necessary action.
     
    Methods inherited from class jmri.implementation.AbstractShutDownTask
    name
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    SwingShutDownTask

    public SwingShutDownTask(String name,
                             String warning,
                             String action,
                             Component component)
    Constructor specifies the warning message and action to take

    Method Detail

    execute

    public boolean execute()
    Take the necessary action.

    Returns:
    true if the shutdown should continue, false to abort.

    checkPromptNeeded

    protected boolean checkPromptNeeded()
    Provide a subclass-specific check as to whether it's OK to shutdown. If not, issue a prompt before continuing. Default implementation never passes, causing message to be emitted.

    Returns:
    true if ready to shutdown, and no prompt needed. false to present dialog before shutdown proceeds

    doPrompt

    protected boolean doPrompt()
    Provide a subclass-specific method to handle the request to fix the problem. This is a dummy implementation, intended to be overloaded.

    Returns:
    true if ready to shutdown, false to end shutdown


    Copyright © 1997 - 2011 JMRI Community.
    JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

    Additional information on copyright, trademarks and licenses is linked here.
    Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads