Author: pwang
Date: 2012-08-14 16:31:14 -0700 (Tue, 14 Aug 2012)
New Revision: 30194
Modified:
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/dialogs/BookmarkDialogImpl.java
Log:
Fixed bug#1270
Modified:
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/dialogs/BookmarkDialogImpl.java
===================================================================
---
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/dialogs/BookmarkDialogImpl.java
2012-08-14 23:23:26 UTC (rev 30193)
+++
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/dialogs/BookmarkDialogImpl.java
2012-08-14 23:31:14 UTC (rev 30194)
@@ -230,8 +230,8 @@
this.dispose();
} else if (_btn == btnAddBookmark) {
EditBookmarkDialog theNewDialog = new
EditBookmarkDialog(this,
- true, bookmarks,
bookmarkCategory, "new", null);
- theNewDialog.setSize(300, 250);
+ true, bookmarks,
bookmarkCategory, "new", null, bkUtil);
+ theNewDialog.setSize(400, 300);
theNewDialog.setLocationRelativeTo(this);
theNewDialog.setVisible(true);
@@ -241,8 +241,8 @@
.getSelectedValue();
EditBookmarkDialog theEditDialog = new
EditBookmarkDialog(this,
true, bookmarks,
bookmarkCategory, "edit",
- theDataSource);
- theEditDialog.setSize(300, 250);
+ theDataSource, bkUtil);
+ theEditDialog.setSize(400, 300);
theEditDialog.setLocationRelativeTo(this);
theEditDialog.setVisible(true);
@@ -340,23 +340,26 @@
private final static long serialVersionUID = 1202339873325728L;
private String name;
private String URLstr;
+ private String provider = "";
private JDialog parent;
private Bookmarks theBookmarks;
private String categoryName;
private String mode = "new"; // new/edit
private DataSource dataSource = null;
+ private BookmarksUtil bkUtil;
/** Creates new form NewBookmarkDialog */
public EditBookmarkDialog(JDialog parent, boolean modal,
Bookmarks pBookmarks, String categoryName,
String pMode,
- DataSource pDataSource) {
+ DataSource pDataSource, BookmarksUtil bkUtil) {
super(parent, modal);
this.parent = parent;
this.theBookmarks = pBookmarks;
this.categoryName = categoryName;
this.mode = pMode;
this.dataSource = pDataSource;
-
+ this.bkUtil = bkUtil;
+
initComponents();
lbCategoryValue.setText(categoryName);
@@ -370,6 +373,12 @@
tfName.setText(dataSource.getName());
tfName.setEditable(false);
tfURL.setText(dataSource.getHref());
+ if (bkUtil.getCyDataSource(dataSource) != null){
+
tfProvider.setText(bkUtil.getCyDataSource(dataSource).getProvider());
+ }
+ else {
+ tfProvider.setText("");
+ }
}
}
@@ -383,6 +392,7 @@
if ((_btn == btnOK) &&
(mode.equalsIgnoreCase("new"))) {
name = tfName.getText();
URLstr = tfURL.getText();
+ provider = tfProvider.getText().trim();
if (name.trim().equals("") ||
URLstr.trim().equals("")) {
String msg = "Please provide a
name/URL.";
@@ -408,13 +418,14 @@
}
bkUtil.saveBookmark(theBookmarks,
categoryName,
- theDataSource);
+ theDataSource,
provider);
this.dispose();
}
if ((_btn == btnOK) &&
(mode.equalsIgnoreCase("edit"))) {
name = tfName.getText();
URLstr = tfURL.getText();
+ provider = tfProvider.getText().trim();
if (URLstr.trim().equals("")) {
String msg = "URL is empty.";
@@ -434,7 +445,7 @@
bkUtil.deleteBookmark(theBookmarks,
bookmarkCategory,
theDataSource);
bkUtil.saveBookmark(theBookmarks,
categoryName,
- theDataSource);
+ theDataSource,
this.provider);
this.dispose();
} else if (_btn == btnCancel) {
this.dispose();
@@ -447,104 +458,144 @@
* 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;
- // <editor-fold defaultstate="collapsed" desc=" Generated Code
">
- private void initComponents() {
- java.awt.GridBagConstraints gridBagConstraints;
+ lbCategory = new javax.swing.JLabel();
+ lbCategoryValue = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+ tfProvider = new javax.swing.JTextField();
+ 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();
- 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();
+
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ setTitle("Add new Bookmark");
+ getContentPane().setLayout(new java.awt.GridBagLayout());
- getContentPane().setLayout(new
java.awt.GridBagLayout());
+ lbCategory.setText("Category");
+ lbCategory.setName("lbCategory"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(30, 10, 0, 0);
+ getContentPane().add(lbCategory, gridBagConstraints);
-
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);
+ lbCategoryValue.setText("network");
+ lbCategoryValue.setName("lbCategoryValue"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.anchor =
java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(30, 10, 0, 0);
+ getContentPane().add(lbCategoryValue, 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);
+ jLabel3.setText("Provider:");
+ jLabel3.setName("jLabel3"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(20, 10, 0, 20);
+ getContentPane().add(jLabel3, 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);
+ tfProvider.setName("tfProvider"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.fill =
java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor =
java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.insets = new java.awt.Insets(20, 10, 0, 15);
+ getContentPane().add(tfProvider, 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);
+ lbName.setText("Name:");
+ lbName.setName("lbName"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.anchor =
java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(20, 10, 0, 20);
+ getContentPane().add(lbName, gridBagConstraints);
- btnOK.setText("OK");
- btnOK.setPreferredSize(new java.awt.Dimension(65, 23));
- jPanel1.add(btnOK);
+ tfName.setName("tfName"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.gridheight = 2;
+ gridBagConstraints.fill =
java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor =
java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(20, 10, 0, 15);
+ getContentPane().add(tfName, gridBagConstraints);
- btnCancel.setText("Cancel");
- jPanel1.add(btnCancel);
+ lbURL.setText("URL:");
+ lbURL.setName("lbURL"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 3;
+ gridBagConstraints.anchor =
java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.insets = new java.awt.Insets(20, 10, 0, 20);
+ getContentPane().add(lbURL, gridBagConstraints);
- 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);
+ tfURL.setName("tfURL"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 3;
+ gridBagConstraints.fill =
java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(20, 10, 0, 15);
+ getContentPane().add(tfURL, 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);
+ jPanel1.setName("jPanel1"); // NOI18N
- 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.setText("OK");
+ btnOK.setName("btnOK"); // NOI18N
+ jPanel1.add(btnOK);
+ btnCancel.setText("Cancel");
+ btnCancel.setName("btnCancel"); // NOI18N
+ jPanel1.add(btnCancel);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 4;
+ gridBagConstraints.gridwidth = 2;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.weighty = 1.0;
+ gridBagConstraints.insets = new java.awt.Insets(30, 0, 0, 0);
+ getContentPane().add(jPanel1, 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
+
+ pack();
+ }// </editor-fold>
+
+ // Variables declaration - do not modify
+ private javax.swing.JButton btnCancel;
+ private javax.swing.JButton btnOK;
+ private javax.swing.JLabel jLabel3;
+ 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 tfProvider;
+ private javax.swing.JTextField tfURL;
+ // End of variables declaration
}
public void showDialog() {
setVisible(true);
-
}
}
--
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.