Class ConnectionDialog

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

public class ConnectionDialog extends JDialog
ConnectionDialog displays a dialog allowing the user to supply the database URL, their user ID and their password. A connection dictionary is returned to the user based on their input.
Author:
tap
See Also:
  • Constructor Details

    • ConnectionDialog

      protected ConnectionDialog(Frame owner, ConnectionDictionary dictionary, String submitLabel)
      Primary Constructor
      Parameters:
      owner - The frame which owns this dialog window.
      dictionary - The initial connection dictionary.
      submitLabel - The label to use for the submit button.
    • ConnectionDialog

      protected ConnectionDialog(Frame owner, ConnectionDictionary dictionary)
      Constructor with a default submit button label of "Connect".
      Parameters:
      owner - The frame which owns this dialog window.
      dictionary - The initial connection dictionary.
    • ConnectionDialog

      protected ConnectionDialog(Frame owner)
      Constructor with the default submit button label and an empty connection dictionary.
      Parameters:
      owner - The frame which owns this dialog window.
    • ConnectionDialog

      protected ConnectionDialog(Dialog owner, ConnectionDictionary dictionary, String submitLabel)
      Primary Constructor
      Parameters:
      owner - The dialog which owns this dialog window.
      dictionary - The initial connection dictionary.
      submitLabel - The label to use for the submit button.
    • ConnectionDialog

      protected ConnectionDialog(Dialog owner, ConnectionDictionary dictionary)
      Constructor with a default submit button label of "Connect".
      Parameters:
      owner - The dialog which owns this dialog window.
      dictionary - The initial connection dictionary.
    • ConnectionDialog

      protected ConnectionDialog(Dialog owner)
      Constructor with the default submit button label and an empty connection dictionary.
      Parameters:
      owner - The dialog which owns this dialog window.
  • Method Details

    • setup

      protected void setup(ConnectionDictionary dictionary)
      Common initialization.
      Parameters:
      dictionary - The initial connection dictionary.
    • loadDictionary

      public void loadDictionary(ConnectionDictionary dictionary)
      Load the specified connection dictionary.
      Parameters:
      dictionary - the connection dictionary to load
    • getConnectionDictionary

      public ConnectionDictionary getConnectionDictionary()
      Get the connection user's dictionary.
      Returns:
      the user's connection dictionary
    • showDialog

      protected ConnectionDictionary showDialog()
      Show the connection dialog
      Returns:
      The connection dictionary based on user input
    • showConnectionDialog

      public Connection showConnectionDialog(DatabaseAdaptor databaseAdaptor)
      Attempt to connect to the database using the supplied database adaptor and the connection dictionary specified by the user via the dialog box.
      Parameters:
      databaseAdaptor - the database adaptor to use for the connection
      Returns:
      the new connection or null if the user canceled the dialog
    • showDialog

      public static ConnectionDictionary showDialog(Frame owner)
      Display the dialog and return the connection dictionary.
      Parameters:
      owner - The window that owns dialog box
      Returns:
      The connection dictionary based on user input
    • showDialog

      public static ConnectionDictionary showDialog(Frame owner, ConnectionDictionary dictionary)
      Display the dialog and return the connection dictionary. Initialize the new connection dictionary with the supplied one except that we ignore the password.
      Parameters:
      owner - The window that owns dialog box
      dictionary - The dictionary from which to initialize the new connection dictionary
      Returns:
      The connection dictionary based on user input
    • showDialog

      public static ConnectionDictionary showDialog(Frame owner, ConnectionDictionary dictionary, String submitLabel)
      Display the dialog and return the connection dictionary. Initialize the new connection dictionary with the supplied one except that we ignore the password.
      Parameters:
      owner - The window that owns dialog box
      dictionary - The dictionary from which to initialize the new connection dictionary
      submitLabel - The label to use for the submit button
      Returns:
      The connection dictionary based on user input
    • showConnectionDialog

      public static Connection showConnectionDialog(Frame owner, DatabaseAdaptor databaseAdaptor, ConnectionDictionary dictionary)
      Display the dialog and return the connection dictionary. Initialize the new connection dictionary with the supplied one except that we ignore the password.
      Parameters:
      owner - The window that owns dialog box
      databaseAdaptor - The database adaptor to use to make the connection
      dictionary - The connection dictionary from which to initialize the new connection dictionary
      Returns:
      The connection dictionary based on user input
    • showConnectionDialog

      public static Connection showConnectionDialog(Frame owner, DatabaseAdaptor databaseAdaptor)
      Display the dialog and return the connection dictionary. Start with an empty connection dictionary.
      Parameters:
      owner - The window that owns dialog box
      databaseAdaptor - The database adaptor to use to make the connection
      Returns:
      The connection dictionary based on user input
    • getInstance

      public static ConnectionDialog getInstance(Frame owner, ConnectionDictionary dictionary)
      Get a new instance of the connection dialog.
      Parameters:
      owner - The window that owns the new connection dialog box
      dictionary - The connection dictionary from which to initialize the new connection dictionary
      Returns:
      A new instance of the connection dialog
    • getInstance

      public static ConnectionDialog getInstance(Dialog owner, ConnectionDictionary dictionary)
      Get a new instance of the connection dialog.
      Parameters:
      owner - The window that owns the new connection dialog box
      dictionary - The connection dictionary from which to initialize the new connection dictionary
      Returns:
      A new instance of the connection dialog
    • makeContent

      protected void makeContent()
      Make the Dialog content