You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/02/17 21:44:29 UTC
[09/16] incubator-taverna-plugin-bioinformatics git commit:
temporarily empty repository
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/QueryTest.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/QueryTest.java b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/QueryTest.java
deleted file mode 100644
index b2b93cc..0000000
--- a/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/QueryTest.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Copyright (C) 2003 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate. Authorship
- * of the modifications may be determined from the ChangeLog placed at
- * the end of this file.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- *
- ****************************************************************
- * Source code information
- * -----------------------
- * Filename $RCSfile: QueryTest.java,v $
- * Revision $Revision: 1.3 $
- * Release status $State: Exp $
- * Last modified on $Date: 2007/10/01 12:11:30 $
- * by $Author: davidwithers $
- * Created on 03-May-2006
- *****************************************************************/
-package org.biomart.martservice.query;
-
-import junit.framework.TestCase;
-
-/**
- *
- * @author David Withers
- */
-public class QueryTest extends TestCase {
- private String attributeName;
-
- private Attribute attribute;
-
- private String filterName;
-
- private String filterValue;
-
- private Filter filter;
-
- private Link link;
-
- private String datasetName;
-
- private Dataset dataset;
-
- private String virtualSchemaName;
-
- private String softwareVersion;
-
- private String formatter;
-
- private Query query;
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- attributeName = "attribute name";
- attribute = new Attribute(attributeName);
-
- filterName = "filter name";
- filterValue = "filter value";
- filter = new Filter(filterName, filterValue);
-
- link = new Link("source", "target", "id");
-
- datasetName = "dataset name";
- dataset = new Dataset(datasetName);
-
- dataset.addAttribute(attribute);
- dataset.addFilter(filter);
-
- virtualSchemaName = "default";
-
- softwareVersion = "software version";
-
- formatter = "page formatter";
-
- query = new Query(virtualSchemaName);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.Query(String)'
- */
- public final void testQueryString() {
- Query query = new Query(virtualSchemaName);
- assertEquals("virtualSchemaName should be '" + virtualSchemaName + "'",
- query.getVirtualSchemaName(), virtualSchemaName);
- assertEquals("count should be '0'", query.getCount(), 0);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.Query(String, int)'
- */
- public final void testQueryStringInt() {
- Query query = new Query(virtualSchemaName, 1);
- assertEquals("virtualSchemaName should be '" + virtualSchemaName + "'",
- query.getVirtualSchemaName(), virtualSchemaName);
- assertEquals("count should be '1'", query.getCount(), 1);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.Query(Query)'
- */
- public final void testQueryQuery() {
- query.addDataset(dataset);
- query.addLink(link);
- query.setCount(1);
- query.setUniqueRows(1);
- query.setSoftwareVersion(softwareVersion);
- query.setFormatter(formatter);
- Query copy = new Query(query);
- assertEquals(copy.getDatasets().size(), 1);
- assertEquals(copy.getAttributes().size(), 1);
- assertEquals(copy.getFilters().size(), 1);
- assertEquals(copy.getLinks().size(), 1);
- assertEquals(copy.getCount(), 1);
- assertEquals(copy.getUniqueRows(), 1);
- assertEquals(copy.getSoftwareVersion(), softwareVersion);
- assertEquals(copy.getFormatter(), formatter);
- }
-
- /*
- * Test method for
- * 'org.biomart.martservice.query.Query.getVirtualSchemaName()'
- */
- public final void testGetVirtualSchemaName() {
- assertEquals("virtualSchemaName should be '" + virtualSchemaName + "'",
- query.getVirtualSchemaName(), virtualSchemaName);
- }
-
- /*
- * Test method for
- * 'org.biomart.martservice.query.Query.setVirtualSchemaName(String)'
- */
- public final void testSetVirtualSchemaName() {
- String newVirtualSchemaName = "new virtual schema name";
- query.setVirtualSchemaName(newVirtualSchemaName);
- assertEquals("virtualSchemaName should be '" + newVirtualSchemaName
- + "'", query.getVirtualSchemaName(), newVirtualSchemaName);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.getCount()'
- */
- public final void testGetCount() {
- assertEquals("count should be '0'", query.getCount(), 0);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.setCount(int)'
- */
- public final void testSetCount() {
- query.setCount(1);
- assertEquals("count should be '1'", query.getCount(), 1);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.getUniqueRows()'
- */
- public final void testGetUniqueRows() {
- assertEquals("uniqueRows should be '0'", query.getUniqueRows(), 0);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.setUniqueRows(int)'
- */
- public final void testSetUniqueRows() {
- query.setUniqueRows(1);
- assertEquals("uniqueRows should be '1'", query.getUniqueRows(), 1);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.getSoftwareVersion()'
- */
- public final void testGetSoftwareVersion() {
- assertNull("softwareVersion should be null", query.getSoftwareVersion());
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.setSoftwareVersion(String)'
- */
- public final void testSetSoftwareVersion() {
- String newSoftwareVersion = "new software version";
- query.setSoftwareVersion(newSoftwareVersion);
- assertEquals("softwareVersion should be '" + newSoftwareVersion + "'", query.getSoftwareVersion(), newSoftwareVersion);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.getFormatter()'
- */
- public final void testGetFormatter() {
- assertNull("formatter should be null", query.getFormatter());
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.setFormatter(String)'
- */
- public final void testSetFormatter() {
- String newFormatter = "new formatter";
- query.setFormatter(newFormatter);
- assertEquals("formatter should be '" + newFormatter + "'", query.getFormatter(), newFormatter);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.getRequestId()'
- */
- public final void testGetRequestId() {
- assertNull("requestId should be null", query.getRequestId());
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.setnewRequestId(String)'
- */
- public final void testSetRequestId() {
- String newRequestId = "new RequestId";
- query.setRequestId(newRequestId);
- assertEquals("requestId should be '" + newRequestId + "'", query.getRequestId(), newRequestId);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.addDataset(Dataset)'
- */
- public final void testAddDataset() {
- query.addDataset(dataset);
- assertEquals(query.getDatasets().size(), 1);
- assertSame(query.getDatasets().get(0), dataset);
- }
-
- /*
- * Test method for
- * 'org.biomart.martservice.query.Query.removeDataset(Dataset)'
- */
- public final void testRemoveDataset() {
- query.addDataset(dataset);
- query.removeDataset(dataset);
- assertEquals(query.getDatasets().size(), 0);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.getDatasets()'
- */
- public final void testGetDatasets() {
- query.addDataset(dataset);
- assertEquals(query.getDatasets().size(), 1);
- assertSame(query.getDatasets().get(0), dataset);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.getDataset(String)'
- */
- public final void testGetDataset() {
- query.addDataset(dataset);
- assertSame(query.getDataset(dataset.getName()), dataset);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.getAttributes()'
- */
- public final void testGetAttributes() {
- query.addDataset(dataset);
- assertEquals(query.getAttributes().size(), 1);
- assertSame(query.getAttributes().get(0), attribute);
- }
-
- /*
- * Test method for 'org.biomart.martservice.query.Query.getFilters()'
- */
- public final void testGetFilters() {
- query.addDataset(dataset);
- assertEquals(query.getFilters().size(), 1);
- assertSame(query.getFilters().get(0), filter);
- }
-
- /*
- * Test method for
- * 'org.biomart.martservice.query.Query.addQueryListener(QueryListener)'
- */
- public final void testAddQueryListener() {
- }
-
- /*
- * Test method for
- * 'org.biomart.martservice.query.Query.removeQueryListener(QueryListener)'
- */
- public final void testRemoveQueryListener() {
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/pom.xml b/taverna-biomoby-activity-ui/pom.xml
deleted file mode 100644
index 8f92c83..0000000
--- a/taverna-biomoby-activity-ui/pom.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.sf.taverna</groupId>
- <artifactId>taverna-parent</artifactId>
- <version>3.0.1-SNAPSHOT</version>
- </parent>
- <groupId>net.sf.taverna.t2.ui-activities</groupId>
- <artifactId>biomoby-activity-ui</artifactId>
- <version>2.0.1-SNAPSHOT</version>
- <name>Taverna 2 Biomoby Activity UI</name>
- <dependencies>
- <dependency>
- <groupId>net.sf.taverna.t2.ui-api</groupId>
- <artifactId>activity-icons-api</artifactId>
- <version>${t2.ui.api.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.ui-api</groupId>
- <artifactId>activity-palette-api</artifactId>
- <version>${t2.ui.api.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.ui-impl</groupId>
- <artifactId>activity-palette-impl</artifactId>
- <version>${t2.ui.impl.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.activities</groupId>
- <artifactId>biomoby-activity</artifactId>
- <version>${t2.activities.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.ui-impl</groupId>
- <artifactId>contextual-views-impl</artifactId>
- <version>${t2.ui.impl.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.ui-api</groupId>
- <artifactId>contextual-views-api</artifactId>
- <version>${t2.ui.api.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.ui-api</groupId>
- <artifactId>activity-tools</artifactId>
- <version>${t2.ui.api.version}</version>
- </dependency>
-
- <!-- testing dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
-<!-- <dependency>
- <groupId>net.sf.taverna.t2.ui-impl</groupId>
- <artifactId>activity-palette-impl</artifactId>
- <version>${t2.ui.impl.version}</version>
- <scope>test</scope>
- </dependency> -->
- </dependencies>
- <repositories>
- <repository>
- <releases />
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <id>mygrid-repository</id>
- <name>myGrid Repository</name>
- <url>http://www.mygrid.org.uk/maven/repository
- </url>
- </repository>
- <repository>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots />
- <id>mygrid-snapshot-repository</id>
- <name>myGrid Snapshot Repository</name>
- <url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
- </repository>
- </repositories>
-</project>
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/AddParserActionHelper.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/AddParserActionHelper.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/AddParserActionHelper.java
deleted file mode 100644
index b03b98c..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/AddParserActionHelper.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * This file is a component of the Taverna project, and is licensed under the
- * GNU LGPL. Copyright Edward Kawas, The BioMoby Project
- */
-package net.sf.taverna.t2.activities.biomoby.actions;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-import javax.swing.ImageIcon;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JScrollPane;
-import javax.swing.JSeparator;
-import javax.swing.JTree;
-import javax.swing.ToolTipManager;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreePath;
-import javax.swing.tree.TreeSelectionModel;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.activities.biomoby.edits.AddMobyParseDatatypeEdit;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Edit;
-
-import org.apache.log4j.Logger;
-import org.biomoby.shared.MobyData;
-import org.biomoby.shared.MobyNamespace;
-import org.biomoby.shared.MobyPrimaryDataSet;
-import org.biomoby.shared.MobyPrimaryDataSimple;
-
-/**
- * An action to add a parser from within the Workflow editor
- *
- * @author Eddie Kawas
- * @author Stuart Owen - adapted for Taverna 2
- */
-public class AddParserActionHelper {
- private static Logger logger = Logger.getLogger(AddParserActionHelper.class);
-
- private EditManager editManager;
-
- private final FileManager fileManager;
-
- public AddParserActionHelper(EditManager editManager, FileManager fileManager) {
- this.editManager = editManager;
- this.fileManager = fileManager;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.embl.ebi.escience.scuflui.processoractions.AbstractProcessorAction#getComponent(org.embl.ebi.escience.scufl.Processor)
- */
- public JComponent getComponent(final BiomobyActivity activity) {
-
-
- // set up the root node
- String serviceName = activity.getMobyService().getName();
- String description = activity.getMobyService().getDescription();
- MobyServiceTreeNode service = new MobyServiceTreeNode(serviceName,
- description);
- DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(service);
-
- // now add the child nodes containing useful information about the
- // service
- DefaultMutableTreeNode output = new DefaultMutableTreeNode("Parse:");
- rootNode.add(output);
- // process outputs
- MobyData[] outputs = activity.getMobyService().getPrimaryOutputs();
- for (int i = 0; i < outputs.length; i++) {
- if (outputs[i] instanceof MobyPrimaryDataSimple) {
- MobyPrimaryDataSimple simple = (MobyPrimaryDataSimple) outputs[i];
- StringBuffer sb = new StringBuffer(
- "Namespaces used by this object: ");
- MobyNamespace[] namespaces = simple.getNamespaces();
- for (int j = 0; j < namespaces.length; j++) {
- sb.append(namespaces[j].getName() + " ");
- }
- if (namespaces.length == 0)
- sb.append(" ANY ");
- MobyObjectTreeNode mobyObjectTreeNode = new MobyObjectTreeNode(
- simple.getDataType().getName() + "('"
- + simple.getName() + "')", sb.toString());
- mobyObjectTreeNode.setNamespaces(simple.getNamespaces());
- output.insert(new DefaultMutableTreeNode(mobyObjectTreeNode),
- output.getChildCount());
- } else {
- // we have a collection
- MobyPrimaryDataSet collection = (MobyPrimaryDataSet) outputs[i];
- DefaultMutableTreeNode collectionNode = new DefaultMutableTreeNode(
- "Collection('" + collection.getName() + "')");
- output.insert(collectionNode, output.getChildCount());
- MobyPrimaryDataSimple[] simples = collection.getElements();
- for (int j = 0; j < simples.length; j++) {
- MobyPrimaryDataSimple simple = simples[j];
- StringBuffer sb = new StringBuffer(
- "Namespaces used by this object: ");
- MobyNamespace[] namespaces = simple.getNamespaces();
- for (int k = 0; k < namespaces.length; k++) {
- sb.append(namespaces[k].getName() + " ");
- }
- if (namespaces.length == 0)
- sb.append("ANY ");
- MobyObjectTreeNode mobyObjectTreeNode = new MobyObjectTreeNode(
- simple.getDataType().getName() + "('"
- + simple.getName() + "')", sb.toString());
- mobyObjectTreeNode.setNamespaces(simple.getNamespaces());
- collectionNode
- .insert(new DefaultMutableTreeNode(
- mobyObjectTreeNode), collectionNode
- .getChildCount());
- }
-
- }
- }
- if (outputs.length == 0) {
- output.add(new DefaultMutableTreeNode(" None "));
- }
-
- // finally return a tree describing the object
- final JTree tree = new JTree(rootNode);
- tree.setCellRenderer(new BioMobyServiceTreeCustomRenderer());
- ToolTipManager.sharedInstance().registerComponent(tree);
- tree.addMouseListener(new MouseListener() {
- public void mouseClicked(MouseEvent me) {
- }
-
- public void mousePressed(MouseEvent me) {
- mouseReleased(me);
- }
-
- public void mouseReleased(MouseEvent me) {
- if (me.isPopupTrigger()) // right click, show popup menu
- {
- TreePath path = tree.getPathForLocation(me.getX(), me
- .getY());
- if (path == null)
- return;
- if (path.getPathCount() >= 3) {
- if (path.getParentPath().toString().indexOf("Parse:") >= 0
- && path.getLastPathComponent().toString()
- .indexOf(" None ") == -1) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree
- .getLastSelectedPathComponent();
- if (node == null)
- return;
- final String selectedObject = node.toString();
- if (!selectedObject.equals(path
- .getLastPathComponent().toString()))
- return;
-
- logger.debug("TreePath " + path.toString());
- if (
- // path has a collection in it
- (path.getPathCount() == 4
- && path.getParentPath()
- .getLastPathComponent().toString()
- .startsWith("Collection(") && (path
- .getParentPath().toString())
- .indexOf("Parse:") > 0)
- // or path is just a simple
- || (path.toString().indexOf("Collection(") < 0)) {
-
- final JPopupMenu menu = new JPopupMenu();
-
- final String potentialCollectionString = path
- .getParentPath().getLastPathComponent()
- .toString();
- final boolean isCollection = potentialCollectionString
- .indexOf("Collection('") >= 0;
- JMenuItem item3 = new JMenuItem(
- "Add parser for " + selectedObject
- + " to the workflow");
- item3
- .setIcon(getIcon("/Cut24.gif"));
- item3.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent ae) {
- // you would like to search for
- // selectedObject
- try {
- try {
- Dataflow currentDataflow = fileManager.getCurrentDataflow();
- Edit<?> edit = new AddMobyParseDatatypeEdit(
- currentDataflow, activity,
- selectedObject,isCollection, potentialCollectionString, editManager.getEdits());
- editManager.doDataflowEdit(
- currentDataflow, edit);
-
- } catch (Exception e) {
- logger.error("", e);
- }
-
- } catch (Exception e) {
- logger.error("", e);
- }
-
- }
- });
-
- menu.add(new JSeparator());
- menu.add(new JLabel("Parse Moby Data ... ",
- JLabel.CENTER));
- menu.add(new JSeparator());
- menu.add(item3);
- menu.show(me.getComponent(), me.getX(), me
- .getY());
- } else {
- logger
- .debug("unexpected situation occured; '"
- + selectedObject
- + "' was the object selected and the path is: "
- + path.toString());
- }
- }
- }
- }
- }
-
- public void mouseEntered(MouseEvent me) {
- }
-
- public void mouseExited(MouseEvent me) {
- }
- });
-
- tree.getSelectionModel().setSelectionMode(
- TreeSelectionModel.SINGLE_TREE_SELECTION);
- JScrollPane jsp = new JScrollPane(tree);
- JPanel thePanel = new JPanel(new BorderLayout());
- thePanel.add(jsp, BorderLayout.CENTER);
- return thePanel;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.embl.ebi.escience.scuflui.processoractions.ProcessorActionSPI#getDescription()
- */
- public String getDescription() {
- return "Add BioMOBY Parser ...";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.embl.ebi.escience.scuflui.processoractions.ProcessorActionSPI#getIcon()
- */
- public ImageIcon getIcon() {
- return MobyPanel.getIcon("/Cut24.gif");
- }
-
- /**
- * returns the frame size as a dimension for the content pane housing
- * this action
- */
- public Dimension getFrameSize() {
- return new Dimension(450, 450);
- }
-
- /**
- * Return an Icon to represent this action
- *
- * @param loc
- * the location of the image to use as an icon
- */
- private ImageIcon getIcon(String loc) {
- return MobyPanel.getIcon(loc);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BioMobyObjectTreeCustomRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BioMobyObjectTreeCustomRenderer.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BioMobyObjectTreeCustomRenderer.java
deleted file mode 100644
index 46b4d5a..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BioMobyObjectTreeCustomRenderer.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * This file is a component of the Taverna project,
- * and is licensed under the GNU LGPL.
- * Copyright Edward Kawas, The BioMoby Project
- */
-package net.sf.taverna.t2.activities.biomoby.actions;
-
-import java.awt.Color;
-import java.awt.Component;
-
-import javax.swing.JComponent;
-import javax.swing.JTree;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeCellRenderer;
-
-public class BioMobyObjectTreeCustomRenderer extends DefaultTreeCellRenderer {
-
- private static final long serialVersionUID = 1L;
-
- private Color leafForeground = Color.blue;
-
- private Color rootColor = Color.black;
-
- @SuppressWarnings("unused")
- private Color feedsIntoColor = Color.gray;
-
- @SuppressWarnings("unused")
- private Color producedColor = Color.lightGray;
-
- @SuppressWarnings("unused")
- private Color authorityColor = Color.orange;
-
- private Color serviceColor = Color.magenta;
-
- private Color objectColor = Color.green;
-
- public Component getTreeCellRendererComponent(JTree tree, Object value,
- boolean selected, boolean expanded, boolean leaf, int row,
- boolean hasFocus) {
- // Allow the original renderer to set up the label
- Component c = super.getTreeCellRendererComponent(tree, value, selected,
- expanded, leaf, row, hasFocus);
-
- if (value instanceof DefaultMutableTreeNode) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
- if (node.getUserObject() instanceof MobyServiceTreeNode) {
- // service node
- c.setForeground(serviceColor);
- ((JComponent) c).setToolTipText(((MobyServiceTreeNode) node
- .getUserObject()).getDescription());
- setIcon(MobyPanel.getIcon("/service.png"));
- } else if (node.getUserObject() instanceof MobyObjectTreeNode) {
- // object node
- c.setForeground(objectColor);
- ((JComponent) c).setToolTipText(((MobyObjectTreeNode) node
- .getUserObject()).getDescription());
- } else if (node.isRoot()) {
- // root node
- setIcon(MobyPanel.getIcon("/moby.png"));
- ((JComponent) c).setToolTipText(" Description of "
- + node.getUserObject());
- c.setForeground(rootColor);
- } else if (node.getUserObject() instanceof String) {
- // check for feeds into and produced by nodes
- String string = (String) node.getUserObject();
- if (string.equalsIgnoreCase("feeds into")) {
- setIcon(MobyPanel.getIcon("/input.png"));
- ((JComponent) c).setToolTipText(null);
- } else if (string.equalsIgnoreCase("produced by")) {
- setIcon(MobyPanel.getIcon("/output.png"));
- ((JComponent) c).setToolTipText(null);
- } else if (string.equalsIgnoreCase("produces")) {
- ((JComponent) c).setToolTipText(null);
- } else {
-
- ((JComponent) c).setToolTipText(null);
-
- if (!leaf) {
- if (string.startsWith("Collection('")) {
- setIcon(MobyPanel.getIcon("/collection.png"));
- } else {
- setIcon(MobyPanel.getIcon("/authority.png"));
- }
- }
- }
-
- } else {
- ((JComponent) c).setToolTipText("nothing node");
- }
- }
- if (selected)
- c.setBackground(Color.lightGray);
- if (leaf)
- c.setForeground(this.leafForeground);
- return c;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BioMobyServiceTreeCustomRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BioMobyServiceTreeCustomRenderer.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BioMobyServiceTreeCustomRenderer.java
deleted file mode 100644
index ecce3ca..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BioMobyServiceTreeCustomRenderer.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * This file is a component of the Taverna project,
- * and is licensed under the GNU LGPL.
- * Copyright Edward Kawas, The BioMoby Project
- */
-package net.sf.taverna.t2.activities.biomoby.actions;
-
-import java.awt.Color;
-import java.awt.Component;
-
-import javax.swing.JComponent;
-import javax.swing.JTree;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeCellRenderer;
-
-public class BioMobyServiceTreeCustomRenderer extends DefaultTreeCellRenderer {
-
- private static final long serialVersionUID = 1L;
-
- private Color leafForeground = Color.blue;
-
- @SuppressWarnings("unused")
- private Color rootColor = Color.black;
-
- @SuppressWarnings("unused")
- private Color feedsIntoColor = Color.gray;
-
- @SuppressWarnings("unused")
- private Color producedColor = Color.lightGray;
-
- @SuppressWarnings("unused")
- private Color authorityColor = Color.orange;
-
- private Color serviceColor = Color.magenta;
-
- private Color objectColor = Color.green;
-
- public Component getTreeCellRendererComponent(JTree tree, Object value,
- boolean selected, boolean expanded, boolean leaf, int row,
- boolean hasFocus) {
- // Allow the original renderer to set up the label
- Component c = super.getTreeCellRendererComponent(tree, value, selected,
- expanded, leaf, row, hasFocus);
-
- if (value instanceof DefaultMutableTreeNode) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
- if (node.getUserObject() instanceof MobyServiceTreeNode) {
- // service node
- c.setForeground(serviceColor);
- ((JComponent) c).setToolTipText(((MobyServiceTreeNode) node
- .getUserObject()).getDescription());
- setIcon(MobyPanel.getIcon("/service.png"));
- } else if (node.getUserObject() instanceof MobyObjectTreeNode) {
- // object node
- c.setForeground(objectColor);
- ((JComponent) c).setToolTipText(((MobyObjectTreeNode) node
- .getUserObject()).getDescription());
- } else if (node.getUserObject() instanceof String) {
- // check for feeds into and produced by nodes
- String string = (String) node.getUserObject();
- if (string.equalsIgnoreCase("inputs")) {
- setIcon(MobyPanel.getIcon("/input.png"));
- ((JComponent) c).setToolTipText(null);
- } else if (string.equalsIgnoreCase("outputs")) {
- setIcon(MobyPanel.getIcon("/output.png"));
- ((JComponent) c).setToolTipText(null);
- } else {
-
- ((JComponent) c).setToolTipText(null);
-
- if (!leaf) {
- if (string.startsWith("Collection('")) {
- setIcon(MobyPanel.getIcon("/collection.png"));
- }
- }
- }
-
- } else {
- ((JComponent) c).setToolTipText("nothing node");
- }
- }
- if (leaf)
- c.setForeground(this.leafForeground);
- return c;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyActionHelper.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyActionHelper.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyActionHelper.java
deleted file mode 100644
index 9579627..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyActionHelper.java
+++ /dev/null
@@ -1,852 +0,0 @@
-/*
- * This file is a component of the Taverna project, and is licensed under the
- * GNU LGPL. Copyright Edward Kawas, The BioMoby Project
- */
-package net.sf.taverna.t2.activities.biomoby.actions;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-import javax.swing.ImageIcon;
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JProgressBar;
-import javax.swing.JScrollPane;
-import javax.swing.JSeparator;
-import javax.swing.JTree;
-import javax.swing.ToolTipManager;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreePath;
-import javax.swing.tree.TreeSelectionModel;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivity;
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivityConfigurationBean;
-import net.sf.taverna.t2.activities.biomoby.edits.AddBiomobyCollectionDataTypeEdit;
-import net.sf.taverna.t2.activities.biomoby.edits.AddBiomobyDataTypeEdit;
-import net.sf.taverna.t2.activities.biomoby.edits.AddMobyParseDatatypeEdit;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.utils.Tools;
-
-import org.apache.log4j.Logger;
-import org.biomoby.client.CentralImpl;
-import org.biomoby.shared.Central;
-import org.biomoby.shared.MobyData;
-import org.biomoby.shared.MobyDataType;
-import org.biomoby.shared.MobyException;
-import org.biomoby.shared.MobyNamespace;
-import org.biomoby.shared.MobyPrimaryDataSet;
-import org.biomoby.shared.MobyPrimaryDataSimple;
-import org.biomoby.shared.NoSuccessException;
-
-
-/**
- *
- * @author Eddie An action that for BioMobyProcessors
- * @auther Stuart Owen - helped port to T2 - but with the minimum code changes possible!
- */
-public class BiomobyActionHelper {
-
- private static Logger logger = Logger
- .getLogger(BiomobyActionHelper.class);
-
- JProgressBar progressBar = new JProgressBar();
-
- private EditManager editManager;
-
- private final FileManager fileManager;
-
- public BiomobyActionHelper(EditManager editManager, FileManager fileManager) {
- this.editManager = editManager;
- this.fileManager = fileManager;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.embl.ebi.escience.scuflui.processoractions.AbstractProcessorAction
- * #getComponent(org.embl.ebi.escience.scufl.Processor)
- */
-
- public JComponent getComponent(final BiomobyActivity activity) {
- // variables i need
-
- final String endpoint = activity.getConfiguration().getMobyEndpoint();
- // set up the root node
- String serviceName = activity.getMobyService().getName();
- String description = activity.getMobyService().getDescription();
-
- MobyServiceTreeNode service = new MobyServiceTreeNode(serviceName,
- description);
- DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(service);
-
- // now add the child nodes containing useful information about the
- // service
- DefaultMutableTreeNode input = new DefaultMutableTreeNode("Inputs");
- DefaultMutableTreeNode output = new DefaultMutableTreeNode("Outputs");
- rootNode.add(input);
- rootNode.add(output);
-
- // process inputs
- MobyData[] inputs = activity.getMobyService().getPrimaryInputs();
- for (int i = 0; i < inputs.length; i++) {
- if (inputs[i] instanceof MobyPrimaryDataSimple) {
- MobyPrimaryDataSimple simple = (MobyPrimaryDataSimple) inputs[i];
- StringBuffer sb = new StringBuffer(
- "Namespaces used by this object: ");
- MobyNamespace[] namespaces = simple.getNamespaces();
- for (int j = 0; j < namespaces.length; j++) {
- sb.append(namespaces[j].getName() + " ");
- }
- if (namespaces.length == 0)
- sb.append(" ANY ");
- MobyObjectTreeNode mobyObjectTreeNode = new MobyObjectTreeNode(
- simple.getDataType().getName() + "('"
- + simple.getName() + "')", sb.toString());
- input.insert(new DefaultMutableTreeNode(mobyObjectTreeNode),
- input.getChildCount());
- } else {
- // we have a collection
- MobyPrimaryDataSet collection = (MobyPrimaryDataSet) inputs[i];
- DefaultMutableTreeNode collectionNode = new DefaultMutableTreeNode(
- "Collection('" + collection.getName() + "')");
- input.insert(collectionNode, input.getChildCount());
- MobyPrimaryDataSimple[] simples = collection.getElements();
- for (int j = 0; j < simples.length; j++) {
- MobyPrimaryDataSimple simple = simples[j];
- StringBuffer sb = new StringBuffer(
- "Namespaces used by this object: ");
- MobyNamespace[] namespaces = simple.getNamespaces();
- for (int k = 0; k < namespaces.length; k++) {
- sb.append(namespaces[k].getName() + " ");
- }
- if (namespaces.length == 0)
- sb.append(" ANY ");
- MobyObjectTreeNode mobyObjectTreeNode = new MobyObjectTreeNode(
- simple.getDataType().getName() + "('"
- + simple.getName() + "')", sb.toString());
- collectionNode
- .insert(new DefaultMutableTreeNode(
- mobyObjectTreeNode), collectionNode
- .getChildCount());
- }
-
- }
- }
- if (inputs.length == 0) {
- input.add(new DefaultMutableTreeNode(" None "));
- }
-
- // process outputs
- MobyData[] outputs = activity.getMobyService().getPrimaryOutputs();
- for (int i = 0; i < outputs.length; i++) {
- if (outputs[i] instanceof MobyPrimaryDataSimple) {
- MobyPrimaryDataSimple simple = (MobyPrimaryDataSimple) outputs[i];
- StringBuffer sb = new StringBuffer(
- "Namespaces used by this object: ");
- MobyNamespace[] namespaces = simple.getNamespaces();
- for (int j = 0; j < namespaces.length; j++) {
- sb.append(namespaces[j].getName() + " ");
- }
- if (namespaces.length == 0)
- sb.append(" ANY ");
- MobyObjectTreeNode mobyObjectTreeNode = new MobyObjectTreeNode(
- simple.getDataType().getName() + "('"
- + simple.getName() + "')", sb.toString());
- mobyObjectTreeNode.setNamespaces(simple.getNamespaces());
- output.insert(new DefaultMutableTreeNode(mobyObjectTreeNode),
- output.getChildCount());
- } else {
- // we have a collection
- MobyPrimaryDataSet collection = (MobyPrimaryDataSet) outputs[i];
- DefaultMutableTreeNode collectionNode = new DefaultMutableTreeNode(
- "Collection('" + collection.getName() + "')");
- output.insert(collectionNode, output.getChildCount());
- MobyPrimaryDataSimple[] simples = collection.getElements();
- for (int j = 0; j < simples.length; j++) {
- MobyPrimaryDataSimple simple = simples[j];
- StringBuffer sb = new StringBuffer(
- "Namespaces used by this object: ");
- MobyNamespace[] namespaces = simple.getNamespaces();
- for (int k = 0; k < namespaces.length; k++) {
- sb.append(namespaces[k].getName() + " ");
- }
- if (namespaces.length == 0)
- sb.append("ANY ");
- MobyObjectTreeNode mobyObjectTreeNode = new MobyObjectTreeNode(
- simple.getDataType().getName() + "('"
- + simple.getName() + "')", sb.toString());
- mobyObjectTreeNode.setNamespaces(simple.getNamespaces());
- collectionNode
- .insert(new DefaultMutableTreeNode(
- mobyObjectTreeNode), collectionNode
- .getChildCount());
- }
-
- }
- }
- if (outputs.length == 0) {
- output.add(new DefaultMutableTreeNode(" None "));
- }
-
- // finally return a tree describing the object
- final JTree tree = new JTree(rootNode);
- tree.setCellRenderer(new BioMobyServiceTreeCustomRenderer());
- ToolTipManager.sharedInstance().registerComponent(tree);
- tree.addMouseListener(new MouseListener() {
- public void mouseClicked(MouseEvent me) {
- }
-
- public void mousePressed(MouseEvent me) {
- mouseReleased(me);
- }
-
- public void mouseReleased(MouseEvent me) {
- if (me.isPopupTrigger()) // right click, show popup menu
- {
- TreePath path = tree.getPathForLocation(me.getX(), me
- .getY());
- if (path == null)
- return;
- if (path.getPathCount() >= 3) {
- if (path.getPathCount() == 4
- && path.getParentPath().getLastPathComponent()
- .toString().startsWith("Collection(")
- && (path.getParentPath().toString())
- .indexOf("Inputs") > 0) {
- // we have a collection input
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree
- .getLastSelectedPathComponent();
- final String selectedObject = node.toString();
- // ensure that the last selected item is an object!
- if (!selectedObject.equals(path
- .getLastPathComponent().toString()))
- return;
- String collectionName = "";
- if (path.getParentPath().getLastPathComponent()
- .toString().indexOf("('") > 0
- && path.getParentPath()
- .getLastPathComponent().toString()
- .indexOf("')") > 0) {
- collectionName = path.getParentPath()
- .getLastPathComponent().toString()
- .substring(
- path.getParentPath()
- .getLastPathComponent()
- .toString().indexOf(
- "('") + 2,
- path.getParentPath()
- .getLastPathComponent()
- .toString().indexOf(
- "')"));
- }
- final String theCollectionName = collectionName;
- final JPopupMenu menu = new JPopupMenu();
- // Create and add a menu item for adding to the item
- // to the workflow
- JMenuItem item = new JMenuItem("Add Datatype - "
- + selectedObject + " to the workflow?");
- item
- .setIcon(MobyPanel.getIcon("/Add24.gif"));
- item.addActionListener(new ActionListener() {
- // private boolean added = false;
-
- public void actionPerformed(ActionEvent ae) {
-
- try {
- Dataflow currentDataflow = fileManager.getCurrentDataflow();
- Edit<?> edit = new AddBiomobyCollectionDataTypeEdit(
- currentDataflow, activity,
- selectedObject,
- theCollectionName, editManager.getEdits());
- editManager.doDataflowEdit(
- currentDataflow, edit);
-
- } catch (Exception e) {
- logger.error("", e);
- }
- }
- });
- // Create and add a menu item for service details
- JMenuItem details = new JMenuItem("Find out about "
- + selectedObject);
- details
- .setIcon(MobyPanel.getIcon("/Information24.gif"));
- details.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent ae) {
-
- // TODO Create a frame
- Frame frame = MobyPanel.CreateFrame("A BioMoby Object Description");
- JPanel panel = new MobyPanel(
- selectedObject,
- "A BioMoby Object Description", "");
-
- frame.add(panel);
- frame.setSize(getFrameSize());
- frame.pack();
- frame.setVisible(true);
- }
- });
- // add the components to the menu
- menu.add(new JLabel("Add to workflow ... ",
- JLabel.CENTER));
- menu.add(new JSeparator());
- menu.add(item);
- menu.add(new JSeparator());
- menu.add(new JLabel("Datatype Details ... ",
- JLabel.CENTER));
- menu.add(new JSeparator());
- menu.add(details);
- // show the window
- menu.show(me.getComponent(), me.getX(), me.getY());
- } else if (path.getPathCount() == 3
- && path.getParentPath().getLastPathComponent()
- .toString().startsWith("Inputs")
- && !path.getLastPathComponent().toString()
- .startsWith("Collection(")
- && !path.getLastPathComponent().toString()
- .equals(" None ")) {
- // we have a simple input
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree
- .getLastSelectedPathComponent();
- if (node == null)
- return;
- final String selectedObject = node.toString();
- // ensure that the last selected item is an object!
- if (!selectedObject.equals(path
- .getLastPathComponent().toString()))
- return;
-
- final JPopupMenu menu = new JPopupMenu();
- // Create and add a menu item for adding to the item
- // to the workflow
- JMenuItem item = new JMenuItem("Add Datatype - "
- + selectedObject + " to the workflow?");
- item
- .setIcon(MobyPanel.getIcon("/Add24.gif"));
- item.addActionListener(new ActionListener() {
- // private boolean added = false;
-
- public void actionPerformed(ActionEvent ae) {
-
- try {
- Dataflow currentDataflow = fileManager.getCurrentDataflow();
- Edit<?> edit = new AddBiomobyDataTypeEdit(
- currentDataflow, activity,
- selectedObject, editManager.getEdits());
- editManager.doDataflowEdit(
- currentDataflow, edit);
-
- } catch (Exception e) {
- logger.error("Could not perform action", e);
- }
- }
- });
-
- // Create and add a menu item for service details
- JMenuItem details = new JMenuItem(
- "Find out about 1 " + selectedObject);
- details
- .setIcon(MobyPanel.getIcon("/Information24.gif"));
- details.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent ae) {
- // TODO Create a frame
- Frame frame = MobyPanel.CreateFrame("A BioMoby Object Description");
- JPanel panel = new MobyPanel(
- // TODO create a valid description
- selectedObject,
- "A BioMoby Object Description",
- createDataDescription(
- selectedObject.split("\\(")[0],
- activity.getConfiguration()
- .getMobyEndpoint()));
- frame.add(panel);
- frame.setSize(getFrameSize());
- frame.pack();
- frame.setVisible(true);
- }
-
- private String createDataDescription(
- String dataName, String mobyEndpoint) {
- MobyDataType data;
- try {
- Central central = new CentralImpl(
- mobyEndpoint);
- data = central.getDataType(dataName);
-
- } catch (MobyException e) {
- return "Couldn't retrieve a description on the BioMoby service '"
- + dataName + "'";
- } catch (NoSuccessException e) {
- return "Couldn't retrieve a description on the BioMoby service '"
- + dataName + "'";
- }
- return data.toString();
- }
- });
- // add the components to the menu
- menu.add(new JLabel("Add to workflow ... ",
- JLabel.CENTER));
- menu.add(new JSeparator());
- menu.add(item);
- menu.add(new JSeparator());
- menu.add(new JLabel("Datatype Details ... ",
- JLabel.CENTER));
- menu.add(new JSeparator());
- menu.add(details);
- // show the window
- menu.show(me.getComponent(), me.getX(), me.getY());
-
- } else if (path.getParentPath().toString().indexOf(
- "Outputs") >= 0
- && path.getLastPathComponent().toString()
- .indexOf(" None ") == -1) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree
- .getLastSelectedPathComponent();
- if (node == null)
- return;
- final String selectedObject = node.toString();
- if (!selectedObject.equals(path
- .getLastPathComponent().toString()))
- return;
-
- if ((path.getPathCount() == 4
- && path.getParentPath()
- .getLastPathComponent().toString()
- .startsWith("Collection(") && (path
- .getParentPath().toString())
- .indexOf("Outputs") > 0)
- || (path.toString().indexOf("Collection(") < 0)) {
- final JPopupMenu menu = new JPopupMenu();
- JMenuItem item = new JMenuItem(
- "Find Services that Consume "
- + selectedObject
- + " - brief search");
- item
- .setIcon(MobyPanel.getIcon("/Information24.gif"));
- final String potentialCollectionString = path
- .getParentPath().getLastPathComponent()
- .toString();
- final boolean isCollection = potentialCollectionString
- .indexOf("Collection('") >= 0;
- final Object selectedMobyObjectTreeNodeHolder = (DefaultMutableTreeNode) tree
- .getLastSelectedPathComponent();
- item.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent ae) {
- // you would like to search for
- // selectedObject
- new Thread("Finding biomoby services") {
- public void run() {
- try {
- // FIXME: ignored for now -
- // Stuart
- String name = selectedObject;
- if (name.indexOf("(") > 0)
- name = name
- .substring(
- 0,
- name
- .indexOf("("));
- String articlename = "";
- if (isCollection) {
- articlename = potentialCollectionString
- .substring(
- potentialCollectionString
- .indexOf("('") + 2,
- potentialCollectionString
- .lastIndexOf("'"));
- } else {
- articlename = selectedObject
- .substring(
- selectedObject
- .indexOf("'") + 1,
- selectedObject
- .lastIndexOf("'"));
- }
-
- BiomobyObjectActivity boAct = new BiomobyObjectActivity();
- BiomobyObjectActivityConfigurationBean bean = new BiomobyObjectActivityConfigurationBean();
- MobyDataType dataType = new MobyDataType(
- name);
- bean
- .setAuthorityName(dataType
- .getAuthority());
- bean
- .setServiceName(dataType
- .getName());
- bean
- .setMobyEndpoint(endpoint);
- boAct.configure(bean);
-
- OutputPort theServiceport = null;
-
- try {
- if (isCollection)
- theServiceport = Tools
- .getActivityOutputPort(
- activity,
- name
- + "(Collection - '"
- + (articlename
- .equals("") ? "MobyCollection"
- : articlename)
- + "' As Simples)");
-
- else
- theServiceport = Tools
- .getActivityOutputPort(
- activity,
- name
- + "("
- + articlename
- + ")");
- } catch (Exception except) {
- }
- BiomobyObjectActionHelper boa = null;
-
- if (theServiceport == null) {
- boa = new BiomobyObjectActionHelper(
- false, editManager, fileManager);
- } else {
- boa = new BiomobyObjectActionHelper(
- theServiceport,
- false, editManager, fileManager);
- }
-
- if (selectedMobyObjectTreeNodeHolder instanceof DefaultMutableTreeNode
- && ((DefaultMutableTreeNode) selectedMobyObjectTreeNodeHolder)
- .getUserObject() instanceof MobyObjectTreeNode) {
- DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode) selectedMobyObjectTreeNodeHolder;
- MobyObjectTreeNode motn = (MobyObjectTreeNode) dmtn
- .getUserObject();
- boa
- .setNamespaces(motn
- .getNamespaces());
- }
- PopupThread popupthread = new PopupThread(
- boAct, boa);
- progressBar
- .setStringPainted(true);
- progressBar
- .setVisible(true);
- popupthread.start();
-
- while (popupthread
- .isAlive()) {
- Thread.sleep(4000);
- }
-
- progressBar
- .setVisible(false);
- Component c = popupthread
- .getComponent();
- Dimension loc = getFrameLocation();
- Dimension size = getFrameSize();
- JPanel frame = new SimpleActionFrame(
- c,
- "Moby Object Details");
- createFrame(
- frame,
- (int) loc
- .getWidth(),
- (int) loc
- .getHeight(),
- (int) size
- .getWidth(),
- (int) size
- .getHeight());
- } catch (Exception e) {
- }
- }
- }.start();
-
- }
- });
-
- JMenuItem item2 = new JMenuItem(
- "Find Services that Consume "
- + selectedObject
- + " - semantic search");
- item2
- .setIcon(MobyPanel.getIcon("/Search24.gif"));
- item2.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent ae) {
- // you would like to search for
- // selectedObject
- new Thread("Finding BioMoby services") {
-
- public void run() {
- try {
- String name = selectedObject;
- if (name.indexOf("(") > 0)
- name = name
- .substring(
- 0,
- name
- .indexOf("("));
- String articlename = "";
- if (isCollection) {
- articlename = potentialCollectionString
- .substring(
- potentialCollectionString
- .indexOf("('") + 2,
- potentialCollectionString
- .lastIndexOf("'"));
- } else {
- articlename = selectedObject
- .substring(
- selectedObject
- .indexOf("'") + 1,
- selectedObject
- .lastIndexOf("'"));
- }
- BiomobyObjectActivity boAct = new BiomobyObjectActivity();
- BiomobyObjectActivityConfigurationBean bean = new BiomobyObjectActivityConfigurationBean();
- MobyDataType dataType = new MobyDataType(
- name);
- bean
- .setAuthorityName(dataType
- .getAuthority());
- bean
- .setServiceName(dataType
- .getName());
- bean
- .setMobyEndpoint(endpoint);
- boAct.configure(bean);
-
- OutputPort theServiceport = null;
-
- try {
-
- if (isCollection)
- theServiceport = Tools
- .getActivityOutputPort(
- activity,
- name
- + "(Collection - '"
- + (articlename
- .equals("") ? "MobyCollection"
- : articlename)
- + "' As Simples)");
-
- else
- theServiceport = Tools
- .getActivityOutputPort(
- activity,
- name
- + "("
- + articlename
- + ")");
- } catch (Exception except) {
- }
- BiomobyObjectActionHelper boa = null;
-
- if (theServiceport == null)
- boa = new BiomobyObjectActionHelper(
- true, editManager, fileManager);
- else
- boa = new BiomobyObjectActionHelper(
- theServiceport,
- true, editManager, fileManager);
- if (selectedMobyObjectTreeNodeHolder instanceof DefaultMutableTreeNode
- && ((DefaultMutableTreeNode) selectedMobyObjectTreeNodeHolder)
- .getUserObject() instanceof MobyObjectTreeNode) {
- DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode) selectedMobyObjectTreeNodeHolder;
- MobyObjectTreeNode motn = (MobyObjectTreeNode) dmtn
- .getUserObject();
- boa
- .setNamespaces(motn
- .getNamespaces());
- }
-
- PopupThread popupthread = new PopupThread(
- boAct, boa);
- progressBar
- .setStringPainted(true);
- progressBar
- .setVisible(true);
- popupthread.start();
-
- while (popupthread
- .isAlive()) {
- Thread.sleep(4000);
- }
-
- progressBar
- .setVisible(false);
- Component c = popupthread
- .getComponent();
- Dimension loc = getFrameLocation();
- Dimension size = getFrameSize();
- JPanel frame = new SimpleActionFrame(
- c,
- "Moby Object Details");
- createFrame(
- frame,
- (int) loc
- .getWidth(),
- (int) loc
- .getHeight(),
- (int) size
- .getWidth(),
- (int) size
- .getHeight());
- } catch (Exception e) {
- }
- }
- }.start();
- }
- });
-
- // string may be needed to extract the
- // collection article name
- // final String potentialCollectionString =
- // path.getParentPath()
- // .getLastPathComponent().toString();
- // final boolean isCollection =
- // potentialCollectionString
- // .indexOf("Collection('") >= 0;
-
- JMenuItem item3 = new JMenuItem(
- "Add parser for " + selectedObject
- + " to the workflow");
- item3
- .setIcon(MobyPanel.getIcon("/Cut24.gif"));
- item3.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent ae) {
-
- try {
- Dataflow currentDataflow = fileManager.getCurrentDataflow();
- Edit<?> edit = new AddMobyParseDatatypeEdit(
- currentDataflow, activity,
- selectedObject,isCollection, potentialCollectionString, editManager.getEdits());
- editManager.doDataflowEdit(
- currentDataflow, edit);
-
- } catch (Exception e) {
- logger.error("Could not perform action", e);
- }
-
- }
- });
-
- menu.add(new JLabel(
- "Moby Service Discovery ... ",
- JLabel.CENTER));
- menu.add(new JSeparator());
- menu.add(item);
- menu.add(new JSeparator());
- menu.add(item2);
- menu.add(new JLabel("Parse Moby Data ... ",
- JLabel.CENTER));
- menu.add(new JSeparator());
- menu.add(item3);
-
- menu.show(me.getComponent(), me.getX(), me
- .getY());
- }
- }
- }
- }
- }
-
- public void mouseEntered(MouseEvent me) {
- }
-
- public void mouseExited(MouseEvent me) {
- }
- });
-
- tree.getSelectionModel().setSelectionMode(
- TreeSelectionModel.SINGLE_TREE_SELECTION);
- JScrollPane jsp = new JScrollPane(tree);
- JPanel thePanel = new JPanel(new BorderLayout());
- thePanel.add(jsp, BorderLayout.CENTER);
- progressBar = new JProgressBar();
- progressBar.setValue(0);
- progressBar.setString("Finding Services ... ");
- progressBar.setStringPainted(true);
- progressBar.setIndeterminate(true);
- progressBar.setVisible(false);
- thePanel.add(progressBar, BorderLayout.PAGE_END);
- return thePanel;
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.embl.ebi.escience.scuflui.processoractions.ProcessorActionSPI#
- * getDescription()
- */
- public String getDescription() {
- return "Moby Service Details";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.embl.ebi.escience.scuflui.processoractions.ProcessorActionSPI#getIcon
- * ()
- */
- public ImageIcon getIcon() {
- return MobyPanel.getIcon("/moby_small.gif");
- }
-
- /**
- * returns the frame size as a dimension for the content pane housing this
- * action
- */
- public Dimension getFrameSize() {
- return new Dimension(450, 450);
- }
-
- /**
- * Return an Icon to represent this action
- *
- * @param loc
- * the location of the image to use as an icon
- */
- public ImageIcon getIcon(String loc) {
- return MobyPanel.getIcon(loc);
- }
-
- /**
- * Where should the frame open?
- */
- public Dimension getFrameLocation() {
- return new Dimension(100, 100);
- }
-
- public void createFrame(JPanel targetComponent,
- int posX, int posY, int sizeX, int sizeY) {
- final JPanel component = targetComponent;
- JFrame newFrame = new JFrame(component.getName());
- newFrame.getContentPane().setLayout(new BorderLayout());
- newFrame.getContentPane().add(
- new JScrollPane((JComponent) targetComponent),
- BorderLayout.CENTER);
- newFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- newFrame.setSize(sizeX, sizeY);
- newFrame.setLocation(posX, posY);
- newFrame.setVisible(true);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyActivityConfigurationAction.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyActivityConfigurationAction.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyActivityConfigurationAction.java
deleted file mode 100644
index f74c76a..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/actions/BiomobyActivityConfigurationAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * This file is a component of the Taverna project, and is licensed under the
- * GNU LGPL. Copyright Edward Kawas, The BioMoby Project
- ******************************************************************************/
-package net.sf.taverna.t2.activities.biomoby.actions;
-
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivityConfigurationBean;
-import net.sf.taverna.t2.activities.biomoby.view.BiomobyConfigView;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
-
-import org.apache.log4j.Logger;
-
-@SuppressWarnings("serial")
-public class BiomobyActivityConfigurationAction extends
- ActivityConfigurationAction<BiomobyActivity, BiomobyActivityConfigurationBean> {
-
- private final Frame owner;
- private static Logger logger = Logger.getLogger(BiomobyActivityConfigurationAction.class);
- private final EditManager editManager;
- private final FileManager fileManager;
-
- public BiomobyActivityConfigurationAction(BiomobyActivity activity, Frame owner,
- EditManager editManager, FileManager fileManager,
- ActivityIconManager activityIconManager) {
- super(activity, activityIconManager);
- this.owner = owner;
- this.editManager = editManager;
- this.fileManager = fileManager;
- }
-
- public void actionPerformed(ActionEvent arg0) {
- ActivityConfigurationDialog<BiomobyActivity, BiomobyActivityConfigurationBean> currentDialog = ActivityConfigurationAction
- .getDialog(getActivity());
- if (currentDialog != null) {
- currentDialog.toFront();
- return;
- }
-
- final BiomobyConfigView biomobyConfigView = new BiomobyConfigView(
- (BiomobyActivity) getActivity());
- final ActivityConfigurationDialog<BiomobyActivity, BiomobyActivityConfigurationBean> dialog = new ActivityConfigurationDialog<BiomobyActivity, BiomobyActivityConfigurationBean>(
- getActivity(), biomobyConfigView, editManager, fileManager);
-
- ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
- }
-
- public boolean isEnabled() {
- BiomobyActivity activity = (BiomobyActivity) getActivity();
- return (activity.getMobyService() != null && activity.containsSecondaries());
- }
-
-}