[queryviewer-devel] queryviewer/src/net/sourceforge/queryviewer/ui/swing InfoTab.java,1.1,1.2
Status: Alpha
Brought to you by:
avdyk
From: <av...@us...> - 2003-06-22 21:25:44
|
Update of /cvsroot/queryviewer/queryviewer/src/net/sourceforge/queryviewer/ui/swing In directory sc8-pr-cvs1:/tmp/cvs-serv6013/src/net/sourceforge/queryviewer/ui/swing Modified Files: InfoTab.java Log Message: typo dans la javadoc (latin-1), les infos sont maintenant dans un javax.swing.JTextArea Index: InfoTab.java =================================================================== RCS file: /cvsroot/queryviewer/queryviewer/src/net/sourceforge/queryviewer/ui/swing/InfoTab.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InfoTab.java 12 Jun 2003 07:43:35 -0000 1.1 --- InfoTab.java 22 Jun 2003 21:25:42 -0000 1.2 *************** *** 3,77 **** package net.sourceforge.queryviewer.ui.swing; - import java.awt.GridLayout; - import java.sql.Connection; ! import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; /** * * @author arnaud <a href="mailto:arn...@ul...">Arnaud Vandyck</a> * @version $Id$ */ ! public class InfoTab extends JPanel { ! /** ! * @param arg0 ! * @param arg1 ! */ ! public InfoTab(Connection connection) { ! super( new GridLayout(1, 1)); ! super.add(new JScrollPane(new JLabel(getInfo(connection)))); ! } /** ! * @param connection */ ! private String getInfo(Connection connection) { ! StringBuffer text = new StringBuffer(); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! text.append("test du string buffer sur plusieurs lignes\n"); ! return text.toString(); } } --- 3,56 ---- package net.sourceforge.queryviewer.ui.swing; ! import java.awt.GridLayout; ! import java.beans.PropertyChangeEvent; ! import java.beans.PropertyChangeListener; ! import javax.swing.JTextArea; import javax.swing.JPanel; import javax.swing.JScrollPane; + import net.sourceforge.queryviewer.Query; + import net.sourceforge.queryviewer.Connection; + import net.sourceforge.queryviewer.ui.event.ControlerFactory; /** + * Affichage des informations du pilote de la source de données. * * @author arnaud <a href="mailto:arn...@ul...">Arnaud Vandyck</a> * @version $Id$ */ ! public class InfoTab extends JPanel implements PropertyChangeListener { ! protected JTextArea jtInfo; ! protected Query query; /** ! * @param controler la fabrique des actions */ ! public InfoTab(ControlerFactory controler) { ! super( new GridLayout(1, 1) ); ! this.query = controler.getQuery(); ! this.query.addPropertyChangeListener( this ); ! this.jtInfo = new JTextArea( "Pas de connecxion pour l'instant...\n... mais ça ne devrait pas tarder" ); ! this.jtInfo.setEnabled( false ); ! super.add(new JScrollPane( jtInfo )); } + + /** + * Vérifie si la propriété connexion a changé. + */ + public void propertyChange(PropertyChangeEvent evt) { + if ( Query.CONNECTION_PROPERTY.equals( evt.getPropertyName() ) ) { + if ( evt.getNewValue() == null ) { + this.jtInfo.setText( "Il n'y a pas de connexion pour l'instant" ); + } // end of if () + else { + Connection c = (Connection)evt.getNewValue(); + this.jtInfo.setText( c.getInfo() ); + } // end of if () else + + } // end of if () + + } } |