[MOBY-guts] biomoby commit
Eddie Kawas
kawas at dev.open-bio.org
Fri Jan 30 14:48:02 UTC 2009
kawas
Fri Jan 30 09:48:01 EST 2009
Update of /home/repository/moby/moby-live/Java/src/Clients
In directory dev.open-bio.org:/tmp/cvs-serv16633/src/Clients
Modified Files:
CreateMobyInput.java
Log Message:
updated client. when invoked with a -service and data is loaded, the panel populates it members.
moby-live/Java/src/Clients CreateMobyInput.java,1.10,1.11
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/Clients/CreateMobyInput.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- /home/repository/moby/moby-live/Java/src/Clients/CreateMobyInput.java 2008/04/19 19:11:18 1.10
+++ /home/repository/moby/moby-live/Java/src/Clients/CreateMobyInput.java 2009/01/30 14:48:01 1.11
@@ -6,34 +6,35 @@
// Copyright Martin Senger (martin.senger at gmail.com).
//
-import org.biomoby.shared.CentralCached;
-import org.biomoby.shared.MobyDataType;
-import org.biomoby.shared.MobyService;
-import org.biomoby.shared.event.LogListener;
-import org.biomoby.shared.event.Notifier;
-import org.biomoby.service.dashboard.data.DataTypeTreeTable;
-import org.biomoby.service.dashboard.data.ServiceInputPanel;
-import org.biomoby.client.CentralDigestCachedImpl;
-import org.biomoby.client.CmdLineHelper;
-
-import org.tulsoft.tools.BaseCmdLine;
-import org.tulsoft.shared.FileUtils;
-import org.tulsoft.shared.GException;
-import org.tulsoft.tools.gui.SwingUtils;
-
-import javax.swing.JFrame;
-import javax.swing.JButton;
-import javax.swing.JPanel;
-
-import java.awt.BorderLayout;
-import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+import org.biomoby.client.CmdLineHelper;
+import org.biomoby.service.dashboard.data.DataTypeTreeTable;
+import org.biomoby.service.dashboard.data.ServiceInputPanel;
+import org.biomoby.shared.CentralCached;
+import org.biomoby.shared.MobyDataType;
+import org.biomoby.shared.MobyException;
+import org.biomoby.shared.MobyService;
+import org.biomoby.shared.event.LogListener;
import org.jdom.Document;
-import org.jdom.output.XMLOutputter;
import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+import org.tulsoft.tools.BaseCmdLine;
+import org.tulsoft.tools.gui.JFileChooserWithHistory;
+import org.tulsoft.tools.gui.SwingUtils;
/**
* A small command-line application showing how to use
@@ -62,10 +63,13 @@
}
});
- JPanel panel = new JPanel(new BorderLayout());
- panel.add (printButton, BorderLayout.SOUTH);
- panel.add (treeTable.scrollable(), BorderLayout.CENTER);
-
+ JPanel panel = new JPanel(new GridBagLayout());
+ SwingUtils.addComponent
+ (panel, treeTable,
+ 0, 0, 2, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST, 1.0, 1.0);
+ SwingUtils.addComponent
+ (panel, printButton,
+ 0, 1, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST, 1.0, 0.0);
showIt ("Data type: " + rootType.getName(), panel);
}
@@ -86,12 +90,39 @@
onPrint (tables);
}
});
+ JButton loadButton = new JButton ("Load Input");
+ loadButton.addActionListener (new ActionListener() {
+ public void actionPerformed (ActionEvent e) {
+ JFileChooserWithHistory chooser = new JFileChooserWithHistory(System.getProperty("tmp.dir"), "load-file");
+ chooser.getFileChooser().setMultiSelectionEnabled(false);
+ if (chooser.getFileChooser().showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
+ File chosen = chooser.getFileChooser().getSelectedFile();
+ StringBuilder sb = new StringBuilder();
+ String line = null;
+ try {
+ BufferedReader br = new BufferedReader(new FileReader(chosen));
+ while ((line = br.readLine()) != null)
+ sb.append(line + "\n");
+ onLoad(tables, sb.toString());
+ } catch (FileNotFoundException fnfe) {
+
+ } catch (IOException ioe) {
+
+ }
+
+ }
+
+ }
+ });
SwingUtils.addComponent
(panel, tables,
- 0, 0, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST, 1.0, 1.0);
+ 0, 0, 2, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST, 1.0, 1.0);
SwingUtils.addComponent
(panel, printButton,
0, 1, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST, 1.0, 0.0);
+ SwingUtils.addComponent
+ (panel, loadButton,
+ 1, 1, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST, 1.0, 0.0);
showIt ("Service: " + service.getName(), panel);
}
@@ -124,6 +155,14 @@
protected void onPrint (ServiceInputPanel inputs) {
msgln (inputs.toXML());
}
+
+ protected void onLoad (ServiceInputPanel inputs, String xml) {
+ try {
+ inputs.setValues(xml);
+ } catch (MobyException me) {
+ me.printStackTrace();
+ }
+ }
/*************************************************************************
*
More information about the MOBY-guts
mailing list