diff --git a/src/Wizard/Bundle.properties b/src/Wizard/Bundle.properties new file mode 100644 index 0000000..87a16f9 --- /dev/null +++ b/src/Wizard/Bundle.properties @@ -0,0 +1,42 @@ +OpenIDE-Module-Name=Wizard +FreimapVisualPanel1.jLabel1.text=Information About Freimap and this Wizard - SKIP BUTTON? +FreimapVisualPanel2.logLabel.text=\ +FreimapVisualPanel2.jLabel5.text=Host: +FreimapVisualPanel2.jLabel2.text=Password: +FreimapVisualPanel2.jLabel6.text=: +FreimapVisualPanel2.jLabel1.text=UserName: +FreimapVisualPanel2.loadDb.text=Load Avaible Databse +FreimapVisualPanel2.jButton1.text=Example +FreimapVisualPanel2.jLabel7.text=Avaible Database: +FreimapVisualPanel2.portText.text=3306 +FreimapVisualPanel2.jLabel4.text=For security reason you cannot store User/Pass +FreimapVisualPanel2.connectButton.text=Connect +FreimapVisualPanel2.jLabel3.text=Insert MySQL Requirements to store data +FreimapVisualPanel3.jLabel1.text=Name Service Plugin: +FreimapVisualPanel3.jLabel2.text=Olsr Config File: +FreimapVisualPanel3.jLabel3.text=DotDraw Plugin Port: +FreimapVisualPanel4.jLabel1.text=UserName: +FreimapVisualPanel4.jLabel2.text=MySQL Database: +FreimapVisualPanel4.jLabel3.text=Password: +FreimapVisualPanel4.jLabel4.text=OLSRd Config file path: +FreimapVisualPanel4.jLabel5.text=Nameservice LatLon.js file path: +FreimapVisualPanel4.jLabel6.text=DotDraw Plugin port: +FreimapVisualPanel3.jButton1.text=Browse +FreimapVisualPanel3.jButton2.text=Read Config File +FreimapVisualPanel3.olsrdPath.text= +FreimapVisualPanel3.nameServicePath.text= +FreimapVisualPanel3.dotDrawPort.text= +FreimapVisualPanel2.jLabel5.text=Database: +FreimapVisualPanel4.mySQLLabel.text=\ +FreimapVisualPanel4.UserNameLabel.text=jLabel7 +FreimapVisualPanel4.passwordLabel.text=\ +FreimapVisualPanel4.olsrdLabel.text=jLabel7 +FreimapVisualPanel4.NameServiceLabel.text=\ +FreimapVisualPanel4.dotDrawPortLabel.text=jLabel7 +FreimapVisualPanel4.UserNameLabel.text=\ +FreimapVisualPanel4.olsrdLabel.text=\ +FreimapVisualPanel4.dotDrawPortLabel.text=\ +FreimapVisualPanel4.jLabel7.text=jLabel7 +FreimapVisualPanel4.jLabel7.text=You have put this information: +FreimapVisualPanel4.jLabel8.text=HostName/port: +FreimapVisualPanel4.hostNameLabel.text=\ diff --git a/src/Wizard/FreimapVisualPanel1.form b/src/Wizard/FreimapVisualPanel1.form new file mode 100644 index 0000000..4846818 --- /dev/null +++ b/src/Wizard/FreimapVisualPanel1.form @@ -0,0 +1,45 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/Wizard/FreimapVisualPanel1.java b/src/Wizard/FreimapVisualPanel1.java new file mode 100644 index 0000000..6380d47 --- /dev/null +++ b/src/Wizard/FreimapVisualPanel1.java @@ -0,0 +1,54 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package Wizard; + +import javax.swing.JPanel; + +public final class FreimapVisualPanel1 extends JPanel { + + /** Creates new form FreimapVisualPanel1 */ + public FreimapVisualPanel1() { + initComponents(); + } + + @Override + public String getName() { + return "Step #1"; + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FreimapVisualPanel1.class, "FreimapVisualPanel1.jLabel1.text")); // NOI18N + + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .addContainerGap() + .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .addContainerGap() + .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE) + .addContainerGap()) + ); + }// //GEN-END:initComponents + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabel1; + // End of variables declaration//GEN-END:variables +} + diff --git a/src/Wizard/FreimapVisualPanel2.form b/src/Wizard/FreimapVisualPanel2.form new file mode 100644 index 0000000..72289c1 --- /dev/null +++ b/src/Wizard/FreimapVisualPanel2.form @@ -0,0 +1,266 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Wizard/FreimapVisualPanel2.java b/src/Wizard/FreimapVisualPanel2.java new file mode 100644 index 0000000..0d3df10 --- /dev/null +++ b/src/Wizard/FreimapVisualPanel2.java @@ -0,0 +1,318 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package Wizard; + +import java.awt.Color; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JPanel; + +public final class FreimapVisualPanel2 extends JPanel { + + /** Creates new form FreimapVisualPanel2 */ + public FreimapVisualPanel2() { + initComponents(); + } + + @Override + public String getName() { + return "MySQL Information"; + } + + public String getHost() { + return hostText.getText(); + } + + public String getPort() { + return portText.getText(); + } + + public String getDatabase() { + return dbText.getSelectedItem().toString(); + } + + public String getUserName() { + return userText.getText(); + } + + public String getPassword() { + return passwordText.getText(); + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + connectButton = new javax.swing.JButton(); + userText = new javax.swing.JTextField(); + jLabel4 = new javax.swing.JLabel(); + portText = new javax.swing.JTextField(); + dbText = new javax.swing.JComboBox(); + jLabel7 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + loadDb = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + hostText = new javax.swing.JTextField(); + logLabel = new javax.swing.JLabel(); + passwordText = new javax.swing.JPasswordField(); + jLabel3 = new javax.swing.JLabel(); + + org.openide.awt.Mnemonics.setLocalizedText(connectButton, org.openide.util.NbBundle.getMessage(FreimapVisualPanel2.class, "FreimapVisualPanel2.connectButton.text")); // NOI18N + connectButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + connectButtonActionPerformed(evt); + } + }); + + userText.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + + jLabel4.setFont(new java.awt.Font("Lucida Grande", 0, 8)); + org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(FreimapVisualPanel2.class, "FreimapVisualPanel2.jLabel4.text")); // NOI18N + + portText.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + portText.setText(org.openide.util.NbBundle.getMessage(FreimapVisualPanel2.class, "FreimapVisualPanel2.portText.text")); // NOI18N + + dbText.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + + jLabel7.setFont(new java.awt.Font("Lucida Grande", 0, 10)); + org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(FreimapVisualPanel2.class, "FreimapVisualPanel2.jLabel7.text")); // NOI18N + + jButton1.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(FreimapVisualPanel2.class, "FreimapVisualPanel2.jButton1.text")); // NOI18N + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(loadDb, org.openide.util.NbBundle.getMessage(FreimapVisualPanel2.class, "FreimapVisualPanel2.loadDb.text")); // NOI18N + loadDb.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + loadDbActionPerformed(evt); + } + }); + + jLabel1.setFont(new java.awt.Font("Lucida Grande", 0, 10)); + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FreimapVisualPanel2.class, "FreimapVisualPanel2.jLabel1.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(FreimapVisualPanel2.class, "FreimapVisualPanel2.jLabel6.text")); // NOI18N + + jLabel2.setFont(new java.awt.Font("Lucida Grande", 0, 10)); + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(FreimapVisualPanel2.class, "FreimapVisualPanel2.jLabel2.text")); // NOI18N + + jLabel5.setFont(new java.awt.Font("Lucida Grande", 0, 10)); + org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FreimapVisualPanel2.class, "FreimapVisualPanel2.jLabel5.text")); // NOI18N + + hostText.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + + logLabel.setFont(new java.awt.Font("Lucida Grande", 0, 10)); + org.openide.awt.Mnemonics.setLocalizedText(logLabel, org.openide.util.NbBundle.getMessage(FreimapVisualPanel2.class, "FreimapVisualPanel2.logLabel.text")); // NOI18N + + passwordText.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + + org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(FreimapVisualPanel2.class, "FreimapVisualPanel2.jLabel3.text")); // NOI18N + + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .add(56, 56, 56) + .add(jLabel3)) + .add(layout.createSequentialGroup() + .add(22, 22, 22) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(logLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 311, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(layout.createSequentialGroup() + .add(jLabel7) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(dbText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 197, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(layout.createSequentialGroup() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) + .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 189, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(layout.createSequentialGroup() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) + .add(jLabel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .add(jLabel1)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) + .add(hostText) + .add(org.jdesktop.layout.GroupLayout.LEADING, userText) + .add(org.jdesktop.layout.GroupLayout.LEADING, passwordText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 170, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(jLabel6))) + .add(jLabel2)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 117, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(portText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 53, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))) + .add(layout.createSequentialGroup() + .addContainerGap() + .add(loadDb, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 166, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) + .add(connectButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 106, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .add(9, 9, 9) + .add(jLabel3) + .add(18, 18, 18) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(hostText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel5) + .add(jLabel6) + .add(portText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel1) + .add(userText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel2) + .add(passwordText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jButton1)) + .add(2, 2, 2) + .add(jLabel4) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel7) + .add(dbText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) + .add(logLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(18, 18, 18) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(loadDb, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(connectButton)) + .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + }// //GEN-END:initComponents + + public void findDatabase(String host, String port, String username, String password, String database) throws SQLException, InterruptedException { + try { + logLabel.setText("Getting connection..."); + Thread.sleep(1000); + Class.forName("com.mysql.jdbc.Driver"); + c = (Connection) DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, username, password); + if (!c.isClosed()) { + logLabel.setForeground(Color.green); + logLabel.setText("Connected!"); + Thread.sleep(3000); + } + } catch (Exception ex) { + logLabel.setForeground(Color.red); + logLabel.setText(ex.getMessage()); + System.out.println(ex.getMessage()); + System.out.println(ex.getCause()); + } + } + + private void connectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectButtonActionPerformed + host = hostText.getText(); + port = portText.getText(); + username = userText.getText(); + password = passwordText.getText(); + if (dbText.getSelectedItem().equals(null)) { + logLabel.setForeground(Color.red); + logLabel.setText("Select a valid Database!"); + } else { + database = dbText.getSelectedItem().toString(); + } + if (host.length() < 2) { + if (port.length() == 0) { + port = "3306"; + } + logLabel.setForeground(Color.red); + logLabel.setText("Add host address and port number!"); + } else { + try { + findDatabase(host, port, username, password, database); + } catch (Exception e) { + e.printStackTrace(); + } + } + }//GEN-LAST:event_connectButtonActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + + userText.setText("root"); + passwordText.setText("CiscoSte5785"); + hostText.setText("127.0.0.1"); +}//GEN-LAST:event_jButton1ActionPerformed + + private void loadDbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadDbActionPerformed + try { + host = hostText.getText(); + port = portText.getText(); + username = userText.getText(); + password = passwordText.getText(); + if (host.length() < 2) { + if (port.length() == 0) { + port = "3306"; + } + logLabel.setForeground(Color.red); + logLabel.setText("Add host address and port number!"); + } else { + Class.forName("com.mysql.jdbc.Driver"); + c = (Connection) DriverManager.getConnection("jdbc:mysql://" + host + ":" + port, username, password); + if (!c.isClosed()) { + stmt = (Statement) c.createStatement(); + rss = stmt.executeQuery("SHOW DATABASES"); + int i = 0; + while (rss.next()) { + dbText.insertItemAt(rss.getString("Database"), i); + i++; + dbText.setSelectedIndex(0); + } + } + } + } catch (Exception ex) { + System.out.println(ex.getMessage()); + logLabel.setForeground(Color.red); + logLabel.setText(ex.getMessage()); + } + // TODO add your handling code here: +}//GEN-LAST:event_loadDbActionPerformed + private String host,port,username,password,database; + private Statement stmt; + private ResultSet rss; + private Connection c; + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton connectButton; + private javax.swing.JComboBox dbText; + private javax.swing.JTextField hostText; + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JButton loadDb; + private javax.swing.JLabel logLabel; + private javax.swing.JPasswordField passwordText; + private javax.swing.JTextField portText; + private javax.swing.JTextField userText; + // End of variables declaration//GEN-END:variables +} + diff --git a/src/Wizard/FreimapVisualPanel3.form b/src/Wizard/FreimapVisualPanel3.form new file mode 100644 index 0000000..8bc0008 --- /dev/null +++ b/src/Wizard/FreimapVisualPanel3.form @@ -0,0 +1,163 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Wizard/FreimapVisualPanel3.java b/src/Wizard/FreimapVisualPanel3.java new file mode 100644 index 0000000..a1619b2 --- /dev/null +++ b/src/Wizard/FreimapVisualPanel3.java @@ -0,0 +1,163 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package Wizard; + +import java.io.File; +import javax.swing.JFileChooser; +import javax.swing.JPanel; + +public final class FreimapVisualPanel3 extends JPanel { + + /** Creates new form FreimapVisualPanel3 */ + public FreimapVisualPanel3() { + initComponents(); + } + + @Override + public String getName() { + return "OLSRd Configuration"; + } + + public String getOlsrPath() { + return olsrdPath.getText(); + } + + public String getNameServicePath() { + return nameServicePath.getText(); + } + public String getDotDrawPort() { + return dotDrawPort.getText(); + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + olsrdPath = new javax.swing.JTextField(); + nameServicePath = new javax.swing.JTextField(); + dotDrawPort = new javax.swing.JTextField(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + + jLabel1.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FreimapVisualPanel3.class, "FreimapVisualPanel3.jLabel1.text")); // NOI18N + + jLabel2.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(FreimapVisualPanel3.class, "FreimapVisualPanel3.jLabel2.text")); // NOI18N + + jLabel3.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(FreimapVisualPanel3.class, "FreimapVisualPanel3.jLabel3.text")); // NOI18N + + olsrdPath.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + olsrdPath.setText(org.openide.util.NbBundle.getMessage(FreimapVisualPanel3.class, "FreimapVisualPanel3.olsrdPath.text")); // NOI18N + + nameServicePath.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + nameServicePath.setText(org.openide.util.NbBundle.getMessage(FreimapVisualPanel3.class, "FreimapVisualPanel3.nameServicePath.text")); // NOI18N + nameServicePath.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + nameServicePathActionPerformed(evt); + } + }); + + dotDrawPort.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + dotDrawPort.setText(org.openide.util.NbBundle.getMessage(FreimapVisualPanel3.class, "FreimapVisualPanel3.dotDrawPort.text")); // NOI18N + + jButton1.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(FreimapVisualPanel3.class, "FreimapVisualPanel3.jButton1.text")); // NOI18N + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jButton2.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + org.openide.awt.Mnemonics.setLocalizedText(jButton2, org.openide.util.NbBundle.getMessage(FreimapVisualPanel3.class, "FreimapVisualPanel3.jButton2.text")); // NOI18N + + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .add(29, 29, 29) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) + .add(layout.createSequentialGroup() + .add(jLabel3) + .add(18, 18, 18) + .add(dotDrawPort, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 126, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(layout.createSequentialGroup() + .add(jLabel1) + .add(18, 18, 18) + .add(nameServicePath, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 126, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(layout.createSequentialGroup() + .add(jLabel2) + .add(19, 19, 19) + .add(olsrdPath, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 126, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(jButton1) + .addContainerGap(49, Short.MAX_VALUE)) + .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() + .addContainerGap(288, Short.MAX_VALUE) + .add(jButton2) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .add(50, 50, 50) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jButton1) + .add(jLabel2) + .add(olsrdPath, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(jButton2) + .add(20, 20, 20) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(nameServicePath, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel1)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(dotDrawPort, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel3)) + .addContainerGap(109, Short.MAX_VALUE)) + ); + }// //GEN-END:initComponents + + private void nameServicePathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nameServicePathActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_nameServicePathActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + JFileChooser fc = new JFileChooser(); + + fc.setAcceptAllFileFilterUsed(false); + int returnVal = fc.showOpenDialog(fc); + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + olsrdPath.setText(file.getPath()); + } else if (returnVal == JFileChooser.CANCEL_OPTION) { + System.out.println("Browse command cancelled by user." + "\n"); + } // TODO add your handling code here: + + }//GEN-LAST:event_jButton1ActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JTextField dotDrawPort; + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JTextField nameServicePath; + private javax.swing.JTextField olsrdPath; + // End of variables declaration//GEN-END:variables +} + diff --git a/src/Wizard/FreimapVisualPanel4.form b/src/Wizard/FreimapVisualPanel4.form new file mode 100644 index 0000000..56b2622 --- /dev/null +++ b/src/Wizard/FreimapVisualPanel4.form @@ -0,0 +1,252 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Wizard/FreimapVisualPanel4.java b/src/Wizard/FreimapVisualPanel4.java new file mode 100644 index 0000000..872a6c1 --- /dev/null +++ b/src/Wizard/FreimapVisualPanel4.java @@ -0,0 +1,177 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package Wizard; + +import javax.swing.JPanel; + +public final class FreimapVisualPanel4 extends JPanel { + + /** Creates new form FreimapVisualPanel4 */ + public FreimapVisualPanel4() { + initComponents(); + } + + @Override + public String getName() { + return "Confirm Data"; + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + mySQLLabel = new javax.swing.JLabel(); + UserNameLabel = new javax.swing.JLabel(); + passwordLabel = new javax.swing.JLabel(); + olsrdLabel = new javax.swing.JLabel(); + NameServiceLabel = new javax.swing.JLabel(); + dotDrawPortLabel = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + hostNameLabel = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + + jLabel1.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.jLabel1.text")); // NOI18N + + jLabel2.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.jLabel2.text")); // NOI18N + + jLabel3.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.jLabel3.text")); // NOI18N + + jLabel4.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.jLabel4.text")); // NOI18N + + jLabel5.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.jLabel5.text")); // NOI18N + + jLabel6.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.jLabel6.text")); // NOI18N + + mySQLLabel.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(mySQLLabel, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.mySQLLabel.text")); // NOI18N + + UserNameLabel.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(UserNameLabel, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.UserNameLabel.text")); // NOI18N + + passwordLabel.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(passwordLabel, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.passwordLabel.text")); // NOI18N + + olsrdLabel.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(olsrdLabel, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.olsrdLabel.text")); // NOI18N + + NameServiceLabel.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(NameServiceLabel, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.NameServiceLabel.text")); // NOI18N + + dotDrawPortLabel.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(dotDrawPortLabel, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.dotDrawPortLabel.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.jLabel7.text")); // NOI18N + + hostNameLabel.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(hostNameLabel, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.hostNameLabel.text")); // NOI18N + + jLabel8.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(FreimapVisualPanel4.class, "FreimapVisualPanel4.jLabel8.text")); // NOI18N + + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() + .addContainerGap(45, Short.MAX_VALUE) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .add(jLabel6) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(dotDrawPortLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 155, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(layout.createSequentialGroup() + .add(jLabel5) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(NameServiceLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 155, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(layout.createSequentialGroup() + .add(jLabel4) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(olsrdLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 155, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(jLabel7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 315, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(layout.createSequentialGroup() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel2) + .add(jLabel1) + .add(jLabel3) + .add(jLabel8)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(hostNameLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 155, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(passwordLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 155, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(UserNameLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 155, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(mySQLLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 155, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))) + .add(31, 31, 31)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .add(20, 20, 20) + .add(jLabel7) + .add(19, 19, 19) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel8) + .add(hostNameLabel)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel2) + .add(mySQLLabel)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel1) + .add(UserNameLabel)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel3) + .add(passwordLabel)) + .add(18, 18, 18) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel4) + .add(olsrdLabel)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel5) + .add(NameServiceLabel)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel6) + .add(dotDrawPortLabel)) + .addContainerGap(74, Short.MAX_VALUE)) + ); + }// //GEN-END:initComponents + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel NameServiceLabel; + private javax.swing.JLabel UserNameLabel; + private javax.swing.JLabel dotDrawPortLabel; + private javax.swing.JLabel hostNameLabel; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel mySQLLabel; + private javax.swing.JLabel olsrdLabel; + private javax.swing.JLabel passwordLabel; + // End of variables declaration//GEN-END:variables +} + diff --git a/src/Wizard/FreimapWizardAction.java b/src/Wizard/FreimapWizardAction.java new file mode 100644 index 0000000..fe61474 --- /dev/null +++ b/src/Wizard/FreimapWizardAction.java @@ -0,0 +1,79 @@ +package Wizard; + +import java.awt.Component; +import java.awt.Dialog; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.MessageFormat; +import javax.swing.JComponent; +import org.openide.DialogDisplayer; +import org.openide.WizardDescriptor; + +public final class FreimapWizardAction implements ActionListener { + + private WizardDescriptor.Panel[] panels; + + public void actionPerformed(ActionEvent e) { + WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels()); + // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName() + wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); + wizardDescriptor.setTitle("Freimap Configuration Wizard"); + Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor); + dialog.setVisible(true); + dialog.toFront(); + boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION; + if (!cancelled) { + String host = (String) wizardDescriptor.getProperty("host"); + String port = (String) wizardDescriptor.getProperty("port"); + String dabatase = (String) wizardDescriptor.getProperty("dbText"); + String username = (String) wizardDescriptor.getProperty("username"); + String password = (String) wizardDescriptor.getProperty("password"); + String olsrdPath = (String) wizardDescriptor.getProperty("olsrdPath"); + String dotDrawPort = (String) wizardDescriptor.getProperty("dotDrawPort"); + String nameServicePath = (String) wizardDescriptor.getProperty("nameServicePath"); + + } + } + + /** + * Initialize panels representing individual wizard's steps and sets + * various properties for them influencing wizard appearance. + */ + private WizardDescriptor.Panel[] getPanels() { + if (panels == null) { + panels = new WizardDescriptor.Panel[]{ + new FreimapWizardPanel1(), + new FreimapWizardPanel2(), + new FreimapWizardPanel3(), + new FreimapWizardPanel4() + }; + String[] steps = new String[panels.length]; + for (int i = 0; i < panels.length; i++) { + Component c = panels[i].getComponent(); + // Default step name to component name of panel. Mainly useful + // for getting the name of the target chooser to appear in the + // list of steps. + steps[i] = c.getName(); + if (c instanceof JComponent) { // assume Swing components + JComponent jc = (JComponent) c; + // Sets step number of a component + // TODO if using org.openide.dialogs >= 7.8, can use WizardDescriptor.PROP_*: + jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i)); + // Sets steps names for a panel + jc.putClientProperty("WizardPanel_contentData", steps); + // Turn on subtitle creation on each step + jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); + // Show steps on the left side with the image on the background + jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE); + // Turn on numbering of all steps + jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE); + } + } + } + return panels; + } + + public String getName() { + return "Start Sample Wizard"; + } +} diff --git a/src/Wizard/FreimapWizardPanel1.java b/src/Wizard/FreimapWizardPanel1.java new file mode 100644 index 0000000..63072e6 --- /dev/null +++ b/src/Wizard/FreimapWizardPanel1.java @@ -0,0 +1,87 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package Wizard; + +import java.awt.Component; +import javax.swing.event.ChangeListener; +import org.openide.WizardDescriptor; +import org.openide.util.HelpCtx; + +public class FreimapWizardPanel1 implements WizardDescriptor.Panel { + + /** + * The visual component that displays this panel. If you need to access the + * component from this class, just use getComponent(). + */ + private Component component; + + // Get the visual component for the panel. In this template, the component + // is kept separate. This can be more efficient: if the wizard is created + // but never displayed, or not all panels are displayed, it is better to + // create only those which really need to be visible. + public Component getComponent() { + if (component == null) { + component = new FreimapVisualPanel1(); + } + return component; + } + + public HelpCtx getHelp() { + // Show no Help button for this panel: + return HelpCtx.DEFAULT_HELP; + // If you have context help: + // return new HelpCtx(SampleWizardPanel1.class); + } + + public boolean isValid() { + // If it is always OK to press Next or Finish, then: + return true; + // If it depends on some condition (form filled out...), then: + // return someCondition(); + // and when this condition changes (last form field filled in...) then: + // fireChangeEvent(); + // and uncomment the complicated stuff below. + } + + public final void addChangeListener(ChangeListener l) { + } + + public final void removeChangeListener(ChangeListener l) { + } + /* + private final Set listeners = new HashSet(1); // or can use ChangeSupport in NB 6.0 + public final void addChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.add(l); + } + } + public final void removeChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.remove(l); + } + } + protected final void fireChangeEvent() { + Iterator it; + synchronized (listeners) { + it = new HashSet(listeners).iterator(); + } + ChangeEvent ev = new ChangeEvent(this); + while (it.hasNext()) { + it.next().stateChanged(ev); + } + } + */ + + // You can use a settings object to keep track of state. Normally the + // settings object will be the WizardDescriptor, so you can use + // WizardDescriptor.getProperty & putProperty to store information entered + // by the user. + public void readSettings(Object settings) { + } + + public void storeSettings(Object settings) { + } +} + diff --git a/src/Wizard/FreimapWizardPanel2.java b/src/Wizard/FreimapWizardPanel2.java new file mode 100644 index 0000000..c85b3d3 --- /dev/null +++ b/src/Wizard/FreimapWizardPanel2.java @@ -0,0 +1,126 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package Wizard; + +import java.awt.Component; +import javax.swing.JOptionPane; +import javax.swing.event.ChangeListener; +import org.openide.WizardDescriptor; +import org.openide.WizardValidationException; +import org.openide.util.HelpCtx; + +public class FreimapWizardPanel2 implements WizardDescriptor.ValidatingPanel { + + /** + * The visual component that displays this panel. If you need to access the + * component from this class, just use getComponent(). + */ + private FreimapVisualPanel2 component; + private boolean isValid = true; + // Get the visual component for the panel. In this template, the component + // is kept separate. This can be more efficient: if the wizard is created + // but never displayed, or not all panels are displayed, it is better to + // create only those which really need to be visible. + + public Component getComponent() { + if (component == null) { + component = new FreimapVisualPanel2(); + } + return component; + } + + public HelpCtx getHelp() { + // Show no Help button for this panel: + return HelpCtx.DEFAULT_HELP; + // If you have context help: + // return new HelpCtx(SampleWizardPanel1.class); + } + + public boolean isValid() { + // If it is always OK to press Next or Finish, then: + return true; + // If it depends on some condition (form filled out...), then: + // return someCondition(); + // and when this condition changes (last form field filled in...) then: + // fireChangeEvent(); + // and uncomment the complicated stuff below. + } + + public final void addChangeListener(ChangeListener l) { + } + + public final void removeChangeListener(ChangeListener l) { + } + /* + private final Set listeners = new HashSet(1); // or can use ChangeSupport in NB 6.0 + public final void addChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.add(l); + } + } + public final void removeChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.remove(l); + } + } + protected final void fireChangeEvent() { + Iterator it; + synchronized (listeners) { + it = new HashSet(listeners).iterator(); + } + ChangeEvent ev = new ChangeEvent(this); + while (it.hasNext()) { + it.next().stateChanged(ev); + } + } + */ + + // You can use a settings object to keep track of state. Normally the + // settings object will be the WizardDescriptor, so you can use + // WizardDescriptor.getProperty & putProperty to store information entered + // by the user. + public void readSettings(Object settings) { + } + + public void storeSettings(Object settings) { + ((WizardDescriptor) settings).putProperty("host", ((FreimapVisualPanel2) getComponent()).getHost()); + ((WizardDescriptor) settings).putProperty("username", ((FreimapVisualPanel2) getComponent()).getUserName()); + ((WizardDescriptor) settings).putProperty("password", ((FreimapVisualPanel2) getComponent()).getPassword()); + ((WizardDescriptor) settings).putProperty("dbText", ((FreimapVisualPanel2) getComponent()).getDatabase()); + ((WizardDescriptor) settings).putProperty("port", ((FreimapVisualPanel2) getComponent()).getPort()); + + } + + public void validate() throws WizardValidationException { + String host = component.getHost(); + String database = component.getDatabase(); + String port = component.getPort(); + String username = component.getUserName(); + + if (host.equals("")) { + isValid = false; + throw new WizardValidationException(null, "Invalid Host", null); + } + if (port.equals("")) { + port = "3306"; + throw new WizardValidationException(null, "Will be used the default port: 3306", null); + } + if (username.equals("")) { + isValid = false; + throw new WizardValidationException(null, "Invalid Username", null); + } + if (database.equals("information_schema")) { + isValid = false; + throw new WizardValidationException(null, "You cannot use selected Database", null); + } + if (database.equals("")) { + isValid = false; + + throw new WizardValidationException(null, "Please select a Database", null); + } + + } +} + diff --git a/src/Wizard/FreimapWizardPanel3.java b/src/Wizard/FreimapWizardPanel3.java new file mode 100644 index 0000000..936defa --- /dev/null +++ b/src/Wizard/FreimapWizardPanel3.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package Wizard; + +import java.awt.Component; +import javax.swing.JOptionPane; +import javax.swing.event.ChangeListener; +import org.openide.WizardDescriptor; +import org.openide.WizardValidationException; +import org.openide.util.HelpCtx; + +public class FreimapWizardPanel3 implements WizardDescriptor.ValidatingPanel { + + /** + * The visual component that displays this panel. If you need to access the + * component from this class, just use getComponent(). + */ + private FreimapVisualPanel3 component; + + // Get the visual component for the panel. In this template, the component + // is kept separate. This can be more efficient: if the wizard is created + // but never displayed, or not all panels are displayed, it is better to + // create only those which really need to be visible. + public Component getComponent() { + if (component == null) { + component = new FreimapVisualPanel3(); + } + return component; + } + + public HelpCtx getHelp() { + // Show no Help button for this panel: + return HelpCtx.DEFAULT_HELP; + // If you have context help: + // return new HelpCtx(SampleWizardPanel1.class); + } + + public boolean isValid() { + // If it is always OK to press Next or Finish, then: + return true; + // If it depends on some condition (form filled out...), then: + // return someCondition(); + // and when this condition changes (last form field filled in...) then: + // fireChangeEvent(); + // and uncomment the complicated stuff below. + } + + public final void addChangeListener(ChangeListener l) { + } + + public final void removeChangeListener(ChangeListener l) { + } + /* + private final Set listeners = new HashSet(1); // or can use ChangeSupport in NB 6.0 + public final void addChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.add(l); + } + } + public final void removeChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.remove(l); + } + } + protected final void fireChangeEvent() { + Iterator it; + synchronized (listeners) { + it = new HashSet(listeners).iterator(); + } + ChangeEvent ev = new ChangeEvent(this); + while (it.hasNext()) { + it.next().stateChanged(ev); + } + } + */ + + // You can use a settings object to keep track of state. Normally the + // settings object will be the WizardDescriptor, so you can use + // WizardDescriptor.getProperty & putProperty to store information entered + // by the user. + public void readSettings(Object settings) { + + + } + + public void storeSettings(Object settings) { + ((WizardDescriptor) settings).putProperty("olsrdPath", ((FreimapVisualPanel3)getComponent()).getOlsrPath()); + ((WizardDescriptor) settings).putProperty("nameServicePath", ((FreimapVisualPanel3)getComponent()).getNameServicePath()); + ((WizardDescriptor) settings).putProperty("dotDrawPort", ((FreimapVisualPanel3)getComponent()).getDotDrawPort()); + + } + + public void validate() throws WizardValidationException { + String olsrdPath=component.getOlsrPath(); + String nameServicePath=component.getNameServicePath(); + String dotDrawPort=component.getDotDrawPort(); + + if(olsrdPath.equals("") && nameServicePath.equals("") && dotDrawPort.equals("")){ + olsrdPath="/etc/olsr.conf"; + nameServicePath="/var/run/latlon.js"; + dotDrawPort="2004"; + throw new WizardValidationException(null, "Will be used default value for the following values:\nOLSRd Config File: /etc/olsr.conf\nNameService LatLon.js file: /var/run/latlon.js\ndotDrawPort: 2004 ", null); + }else if(olsrdPath.equals("") && nameServicePath.equals("")){ + olsrdPath="/etc/olsr.conf"; + nameServicePath="/var/run/latlon.js"; + throw new WizardValidationException(null, "Will be used default value for the following values:\nOLSRd Config File: /etc/olsr.conf\nNameService LatLon.js file: /var/run/latlon.js\n", null); + }else if(nameServicePath.equals("") && dotDrawPort.equals("")){ + nameServicePath="/var/run/latlon.js"; + dotDrawPort="2004"; + throw new WizardValidationException(null, "Will be used default value for the following values:\nNameService LatLon.js file: /var/run/latlon.js", null); + }else if(olsrdPath.equals("") && dotDrawPort.equals("") ){ + olsrdPath="/etc/olsr.conf"; + dotDrawPort="2004"; + throw new WizardValidationException(null, "Will be used default value for the following values:\ndotDrawPort: 2004 ", null); + }else if(olsrdPath.endsWith("")){ + olsrdPath="/etc/olsr.conf"; + throw new WizardValidationException(null, "Will be used default position: \"/etc/olsr.conf\"", null); + }else if(nameServicePath.equals("")){ + nameServicePath="/var/run/latlon.js"; + throw new WizardValidationException(null, "Will be used default position: \"/var/run/latlon.js\"", null); + }else if(dotDrawPort.equals("")){ + dotDrawPort="2004"; + throw new WizardValidationException(null, "Will be used default position: \"/etc/olsr.conf\"", null); + } + } + } + + diff --git a/src/Wizard/FreimapWizardPanel4.java b/src/Wizard/FreimapWizardPanel4.java new file mode 100644 index 0000000..7be3c75 --- /dev/null +++ b/src/Wizard/FreimapWizardPanel4.java @@ -0,0 +1,99 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package Wizard; + +import java.awt.Component; +import javax.swing.JLabel; +import javax.swing.event.ChangeListener; +import org.openide.WizardDescriptor; +import org.openide.util.HelpCtx; +import org.openide.util.NbPreferences; + +public class FreimapWizardPanel4 implements WizardDescriptor.Panel { + + /** + * The visual component that displays this panel. If you need to access the + * component from this class, just use getComponent(). + */ + private Component component; + + // Get the visual component for the panel. In this template, the component + // is kept separate. This can be more efficient: if the wizard is created + // but never displayed, or not all panels are displayed, it is better to + // create only those which really need to be visible. + public Component getComponent() { + if (component == null) { + component = new FreimapVisualPanel4(); + } + return component; + } + + public HelpCtx getHelp() { + // Show no Help button for this panel: + return HelpCtx.DEFAULT_HELP; + // If you have context help: + // return new HelpCtx(SampleWizardPanel1.class); + } + + public boolean isValid() { + // If it is always OK to press Next or Finish, then: + return true; + // If it depends on some condition (form filled out...), then: + // return someCondition(); + // and when this condition changes (last form field filled in...) then: + // fireChangeEvent(); + // and uncomment the complicated stuff below. + } + + public final void addChangeListener(ChangeListener l) { + } + + public final void removeChangeListener(ChangeListener l) { + } + /* + private final Set listeners = new HashSet(1); // or can use ChangeSupport in NB 6.0 + public final void addChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.add(l); + } + } + public final void removeChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.remove(l); + } + } + protected final void fireChangeEvent() { + Iterator it; + synchronized (listeners) { + it = new HashSet(listeners).iterator(); + } + ChangeEvent ev = new ChangeEvent(this); + while (it.hasNext()) { + it.next().stateChanged(ev); + } + } + */ + // You can use a settings object to keep track of state. Normally the + // settings object will be the WizardDescriptor, so you can use + // WizardDescriptor.getProperty & putProperty to store information entered + // by the user. + JLabel hostNameLabel, mySQLLabel, mySQLPortLabel, usernameLabel, passwordLabel, olsrdLabel, NameServicePathLabel, dotDrawPortLabel; + + @Override + public void readSettings(Object settings) { + hostNameLabel.setText(NbPreferences.forModule(FreimapWizardPanel2.class).get("host", "localhost")); + mySQLLabel.setText(NbPreferences.forModule(FreimapWizardPanel2.class).get("dbText", "freimap")); + mySQLPortLabel.setText(NbPreferences.forModule(FreimapWizardPanel2.class).get("port", "3306")); + usernameLabel.setText(NbPreferences.forModule(FreimapWizardPanel2.class).get("username", "root")); + passwordLabel.setText(NbPreferences.forModule(FreimapWizardPanel2.class).get("password", "")); + olsrdLabel.setText(NbPreferences.forModule(FreimapWizardPanel3.class).get("olsrdPath", "/etc/olsr.conf")); + dotDrawPortLabel.setText(NbPreferences.forModule(FreimapWizardPanel3.class).get("dotDrawPort", "2004")); + NameServicePathLabel.setText(NbPreferences.forModule(FreimapWizardPanel3.class).get("nameServicePath", "/var/run/latlon.js")); + } + + public void storeSettings(Object settings) { + } +} + diff --git a/src/Wizard/layer.xml b/src/Wizard/layer.xml new file mode 100644 index 0000000..d7d46ca --- /dev/null +++ b/src/Wizard/layer.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/freimapgsoc/CheckActiveDataSource.java b/src/freimapgsoc/CheckActiveDataSource.java index b99e815..5f4168f 100644 --- a/src/freimapgsoc/CheckActiveDataSource.java +++ b/src/freimapgsoc/CheckActiveDataSource.java @@ -76,7 +76,7 @@ private String selectIpAddress() { String tmp = v.elementAt(i).toString().substring(1); poss[i] = tmp; } - String s = (String) JOptionPane.showInputDialog(null, "Please elect interface connected to OLSR Network: ", "Interface Selection", JOptionPane.PLAIN_MESSAGE, null, poss, poss[0]); + String s = (String) JOptionPane.showInputDialog(null, "Please select interface connected to OLSR Network: ", "Interface Selection", JOptionPane.PLAIN_MESSAGE, null, poss, poss[0]); if ((s != null) && (s.length() > 0)) { return s; }else if (s== null){ @@ -89,9 +89,9 @@ private String selectIpAddress() { } public boolean check_olsr() { - // Create a socket without a timeout + // Create a socket without a timeout with a dotDrawPlugin try { - InetAddress addr = InetAddress.getByName(selectIpAddress()); + InetAddress addr = InetAddress.getByName("127.0.0.1"); int port = 2004; // This constructor will block until the connection succeeds Socket socket = new Socket(addr, port); diff --git a/src/freimapgsoc/CredentialRequired.form b/src/freimapgsoc/CredentialRequired.form index 321f1ef..4c65ad0 100644 --- a/src/freimapgsoc/CredentialRequired.form +++ b/src/freimapgsoc/CredentialRequired.form @@ -27,33 +27,11 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - @@ -63,39 +41,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - + + + + + + + - + - + @@ -111,6 +111,7 @@ + @@ -123,15 +124,13 @@ - + - - - + diff --git a/src/freimapgsoc/CredentialRequired.java b/src/freimapgsoc/CredentialRequired.java index 11743fd..1d3a1ce 100644 --- a/src/freimapgsoc/CredentialRequired.java +++ b/src/freimapgsoc/CredentialRequired.java @@ -102,7 +102,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { passwordText.setFont(new java.awt.Font("Lucida Grande", 0, 12)); passwordText.setName("passwordText"); // NOI18N - logLabel.setFont(new java.awt.Font("Lucida Grande", 0, 10)); + logLabel.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N logLabel.setText(" "); logLabel.setName("logLabel"); // NOI18N @@ -140,7 +140,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jButton1.setFont(new java.awt.Font("Lucida Grande", 0, 12)); + jButton1.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N jButton1.setText("Example"); jButton1.setName("jButton1"); // NOI18N jButton1.addActionListener(new java.awt.event.ActionListener() { @@ -153,57 +153,57 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(layout.createSequentialGroup() - .add(23, 23, 23) + .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() + .add(25, 25, 25) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(layout.createSequentialGroup() - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) - .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 189, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(layout.createSequentialGroup() - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) - .add(jLabel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(jLabel1)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) - .add(hostText) - .add(org.jdesktop.layout.GroupLayout.LEADING, userText) - .add(org.jdesktop.layout.GroupLayout.LEADING, passwordText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 170, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(jLabel6))) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(portText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 53, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add(jLabel2) .add(layout.createSequentialGroup() .add(jLabel7) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(dbText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 197, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(layout.createSequentialGroup() .add(46, 46, 46) - .add(onlydataNode))) - .add(79, 79, 79)) + .add(onlydataNode)) + .add(layout.createSequentialGroup() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) + .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 189, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(layout.createSequentialGroup() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) + .add(jLabel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .add(jLabel1)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) + .add(hostText) + .add(org.jdesktop.layout.GroupLayout.LEADING, userText) + .add(org.jdesktop.layout.GroupLayout.LEADING, passwordText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 170, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(jLabel6))) + .add(jLabel2)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 117, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(portText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 53, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))) + .add(15, 15, 15)) .add(layout.createSequentialGroup() .add(2, 2, 2) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() - .add(logLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 363, Short.MAX_VALUE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 18, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add(layout.createSequentialGroup() - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) - .add(jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 271, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() - .add(loadDb, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 166, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(cancelButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 101, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) + .add(loadDb, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 166, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(cancelButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 101, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(connectButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 106, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))) - .add(22, 22, 22)) + .add(connectButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 106, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(layout.createSequentialGroup() + .add(logLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 363, Short.MAX_VALUE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 18, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))) + .add(20, 20, 20)) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() - .add(37, 37, 37) + .add(48, 48, 48) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(hostText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel5) @@ -216,7 +216,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel2) - .add(passwordText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(passwordText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jButton1)) .add(2, 2, 2) .add(jLabel4) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) @@ -227,14 +228,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .add(onlydataNode) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(logLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(26, 26, 26) + .add(18, 18, 18) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(connectButton) .add(cancelButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 32, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(loadDb, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add(29, 29, 29) - .add(jButton1) - .add(16, 16, 16)) + .add(71, 71, 71)) ); pack(); diff --git a/src/freimapgsoc/MySQLCredential.form b/src/freimapgsoc/MySQLCredential.form index 041657a..b109c82 100644 --- a/src/freimapgsoc/MySQLCredential.form +++ b/src/freimapgsoc/MySQLCredential.form @@ -51,7 +51,7 @@ - + @@ -99,19 +99,16 @@ - - - - + - + + - @@ -148,16 +145,15 @@ - - - - - - - + + + + + + - + @@ -194,13 +190,13 @@ - + - + @@ -478,14 +474,5 @@ - - - - - - - - - diff --git a/src/freimapgsoc/MySQLCredential.java b/src/freimapgsoc/MySQLCredential.java index 75b8efe..67bd279 100644 --- a/src/freimapgsoc/MySQLCredential.java +++ b/src/freimapgsoc/MySQLCredential.java @@ -71,7 +71,7 @@ private void initComponents() { errorsLog = new javax.swing.JTextArea(); cancelButton = new javax.swing.JButton(); startButton = new javax.swing.JButton(); - logLabel2 = new javax.swing.JLabel(); + logLabel = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); showLog = new javax.swing.JButton(); newDb = new javax.swing.JCheckBox(); @@ -91,7 +91,6 @@ private void initComponents() { exampleButton = new javax.swing.JButton(); dbText = new javax.swing.JComboBox(); jLabel4 = new javax.swing.JLabel(); - logLabel = new javax.swing.JLabel(); confirmPane.setMessage("If you continue your current data in the Database will be destroyed. \n Are you sure that you want to continue?.\n"); confirmPane.setFont(new java.awt.Font("Lucida Grande", 1, 10)); @@ -115,7 +114,7 @@ public void propertyChange(java.beans.PropertyChangeEvent evt) { errorsLog.setSize(new java.awt.Dimension(300, 400)); scrollPane.setViewportView(errorsLog); - setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("MySQL Credentials"); cancelButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); @@ -139,9 +138,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - logLabel2.setFont(new java.awt.Font("Lucida Grande", 0, 10)); - logLabel2.setText(" "); - logLabel2.setName("logLabel2"); // NOI18N + logLabel.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N + logLabel.setText(" "); + logLabel.setName("logLabel"); // NOI18N jLabel7.setFont(new java.awt.Font("Lucida Grande", 0, 12)); jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/freimapgsoc/resources/download.png"))); // NOI18N @@ -168,7 +167,7 @@ public void itemStateChanged(java.awt.event.ItemEvent evt) { } }); - newDbText.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + newDbText.setFont(new java.awt.Font("Lucida Grande", 0, 12)); newDbText.setEnabled(false); newDbText.setName("newDbText"); // NOI18N @@ -304,10 +303,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel4.setText("Avaible Database:"); jLabel4.setName("jLabel4"); // NOI18N - logLabel.setFont(new java.awt.Font("Lucida Grande", 0, 10)); - logLabel.setText(" "); - logLabel.setName("logLabel"); // NOI18N - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -334,17 +329,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .add(newDbText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 160, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(layout.createSequentialGroup() .add(19, 19, 19) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) - .add(logLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 253, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(logLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 253, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(logLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 253, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(resumeButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE) .add(continueButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(cancelButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(startButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 127, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add(org.jdesktop.layout.GroupLayout.TRAILING, resumeButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE)))) + .add(startButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 127, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))) .addContainerGap()) ); layout.setVerticalGroup( @@ -371,14 +364,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .add(2, 2, 2) .add(newDb))) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(continueButton) - .add(logLabel2)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(resumeButton) - .add(logLabel)) - .addContainerGap(13, Short.MAX_VALUE)) + .add(logLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 77, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(layout.createSequentialGroup() + .add(continueButton) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(resumeButton))) + .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); @@ -393,49 +385,45 @@ private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN- }//GEN-LAST:event_cancelButtonActionPerformed private void startButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startButtonActionPerformed - try{ - if (!newDbText.isEnabled()) { - database = dbText.getSelectedItem().toString(); - } else { - if (newDbText.getText().equals("")) { - logLabel2.setForeground(Color.red); - logLabel.setForeground(Color.red); - logLabel2.setText("Please select or specify a name "); - logLabel.setText("for the Database!!!"); - return; + try { + if (!newDbText.isEnabled()) { + database = dbText.getSelectedItem().toString(); } else { - database=newDbText.getText(); - } + if (newDbText.getText().equals("")) { + logLabel.setForeground(Color.red); + logLabel.setText("Please select or specify a name \nfor the Database."); + return; + } else { + database = newDbText.getText(); + } } - + host = hostText.getText(); port = portText.getText(); username = userText.getText(); password = passwordText.getText(); - }catch (Exception e) { - logLabel2.setForeground(Color.red); - logLabel.setForeground(Color.red); - logLabel2.setText("Please choose a least one database"); - logLabel.setText("or insert a new one!!"); - } - Component source = (Component) evt.getSource(); - int i = confirmPane.showConfirmDialog(source, "This operation will destory all data in the selected database. Are you sure?", "Database Replacement", JOptionPane.YES_NO_OPTION); - if (i == 0) { - try { - createTables(); - new OlsrdDataSource(host, port, username, password, database); - } catch (ClassNotFoundException ex) { - logLabel2.setText(ex.getMessage()); - Logger.getLogger(LatLonJsToMySQL.class.getName()).log(Level.SEVERE, null, ex); - } catch (SQLException ex) { - logLabel2.setText(ex.getMessage()); - Logger.getLogger(LatLonJsToMySQL.class.getName()).log(Level.SEVERE, null, ex); - } catch (Exception ex) { - ex.getMessage(); - } - } else { - confirmPane.setVisible(false); + } catch (Exception e) { + logLabel.setForeground(Color.red); + logLabel.setText("Please choose a least one database or insert a new one."); + } + Component source = (Component) evt.getSource(); + int i = confirmPane.showConfirmDialog(source, "This operation will destory all data in the selected database. Are you sure?", "Database Replacement", JOptionPane.YES_NO_OPTION); + if (i == 0) { + try { + createTables(); + new OlsrdDataSource(host, port, username, password, database); + } catch (ClassNotFoundException ex) { + logLabel.setText(ex.getMessage()); + Logger.getLogger(LatLonJsToMySQL.class.getName()).log(Level.SEVERE, null, ex); + } catch (SQLException ex) { + logLabel.setText(ex.getMessage()); + Logger.getLogger(LatLonJsToMySQL.class.getName()).log(Level.SEVERE, null, ex); + } catch (Exception ex) { + ex.getMessage(); } + } else { + confirmPane.setVisible(false); + } }//GEN-LAST:event_startButtonActionPerformed private void checkconnButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkconnButtonActionPerformed @@ -448,10 +436,10 @@ private void checkconnButtonActionPerformed(java.awt.event.ActionEvent evt) {//G if (port.length() == 0) { port = "3306"; } - logLabel2.setForeground(Color.red); - logLabel2.setText("Add host address and port number!"); + logLabel.setForeground(Color.red); + logLabel.setText("Add host address and port number!"); } else { - logLabel2.setText("Getting connection..."); + logLabel.setText("Getting connection..."); Class.forName("com.mysql.jdbc.Driver"); c = (Connection) DriverManager.getConnection("jdbc:mysql://" + host + ":" + port, username, password); if (!c.isClosed()) { @@ -464,8 +452,8 @@ private void checkconnButtonActionPerformed(java.awt.event.ActionEvent evt) {//G while (rss.next()) { dbText.insertItemAt(rss.getString("Database"), i); i++; - logLabel2.setForeground(Color.green); - logLabel2.setText("Connected!"); + logLabel.setForeground(Color.green); + logLabel.setText("Connected!"); dbText.setSelectedIndex(0); dbText.addItemListener(new java.awt.event.ItemListener() { @@ -473,24 +461,24 @@ public void itemStateChanged(java.awt.event.ItemEvent evt) { dbTextItemStateChanged(evt); } }); - logLabel2.setText("Now choose a database or create a new one."); + logLabel.setText("Now choose a database or create a new one."); } } } } catch (Exception ex) { - logLabel2.setForeground(Color.red); - logLabel2.setText(ex.getMessage()); + logLabel.setForeground(Color.red); + logLabel.setText(ex.getMessage()); } }//GEN-LAST:event_checkconnButtonActionPerformed private void createTables() throws ClassNotFoundException, SQLException { try { - logLabel2.setForeground(Color.black); - logLabel2.setText("Creating Table in " + database + " database..."); + logLabel.setForeground(Color.black); + logLabel.setText("Creating Table in " + database + " database..."); Class.forName("com.mysql.jdbc.Driver"); errors.put("DATABASE:", "Getting Connection for CreateTables...\n"); - logLabel2.setText("Getting Connection for CreateTables..."); + logLabel.setText("Getting Connection for CreateTables..."); String queryDel = "DROP SCHEMA IF EXISTS " + database + ";"; @@ -567,7 +555,7 @@ private void createTables() throws ClassNotFoundException, SQLException { Connection c2 = (Connection) DriverManager.getConnection("jdbc:mysql://" + host + ":" + port, username, password); Statement stmt2 = (Statement) c2.createStatement(); errors.put("DATABASE:", "Connected to the database...\n"); - logLabel2.setText("Execute Queries..."); + logLabel.setText("Execute Queries..."); Thread.sleep(3000); System.out.println(queryDel); @@ -610,7 +598,7 @@ private void createTables() throws ClassNotFoundException, SQLException { Thread.sleep(1000); errors.put("DATABASE:", "Now Adding nodes and Links....! This will take a while...\n"); - logLabel2.setText("Now Adding nodes and Links....! This will take a while.."); + logLabel.setText("Now Adding nodes and Links....! This will take a while.."); } catch (Exception e) { System.out.println(e.getMessage()); @@ -647,21 +635,18 @@ private void confirmPanePropertyChange(java.beans.PropertyChangeEvent evt) {//GE String prop = evt.getPropertyName(); if (evt.getSource().equals(confirmPane) && prop.equals(JOptionPane.YES_OPTION)) { try { - logLabel.setText(""); - logLabel2.setText("Getting connection..."); + logLabel.setText("Getting connection..."); Thread.sleep(1000); Class.forName("com.mysql.jdbc.Driver"); c = (Connection) DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, username, password); if (!c.isClosed()) { - logLabel.setText(""); - logLabel2.setForeground(Color.green); - logLabel2.setText("Connected!"); + logLabel.setForeground(Color.green); + logLabel.setText("Connected!"); createTables(); Thread.sleep(3000); } } catch (Exception ex) { - logLabel.setText(""); - logLabel2.setText(ex.getMessage()); + logLabel.setText(ex.getMessage()); Logger.getLogger(LatLonJsToMySQL.class.getName()).log(Level.SEVERE, null, ex); } } else { @@ -708,9 +693,9 @@ private void dbTextItemStateChanged(java.awt.event.ItemEvent evt) { host = hostText.getText(); username = userText.getText(); password = passwordText.getText(); - logLabel2.setForeground(Color.green); + logLabel.setForeground(Color.green); - logLabel2.setText("Checking Database...please wait..."); + logLabel.setText("Checking Database...please wait..."); try { Class.forName("com.mysql.jdbc.Driver"); c = (Connection) DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + selectedDatabase, username, password); @@ -730,27 +715,27 @@ private void dbTextItemStateChanged(java.awt.event.ItemEvent evt) { } // System.out.println(tables); //System.out.println(oktables); - if (tables.containsAll(oktables)) { - resumeButton.setEnabled(true); - continueButton.setEnabled(true); - logLabel2.setForeground(Color.green); - logLabel.setForeground(Color.green); - logLabel2.setText("This database contains Freimap data yet."); - logLabel.setText("You can resume it by pressing resume button..."); - // System.out.println("jdbc:mysql://" + host + ":" + port + "/" + selectedDatabase+" "+username+" "+password); + if (selectedDB.equals("information_schema")) { + logLabel.setForeground(Color.RED); + logLabel.setText("ATTENTION! Selected Database cannot be used!"); } else { - if (resumeButton.isEnabled()) { - resumeButton.setEnabled(false); + if (tables.containsAll(oktables)) { + resumeButton.setEnabled(true); + continueButton.setEnabled(true); + logLabel.setForeground(Color.green); + logLabel.setText("This database already contains Freimap data.\n\nYou can resume storing by pressing\nresume button..."); + } else { + if (resumeButton.isEnabled()) { + resumeButton.setEnabled(false); + } + startButton.setEnabled(true); + logLabel.setForeground(Color.RED); + logLabel.setText("ATTENTION!!! This database must be initialized for Freimap...\n\nALL DATA WILL BE DESTROYED!!"); } - startButton.setEnabled(true); - logLabel2.setForeground(Color.RED); - logLabel.setForeground(Color.RED); - logLabel2.setText("ATTENTION!!! This database must be initialized for Freimap..."); - logLabel.setText("All data must be destroyed!!"); } } } catch (Exception ex) { - logLabel2.setText(ex.getMessage()); + logLabel.setText(ex.getMessage()); Logger.getLogger(LatLonJsToMySQL.class.getName()).log(Level.SEVERE, null, ex); } } @@ -761,50 +746,79 @@ public boolean controlDabatase() { port = portText.getText(); username = userText.getText(); password = passwordText.getText(); + + if (host.length() < 2) { if (port.length() == 0) { port = "3306"; + + } - logLabel2.setForeground(Color.red); - logLabel2.setText("Add host address and port number!"); + logLabel.setForeground(Color.red); + logLabel.setText("Add host address and port number!"); + + return false; + + } else { - logLabel2.setText("Check connection..."); + logLabel.setText("Check connection..."); Thread.sleep(1000); Class.forName("com.mysql.jdbc.Driver"); c = (Connection) DriverManager.getConnection("jdbc:mysql://" + host + ":" + port, username, password); + + if (!c.isClosed()) { //check the connection again.... stmt = (Statement) c.createStatement(); rss = stmt.executeQuery("SHOW DATABASES"); dbText.setEnabled(true); newDb.setEnabled(true); + + int i = 0; + + while (rss.next()) { dbText.insertItemAt(rss.getString("Database"), i); i++; + } - logLabel2.setForeground(Color.green); - logLabel2.setText("Connected!"); + + + logLabel.setForeground(Color.green); + logLabel.setText("Connected!"); Thread.sleep(1000); - logLabel2.setText("Now choose a Database"); + logLabel.setText("Now choose a Database"); + + return true; + + } } } catch (Exception ex) { - logLabel2.setForeground(Color.red); - logLabel2.setText(ex.getMessage()); + logLabel.setForeground(Color.red); + logLabel.setText(ex.getMessage()); + + } return false; + + } private String stripQuotes(String str) { if (str.length() <= 2) { return null; + + } return str.substring(1, str.length() - 1); + + } /** @@ -818,6 +832,8 @@ public void run() { + + } }); @@ -825,6 +841,8 @@ public void run() { + + } Frame frame = null; Connection c = null; @@ -858,7 +876,6 @@ public void run() { private javax.swing.JLabel jLabel7; private javax.swing.JPanel jPanel1; private javax.swing.JLabel logLabel; - private javax.swing.JLabel logLabel2; private javax.swing.JCheckBox newDb; private javax.swing.JTextField newDbText; private javax.swing.JPasswordField passwordText; diff --git a/src/freimapgsoc/Start.form b/src/freimapgsoc/Start.form index 1f6ab3f..7c2d11d 100644 --- a/src/freimapgsoc/Start.form +++ b/src/freimapgsoc/Start.form @@ -30,15 +30,19 @@ - + + + + + - - + + @@ -52,11 +56,13 @@ - + - + + + @@ -201,6 +207,7 @@ + @@ -209,5 +216,15 @@ + + + + + + + + + + diff --git a/src/freimapgsoc/Start.java b/src/freimapgsoc/Start.java index 538936f..3275a93 100644 --- a/src/freimapgsoc/Start.java +++ b/src/freimapgsoc/Start.java @@ -12,6 +12,7 @@ import java.io.File; import javax.swing.JFileChooser; +import javax.swing.JOptionPane; /** * @@ -21,7 +22,17 @@ public class Start extends javax.swing.JFrame { /** Creates new form Start */ public Start() { - initComponents(); + initComponents(); + CheckActiveDataSource check=new CheckActiveDataSource(); + if(check.check_olsr()){ //check DotDrawPlugin + if(check.check_nameservice()){ + olsrdButton.setEnabled(true); + }else{ + JOptionPane.showMessageDialog(this.getContentPane(),"Nameservice Plugin Must be enabled in the olsr.conf file for live data!\nOlsrd button will be enabled but the lat/lon position in the Map\nwill be DEFAULT_LAT/DEFAULT_LON (now in Rome)!"); + } + }else{ + olsrdButton.setEnabled(false); + } } /** @@ -44,6 +55,7 @@ private void initComponents() { jPanel2 = new javax.swing.JPanel(); olsrdButton = new javax.swing.JButton(); batmanButton = new javax.swing.JButton(); + exitButton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setName("Form"); // NOI18N @@ -125,6 +137,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { batmanButton.setFont(resourceMap.getFont("batmanButton.font")); // NOI18N batmanButton.setText(resourceMap.getString("batmanButton.text")); // NOI18N + batmanButton.setEnabled(false); batmanButton.setName("batmanButton"); // NOI18N batmanButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -151,6 +164,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addContainerGap(9, Short.MAX_VALUE)) ); + exitButton.setIcon(resourceMap.getIcon("exitButton.icon")); // NOI18N + exitButton.setText(resourceMap.getString("exitButton.text")); // NOI18N + exitButton.setName("exitButton"); // NOI18N + exitButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + exitButtonActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -161,13 +183,16 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGap(8, 8, 8) .addComponent(jLabel1)) .addGroup(layout.createSequentialGroup() - .addGap(56, 56, 56) + .addGap(95, 95, 95) + .addComponent(secondLabel)) + .addGroup(layout.createSequentialGroup() + .addGap(55, 55, 55) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() - .addGap(95, 95, 95) - .addComponent(secondLabel))) + .addGap(106, 106, 106) + .addComponent(exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( @@ -177,19 +202,19 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(secondLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(20, 20, 20)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(exitButton) + .addContainerGap(24, Short.MAX_VALUE)) ); pack(); }// //GEN-END:initComponents private void olsrdButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_olsrdButtonActionPerformed - //new Layer(new OlsrdDataSource().init()); - CheckActiveDataSource check = new CheckActiveDataSource(); MySQLCredential mysqlcr=new MySQLCredential(new OlsrdDataSource()); mysqlcr.setVisible(true); }//GEN-LAST:event_olsrdButtonActionPerformed @@ -233,6 +258,10 @@ private void batmanButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN- // TODO add your handling code here: }//GEN-LAST:event_batmanButtonActionPerformed + private void exitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitButtonActionPerformed + this.dispose(); + }//GEN-LAST:event_exitButtonActionPerformed + /** * @param args the command line arguments */ @@ -246,6 +275,7 @@ public void run() { } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton batmanButton; + private javax.swing.JButton exitButton; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; diff --git a/src/freimapgsoc/resources/Start.properties b/src/freimapgsoc/resources/Start.properties index 94ceb79..d9a649b 100644 --- a/src/freimapgsoc/resources/Start.properties +++ b/src/freimapgsoc/resources/Start.properties @@ -23,3 +23,6 @@ jPanel2.border.titleFont=Lucida Grande-Plain-10 batmanButton.text=B.A.T.M.A.N Daemon #NOI18N batmanButton.font=Lucida Grande 10-Plain-10 +#NOI18N +exitButton.icon=close2.png +exitButton.text=Exit