[queryviewer-devel] queryviewer/src/net/sourceforge/queryviewer/ui/swing ConnectionTab.java,1.4,1.5
Status: Alpha
Brought to you by:
avdyk
From: <av...@us...> - 2003-06-19 22:55:58
|
Update of /cvsroot/queryviewer/queryviewer/src/net/sourceforge/queryviewer/ui/swing In directory sc8-pr-cvs1:/tmp/cvs-serv9850/src/net/sourceforge/queryviewer/ui/swing Modified Files: ConnectionTab.java Log Message: les méthodes de création de panneau retournent maintenant un Component. Les champs de connexion sont initialisés au départ (mauvaise idée). Diminution de l'utilisation des javax.swing.Box Index: ConnectionTab.java =================================================================== RCS file: /cvsroot/queryviewer/queryviewer/src/net/sourceforge/queryviewer/ui/swing/ConnectionTab.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ConnectionTab.java 17 Jun 2003 22:48:50 -0000 1.4 --- ConnectionTab.java 19 Jun 2003 22:55:55 -0000 1.5 *************** *** 10,14 **** --- 10,16 ---- import java.awt.event.ActionListener; import java.util.HashMap; + import java.util.Iterator; import java.util.Map; + import java.util.Set; import java.util.Vector; import javax.swing.Action; *************** *** 74,78 **** } ! protected JPanel getNorth( ControlerFactory controler ) { JPanel result = new JPanel( new FlowLayout( FlowLayout.CENTER ) ); result.add( new JLabel( "JDBC Driver") ); --- 76,80 ---- } ! protected Container getNorth( ControlerFactory controler ) { JPanel result = new JPanel( new FlowLayout( FlowLayout.CENTER ) ); result.add( new JLabel( "JDBC Driver") ); *************** *** 80,89 **** } ! protected JPanel getCenter( ControlerFactory controler ) { //TODO here is a cardLayout! return getJDBCPanel( controler ); } ! protected JPanel getJDBCPanel( ControlerFactory controler ) { /* JDBC Driver: ___________________ --- 82,91 ---- } ! protected Container getCenter( ControlerFactory controler ) { //TODO here is a cardLayout! return getJDBCPanel( controler ); } ! protected Container getJDBCPanel( ControlerFactory controler ) { /* JDBC Driver: ___________________ *************** *** 92,118 **** Password : ___________________ */ ! this.userInputs.put( QueryActions.TF_JDBC_DRIVER, new JTextField( 30 ) ); ! this.userInputs.put( QueryActions.TF_JDBC_URL, new JTextField( 50 ) ); ! this.userInputs.put( QueryActions.TF_JDBC_USERNAME, new JTextField( 20 ) ); ! this.userInputs.put( QueryActions.TF_JDBC_PASSWORD, new JTextField( 20 ) ); JPanel result = new JPanel( new GridLayout( 1, 1 ) ); ! Box b = new Box( BoxLayout.Y_AXIS ); ! Container bDriver = new Box( BoxLayout.X_AXIS ); JLabel lDriver = new JLabel( "Pilote JDBC: " ); bDriver.add( lDriver ); ! bDriver.add( (JTextField)this.userInputs.get( QueryActions.TF_JDBC_DRIVER ) ); b.add( bDriver ); ! Container bURL = new Box( BoxLayout.X_AXIS ); JLabel lURL = new JLabel( "URL de la base de donnees: " ); bURL.add( lURL ); bURL.add( (JTextField)this.userInputs.get( QueryActions.TF_JDBC_URL ) ); b.add( bURL ); ! Container bUsername = new Box( BoxLayout.X_AXIS ); JLabel lUsername = new JLabel( "Utilisateur: " ); bUsername.add( lUsername ); bUsername.add( (JTextField)this.userInputs.get( QueryActions.TF_JDBC_USERNAME ) ); b.add( bUsername ); ! Container bPassword = new Box( BoxLayout.X_AXIS ); JLabel lPassword = new JLabel( "Mot de passe: " ); bPassword.add( lPassword ); --- 94,130 ---- Password : ___________________ */ ! /* ! this.userInputs.put( QueryActions.TF_JDBC_DRIVER, new JTextField( 30 ) ); ! this.userInputs.put( QueryActions.TF_JDBC_URL, new JTextField( 40 ) ); ! this.userInputs.put( QueryActions.TF_JDBC_USERNAME, new JTextField( 20 ) ); ! this.userInputs.put( QueryActions.TF_JDBC_PASSWORD, new JTextField( 20 ) ); ! */ ! this.userInputs.put( QueryActions.TF_JDBC_DRIVER, new JTextField( "org.postgresql.Driver" ) ); ! this.userInputs.put( QueryActions.TF_JDBC_URL, new JTextField( "jdbc:postgresql://vbstefi60.fapse.ulg.ac.be:5432/lcp" ) ); ! this.userInputs.put( QueryActions.TF_JDBC_USERNAME, new JTextField( "lcp" ) ); ! this.userInputs.put( QueryActions.TF_JDBC_PASSWORD, new JTextField( "lcpass" ) ); JPanel result = new JPanel( new GridLayout( 1, 1 ) ); ! Container b = new Box( BoxLayout.Y_AXIS ); ! //Container bDriver = new Box( BoxLayout.X_AXIS ); ! Container bDriver = new JPanel(); JLabel lDriver = new JLabel( "Pilote JDBC: " ); bDriver.add( lDriver ); ! bDriver.add( new JPanel().add( (JTextField)this.userInputs.get( QueryActions.TF_JDBC_DRIVER ) ) ); b.add( bDriver ); ! //Container bURL = new Box( BoxLayout.X_AXIS ); ! Container bURL = new JPanel(); JLabel lURL = new JLabel( "URL de la base de donnees: " ); bURL.add( lURL ); bURL.add( (JTextField)this.userInputs.get( QueryActions.TF_JDBC_URL ) ); b.add( bURL ); ! //Container bUsername = new Box( BoxLayout.X_AXIS ); ! Container bUsername = new JPanel(); JLabel lUsername = new JLabel( "Utilisateur: " ); bUsername.add( lUsername ); bUsername.add( (JTextField)this.userInputs.get( QueryActions.TF_JDBC_USERNAME ) ); b.add( bUsername ); ! //Container bPassword = new Box( BoxLayout.X_AXIS ); ! Container bPassword = new JPanel(); JLabel lPassword = new JLabel( "Mot de passe: " ); bPassword.add( lPassword ); *************** *** 131,147 **** /** ! * Get the UserInputs value. * @return the UserInputs value. */ public Map getUserInputs() { ! return userInputs; } /** ! * Set the UserInputs value. * @param newUserInputs The new UserInputs value. */ public void setUserInputs(Map newUserInputs) { ! this.userInputs = newUserInputs; } --- 143,180 ---- /** ! * Retourne le texte ({@link String}) qu'il y a dans les composants de texte. ! * @see QueryActions * @return the UserInputs value. */ public Map getUserInputs() { ! Map m = new HashMap(); ! Set keys = this.userInputs.keySet(); ! Iterator iterator = keys.iterator(); ! while (iterator.hasNext()) { ! String k = (String)iterator.next(); ! String value = ( (JTextField)this.userInputs.get( k ) ).getText(); ! m.put( k, value ); ! } // end of while () ! ! return m; } /** ! * Mise à jour des valeurs dans les composants de texte. ! * @see QueryActions * @param newUserInputs The new UserInputs value. */ public void setUserInputs(Map newUserInputs) { ! Set keys = newUserInputs.keySet(); ! Iterator iter = keys.iterator(); ! while (iter.hasNext()) { ! String k = (String)iter.next(); ! Object o = this.userInputs.get( k ); ! if (o!=null) { ! ( (JTextField)o ).setText( (String)newUserInputs.get( k ) ); ! } // end of if () ! ! } // end of while () ! } |