Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

SetSubjectDialog.java

00001 /**
00002  * C-JDBC: Clustered JDBC.
00003  * Copyright (C) 2002-2004 French National Institute For Research In Computer
00004  * Science And Control (INRIA).
00005  * Contact: c-jdbc@objectweb.org
00006  * 
00007  * This library is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU Lesser General Public License as published by the
00009  * Free Software Foundation; either version 2.1 of the License, or any later
00010  * version.
00011  * 
00012  * This library is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00015  * for more details.
00016  * 
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00020  *
00021  * Initial developer(s): Nicolas Modrzyk.
00022  * Contributor(s): ______________________.
00023  */
00024 
00025 package org.objectweb.cjdbc.console.gui.frames.jmxdesktop;
00026 
00027 import java.awt.BorderLayout;
00028 import java.awt.GridLayout;
00029 import java.awt.event.ActionEvent;
00030 import java.awt.event.ActionListener;
00031 
00032 import javax.swing.JButton;
00033 import javax.swing.JDialog;
00034 import javax.swing.JLabel;
00035 import javax.swing.JTextField;
00036 
00037 import org.objectweb.cjdbc.common.i18n.GuiTranslate;
00038 import org.objectweb.cjdbc.console.gui.CjdbcGui;
00039 import org.objectweb.cjdbc.console.gui.constants.GuiCommands;
00040 import org.objectweb.cjdbc.console.gui.constants.GuiConstants;
00041 
00042 /**
00043  * This class defines a SetSubjectDialog
00044  * 
00045  * @author <a href="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
00046  * @version 1.0
00047  */
00048 public class SetSubjectDialog extends JDialog implements ActionListener
00049 {
00050 
00051   private JTextField user;
00052   private JTextField password;
00053   private CjdbcGui   gui;
00054 
00055   /**
00056    * Creates a new <code>SetSubjectDialog</code> object
00057    * 
00058    * @throws java.awt.HeadlessException
00059    */
00060   public SetSubjectDialog(CjdbcGui gui)
00061   {
00062     super(gui, "Set Subject", true);
00063     GuiConstants.centerComponent(this, 300, 100);
00064 
00065     this.getContentPane().setLayout(new BorderLayout());
00066     this.getContentPane().setLayout(new GridLayout(3, 2));
00067 
00068     user = new JTextField("");
00069     JLabel userLabel = new JLabel("User");
00070     this.getContentPane().add(userLabel);
00071     this.getContentPane().add(user);
00072 
00073     password = new JTextField("");
00074     JLabel passwordLabel = new JLabel("Password");
00075     this.getContentPane().add(passwordLabel);
00076     this.getContentPane().add(password);
00077 
00078     JButton ok = new JButton(GuiTranslate
00079         .get("frame.ok"));
00080     ok.setActionCommand(GuiCommands.COMMAND_CONFIRM_ACTION);
00081     ok.addActionListener(this);
00082     this.getContentPane().add(ok);
00083 
00084     JButton cancel = new JButton(GuiTranslate
00085         .get("frame.cancel"));
00086     cancel.setActionCommand(GuiCommands.COMMAND_CANCEL_ACTION);
00087     cancel.addActionListener(this);
00088     this.getContentPane().add(cancel);
00089 
00090     this.validate();
00091     this.gui = gui;
00092     this.setVisible(true);
00093 
00094   }
00095 
00096   /**
00097    * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
00098    */
00099   public void actionPerformed(ActionEvent e)
00100   {
00101     if (e.getActionCommand().equalsIgnoreCase(
00102         GuiCommands.COMMAND_CONFIRM_ACTION))
00103     {
00104       gui.getCurrentJmxClient().setCurrentSubject(user.getText(),
00105           password.getText());
00106       this.setVisible(false);
00107     }
00108     else if (e.getActionCommand().equalsIgnoreCase(
00109         GuiCommands.COMMAND_CANCEL_ACTION))
00110     {
00111       this.setVisible(false);
00112     }
00113   }
00114 }

Generated on Mon Apr 11 22:01:34 2005 for C-JDBC by  doxygen 1.3.9.1