[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Fri Jun 8 14:04:27 UTC 2007
gordonp
Fri Jun 8 10:04:27 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv28675/src/main/ca/ucalgary/seahawk/gui
Modified Files:
FileAndTextTransferHandler.java MobyContentClipboard.java
MobyContentGUI.java MobyContentHelpPane.java
MobyContentPane.java MobyDataObjectWidget.java
MobyObjectTransferHandler.java MobySaveDialog.java
MobyServicesGUI.java MobyShimmer.java
Added Files:
MobyContentProducer.java SeahawkOptionsGUI.java
Log Message:
Commit of Seahawk 1.0 updates and associated core updates
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentProducer.java,NONE,1.1 SeahawkOptionsGUI.java,NONE,1.1 FileAndTextTransferHandler.java,1.5,1.6 MobyContentClipboard.java,1.3,1.4 MobyContentGUI.java,1.8,1.9 MobyContentHelpPane.java,1.2,1.3 MobyContentPane.java,1.7,1.8 MobyDataObjectWidget.java,1.1,1.2 MobyObjectTransferHandler.java,1.1,1.2 MobySaveDialog.java,1.2,1.3 MobyServicesGUI.java,1.10,1.11 MobyShimmer.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/FileAndTextTransferHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/FileAndTextTransferHandler.java 2007/04/26 15:15:45 1.5
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/FileAndTextTransferHandler.java 2007/06/08 14:04:27 1.6
@@ -33,7 +33,6 @@
}
public boolean importData(JComponent c, Transferable t) {
- System.err.println("importData called for file and text transfer handler");
if (!canImport(c, t.getTransferDataFlavors())) {
System.err.println("Cannot drop data into Seahawk: " + t);
return false;
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java 2007/04/03 02:34:08 1.3
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java 2007/06/08 14:04:27 1.4
@@ -1,13 +1,10 @@
package ca.ucalgary.seahawk.gui;
+import ca.ucalgary.seahawk.util.DataRecorder;
+
import org.biomoby.client.MobyRequestEventHandler;
-import org.biomoby.shared.data.MobyContentInstance;
-import org.biomoby.shared.data.MobyDataInstance;
-import org.biomoby.shared.data.MobyDataJob;
-import org.biomoby.shared.data.MobyDataObject;
-import org.biomoby.shared.data.MobyDataObjectSet;
-import org.biomoby.shared.data.MobyDataUtils;
+import org.biomoby.shared.data.*;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
@@ -51,8 +48,8 @@
private MobyDataInstance itemToDelete;
private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(MobyContentClipboard.class);
public MobyContentClipboard(MobyContentGUI cGUI, MobyServicesGUI sGUI, JTabbedPane parentComponent,
- JLabel statusBar){
- super(cGUI, sGUI, parentComponent, statusBar);
+ DataRecorder recorder, JLabel statusBar){
+ super(cGUI, sGUI, parentComponent, recorder, statusBar);
ClassLoader cl = getClass().getClassLoader();
if(cl == null){
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java 2007/04/26 15:23:59 1.8
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java 2007/06/08 14:04:27 1.9
@@ -19,8 +19,9 @@
import org.biomoby.client.MobyRequest;
import org.biomoby.client.MobyRequestEvent;
import org.biomoby.client.MobyRequestEventHandler;
+import org.biomoby.shared.*;
import org.biomoby.shared.data.*;
-import ca.ucalgary.seahawk.util.DescriptiveFileFilter;
+import ca.ucalgary.seahawk.util.*;
/**
* Main interface component: textually displays the data in a MOBY content XML document.
@@ -38,6 +39,7 @@
public final static String SAVE_BUTTON_NAME = "MCGsaveButton";
public final static String PRINT_BUTTON_NAME = "MCGprintButton";
public final static String HELP_BUTTON_NAME = "MCGhelpButton";
+ public final static String SETTINGS_BUTTON_NAME = "MCGsettingsButton";
public final static String OPEN_OPTION_NAME = "MCGopenPopup";
public final static String FILE_OPEN_OPTION_NAME = "MCGopenPopupFileOption";
public final static String WEB_OPEN_OPTION_NAME = "MCGopenPopupWebOption";
@@ -69,11 +71,13 @@
private JButton saveButton;
private JButton printButton;
private JButton helpButton;
+ private JButton settingsButton;
private Transformer moby2HTMLConverter; // XSLT engine
private MobyServicesGUI servicesGUI;
private DocumentBuilder docBuilder = null;
private MobyContentClipboard clipboard;
private MobyContentHelpPane helpPane;
+ private DataRecorder dataRecorder; // used for workflow export, etc.
private boolean setup;
private Map request2tab;
private int activeTabIndex = -1;
@@ -163,6 +167,15 @@
gridbag.setConstraints(helpButton, c);
statusPanel.add(helpButton);
+ settingsButton = new JButton(new ImageIcon(cl.getResource("ca/ucalgary/seahawk/resources/images/settings.gif")));
+ settingsButton.setToolTipText("Show program options");
+ settingsButton.setPreferredSize(buttonSize);
+ settingsButton.setEnabled(true);
+ settingsButton.addActionListener(this);
+ settingsButton.setName(SETTINGS_BUTTON_NAME);
+ gridbag.setConstraints(settingsButton, c);
+ statusPanel.add(settingsButton);
+
status = new JLabel(DEFAULT_STATUS_MSG, SwingConstants.LEFT);
JPanel labelPanel = new JPanel();
labelPanel.setLayout(new BorderLayout());
@@ -182,9 +195,16 @@
tabbedPane.setToolTipText("Hit <Control-T> to display a new tab");
tabbedPane.addKeyListener(this);
+ try{
+ dataRecorder = new DataRecorder(servicesGUI.getMobyCentralImpl());
+ } catch(Exception e){
+ e.printStackTrace();
+ }
+
clipboard = new MobyContentClipboard(this,
servicesGUI,
- tabbedPane,
+ tabbedPane,
+ dataRecorder,
status);
getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER);
@@ -293,19 +313,20 @@
* Called by MOBYRequest when the service request is being sent. We
* can create the GUI and wait message here.
*/
- public void start(MobyRequest request, int requestID){
+ public void start(MobyRequestEvent requestEvent){
if(!setup){
setup();
}
MobyContentPane tab = createTab("New Request");
- request2tab.put(new Integer(requestID), tab);
- tab.start(request, requestID);
+ request2tab.put(new Integer(requestEvent.getID()), tab);
+ tab.start(requestEvent);
}
protected MobyContentPane createTab(String title){
MobyContentPane tab = new MobyContentPane(this,
servicesGUI,
- tabbedPane,
+ tabbedPane,
+ dataRecorder,
status);
setVisible(true);
tab.setPreferredSize(getContentSize());
@@ -469,9 +490,10 @@
public int showHelpTab(){
if(helpPane == null){
helpPane = new MobyContentHelpPane(this,
- servicesGUI,
- tabbedPane,
- status);
+ servicesGUI,
+ tabbedPane,
+ dataRecorder,
+ status);
}
// Not a tab in the display yet
@@ -877,44 +899,28 @@
java.util.Locale.setDefault(java.util.Locale.ENGLISH);
// Unless overridden on the command line, use xerces
- if(System.getProperty("javax.xml.parsers.DocumentBuilderFactory") == null){
- System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
- "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
- }
+ //if(System.getProperty("javax.xml.parsers.DocumentBuilderFactory") == null){
+ // System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
+ // "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
+ //}
// Unless overridden on the command line, use xalan
- if(System.getProperty("javax.xml.transform.TransformerFactory") == null){
- System.setProperty("javax.xml.transform.TransformerFactory",
- "org.apache.xalan.processor.TransformerFactoryImpl");
- }
+ //if(System.getProperty("javax.xml.transform.TransformerFactory") == null){
+ // System.setProperty("javax.xml.transform.TransformerFactory",
+ // "org.apache.xalan.processor.TransformerFactoryImpl");
+ //}
// Setting this explicitly prevents repeated calls to the META-INF file encoding the same
- if(System.getProperty("org.apache.xerces.xni.parser.XMLParserConfiguration") == null){
- System.setProperty("org.apache.xerces.xni.parser.XMLParserConfiguration",
- "org.apache.xerces.parsers.StandardParserConfiguration");
- }
+ //if(System.getProperty("org.apache.xerces.xni.parser.XMLParserConfiguration") == null){
+ // System.setProperty("org.apache.xerces.xni.parser.XMLParserConfiguration",
+ // "org.apache.xerces.parsers.StandardParserConfiguration");
+ //}
-// if(System.getProperty("org.apache.commons.logging.Log") == null){
-// System.setProperty("org.apache.commons.logging.Log",
-// "org.apache.commons.logging.impl.SimpleLog");
-// }
-
-// if(System.getProperty("org.apache.commons.logging.simplelog.defaultlog") == null){
-// System.setProperty("org.apache.commons.logging.simplelog.defaultlog",
-// "error");
-// }
+ // First, restore any user preferences (uses default settings file location)
+ SeahawkOptions.restoreSettings();
- // The following command will cache all data type definitions for this session
- new Thread(){
- public void run(){org.biomoby.shared.MobyDataType.getDataType("Object");}
- }.start();
- new Thread(){
- public void run(){org.biomoby.shared.MobyServiceType.getServiceType("Analysis");}
- }.start();
- // And the service definitions
- //new Thread(){
- // public void run(){org.biomoby.shared.MobyService.getService("","");}
- // }.start();
+ // Asynchronously load up ontology data so it's ready when the user needs it.
+ cacheOntologies();
MobyContentGUI gui = ca.ucalgary.seahawk.util.MobyUtils.getMobyContentGUI(new JLabel());
gui.setDefaultCloseOperation(defaultCloseOperation);
@@ -942,6 +948,43 @@
}
}
+ protected static void cacheOntologies(){
+ final org.biomoby.registry.meta.Registry preferredRegistry = SeahawkOptions.getRegistry();
+
+ // Redirect the registry endpoints to local cache files if available
+ // preferredRegistry and/or dataDefURL may be null, if not cached, but that's okay to pass around
+
+ // The following command will cache all data type definitions for this session
+ new Thread(){
+ public void run(){
+ URL dataDefURL = RegistryCache.getDataTypeOntologyURL(preferredRegistry);
+ if(dataDefURL != null){
+ // Use the cached file rather than actually going to the registry
+ MobyDataType.loadDataTypes(dataDefURL, preferredRegistry);
+ }
+ else{
+ MobyDataType.getDataType("Object", preferredRegistry);
+ }
+ }
+ }.start();
+ new Thread(){
+ public void run(){
+ URL serviceTypeDefURL = RegistryCache.getServiceTypeOntologyURL(preferredRegistry);
+ if(serviceTypeDefURL != null){
+ // Use the cached file rather than actually going to the registry
+ MobyServiceType.loadServiceTypes(serviceTypeDefURL, preferredRegistry);
+ }
+ else{
+ MobyServiceType.getServiceType("Analysis", preferredRegistry);
+ }
+ }
+ }.start();
+ // And the service definitions
+ //new Thread(){
+ // public void run(){org.biomoby.shared.MobyService.getService("","");}
+ // }.start();
+ }
+
/**
* Method to be called when an applet is being decommissioned.
*/
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentHelpPane.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentHelpPane.java 2007/02/08 16:59:57 1.2
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentHelpPane.java 2007/06/08 14:04:27 1.3
@@ -1,6 +1,8 @@
package ca.ucalgary.seahawk.gui;
+import ca.ucalgary.seahawk.util.DataRecorder;
+
import org.biomoby.client.MobyRequestEventHandler;
import org.biomoby.shared.data.MobyContentInstance;
import org.biomoby.shared.data.MobyDataInstance;
@@ -39,8 +41,8 @@
private static URL helpHTMLURL;
private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(MobyContentHelpPane.class);
public MobyContentHelpPane(MobyContentGUI cGUI, MobyServicesGUI sGUI, JTabbedPane parentComponent,
- JLabel statusBar){
- super(cGUI, sGUI, parentComponent, statusBar);
+ DataRecorder recorder, JLabel statusBar){
+ super(cGUI, sGUI, parentComponent, recorder, statusBar);
// So JFCUnit tests can find it
setName(HELP_TAB_NAME);
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java 2007/04/18 16:04:06 1.7
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java 2007/06/08 14:04:27 1.8
@@ -1,8 +1,7 @@
package ca.ucalgary.seahawk.gui;
-// For external links
-import ca.ucalgary.seahawk.util.BrowserLauncher;
+import ca.ucalgary.seahawk.util.*;
import org.biomoby.client.MobyRequest;
import org.biomoby.client.MobyRequestEvent;
@@ -19,14 +18,10 @@
import org.apache.xpath.*;
import org.apache.xpath.objects.*;
-import ca.ucalgary.seahawk.util.*;
-
import javax.swing.*;
import javax.swing.event.*;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.Point;
+import java.awt.*;
import java.awt.print.*;
import java.awt.event.*;
import java.io.*;
@@ -67,17 +62,19 @@
private int lastClickY = 1;
private boolean hasFailed = false;
private boolean isContentsXML = false;
+ private DataRecorder dataRecorder;
// Text selection members
private int dot;
private int mark;
private String selectedTextData;
private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(MobyContentPane.class);
- public MobyContentPane(MobyContentGUI cGUI, MobyServicesGUI sGUI, JTabbedPane parentComponent, JLabel statusBar){
+ public MobyContentPane(MobyContentGUI cGUI, MobyServicesGUI sGUI, JTabbedPane parentComponent, DataRecorder recorder, JLabel statusBar){
tabbedPane = parentComponent;
status = statusBar;
contentGUI = cGUI;
servicesGUI = sGUI;
+ dataRecorder = recorder;
// The next line is what provides the drag 'n' drop capability
addKeyListener(this);
@@ -89,7 +86,6 @@
editorPane = new PrintableJEditorPane();
editorPane.addKeyListener(this);
editorPane.setTransferHandler(getTransferHandler());
- //editorPane.setPreferredSize(parentComponent.getPreferredSize());
editorPane.setEditable(false);
editorPane.addMouseListener(this);
editorPane.addHyperlinkListener(this);
@@ -254,11 +250,12 @@
else if(htmlContents.indexOf(" ") != -1){
htmlContents = htmlContents.replaceAll(">([^<]+ [^<]+)<", "><pre>$1</pre><");
}
- //else{
+ else{
// Break up any really long DNA/AA stretches
- htmlContents = htmlContents.replaceAll("([a-zA-Z]{60,})", "<pre>$1</pre>");
- htmlContents = htmlContents.replaceAll("([a-zA-Z]{60})", "$1\n");
- //}
+ System.err.println("Trying to break up long streches");
+ htmlContents = htmlContents.replaceAll("([a-zA-Z]{60})", "\n<br><tt>$1</tt>");
+ htmlContents = htmlContents.replaceAll("([a-zA-Z]{60}</tt>)([a-zA-Z]{1,})", "$1\n<br><tt>$2</tt><br>\n");
+ }
// Otherwise assume it's formatted
resultBuffer.append(htmlContents);
}
@@ -286,9 +283,7 @@
// Assume it's plain text, or whatever the JEditorPane can glean from the content-type
// such as a remote HTML or RTF doc, because result buffer will be empty in condition below
else{
- editorPane.setContentType("text/plain");
isContentsXML = false;
- editorPane.setFont(java.awt.Font.getFont("Monospaced"));
}
if(resultBuffer.length() == 0){
@@ -313,7 +308,12 @@
logger.error("Failure in loading MOBYfied binary data:\n" + e);
}
// Shouldn't get here unless either not binary, or the binary data load failed
- editorPane.setPage(url);
+ System.err.println("Is plain text");
+ editorPane.setContentType("text/html");
+ resultBuffer = new StringBuffer("<html><body><pre>"+
+ getInputStreamContents(url.openStream()).replaceAll("&", "&").replaceAll("<","<")+
+ "</pre></body></html>");
+ editorPane.setText(resultBuffer.toString());
}
else{
editorPane.setText(resultBuffer.toString());
@@ -322,6 +322,8 @@
}
// Regardless of the doc, scroll to a reference called "start:" if available.
// By default the pane will annoyingly scroll to the bottom when new data is loaded.
+ try{Thread.sleep(1000);} // Give it time to paint before scrolling
+ catch(Exception te){}
editorPane.scrollToReference("start");
}
catch (java.io.IOException ioe) {
@@ -385,11 +387,19 @@
* Called by MOBYRequest when the service request is being sent. We
* can create the GUI and wait message here.
*/
- public void start(MobyRequest request, int requestID){
+ public void start(MobyRequestEvent requestEvent){
hasFailed = false;
tabbedPane.setSelectedComponent(this);
- tabbedPane.setTitleAt(tabbedPane.indexOfComponent(this), ""+requestID+"-"+request.getService().getName());
+ tabbedPane.setTitleAt(tabbedPane.indexOfComponent(this),
+ ""+requestEvent.getID()+"-"+requestEvent.getService().getName());
setWaitScreen();
+ // Store the request being sent (w/ 2ndary params and all),
+ // for reference (e.g. when exporting a workflow)
+ try{
+ dataRecorder.saveInputData(requestEvent);
+ } catch(Exception e){
+ e.printStackTrace();
+ }
}
public void stop(MobyRequest request, int requestID){
@@ -474,6 +484,20 @@
return hasFailed;
}
+ public String toScufl() throws Exception{
+ URL[] historyToExport = (URL[]) history.toArray(new URL[history.size()]);
+ if(historyIndex != historyToExport.length-1){
+ // Shorten the array if we aren't cuurently on the last doc (i.e.
+ // we don't want to export documents forward in the history)
+ URL[] truncatedHistory = new URL[historyIndex];
+ System.arraycopy(historyToExport, 0, truncatedHistory, 0, historyIndex);
+ historyToExport = truncatedHistory;
+ }
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ dataRecorder.exportWorkflow(historyToExport, output, DataRecorder.TAVERNA15);
+ return output.toString();
+ }
+
// Save the MOBY data to a file, then tell NewBrowser to load that local file URL
protected void loadDataInBrowser(MobyRequestEvent mre){
@@ -509,21 +533,12 @@
}
try {
- // Create temp file.
- File temp = File.createTempFile(serviceToFilePrefix(mobyRequest.getService()), ".xml");
-
- // Delete temp file when program exits.
- temp.deleteOnExit();
-
- // Write to temp file
- FileWriter out = new FileWriter(temp);
- out.write(mre.getContentsXML());
- out.close();
- gotoURL(temp.toURL(), true);
- } catch (IOException ioe) {
+ URL outputURL = dataRecorder.saveOutputData(mre);
+ gotoURL(outputURL, true);
+ } catch (Exception e) {
failed("Could not write a local file");
- editorPane.setText("ERROR: Could not write temporary file for MOBY results: " + ioe);
- ioe.printStackTrace();
+ editorPane.setText("ERROR: Could not write temporary file for MOBY results: " + e);
+ e.printStackTrace();
return;
}
succeeded(responseType);
@@ -821,12 +836,12 @@
}
if(mobyString != null){
- mobyData = new MobyDataString("", mobyString);
+ mobyData = new MobyDataString("", mobyString, SeahawkOptions.getRegistry());
}
else{
- mobyData = new MobyDataObject("");
+ mobyData = new MobyDataObject("", SeahawkOptions.getRegistry());
}
- mobyData.addNamespace(MobyNamespace.getNamespace(namespace));
+ mobyData.addNamespace(MobyNamespace.getNamespace(namespace, SeahawkOptions.getRegistry()));
if(mobyID != null){
mobyData.setId(mobyID);
@@ -952,8 +967,8 @@
* This method tries to figure out what kinds of MOBY Data could be
* created from the string given. e.g. Keywords, DNASequence, etc.
*/
- protected MobyDataInstance[] loadMobyDataFromString(String data, boolean reverseSelected){
- return MobyUtils.convertStringToObjects(data, reverseSelected);
+ protected MobyDataInstance[] loadMobyDataFromString(String data){
+ return MobyUtils.convertStringToObjects(data);
}
public boolean isMobyURL(URL u){
@@ -964,8 +979,8 @@
// MouseListener interface implementation
public void mouseClicked(MouseEvent e){
// Allow middle button paste
- if(e.getButton() == MouseEvent.BUTTON3 ||
- e.getButton() == MouseEvent.BUTTON2 && e.isAltDown()){
+ if(e.getButton() == MouseEvent.BUTTON2 ||
+ e.getButton() == MouseEvent.BUTTON3 && e.isAltDown()){
paste();
}
}
@@ -999,7 +1014,7 @@
if(selectedTextData == null){
return;
}
- MobyDataInstance[] mobyData = loadMobyDataFromString(selectedTextData, mark > dot);
+ MobyDataInstance[] mobyData = loadMobyDataFromString(selectedTextData);
if(mobyData == null || mobyData.length == 0){
logger.warn("No MobyData could be made from the selected text");
return;
@@ -1066,111 +1081,6 @@
status.setText("Click your selection to use as MOBY data!");
}
- private MobyService getService(int index) throws Exception{
- String filename = ((URL) history.elementAt(index)).getPath();
- if(filename.lastIndexOf('/') != -1){
- filename = filename.substring(filename.lastIndexOf('/')+1);
- }
- return filePrefixToService(filename);
- }
-
- private String getScuflProcessor(int index) throws Exception{
- MobyService service = getService(index);
-
- if(service == null){ //data was loaded from file, not from a service
- return "";
- }
-
- StringBuffer secondaryParams = new StringBuffer();
- // example input <s:Parameter s:name="species">human</s:Parameter>
-
- return " <s:processor name=\""+service.getName()+"\">\n"+
- " <s:description>"+service.getDescription()+"</s:description>\n" +
- " <s:biomobywsdl>\n"+
- " <s:mobyEndpoint>"+servicesGUI.getMobyCentralImpl().getRegistryEndpoint()+"</s:mobyEndpoint>\n"+
- " <s:serviceName>"+service.getName()+"</s:serviceName>\n"+
- " <s:authorityName>"+service.getAuthority()+"</s:authorityName>\n"+
- secondaryParams.toString() +
- " </s:biomobywsdl>\n"+
- " </s:processor>\n";
-
- }
-
- public String toScufl() throws Exception{
-
- StringBuffer scufl = new StringBuffer();
- scufl.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<s:scufl xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\" version=\"0.2\" log=\"0\">\n" +
- " <s:workflowdescription lsid=\"urn:lsid:seahawk.ucalgary.ca:macro:"+System.currentTimeMillis()+
- "\" author=\"Seahawk\" title=\"Browsing Macro Saved By Seahawk User\" />\n");
-
- // The first service to be called
- int i = 0;
- MobyService firstService = getService(i);
- while(firstService == null){
- firstService = getService(++i);
- }
- MobyPrimaryData[] inputData = firstService.getPrimaryInputs();
- if(inputData != null && inputData.length != 0){
- // Seahawk only deals with single input services for now
- scufl.append(" <s:processor name=\"Create_moby_data\">\n"+
- " <s:description>Generates "+inputData[0].getDataType().getDescription()+"</s:description>\n"+
- " <s:biomobyobject>\n"+
- " <s:mobyEndpoint>"+servicesGUI.getMobyCentralImpl().getRegistryEndpoint()+"</s:mobyEndpoint>\n"+
- " <s:serviceName>"+inputData[0].getDataType().getName()+"</s:serviceName>\n"+
- " <s:authorityName />\n"+
- " </s:biomobyobject>\n"+
- " </s:processor>\n");
-
- MobyNamespace[] inputNS = inputData[0].getNamespaces();
- String nsNames = "Object";
- if(inputNS != null && inputNS.length != 0){
- String firstNS = inputNS[0].getName().replaceAll("urn:lsid:biomoby.org:namespacetype:(.*?):.*", "$1");
- nsNames = firstNS;
- for(int j = 1; j < inputNS.length; j++){
- nsNames = nsNames + "_or_" + inputNS[j].getName().replaceAll("[^A-Za-z0-9_]", "_");
- }
- nsNames = nsNames.replaceAll("[^A-Za-z0-9_]", "_");
- nsNames = nsNames + "_";
- // Predefine the namespace for the user since it's available
- scufl.append("<s:processor name=\""+nsNames+"namespace\" boring=\"true\"><s:stringconstant>"
- + firstNS + "</s:stringconstant></s:processor>\n");
- }
- else{
- scufl.append("<s:source name=\""+nsNames+"namespace\" />\n");
- }
- scufl.append("<s:source name=\""+nsNames+"id\"><s:metadata><s:mimeTypes>\n" +
- " <s:mimeType>text/plain</s:mimeType>\n"+
- "</s:mimeTypes></s:metadata></s:source>\n");
-
- scufl.append(getScuflProcessor(i));
-
- scufl.append("<s:link source=\""+nsNames+"id\" sink=\"Create_moby_data:id\" />\n" +
- "<s:link source=\""+nsNames+"namespace:value\" sink=\"Create_moby_data:namespace\" />\n" +
- "<s:link source=\"Create_moby_data:mobydata\" sink=\""+
- firstService.getName()+":input\"/>");
- }
- else{
- // service has no input if we're here...
- scufl.append(getScuflProcessor(i));
- }
-
- // for each history element, there was a service execution that generated the data
- for(; i < historyIndex; i++){
- scufl.append(getScuflProcessor(i+1));
- scufl.append("<s:link source=\""+getService(i).getName()+":output\" sink=\""+
- getService(i+1).getName()+":input\" />\n");
- }
- scufl.append("<s:link source=\""+getService(historyIndex).getName()+
- ":output\" sink=\"FinalDisplay\" />\n");
- scufl.append("<s:sink name=\"FinalDisplay\"><s:metadata><s:mimeTypes>" +
- "<s:mimeType>text/xml</s:mimeType></s:mimeTypes></s:metadata>"+
- "</s:sink>\n");
- scufl.append("</s:scufl>\n");
-
- return scufl.toString();
- }
-
/**
* Implemented to provide paste functionality (control-v or the paste button on a Sun keyboard),
* since the editor panes are not editable and therefore by default do not respond to
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyDataObjectWidget.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyDataObjectWidget.java 2007/04/26 15:19:58 1.1
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyDataObjectWidget.java 2007/06/08 14:04:27 1.2
@@ -16,7 +16,7 @@
* the user to drop data onto it via a MobyObjectTransferHandler
* (hence the implementation of MobyObjectReceiver).
*/
-public class MobyDataObjectWidget extends JLabel implements MobyObjectReceiver{
+public class MobyDataObjectWidget extends JLabel implements MobyObjectReceiver, MobyContentProducer{
public static final int PARAM_TOOLTIP_WIDTH = 50;
public static final Color INSTANTIATED_FG_COLOUR = Color.DARK_GRAY;
public static final Color UNINSTANTIATED_FG_COLOUR = Color.RED;
@@ -58,7 +58,17 @@
setTransferHandler(MobyObjectTransferHandler.getHandler(client));
}
+ // Enables copying of MOBY data to the clipboard
+ addMouseListener(new DragMouseAdapter());
+ }
+ // Shamelessly copied from the Java DnD tutorial's LabalDND.java
+ private class DragMouseAdapter extends MouseAdapter {
+ public void mousePressed(MouseEvent e) {
+ JComponent c = (JComponent)e.getSource();
+ TransferHandler handler = c.getTransferHandler();
+ handler.exportAsDrag(c, e, TransferHandler.COPY);
+ }
}
private Icon getInstantiatedIcon(){
@@ -221,4 +231,11 @@
acceptableData.put(name, targetData);
return acceptableData;
}
+
+ /**
+ * Used to send data out to the clipboard.
+ */
+ public MobyContentInstance exportMobyContent(){
+ return null;
+ }
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyObjectTransferHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyObjectTransferHandler.java 2007/04/26 15:19:58 1.1
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyObjectTransferHandler.java 2007/06/08 14:04:27 1.2
@@ -1,6 +1,7 @@
package ca.ucalgary.seahawk.gui;
import ca.ucalgary.seahawk.util.HTMLUtils;
+import ca.ucalgary.seahawk.util.MobyUtils;
import ca.ucalgary.seahawk.services.MobyClient;
import org.biomoby.shared.MobyPrefixResolver;
import org.biomoby.shared.*;
@@ -28,7 +29,7 @@
* be convertible into a desired Moby Object data type in order to be dropped. Components using this
* class as their TransferHandler should implement MobyObjectReceiver for this to do something meaningful.
*/
-public class MobyObjectTransferHandler extends FileAndTextTransferHandler {
+public class MobyObjectTransferHandler extends FileAndTextTransferHandler implements ClipboardOwner{
private MobyClient client;
private static Map<MobyClient,MobyObjectTransferHandler> handlers;
@@ -309,5 +310,34 @@
keeper.put(key, entry.getValue());
}
}
-}
+ /**
+ * Drag and copy functiunality.
+ */
+ public void exportToClipboard(JComponent comp,
+ Clipboard clip,
+ int action) throws IllegalStateException{
+ Transferable createdData = null;
+ try{
+ if(!(comp instanceof MobyContentProducer)){
+ throw new IllegalStateException("Component calling exportToClipboard " +
+ "was not a MobyObjectProducer as expected, export aborted");
+ }
+ createdData = MobyUtils.createTransferable(((MobyContentProducer) comp).exportMobyContent());
+ clip.setContents(createdData, this);
+ } catch(IllegalStateException e){
+ // To be consistent with the normal transfer handler, call exportDone
+ // even if we failed
+ exportDone(comp, createdData, TransferHandler.NONE);
+ throw e;
+ }
+ exportDone(comp, createdData, action);
+ }
+
+ /**
+ * To satisfy the ClipboardOwner interface.
+ */
+ public void lostOwnership(Clipboard clipboard, Transferable contents){
+
+ }
+}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobySaveDialog.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobySaveDialog.java 2007/02/08 16:59:57 1.2
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobySaveDialog.java 2007/06/08 14:04:27 1.3
@@ -113,6 +113,7 @@
ostream.flush();
ostream.close();
} catch (Exception ex) {
+ ex.printStackTrace();
JOptionPane.showMessageDialog(null, "Cannot save the Seahawk tab history as a Taverna workflow: "+ex,
"Error saving", JOptionPane.ERROR_MESSAGE);
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java 2007/04/26 15:26:24 1.10
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java 2007/06/08 14:04:27 1.11
@@ -2,20 +2,23 @@
import ca.ucalgary.seahawk.services.MobyClient;
import ca.ucalgary.seahawk.util.HTMLUtils;
-import javax.swing.*;
-import org.w3c.dom.*;
+import ca.ucalgary.seahawk.util.SeahawkOptions;
+
import org.biomoby.shared.*;
import org.biomoby.shared.data.*;
import org.biomoby.client.MobyRequest;
import org.biomoby.client.MobyRequestEventHandler;
-import java.lang.ref.WeakReference;
+import org.w3c.dom.*;
+
import java.awt.event.*;
import java.awt.*;
import java.io.*;
+import java.lang.ref.WeakReference;
import java.text.Collator;
import java.net.URL;
import java.util.*;
+import javax.swing.*;
import javax.swing.event.PopupMenuListener;
import javax.swing.event.PopupMenuEvent;
@@ -249,8 +252,8 @@
// Need to choose among multiple parameters
if(paramMatch.size() > 1){
targetParamName = (String) JOptionPane.showInputDialog(null,
- "Choose the service parameter the chosen " +
- "object represents",
+ "Choose the service parameter\n"+
+ "the chosen object represents",
"Service Parameter Choice",
JOptionPane.QUESTION_MESSAGE,
null,
@@ -783,7 +786,8 @@
MobyDataType outputType = null;
if(output != null && output.length != 0 && output[0] instanceof MobyPrimaryData){
- outputType = MobyDataType.getDataType(((MobyPrimaryData) output[0]).getDataType().getName());
+ outputType = MobyDataType.getDataType(((MobyPrimaryData) output[0]).getDataType().getName(),
+ SeahawkOptions.getRegistry());
}
if(outputType == null){
logger.warn("No output data type (ontology) was associated with service " +
@@ -1176,7 +1180,7 @@
}
// Make sure we have a fully documented data type object
- mobyDataType = MobyDataType.getDataType(targetData.getDataType().getName());
+ mobyDataType = MobyDataType.getDataType(targetData.getDataType().getName(), SeahawkOptions.getRegistry());
String desc = null;
String datatype = null;
if(mobyDataType == null){
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyShimmer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyShimmer.java 2007/02/08 16:59:57 1.2
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyShimmer.java 2007/06/08 14:04:27 1.3
@@ -115,7 +115,7 @@
}
}
- public void start(MobyRequest request, int requestID){
+ public void start(MobyRequestEvent requestEvent){
}
public void processEvent(MobyRequestEvent mre){
More information about the MOBY-guts
mailing list