home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VCafe / prosrc.bin / LogonFrame.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  1.7 KB  |  69 lines

  1. /*
  2.  * @(#LogonFrame.java
  3.  *
  4.  * Copyright (c) 1997 Symantec Corporation. All Rights Reserved.
  5.  *
  6.  */
  7.  
  8.  
  9. package symantec.itools.db.awt;
  10.  
  11. import java.awt.Button;
  12. import java.awt.Label;
  13. import java.awt.Font;
  14. import java.awt.Event;
  15. import java.util.*;
  16. import java.sql.*;
  17. import java.lang.*;
  18. import java.awt.*;
  19. import symantec.itools.db.net.*;
  20. import symantec.itools.db.pro.*;
  21.  
  22. /**
  23.  * This window gathers the user's name and password for a database.
  24.  * <p>
  25.  * It implements the Logon interface to provide a common logon dialog
  26.  * as needed.
  27.  *
  28.  * @see symantec.itools.db.pro.Logon
  29.  */
  30. public class LogonFrame extends java.awt.Frame implements Logon
  31. {
  32.     //{{DECLARE_CONTROLS
  33.     LogonDialog dialog;
  34.     //}}
  35.  
  36.     /**
  37.      * Constructs a LogonFrame. It is hidden by default.
  38.      */
  39.     public LogonFrame()
  40.     {
  41.         hide();
  42.     }
  43.  
  44.     /**
  45.      * Allows the user to try to logon to the database.
  46.      * <p>
  47.      * If this object was registered with the a Session object's LogonHandler, this method will
  48.      * be called when a logon failure has occurred.
  49.      * It creates and displays a LogonDialog for the user.
  50.      *
  51.      * @param conn the current connection info used for logon attempts
  52.      * @param retries the number of logon attempts
  53.      *
  54.      * @return true if should attempt to logon again, false otherwise
  55.      * @see symantec.itools.db.awt.LogonDialog
  56.      */
  57.     public boolean logonFailed(ConnectionInfo conn, int retries)
  58.     {
  59.         dialog = new LogonDialog(this, "User Authentication", conn);
  60.  
  61.         // Allow user input
  62.         dialog.show();
  63.  
  64.         conn = dialog.m_ConnectionInfo;
  65.  
  66.         // Pass the input back to the caller
  67.         return dialog.m_Action;
  68.     }
  69. }