EditProfile: fix stack overflow, remove obsolete code, edit javadoc
authorEddie <dev@fun2be.me>
Sat, 6 Jun 2015 10:40:29 +0000 (11:40 +0100)
committerEddie <dev@fun2be.me>
Sat, 6 Jun 2015 10:40:29 +0000 (11:40 +0100)
Fix stack overflow: gLabelCurrLocation was pointing to itself - point it
to gFieldCurrLocation instead!

src/uk/ac/ntu/n0521366/wsyd/client/EditProfile.form
src/uk/ac/ntu/n0521366/wsyd/client/EditProfile.java

index 55dca98..b8ec480 100644 (file)
     <Component class="javax.swing.JLabel" name="gLabelCurrLocation">
       <Properties>
         <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
-          <ComponentRef name="gLabelCurrLocation"/>
+          <ComponentRef name="gFieldCurrLocation"/>
         </Property>
         <Property name="text" type="java.lang.String" value="Current City/Town:"/>
       </Properties>
index a30def6..14371df 100644 (file)
@@ -33,20 +33,18 @@ import javax.swing.DefaultListModel;
 import javax.swing.JOptionPane;
 import javax.swing.ListModel;
 import uk.ac.ntu.n0521366.wsyd.libs.WSYD_Member;
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
 
 /**
- *
+ * Profile Registration and Editing dialog.
+ * 
  * @author Eddie Berrisford-Lynch
  */
 public class EditProfile extends javax.swing.JDialog {
 
     /**
      * Creates new form WSYD_RegiProfile
+     * @param parent owner frame
+     * @param modal true if modal
      */
     public EditProfile(java.awt.Frame parent, boolean modal) {
         super(parent, modal);
@@ -54,7 +52,7 @@ public class EditProfile extends javax.swing.JDialog {
     }
 
     /**
-     *  Populate a model with the applications pre-defined interests.
+     *  Populate a model with the application's pre-defined interests.
      * 
      * @return the model
      */
@@ -62,7 +60,6 @@ public class EditProfile extends javax.swing.JDialog {
         DefaultListModel<String> m = new DefaultListModel<>();
         for (String i : WSYD_Member.Interests)
             m.addElement(i);
-        System.err.println(m.toString());
         return m;
     }
     /**
@@ -190,7 +187,7 @@ public class EditProfile extends javax.swing.JDialog {
         gridBagConstraints.gridy = 6;
         getContentPane().add(gFieldBirthDate, gridBagConstraints);
 
-        gLabelCurrLocation.setLabelFor(gLabelCurrLocation);
+        gLabelCurrLocation.setLabelFor(gFieldCurrLocation);
         gLabelCurrLocation.setText("Current City/Town:");
         gridBagConstraints = new java.awt.GridBagConstraints();
         gridBagConstraints.gridx = 0;
@@ -330,22 +327,6 @@ public class EditProfile extends javax.swing.JDialog {
             // trigger sending of the data to SocialServer
             ((ClientGUI)this.getOwner()).confirmRegistration(m);
         }
-        // FIXME: gButtonConfirmationMouseClicked(): remove superceded code that has been commented out
-        /* 
-        TreeSet<String> interests = null;
-
-        for (int i = 0; i < gListInterests.getModel().getSize(); i++)
-        {
-            interests.add(((String)gListInterests.getModel().getElementAt(i)));
-        }
-        if (((ClientGUI)this.getOwner()).confirmRegistration(gFieldUsername.getText(),
-                new String(gPFieldPassword.getPassword()),
-                gFieldBirthDate.getText(),
-                gFieldCurrLocation.getText(),
-                interests,
-                gTAreaBio.getText())) this.dispose();
-        else gLabelPWarning.setText("Server failed to register. Retry.");
-        */
     }//GEN-LAST:event_gButtonConfirmationMouseClicked
 
     /**
@@ -378,6 +359,7 @@ public class EditProfile extends javax.swing.JDialog {
 
         /* Create and display the dialog */
         java.awt.EventQueue.invokeLater(new Runnable() {
+            @Override
             public void run() {
                 EditProfile dialog = new EditProfile(new javax.swing.JFrame(), true);
                 dialog.addWindowListener(new java.awt.event.WindowAdapter() {