mongobrowser-commit Mailing List for mongobrowser
Status: Pre-Alpha
Brought to you by:
dbrosius
You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(60) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(61) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(9) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <dbr...@us...> - 2011-06-27 05:18:09
|
Revision: 134 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=134&view=rev Author: dbrosius Date: 2011-06-27 05:18:03 +0000 (Mon, 27 Jun 2011) Log Message: ----------- better date handling Modified Paths: -------------- trunk/mongobrowser/.classpath trunk/mongobrowser/build.xml trunk/mongobrowser/etc/mongobrowser.jnlp trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/EditKeyValueAction.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java Added Paths: ----------- trunk/mongobrowser/README Modified: trunk/mongobrowser/.classpath =================================================================== --- trunk/mongobrowser/.classpath 2011-06-24 06:10:13 UTC (rev 133) +++ trunk/mongobrowser/.classpath 2011-06-27 05:18:03 UTC (rev 134) @@ -5,5 +5,6 @@ <classpathentry kind="lib" path="lib/forms-1.2.1.jar"/> <classpathentry kind="lib" path="lib/commons-io-1.3.2.jar"/> <classpathentry kind="lib" path="lib/mongo-java-driver-2.6.2.jar"/> + <classpathentry kind="lib" path="lib/pickcal-0.1.0.jar"/> <classpathentry kind="output" path="classes"/> </classpath> Added: trunk/mongobrowser/README =================================================================== --- trunk/mongobrowser/README (rev 0) +++ trunk/mongobrowser/README 2011-06-27 05:18:03 UTC (rev 134) @@ -0,0 +1,6 @@ +mongobrowser +============ + +A webstart application that allows to you to browser, update and administer a MongoDB database. + +This is a work in progress, and is early on. Any bugs, features or ideas are very much welcome. Property changes on: trunk/mongobrowser/README ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: trunk/mongobrowser/build.xml =================================================================== --- trunk/mongobrowser/build.xml 2011-06-24 06:10:13 UTC (rev 133) +++ trunk/mongobrowser/build.xml 2011-06-27 05:18:03 UTC (rev 134) @@ -38,6 +38,7 @@ <property name="forms.version" value="1.2.1"/> <property name="mongo-java-driver.version" value="2.6.2"/> <property name="commons-io.version" value="1.3.2"/> + <property name="pickcal.version" value="0.1.0"/> <property name="mongobrowser.version" value="0.1.0"/> @@ -62,13 +63,15 @@ <pathelement location="${lib.dir}/mongo-java-driver-${mongo-java-driver.version}.jar"/> <pathelement location="${lib.dir}/forms-${forms.version}.jar"/> <pathelement location="${lib.dir}/commons-io-${commons-io.version}.jar"/> + <pathelement location="${lib.dir}/pickcal-${pickcal.version}.jar"/> </path> </target> <property name="forms_url" value="http://repo1.maven.org/maven2/com/jgoodies/forms/${forms.version}/forms-${forms.version}.jar"/> <property name="mongodriver_url" value="http://repo1.maven.org/maven2/org/mongodb/mongo-java-driver/${mongo-java-driver.version}/mongo-java-driver-${mongo-java-driver.version}.jar"/> <property name="commonsio_url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-io/${commons-io.version}/commons-io-${commons-io.version}.jar"/> - + <property name="pickcal_url" value="http://cloud.github.com/downloads/mebigfatguy/pickcal/pickcal-0.1.0.jar"/> + <target name="forms_check"> <available file="${basedir}/lib/forms-${forms.version}.jar" property="forms_exists"/> </target> @@ -80,6 +83,10 @@ <target name="commonsio_check"> <available file="${basedir}/lib/commons-io-${commons-io.version}.jar" property="commonsio.exists"/> </target> + + <target name="pickcal_check"> + <available file="${basedir}/lib/pickcal-${pickcal.version}.jar" property="pickcal.exists"/> + </target> <target name="install_forms" depends="forms_check" unless="forms_exists" description="installs forms.jar into lib"> <get src="${forms_url}" dest="${basedir}/lib/forms-${forms.version}.jar" verbose="true" ignoreerrors="true"/> @@ -92,8 +99,12 @@ <target name="install_commonsio" depends="commonsio_check" unless="commonsio.exists" description="installs commons-io.jar into lib"> <get src="${commonsio_url}" dest="${basedir}/lib/commons-io-${commons-io.version}.jar" verbose="true" ignoreerrors="true"/> </target> + + <target name="install_pickcal" depends="pickcal_check" unless="pickcal.exists" description="installs pickcal.jar into lib"> + <get src="${pickcal_url}" dest="${basedir}/lib/pickcal-${pickcal.version}.jar" verbose="true" ignoreerrors="true"/> + </target> - <target name="pull" depends="install_forms, install_mongodriver, install_commonsio" description="pulls in the 3rd party jars"> + <target name="pull" depends="install_forms, install_mongodriver, install_commonsio, install_pickcal" description="pulls in the 3rd party jars"> </target> <target name="compile" depends="-init, pull" description="compiles java files"> @@ -144,7 +155,7 @@ <manifest> <attribute name="mongobrowser-version" value="${mongobrowser.version}"/> <attribute name="Main-Class" value="com.mebigfatguy.mongobrowser.MongoBrowser"/> - <attribute name="Class-Path" value="commons-io-${commons-io.version}.jar forms-${forms.version}.jar"/> + <attribute name="Class-Path" value="commons-io-${commons-io.version}.jar forms-${forms.version}.jar pickcal-${pickcal.version}.jar"/> </manifest> </jar> </target> @@ -211,7 +222,7 @@ <target name="binzip" depends="build" description="zips up all jars"> <zip destfile="${basedir}/mongobrowser-bin-${mongobrowser.version}.zip" basedir="${jnlp.dir}" - includes="mongobrowser-${mongobrowser.version}.jar commons-io-${commons-io.version}.jar forms-${forms.version}.jar"/> + includes="mongobrowser-${mongobrowser.version}.jar commons-io-${commons-io.version}.jar forms-${forms.version}.jar pickcal-${pickcal.version}.jar"/> </target> <target name="release" depends="build, jnlp, binzip, srczip, javadoc" description="prepares everything for a release"/> Modified: trunk/mongobrowser/etc/mongobrowser.jnlp =================================================================== --- trunk/mongobrowser/etc/mongobrowser.jnlp 2011-06-24 06:10:13 UTC (rev 133) +++ trunk/mongobrowser/etc/mongobrowser.jnlp 2011-06-27 05:18:03 UTC (rev 134) @@ -18,6 +18,7 @@ <jar href="mongobrowser-$VERSION.jar"/> <jar href="mongo-java-driver-2.6.2.jar"/> <jar href="forms-1.2.1.jar"/> + <jar href="pickcal-0.1.0.jar"/> </resources> <application-desc main-class="com.mebigfatguy.mongobrowser.MongoBrowser"/> </jnlp> Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/EditKeyValueAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/EditKeyValueAction.java 2011-06-24 06:10:13 UTC (rev 133) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/EditKeyValueAction.java 2011-06-27 05:18:03 UTC (rev 134) @@ -36,6 +36,7 @@ */ public class EditKeyValueAction extends AbstractAction { + private static final long serialVersionUID = 6217724540802572545L; private final MongoContext context; /** Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java 2011-06-24 06:10:13 UTC (rev 133) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java 2011-06-27 05:18:03 UTC (rev 134) @@ -24,6 +24,9 @@ import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; @@ -47,6 +50,7 @@ import com.jgoodies.forms.layout.FormLayout; import com.mebigfatguy.mongobrowser.MongoBundle; import com.mebigfatguy.mongobrowser.SwingUtils; +import com.mebigfatguy.pickcal.PickCalDialog; import com.mongodb.BasicDBObject; /** @@ -61,6 +65,7 @@ private JTextField valueField; private JButton okButton; private JButton cancelButton; + private final DateMouseListener dateMouseListener; private boolean ok = false; /** @@ -77,6 +82,7 @@ setTitle(MongoBundle.getString(MongoBundle.Key.NewKeyValue)); initComponents(); initListeners(); + dateMouseListener = new DateMouseListener(); if (key != null) { keyField.setText(key); @@ -187,6 +193,13 @@ if (ie.getStateChange() == ItemEvent.SELECTED) { ValueType vt = (ValueType) ie.getItem(); vt.installDocument(valueField); + if (vt instanceof DateValueType) { + valueField.setEditable(false); + valueField.addMouseListener(dateMouseListener); + } else { + valueField.setEditable(true); + valueField.removeMouseListener(dateMouseListener); + } } } }); @@ -256,6 +269,7 @@ valueTypeBox.setSelectedIndex(4); ValueType vt = (ValueType) model.getElementAt(4); vt.installDocument(valueField); + valueField.setEditable(false); SimpleDateFormat sdf = new SimpleDateFormat(MongoBundle.getString(MongoBundle.Key.DateFormat)); valueField.setText(sdf.format((Date) value)); } @@ -593,4 +607,26 @@ return MongoBundle.getString(MongoBundle.Key.Object); } } + + class DateMouseListener extends MouseAdapter { + + @Override + public void mouseClicked(MouseEvent e) { + SimpleDateFormat sdf = new SimpleDateFormat(MongoBundle.getString(MongoBundle.Key.DateFormat)); + + PickCalDialog pick = new PickCalDialog(); + try { + pick.setDate(sdf.parse(valueField.getText())); + } catch (ParseException pe) { + } + + pick.setModal(true); + pick.setLocationRelativeTo(KeyValueDialog.this); + pick.setVisible(true); + if (pick.isOK()) { + Date pickedDate = pick.getDate(); + valueField.setText(sdf.format(pickedDate)); + } + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-06-24 06:10:20
|
Revision: 133 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=133&view=rev Author: dbrosius Date: 2011-06-24 06:10:13 +0000 (Fri, 24 Jun 2011) Log Message: ----------- add support for editing existing property values Modified Paths: -------------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBundle.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoTreeNode.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/resource.properties Added Paths: ----------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/EditKeyValueAction.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/DateDocument.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexDescription.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexField.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexFieldList.java Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBundle.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBundle.java 2011-06-23 03:53:16 UTC (rev 132) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBundle.java 2011-06-24 06:10:13 UTC (rev 133) @@ -44,6 +44,7 @@ ManageIndices("mongo.manageindices"), NewObject("mongo.newobject"), NewKeyValue("mongo.newkeyvalue"), + EditKeyValue("mongo.editkeyvalue"), RemoveIndex("mongo.removeindex"), AddIndex("mongo.addindex"), Key("mongo.key"), @@ -52,11 +53,15 @@ Double("mongo.double"), Float("mongo.float"), String("mongo.string"), + Date("mongo.date"), Object("mongo.object"), Delete("mongo.delete"), IndexName("mongo.indexname"), IndexFields("mongo.indexfields"), - IndexPrefix("mongo.indexprefix"); + IndexPrefix("mongo.indexprefix"), + DateRegex("mongo.dateregex"), + MonthValues("mongo.monthvalues"), + DateFormat("mongo.dateformat"); private String id; Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/EditKeyValueAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/EditKeyValueAction.java (rev 0) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/EditKeyValueAction.java 2011-06-24 06:10:13 UTC (rev 133) @@ -0,0 +1,83 @@ +/* + * mongobrowser - a webstart gui application for viewing, + * editing and administering a Mongo Database + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations + * under the License. + */ +package com.mebigfatguy.mongobrowser.actions; + +import java.awt.event.ActionEvent; + +import javax.swing.AbstractAction; +import javax.swing.JTree; + +import com.mebigfatguy.mongobrowser.MongoBundle; +import com.mebigfatguy.mongobrowser.MongoContext; +import com.mebigfatguy.mongobrowser.TreeUtils; +import com.mebigfatguy.mongobrowser.dialogs.KeyValueDialog; +import com.mebigfatguy.mongobrowser.dialogs.MongoTreeNode; +import com.mongodb.DBCollection; +import com.mongodb.DBObject; + +/** + * an action for editing a mongo object's key value pair + */ +public class EditKeyValueAction extends AbstractAction { + + private final MongoContext context; + + /** + * constructs an action to handle editing a new key/value pair + * + * @param ctxt + * the state context + */ + public EditKeyValueAction(MongoContext ctxt) { + super(MongoBundle.getString(MongoBundle.Key.EditKeyValue)); + context = ctxt; + } + + @Override + public void actionPerformed(ActionEvent e) { + JTree tree = context.getTree(); + MongoTreeNode[] selectedNodes = TreeUtils.getSelectedNodes(tree); + + if (selectedNodes.length == 1) { + + DBObject dbObject = (DBObject) ((MongoTreeNode) selectedNodes[0].getParent()).getUserObject(); + MongoTreeNode.KV keyValue = ((MongoTreeNode.KV) selectedNodes[0].getUserObject()); + + String key = keyValue.getKey(); + Object value = keyValue.getValue(); + + KeyValueDialog dialog = new KeyValueDialog(key, value); + dialog.setLocationRelativeTo(tree); + dialog.setModal(true); + dialog.setVisible(true); + + if (dialog.isOK()) { + key = dialog.getKey(); + value = dialog.getValue(); + + dbObject.put(key, value); + keyValue.setValue(value); + + MongoTreeNode collectionNode = TreeUtils.findCollectionNode(selectedNodes[0]); + DBCollection collection = (DBCollection) collectionNode.getUserObject(); + collection.save(dbObject); + } + } + } +} Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/EditKeyValueAction.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/DateDocument.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/DateDocument.java (rev 0) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/DateDocument.java 2011-06-24 06:10:13 UTC (rev 133) @@ -0,0 +1,58 @@ +/* + * mongobrowser - a webstart gui application for viewing, + * editing and administering a Mongo Database + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations + * under the License. + */ +package com.mebigfatguy.mongobrowser.dialogs; + +import java.awt.Toolkit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.swing.text.AttributeSet; +import javax.swing.text.BadLocationException; +import javax.swing.text.PlainDocument; + +import com.mebigfatguy.mongobrowser.MongoBundle; + +public class DateDocument extends PlainDocument { + + private static Pattern DATE_PATTERN = Pattern.compile(MongoBundle.getString(MongoBundle.Key.DateRegex)); + + /** + * intercepts string insertions to make sure that the values to be put into + * a text component is only a date value + * + * @param pos + * where the text is being inserted + * @param insertStr + * the new text that was typed + * @param atts + * the attributes for the text (unused) + */ + @Override + public void insertString(int pos, String insertStr, AttributeSet atts) throws BadLocationException { + StringBuilder text = new StringBuilder(getText(0, getLength())); + text.insert(pos, insertStr); + + Matcher m = DATE_PATTERN.matcher(text.toString()); + if (m.matches() || m.hitEnd()) { + super.insertString(pos, insertStr, atts); + } else { + Toolkit.getDefaultToolkit().beep(); + } + } +} Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/DateDocument.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java 2011-06-23 03:53:16 UTC (rev 132) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java 2011-06-24 06:10:13 UTC (rev 133) @@ -1,3 +1,21 @@ +/* + * mongobrowser - a webstart gui application for viewing, + * editing and administering a Mongo Database + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations + * under the License. + */ package com.mebigfatguy.mongobrowser.dialogs; import java.awt.BorderLayout; @@ -6,6 +24,11 @@ import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.swing.BorderFactory; import javax.swing.Box; @@ -44,9 +67,23 @@ * constructs a dialog to collect a key value for a mongo object's property */ public KeyValueDialog() { + this(null, null); + } + + /** + * constructs a dialog to collect a key value for a mongo object's property + */ + public KeyValueDialog(String key, Object value) { setTitle(MongoBundle.getString(MongoBundle.Key.NewKeyValue)); initComponents(); initListeners(); + + if (key != null) { + keyField.setText(key); + keyField.setEnabled(false); + installValue(value); + } + pack(); } @@ -90,6 +127,7 @@ model.addElement(new DoubleValueType()); model.addElement(new FloatValueType()); model.addElement(new StringValueType()); + model.addElement(new DateValueType()); model.addElement(new ObjectValueType()); valueTypeBox.setSelectedIndex(3); p.add(valueTypeBox, cc.xy(6, 4)); @@ -184,6 +222,47 @@ } /** + * updates the key value dialog based on the value, this is kind of crufty, + * would be nicer to handle the popup a better way + * + * @param value + * the value to set + */ + private void installValue(Object value) { + if (value != null) { + DefaultComboBoxModel model = (DefaultComboBoxModel) valueTypeBox.getModel(); + + if (value instanceof Integer) { + valueTypeBox.setSelectedIndex(0); + ValueType vt = (ValueType) model.getElementAt(0); + vt.installDocument(valueField); + valueField.setText(String.valueOf(value)); + } else if (value instanceof Double) { + valueTypeBox.setSelectedIndex(1); + ValueType vt = (ValueType) model.getElementAt(1); + vt.installDocument(valueField); + valueField.setText(String.valueOf(value)); + } else if (value instanceof Float) { + valueTypeBox.setSelectedIndex(2); + ValueType vt = (ValueType) model.getElementAt(2); + vt.installDocument(valueField); + valueField.setText(String.valueOf(value)); + } else if (value instanceof String) { + valueTypeBox.setSelectedIndex(3); + ValueType vt = (ValueType) model.getElementAt(3); + vt.installDocument(valueField); + valueField.setText((String) value); + } else if (value instanceof Date) { + valueTypeBox.setSelectedIndex(4); + ValueType vt = (ValueType) model.getElementAt(4); + vt.installDocument(valueField); + SimpleDateFormat sdf = new SimpleDateFormat(MongoBundle.getString(MongoBundle.Key.DateFormat)); + valueField.setText(sdf.format((Date) value)); + } + } + } + + /** * interface for items that are put into the Value type combobox */ interface ValueType { @@ -390,6 +469,91 @@ } /** + * a value type representing a Date object + */ + static class DateValueType implements ValueType { + + /** + * installs an PlainDocument as the field's model + * + * @param field + * the text edit field to install the model + */ + @Override + public void installDocument(JTextField field) { + try { + String val = field.getText(); + field.setText(""); + field.setDocument(new DateDocument()); + field.getDocument().insertString(0, val, null); + field.setEnabled(true); + } catch (BadLocationException ble) { + } + } + + /** + * get the field's values as an String + * + * @param field + * the component that holds the string value + * @return an Date that is the value of the text field + */ + @Override + public Object getValue(JTextField field) { + Pattern p = Pattern.compile(MongoBundle.getString(MongoBundle.Key.DateRegex)); + + Calendar c = Calendar.getInstance(); + + Matcher m = p.matcher(field.getText()); + if (m.matches() || m.hitEnd()) { + c.clear(); + + int groupCounts = m.groupCount(); + if (groupCounts > 0) { + String[] monthVals = MongoBundle.getString(MongoBundle.Key.MonthValues).split(","); + String month = m.group(1); + for (String mv : monthVals) { + if (month.startsWith(mv)) { + c.set(Calendar.MONTH, Integer.parseInt(mv.split(":")[1])); + } + } + if (groupCounts > 1) { + c.set(Calendar.DAY_OF_MONTH, Integer.parseInt(m.group(2))); + if (groupCounts > 2) { + c.set(Calendar.YEAR, Integer.parseInt(m.group(3))); + if (groupCounts > 3) { + String[] time = m.group(4).split(":"); + + if (time.length > 0) { + c.set(Calendar.HOUR_OF_DAY, Integer.parseInt(time[0])); + if (time.length > 1) { + c.set(Calendar.MINUTE, Integer.parseInt(time[1])); + if (time.length > 2) { + c.set(Calendar.SECOND, Integer.parseInt(time[2])); + } + } + } + } + } + } + } + } + + return c.getTime(); + } + + /** + * returns the display value shown in the combo box + * + * @return the string 'String' + */ + @Override + public String toString() { + return MongoBundle.getString(MongoBundle.Key.Date); + } + } + + /** * a value type representing an BasicDBObject object */ static class ObjectValueType implements ValueType { Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java 2011-06-23 03:53:16 UTC (rev 132) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java 2011-06-24 06:10:13 UTC (rev 133) @@ -40,6 +40,7 @@ import com.mebigfatguy.mongobrowser.MongoContext; import com.mebigfatguy.mongobrowser.TreeUtils; import com.mebigfatguy.mongobrowser.actions.DeleteAction; +import com.mebigfatguy.mongobrowser.actions.EditKeyValueAction; import com.mebigfatguy.mongobrowser.actions.ManageIndicesAction; import com.mebigfatguy.mongobrowser.actions.NewCollectionAction; import com.mebigfatguy.mongobrowser.actions.NewKeyValueAction; @@ -61,6 +62,7 @@ private JMenuItem newCollectionItem; private JMenuItem newObjectItem; private JMenuItem newKeyValueItem; + private JMenuItem editKeyValueItem; private JMenuItem deleteItem; /** @@ -131,6 +133,7 @@ manageIndicesItem = new JMenuItem(new ManageIndicesAction(context)); newObjectItem = new JMenuItem(new NewObjectAction(context)); newKeyValueItem = new JMenuItem(new NewKeyValueAction(context)); + editKeyValueItem = new JMenuItem(new EditKeyValueAction(context)); deleteItem = new JMenuItem(new DeleteAction(context)); } @@ -190,6 +193,9 @@ if (value instanceof DBObject) { menu.add(newKeyValueItem); needsSeparator = true; + } else { + menu.add(editKeyValueItem); + needsSeparator = true; } if (!kv.getKey().startsWith("_")) { Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoTreeNode.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoTreeNode.java 2011-06-23 03:53:16 UTC (rev 132) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoTreeNode.java 2011-06-24 06:10:13 UTC (rev 133) @@ -41,7 +41,7 @@ * holds the key value of a mongo object property */ public static class KV { - private String key; + private final String key; private Object value; public KV(String k, Object v) { @@ -57,6 +57,10 @@ return value; } + public void setValue(Object o) { + value = o; + } + @Override public String toString() { return key + " : " + value; Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexDescription.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexDescription.java (rev 0) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexDescription.java 2011-06-24 06:10:13 UTC (rev 133) @@ -0,0 +1,76 @@ +/* + * mongobrowser - a webstart gui application for viewing, + * editing and administering a Mongo Database + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations + * under the License. + */ +package com.mebigfatguy.mongobrowser.model; + +import java.io.Serializable; + +public class IndexDescription implements Comparable<IndexDescription>, Serializable { + + private static final long serialVersionUID = 1616892606319350318L; + + private String indexName; + private IndexFieldList indexFields; + + public IndexDescription(String name, IndexFieldList fields) { + indexName = name; + indexFields = fields; + } + + public String getIndexName() { + return indexName; + } + + public void setIndexName(String name) { + indexName = name; + } + + public IndexFieldList getIndexFieldList() { + return indexFields; + } + + public void setIndexFieldList(IndexFieldList fieldList) { + indexFields = fieldList; + } + + @Override + public int hashCode() { + return indexName.hashCode(); + } + + @Override + public boolean equals(Object o) { + if (o instanceof IndexDescription) { + IndexDescription that = (IndexDescription) o; + + return indexName.equals(that.indexName); + } + + return false; + } + + @Override + public int compareTo(IndexDescription o) { + return indexName.compareTo(o.indexName); + } + + @Override + public String toString() { + return indexName + "==> " + indexFields.toString(); + } +} Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexDescription.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexField.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexField.java (rev 0) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexField.java 2011-06-24 06:10:13 UTC (rev 133) @@ -0,0 +1,59 @@ +/* + * mongobrowser - a webstart gui application for viewing, + * editing and administering a Mongo Database + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations + * under the License. + */ +package com.mebigfatguy.mongobrowser.model; + +public class IndexField { + + private final String fieldName; + private final boolean ascending; + + public IndexField(String name, boolean asc) { + + fieldName = name; + ascending = asc; + } + + public String getFieldName() { + return fieldName; + } + + public boolean isAscending() { + return ascending; + } + + @Override + public int hashCode() { + return fieldName.hashCode(); + } + + @Override + public boolean equals(Object o) { + if (o instanceof IndexField) { + IndexField that = (IndexField) o; + return fieldName.equals(that.fieldName); + } + + return false; + } + + @Override + public String toString() { + return fieldName + (ascending ? ": ASC" : ": DESC"); + } +} Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexField.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexFieldList.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexFieldList.java (rev 0) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexFieldList.java 2011-06-24 06:10:13 UTC (rev 133) @@ -0,0 +1,66 @@ +/* + * mongobrowser - a webstart gui application for viewing, + * editing and administering a Mongo Database + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations + * under the License. + */ +package com.mebigfatguy.mongobrowser.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +public class IndexFieldList implements Iterable<IndexField>, Serializable { + + private static final long serialVersionUID = -2452588491740324146L; + private final List<IndexField> indexFields = new ArrayList<IndexField>(); + + public IndexFieldList() { + } + + public IndexFieldList(Collection<IndexField> fields) { + indexFields.addAll(fields); + } + + public void add(String fieldName, boolean ascending) { + IndexField indexField = new IndexField(fieldName, ascending); + int index = indexFields.indexOf(indexField); + if (index < 0) { + indexFields.add(indexField); + } else { + indexFields.set(index, indexField); + } + } + + @Override + public Iterator<IndexField> iterator() { + return indexFields.iterator(); + } + + public int size() { + return indexFields.size(); + } + + public IndexField get(int index) { + return indexFields.get(index); + } + + @Override + public String toString() { + return indexFields.toString(); + } +} Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/model/IndexFieldList.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/resource.properties =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/resource.properties 2011-06-23 03:53:16 UTC (rev 132) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/resource.properties 2011-06-24 06:10:13 UTC (rev 133) @@ -32,6 +32,7 @@ mongo.manageindices = Manage Indices... mongo.newobject = New Object mongo.newkeyvalue = New Key/Value... +mongo.editkeyvalue = Edit Key/Value... mongo.removeindex = Remove Index mongo.addindex = Add Index mongo.key = Key @@ -40,8 +41,12 @@ mongo.double = Double mongo.float = Float mongo.string = String +mongo.date = Date mongo.object = Object mongo.delete = Delete mongo.indexname = Index Name mongo.indexfields = Index Fields mongo.indexprefix = index_ +mongo.dateregex=(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\\s+([0-9]{1,2})(?:\\,)?\\s+([0-9]{4})\\s+([0-3][0-9](?::[0-6][0-9]){1,2})? +mongo.monthvalues=Jan:1,Feb:2,Mar:3,Apr:4,May:5,Jun:6,Jul:7,Aug:8,Sep:9,Oct:10,Nov:11,Dec:12 +mongo.dateformat=MMM d, yyyy HH:mm:ss \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-06-23 03:53:25
|
Revision: 132 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=132&view=rev Author: dbrosius Date: 2011-06-23 03:53:16 +0000 (Thu, 23 Jun 2011) Log Message: ----------- implement index management Modified Paths: -------------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBundle.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewKeyValueAction.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ConnectionDialog.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/resource.properties Added Paths: ----------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoConstants.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/SwingUtils.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/ManageIndicesAction.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/IndexFieldListCellEditor.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/IndexFieldListCellRenderer.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ManageIndicesDialog.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ManageIndicesModel.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoTreeCellRenderer.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/ascending.png trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/descending.png trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/index.png trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/manageindices.png Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBundle.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBundle.java 2011-06-19 07:14:41 UTC (rev 131) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBundle.java 2011-06-23 03:53:16 UTC (rev 132) @@ -29,14 +29,36 @@ * an enumeration of all the possible entries in the bundle */ public enum Key { - OK("mongo.ok"), Cancel("mongo.cancel"), Title("mongo.title"), Servers("mongo.servers"), Connect("mongo.connect"), Disconnect( - "mongo.disconnect"), ConnectToServer("mongo.connecttoserver"), Server("mongo.server"), Port( - "mongo.port"), Database("mongo.database"), NewDatabase("mongo.newdatabase"), NewCollection( - "mongo.newcollection"), NewObject("mongo.newobject"), NewKeyValue("mongo.newkeyvalue"), Key("mongo.key"), Value( - "mongo.value"), Integer("mongo.integer"), Double("mongo.double"), Float("mongo.float"), String( - "mongo.string"), Object("mongo.object"), Delete("mongo.delete"); + OK("mongo.ok"), + Cancel("mongo.cancel"), + Title("mongo.title"), + Servers("mongo.servers"), + Connect("mongo.connect"), + Disconnect("mongo.disconnect"), + ConnectToServer("mongo.connecttoserver"), + Server("mongo.server"), + Port("mongo.port"), + Database("mongo.database"), + NewDatabase("mongo.newdatabase"), + NewCollection("mongo.newcollection"), + ManageIndices("mongo.manageindices"), + NewObject("mongo.newobject"), + NewKeyValue("mongo.newkeyvalue"), + RemoveIndex("mongo.removeindex"), + AddIndex("mongo.addindex"), + Key("mongo.key"), + Value("mongo.value"), + Integer("mongo.integer"), + Double("mongo.double"), + Float("mongo.float"), + String("mongo.string"), + Object("mongo.object"), + Delete("mongo.delete"), + IndexName("mongo.indexname"), + IndexFields("mongo.indexfields"), + IndexPrefix("mongo.indexprefix"); - String id; + private String id; /** * creates a key given the properties file name Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoConstants.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoConstants.java (rev 0) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoConstants.java 2011-06-23 03:53:16 UTC (rev 132) @@ -0,0 +1,32 @@ +/* + * mongobrowser - a webstart gui application for viewing, + * editing and administering a Mongo Database + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations + * under the License. + */ +package com.mebigfatguy.mongobrowser; + +public class MongoConstants { + + public static final String NAME = "name"; + public static final String KEY = "key"; + public static final Integer ASCENDING = Integer.valueOf(1); + public static final Integer DESCENDING = Integer.valueOf(-1); + public static final String ID_INDEX = "_id_"; + public static final String SYSTEM_PREFIX = "system."; + + private MongoConstants() { + } +} Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoConstants.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mimetype + text/plain Added: svn:eol-style + native Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/SwingUtils.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/SwingUtils.java (rev 0) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/SwingUtils.java 2011-06-23 03:53:16 UTC (rev 132) @@ -0,0 +1,60 @@ +/* + * mongobrowser - a webstart gui application for viewing, + * editing and administering a Mongo Database + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations + * under the License. + */ +package com.mebigfatguy.mongobrowser; + +import java.awt.Dimension; + +import javax.swing.JComponent; + +public class SwingUtils { + + private SwingUtils() { + } + + public static void sizeUniformly(JComponent... components) { + + for (JComponent c : components) { + c.setPreferredSize(null); + c.setMinimumSize(null); + c.setMaximumSize(null); + } + + int width = 0; + int height = 0; + + for (JComponent c : components) { + Dimension d = c.getPreferredSize(); + if (d.width > width) { + width = d.width; + } + if (d.height > height) { + height = d.height; + } + } + + for (JComponent c : components) { + Dimension d = c.getPreferredSize(); + d.width = width; + d.height = height; + c.setPreferredSize(d); + c.setMinimumSize(d); + c.setMaximumSize(d); + } + } +} Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/SwingUtils.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mimetype + text/plain Added: svn:eol-style + native Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/ManageIndicesAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/ManageIndicesAction.java (rev 0) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/ManageIndicesAction.java 2011-06-23 03:53:16 UTC (rev 132) @@ -0,0 +1,106 @@ +/* + * mongobrowser - a webstart gui application for viewing, + * editing and administering a Mongo Database + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations + * under the License. + */ +package com.mebigfatguy.mongobrowser.actions; + +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.swing.AbstractAction; +import javax.swing.JTree; + +import com.mebigfatguy.mongobrowser.MongoBundle; +import com.mebigfatguy.mongobrowser.MongoConstants; +import com.mebigfatguy.mongobrowser.MongoContext; +import com.mebigfatguy.mongobrowser.dialogs.ManageIndicesDialog; +import com.mebigfatguy.mongobrowser.dialogs.MongoTreeNode; +import com.mebigfatguy.mongobrowser.model.IndexDescription; +import com.mebigfatguy.mongobrowser.model.IndexField; +import com.mebigfatguy.mongobrowser.model.IndexFieldList; +import com.mongodb.BasicDBObject; +import com.mongodb.DBCollection; +import com.mongodb.DBObject; + +public class ManageIndicesAction extends AbstractAction { + + private static final long serialVersionUID = 554299884297317739L; + private final MongoContext context; + + public ManageIndicesAction(MongoContext ctxt) { + super(MongoBundle.getString(MongoBundle.Key.ManageIndices)); + context = ctxt; + } + + @Override + public void actionPerformed(ActionEvent e) { + JTree tree = context.getTree(); + + MongoTreeNode[] nodes = context.getSelectedNodes(); + DBCollection collection = (DBCollection) nodes[0].getUserObject(); + List<IndexDescription> indices = buildIndexDescriptions(collection); + + ManageIndicesDialog dialog = new ManageIndicesDialog(indices); + dialog.setLocationRelativeTo(tree); + dialog.setModal(true); + dialog.setVisible(true); + + if (dialog.isOK()) { + indices = dialog.getIndicesNames(); + updateIndices(collection, indices); + } + } + + private List<IndexDescription> buildIndexDescriptions(DBCollection collection) { + List<IndexDescription> indices = new ArrayList<IndexDescription>(); + List<DBObject> dbIndices = collection.getIndexInfo(); + for (DBObject dbIndex : dbIndices) { + String name = (String) dbIndex.get(MongoConstants.NAME); + Map<String, Integer> srcFields = (Map<String, Integer>) dbIndex.get(MongoConstants.KEY); + IndexFieldList fieldSet = new IndexFieldList(); + + for (Map.Entry<String, Integer> entry : srcFields.entrySet()) { + fieldSet.add(entry.getKey(), MongoConstants.ASCENDING.equals(entry.getValue())); + } + + indices.add(new IndexDescription(name, fieldSet)); + } + + return indices; + } + + private void updateIndices(DBCollection collection, List<IndexDescription> indices) { + + collection.dropIndexes(); + + for (IndexDescription index : indices) { + if (!MongoConstants.ID_INDEX.equals(index.getIndexName())) { + + BasicDBObject dbFields = new BasicDBObject(); + IndexFieldList fieldList = index.getIndexFieldList(); + + for (IndexField field : fieldList) { + dbFields.append(field.getFieldName(), Integer.valueOf(field.isAscending() ? 1 : -1)); + } + + collection.ensureIndex(dbFields, index.getIndexName()); + } + } + } +} Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/ManageIndicesAction.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mimetype + text/plain Added: svn:eol-style + native Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewKeyValueAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewKeyValueAction.java 2011-06-19 07:14:41 UTC (rev 131) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewKeyValueAction.java 2011-06-23 03:53:16 UTC (rev 132) @@ -41,6 +41,12 @@ private static final long serialVersionUID = -500965537578361564L; private final MongoContext context; + /** + * constructs an action to handle creating a new key/value pair + * + * @param ctxt + * the state context + */ public NewKeyValueAction(MongoContext ctxt) { super(MongoBundle.getString(MongoBundle.Key.NewKeyValue)); context = ctxt; Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ConnectionDialog.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ConnectionDialog.java 2011-06-19 07:14:41 UTC (rev 131) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ConnectionDialog.java 2011-06-23 03:53:16 UTC (rev 132) @@ -35,6 +35,7 @@ import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.FormLayout; import com.mebigfatguy.mongobrowser.MongoBundle; +import com.mebigfatguy.mongobrowser.SwingUtils; /** * a dialog for requesting server and port information for a mongo server @@ -119,6 +120,8 @@ p.add(cancelButton); p.add(Box.createHorizontalStrut(10)); + SwingUtils.sizeUniformly(okButton, cancelButton); + return p; } Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/IndexFieldListCellEditor.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/IndexFieldListCellEditor.java (rev 0) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/IndexFieldListCellEditor.java 2011-06-23 03:53:16 UTC (rev 132) @@ -0,0 +1,164 @@ +/* + * mongobrowser - a webstart gui application for viewing, + * editing and administering a Mongo Database + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations + * under the License. + */ +package com.mebigfatguy.mongobrowser.dialogs; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.AbstractCellEditor; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.table.TableCellEditor; + +import com.mebigfatguy.mongobrowser.model.IndexField; +import com.mebigfatguy.mongobrowser.model.IndexFieldList; + +/** + * a cell editor for a set of fields/directions for an index + */ +public class IndexFieldListCellEditor extends AbstractCellEditor implements TableCellEditor { + + private static final long serialVersionUID = 3996145084996105628L; + + private static final Icon ASCENDING = new ImageIcon( + IndexFieldListCellEditor.class.getResource("/com/mebigfatguy/mongobrowser/resources/ascending.png")); + private static final Icon DESCENDING = new ImageIcon( + IndexFieldListCellEditor.class.getResource("/com/mebigfatguy/mongobrowser/resources/descending.png")); + + private final JPanel panel = new JPanel(); + private final List<FieldControl> controls = new ArrayList<FieldControl>(); + + public IndexFieldListCellEditor() { + panel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 0)); + panel.setOpaque(true); + } + + @Override + public Object getCellEditorValue() { + IndexFieldList fieldList = new IndexFieldList(); + + for (FieldControl control : controls) { + String fieldName = control.nameField.getText().trim(); + + if (!fieldName.isEmpty()) { + fieldList.add(fieldName, control.directionButton.getIcon().equals(ASCENDING)); + } + } + + return fieldList; + + } + + @Override + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + + panel.removeAll(); + panel.setFont(table.getFont()); + + if (isSelected) { + panel.setBackground(table.getSelectionBackground()); + panel.setForeground(table.getSelectionForeground()); + } else { + panel.setBackground(table.getBackground()); + panel.setForeground(table.getForeground()); + } + + if (value instanceof IndexFieldList) { + IndexFieldList fields = (IndexFieldList) value; + + for (FieldControl control : controls) { + control.nameField.setText(""); + } + + for (int i = 0; i < fields.size(); i++) { + if (controls.size() <= i) { + controls.add(new FieldControl()); + } + + IndexField field = fields.get(i); + FieldControl control = controls.get(i); + control.nameField.setFont(table.getFont()); + control.nameField.setText(field.getFieldName()); + control.setAscending(field.isAscending()); + panel.add(control.nameField); + panel.add(control.directionButton); + } + + if (controls.size() <= fields.size()) { + controls.add(new FieldControl()); + } + + FieldControl control = controls.get(fields.size()); + control.nameField.setFont(table.getFont()); + control.nameField.setText(""); + control.setAscending(true); + panel.add(control.nameField); + panel.add(control.directionButton); + } + + return panel; + } + + /** + * holds one set of controls for a index field, a name and direction + * indicator + * + */ + static class FieldControl { + private final JTextField nameField = new JTextField(5); + private final JButton directionButton = new JButton(); + private boolean isAscending = true; + + /** + * constructs the controls for one index field + */ + public FieldControl() { + directionButton.setPreferredSize(new Dimension(ASCENDING.getIconWidth(), ASCENDING.getIconHeight())); + directionButton.setBorderPainted(false); + directionButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + setAscending(!isAscending); + } + + }); + } + + /** + * set the direction of the index on this field + * + * @param ascending + * either ascending or descending + */ + public void setAscending(boolean ascending) { + directionButton.setIcon(ascending ? ASCENDING : DESCENDING); + isAscending = ascending; + } + } +} Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/IndexFieldListCellEditor.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mimetype + text/plain Added: svn:eol-style + native Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/IndexFieldListCellRenderer.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/IndexFieldListCellRenderer.java (rev 0) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/IndexFieldListCellRenderer.java 2011-06-23 03:53:16 UTC (rev 132) @@ -0,0 +1,98 @@ +/* + * mongobrowser - a webstart gui application for viewing, + * editing and administering a Mongo Database + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations + * under the License. + */ +package com.mebigfatguy.mongobrowser.dialogs; + +import java.awt.Component; +import java.awt.FlowLayout; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.SwingConstants; +import javax.swing.table.TableCellRenderer; + +import sun.swing.DefaultLookup; + +import com.mebigfatguy.mongobrowser.model.IndexField; +import com.mebigfatguy.mongobrowser.model.IndexFieldList; + +public class IndexFieldListCellRenderer extends JPanel implements TableCellRenderer { + + private static final long serialVersionUID = 1447611436027408402L; + + private static final Icon ASCENDING = new ImageIcon( + IndexFieldListCellRenderer.class.getResource("/com/mebigfatguy/mongobrowser/resources/ascending.png")); + private static final Icon DESCENDING = new ImageIcon( + IndexFieldListCellRenderer.class.getResource("/com/mebigfatguy/mongobrowser/resources/descending.png")); + + private final List<JLabel> fieldLabels = new ArrayList<JLabel>(); + + public IndexFieldListCellRenderer() { + setLayout(new FlowLayout(FlowLayout.CENTER, 2, 0)); + setOpaque(true); + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, + int row, int column) { + + removeAll(); + setFont(table.getFont()); + + if (isSelected) { + setBackground(table.getSelectionBackground()); + setForeground(table.getSelectionForeground()); + } else { + setBackground(table.getBackground()); + setForeground(table.getForeground()); + } + + if (hasFocus) { + setBorder(isSelected ? DefaultLookup.getBorder(this, ui, "Table.focusSelectedCellHighlightBorder") + : DefaultLookup.getBorder(this, ui, "Table.focusCellHighlightBorder")); + } else { + setBorder(DefaultLookup.getBorder(this, ui, "Table.cellNoFocusBorder")); + } + + if (value instanceof IndexFieldList) { + IndexFieldList fields = (IndexFieldList) value; + + for (int i = 0; i < fields.size(); i++) { + if (fieldLabels.size() <= i) { + JLabel l = new JLabel(); + fieldLabels.add(l); + l.setHorizontalTextPosition(SwingConstants.LEFT); + l.setVerticalTextPosition(SwingConstants.CENTER); + } + + JLabel l = fieldLabels.get(i); + l.setFont(table.getFont()); + IndexField field = fields.get(i); + l.setText(field.getFieldName()); + l.setIcon(field.isAscending() ? ASCENDING : DESCENDING); + add(l); + } + } + return this; + } +} Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/IndexFieldListCellRenderer.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mimetype + text/plain Added: svn:eol-style + native Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java 2011-06-19 07:14:41 UTC (rev 131) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java 2011-06-23 03:53:16 UTC (rev 132) @@ -23,6 +23,7 @@ import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.FormLayout; import com.mebigfatguy.mongobrowser.MongoBundle; +import com.mebigfatguy.mongobrowser.SwingUtils; import com.mongodb.BasicDBObject; /** @@ -117,6 +118,8 @@ p.add(cancelButton); p.add(Box.createHorizontalStrut(10)); + SwingUtils.sizeUniformly(okButton, cancelButton); + return p; } Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ManageIndicesDialog.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ManageIndicesDialog.java (rev 0) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ManageIndicesDialog.java 2011-06-23 03:53:16 UTC (rev 132) @@ -0,0 +1,192 @@ +/* + * mongobrowser - a webstart gui application for viewing, + * editing and administering a Mongo Database + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations + * under the License. + */ +package com.mebigfatguy.mongobrowser.dialogs; + +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.List; + +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.DefaultCellEditor; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextField; + +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import com.mebigfatguy.mongobrowser.MongoBundle; +import com.mebigfatguy.mongobrowser.SwingUtils; +import com.mebigfatguy.mongobrowser.model.IndexDescription; +import com.mebigfatguy.mongobrowser.model.IndexFieldList; + +public class ManageIndicesDialog extends JDialog { + + private static final long serialVersionUID = -4263800895451732866L; + private static int INDEX_SEQ = 1; + + private JTable indicesTable; + private JButton addIndexButton; + private JButton removeIndexButton; + private JButton okButton; + private JButton cancelButton; + private boolean ok = false; + + public ManageIndicesDialog(List<IndexDescription> indices) { + setTitle(MongoBundle.getString(MongoBundle.Key.ManageIndices)); + initComponents(indices); + initListeners(); + pack(); + } + + /** + * did the user click ok + * + * @return if the user clicked ok + */ + public boolean isOK() { + return ok; + } + + public List<IndexDescription> getIndicesNames() { + + ManageIndicesModel model = (ManageIndicesModel) indicesTable.getModel(); + return model.getIndices(); + } + + private void initComponents(List<IndexDescription> indices) { + Container cp = getContentPane(); + cp.setLayout(new BorderLayout(4, 4)); + cp.add(createIndicesListPanel(indices), BorderLayout.CENTER); + cp.add(createCtrlPanel(), BorderLayout.SOUTH); + + SwingUtils.sizeUniformly(okButton, cancelButton, addIndexButton, removeIndexButton); + } + + private void initListeners() { + okButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent ae) { + ok = true; + dispose(); + } + }); + + cancelButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent ae) { + dispose(); + } + }); + + addIndexButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + String indexName = createUniqueIndexName(); + IndexDescription index = new IndexDescription(indexName, new IndexFieldList()); + ManageIndicesModel model = (ManageIndicesModel) indicesTable.getModel(); + model.add(index); + } + }); + + removeIndexButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + ManageIndicesModel model = (ManageIndicesModel) indicesTable.getModel(); + int[] selRows = indicesTable.getSelectedRows(); + for (int i = selRows.length - 1; i >= 0; i--) { + model.removeAt(selRows[i]); + } + } + }); + } + + private JPanel createIndicesListPanel(List<IndexDescription> indices) { + JPanel p = new JPanel(); + p.setLayout(new FormLayout("6dlu, pref:grow, 5dlu, pref, 6dlu", + "6dlu, 12dlu:grow, pref, 3dlu, pref, 12dlu:grow, 6dlu, pref, 6dlu")); + CellConstraints cc = new CellConstraints(); + + ManageIndicesModel model = new ManageIndicesModel(indices); + + indicesTable = new JTable(model); + indicesTable.setDefaultEditor(String.class, new DefaultCellEditor(new JTextField())); + indicesTable.setDefaultEditor(IndexFieldList.class, new IndexFieldListCellEditor()); + indicesTable.setDefaultRenderer(IndexFieldList.class, new IndexFieldListCellRenderer()); + p.add(new JScrollPane(indicesTable), cc.xywh(2, 2, 1, 5)); + + addIndexButton = new JButton(MongoBundle.getString(MongoBundle.Key.AddIndex)); + p.add(addIndexButton, cc.xy(4, 3)); + + removeIndexButton = new JButton(MongoBundle.getString(MongoBundle.Key.RemoveIndex)); + p.add(removeIndexButton, cc.xy(4, 5)); + + return p; + } + + /** + * creates a panel holding the ok and cancel buttons + * + * @return the ok/cancel button panel + */ + private JPanel createCtrlPanel() { + JPanel p = new JPanel(); + p.setBorder(BorderFactory.createEmptyBorder(20, 0, 10, 0)); + p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); + p.add(Box.createHorizontalGlue()); + + okButton = new JButton(MongoBundle.getString(MongoBundle.Key.OK)); + p.add(okButton); + p.add(Box.createHorizontalStrut(10)); + + cancelButton = new JButton(MongoBundle.getString(MongoBundle.Key.Cancel)); + p.add(cancelButton); + p.add(Box.createHorizontalStrut(10)); + + return p; + } + + private String createUniqueIndexName() { + String name = null; + do { + name = MongoBundle.getString(MongoBundle.Key.IndexPrefix) + INDEX_SEQ++; + } while (indexExists(name)); + + return name; + } + + private boolean indexExists(String name) { + ManageIndicesModel model = (ManageIndicesModel) indicesTable.getModel(); + for (int i = 0; i < model.getRowCount(); i++) { + if (name.equals(model.getValueAt(i, 0))) { + return true; + } + } + + return false; + } +} Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ManageIndicesDialog.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mimetype + text/plain Added: svn:eol-style + native Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ManageIndicesModel.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ManageIndicesModel.java (rev 0) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ManageIndicesModel.java 2011-06-23 03:53:16 UTC (rev 132) @@ -0,0 +1,126 @@ +/* + * mongobrowser - a webstart gui application for viewing, + * editing and administering a Mongo Database + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations + * under the License. + */ +package com.mebigfatguy.mongobrowser.dialogs; + +import java.util.List; + +import javax.swing.table.AbstractTableModel; + +import com.mebigfatguy.mongobrowser.MongoBundle; +import com.mebigfatguy.mongobrowser.MongoConstants; +import com.mebigfatguy.mongobrowser.model.IndexDescription; +import com.mebigfatguy.mongobrowser.model.IndexFieldList; + +public class ManageIndicesModel extends AbstractTableModel { + + private static final long serialVersionUID = 2062960191211526719L; + + private final List<IndexDescription> indices; + + public ManageIndicesModel(List<IndexDescription> indexInfo) { + indices = indexInfo; + } + + public List<IndexDescription> getIndices() { + return indices; + } + + public void add(IndexDescription index) { + indices.add(index); + fireTableRowsInserted(indices.size() - 1, indices.size() - 1); + } + + public void removeAt(int index) { + indices.remove(index); + fireTableRowsDeleted(index, index); + } + + @Override + public int getRowCount() { + return indices.size(); + } + + @Override + public int getColumnCount() { + return 2; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + IndexDescription index = indices.get(rowIndex); + switch (columnIndex) { + case 0: + return index.getIndexName(); + case 1: + return index.getIndexFieldList(); + default: + throw new IllegalArgumentException("columnIndex = " + columnIndex); + } + } + + @Override + public void setValueAt(Object value, int rowIndex, int columnIndex) { + IndexDescription index = indices.get(rowIndex); + switch (columnIndex) { + case 0: + index.setIndexName((String) value); + break; + case 1: + index.setIndexFieldList((IndexFieldList) value); + break; + default: + throw new IllegalArgumentException("columnIndex = " + columnIndex); + } + + fireTableCellUpdated(rowIndex, columnIndex); + } + + @Override + public String getColumnName(int columnIndex) { + switch (columnIndex) { + case 0: + return MongoBundle.getString(MongoBundle.Key.IndexName); + case 1: + return MongoBundle.getString(MongoBundle.Key.IndexFields); + default: + throw new IllegalArgumentException("columnIndex = " + columnIndex); + } + } + + @Override + public Class<?> getColumnClass(int columnIndex) { + switch (columnIndex) { + case 0: + return String.class; + case 1: + return IndexFieldList.class; + default: + throw new IllegalArgumentException("columnIndex = " + columnIndex); + } + } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + String name = (String) getValueAt(rowIndex, 0); + if (MongoConstants.ID_INDEX.equals(name)) { + return false; + } + return (columnIndex == 0) || (columnIndex == 1); + } +} Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ManageIndicesModel.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mimetype + text/plain Added: svn:eol-style + native Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java 2011-06-19 07:14:41 UTC (rev 131) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java 2011-06-23 03:53:16 UTC (rev 132) @@ -43,6 +43,7 @@ import com.mebigfatguy.mongobrowser.MongoBundle; import com.mebigfatguy.mongobrowser.MongoContext; import com.mebigfatguy.mongobrowser.actions.DeleteAction; +import com.mebigfatguy.mongobrowser.actions.ManageIndicesAction; import com.mebigfatguy.mongobrowser.actions.NewCollectionAction; import com.mebigfatguy.mongobrowser.actions.NewKeyValueAction; import com.mebigfatguy.mongobrowser.actions.NewObjectAction; @@ -58,6 +59,7 @@ private final MongoContext context; private JComboBox dbComboBox; private JButton dbNewCollectionButton; + private JButton dbManageIndicesButton; private JButton dbNewObjectButton; private JButton dbNewKeyValueButton; private JButton dbDeleteButton; @@ -120,11 +122,13 @@ public void adjustEnabled(MongoTreeNode... selectedNodes) { if ((selectedNodes == null) || (selectedNodes.length == 0)) { dbNewCollectionButton.setEnabled(true); + dbManageIndicesButton.setEnabled(false); dbNewObjectButton.setEnabled(false); dbNewKeyValueButton.setEnabled(false); dbDeleteButton.setEnabled(false); } else { + boolean canDoManageIndices = selectedNodes.length == 1; boolean canDoNewObject = true; boolean canDoNewKeyValue = true; boolean canDoDelete = true; @@ -137,12 +141,14 @@ break; case Object: + canDoManageIndices = false; canDoNewObject = false; break; case KeyValue: MongoTreeNode.KV kv = (MongoTreeNode.KV) selectedNode.getUserObject(); Object value = kv.getValue(); + canDoManageIndices = false; canDoNewObject = false; canDoNewKeyValue = value instanceof DBObject; canDoDelete = !kv.getKey().startsWith("_"); @@ -150,6 +156,7 @@ } if (selectedNode.isReadOnly()) { + canDoManageIndices = false; canDoNewObject = false; canDoNewKeyValue = false; canDoDelete = false; @@ -157,6 +164,7 @@ } dbNewCollectionButton.setEnabled(true); + dbManageIndicesButton.setEnabled(true); dbNewObjectButton.setEnabled(canDoNewObject); dbNewKeyValueButton.setEnabled(canDoNewKeyValue); dbDeleteButton.setEnabled(canDoDelete); @@ -184,7 +192,8 @@ private void initComponents() { setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK), BorderFactory.createEmptyBorder(5, 5, 5, 5))); - setLayout(new FormLayout("3dlu, pref, 1dlu, 200px:grow, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref", "pref")); + setLayout(new FormLayout( + "3dlu, pref, 1dlu, 200px:grow, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref", "pref")); CellConstraints cc = new CellConstraints(); JLabel dbLabel = new JLabel(MongoBundle.getString(MongoBundle.Key.Database)); @@ -204,6 +213,16 @@ add(dbNewCollectionButton, cc.xy(6, 1)); dbNewCollectionButton.setEnabled(false); + dbManageIndicesButton = new JButton(new ManageIndicesAction(context)); + icon = new ImageIcon( + MongoControlPanel.class.getResource("/com/mebigfatguy/mongobrowser/resources/manageindices.png")); + dbManageIndicesButton.setIcon(icon); + dbManageIndicesButton.setText(""); + dbManageIndicesButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight())); + dbManageIndicesButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.ManageIndices)); + add(dbManageIndicesButton, cc.xy(8, 1)); + dbManageIndicesButton.setEnabled(false); + dbNewObjectButton = new JButton(new NewObjectAction(context)); icon = new ImageIcon( MongoControlPanel.class.getResource("/com/mebigfatguy/mongobrowser/resources/newobject.png")); @@ -211,7 +230,7 @@ dbNewObjectButton.setText(""); dbNewObjectButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight())); dbNewObjectButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.NewObject)); - add(dbNewObjectButton, cc.xy(8, 1)); + add(dbNewObjectButton, cc.xy(10, 1)); dbNewObjectButton.setEnabled(false); dbNewKeyValueButton = new JButton(new NewKeyValueAction(context)); @@ -221,7 +240,7 @@ dbNewKeyValueButton.setText(""); dbNewKeyValueButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight())); dbNewKeyValueButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.NewKeyValue)); - add(dbNewKeyValueButton, cc.xy(10, 1)); + add(dbNewKeyValueButton, cc.xy(12, 1)); dbNewKeyValueButton.setEnabled(false); dbDeleteButton = new JButton(new DeleteAction(context)); @@ -230,7 +249,7 @@ dbDeleteButton.setText(null); dbDeleteButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight())); dbDeleteButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.Delete)); - add(dbDeleteButton, cc.xy(12, 1)); + add(dbDeleteButton, cc.xy(14, 1)); dbDeleteButton.setEnabled(false); } Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java 2011-06-19 07:14:41 UTC (rev 131) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java 2011-06-23 03:53:16 UTC (rev 132) @@ -36,9 +36,11 @@ import javax.swing.tree.ExpandVetoException; import javax.swing.tree.TreePath; +import com.mebigfatguy.mongobrowser.MongoConstants; import com.mebigfatguy.mongobrowser.MongoContext; import com.mebigfatguy.mongobrowser.TreeUtils; import com.mebigfatguy.mongobrowser.actions.DeleteAction; +import com.mebigfatguy.mongobrowser.actions.ManageIndicesAction; import com.mebigfatguy.mongobrowser.actions.NewCollectionAction; import com.mebigfatguy.mongobrowser.actions.NewKeyValueAction; import com.mebigfatguy.mongobrowser.actions.NewObjectAction; @@ -55,6 +57,7 @@ private static final long serialVersionUID = 1579613544693305078L; private final MongoContext context; private JTree tree; + private JMenuItem manageIndicesItem; private JMenuItem newCollectionItem; private JMenuItem newObjectItem; private JMenuItem newKeyValueItem; @@ -85,7 +88,7 @@ Set<String> collectionNames = db.getCollectionNames(); for (String collectionName : collectionNames) { DBCollection collection = db.getCollection(collectionName); - boolean readOnly = collectionName.startsWith("system."); + boolean readOnly = collectionName.startsWith(MongoConstants.SYSTEM_PREFIX); MongoTreeNode col = new MongoTreeNode(collection, readOnly); root.add(col); MongoTreeNode slug = new MongoTreeNode(); @@ -125,6 +128,7 @@ context.setTree(tree); newCollectionItem = new JMenuItem(new NewCollectionAction(context)); + manageIndicesItem = new JMenuItem(new ManageIndicesAction(context)); newObjectItem = new JMenuItem(new NewObjectAction(context)); newKeyValueItem = new JMenuItem(new NewKeyValueAction(context)); deleteItem = new JMenuItem(new DeleteAction(context)); @@ -167,6 +171,7 @@ context.setSelectedNodes(node); if (node.getType() == MongoTreeNode.Type.Collection) { if (!node.isReadOnly()) { + menu.add(manageIndicesItem); menu.add(newObjectItem); menu.show(tree, x, y); } Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoTreeCellRenderer.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoTreeCellRenderer.java (rev 0) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoTreeCellRenderer.java 2011-06-23 03:53:16 UTC (rev 132) @@ -0,0 +1,89 @@ +/* + * mongobrowser - a webstart gui application for viewing, + * editing and administering a Mongo Database + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations + * under the License. + */ +package com.mebigfatguy.mongobrowser.dialogs; + +import java.awt.Component; +import java.util.List; + +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JLabel; +import javax.swing.JTree; +import javax.swing.tree.DefaultTreeCellRenderer; + +import com.mebigfatguy.mongobrowser.MongoConstants; +import com.mebigfatguy.mongobrowser.dialogs.MongoTreeNode.KV; +import com.mebigfatguy.mongobrowser.dialogs.MongoTreeNode.Type; +import com.mongodb.BasicDBObject; +import com.mongodb.DBCollection; +import com.mongodb.DBObject; + +/** + * a table cell renderer for showing the list of fields that an index controls + */ +public class MongoTreeCellRenderer extends DefaultTreeCellRenderer { + + private static final long serialVersionUID = -5461207993315946236L; + private final Icon indexIcon; + + /** + * constructs a renderer for the list of fields of an index + */ + public MongoTreeCellRenderer() { + indexIcon = new ImageIcon(getClass().getResource("/com/mebigfatguy/mongobrowser/resources/index.png")); + } + + @Override + public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, + boolean leaf, int row, boolean hasFocus) { + + MongoTreeNode treeNode = (MongoTreeNode) value; + + JLabel label = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); + label.setHorizontalTextPosition(JLabel.RIGHT); + label.setVerticalTextPosition(JLabel.CENTER); + + label.setIcon(null); + + if (treeNode.getType() == Type.KeyValue) { + MongoTreeNode parentTreeNode = treeNode; + + do { + parentTreeNode = (MongoTreeNode) parentTreeNode.getParent(); + } while ((parentTreeNode != null) && (parentTreeNode.getType() != Type.Collection)); + + if (parentTreeNode != null) { + + DBCollection collection = (DBCollection) parentTreeNode.getUserObject(); + List<DBObject> indices = collection.getIndexInfo(); + String key = ((KV) treeNode.getUserObject()).getKey(); + + for (DBObject index : indices) { + BasicDBObject kvIndex = (BasicDBObject) index.get(MongoConstants.KEY); + if (kvIndex.get(key) != null) { + label.setIcon(indexIcon); + break; + } + } + } + } + + return label; + } +} Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoTreeCellRenderer.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mimetype + text/plain Added: svn:eol-style + native Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/ascending.png =================================================================== (Binary files differ) Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/ascending.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/descending.png =================================================================== (Binary files differ) Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/descending.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/index.png =================================================================== (Binary files differ) Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/index.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/manageindices.png =================================================================== (Binary files differ) Property changes on: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/manageindices.png ___________________________________________________________________ Added: svn:mime-type + image/png Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/resource.properties =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/resource.properties 2011-06-19 07:14:41 UTC (rev 131) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/resource.properties 2011-06-23 03:53:16 UTC (rev 132) @@ -29,8 +29,11 @@ mongo.database = Database mongo.newdatabase = New Database... mongo.newcollection = New Collection... -mongo.newobject = New Object... +mongo.manageindices = Manage Indices... +mongo.newobject = New Object mongo.newkeyvalue = New Key/Value... +mongo.removeindex = Remove Index +mongo.addindex = Add Index mongo.key = Key mongo.value = Value mongo.integer = Integer @@ -39,3 +42,6 @@ mongo.string = String mongo.object = Object mongo.delete = Delete +mongo.indexname = Index Name +mongo.indexfields = Index Fields +mongo.indexprefix = index_ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-06-19 07:14:50
|
Revision: 131 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=131&view=rev Author: dbrosius Date: 2011-06-19 07:14:41 +0000 (Sun, 19 Jun 2011) Log Message: ----------- periodic checkin from git Modified Paths: -------------- trunk/mongobrowser/.classpath trunk/mongobrowser/.gitignore trunk/mongobrowser/build.xml trunk/mongobrowser/etc/mongobrowser.jnlp trunk/mongobrowser/mongobrowser.fb trunk/mongobrowser/mongobrowser.store trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBrowser.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBundle.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoContext.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/TreeUtils.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/ConnectAction.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DeleteAction.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DisconnectAction.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewCollectionAction.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewKeyValueAction.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewObjectAction.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ConnectionDialog.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/DoubleDocument.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/FloatDocument.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/IntegerDocument.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoBrowserFrame.java 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/MongoPanel.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoTreeNode.java trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/resources/resource.properties Modified: trunk/mongobrowser/.classpath =================================================================== --- trunk/mongobrowser/.classpath 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/.classpath 2011-06-19 07:14:41 UTC (rev 131) @@ -4,6 +4,6 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="lib" path="lib/forms-1.2.1.jar"/> <classpathentry kind="lib" path="lib/commons-io-1.3.2.jar"/> - <classpathentry kind="lib" path="lib/mongo-java-driver-1.2.jar"/> + <classpathentry kind="lib" path="lib/mongo-java-driver-2.6.2.jar"/> <classpathentry kind="output" path="classes"/> </classpath> Modified: trunk/mongobrowser/.gitignore =================================================================== --- trunk/mongobrowser/.gitignore 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/.gitignore 2011-06-19 07:14:41 UTC (rev 131) @@ -8,3 +8,4 @@ .settings javadoc jnlp +/lib Modified: trunk/mongobrowser/build.xml =================================================================== --- trunk/mongobrowser/build.xml 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/build.xml 2011-06-19 07:14:41 UTC (rev 131) @@ -2,8 +2,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,10 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> + <property name="forms.version" value="1.2.1"/> + <property name="mongo-java-driver.version" value="2.6.2"/> + <property name="commons-io.version" value="1.3.2"/> + <property name="mongobrowser.version" value="0.1.0"/> <target name="clean" description="removes all generated collateral"> @@ -55,38 +59,38 @@ <mkdir dir="${classes.dir}"/> <mkdir dir="${javadoc.dir}"/> <path id="mongobrowser.classpath"> - <pathelement location="${lib.dir}/mongo-java-driver-1.2.jar"/> - <pathelement location="${lib.dir}/forms-1.2.1.jar"/> - <pathelement location="${lib.dir}/commons-io-2.3.2.jar"/> + <pathelement location="${lib.dir}/mongo-java-driver-${mongo-java-driver.version}.jar"/> + <pathelement location="${lib.dir}/forms-${forms.version}.jar"/> + <pathelement location="${lib.dir}/commons-io-${commons-io.version}.jar"/> </path> </target> - <property name="forms_url" value="http://repo1.maven.org/maven2/com/jgoodies/forms/1.2.1/forms-1.2.1.jar"/> - <property name="mongodriver_url" value="http://repo1.maven.org/maven2/org/mongodb/mongo-java-driver/1.2/mongo-java-driver-1.2.jar"/> - <property name="commonsio_url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2.jar"/> + <property name="forms_url" value="http://repo1.maven.org/maven2/com/jgoodies/forms/${forms.version}/forms-${forms.version}.jar"/> + <property name="mongodriver_url" value="http://repo1.maven.org/maven2/org/mongodb/mongo-java-driver/${mongo-java-driver.version}/mongo-java-driver-${mongo-java-driver.version}.jar"/> + <property name="commonsio_url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-io/${commons-io.version}/commons-io-${commons-io.version}.jar"/> <target name="forms_check"> - <available file="${basedir}/lib/forms-1.2.1.jar" property="forms_exists"/> + <available file="${basedir}/lib/forms-${forms.version}.jar" property="forms_exists"/> </target> <target name="mongodriver_check"> - <available file="${basedir}/lib/mongo-java-driver-1.2.jar" property="mongodriver.exists"/> + <available file="${basedir}/lib/mongo-java-driver-${mongo-java-driver.version}.jar" property="mongodriver.exists"/> </target> <target name="commonsio_check"> - <available file="${basedir}/lib/commons-io-1.3.2.jar" property="commonsio.exists"/> + <available file="${basedir}/lib/commons-io-${commons-io.version}.jar" property="commonsio.exists"/> </target> <target name="install_forms" depends="forms_check" unless="forms_exists" description="installs forms.jar into lib"> - <get src="${forms_url}" dest="${basedir}/lib/forms-1.2.1.jar" verbose="true" ignoreerrors="true"/> + <get src="${forms_url}" dest="${basedir}/lib/forms-${forms.version}.jar" verbose="true" ignoreerrors="true"/> </target> <target name="install_mongodriver" depends="mongodriver_check" unless="mongodriver.exists" description="installs mongodriver.jar into lib"> - <get src="${mongodriver_url}" dest="${basedir}/lib/mongo-java-driver-1.2.jar" verbose="true" ignoreerrors="true"/> + <get src="${mongodriver_url}" dest="${basedir}/lib/mongo-java-driver-${mongo-java-driver.version}.jar" verbose="true" ignoreerrors="true"/> </target> <target name="install_commonsio" depends="commonsio_check" unless="commonsio.exists" description="installs commons-io.jar into lib"> - <get src="${commonsio_url}" dest="${basedir}/lib/commons-io-1.3.2.jar" verbose="true" ignoreerrors="true"/> + <get src="${commonsio_url}" dest="${basedir}/lib/commons-io-${commons-io.version}.jar" verbose="true" ignoreerrors="true"/> </target> <target name="pull" depends="install_forms, install_mongodriver, install_commonsio" description="pulls in the 3rd party jars"> @@ -98,7 +102,8 @@ source="${javac.source}" target="${javac.target}" deprecation="${javac.deprecation}" - debug="${javac.debug}"> + debug="${javac.debug}" + includeantruntime="false"> <classpath refid="mongobrowser.classpath"/> </javac> </target> @@ -139,7 +144,7 @@ <manifest> <attribute name="mongobrowser-version" value="${mongobrowser.version}"/> <attribute name="Main-Class" value="com.mebigfatguy.mongobrowser.MongoBrowser"/> - <attribute name="Class-Path" value="commons-io-1.3.2.jar forms-1.2.1.jar"/> + <attribute name="Class-Path" value="commons-io-${commons-io.version}.jar forms-${forms.version}.jar"/> </manifest> </jar> </target> @@ -157,7 +162,7 @@ destdir="${javadoc.dir}" windowtitle="mongobrowser api"> <doctitle><![CDATA[<h1>mongobrowser javadoc</h1>]]></doctitle> - <bottom><![CDATA[<i>Copyright © 2009-2010 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom> + <bottom><![CDATA[<i>Copyright © 2009-2011 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom> </javadoc> </target> @@ -206,7 +211,7 @@ <target name="binzip" depends="build" description="zips up all jars"> <zip destfile="${basedir}/mongobrowser-bin-${mongobrowser.version}.zip" basedir="${jnlp.dir}" - includes="mongobrowser-${mongobrowser.version}.jar commons-io-1.3.2.jar forms-1.2.1.jar"/> + includes="mongobrowser-${mongobrowser.version}.jar commons-io-${commons-io.version}.jar forms-${forms.version}.jar"/> </target> <target name="release" depends="build, jnlp, binzip, srczip, javadoc" description="prepares everything for a release"/> Modified: trunk/mongobrowser/etc/mongobrowser.jnlp =================================================================== --- trunk/mongobrowser/etc/mongobrowser.jnlp 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/etc/mongobrowser.jnlp 2011-06-19 07:14:41 UTC (rev 131) @@ -16,7 +16,7 @@ <resources> <j2se version="1.6+" initial-heap-size="400m" max-heap-size="800m"/> <jar href="mongobrowser-$VERSION.jar"/> - <jar href="mongo-1.2.jar"/> + <jar href="mongo-java-driver-2.6.2.jar"/> <jar href="forms-1.2.1.jar"/> </resources> <application-desc main-class="com.mebigfatguy.mongobrowser.MongoBrowser"/> Modified: trunk/mongobrowser/mongobrowser.fb =================================================================== --- trunk/mongobrowser/mongobrowser.fb 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/mongobrowser.fb 2011-06-19 07:14:41 UTC (rev 131) @@ -4,6 +4,7 @@ ./src [Aux classpath entries] ./lib/forms-1.2.1.jar -./lib/mongo-1.2.jar +./lib/commons-io-1.3.2.jar +./lib/mongo-java-driver-2.6.2.jar [Options] relative_paths=true Modified: trunk/mongobrowser/mongobrowser.store =================================================================== (Binary files differ) Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBrowser.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBrowser.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBrowser.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,9 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius + * Copyright 2009-2011 Rodrigo Hjort * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,20 +19,40 @@ */ package com.mebigfatguy.mongobrowser; +import java.net.UnknownHostException; + import com.mebigfatguy.mongobrowser.dialogs.MongoBrowserFrame; +import com.mongodb.MongoException; /** * main application class */ public class MongoBrowser { + public static final String DEFAULT_SERVER = "localhost"; + public static final int DEFAULT_PORT = 27017; + /** - * - * @param args the command line arguments (unused) + * @param args + * the command line arguments */ public static void main(String[] args) { + + final String host = (args.length > 0 ? args[0] : null); + MongoBrowserFrame frame = new MongoBrowserFrame(); frame.setLocationRelativeTo(null); frame.setVisible(true); + + if (host != null) { + final int port = (args.length > 1 ? Integer.parseInt(args[1]) : DEFAULT_PORT); + try { + frame.startupConnection(host, port); + } catch (UnknownHostException e) { + System.err.println("Unknown host specified: " + host); + } catch (MongoException e) { + System.err.println("An error has occurred: " + e.getMessage()); + } + } } } Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBundle.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBundle.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoBundle.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ import java.util.ResourceBundle; -/** +/** * manages the resource bundle properties file for this application */ public class MongoBundle { @@ -29,40 +29,25 @@ * an enumeration of all the possible entries in the bundle */ public enum Key { - OK("mongo.ok"), - Cancel("mongo.cancel"), - Title("mongo.title"), - Servers("mongo.servers"), - Connect("mongo.connect"), - Disconnect("mongo.disconnect"), - ConnectToServer("mongo.connecttoserver"), - Server("mongo.server"), - Port("mongo.port"), - Database("mongo.database"), - NewDatabase("mongo.newdatabase"), - NewCollection("mongo.newcollection"), - NewObject("mongo.newobject"), - NewKeyValue("mongo.newkeyvalue"), - Key("mongo.key"), - Value("mongo.value"), - Integer("mongo.integer"), - Double("mongo.double"), - Float("mongo.float"), - String("mongo.string"), - Object("mongo.object"), - Delete("mongo.delete"); - + OK("mongo.ok"), Cancel("mongo.cancel"), Title("mongo.title"), Servers("mongo.servers"), Connect("mongo.connect"), Disconnect( + "mongo.disconnect"), ConnectToServer("mongo.connecttoserver"), Server("mongo.server"), Port( + "mongo.port"), Database("mongo.database"), NewDatabase("mongo.newdatabase"), NewCollection( + "mongo.newcollection"), NewObject("mongo.newobject"), NewKeyValue("mongo.newkeyvalue"), Key("mongo.key"), Value( + "mongo.value"), Integer("mongo.integer"), Double("mongo.double"), Float("mongo.float"), String( + "mongo.string"), Object("mongo.object"), Delete("mongo.delete"); + String id; - + /** * creates a key given the properties file name * - * @param id the properties file entry name + * @param id + * the properties file entry name */ Key(String id) { this.id = id; } - + /** * retrieves the properties file entry name for this Key * @@ -72,20 +57,22 @@ return id; } }; - + private static ResourceBundle bundle = ResourceBundle.getBundle("com/mebigfatguy/mongobrowser/resources/resource"); - + /** - * protects this class from being instantiated as it is meant to be accessed as a static class + * protects this class from being instantiated as it is meant to be accessed + * as a static class */ private MongoBundle() { - + } - + /** * retrieves a string from a resource bundle given a key * - * @param key the key of the property item that is to be retrieved + * @param key + * the key of the property item that is to be retrieved * @return the string representing the localized name */ public static String getString(Key key) { Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoContext.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoContext.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/MongoContext.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,14 +30,18 @@ public interface MongoContext { void setTree(JTree tree); + JTree getTree(); - - void setSelectedNode(MongoTreeNode node); - MongoTreeNode getSelectedNode(); - + + void setSelectedNodes(MongoTreeNode... node); + + MongoTreeNode[] getSelectedNodes(); + void setServer(Mongo server); + Mongo getServer(); - + void setDatabase(DB db); + DB getDatabase(); } Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/TreeUtils.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/TreeUtils.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/TreeUtils.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,27 +18,54 @@ */ package com.mebigfatguy.mongobrowser; +import javax.swing.JTree; +import javax.swing.tree.TreePath; + import com.mebigfatguy.mongobrowser.dialogs.MongoTreeNode; /** * a collection of utility methods used in a static context */ public class TreeUtils { - - private TreeUtils() { + + private TreeUtils() { } - + /** * retrieves the collection node that owns the requested node * - * @param fromNode the node to find the collection for + * @param fromNode + * the node to find the collection for * @return the collection node that owns this node */ public static MongoTreeNode findCollectionNode(MongoTreeNode fromNode) { while (fromNode.getType() != MongoTreeNode.Type.Collection) { - fromNode = (MongoTreeNode)fromNode.getParent(); + fromNode = (MongoTreeNode) fromNode.getParent(); } - + return fromNode; } + + /** + * retrieves all the MongoTreeNodes from the current selection + * + * @param tree + * the tree to fetch the nodes from + * @return the selected MongoTreeNodes + */ + public static MongoTreeNode[] getSelectedNodes(JTree tree) { + TreePath[] paths = tree.getSelectionPaths(); + + if (paths != null) { + MongoTreeNode[] nodes = new MongoTreeNode[paths.length]; + + for (int i = 0; i < nodes.length; i++) { + nodes[i] = (MongoTreeNode) paths[i].getLastPathComponent(); + } + + return nodes; + } else { + return new MongoTreeNode[0]; + } + } } Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/ConnectAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/ConnectAction.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/ConnectAction.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,12 +36,12 @@ private static final long serialVersionUID = -4704951174439411332L; private MongoContext context; - + public ConnectAction(MongoContext ctxt) { super(MongoBundle.getString(MongoBundle.Key.Connect)); context = ctxt; } - + @Override public void actionPerformed(ActionEvent e) { try { Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DeleteAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DeleteAction.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DeleteAction.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import com.mebigfatguy.mongobrowser.MongoContext; import com.mebigfatguy.mongobrowser.TreeUtils; import com.mebigfatguy.mongobrowser.dialogs.MongoTreeNode; +import com.mebigfatguy.mongobrowser.dialogs.MongoTreeNode.Type; import com.mongodb.DBCollection; import com.mongodb.DBObject; @@ -36,54 +37,68 @@ public class DeleteAction extends AbstractAction { private static final long serialVersionUID = 9057255369669193765L; - private MongoContext context; - + private final MongoContext context; + public DeleteAction(MongoContext ctxt) { super(MongoBundle.getString(MongoBundle.Key.Delete)); context = ctxt; } - + @Override public void actionPerformed(ActionEvent e) { - MongoTreeNode node = context.getSelectedNode(); - switch (node.getType()) { - case Collection: { - DBCollection collection = (DBCollection)node.getUserObject(); - collection.drop(); - MongoTreeNode dbNode = (MongoTreeNode)node.getParent(); - dbNode.remove(node); - DefaultTreeModel model = (DefaultTreeModel)context.getTree().getModel(); - model.nodeStructureChanged(dbNode); - } - break; - - case Object: { - DBObject object = (DBObject)node.getUserObject(); - MongoTreeNode collectionNode = TreeUtils.findCollectionNode(node); - DBCollection collection = (DBCollection)collectionNode.getUserObject(); - collection.remove(object); - collectionNode.remove(node); - DefaultTreeModel model = (DefaultTreeModel)context.getTree().getModel(); - model.nodeStructureChanged(collectionNode); - } - break; - - case KeyValue: { - MongoTreeNode.KV kv = (MongoTreeNode.KV)node.getUserObject(); - String key = kv.getKey(); - if (!key.startsWith("_")) { - MongoTreeNode objectNode = (MongoTreeNode)node.getParent(); - DBObject object = (DBObject)objectNode.getUserObject(); - object.removeField(key); - MongoTreeNode collectionNode = TreeUtils.findCollectionNode(objectNode); - DBCollection collection = (DBCollection)collectionNode.getUserObject(); - collection.save(object); - objectNode.remove(node); - DefaultTreeModel model = (DefaultTreeModel)context.getTree().getModel(); - model.nodeStructureChanged(objectNode); + MongoTreeNode[] nodes = context.getSelectedNodes(); + + deleteNodesOfType(nodes, Type.KeyValue); + deleteNodesOfType(nodes, Type.Object); + deleteNodesOfType(nodes, Type.Collection); + } + + private void deleteNodesOfType(MongoTreeNode[] nodes, Type type) { + for (int i = nodes.length - 1; i >= 0; i--) { + MongoTreeNode node = nodes[i]; + + Type nodeType = node.getType(); + if (nodeType == type) { + switch (nodeType) { + case Collection: { + DBCollection collection = (DBCollection) node.getUserObject(); + collection.drop(); + MongoTreeNode dbNode = (MongoTreeNode) node.getParent(); + dbNode.remove(node); + DefaultTreeModel model = (DefaultTreeModel) context.getTree().getModel(); + model.nodeStructureChanged(dbNode); + } + break; + + case Object: { + DBObject object = (DBObject) node.getUserObject(); + MongoTreeNode collectionNode = TreeUtils.findCollectionNode(node); + DBCollection collection = (DBCollection) collectionNode.getUserObject(); + collection.remove(object); + collectionNode.remove(node); + DefaultTreeModel model = (DefaultTreeModel) context.getTree().getModel(); + model.nodeStructureChanged(collectionNode); + } + break; + + case KeyValue: { + MongoTreeNode.KV kv = (MongoTreeNode.KV) node.getUserObject(); + String key = kv.getKey(); + if (!key.startsWith("_")) { + MongoTreeNode objectNode = (MongoTreeNode) node.getParent(); + DBObject object = (DBObject) objectNode.getUserObject(); + object.removeField(key); + MongoTreeNode collectionNode = TreeUtils.findCollectionNode(objectNode); + DBCollection collection = (DBCollection) collectionNode.getUserObject(); + collection.save(object); + objectNode.remove(node); + DefaultTreeModel model = (DefaultTreeModel) context.getTree().getModel(); + model.nodeStructureChanged(objectNode); + } + } + break; } } - break; } } } Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DisconnectAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DisconnectAction.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DisconnectAction.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,12 +32,12 @@ private static final long serialVersionUID = -5795316226405751888L; private MongoContext context; - + public DisconnectAction(MongoContext ctxt) { super(MongoBundle.getString(MongoBundle.Key.Disconnect)); context = ctxt; } - + @Override public void actionPerformed(ActionEvent e) { context.setDatabase(null); Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewCollectionAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewCollectionAction.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewCollectionAction.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,14 +38,14 @@ public class NewCollectionAction extends AbstractAction { private static final long serialVersionUID = 9090870672875251498L; - + private MongoContext context; - + public NewCollectionAction(MongoContext ctxt) { super(MongoBundle.getString(MongoBundle.Key.NewCollection)); context = ctxt; } - + @Override public void actionPerformed(ActionEvent e) { JTree tree = context.getTree(); @@ -53,8 +53,8 @@ if (collectionName != null) { DB db = context.getDatabase(); DBCollection dbCollection = db.getCollection(collectionName); - DefaultTreeModel model = (DefaultTreeModel)tree.getModel(); - MongoTreeNode root = (MongoTreeNode)model.getRoot(); + DefaultTreeModel model = (DefaultTreeModel) tree.getModel(); + MongoTreeNode root = (MongoTreeNode) model.getRoot(); MongoTreeNode collectionNode = new MongoTreeNode(dbCollection, false); root.add(collectionNode); MongoTreeNode slug = new MongoTreeNode(); Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewKeyValueAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewKeyValueAction.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewKeyValueAction.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,13 +39,13 @@ public class NewKeyValueAction extends AbstractAction { private static final long serialVersionUID = -500965537578361564L; - private MongoContext context; - + private final MongoContext context; + public NewKeyValueAction(MongoContext ctxt) { super(MongoBundle.getString(MongoBundle.Key.NewKeyValue)); context = ctxt; } - + @Override public void actionPerformed(ActionEvent e) { JTree tree = context.getTree(); @@ -53,34 +53,45 @@ dialog.setLocationRelativeTo(tree); dialog.setModal(true); dialog.setVisible(true); + if (dialog.isOK()) { String key = dialog.getKey(); Object value = dialog.getValue(); - TreePath path = tree.getSelectionPath(); - MongoTreeNode selectedNode = (MongoTreeNode)path.getLastPathComponent(); - DBObject object; - - if (selectedNode.getType() == MongoTreeNode.Type.KeyValue) { - object = (DBObject) ((MongoTreeNode.KV)selectedNode.getUserObject()).getValue(); - } else { - object = (DBObject) selectedNode.getUserObject(); + + boolean didScrollToView = false; + MongoTreeNode[] selectedNodes = TreeUtils.getSelectedNodes(tree); + + for (MongoTreeNode selectedNode : selectedNodes) { + DBObject object; + + if (selectedNode.getType() == MongoTreeNode.Type.KeyValue) { + object = (DBObject) ((MongoTreeNode.KV) selectedNode.getUserObject()).getValue(); + } else { + object = (DBObject) selectedNode.getUserObject(); + } + + object.put(key, value); + MongoTreeNode kv = new MongoTreeNode(new MongoTreeNode.KV(key, object.get(key)), false); + selectedNode.add(kv); + if (value instanceof DBObject) { + MongoTreeNode slug = new MongoTreeNode(); + kv.add(slug); + } + MongoTreeNode collectionNode = TreeUtils.findCollectionNode(selectedNode); + DBCollection collection = (DBCollection) collectionNode.getUserObject(); + collection.save(object); + + DefaultTreeModel model = (DefaultTreeModel) tree.getModel(); + model.nodeStructureChanged((MongoTreeNode) model.getRoot()); + + if (!didScrollToView) { + TreePath selection = new TreePath(kv.getPath()); + tree.scrollPathToVisible(selection); + tree.setSelectionPath(selection); + didScrollToView = true; + } } - - object.put(key, value); - MongoTreeNode kv = new MongoTreeNode(new MongoTreeNode.KV(key, object.get(key)), false); - selectedNode.add(kv); - if (value instanceof DBObject) { - MongoTreeNode slug = new MongoTreeNode(); - kv.add(slug); - } - MongoTreeNode collectionNode = TreeUtils.findCollectionNode(selectedNode); - DBCollection collection = (DBCollection)collectionNode.getUserObject(); - collection.save(object); - DefaultTreeModel model = (DefaultTreeModel)tree.getModel(); - model.nodeStructureChanged((MongoTreeNode)model.getRoot()); - TreePath selection = new TreePath(kv.getPath()); - tree.scrollPathToVisible(selection); - tree.setSelectionPath(selection); + } } } Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewObjectAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewObjectAction.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewObjectAction.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import com.mebigfatguy.mongobrowser.MongoBundle; import com.mebigfatguy.mongobrowser.MongoContext; +import com.mebigfatguy.mongobrowser.TreeUtils; import com.mebigfatguy.mongobrowser.dialogs.MongoTreeNode; import com.mongodb.BasicDBObject; import com.mongodb.DBCollection; @@ -37,30 +38,36 @@ public class NewObjectAction extends AbstractAction { private static final long serialVersionUID = 5752147095730092598L; - private MongoContext context; - + private final MongoContext context; + public NewObjectAction(MongoContext ctxt) { super(MongoBundle.getString(MongoBundle.Key.NewObject)); context = ctxt; } - + @Override public void actionPerformed(ActionEvent e) { JTree tree = context.getTree(); - TreePath path = tree.getSelectionPath(); - MongoTreeNode collectionNode = (MongoTreeNode)path.getLastPathComponent(); - DBCollection dbCollection = (DBCollection) collectionNode.getUserObject(); - BasicDBObject dbObj = new BasicDBObject(); - dbCollection.insert(dbObj); - DefaultTreeModel model = (DefaultTreeModel)tree.getModel(); - MongoTreeNode objectNode = new MongoTreeNode(dbObj, false); - collectionNode.add(objectNode); - MongoTreeNode slug = new MongoTreeNode(); - objectNode.add(slug); - model.nodeStructureChanged((MongoTreeNode)model.getRoot()); - TreePath selection = new TreePath(objectNode.getPath()); - tree.scrollPathToVisible(selection); - tree.setSelectionPath(selection); + + MongoTreeNode[] selectedNodes = TreeUtils.getSelectedNodes(tree); + boolean didScrollToVisible = false; + for (MongoTreeNode selectedNode : selectedNodes) { + DBCollection dbCollection = (DBCollection) selectedNode.getUserObject(); + BasicDBObject dbObj = new BasicDBObject(); + dbCollection.insert(dbObj); + DefaultTreeModel model = (DefaultTreeModel) tree.getModel(); + MongoTreeNode objectNode = new MongoTreeNode(dbObj, false); + selectedNode.add(objectNode); + MongoTreeNode slug = new MongoTreeNode(); + objectNode.add(slug); + model.nodeStructureChanged((MongoTreeNode) model.getRoot()); + + if (!didScrollToVisible) { + TreePath selection = new TreePath(objectNode.getPath()); + tree.scrollPathToVisible(selection); + tree.setSelectionPath(selection); + didScrollToVisible = false; + } + } } - } Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ConnectionDialog.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ConnectionDialog.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ConnectionDialog.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ private JButton okButton; private JButton cancelButton; private boolean ok = false; - + /** * constructs the dialog */ @@ -67,7 +67,7 @@ cp.add(createFormPanel(), BorderLayout.CENTER); cp.add(createCtrlPanel(), BorderLayout.SOUTH); } - + /** * create the panel that houses the input form * @@ -77,29 +77,29 @@ JPanel p = new JPanel(); p.setLayout(new FormLayout("6dlu, pref, 5dlu, 200px, 6dlu", "6dlu, pref, 2dlu, pref, 6dlu")); CellConstraints cc = new CellConstraints(); - + JLabel serverLabel = new JLabel(MongoBundle.getString(MongoBundle.Key.Server)); p.add(serverLabel, cc.xy(2, 2)); - + serverField = new JTextField(); p.add(serverField, cc.xy(4, 2)); serverField.setText("localhost"); - + serverLabel.setLabelFor(serverField); - + JLabel portLabel = new JLabel(MongoBundle.getString(MongoBundle.Key.Port)); p.add(portLabel, cc.xy(2, 4)); - + portField = new JTextField(); portField.setDocument(new IntegerDocument()); p.add(portField, cc.xy(4, 4)); portField.setText("27017"); - + portLabel.setLabelFor(portField); - + return p; } - + /** * creates the panel that houses the ok and cancel buttons * @@ -110,15 +110,15 @@ p.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(Box.createHorizontalGlue()); - + okButton = new JButton(MongoBundle.getString(MongoBundle.Key.OK)); p.add(okButton); p.add(Box.createHorizontalStrut(10)); - + cancelButton = new JButton(MongoBundle.getString(MongoBundle.Key.Cancel)); p.add(cancelButton); p.add(Box.createHorizontalStrut(10)); - + return p; } @@ -127,17 +127,21 @@ */ private void initListeners() { okButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent ae) { ok = true; dispose(); } }); - + cancelButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent ae) { dispose(); } }); + + getRootPane().setDefaultButton(okButton); } /** @@ -148,7 +152,7 @@ public boolean isOK() { return ok; } - + /** * get the user supplied host name of the server * @@ -167,5 +171,4 @@ return Integer.parseInt(portField.getText()); } - } Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/DoubleDocument.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/DoubleDocument.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/DoubleDocument.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,9 +35,12 @@ * intercepts string insertions to make sure that the values to be put into * a text component is only an double value * - * @param pos where the text is being inserted - * @param insertStr the new text that was typed - * @param atts the attributes for the text (unused) + * @param pos + * where the text is being inserted + * @param insertStr + * the new text that was typed + * @param atts + * the attributes for the text (unused) */ @Override public void insertString(int pos, String insertStr, AttributeSet atts) throws BadLocationException { @@ -47,7 +50,7 @@ Double.parseDouble(text.toString()); super.insertString(pos, insertStr, atts); } catch (Exception e) { - Toolkit.getDefaultToolkit().beep(); + Toolkit.getDefaultToolkit().beep(); } } Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/FloatDocument.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/FloatDocument.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/FloatDocument.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; + /** * a JTextComponent model object that only allows float value input */ @@ -34,9 +35,12 @@ * intercepts string insertions to make sure that the values to be put into * a text component is only an float value * - * @param pos where the text is being inserted - * @param insertStr the new text that was typed - * @param atts the attributes for the text (unused) + * @param pos + * where the text is being inserted + * @param insertStr + * the new text that was typed + * @param atts + * the attributes for the text (unused) */ @Override public void insertString(int pos, String insertStr, AttributeSet atts) throws BadLocationException { @@ -46,7 +50,7 @@ Float.parseFloat(text.toString()); super.insertString(pos, insertStr, atts); } catch (Exception e) { - Toolkit.getDefaultToolkit().beep(); + Toolkit.getDefaultToolkit().beep(); } } Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/IntegerDocument.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/IntegerDocument.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/IntegerDocument.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,9 +35,12 @@ * intercepts string insertions to make sure that the values to be put into * a text component is only an integer value * - * @param pos where the text is being inserted - * @param insertStr the new text that was typed - * @param atts the attributes for the text (unused) + * @param pos + * where the text is being inserted + * @param insertStr + * the new text that was typed + * @param atts + * the attributes for the text (unused) */ @Override public void insertString(int pos, String insertStr, AttributeSet atts) throws BadLocationException { @@ -47,7 +50,7 @@ Integer.parseInt(text.toString()); super.insertString(pos, insertStr, atts); } catch (Exception e) { - Toolkit.getDefaultToolkit().beep(); + Toolkit.getDefaultToolkit().beep(); } } Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/KeyValueDialog.java 2011-06-19 07:14:41 UTC (rev 131) @@ -29,16 +29,16 @@ * a dialog for collecting key/value pairs for a mongo object property */ public class KeyValueDialog extends JDialog { - + private static final long serialVersionUID = 4909101478144542212L; - + private JTextField keyField; private JComboBox valueTypeBox; private JTextField valueField; private JButton okButton; private JButton cancelButton; private boolean ok = false; - + /** * constructs a dialog to collect a key value for a mongo object's property */ @@ -48,7 +48,7 @@ initListeners(); pack(); } - + /** * adds and lays out the components in the dialog */ @@ -58,7 +58,7 @@ cp.add(createFormPanel(), BorderLayout.CENTER); cp.add(createCtrlPanel(), BorderLayout.SOUTH); } - + /** * creates the panel for collecting the key and value * @@ -68,36 +68,36 @@ JPanel p = new JPanel(); p.setLayout(new FormLayout("6dlu, pref, 5dlu, 200px, 5dlu, pref, 6dlu", "6dlu, pref, 2dlu, pref, 6dlu")); CellConstraints cc = new CellConstraints(); - + JLabel keyLabel = new JLabel(MongoBundle.getString(MongoBundle.Key.Key)); p.add(keyLabel, cc.xy(2, 2)); - + keyField = new JTextField(); p.add(keyField, cc.xy(4, 2)); - + keyLabel.setLabelFor(keyField); - + JLabel valueLabel = new JLabel(MongoBundle.getString(MongoBundle.Key.Value)); p.add(valueLabel, cc.xy(2, 4)); valueField = new JTextField(); p.add(valueField, cc.xy(4, 4)); - + valueTypeBox = new JComboBox(); - DefaultComboBoxModel model = (DefaultComboBoxModel)valueTypeBox.getModel(); + DefaultComboBoxModel model = (DefaultComboBoxModel) valueTypeBox.getModel(); model.addElement(new IntegerValueType()); model.addElement(new DoubleValueType()); model.addElement(new FloatValueType()); model.addElement(new StringValueType()); model.addElement(new ObjectValueType()); - valueTypeBox.setSelectedIndex(2); + valueTypeBox.setSelectedIndex(3); p.add(valueTypeBox, cc.xy(6, 4)); - + valueLabel.setLabelFor(valueField); - + return p; } - + /** * creates a panel holding the ok and cancel buttons * @@ -108,45 +108,49 @@ p.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(Box.createHorizontalGlue()); - + okButton = new JButton(MongoBundle.getString(MongoBundle.Key.OK)); p.add(okButton); p.add(Box.createHorizontalStrut(10)); - + cancelButton = new JButton(MongoBundle.getString(MongoBundle.Key.Cancel)); p.add(cancelButton); p.add(Box.createHorizontalStrut(10)); - + return p; } - + /** * installs the listeners */ private void initListeners() { okButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent ae) { ok = true; dispose(); } }); - + cancelButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent ae) { dispose(); } }); - + valueTypeBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent ie) { if (ie.getStateChange() == ItemEvent.SELECTED) { - ValueType vt = (ValueType)ie.getItem(); + ValueType vt = (ValueType) ie.getItem(); vt.installDocument(valueField); } } }); + + getRootPane().setDefaultButton(okButton); } /** @@ -157,7 +161,7 @@ public boolean isOK() { return ok; } - + /** * gets the key value from the form * @@ -166,16 +170,16 @@ public String getKey() { return keyField.getText(); } - + /** * gets the typed value from the dialog * * @return the typed value */ public Object getValue() { - return ((ValueType)valueTypeBox.getSelectedItem()).getValue(valueField); + return ((ValueType) valueTypeBox.getSelectedItem()).getValue(valueField); } - + /** * interface for items that are put into the Value type combobox */ @@ -183,27 +187,31 @@ /** * switch the JTextField's model based on the type of value * - * @param field the component who's document should be modified + * @param field + * the component who's document should be modified */ void installDocument(JTextField field); + /** * get the value object of the field, based on the type of this value * - * @param field the component to get the value from + * @param field + * the component to get the value from * @return a value object */ Object getValue(JTextField field); } - + /** * a value type representing an Integer object */ static class IntegerValueType implements ValueType { - + /** * installs an IntegerDocument as the field's model * - * @param field the text edit field to install the model + * @param field + * the text edit field to install the model */ @Override public void installDocument(JTextField field) { @@ -216,18 +224,19 @@ } catch (BadLocationException ble) { } } - + /** * get the field's values as an Integer * - * @param field the component that holds the integer value + * @param field + * the component that holds the integer value * @return an Integer that is the value of the text field */ @Override public Object getValue(JTextField field) { return Integer.valueOf(field.getText()); } - + /** * returns the display value shown in the combo box * @@ -238,16 +247,17 @@ return MongoBundle.getString(MongoBundle.Key.Integer); } } - + /** * a value type representing an Double object */ static class DoubleValueType implements ValueType { - + /** * installs an DoubleDocument as the field's model * - * @param field the text edit field to install the model + * @param field + * the text edit field to install the model */ @Override public void installDocument(JTextField field) { @@ -260,18 +270,19 @@ } catch (BadLocationException ble) { } } - + /** * get the field's values as an Double * - * @param field the component that holds the double value + * @param field + * the component that holds the double value * @return an Double that is the value of the text field */ @Override public Object getValue(JTextField field) { return Double.valueOf(field.getText()); } - + /** * returns the display value shown in the combo box * @@ -280,18 +291,19 @@ @Override public String toString() { return MongoBundle.getString(MongoBundle.Key.Double); - } + } } - + /** * a value type representing an Float object */ static class FloatValueType implements ValueType { - + /** * installs an FloatDocument as the field's model * - * @param field the text edit field to install the model + * @param field + * the text edit field to install the model */ @Override public void installDocument(JTextField field) { @@ -304,18 +316,19 @@ } catch (BadLocationException ble) { } } - + /** * get the field's values as an Float * - * @param field the component that holds the float value + * @param field + * the component that holds the float value * @return an Float that is the value of the text field */ @Override public Object getValue(JTextField field) { return Float.valueOf(field.getText()); } - + /** * returns the display value shown in the combo box * @@ -324,19 +337,19 @@ @Override public String toString() { return MongoBundle.getString(MongoBundle.Key.Float); - } + } } - /** * a value type representing an String object */ static class StringValueType implements ValueType { - + /** * installs an PlainDocument as the field's model * - * @param field the text edit field to install the model + * @param field + * the text edit field to install the model */ @Override public void installDocument(JTextField field) { @@ -349,18 +362,19 @@ } catch (BadLocationException ble) { } } - + /** * get the field's values as an String * - * @param field the component that holds the string value + * @param field + * the component that holds the string value * @return an String that is the value of the text field */ @Override public Object getValue(JTextField field) { return field.getText(); } - + /** * returns the display value shown in the combo box * @@ -369,19 +383,19 @@ @Override public String toString() { return MongoBundle.getString(MongoBundle.Key.String); - } + } } - + /** * a value type representing an BasicDBObject object */ static class ObjectValueType implements ValueType { - + /** - * installs an PlainDocument as the field's model - * and disables the field + * installs an PlainDocument as the field's model and disables the field * - * @param field the text edit field to install the model + * @param field + * the text edit field to install the model */ @Override public void installDocument(JTextField field) { @@ -389,18 +403,19 @@ field.setDocument(new PlainDocument()); field.setEnabled(false); } - + /** * get the field's values as an BasicDBObject * - * @param field the component that holds the string value + * @param field + * the component that holds the string value * @return an String that is the value of the text field */ @Override public Object getValue(JTextField field) { return new BasicDBObject(); } - + /** * returns the display value shown in the combo box * Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoBrowserFrame.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoBrowserFrame.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoBrowserFrame.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import java.awt.Container; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.net.UnknownHostException; import javax.swing.JFrame; import javax.swing.JMenu; @@ -35,6 +36,7 @@ import com.mebigfatguy.mongobrowser.actions.DisconnectAction; import com.mongodb.DB; import com.mongodb.Mongo; +import com.mongodb.MongoException; /** * the main frame of the browser @@ -46,8 +48,8 @@ private JMenuItem disconnectItem; private MongoControlPanel ctrlPanel; private MongoDataPanel dataPanel; - private Mediator mediator = new Mediator(); - + private final Mediator mediator = new Mediator(); + /** * constructs the main frame */ @@ -67,20 +69,21 @@ dataPanel = new MongoDataPanel(mediator); cp.add(dataPanel, BorderLayout.CENTER); } - + private void initMenus() { - + JMenuBar mb = new JMenuBar(); JMenu databasesMenu = new JMenu(MongoBundle.getString(MongoBundle.Key.Servers)); connectItem = new JMenuItem(new ConnectAction(mediator)); databasesMenu.add(connectItem); disconnectItem = new JMenuItem(new DisconnectAction(mediator)); - mb.add(databasesMenu); + disconnectItem.setEnabled(false); + mb.add(databasesMenu); databasesMenu.add(disconnectItem); - + setJMenuBar(mb); } - + private void initListeners() { addWindowListener(new WindowAdapter() { @Override @@ -90,18 +93,17 @@ } }); } - + /** * a mediator for all the actions that occur in the frame */ class Mediator implements MongoContext { - + private JTree activeTree; - private MongoTreeNode activeNode; + private MongoTreeNode[] activeNodes; private Mongo activeServer; private DB activeDatabase; - - + @Override public JTree getTree() { return activeTree; @@ -111,23 +113,23 @@ public void setTree(JTree tree) { activeTree = tree; } - + @Override - public MongoTreeNode getSelectedNode() { - return activeNode; + public MongoTreeNode[] getSelectedNodes() { + return activeNodes; } - + @Override - public void setSelectedNode(MongoTreeNode node) { - activeNode = node; - ctrlPanel.adjustEnabled(node); + public void setSelectedNodes(MongoTreeNode... nodes) { + activeNodes = nodes; + ctrlPanel.adjustEnabled(nodes); } @Override public Mongo getServer() { return activeServer; } - + @Override public void setServer(Mongo server) { activeServer = server; @@ -141,17 +143,40 @@ dataPanel.term(); } } - + + @Override public DB getDatabase() { return activeDatabase; } - + + @Override public void setDatabase(DB database) { activeDatabase = database; - if (activeDatabase != null) + if (activeDatabase != null) { dataPanel.init(); - else + } else { dataPanel.term(); + } } } + + public void startupConnection(final String host, final int port) throws UnknownHostException, MongoException { + + try { + mediator.setServer(new Mongo(host, port)); + } catch (Exception e) { + + connectItem.setEnabled(true); + disconnectItem.setEnabled(false); + ctrlPanel.term(); + dataPanel.term(); + + if (e instanceof UnknownHostException) { + throw (UnknownHostException) e; + } else if (e instanceof MongoException) { + throw (MongoException) e; + } + } + } + } Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java 2011-06-16 19:41:58 UTC (rev 130) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java 2011-06-19 07:14:41 UTC (rev 131) @@ -1,8 +1,8 @@ /* * mongobrowser - a webstart gui application for viewing, * editing and administering a Mongo Database - * Copyright 2009-2010 MeBigFatGuy.com - * Copyright 2009-2010 Dave Brosius + * Copyright 2009-2011 MeBigFatGuy.com + * Copyright 2009-2011 Dave Brosius * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,10 @@ import java.awt.Color; import java.awt.Dimension; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Paint; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.List; @@ -51,154 +55,175 @@ public class MongoControlPanel extends JPanel implements MongoPanel { private static final long serialVersionUID = 1439280424726915624L; - private MongoContext context; + private final MongoContext context; private JComboBox dbComboBox; private JButton dbNewCollectionButton; private JButton dbNewObjectButton; private JButton dbNewKeyValueButton; private JButton dbDeleteButton; - + /** * constructs the button bar panel * - * @param ctxt the mediator object for the dialog + * @param ctxt + * the mediator object for the dialog */ public MongoControlPanel(MongoContext ctxt) { context = ctxt; initComponents(); initListeners(); } - + @Override public void init() { SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { Mongo db = context.getServer(); List<String> databases = db.getDatabaseNames(); - DefaultComboBoxModel model = (Def... [truncated message content] |
From: <dbr...@us...> - 2011-06-16 19:42:04
|
Revision: 130 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=130&view=rev Author: dbrosius Date: 2011-06-16 19:41:58 +0000 (Thu, 16 Jun 2011) Log Message: ----------- don't keep pulling Modified Paths: -------------- trunk/mongobrowser/build.xml Modified: trunk/mongobrowser/build.xml =================================================================== --- trunk/mongobrowser/build.xml 2011-06-16 19:36:03 UTC (rev 129) +++ trunk/mongobrowser/build.xml 2011-06-16 19:41:58 UTC (rev 130) @@ -77,15 +77,15 @@ <available file="${basedir}/lib/commons-io-1.3.2.jar" property="commonsio.exists"/> </target> - <target name="install_forms" depends="forms_check" unless="forms_check" description="installs forms.jar into lib"> + <target name="install_forms" depends="forms_check" unless="forms_exists" description="installs forms.jar into lib"> <get src="${forms_url}" dest="${basedir}/lib/forms-1.2.1.jar" verbose="true" ignoreerrors="true"/> </target> - <target name="install_mongodriver" depends="mongodriver_check" unless="mongodriver_check" description="installs mongodriver.jar into lib"> + <target name="install_mongodriver" depends="mongodriver_check" unless="mongodriver.exists" description="installs mongodriver.jar into lib"> <get src="${mongodriver_url}" dest="${basedir}/lib/mongo-java-driver-1.2.jar" verbose="true" ignoreerrors="true"/> </target> - <target name="install_commonsio" depends="commonsio_check" unless="commonsio_check" description="installs commons-io.jar into lib"> + <target name="install_commonsio" depends="commonsio_check" unless="commonsio.exists" description="installs commons-io.jar into lib"> <get src="${commonsio_url}" dest="${basedir}/lib/commons-io-1.3.2.jar" verbose="true" ignoreerrors="true"/> </target> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-06-16 19:36:09
|
Revision: 129 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=129&view=rev Author: dbrosius Date: 2011-06-16 19:36:03 +0000 (Thu, 16 Jun 2011) Log Message: ----------- auto pull the dependencies now Removed Paths: ------------- trunk/mongobrowser/lib/forms-1.2.1.jar trunk/mongobrowser/lib/mongo-1.2.jar Deleted: trunk/mongobrowser/lib/forms-1.2.1.jar =================================================================== (Binary files differ) Deleted: trunk/mongobrowser/lib/mongo-1.2.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-06-16 19:34:57
|
Revision: 128 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=128&view=rev Author: dbrosius Date: 2011-06-16 19:34:50 +0000 (Thu, 16 Jun 2011) Log Message: ----------- fix classpaths Modified Paths: -------------- trunk/mongobrowser/.classpath Modified: trunk/mongobrowser/.classpath =================================================================== --- trunk/mongobrowser/.classpath 2011-06-16 19:31:07 UTC (rev 127) +++ trunk/mongobrowser/.classpath 2011-06-16 19:34:50 UTC (rev 128) @@ -3,6 +3,7 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="lib" path="lib/forms-1.2.1.jar"/> - <classpathentry kind="lib" path="lib/mongo-1.2.jar"/> + <classpathentry kind="lib" path="lib/commons-io-1.3.2.jar"/> + <classpathentry kind="lib" path="lib/mongo-java-driver-1.2.jar"/> <classpathentry kind="output" path="classes"/> </classpath> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-06-16 19:31:13
|
Revision: 127 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=127&view=rev Author: dbrosius Date: 2011-06-16 19:31:07 +0000 (Thu, 16 Jun 2011) Log Message: ----------- download jars Modified Paths: -------------- trunk/mongobrowser/build.xml Modified: trunk/mongobrowser/build.xml =================================================================== --- trunk/mongobrowser/build.xml 2011-06-16 19:05:42 UTC (rev 126) +++ trunk/mongobrowser/build.xml 2011-06-16 19:31:07 UTC (rev 127) @@ -55,12 +55,44 @@ <mkdir dir="${classes.dir}"/> <mkdir dir="${javadoc.dir}"/> <path id="mongobrowser.classpath"> - <pathelement location="${lib.dir}/mongo-1.2.jar"/> + <pathelement location="${lib.dir}/mongo-java-driver-1.2.jar"/> <pathelement location="${lib.dir}/forms-1.2.1.jar"/> + <pathelement location="${lib.dir}/commons-io-2.3.2.jar"/> </path> </target> + + <property name="forms_url" value="http://repo1.maven.org/maven2/com/jgoodies/forms/1.2.1/forms-1.2.1.jar"/> + <property name="mongodriver_url" value="http://repo1.maven.org/maven2/org/mongodb/mongo-java-driver/1.2/mongo-java-driver-1.2.jar"/> + <property name="commonsio_url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2.jar"/> + + <target name="forms_check"> + <available file="${basedir}/lib/forms-1.2.1.jar" property="forms_exists"/> + </target> + + <target name="mongodriver_check"> + <available file="${basedir}/lib/mongo-java-driver-1.2.jar" property="mongodriver.exists"/> + </target> + + <target name="commonsio_check"> + <available file="${basedir}/lib/commons-io-1.3.2.jar" property="commonsio.exists"/> + </target> + + <target name="install_forms" depends="forms_check" unless="forms_check" description="installs forms.jar into lib"> + <get src="${forms_url}" dest="${basedir}/lib/forms-1.2.1.jar" verbose="true" ignoreerrors="true"/> + </target> + + <target name="install_mongodriver" depends="mongodriver_check" unless="mongodriver_check" description="installs mongodriver.jar into lib"> + <get src="${mongodriver_url}" dest="${basedir}/lib/mongo-java-driver-1.2.jar" verbose="true" ignoreerrors="true"/> + </target> + + <target name="install_commonsio" depends="commonsio_check" unless="commonsio_check" description="installs commons-io.jar into lib"> + <get src="${commonsio_url}" dest="${basedir}/lib/commons-io-1.3.2.jar" verbose="true" ignoreerrors="true"/> + </target> + + <target name="pull" depends="install_forms, install_mongodriver, install_commonsio" description="pulls in the 3rd party jars"> + </target> - <target name="compile" depends="-init" description="compiles java files"> + <target name="compile" depends="-init, pull" description="compiles java files"> <javac srcdir="${src.dir}" destdir="${classes.dir}" source="${javac.source}" @@ -107,7 +139,7 @@ <manifest> <attribute name="mongobrowser-version" value="${mongobrowser.version}"/> <attribute name="Main-Class" value="com.mebigfatguy.mongobrowser.MongoBrowser"/> - <attribute name="Class-Path" value="commons-io-1.4.jar forms-1.2.1.jar"/> + <attribute name="Class-Path" value="commons-io-1.3.2.jar forms-1.2.1.jar"/> </manifest> </jar> </target> @@ -174,7 +206,7 @@ <target name="binzip" depends="build" description="zips up all jars"> <zip destfile="${basedir}/mongobrowser-bin-${mongobrowser.version}.zip" basedir="${jnlp.dir}" - includes="mongobrowser-${mongobrowser.version}.jar commons-io-1.4.jar forms-1.2.1.jar"/> + includes="mongobrowser-${mongobrowser.version}.jar commons-io-1.3.2.jar forms-1.2.1.jar"/> </target> <target name="release" depends="build, jnlp, binzip, srczip, javadoc" description="prepares everything for a release"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-06-16 19:05:48
|
Revision: 126 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=126&view=rev Author: dbrosius Date: 2011-06-16 19:05:42 +0000 (Thu, 16 Jun 2011) Log Message: ----------- doc the move to github Modified Paths: -------------- trunk/mongobrowser/htdocs/index.shtml Added Paths: ----------- trunk/mongobrowser/.gitignore Added: trunk/mongobrowser/.gitignore =================================================================== --- trunk/mongobrowser/.gitignore (rev 0) +++ trunk/mongobrowser/.gitignore 2011-06-16 19:05:42 UTC (rev 126) @@ -0,0 +1,10 @@ + +classes +*.class +*.jar +*.zip +*.store +.svn +.settings +javadoc +jnlp Property changes on: trunk/mongobrowser/.gitignore ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: trunk/mongobrowser/htdocs/index.shtml =================================================================== --- trunk/mongobrowser/htdocs/index.shtml 2010-06-07 02:50:48 UTC (rev 125) +++ trunk/mongobrowser/htdocs/index.shtml 2011-06-16 19:05:42 UTC (rev 126) @@ -25,6 +25,8 @@ <p>MongoBrowser is a simple web start application that allows you to browse, update and administer a Mongo database. This is a work in progress, and is early on. Any bugs, features or ideas are very much welcome. </p> + <p>The source code repository for this project has moved to github. + See gi...@gi...:mebigfatguy/mongobrowser.git</p> <p>-- Dave Brosius</p> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-06-07 02:50:54
|
Revision: 125 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=125&view=rev Author: dbrosius Date: 2010-06-07 02:50:48 +0000 (Mon, 07 Jun 2010) Log Message: ----------- fat fingers Modified Paths: -------------- trunk/mongobrowser/htdocs/mbfg_menu.shtml Modified: trunk/mongobrowser/htdocs/mbfg_menu.shtml =================================================================== --- trunk/mongobrowser/htdocs/mbfg_menu.shtml 2010-06-07 02:26:45 UTC (rev 124) +++ trunk/mongobrowser/htdocs/mbfg_menu.shtml 2010-06-07 02:50:48 UTC (rev 125) @@ -12,7 +12,7 @@ <li><a href="http://schemalizer.sf.net">Schemalizer</a></li> <li><a href="http://tomailer.sf.net">ToMailer</a></li> <li><a href="http://jd4a.sf.net">JavaDoc for Android</a></li> - <il><a href="http://damus.sf.net">Damus</a></il> + <li><a href="http://damus.sf.net">Damus</a></il> <li><a href="http://www.heartofgoldfarm.com">Heart of Gold Farm</a></li> </ul> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-06-07 02:26:52
|
Revision: 124 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=124&view=rev Author: dbrosius Date: 2010-06-07 02:26:45 +0000 (Mon, 07 Jun 2010) Log Message: ----------- more projects Modified Paths: -------------- trunk/mongobrowser/htdocs/mbfg_menu.shtml Modified: trunk/mongobrowser/htdocs/mbfg_menu.shtml =================================================================== --- trunk/mongobrowser/htdocs/mbfg_menu.shtml 2010-01-03 05:06:24 UTC (rev 123) +++ trunk/mongobrowser/htdocs/mbfg_menu.shtml 2010-06-07 02:26:45 UTC (rev 124) @@ -10,7 +10,9 @@ <li><a href="http://pixelle.sf.net">Pixelle</a></li> <li><a href="http://polycasso.sf.net">Polycasso</a></li> <li><a href="http://schemalizer.sf.net">Schemalizer</a></li> - <li><a href="http://tomailer.sf.net">ToMailer</a></li> + <li><a href="http://tomailer.sf.net">ToMailer</a></li> + <li><a href="http://jd4a.sf.net">JavaDoc for Android</a></li> + <il><a href="http://damus.sf.net">Damus</a></il> <li><a href="http://www.heartofgoldfarm.com">Heart of Gold Farm</a></li> </ul> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-03 05:06:35
|
Revision: 123 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=123&view=rev Author: dbrosius Date: 2010-01-03 05:06:24 +0000 (Sun, 03 Jan 2010) Log Message: ----------- javadoc Modified Paths: -------------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoPanel.java Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoPanel.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoPanel.java 2010-01-03 05:05:00 UTC (rev 122) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoPanel.java 2010-01-03 05:06:24 UTC (rev 123) @@ -23,6 +23,8 @@ * is connected to or disconnected from */ public interface MongoPanel { + /** a connection to a server has been initiated */ void init(); + /** a connection to a server has been terminated */ void term(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-03 05:05:26
|
Revision: 122 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=122&view=rev Author: dbrosius Date: 2010-01-03 05:05:00 +0000 (Sun, 03 Jan 2010) Log Message: ----------- javadoc Modified Paths: -------------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/DoubleDocument.java Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/DoubleDocument.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/DoubleDocument.java 2010-01-03 05:03:29 UTC (rev 121) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/DoubleDocument.java 2010-01-03 05:05:00 UTC (rev 122) @@ -24,6 +24,9 @@ import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; +/** + * a JTextComponent model class that only allows Double values + */ public class DoubleDocument extends PlainDocument { private static final long serialVersionUID = 8828076098529130637L; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-03 05:03:49
|
Revision: 121 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=121&view=rev Author: dbrosius Date: 2010-01-03 05:03:29 +0000 (Sun, 03 Jan 2010) Log Message: ----------- javadoc Modified Paths: -------------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ConnectionDialog.java Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ConnectionDialog.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ConnectionDialog.java 2010-01-03 05:00:20 UTC (rev 120) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/ConnectionDialog.java 2010-01-03 05:03:29 UTC (rev 121) @@ -36,6 +36,9 @@ import com.jgoodies.forms.layout.FormLayout; import com.mebigfatguy.mongobrowser.MongoBundle; +/** + * a dialog for requesting server and port information for a mongo server + */ public class ConnectionDialog extends JDialog { private static final long serialVersionUID = -3210253285939498235L; @@ -45,6 +48,9 @@ private JButton cancelButton; private boolean ok = false; + /** + * constructs the dialog + */ public ConnectionDialog() { setTitle(MongoBundle.getString(MongoBundle.Key.ConnectToServer)); initComponents(); @@ -52,14 +58,21 @@ pack(); } + /** + * creates and lays out the components + */ private void initComponents() { Container cp = getContentPane(); cp.setLayout(new BorderLayout(4, 4)); cp.add(createFormPanel(), BorderLayout.CENTER); cp.add(createCtrlPanel(), BorderLayout.SOUTH); - } + /** + * create the panel that houses the input form + * + * @return the form panel + */ private JPanel createFormPanel() { JPanel p = new JPanel(); p.setLayout(new FormLayout("6dlu, pref, 5dlu, 200px, 6dlu", "6dlu, pref, 2dlu, pref, 6dlu")); @@ -87,6 +100,11 @@ return p; } + /** + * creates the panel that houses the ok and cancel buttons + * + * @return the control panel + */ private JPanel createCtrlPanel() { JPanel p = new JPanel(); p.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); @@ -104,6 +122,9 @@ return p; } + /** + * initializes the event listeners + */ private void initListeners() { okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { @@ -119,14 +140,29 @@ }); } + /** + * retrieves whether or not the user clicked the ok button + * + * @return if the user clicked the ok button + */ public boolean isOK() { return ok; } + /** + * get the user supplied host name of the server + * + * @return the host name or ip address of the server + */ public String getHost() { return serverField.getText(); } + /** + * get the user supplied port of the server + * + * @return the port of the server + */ public int getPort() { return Integer.parseInt(portField.getText()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-03 05:00:30
|
Revision: 120 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=120&view=rev Author: dbrosius Date: 2010-01-03 05:00:20 +0000 (Sun, 03 Jan 2010) Log Message: ----------- javadoc Modified Paths: -------------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java 2010-01-03 04:57:53 UTC (rev 119) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoControlPanel.java 2010-01-03 05:00:20 UTC (rev 120) @@ -45,6 +45,9 @@ import com.mongodb.DBObject; import com.mongodb.Mongo; +/** + * the panel the houses the button bar for all the controls + */ public class MongoControlPanel extends JPanel implements MongoPanel { private static final long serialVersionUID = 1439280424726915624L; @@ -55,6 +58,11 @@ private JButton dbNewKeyValueButton; private JButton dbDeleteButton; + /** + * constructs the button bar panel + * + * @param ctxt the mediator object for the dialog + */ public MongoControlPanel(MongoContext ctxt) { context = ctxt; initComponents(); @@ -72,6 +80,7 @@ model.addElement(database); } model.addElement(new Object() { + @Override public String toString() { return "New Database..."; } @@ -95,7 +104,11 @@ }); } - + /** + * resets the enabled state of all the controls based on new selection + * + * @param selectedNode the tree node that is currently selected + */ public void adjustEnabled(MongoTreeNode selectedNode) { if (selectedNode == null) { dbNewCollectionButton.setEnabled(true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-03 04:58:13
|
Revision: 119 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=119&view=rev Author: dbrosius Date: 2010-01-03 04:57:53 +0000 (Sun, 03 Jan 2010) Log Message: ----------- javadoc Modified Paths: -------------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java 2010-01-03 04:54:28 UTC (rev 118) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoDataPanel.java 2010-01-03 04:57:53 UTC (rev 119) @@ -46,6 +46,9 @@ import com.mongodb.DBCursor; import com.mongodb.DBObject; +/** + * the panel that holds the tree of mongo database objects + */ public class MongoDataPanel extends JPanel implements MongoPanel { private static final long serialVersionUID = 1579613544693305078L; @@ -56,12 +59,20 @@ private JMenuItem newKeyValueItem; private JMenuItem deleteItem; + /** + * constructs the panel + * + * @param ctxt the mediator object + */ public MongoDataPanel(MongoContext ctxt) { context = ctxt; initComponents(); initListeners(); } + /** + * sets up the panel when a database is connected to + */ @Override public void init() { DB db = context.getDatabase(); @@ -85,6 +96,9 @@ context.setSelectedNode(null); } + /** + * cleans up a panel when a database is disconnected from + */ @Override public void term() { DefaultTreeModel model = (DefaultTreeModel)tree.getModel(); @@ -94,6 +108,9 @@ context.setSelectedNode(null); } + /** + * creates and lays out the components in this panel + */ private void initComponents() { setLayout(new BorderLayout(4, 4)); @@ -110,6 +127,9 @@ deleteItem = new JMenuItem(new DeleteAction(context)); } + /** + * installs the event listeners for the components on this panel + */ private void initListeners() { final JPopupMenu menu = new JPopupMenu(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-03 04:54:37
|
Revision: 118 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=118&view=rev Author: dbrosius Date: 2010-01-03 04:54:28 +0000 (Sun, 03 Jan 2010) Log Message: ----------- javadoc Modified Paths: -------------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoBrowserFrame.java Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoBrowserFrame.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoBrowserFrame.java 2010-01-03 04:51:14 UTC (rev 117) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/dialogs/MongoBrowserFrame.java 2010-01-03 04:54:28 UTC (rev 118) @@ -36,6 +36,9 @@ import com.mongodb.DB; import com.mongodb.Mongo; +/** + * the main frame of the browser + */ public class MongoBrowserFrame extends JFrame { private static final long serialVersionUID = 8152287910101198703L; @@ -45,6 +48,9 @@ private MongoDataPanel dataPanel; private Mediator mediator = new Mediator(); + /** + * constructs the main frame + */ public MongoBrowserFrame() { super(MongoBundle.getString(MongoBundle.Key.Title)); initComponents(); @@ -77,6 +83,7 @@ private void initListeners() { addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent we) { dispose(); System.exit(0); @@ -84,6 +91,9 @@ }); } + /** + * a mediator for all the actions that occur in the frame + */ class Mediator implements MongoContext { private JTree activeTree; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-03 04:51:20
|
Revision: 117 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=117&view=rev Author: dbrosius Date: 2010-01-03 04:51:14 +0000 (Sun, 03 Jan 2010) Log Message: ----------- use mongo-1.2.jar Removed Paths: ------------- trunk/mongobrowser/lib/mongo-1.1.jar Deleted: trunk/mongobrowser/lib/mongo-1.1.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-03 04:49:03
|
Revision: 116 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=116&view=rev Author: dbrosius Date: 2010-01-03 04:48:49 +0000 (Sun, 03 Jan 2010) Log Message: ----------- use mongo-1.2.jar Modified Paths: -------------- trunk/mongobrowser/mongobrowser.fb Modified: trunk/mongobrowser/mongobrowser.fb =================================================================== --- trunk/mongobrowser/mongobrowser.fb 2010-01-03 03:21:50 UTC (rev 115) +++ trunk/mongobrowser/mongobrowser.fb 2010-01-03 04:48:49 UTC (rev 116) @@ -4,6 +4,6 @@ ./src [Aux classpath entries] ./lib/forms-1.2.1.jar -./lib/mongo-1.1.jar +./lib/mongo-1.2.jar [Options] relative_paths=true This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-03 03:21:56
|
Revision: 115 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=115&view=rev Author: dbrosius Date: 2010-01-03 03:21:50 +0000 (Sun, 03 Jan 2010) Log Message: ----------- javadoc Modified Paths: -------------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewObjectAction.java Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewObjectAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewObjectAction.java 2010-01-03 03:21:23 UTC (rev 114) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewObjectAction.java 2010-01-03 03:21:50 UTC (rev 115) @@ -31,6 +31,9 @@ import com.mongodb.BasicDBObject; import com.mongodb.DBCollection; +/** + * an action for creating a mongo object + */ public class NewObjectAction extends AbstractAction { private static final long serialVersionUID = 5752147095730092598L; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-03 03:21:34
|
Revision: 114 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=114&view=rev Author: dbrosius Date: 2010-01-03 03:21:23 +0000 (Sun, 03 Jan 2010) Log Message: ----------- javadoc Modified Paths: -------------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewKeyValueAction.java Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewKeyValueAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewKeyValueAction.java 2010-01-03 03:20:49 UTC (rev 113) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewKeyValueAction.java 2010-01-03 03:21:23 UTC (rev 114) @@ -33,6 +33,9 @@ import com.mongodb.DBCollection; import com.mongodb.DBObject; +/** + * an action for creating a mongo object's key value pair + */ public class NewKeyValueAction extends AbstractAction { private static final long serialVersionUID = -500965537578361564L; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-03 03:21:00
|
Revision: 113 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=113&view=rev Author: dbrosius Date: 2010-01-03 03:20:49 +0000 (Sun, 03 Jan 2010) Log Message: ----------- javadoc Modified Paths: -------------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewCollectionAction.java Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewCollectionAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewCollectionAction.java 2010-01-03 03:20:22 UTC (rev 112) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/NewCollectionAction.java 2010-01-03 03:20:49 UTC (rev 113) @@ -32,6 +32,9 @@ import com.mongodb.DB; import com.mongodb.DBCollection; +/** + * an action for creating a new mongo collection + */ public class NewCollectionAction extends AbstractAction { private static final long serialVersionUID = 9090870672875251498L; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-03 03:20:33
|
Revision: 112 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=112&view=rev Author: dbrosius Date: 2010-01-03 03:20:22 +0000 (Sun, 03 Jan 2010) Log Message: ----------- javadoc Modified Paths: -------------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DisconnectAction.java Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DisconnectAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DisconnectAction.java 2010-01-03 03:19:55 UTC (rev 111) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DisconnectAction.java 2010-01-03 03:20:22 UTC (rev 112) @@ -25,6 +25,9 @@ import com.mebigfatguy.mongobrowser.MongoBundle; import com.mebigfatguy.mongobrowser.MongoContext; +/** + * an action for disconnecting from a mongo database + */ public class DisconnectAction extends AbstractAction { private static final long serialVersionUID = -5795316226405751888L; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-03 03:20:01
|
Revision: 111 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=111&view=rev Author: dbrosius Date: 2010-01-03 03:19:55 +0000 (Sun, 03 Jan 2010) Log Message: ----------- javadoc Modified Paths: -------------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DeleteAction.java Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DeleteAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DeleteAction.java 2010-01-03 03:19:23 UTC (rev 110) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/DeleteAction.java 2010-01-03 03:19:55 UTC (rev 111) @@ -30,6 +30,9 @@ import com.mongodb.DBCollection; import com.mongodb.DBObject; +/** + * an action for deleting a mongo object + */ public class DeleteAction extends AbstractAction { private static final long serialVersionUID = 9057255369669193765L; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-03 03:19:34
|
Revision: 110 http://mongobrowser.svn.sourceforge.net/mongobrowser/?rev=110&view=rev Author: dbrosius Date: 2010-01-03 03:19:23 +0000 (Sun, 03 Jan 2010) Log Message: ----------- javadoc Modified Paths: -------------- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/ConnectAction.java Modified: trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/ConnectAction.java =================================================================== --- trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/ConnectAction.java 2010-01-03 03:18:50 UTC (rev 109) +++ trunk/mongobrowser/src/com/mebigfatguy/mongobrowser/actions/ConnectAction.java 2010-01-03 03:19:23 UTC (rev 110) @@ -29,6 +29,9 @@ import com.mebigfatguy.mongobrowser.dialogs.ConnectionDialog; import com.mongodb.Mongo; +/** + * an action for connecting to a mongo database + */ public class ConnectAction extends AbstractAction { private static final long serialVersionUID = -4704951174439411332L; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |