Mercurial > hg > ltpda-connection-manager
diff ConnectionManager/src/connectionmanager/DatabaseSelectorDialog.java @ 6:670905eb688a
Fix code indentation.
author | Daniele Nicolodi <daniele@science.unitn.it> |
---|---|
date | Wed, 02 Jun 2010 18:02:25 +0200 |
parents | 35f1cfcaa5a9 |
children | ea3ae6ce9fea |
line wrap: on
line diff
--- a/ConnectionManager/src/connectionmanager/DatabaseSelectorDialog.java Wed Jun 02 17:29:18 2010 +0200 +++ b/ConnectionManager/src/connectionmanager/DatabaseSelectorDialog.java Wed Jun 02 18:02:25 2010 +0200 @@ -7,42 +7,41 @@ public class DatabaseSelectorDialog extends javax.swing.JDialog { - private boolean cancelled = true; - - public String hostname; - public String database; - public String username; + public boolean cancelled = true; + public String hostname; + public String database; + public String username; - public DatabaseSelectorDialog(java.awt.Frame parent) { - super(parent, true); - initComponents(); - databasesTable.addMouseListener(new MouseListenerDoubleClick()); - } + public DatabaseSelectorDialog(java.awt.Frame parent) { + super(parent, true); + initComponents(); + databasesTable.addMouseListener(new MouseListenerDoubleClick()); + } - public DatabaseSelectorDialog() { + public DatabaseSelectorDialog() { super(new javax.swing.JFrame(), true); initComponents(); databasesTable.addMouseListener(new MouseListenerDoubleClick()); } - private class MouseListenerDoubleClick extends MouseAdapter { + private class MouseListenerDoubleClick extends MouseAdapter { - @Override - public void mouseClicked(MouseEvent e) { - if (e.getClickCount() >= 2) { - cancelled = false; - Point p = e.getPoint(); - int row = databasesTable.rowAtPoint(p); - DefaultTableModel model = (DefaultTableModel)databasesTable.getModel(); - hostname = (String)model.getValueAt(row, 0); - database = (String)model.getValueAt(row, 1); - username = (String)model.getValueAt(row, 2); - doClose(); - } + @Override + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() >= 2) { + cancelled = false; + Point p = e.getPoint(); + int row = databasesTable.rowAtPoint(p); + DefaultTableModel model = (DefaultTableModel) databasesTable.getModel(); + hostname = (String) model.getValueAt(row, 0); + database = (String) model.getValueAt(row, 1); + username = (String) model.getValueAt(row, 2); + doClose(); + } + } } - } - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { @@ -135,43 +134,43 @@ pack(); }// </editor-fold>//GEN-END:initComponents - private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed - cancelled = true; - doClose(); - }//GEN-LAST:event_cancelButtonActionPerformed + private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed + cancelled = true; + doClose(); + }//GEN-LAST:event_cancelButtonActionPerformed - private void selectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectButtonActionPerformed - cancelled = false; - int row = databasesTable.getSelectedRow(); - DefaultTableModel model = (DefaultTableModel)databasesTable.getModel(); - hostname = (String)model.getValueAt(row, 0); - database = (String)model.getValueAt(row, 1); - username = (String)model.getValueAt(row, 2); - doClose(); - }//GEN-LAST:event_selectButtonActionPerformed + private void selectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectButtonActionPerformed + cancelled = false; + int row = databasesTable.getSelectedRow(); + DefaultTableModel model = (DefaultTableModel) databasesTable.getModel(); + hostname = (String) model.getValueAt(row, 0); + database = (String) model.getValueAt(row, 1); + username = (String) model.getValueAt(row, 2); + doClose(); + }//GEN-LAST:event_selectButtonActionPerformed - private void newButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newButtonActionPerformed - DatabaseDialog dialog = new DatabaseDialog(); - dialog.setVisible(true); - if (!dialog.cancelled) { - cancelled = false; - hostname = dialog.hostname; - database = dialog.database; - username = new String(""); - doClose(); - } - }//GEN-LAST:event_newButtonActionPerformed + private void newButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newButtonActionPerformed + DatabaseDialog dialog = new DatabaseDialog(); + dialog.setVisible(true); + if (!dialog.cancelled) { + cancelled = false; + hostname = dialog.hostname; + database = dialog.database; + username = new String(""); + doClose(); + } + }//GEN-LAST:event_newButtonActionPerformed - private void doClose() { + private void doClose() { setVisible(false); dispose(); - } + } - public void add(String hostname, String database, String username) { - DefaultTableModel model = (DefaultTableModel)databasesTable.getModel(); - model.insertRow(model.getRowCount(), new Object[] { hostname, database, username }); - } - + public void add(String hostname, String database, String username) { + DefaultTableModel model = (DefaultTableModel) databasesTable.getModel(); + model.insertRow(model.getRowCount(), new Object[]{hostname, database, username}); + } + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton cancelButton; private javax.swing.JTable databasesTable;