home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 5.3 KB | 205 lines |
- /*
- * @(#ConnectFailedDialog.java
- *
- * Copyright (c) 1997 Symantec Corporation. All Rights Reserved.
- *
- */
- /**
- * <P> This class is the default connect failed dialog.
- */
-
- package symantec.itools.db.beans.jdbc;
-
- import java.util.*;
- import java.sql.*;
- import java.awt.*;
- import symantec.itools.db.awt.*;
-
- /**
- * This dialog gathers the user's name and password for a database.
- */
-
- import symantec.itools.awt.KeyPressManagerPanel;
- public class ConnectFailedDialog
- extends symantec.itools.awt.util.dialog.ModalDialog
- {
- //{{DECLARE_CONTROLS
- symantec.itools.awt.KeyPressManagerPanel keyPressManagerPanel1;
- java.awt.Button OK;
- java.awt.Button Cancel;
- java.awt.TextField UserNameEdit;
- java.awt.TextField UserPasswordEdit;
- java.awt.Label label3;
- java.awt.Label label4;
- java.awt.Label m_URLLabel;
- java.awt.Label m_URLDisplay;
- //}}
-
- boolean m_ShouldRetry;
-
- /**
- * Constructs a logon dialog. The given connection information
- * is displayed then may be updated by the user.
- * @param frame the parent frame
- * @param title the title for this dialog
- * @param conn the connection info to display/edit with this dialog
- */
- public ConnectFailedDialog()
- {
- super(new Frame(), "");
- hide();
- }
-
- /**
- * Tells this component that it has been added to a container.
- * <p>
- * This is a standard Java AWT method which gets called by the AWT when
- * this component is added to a container. Typically, it is used to
- * create this component's peer.
- * <p>
- * Here, it is overridden to create and initialize this dialog's components.
- *
- * @see java.awt.Container#removeNotify
- */
- public void addNotify()
- {
- // Call parents addNotify method.
- super.addNotify();
-
- //{{INIT_CONTROLS
- setLayout(null);
- setVisible(false);
- setSize(insets().left + insets().right + 360,insets().top + insets().bottom + 152);
- setBackground(new Color(12632256));
- keyPressManagerPanel1 = new symantec.itools.awt.KeyPressManagerPanel();
- keyPressManagerPanel1.setLayout(null);
- keyPressManagerPanel1.setBounds(insets().left + 0,insets().top + 0,360,152);
- add(keyPressManagerPanel1);
- OK = new java.awt.Button();
- OK.setLabel("OK");
- OK.setBounds(68,108,85,25);
- keyPressManagerPanel1.add(OK);
- Cancel = new java.awt.Button();
- Cancel.setLabel("Cancel");
- Cancel.setBounds(164,108,85,25);
- keyPressManagerPanel1.add(Cancel);
- UserNameEdit = new java.awt.TextField(28);
- UserNameEdit.setBounds(164,37,166,23);
- keyPressManagerPanel1.add(UserNameEdit);
- UserPasswordEdit = new java.awt.TextField(28);
- UserPasswordEdit.setEchoChar('*');
- UserPasswordEdit.setBounds(164,65,166,23);
- keyPressManagerPanel1.add(UserPasswordEdit);
- label3 = new java.awt.Label("User Name:");
- label3.setBounds(56,40,90,15);
- keyPressManagerPanel1.add(label3);
- label4 = new java.awt.Label("Password:");
- label4.setBounds(64,68,90,15);
- keyPressManagerPanel1.add(label4);
- m_URLLabel = new java.awt.Label("URL:");
- m_URLLabel.setBounds(16,5,40,15);
- keyPressManagerPanel1.add(m_URLLabel);
- m_URLDisplay = new java.awt.Label("URL value");
- m_URLDisplay.setBounds(55,5,270,15);
- keyPressManagerPanel1.add(m_URLDisplay);
- setTitle("Untitled");
- //}}
-
- // Fill controls with properties sent in
- UserNameEdit.setText(m_UserName);
- UserPasswordEdit.setText(m_Password);
- m_URLDisplay.setText(m_URL);
-
- //{{INIT_MENUS
- //}}
-
-
- Action lAction = new Action();
- OK.addActionListener(lAction);
- Cancel.addActionListener(lAction);
-
- }
-
- //{{DECLARE_MENUS
- //}}
-
- /**
- * Does the standard processing for when the OK button is clicked.
- * It notes the contents of the user and password fields,
- * sets the "ok clicked" flag to true, and hides the dialog.
- */
- public void clickedOK()
- {
- setUserName(UserNameEdit.getText());
- setPassword(UserPasswordEdit.getText());
- m_ShouldRetry = true;
- hide();
- }
-
- /**
- * Does the standard processing for when the Cancel button is clicked.
- * It sets the "ok clicked" flag to false and hides the dialog.
- */
- public void clickedCancel() {
- m_ShouldRetry = false;
- hide();
- }
-
- String m_UserName;
- public void setUserName(String value)
- {
- m_UserName = value;
- }
- public String getUserName()
- {
- return m_UserName;
- }
-
- String m_Password;
- public void setPassword(String value)
- {
- m_Password = value;
- }
- public String getPassword()
- {
- return m_Password;
- }
-
- String m_URL;
- public void setURL(String value)
- {
- m_URL = value;
- }
- public String getURL()
- {
- return m_URL;
- }
-
- String m_Reason;
- public void setReason(String value)
- {
- m_Reason = value;
- }
- public String getReason()
- {
- return m_Reason;
- }
-
- public boolean getShouldRetry()
- {
- return m_ShouldRetry;
- }
-
- class Action implements java.awt.event.ActionListener {
- public void actionPerformed(java.awt.event.ActionEvent event) {
- Object object = event.getSource();
- if (object == OK)
- clickedOK();
- else if (object == Cancel)
- clickedCancel();
- }
- }
-
- }
-
-