Class ProxySetupFrame

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class ProxySetupFrame extends JFrame
Create a dialog window for displaying and modifying the current proxy server configuration as found in a backing store.

This is basically an interface to changes the values of the system properties:

  • http.proxySet A boolean (true or false) indicating whether to use the proxy.
  • http.proxyHost The proxy server name.
  • http.proxyPort The proxy server port.
  • http.nonProxyHosts A list of names that do not require the proxy server (e.g. *.dur.ac.uk|localhost)
A typical invocation would follow the sequence:
     ProxySetupFrame.restore( null );
     ...
     ProxySetupFrame frame = new ProxySetupFrame();
 
Which would restore the backing store configuration first and then create a dialog to change or view it. Typically the restoration would occur in an network aware applications startup code (i.e. well before the creation of the frame itself).
Version:
$Id$
Author:
Peter W. Draper
See Also:
  • Field Details

    • fileMenu

      protected JMenu fileMenu
    • closeFileMenu

      protected JMenuItem closeFileMenu
    • needProxy

      protected JCheckBox needProxy
      Other UI elements
    • hostName

      protected JTextField hostName
    • portNumber

      protected JTextField portNumber
    • nonHostNames

      protected JTextField nonHostNames
    • acceptButton

      protected JButton acceptButton
    • cancelButton

      protected JButton cancelButton
  • Constructor Details

    • ProxySetupFrame

      public ProxySetupFrame()
      Create an instance.
  • Method Details

    • initUI

      protected void initUI()
      Initialise the main part of the user interface.
    • initFrame

      protected void initFrame()
      Initialise frame properties (disposal, menus etc.).
    • initMenus

      protected void initMenus()
      Initialise the menu bar and related actions.
    • matchToProperties

      protected void matchToProperties()
      Match interface to the current state of the system properties.
    • matchToInterface

      protected void matchToInterface()
      Match the system properties to the state of interface.
    • checkEntryStates

      protected void checkEntryStates()
      Check the entry states for the proxy hostname and port. These are enabled when a proxy is required and disabled when not.
    • closeWindowEvent

      protected void closeWindowEvent(boolean accept)
      Close the window by withdrawing it.
      Parameters:
      accept - if true then the system global properties are matched to those of the interface. Otherwise the interface is modified to match the system properties (thus "accepting" or "cancelling" modifications to the proxy).
    • restore

      public static void restore(ProxySetupFrame target)
      Restore from backing store, updating the system properties.
      Parameters:
      target - if not null, then this should be a ProxySetupFrame that will be initialise to match the state of the backing store contents.
    • store

      public static void store(ProxySetupFrame target)
      Save state of system properties to backing store.
      Parameters:
      target - if not null, then this should be a ProxySetupFrame that has a setup that should be used in preference to the system properties. Note that after this method the system properties will be modified to reflect the stored state.