Author: pwang
Date: 2010-06-01 15:55:57 -0700 (Tue, 01 Jun 2010)
New Revision: 20394

Modified:
   cytoscape/trunk/src/cytoscape/dialogs/preferences/BookmarkDialog.java
Log:
Pulled out inner class

Modified: cytoscape/trunk/src/cytoscape/dialogs/preferences/BookmarkDialog.java
===================================================================
--- cytoscape/trunk/src/cytoscape/dialogs/preferences/BookmarkDialog.java       
2010-06-01 22:55:21 UTC (rev 20393)
+++ cytoscape/trunk/src/cytoscape/dialogs/preferences/BookmarkDialog.java       
2010-06-01 22:55:57 UTC (rev 20394)
@@ -373,239 +373,7 @@
                }
        }
 
-       public class EditBookmarkDialog extends JDialog implements 
ActionListener {
-               private String name_orig = null;
-               private String name;
-               private String URLstr;
-               private JDialog parent;
-               private Bookmarks theBookmarks;
-               private String categoryName;
-               private URL bookmarkURL;
-               private String mode = "new"; // new/edit
-               private DataSource dataSource = null;
 
-               /** Creates new form NewBookmarkDialog */
-               public EditBookmarkDialog(JDialog parent, boolean modal, 
Bookmarks pBookmarks,
-                                         String categoryName, String pMode, 
DataSource pDataSource) {
-                       super(parent, modal);
-                       this.parent = parent;
-                       this.theBookmarks = pBookmarks;
-                       this.categoryName = categoryName;
-                       this.mode = pMode;
-                       this.dataSource = pDataSource;
-                       if (pDataSource != null){
-                               this.name_orig = pDataSource.getName();         
                
-                       }
-                       
-                       initComponents();
-
-                       lbCategoryValue.setText(categoryName);
-
-                       if (pMode.equalsIgnoreCase("new")) {
-                               this.setTitle("Add new bookmark");
-                       }
-
-                       if (pMode.equalsIgnoreCase("edit")) {
-                               this.setTitle("Edit bookmark");
-                               tfName.setText(dataSource.getName());
-                               tfURL.setText(dataSource.getHref());
-                       }
-               }
-
-               public void actionPerformed(ActionEvent e) {
-                       Object _actionObject = e.getSource();
-
-                       // handle Button events
-                       if (_actionObject instanceof JButton) {
-                               JButton _btn = (JButton) _actionObject;
-
-                               if ((_btn == btnOK) && 
(mode.equalsIgnoreCase("new"))) {
-                                       name = tfName.getText();
-                                       URLstr = tfURL.getText();
-
-                                       if (name.trim().equals("") || 
URLstr.trim().equals("")) {
-                                               String msg = "Please provide a 
name/URL!";
-                                               // display info dialog
-                                               
JOptionPane.showMessageDialog(parent, msg, "Warning",
-                                                                             
JOptionPane.INFORMATION_MESSAGE);
-
-                                               return;
-                                       }
-
-                                       DataSource theDataSource = new 
DataSource();
-                                       theDataSource.setName(name);
-                                       theDataSource.setHref(URLstr);
-
-                                       if 
(BookmarksUtil.isInBookmarks(bookmarkURL, categoryName, theDataSource)) {
-                                               String msg = "Bookmark already 
existed!";
-                                               // display info dialog
-                                               
JOptionPane.showMessageDialog(parent, msg, "Warning",
-                                                                             
JOptionPane.INFORMATION_MESSAGE);
-
-                                               return;
-                                       }
-
-                                       
BookmarksUtil.saveBookmark(theBookmarks, categoryName, theDataSource);
-                                       this.dispose();
-                               }
-
-                               if ((_btn == btnOK) && 
(mode.equalsIgnoreCase("edit"))) {
-                                       name = tfName.getText().trim();
-                                       URLstr = tfURL.getText();
-
-                                       if (name.trim().equals("")) {
-                                               String msg = "The name field is 
empty!";
-                                               // display info dialog
-                                               
JOptionPane.showMessageDialog(parent, msg, "Warning",
-                                                                             
JOptionPane.INFORMATION_MESSAGE);
-
-                                               return;
-                                       }
-                                       
-                                       if (URLstr.trim().equals("")) {
-                                               String msg = "URL is empty!";
-                                               // display info dialog
-                                               
JOptionPane.showMessageDialog(parent, msg, "Warning",
-                                                                             
JOptionPane.INFORMATION_MESSAGE);
-
-                                               return;
-                                       }
-
-                                       DataSource theDataSource = new 
DataSource();
-                                       theDataSource.setName(this.name_orig);
-                                       theDataSource.setHref(URLstr);
-
-                                       if 
(!this.name.equalsIgnoreCase(this.name_orig)){
-                                               // The bookmark name has been 
changed
-                                               DataSource newDataSource = new 
DataSource();
-                                               newDataSource.setName(name);
-                                               newDataSource.setHref(URLstr);
-
-                                               if 
(BookmarksUtil.isInBookmarks(theBookmarks, bookmarkCategory, newDataSource)){
-                                                       // The bookmark name 
must be unique
-                                                       
JOptionPane.showMessageDialog(parent, "Bookmark with this name already 
existed!", "Warning",
-                                                                               
      JOptionPane.INFORMATION_MESSAGE);
-                                                       return;
-                                               }
-                                               
-                                               // first delete the old one, 
then add (note: name is key of DataSource)
-                                               
BookmarksUtil.deleteBookmark(theBookmarks, bookmarkCategory, theDataSource);
-                                               
BookmarksUtil.saveBookmark(theBookmarks, categoryName, newDataSource);
-                                       }
-                                       else { // The bookmark name has not 
been changed
-                                               // first delete the old one, 
then add (note: name is key of DataSource)
-                                               
BookmarksUtil.deleteBookmark(theBookmarks, bookmarkCategory, theDataSource);
-                                               
BookmarksUtil.saveBookmark(theBookmarks, categoryName, theDataSource);          
                                
-                                       }
-
-                                       this.dispose();
-                               } else if (_btn == btnCancel) {
-                                       this.dispose();
-                               }
-                       }
-               } // End of actionPerformed()
-
-               /**
-                * 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.
-                */
-
-               // <editor-fold defaultstate="collapsed" desc=" Generated Code 
">
-               private void initComponents() {
-                       java.awt.GridBagConstraints gridBagConstraints;
-
-                       lbName = new javax.swing.JLabel();
-                       tfName = new javax.swing.JTextField();
-                       lbURL = new javax.swing.JLabel();
-                       tfURL = new javax.swing.JTextField();
-                       jPanel1 = new javax.swing.JPanel();
-                       btnOK = new javax.swing.JButton();
-                       btnCancel = new javax.swing.JButton();
-                       lbCategory = new javax.swing.JLabel();
-                       lbCategoryValue = new javax.swing.JLabel();
-
-                       getContentPane().setLayout(new 
java.awt.GridBagLayout());
-
-                       
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-                       lbName.setText("Name:");
-                       gridBagConstraints = new java.awt.GridBagConstraints();
-                       gridBagConstraints.gridy = 1;
-                       gridBagConstraints.anchor = 
java.awt.GridBagConstraints.WEST;
-                       gridBagConstraints.insets = new java.awt.Insets(10, 10, 
10, 10);
-                       getContentPane().add(lbName, gridBagConstraints);
-
-                       gridBagConstraints = new java.awt.GridBagConstraints();
-                       gridBagConstraints.gridx = 1;
-                       gridBagConstraints.gridy = 1;
-                       gridBagConstraints.fill = 
java.awt.GridBagConstraints.HORIZONTAL;
-                       gridBagConstraints.weightx = 1.0;
-                       gridBagConstraints.insets = new java.awt.Insets(10, 10, 
10, 10);
-                       getContentPane().add(tfName, gridBagConstraints);
-
-                       lbURL.setText("URL:");
-                       gridBagConstraints = new java.awt.GridBagConstraints();
-                       gridBagConstraints.gridx = 0;
-                       gridBagConstraints.gridy = 2;
-                       gridBagConstraints.anchor = 
java.awt.GridBagConstraints.WEST;
-                       gridBagConstraints.insets = new java.awt.Insets(10, 10, 
10, 10);
-                       getContentPane().add(lbURL, gridBagConstraints);
-
-                       gridBagConstraints = new java.awt.GridBagConstraints();
-                       gridBagConstraints.gridx = 1;
-                       gridBagConstraints.fill = 
java.awt.GridBagConstraints.HORIZONTAL;
-                       gridBagConstraints.insets = new java.awt.Insets(10, 10, 
10, 10);
-                       getContentPane().add(tfURL, gridBagConstraints);
-
-                       btnOK.setText("OK");
-                       btnOK.setPreferredSize(new java.awt.Dimension(65, 23));
-                       jPanel1.add(btnOK);
-
-                       btnCancel.setText("Cancel");
-                       jPanel1.add(btnCancel);
-
-                       gridBagConstraints = new java.awt.GridBagConstraints();
-                       gridBagConstraints.gridx = 0;
-                       gridBagConstraints.gridwidth = 2;
-                       gridBagConstraints.insets = new java.awt.Insets(20, 20, 
20, 20);
-                       getContentPane().add(jPanel1, gridBagConstraints);
-
-                       lbCategory.setText("Category:");
-                       gridBagConstraints = new java.awt.GridBagConstraints();
-                       gridBagConstraints.gridx = 0;
-                       gridBagConstraints.gridy = 0;
-                       gridBagConstraints.anchor = 
java.awt.GridBagConstraints.WEST;
-                       gridBagConstraints.insets = new java.awt.Insets(20, 10, 
10, 0);
-                       getContentPane().add(lbCategory, gridBagConstraints);
-
-                       lbCategoryValue.setText("network");
-                       gridBagConstraints = new java.awt.GridBagConstraints();
-                       gridBagConstraints.gridx = 1;
-                       gridBagConstraints.gridy = 0;
-                       gridBagConstraints.anchor = 
java.awt.GridBagConstraints.WEST;
-                       gridBagConstraints.insets = new java.awt.Insets(20, 10, 
10, 0);
-                       getContentPane().add(lbCategoryValue, 
gridBagConstraints);
-
-                       btnOK.addActionListener(this);
-                       btnCancel.addActionListener(this);
-
-                       pack();
-               } // </editor-fold>
-
-               // Variables declaration - do not modify
-               private javax.swing.JButton btnCancel;
-               private javax.swing.JButton btnOK;
-               private javax.swing.JPanel jPanel1;
-               private javax.swing.JLabel lbCategory;
-               private javax.swing.JLabel lbCategoryValue;
-               private javax.swing.JLabel lbName;
-               private javax.swing.JLabel lbURL;
-               private javax.swing.JTextField tfName;
-               private javax.swing.JTextField tfURL;
-
-               // End of variables declaration
-       }
-
        /**
         * @param args
         */

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to