|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Window java.awt.Dialog javax.swing.JDialog PIRL.Database.Connect_View
public class Connect_View
Connect_View provides a dialog used to interactively obtain the information needed to make a connection to a Database.
A Connect_View dialog, which may be modal or non-modal, may contain a user supplied decorative icon on the left side of the panel. The right side of the panel contains a list of label fields used to gather the database connection parameters. Buttons across the bottom allow the user to Connect - accept the current connection parameters and close the dialog - Clear - clear all connection parameters - or Cancel - reject all parameters and close the dialog.
A user supplied Configuration provides an initial source of database
connection parameters. If no Configuration is supplied, an attempt
is made to read the default configuration file
. If this fails the user is offered the
opportunity to browse for a configuration file to read. If this is
rejected an empty Configuration is used.
A specific set of Server configuration parameters is assembled from the connection parameter fields of the dialog. There are two categories of fields:
The fields for the required parameters will always be present. They are drawn from the user supplied Configuration:
Server
parameters. This
field is a drop-down list of each valid Server group; the user
is notified when a Server list name does not have a
corresponding group of parameters in the Configuration.
Selecting an entry in the Server list results in the parameters
of the Server group being used to set the values of all other
fields, both required and additional, from each parameter that
has a name matching one of the field names. The first Server
name is used by default.
Note: When a parameter name in a selected Server group matches an additional field name, the parameter value is used to set the field value only when the field is currently empty or its value is not the user specified value.
Note: When the Server field is cleared the required fields are also cleared, but not any additional fields.
Data_Port
for managing the connection to
the database server. A typical database type is MySQL. An entry
in this field is required.
An optional list containing the names of additional connection parameters to be obtained may be specified. Each field name may optionally be paired with an initial value for the field. All duplicate field names, including names that are the same (ignoring case) as any of the required field names, are removed leaving only the first unique name.
Database
object. This
Configuration will be named for the selected Server.
N.B.: If the Server field is empty the Server name will
be "unnamed". The Configuration will contain a Server
parameter with a value that is the
selected Server name and a group with the same name containing a
parameter for each field where the name of each parameter is the
field name and its value is the contents of the field. The
Connect_View dialog will be closed (setVisible (false)).
N.B.: If the Type or Host field is empty a notice dialog will be preseted, the server specific Configuration will not be assembled, and the Connect_View dialog will not close.
Connect_View is a reusable dialog. Once constructed it only needs to be setVisible to be activated. If it had been used previously the previous field values will remain. The current server configuration is renewed after each use unless the Type or Host fields are empty when Connect is pressed.
Database
,
Configuration
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JDialog |
---|
JDialog.AccessibleJDialog |
Nested classes/interfaces inherited from class java.awt.Dialog |
---|
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType |
Nested classes/interfaces inherited from class java.awt.Window |
---|
Window.AccessibleAWTWindow |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static String |
ID
Class name and version identification. |
Fields inherited from class javax.swing.JDialog |
---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Dialog |
---|
DEFAULT_MODALITY_TYPE |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
Connect_View()
Constructs a default Connect_View. |
|
Connect_View(Configuration configuration,
boolean modal)
Constructs a Database Connect_View dialog. |
|
Connect_View(String title,
boolean modal)
Constructs a Database Connect_View dialog. |
|
Connect_View(String title,
Configuration configuration,
boolean modal)
Constructs a Database Connect_View dialog. |
|
Connect_View(String title,
Configuration configuration,
Icon icon,
boolean modal)
Constructs a Database Connect_View dialog. |
|
Connect_View(String title,
Configuration configuration,
Icon icon,
Vector additional_field_names,
boolean modal)
Constructs a Database Connect_View dialog. |
|
Connect_View(String title,
Configuration configuration,
Icon icon,
Vector additional_field_names,
Frame owner,
boolean modal)
Constructs a Database Connect_View dialog. |
Method Summary | |
---|---|
Configuration |
Database_Configuration()
Gets the current database server connection parameters. |
static Configuration |
Get_Database_Configuration(String title,
Configuration configuration,
Icon icon,
Vector additional_field_names,
JFrame parent)
Gets a Database Configuration. |
static void |
main(String[] arguments)
|
Configuration |
Server_Configuration(String server)
Gets the Configuration for a specific Server. |
Methods inherited from class java.awt.Dialog |
---|
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setModalityType, setResizable, setTitle, setUndecorated, setVisible, show, toBack |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ID
Constructor Detail |
---|
public Connect_View(String title, Configuration configuration, Icon icon, Vector additional_field_names, Frame owner, boolean modal)
title
- The title String for the dialog window.configuration
- The Configuration containing default
Database access parameters. If null the default configuration
file
will be used. If this can found or read the user will be
offered the opportunity to browser for a configuration file. If
rejected, an empty Configuration will be supplied.icon
- The Icon to be displayed on the dialog. If null no
Icon is displayed.additional_field_names
- A Vector of String values (or any
Object that can be converted to a String) which are the names of
additional parameters that are to be obtained beyond the
required parameters. Instead of a String entry a Vector
containing a pair of String values (or any Objects that can be
converted to Strings) may be used in which the first value is
the parameter name and the second value is its initial value.
The Vector may be empty or null.owner
- The Frame with which the dialog is associated,
which may be null.modal
- If true, the dialog will be modal; if false, the
dialog will not be modal.public Connect_View(String title, Configuration configuration, Icon icon, Vector additional_field_names, boolean modal)
title
- The title String for the dialog window.configuration
- The Configuration containing default
Database access parameters. If null the default configuration
file
will be used. If this can found or read the user will be
offered the opportunity to browser for a configuration file. If
rejected, an empty Configuration will be supplied.icon
- The Icon to be displayed on the dialog. If null no
Icon is displayed.additional_field_names
- A Vector of String values (or any
Object that can be converted to a String) which are the names of
additional parameters that are to be obtained beyond the
required parameters. Instead of a String entry a Vector
containing a pair of String values (or any Objects that can be
converted to Strings) may be used in which the first value is
the parameter name and the second value is its initial value.
The Vector may be empty or null.modal
- If true, the dialog will be modal; if false, the
dialog will not be modal.public Connect_View(String title, Configuration configuration, Icon icon, boolean modal)
title
- The title String for the dialog window.configuration
- The Configuration containing default
Database access parameters. If null the default configuration
file
will be used. If this can found or read the user will be
offered the opportunity to browser for a configuration file. If
rejected, an empty Configuration will be supplied.icon
- The Icon to be displayed on the dialog. If null no
Icon is displayed.modal
- If true, the dialog will be modal; if false, the
dialog will not be modal.public Connect_View(String title, Configuration configuration, boolean modal)
title
- The title String for the dialog window.configuration
- The Configuration containing default
Database access parameters. If null the default configuration
file
will be used. If this can found or read the user will be
offered the opportunity to browser for a configuration file. If
rejected, an empty Configuration will be supplied.modal
- If true, the dialog will be modal; if false, the
dialog will not be modal.public Connect_View(String title, boolean modal)
title
- The title String for the dialog window.modal
- If true, the dialog will be modal; if false, the
dialog will not be modal.public Connect_View(Configuration configuration, boolean modal)
configuration
- The Configuration containing default
Database access parameters. If null the default configuration
file
will be used. If this can found or read the user will be
offered the opportunity to browser for a configuration file. If
rejected, an empty Configuration will be supplied.modal
- If true, the dialog will be modal; if false, the
dialog will not be modal.public Connect_View()
Method Detail |
---|
public static Configuration Get_Database_Configuration(String title, Configuration configuration, Icon icon, Vector additional_field_names, JFrame parent)
title
- The title String for the dialog window.configuration
- The Configuration containing default
Database access parameters. If null the default configuration
file
will be used. If this can found or read the user will be
offered the opportunity to browser for a configuration file. If
rejected, an empty Configuration will be supplied.icon
- The Icon to be displayed on the dialog. If null no
Icon is displayed.additional_field_names
- A Vector of String values (or any
Object that can be converted to a String) which are the names of
additional parameters that are to be obtained beyond the
required parameters. Instead of a String entry a Vector
containing a pair of String values (or any Objects that can be
converted to Strings) may be used in which the first value is
the parameter name and the second value is its initial value.
The Vector may be empty or null.parent
- The parent window that dialog is associated with,
which may be null.
public Configuration Database_Configuration()
public Configuration Server_Configuration(String server)
server
- The name of the group of parameters in the current
Configuration that is expected to contain database server access
parameters.
public static void main(String[] arguments)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |