[Mongobrowser-commit] SF.net SVN: mongobrowser:[42] trunk/mongobrowser/src/com/mebigfatguy/ mongobr
Status: Pre-Alpha
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2009-12-27 17:25:32
|
Revision: 42
http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=42&view=rev
Author: dbrosius
Date: 2009-12-27 17:25:23 +0000 (Sun, 27 Dec 2009)
Log Message:
-----------
pull actions out into separate classes
Modified Paths:
--------------
trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java
trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java
trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoTreeNode.java
Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java
===================================================================
--- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java 2009-12-27 17:19:53 UTC (rev 41)
+++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java 2009-12-27 17:25:23 UTC (rev 42)
@@ -20,8 +20,6 @@
import java.awt.Color;
import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
@@ -40,6 +38,9 @@
import com.jgoodies.forms.layout.FormLayout;
import com.mebigfatguy.mongobrowser.MongoBundle;
import com.mebigfatguy.mongobrowser.MongoContext;
+import com.mebigfatguy.mongobrowser.actions.NewCollectionAction;
+import com.mebigfatguy.mongobrowser.actions.NewKeyValueAction;
+import com.mebigfatguy.mongobrowser.actions.NewObjectAction;
import com.mongodb.Mongo;
public class MongoControlPanel extends JPanel implements MongoPanel {
@@ -132,22 +133,25 @@
add(dbLabel, cc.xy(2, 1));
add(dbComboBox, cc.xy(4, 1));
+ dbNewCollectionButton = new JButton(new NewCollectionAction(context));
ImageIcon icon = new ImageIcon(MongoControlPanel.class.getResource("/com/mebigfatguy/mongobrowser/resources/newcollection.png"));
- dbNewCollectionButton = new JButton(icon);
+ dbNewCollectionButton.setIcon(icon);
dbNewCollectionButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));
dbNewCollectionButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.NewCollection));
add(dbNewCollectionButton, cc.xy(6, 1));
dbNewCollectionButton.setEnabled(false);
+ dbNewObjectButton = new JButton(new NewObjectAction(context));
icon = new ImageIcon(MongoControlPanel.class.getResource("/com/mebigfatguy/mongobrowser/resources/newobject.png"));
- dbNewObjectButton = new JButton(icon);
+ dbNewObjectButton.setIcon(icon);
dbNewObjectButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));
dbNewObjectButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.NewObject));
add(dbNewObjectButton, cc.xy(8, 1));
dbNewObjectButton.setEnabled(false);
+ dbNewKeyValueButton = new JButton(new NewKeyValueAction(context));
icon = new ImageIcon(MongoControlPanel.class.getResource("/com/mebigfatguy/mongobrowser/resources/newkeyvalue.png"));
- dbNewKeyValueButton = new JButton(icon);
+ dbNewKeyValueButton.setIcon(icon);
dbNewKeyValueButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));
dbNewKeyValueButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.NewKeyValue));
add(dbNewKeyValueButton, cc.xy(10, 1));
@@ -177,22 +181,6 @@
}
});
-
- dbNewCollectionButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent ae) {
- MongoActions actions = new MongoActions(context);
- actions.createNewCollection();
- }
- });
-
- dbNewObjectButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent ae) {
- MongoActions actions = new MongoActions(context);
- actions.createNewObject();
- }
- });
}
}
Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java
===================================================================
--- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java 2009-12-27 17:19:53 UTC (rev 41)
+++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java 2009-12-27 17:25:23 UTC (rev 42)
@@ -19,8 +19,6 @@
package com.mebigfatguy.mongobrowser.dialogs;
import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Set;
@@ -38,8 +36,10 @@
import javax.swing.tree.ExpandVetoException;
import javax.swing.tree.TreePath;
-import com.mebigfatguy.mongobrowser.MongoBundle;
import com.mebigfatguy.mongobrowser.MongoContext;
+import com.mebigfatguy.mongobrowser.actions.NewCollectionAction;
+import com.mebigfatguy.mongobrowser.actions.NewKeyValueAction;
+import com.mebigfatguy.mongobrowser.actions.NewObjectAction;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
@@ -101,9 +101,9 @@
add(new JScrollPane(tree), BorderLayout.CENTER);
context.setTree(tree);
- newCollectionItem = new JMenuItem(MongoBundle.getString(MongoBundle.Key.NewCollection));
- newObjectItem = new JMenuItem(MongoBundle.getString(MongoBundle.Key.NewObject));
- newKeyValueItem = new JMenuItem(MongoBundle.getString(MongoBundle.Key.NewKeyValue));
+ newCollectionItem = new JMenuItem(new NewCollectionAction(context));
+ newObjectItem = new JMenuItem(new NewObjectAction(context));
+ newKeyValueItem = new JMenuItem(new NewKeyValueAction(context));
}
private void initListeners() {
@@ -207,29 +207,5 @@
}
}
});
-
- newCollectionItem.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent ae) {
- MongoActions actions = new MongoActions(context);
- actions.createNewCollection();
- }
- });
-
- newObjectItem.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent ae) {
- MongoActions actions = new MongoActions(context);
- actions.createNewObject();
- }
- });
-
- newKeyValueItem.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent ae) {
- MongoActions actions = new MongoActions(context);
- actions.createNewKeyValue();
- }
- });
}
}
Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoTreeNode.java
===================================================================
--- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoTreeNode.java 2009-12-27 17:19:53 UTC (rev 41)
+++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoTreeNode.java 2009-12-27 17:25:23 UTC (rev 42)
@@ -26,7 +26,7 @@
public class MongoTreeNode extends DefaultMutableTreeNode {
private static final long serialVersionUID = -1710144820086785938L;
- enum Type {Root, Collection, Object, KeyValue, ExpansionSlug};
+ public enum Type {Root, Collection, Object, KeyValue, ExpansionSlug};
Type nodeType;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|