http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/dc466d6d/taverna-workbench-perspective-biocatalogue/src/main/xsd/xlink.xsd ---------------------------------------------------------------------- diff --git a/taverna-workbench-perspective-biocatalogue/src/main/xsd/xlink.xsd b/taverna-workbench-perspective-biocatalogue/src/main/xsd/xlink.xsd deleted file mode 100644 index 6c2034b..0000000 --- a/taverna-workbench-perspective-biocatalogue/src/main/xsd/xlink.xsd +++ /dev/null @@ -1,83 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- METS XLink Schema, v. 2, Nov. 15, 2004 --> -<!-- Downloaded from http://www.loc.gov/standards/mets/xlink.xsd at 2007-04-19 --> -<!-- Downloaded from http://taverna.cvs.sf.net/viewvc/taverna/taverna-service/taverna-interface/src/main/resources/xlink.xsd?view=log at 2009-10-19 --> -<schema targetNamespace="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink" elementFormDefault="qualified"> - <!-- global attributes --> - <attribute name="href" type="anyURI"/> - <attribute name="role" type="string"/> - <attribute name="arcrole" type="string"/> - <attribute name="title" type="string" /> - <attribute name="show"> - <simpleType> - - <restriction base="string"> - <enumeration value="new" /> - <enumeration value="replace" /> - <enumeration value="embed" /> - <enumeration value="other" /> - <enumeration value="none" /> - </restriction> - </simpleType> - </attribute> - <attribute name="actuate"> - <simpleType> - - <restriction base="string"> - <enumeration value="onLoad" /> - <enumeration value="onRequest" /> - <enumeration value="other" /> - <enumeration value="none" /> - </restriction> - </simpleType> - </attribute> - <attribute name="label" type="string" /> - <attribute name="from" type="string" /> - <attribute name="to" type="string" /> - <attributeGroup name="simpleLink"> - - <attribute name="type" type="string" fixed="simple" form="qualified" /> - <attribute ref="xlink:href" use="optional" /> - <attribute ref="xlink:role" use="optional" /> - <attribute ref="xlink:arcrole" use="optional" /> - <attribute ref="xlink:title" use="optional" /> - <attribute ref="xlink:show" use="optional" /> - <attribute ref="xlink:actuate" use="optional" /> - </attributeGroup> - <attributeGroup name="extendedLink"> - <attribute name="type" type="string" fixed="extended" form="qualified" /> - <attribute ref="xlink:role" use="optional" /> - <attribute ref="xlink:title" use="optional" /> - </attributeGroup> - <attributeGroup name="locatorLink"> - - <attribute name="type" type="string" fixed="locator" form="qualified" /> - <attribute ref="xlink:href" use="required" /> - <attribute ref="xlink:role" use="optional" /> - <attribute ref="xlink:title" use="optional" /> - <attribute ref="xlink:label" use="optional" /> - </attributeGroup> - <attributeGroup name="arcLink"> - <attribute name="type" type="string" fixed="arc" form="qualified" /> - <attribute ref="xlink:arcrole" use="optional" /> - <attribute ref="xlink:title" use="optional" /> - <attribute ref="xlink:show" use="optional" /> - <attribute ref="xlink:actuate" use="optional" /> - <attribute ref="xlink:from" use="optional" /> - <attribute ref="xlink:to" use="optional" /> - </attributeGroup> - - <attributeGroup name="resourceLink"> - <attribute name="type" type="string" fixed="resource" form="qualified" /> - <attribute ref="xlink:role" use="optional" /> - <attribute ref="xlink:title" use="optional" /> - <attribute ref="xlink:label" use="optional" /> - </attributeGroup> - <attributeGroup name="titleLink"> - <attribute name="type" type="string" fixed="title" form="qualified" /> - </attributeGroup> - <attributeGroup name="emptyLink"> - <attribute name="type" type="string" fixed="none" form="qualified" /> - </attributeGroup> - -</schema>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/dc466d6d/taverna-workbench-perspective-design/pom.xml ---------------------------------------------------------------------- diff --git a/taverna-workbench-perspective-design/pom.xml b/taverna-workbench-perspective-design/pom.xml deleted file mode 100644 index cde090a..0000000 --- a/taverna-workbench-perspective-design/pom.xml +++ /dev/null @@ -1,83 +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.t2</groupId> - <artifactId>ui-components</artifactId> - <version>2.0-SNAPSHOT</version> - </parent> - <groupId>net.sf.taverna.t2.ui-components</groupId> - <artifactId>perspective-design</artifactId> - <packaging>bundle</packaging> - <name>Design perspective</name> - <dependencies> - <dependency> - <groupId>net.sf.taverna.t2.ui-api</groupId> - <artifactId>edits-api</artifactId> - <version>${t2.ui.api.version}</version> - </dependency> - <dependency> - <groupId>net.sf.taverna.t2.ui-api</groupId> - <artifactId>file-api</artifactId> - <version>${t2.ui.api.version}</version> - </dependency> - <dependency> - <groupId>net.sf.taverna.t2.ui-api</groupId> - <artifactId>menu-api</artifactId> - <version>${t2.ui.api.version}</version> - </dependency> - <dependency> - <groupId>net.sf.taverna.t2.ui-api</groupId> - <artifactId>report-api</artifactId> - <version>${t2.ui.api.version}</version> - </dependency> - <dependency> - <groupId>net.sf.taverna.t2.ui-api</groupId> - <artifactId>selection-api</artifactId> - <version>${t2.ui.api.version}</version> - </dependency> - <dependency> - <groupId>net.sf.taverna.t2.ui-api</groupId> - <artifactId>workbench-api</artifactId> - <version>${t2.ui.api.version}</version> - </dependency> - <dependency> - <groupId>net.sf.taverna.t2.ui-components</groupId> - <artifactId>activity-palette-ui</artifactId> - <version>${t2.ui.components.version}</version> - </dependency> - <dependency> - <groupId>net.sf.taverna.t2.ui-components</groupId> - <artifactId>graph-view</artifactId> - <version>${t2.ui.components.version}</version> - </dependency> - <dependency> - <groupId>net.sf.taverna.t2.ui-components</groupId> - <artifactId>workflow-explorer</artifactId> - <version>${t2.ui.components.version}</version> - </dependency> - <!-- <dependency> - <groupId>net.sf.taverna.t2.ui-components</groupId> - <artifactId>report-view</artifactId> - <version>${t2.ui.components.version}</version> - </dependency> --> - <dependency> - <groupId>net.sf.taverna.t2.lang</groupId> - <artifactId>ui</artifactId> - <version>${t2.lang.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>uk.org.taverna.configuration</groupId> - <artifactId>taverna-app-configuration-api</artifactId> - <version>${taverna.configuration.version}</version> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/dc466d6d/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/DesignPerspective.java ---------------------------------------------------------------------- diff --git a/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/DesignPerspective.java b/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/DesignPerspective.java deleted file mode 100644 index eca98d4..0000000 --- a/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/DesignPerspective.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2007 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * 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 - ******************************************************************************/ -package net.sf.taverna.t2.ui.perspectives.design; - -import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.editIcon; - -import javax.swing.ImageIcon; -import javax.swing.JComponent; - -import net.sf.taverna.t2.ui.menu.MenuManager; -import net.sf.taverna.t2.workbench.edits.EditManager; -import net.sf.taverna.t2.workbench.file.FileManager; -import net.sf.taverna.t2.workbench.selection.SelectionManager; -import net.sf.taverna.t2.workbench.ui.zaria.PerspectiveSPI; -import net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI; - -public class DesignPerspective implements PerspectiveSPI { - private DesignPerspectiveComponent designPerspectiveComponent; - private UIComponentFactorySPI graphViewComponentFactory; - private UIComponentFactorySPI servicePanelComponentFactory; - private UIComponentFactorySPI contextualViewComponentFactory; - private UIComponentFactorySPI workflowExplorerFactory; - private UIComponentFactorySPI reportViewComponentFactory; - private FileManager fileManager; - private SelectionManager selectionManager; - private MenuManager menuManager; - private EditManager editManager; - - @Override - public String getID() { - return DesignPerspective.class.getName(); - } - - @Override - public JComponent getPanel() { - if (designPerspectiveComponent == null) - designPerspectiveComponent = new DesignPerspectiveComponent( - graphViewComponentFactory, servicePanelComponentFactory, - contextualViewComponentFactory, workflowExplorerFactory, - reportViewComponentFactory, fileManager, selectionManager, - menuManager, editManager); - return designPerspectiveComponent; - } - - @Override - public ImageIcon getButtonIcon() { - return editIcon; - } - - @Override - public String getText() { - return "Design"; - } - - @Override - public int positionHint() { - return 10; - } - - public void setGraphViewComponentFactory( - UIComponentFactorySPI graphViewComponentFactory) { - this.graphViewComponentFactory = graphViewComponentFactory; - } - - public void setServicePanelComponentFactory( - UIComponentFactorySPI servicePanelComponentFactory) { - this.servicePanelComponentFactory = servicePanelComponentFactory; - } - - public void setContextualViewComponentFactory( - UIComponentFactorySPI contextualViewComponentFactory) { - this.contextualViewComponentFactory = contextualViewComponentFactory; - } - - public void setWorkflowExplorerFactory( - UIComponentFactorySPI workflowExplorerFactory) { - this.workflowExplorerFactory = workflowExplorerFactory; - } - - public void setReportViewComponentFactory( - UIComponentFactorySPI reportViewComponentFactory) { - this.reportViewComponentFactory = reportViewComponentFactory; - } - - public void setFileManager(FileManager fileManager) { - this.fileManager = fileManager; - } - - public void setSelectionManager(SelectionManager selectionManager) { - this.selectionManager = selectionManager; - } - - public void setMenuManager(MenuManager menuManager) { - this.menuManager = menuManager; - } - - public void setEditManager(EditManager editManager) { - this.editManager = editManager; - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/dc466d6d/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/DesignPerspectiveComponent.java ---------------------------------------------------------------------- diff --git a/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/DesignPerspectiveComponent.java b/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/DesignPerspectiveComponent.java deleted file mode 100644 index 37df0ac..0000000 --- a/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/DesignPerspectiveComponent.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2011 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * 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 - ******************************************************************************/ -package net.sf.taverna.t2.ui.perspectives.design; - -import static java.awt.BorderLayout.CENTER; -import static java.awt.BorderLayout.NORTH; - -import java.awt.BorderLayout; -import java.awt.Component; - -import javax.swing.JPanel; -import javax.swing.JSplitPane; -import javax.swing.JTabbedPane; - -import net.sf.taverna.t2.ui.menu.MenuManager; -import net.sf.taverna.t2.workbench.edits.EditManager; -import net.sf.taverna.t2.workbench.file.FileManager; -import net.sf.taverna.t2.workbench.selection.SelectionManager; -import net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI; - -/** - * @author David Withers - */ -public class DesignPerspectiveComponent extends JSplitPane { - private static final long serialVersionUID = 6199239532713982318L; - - private final UIComponentFactorySPI graphViewComponentFactory; - private final UIComponentFactorySPI servicePanelComponentFactory; - private final UIComponentFactorySPI contextualViewComponentFactory; - private final UIComponentFactorySPI workflowExplorerFactory; - @SuppressWarnings("unused") - private final UIComponentFactorySPI reportViewComponentFactory; - private final SelectionManager selectionManager; - - private final FileManager fileManager; - private final MenuManager menuManager; - private final EditManager editManager; - - public DesignPerspectiveComponent( - UIComponentFactorySPI graphViewComponentFactory, - UIComponentFactorySPI servicePanelComponentFactory, - UIComponentFactorySPI contextualViewComponentFactory, - UIComponentFactorySPI workflowExplorerFactory, - UIComponentFactorySPI reportViewComponentFactory, - FileManager fileManager, SelectionManager selectionManager, - MenuManager menuManager, EditManager editManager) { - this.graphViewComponentFactory = graphViewComponentFactory; - this.servicePanelComponentFactory = servicePanelComponentFactory; - this.contextualViewComponentFactory = contextualViewComponentFactory; - this.workflowExplorerFactory = workflowExplorerFactory; - this.reportViewComponentFactory = reportViewComponentFactory; - this.fileManager = fileManager; - this.selectionManager = selectionManager; - this.menuManager = menuManager; - this.editManager = editManager; - - setBorder(null); - setOrientation(HORIZONTAL_SPLIT); - setDividerLocation(300); - setLeftComponent(createLeftComponent()); - setRightComponent(createRightComponent()); - } - - private Component createLeftComponent() { - JSplitPane leftComponent = new JSplitPane(VERTICAL_SPLIT); - leftComponent.setBorder(null); - leftComponent.setDividerLocation(400); - - leftComponent.setLeftComponent((Component) servicePanelComponentFactory - .getComponent()); - - JTabbedPane rightComponent = new JTabbedPane(); - rightComponent.addTab("Workflow explorer", - (Component) workflowExplorerFactory.getComponent()); - rightComponent.addTab("Details", - (Component) contextualViewComponentFactory.getComponent()); - // rightComponent.addTab("Validation report", (Component) - // reportViewComponentFactory.getComponent()); - leftComponent.setRightComponent(rightComponent); - - return leftComponent; - } - - private Component createRightComponent() { - JPanel diagramComponent = new JPanel(new BorderLayout()); - diagramComponent.add(new WorkflowSelectorComponent(selectionManager), - NORTH); - diagramComponent.add( - (Component) graphViewComponentFactory.getComponent(), CENTER); - - JPanel rightComonent = new JPanel(new BorderLayout()); - rightComonent.add(new WorkflowBundleSelectorComponent(selectionManager, - fileManager, menuManager, editManager), NORTH); - rightComonent.add(diagramComponent, CENTER); - return rightComonent; - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/dc466d6d/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/WorkflowBundleSelectorComponent.java ---------------------------------------------------------------------- diff --git a/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/WorkflowBundleSelectorComponent.java b/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/WorkflowBundleSelectorComponent.java deleted file mode 100644 index 9fccf06..0000000 --- a/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/WorkflowBundleSelectorComponent.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2013 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * 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 - ******************************************************************************/ -package net.sf.taverna.t2.ui.perspectives.design; - -import java.awt.Component; -import java.net.URI; - -import javax.swing.Action; -import javax.swing.JMenuItem; - -import net.sf.taverna.t2.lang.observer.Observable; -import net.sf.taverna.t2.lang.observer.SwingAwareObserver; -import net.sf.taverna.t2.lang.ui.tabselector.Tab; -import net.sf.taverna.t2.lang.ui.tabselector.TabSelectorComponent; -import net.sf.taverna.t2.ui.menu.MenuManager; -import net.sf.taverna.t2.workbench.edits.EditManager; -import net.sf.taverna.t2.workbench.file.FileManager; -import net.sf.taverna.t2.workbench.file.events.ClosedDataflowEvent; -import net.sf.taverna.t2.workbench.file.events.FileManagerEvent; -import net.sf.taverna.t2.workbench.selection.SelectionManager; -import net.sf.taverna.t2.workbench.selection.events.SelectionManagerEvent; -import net.sf.taverna.t2.workbench.selection.events.WorkflowBundleSelectionEvent; -import uk.org.taverna.scufl2.api.container.WorkflowBundle; - -/** - * Component for managing selection of workflow bundles. - * - * @author David Withers - */ -public class WorkflowBundleSelectorComponent extends TabSelectorComponent<WorkflowBundle> { - private static final long serialVersionUID = 7291973052895544750L; - private static final URI FILE_CLOSE_URI = URI - .create("http://taverna.sf.net/2008/t2workbench/menu#fileClose"); - - private final SelectionManager selectionManager; - private final FileManager fileManager; - private final EditManager editManager; - private final MenuManager menuManager; - - private Action closeMenuAction; - - public WorkflowBundleSelectorComponent(SelectionManager selectionManager, - FileManager fileManager, MenuManager menuManager, - EditManager editManager) { - this.selectionManager = selectionManager; - this.fileManager = fileManager; - this.menuManager = menuManager; - this.editManager = editManager; - fileManager.addObserver(new FileManagerObserver()); - selectionManager.addObserver(new SelectionManagerObserver()); - } - - private class FileManagerObserver extends - SwingAwareObserver<FileManagerEvent> { - @Override - public void notifySwing(Observable<FileManagerEvent> sender, - FileManagerEvent message) { - if (message instanceof ClosedDataflowEvent) { - ClosedDataflowEvent event = (ClosedDataflowEvent) message; - removeObject(event.getDataflow()); - } - } - } - - private class SelectionManagerObserver extends - SwingAwareObserver<SelectionManagerEvent> { - @Override - public void notifySwing(Observable<SelectionManagerEvent> sender, - SelectionManagerEvent message) { - if (message instanceof WorkflowBundleSelectionEvent) { - WorkflowBundleSelectionEvent workflowBundleSelectionEvent = (WorkflowBundleSelectionEvent) message; - WorkflowBundle workflowBundle = workflowBundleSelectionEvent - .getSelectedWorkflowBundle(); - selectObject(workflowBundle); - } - } - } - - @Override - protected Tab<WorkflowBundle> createTab(WorkflowBundle workflowBundle) { - return new WorkflowTab(this, workflowBundle, selectionManager, - fileManager, editManager, getCloseMenuAction()); - } - - private Action getCloseMenuAction() { - if (closeMenuAction == null) { - Component component = menuManager.getComponentByURI(FILE_CLOSE_URI); - if (component instanceof JMenuItem) { - JMenuItem menuItem = (JMenuItem) component; - closeMenuAction = menuItem.getAction(); - } - } - return closeMenuAction; - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/dc466d6d/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/WorkflowSelectorComponent.java ---------------------------------------------------------------------- diff --git a/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/WorkflowSelectorComponent.java b/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/WorkflowSelectorComponent.java deleted file mode 100644 index 6472828..0000000 --- a/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/WorkflowSelectorComponent.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2012 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * 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 - ******************************************************************************/ -package net.sf.taverna.t2.ui.perspectives.design; - -import static java.awt.FlowLayout.LEFT; - -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.net.URI; -import java.util.LinkedList; -import java.util.List; - -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; - -import net.sf.taverna.t2.lang.observer.Observable; -import net.sf.taverna.t2.lang.observer.SwingAwareObserver; -import net.sf.taverna.t2.workbench.selection.SelectionManager; -import net.sf.taverna.t2.workbench.selection.events.SelectionManagerEvent; -import net.sf.taverna.t2.workbench.selection.events.WorkflowBundleSelectionEvent; -import net.sf.taverna.t2.workbench.selection.events.WorkflowSelectionEvent; -import uk.org.taverna.scufl2.api.activity.Activity; -import uk.org.taverna.scufl2.api.common.NamedSet; -import uk.org.taverna.scufl2.api.common.Scufl2Tools; -import uk.org.taverna.scufl2.api.configurations.Configuration; -import uk.org.taverna.scufl2.api.container.WorkflowBundle; -import uk.org.taverna.scufl2.api.core.Processor; -import uk.org.taverna.scufl2.api.core.Workflow; -import uk.org.taverna.scufl2.api.profiles.ProcessorBinding; -import uk.org.taverna.scufl2.api.profiles.Profile; - -import com.fasterxml.jackson.databind.JsonNode; - -/** - * Component for managing selection of workflows. - * - * @author David Withers - */ -@SuppressWarnings("serial") -public class WorkflowSelectorComponent extends JPanel { - private static final URI NESTED_WORKFLOW_TYPE = URI - .create("http://ns.taverna.org.uk/2010/activity/nested-workflow"); - - private final Scufl2Tools scufl2Tools = new Scufl2Tools(); - private final SelectionManager selectionManager; - - public WorkflowSelectorComponent(SelectionManager selectionManager) { - super(new FlowLayout(LEFT)); - this.selectionManager = selectionManager; - update(selectionManager.getSelectedWorkflow()); - selectionManager.addObserver(new SelectionManagerObserver()); - } - - private void update(Workflow workflow) { - removeAll(); - if (workflow != null - && workflow.getParent().getMainWorkflow() != workflow) - update(workflow, selectionManager.getSelectedProfile()); - revalidate(); - repaint(); - } - - /** @see #update(Workflow) */ - private void update(Workflow workflow, Profile profile) { - boolean first = true; - for (final Workflow workflowItem : getPath( - new NamedSet<>(profile.getActivities()), workflow, profile)) { - JButton button = new JButton(workflowItem.getName()); -// button.setBorder(null); - button.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - selectionManager.setSelectedWorkflow(workflowItem); - } - }); - if (!first) - add(new JLabel(">")); - first = false; - add(button); - } - } - - private List<Workflow> getPath(NamedSet<Activity> activities, - Workflow workflow, Profile profile) { - LinkedList<Workflow> path = new LinkedList<>(); - for (Activity activity : activities) { - if (!activity.getType().equals(NESTED_WORKFLOW_TYPE)) - continue; - if (getNestedWorkflow(workflow, profile, activity) != workflow) - continue; - - List<ProcessorBinding> processorBindings = scufl2Tools - .processorBindingsToActivity(activity); - for (ProcessorBinding processorBinding : processorBindings) { - Processor processor = processorBinding.getBoundProcessor(); - Workflow parentWorkflow = processor.getParent(); - if (workflow.getParent().getMainWorkflow() == parentWorkflow) - path.add(parentWorkflow); - else { - activities.remove(activity); - path.addAll(getPath(activities, parentWorkflow, profile)); - } - break; - } - break; - } - path.add(workflow); - return path; - } - - private Workflow getNestedWorkflow(Workflow workflow, Profile profile, - Activity activity) { - for (Configuration configuration : scufl2Tools.configurationsFor( - activity, profile)) { - JsonNode nested = configuration.getJson().get("nestedWorkflow"); - Workflow wf = workflow.getParent().getWorkflows() - .getByName(nested.asText()); - if (wf != null) - return wf; - } - return null; - } - - private class SelectionManagerObserver extends - SwingAwareObserver<SelectionManagerEvent> { - @Override - public void notifySwing(Observable<SelectionManagerEvent> sender, - SelectionManagerEvent message) { - if (message instanceof WorkflowBundleSelectionEvent) - bundleSelected((WorkflowBundleSelectionEvent) message); - else if (message instanceof WorkflowSelectionEvent) - workflowSelected((WorkflowSelectionEvent) message); - } - } - - private void workflowSelected(WorkflowSelectionEvent event) { - update(event.getSelectedWorkflow()); - } - - private void bundleSelected(WorkflowBundleSelectionEvent event) { - WorkflowBundle workflowBundle = event.getSelectedWorkflowBundle(); - if (workflowBundle == null) - update((Workflow) null); - else - update(selectionManager.getSelectedWorkflow()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/dc466d6d/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/WorkflowTab.java ---------------------------------------------------------------------- diff --git a/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/WorkflowTab.java b/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/WorkflowTab.java deleted file mode 100644 index e2f7bd6..0000000 --- a/taverna-workbench-perspective-design/src/main/java/net/sf/taverna/t2/ui/perspectives/design/WorkflowTab.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2012 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * 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 - ******************************************************************************/ -package net.sf.taverna.t2.ui.perspectives.design; - -import java.awt.Component; -import java.awt.event.ActionEvent; - -import javax.swing.Action; - -import net.sf.taverna.t2.lang.observer.Observable; -import net.sf.taverna.t2.lang.observer.SwingAwareObserver; -import net.sf.taverna.t2.lang.ui.tabselector.Tab; -import net.sf.taverna.t2.workbench.edits.EditManager; -import net.sf.taverna.t2.workbench.edits.EditManager.AbstractDataflowEditEvent; -import net.sf.taverna.t2.workbench.edits.EditManager.EditManagerEvent; -import net.sf.taverna.t2.workbench.file.FileManager; -import net.sf.taverna.t2.workbench.file.events.ClosedDataflowEvent; -import net.sf.taverna.t2.workbench.file.events.FileManagerEvent; -import net.sf.taverna.t2.workbench.file.events.SavedDataflowEvent; -import net.sf.taverna.t2.workbench.file.exceptions.UnsavedException; -import net.sf.taverna.t2.workbench.selection.SelectionManager; -import uk.org.taverna.scufl2.api.container.WorkflowBundle; - -/** - * Tab for selecting current workflow. - * - * @author David Withers - */ -@SuppressWarnings("serial") -public class WorkflowTab extends Tab<WorkflowBundle> { - private static final String SAVED_MARKER = "*"; - - private final Component component; - private final SelectionManager selectionManager; - private final FileManager fileManager; - private final EditManager editManager; - private final Action closeMenuAction; - - private boolean saved = true; - private EditManagerObserver editManagerObserver; - private FileManagerObserver fileManagerObserver; - - public WorkflowTab(Component component, final WorkflowBundle workflowBundle, - final SelectionManager selectionManager, final FileManager fileManager, - EditManager editManager, Action closeMenuAction) { - super(workflowBundle.getMainWorkflow().getName(), workflowBundle); - this.component = component; - this.selectionManager = selectionManager; - this.fileManager = fileManager; - this.editManager = editManager; - this.closeMenuAction = closeMenuAction; - editManagerObserver = new EditManagerObserver(); - fileManagerObserver = new FileManagerObserver(); - editManager.addObserver(editManagerObserver); - fileManager.addObserver(fileManagerObserver); - } - - @Override - protected void clickTabAction() { - selectionManager.setSelectedWorkflowBundle(selection); - } - - @Override - protected void closeTabAction() { - if (!saved && closeMenuAction != null) { - selectionManager.setSelectedWorkflowBundle(selection); - closeMenuAction.actionPerformed(new ActionEvent(component, 0, "")); - } else - try { - fileManager.closeDataflow(selection, false); - } catch (UnsavedException e) { - } - } - - private class EditManagerObserver extends - SwingAwareObserver<EditManagerEvent> { - @Override - public void notifySwing(Observable<EditManagerEvent> sender, - EditManagerEvent message) { - if (message instanceof AbstractDataflowEditEvent) { - AbstractDataflowEditEvent event = (AbstractDataflowEditEvent) message; - if (event.getDataFlow() == selection) - setSaved(false); - } - } - } - - private class FileManagerObserver extends - SwingAwareObserver<FileManagerEvent> { - @Override - public void notifySwing(Observable<FileManagerEvent> sender, - FileManagerEvent message) { - if (message instanceof ClosedDataflowEvent) { - ClosedDataflowEvent event = (ClosedDataflowEvent) message; - if (event.getDataflow() == selection) { - fileManager.removeObserver(fileManagerObserver); - editManager.removeObserver(editManagerObserver); - } - } else if (message instanceof SavedDataflowEvent) { - SavedDataflowEvent event = (SavedDataflowEvent) message; - if (event.getDataflow() == selection) - setSaved(true); - } - } - } - - public void setSaved(boolean saved) { - this.saved = saved; - String name = getName(); - if (saved && name.startsWith(SAVED_MARKER)) - setName(name.substring(SAVED_MARKER.length())); - else if (!saved && !name.startsWith(SAVED_MARKER)) - setName(SAVED_MARKER + name); - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/dc466d6d/taverna-workbench-perspective-design/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.PerspectiveSPI ---------------------------------------------------------------------- diff --git a/taverna-workbench-perspective-design/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.PerspectiveSPI b/taverna-workbench-perspective-design/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.PerspectiveSPI deleted file mode 100644 index db4397c..0000000 --- a/taverna-workbench-perspective-design/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.PerspectiveSPI +++ /dev/null @@ -1 +0,0 @@ -net.sf.taverna.t2.ui.perspectives.design.DesignPerspective http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/dc466d6d/taverna-workbench-perspective-design/src/main/resources/META-INF/spring/perspective-design-context-osgi.xml ---------------------------------------------------------------------- diff --git a/taverna-workbench-perspective-design/src/main/resources/META-INF/spring/perspective-design-context-osgi.xml b/taverna-workbench-perspective-design/src/main/resources/META-INF/spring/perspective-design-context-osgi.xml deleted file mode 100644 index 3473a47..0000000 --- a/taverna-workbench-perspective-design/src/main/resources/META-INF/spring/perspective-design-context-osgi.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:beans="http://www.springframework.org/schema/beans" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/osgi - http://www.springframework.org/schema/osgi/spring-osgi.xsd"> - - <service ref="DesignPerspective" auto-export="interfaces" /> - - <reference id="graphViewComponentFactory" interface="net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI" bean-name="GraphViewComponentFactory" /> - <reference id="servicePanelComponentFactory" interface="net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI" bean-name="ServicePanelComponentFactory"/> - <reference id="contextualViewComponentFactory" interface="net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI" bean-name="ContextualViewComponentFactory"/> - <reference id="workflowExplorerFactory" interface="net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI" bean-name="WorkflowExplorerFactory"/> - <!-- <reference id="reportViewComponentFactory" interface="net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI" bean-name="ReportViewComponentFactory"/> --> - <reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" /> - <reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" /> - <reference id="menuManager" interface="net.sf.taverna.t2.ui.menu.MenuManager" /> - <reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" /> - -</beans:beans> http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/dc466d6d/taverna-workbench-perspective-design/src/main/resources/META-INF/spring/perspective-design-context.xml ---------------------------------------------------------------------- diff --git a/taverna-workbench-perspective-design/src/main/resources/META-INF/spring/perspective-design-context.xml b/taverna-workbench-perspective-design/src/main/resources/META-INF/spring/perspective-design-context.xml deleted file mode 100644 index 9e4e383..0000000 --- a/taverna-workbench-perspective-design/src/main/resources/META-INF/spring/perspective-design-context.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd"> - - <bean id="DesignPerspective" class="net.sf.taverna.t2.ui.perspectives.design.DesignPerspective"> - <property name="graphViewComponentFactory" ref="graphViewComponentFactory" /> - <property name="servicePanelComponentFactory" ref="servicePanelComponentFactory" /> - <property name="contextualViewComponentFactory" ref="contextualViewComponentFactory" /> - <property name="workflowExplorerFactory" ref="workflowExplorerFactory" /> - <!-- <property name="reportViewComponentFactory" ref="reportViewComponentFactory" /> --> - <property name="fileManager" ref="fileManager" /> - <property name="selectionManager" ref="selectionManager" /> - <property name="menuManager" ref="menuManager" /> - <property name="editManager" ref="editManager" /> - </bean> - -</beans> http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/dc466d6d/taverna-workbench-perspective-myexperiment/pom.xml ---------------------------------------------------------------------- diff --git a/taverna-workbench-perspective-myexperiment/pom.xml b/taverna-workbench-perspective-myexperiment/pom.xml deleted file mode 100644 index 9406580..0000000 --- a/taverna-workbench-perspective-myexperiment/pom.xml +++ /dev/null @@ -1,85 +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.t2</groupId> - <artifactId>ui-exts</artifactId> - <version>2.0-SNAPSHOT</version> - </parent> - <groupId>net.sf.taverna.t2.ui-exts</groupId> - <artifactId>perspective-myexperiment</artifactId> - <name>myExperiment perspective</name> - <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> - - <dependencies> - <dependency> - <groupId>net.sf.taverna.t2.ui-api</groupId> - <artifactId>menu-api</artifactId> - <version>${t2.ui.api.version}</version> - </dependency> - <dependency> - <groupId>net.sf.taverna.t2.ui-api</groupId> - <artifactId>workbench-api</artifactId> - <version>${t2.ui.api.version}</version> - </dependency> - <dependency> - <groupId>net.sf.taverna.t2.ui-api</groupId> - <artifactId>file-api</artifactId> - <version>${t2.ui.api.version}</version> - </dependency> - <dependency> - <groupId>net.sf.taverna.t2.ui-activities</groupId> - <artifactId>dataflow-activity-ui</artifactId> - <version>${t2.ui.activities.version}</version> - </dependency> - <dependency> - <groupId>net.sf.taverna.t2.lang</groupId> - <artifactId>ui</artifactId> - <version>${t2.lang.version}</version> - </dependency> - - <dependency> - <groupId>uk.org.taverna.configuration</groupId> - <artifactId>taverna-configuration-api</artifactId> - <version>${taverna.configuration.version}</version> - </dependency> - <dependency> - <groupId>uk.org.taverna.configuration</groupId> - <artifactId>taverna-app-configuration-api</artifactId> - <version>${taverna.configuration.version}</version> - </dependency> - - <dependency> - <groupId>org.jdom</groupId> - <artifactId>com.springsource.org.jdom</artifactId> - <version>${jdom.version}</version> - </dependency> - <dependency> - <groupId>org.apache.log4j</groupId> - <artifactId>com.springsource.org.apache.log4j</artifactId> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/dc466d6d/taverna-workbench-perspective-myexperiment/src/main/java/net/sf/taverna/t2/ui/perspectives/myexperiment/AddCommentDialog.java ---------------------------------------------------------------------- diff --git a/taverna-workbench-perspective-myexperiment/src/main/java/net/sf/taverna/t2/ui/perspectives/myexperiment/AddCommentDialog.java b/taverna-workbench-perspective-myexperiment/src/main/java/net/sf/taverna/t2/ui/perspectives/myexperiment/AddCommentDialog.java deleted file mode 100644 index fc1a8e6..0000000 --- a/taverna-workbench-perspective-myexperiment/src/main/java/net/sf/taverna/t2/ui/perspectives/myexperiment/AddCommentDialog.java +++ /dev/null @@ -1,330 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2009 The University of Manchester - * - * Modifications to the initial code base are copyright of their respective - * authors, or their employers as appropriate. - * - * 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 - ******************************************************************************/ -package net.sf.taverna.t2.ui.perspectives.myexperiment; - -import java.awt.Component; -import java.awt.Container; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.net.HttpURLConnection; - -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JRootPane; -import javax.swing.JScrollPane; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.WindowConstants; -import javax.swing.event.CaretEvent; -import javax.swing.event.CaretListener; - -import net.sf.taverna.t2.lang.ui.DialogTextArea; -import net.sf.taverna.t2.ui.perspectives.myexperiment.model.MyExperimentClient; -import net.sf.taverna.t2.ui.perspectives.myexperiment.model.Resource; -import net.sf.taverna.t2.ui.perspectives.myexperiment.model.ServerResponse; -import net.sf.taverna.t2.ui.perspectives.myexperiment.model.Util; -import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog; - -import org.apache.log4j.Logger; - -/** - * @author Sergejs Aleksejevs, Jiten Bhagat - */ - -public class AddCommentDialog extends HelpEnabledDialog implements ActionListener, CaretListener, ComponentListener, KeyListener { - // components for accessing application's main elements - private MainComponent pluginMainComponent; - private MyExperimentClient myExperimentClient; - private Logger logger; - - // COMPONENTS - private DialogTextArea taComment; - private JButton bPost; - private JButton bCancel; - private JLabel lStatusMessage; - - // STORAGE - private Resource resource; // a resource for which the comment is being posted - private String strComment = null; - private boolean bPostingSuccessful = false; - - public AddCommentDialog(JFrame owner, Resource resource, MainComponent component, MyExperimentClient client, Logger logger) { - super(owner, "Add comment for \"" + resource.getTitle() + "\" " - + resource.getItemTypeName(), true); - - // set main variables to ensure access to myExperiment, logger and the parent component - this.pluginMainComponent = component; - this.myExperimentClient = client; - this.logger = logger; - - // set the resource for which the comment is being added - this.resource = resource; - - // set options of the 'add comment' dialog box - this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - //this.setIconImage(new ImageIcon(MyExperimentPerspective.getLocalResourceURL("myexp_icon")).getImage()); - - this.initialiseUI(); - } - - private void initialiseUI() { - // get content pane - Container contentPane = this.getContentPane(); - - // set up layout - contentPane.setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - - // add all components - JLabel lInfo = new JLabel("Please type in you comment:"); - c.gridx = 0; - c.gridy = 0; - c.anchor = GridBagConstraints.WEST; - c.gridwidth = 2; - c.fill = GridBagConstraints.NONE; - c.insets = new Insets(10, 10, 5, 10); - contentPane.add(lInfo, c); - - this.taComment = new DialogTextArea(5, 35); - this.taComment.setLineWrap(true); - this.taComment.setWrapStyleWord(true); - this.taComment.addKeyListener(this); - this.taComment.addCaretListener(this); - - JScrollPane spComment = new JScrollPane(this.taComment); - c.gridy = 1; - c.fill = GridBagConstraints.HORIZONTAL; - c.insets = new Insets(0, 10, 0, 10); - contentPane.add(spComment, c); - - this.bPost = new JButton("Post Comment"); - this.bPost.setEnabled(false); - this.bPost.setDefaultCapable(true); - this.getRootPane().setDefaultButton(this.bPost); - this.bPost.addActionListener(this); - this.bPost.addKeyListener(this); - c.gridy = 2; - c.anchor = GridBagConstraints.EAST; - c.gridwidth = 1; - c.fill = GridBagConstraints.NONE; - c.weightx = 0.5; - c.insets = new Insets(10, 5, 10, 5); - contentPane.add(bPost, c); - - this.bCancel = new JButton("Cancel"); - this.bCancel.setPreferredSize(this.bPost.getPreferredSize()); - this.bCancel.addActionListener(this); - c.gridx = 1; - c.anchor = GridBagConstraints.WEST; - c.weightx = 0.5; - contentPane.add(bCancel, c); - - this.pack(); - this.setMinimumSize(this.getPreferredSize()); - this.setMaximumSize(this.getPreferredSize()); - this.addComponentListener(this); - } - - /** - * Opens up a modal dialog where the user can enter the comment text. - * - * Window is simply closed if 'Cancel' button is pressed; on pressing 'Post - * Comment' button the window will turn into 'waiting' state, post the comment - * and return the resulting XML document (which would contain the newly added - * comment) back to the caller. - * - * @return String value of the non-empty comment text to be sent to - * myExperiment or null if action was cancelled. - */ - public String launchAddCommentDialogAndPostCommentIfRequired() { - // makes the 'add comment' dialog visible, then waits until it is closed; - // control returns to this method when the dialog window is disposed - this.setVisible(true); - return (strComment); - } - - // *** Callback for ActionListener interface *** - public void actionPerformed(ActionEvent e) { - if (e.getSource().equals(this.bPost)) { - // 'Post' button is not active when text in the comment field is blank, - // so if it was pressed, there should be some text typed in - this.strComment = this.taComment.getText(); - - // the window will stay visible, but should turn into 'waiting' state - final JRootPane rootPane = this.getRootPane(); - final Container contentPane = this.getContentPane(); - contentPane.remove(this.bPost); - contentPane.remove(this.bCancel); - if (this.lStatusMessage != null) - contentPane.remove(this.lStatusMessage); - this.taComment.setEditable(false); - - final GridBagConstraints c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 2; - c.gridwidth = 2; - c.anchor = GridBagConstraints.CENTER; - c.fill = GridBagConstraints.NONE; - c.insets = new Insets(10, 5, 10, 5); - lStatusMessage = new JLabel("Posting your comment...", new ImageIcon(MyExperimentPerspective.getLocalResourceURL("spinner")), SwingConstants.CENTER); - contentPane.add(lStatusMessage, c); - - // disable the (X) button (ideally, would need to remove it, but there's no way to do this) - this.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); - - // revalidate the window - this.pack(); - this.validate(); - this.repaint(); - - new Thread("Posting comment") { - public void run() { - // *** POST THE COMMENT *** - final ServerResponse response = myExperimentClient.postComment(resource, Util.stripAllHTML(strComment)); - bPostingSuccessful = (response.getResponseCode() == HttpURLConnection.HTTP_OK); - - SwingUtilities.invokeLater(new Runnable() { - public void run() { - // *** REACT TO POSTING RESULT *** - if (bPostingSuccessful) { - // comment posted successfully - setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); - taComment.setEnabled(false); - contentPane.remove(lStatusMessage); - - c.insets = new Insets(10, 5, 5, 5); - lStatusMessage = new JLabel("Your comment was posted successfully", new ImageIcon(MyExperimentPerspective.getLocalResourceURL("success_icon")), SwingConstants.LEFT); - contentPane.add(lStatusMessage, c); - - bCancel.setText("OK"); - bCancel.setDefaultCapable(true); - rootPane.setDefaultButton(bCancel); - c.insets = new Insets(5, 5, 10, 5); - c.gridy += 1; - contentPane.add(bCancel, c); - - pack(); - bCancel.requestFocusInWindow(); - } else { - // posting wasn't successful, notify the user - // and provide an option to close window or start again - setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); - taComment.setEditable(true); - contentPane.remove(lStatusMessage); - - c.insets = new Insets(10, 5, 5, 5); - lStatusMessage = new JLabel("Error occurred while posting comment: " - + Util.retrieveReasonFromErrorXMLDocument(response.getResponseBody()), new ImageIcon(MyExperimentPerspective.getLocalResourceURL("failure_icon")), SwingConstants.LEFT); - contentPane.add(lStatusMessage, c); - - bPost.setText("Try again"); - bPost.setToolTipText("Please review your comment before trying to post it again"); - c.anchor = GridBagConstraints.EAST; - c.insets = new Insets(5, 5, 10, 5); - c.gridwidth = 1; - c.weightx = 0.5; - c.gridx = 0; - c.gridy += 1; - contentPane.add(bPost, c); - rootPane.setDefaultButton(bPost); - - c.anchor = GridBagConstraints.WEST; - c.gridx = 1; - bCancel.setPreferredSize(bPost.getPreferredSize()); - contentPane.add(bCancel, c); - - pack(); - validate(); - repaint(); - } - } - }); - - } - }.start(); - } else if (e.getSource().equals(this.bCancel)) { - // cleanup the comment if it wasn't posted successfully + simply close and destroy the window - if (!this.bPostingSuccessful) - this.strComment = null; - this.dispose(); - } - - } - - // *** Callbacks for KeyListener interface *** - public void keyPressed(KeyEvent e) { - // if TAB was pressed in the text area, need to move keyboard focus - if (e.getSource().equals(this.taComment) - && e.getKeyCode() == KeyEvent.VK_TAB) { - if ((e.getModifiersEx() & KeyEvent.SHIFT_DOWN_MASK) == KeyEvent.SHIFT_DOWN_MASK) { - // SHIFT + TAB move focus backwards - ((Component) e.getSource()).transferFocusBackward(); - } else { - // TAB moves focus forward - ((Component) e.getSource()).transferFocus(); - } - e.consume(); - } - } - - public void keyReleased(KeyEvent e) { - // not in use - } - - public void keyTyped(KeyEvent e) { - // not in use - } - - // *** Callback for CaretListener interface *** - public void caretUpdate(CaretEvent e) { - // check whether the 'Post' button should be available or not - this.bPost.setEnabled(this.taComment.getText().length() > 0); - } - - // *** Callbacks for ComponentListener interface *** - public void componentShown(ComponentEvent e) { - // center this dialog box within the preview browser window - Util.centerComponentWithinAnother(this.pluginMainComponent.getPreviewBrowser(), this); - } - - public void componentHidden(ComponentEvent e) { - // not in use - } - - public void componentMoved(ComponentEvent e) { - // not in use - } - - public void componentResized(ComponentEvent e) { - // not in use - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/dc466d6d/taverna-workbench-perspective-myexperiment/src/main/java/net/sf/taverna/t2/ui/perspectives/myexperiment/AddRemoveFavouriteDialog.java ---------------------------------------------------------------------- diff --git a/taverna-workbench-perspective-myexperiment/src/main/java/net/sf/taverna/t2/ui/perspectives/myexperiment/AddRemoveFavouriteDialog.java b/taverna-workbench-perspective-myexperiment/src/main/java/net/sf/taverna/t2/ui/perspectives/myexperiment/AddRemoveFavouriteDialog.java deleted file mode 100644 index 563d2b8..0000000 --- a/taverna-workbench-perspective-myexperiment/src/main/java/net/sf/taverna/t2/ui/perspectives/myexperiment/AddRemoveFavouriteDialog.java +++ /dev/null @@ -1,277 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2009 The University of Manchester - * - * Modifications to the initial code base are copyright of their respective - * authors, or their employers as appropriate. - * - * 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 - ******************************************************************************/ -package net.sf.taverna.t2.ui.perspectives.myexperiment; - -import java.awt.Container; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; -import java.net.HttpURLConnection; - -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.WindowConstants; - -import net.sf.taverna.t2.ui.perspectives.myexperiment.model.MyExperimentClient; -import net.sf.taverna.t2.ui.perspectives.myexperiment.model.Resource; -import net.sf.taverna.t2.ui.perspectives.myexperiment.model.ServerResponse; -import net.sf.taverna.t2.ui.perspectives.myexperiment.model.Util; -import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog; - -import org.apache.log4j.Logger; - -/** - * @author Sergejs Aleksejevs - */ -public class AddRemoveFavouriteDialog extends HelpEnabledDialog implements ActionListener, ComponentListener { - // CONSTANTS - protected static final int OPERATION_SUCCESSFUL = 1; - protected static final int OPERATION_CANCELLED = 0; - protected static final int OPERATION_FAILED = -1; - - // components for accessing application's main elements - private final MainComponent pluginMainComponent; - private final MyExperimentClient myExperimentClient; - private final Logger logger; - - // COMPONENTS - private JButton bAddRemoveFavourite; - private JButton bCancel; - - // STORAGE - private final Resource resource; // a resource which is being favourited / removed from favourites - private final boolean bIsFavouriteBeingAdded; - private int iOperationStatus = OPERATION_CANCELLED; - private ServerResponse response = null; - - public AddRemoveFavouriteDialog(JFrame owner, boolean isFavouriteAdded, Resource resource, MainComponent component, MyExperimentClient client, Logger logger) { - super(owner, isFavouriteAdded ? "Add to" : "Remove from" - + " favourites - \"" + resource.getTitle() + "\" " - + resource.getItemTypeName(), true); - - // set main variables to ensure access to myExperiment, logger and the parent component - this.pluginMainComponent = component; - this.myExperimentClient = client; - this.logger = logger; - - // parameters - this.bIsFavouriteBeingAdded = isFavouriteAdded; - this.resource = resource; - - // set options of the 'add/remove favourite' dialog box - this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - //this.setIconImage(new ImageIcon(MyExperimentPerspective.getLocalResourceURL("myexp_icon")).getImage()); - - this.initialiseUI(); - } - - private void initialiseUI() { - // get content pane - Container contentPane = this.getContentPane(); - - // set up layout - contentPane.setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - - // add all components - JLabel lInfo = new JLabel("<html><center>You are about to " - + (this.bIsFavouriteBeingAdded ? "add" : "remove") + " \"" - + resource.getTitle() + "\" " + resource.getItemTypeName() - + (this.bIsFavouriteBeingAdded ? " to" : " from") - + " your favourites.<br><br>" - + "Do you want to proceed?</center></html>"); - c.gridx = 0; - c.gridy = 0; - c.anchor = GridBagConstraints.WEST; - c.gridwidth = 2; - c.fill = GridBagConstraints.NONE; - c.insets = new Insets(10, 10, 10, 10); - contentPane.add(lInfo, c); - - if (this.bIsFavouriteBeingAdded) { - this.bAddRemoveFavourite = new JButton("Add to Favourites"); - } else { - this.bAddRemoveFavourite = new JButton("Remove from Favourites"); - } - this.bAddRemoveFavourite.setDefaultCapable(true); - this.bAddRemoveFavourite.addActionListener(this); - - c.gridy = 1; - c.anchor = GridBagConstraints.EAST; - c.gridwidth = 1; - c.fill = GridBagConstraints.NONE; - c.weightx = 0.5; - c.insets = new Insets(5, 5, 10, 5); - contentPane.add(this.bAddRemoveFavourite, c); - - this.bCancel = new JButton("Cancel"); - this.bCancel.setPreferredSize(this.bAddRemoveFavourite.getPreferredSize()); - this.bCancel.addActionListener(this); - c.gridx = 1; - c.anchor = GridBagConstraints.WEST; - contentPane.add(bCancel, c); - - this.pack(); - this.getRootPane().setDefaultButton(this.bAddRemoveFavourite); - this.setMinimumSize(this.getPreferredSize()); - this.setMaximumSize(this.getPreferredSize()); - this.addComponentListener(this); - } - - /** - * Makes the dialog for adding / removing an item from favourites visible. - * Based on the user actions, it might execute the adding / removing - * operation. - * - * @return Returns an integer value which represents status of the operation: - * {@value #OPERATION_SUCCESSFUL} - favourite item was added / removed - * successfully; {@value #OPERATION_CANCELLED} - the user has - * cancelled operation; {@value #OPERATION_FAILED} - failed while - * adding / removing favourite item; - */ - public int launchAddRemoveFavouriteDialogAndPerformNecessaryActionIfRequired() { - this.setVisible(true); - return (this.iOperationStatus); - } - - // *** Callback for ActionListener interface *** - public void actionPerformed(ActionEvent e) { - - if (e.getSource().equals(this.bAddRemoveFavourite)) { - // the window will stay visible, but should turn into 'waiting' state - final Container contentPane = this.getContentPane(); - contentPane.removeAll(); - - final GridBagConstraints c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.gridwidth = 2; - c.anchor = GridBagConstraints.CENTER; - c.fill = GridBagConstraints.NONE; - c.insets = new Insets(10, 5, 10, 5); - JLabel lInfo = new JLabel(this.bIsFavouriteBeingAdded ? "Adding to favourites..." : "Removing from favourites...", new ImageIcon(MyExperimentPerspective.getLocalResourceURL("spinner")), SwingConstants.CENTER); - contentPane.add(lInfo, c); - - // disable the (X) button (ideally, would need to remove it, but there's no way to do this) - this.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); - - // revalidate the window - this.pack(); - this.validate(); - this.repaint(); - - new Thread("Execute add / remove favourite operation") { - @Override - public void run() { - // *** DO THE REQUIRED ACTION *** - response = (bIsFavouriteBeingAdded ? myExperimentClient.addFavourite(resource) : myExperimentClient.deleteFavourite(resource)); - iOperationStatus = (response.getResponseCode() == HttpURLConnection.HTTP_OK) ? OPERATION_SUCCESSFUL : OPERATION_FAILED; - - if (iOperationStatus == OPERATION_SUCCESSFUL) { - // update local list of favourite items - no data sync with the API is required at this point - if (bIsFavouriteBeingAdded) { - myExperimentClient.getCurrentUser().getFavourites().add(resource); - } else { - myExperimentClient.getCurrentUser().getFavourites().remove(resource); - } - } else { - // operation has failed - this might have been due to outdated data which is stored locally; - // sync favourite data with the API so that the UI can show more relevant data - // (e.g. replace 'add to favourites' with 'remove from favourites' if this item is already - // added to favourites - probably via another interface: web or another instance of the plugin) - myExperimentClient.updateUserFavourites(myExperimentClient.getCurrentUser()); - } - - SwingUtilities.invokeLater(new Runnable() { - public void run() { - // *** REACT TO RESULT *** - setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); - contentPane.removeAll(); - c.insets = new Insets(10, 5, 5, 5); - - if (iOperationStatus == OPERATION_SUCCESSFUL) { - // favourite was added / removed successfully - contentPane.add(new JLabel("Item has been successfully " - + (bIsFavouriteBeingAdded ? "added to" : "removed from") - + " your favourites", new ImageIcon(MyExperimentPerspective.getLocalResourceURL("success_icon")), SwingConstants.LEFT), c); - } else { - // favourite wasn't added / removed - operation failed; - // display error message - contentPane.add(new JLabel("<html><center>Error occurred while " - + (bIsFavouriteBeingAdded ? "adding" : "removing") - + " the item " - + (bIsFavouriteBeingAdded ? "to" : "from") - + " your favourites:<br>" - + Util.retrieveReasonFromErrorXMLDocument(response.getResponseBody()) - + "</center></html>", new ImageIcon(MyExperimentPerspective.getLocalResourceURL("failure_icon")), SwingConstants.LEFT), c); - } - - bCancel.setText("OK"); - bCancel.setPreferredSize(null); // resets preferred size to the automatic one - bCancel.setDefaultCapable(true); - c.insets = new Insets(5, 5, 10, 5); - c.gridy += 1; - contentPane.add(bCancel, c); - - pack(); - repaint(); - - bCancel.requestFocusInWindow(); - getRootPane().setDefaultButton(bCancel); - } - }); - } - }.start(); - - } else if (e.getSource().equals(this.bCancel)) { - // simply close and destroy the window - this.dispose(); - } - } - - // *** Callbacks for ComponentListener interface *** - public void componentShown(ComponentEvent e) { - // center this dialog box within the preview browser window - Util.centerComponentWithinAnother(this.pluginMainComponent.getPreviewBrowser(), this); - } - - public void componentHidden(ComponentEvent e) { - // not in use - } - - public void componentMoved(ComponentEvent e) { - // not in use - } - - public void componentResized(ComponentEvent e) { - // not in use - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/dc466d6d/taverna-workbench-perspective-myexperiment/src/main/java/net/sf/taverna/t2/ui/perspectives/myexperiment/ExampleWorkflowsPanel.java ---------------------------------------------------------------------- diff --git a/taverna-workbench-perspective-myexperiment/src/main/java/net/sf/taverna/t2/ui/perspectives/myexperiment/ExampleWorkflowsPanel.java b/taverna-workbench-perspective-myexperiment/src/main/java/net/sf/taverna/t2/ui/perspectives/myexperiment/ExampleWorkflowsPanel.java deleted file mode 100644 index d3a58a0..0000000 --- a/taverna-workbench-perspective-myexperiment/src/main/java/net/sf/taverna/t2/ui/perspectives/myexperiment/ExampleWorkflowsPanel.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2009 The University of Manchester - * - * Modifications to the initial code base are copyright of their respective - * authors, or their employers as appropriate. - * - * 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 - ******************************************************************************/ -package net.sf.taverna.t2.ui.perspectives.myexperiment; - -import java.awt.BorderLayout; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.SwingUtilities; -import javax.swing.event.ChangeListener; -import javax.swing.event.ChangeEvent; - -import org.apache.log4j.Logger; - -import net.sf.taverna.t2.workbench.icons.WorkbenchIcons; -import net.sf.taverna.t2.ui.perspectives.myexperiment.ResourceListPanel; -import net.sf.taverna.t2.ui.perspectives.myexperiment.model.MyExperimentClient; -import net.sf.taverna.t2.ui.perspectives.myexperiment.model.Resource; -import net.sf.taverna.t2.ui.perspectives.myexperiment.model.Workflow; - -/** - * @author Sergejs Aleksejevs, Jiten Bhagat - */ -public class ExampleWorkflowsPanel extends JPanel implements ActionListener, ChangeListener { - - private static final String ACTION_REFRESH = "refresh_example_workflows"; - - private MainComponent pluginMainComponent; - private MyExperimentClient myExperimentClient; - private Logger logger; - - private JLabel statusLabel; - private JButton refreshButton; - - private List<Workflow> workflows = new ArrayList<Workflow>(); - - private ResourceListPanel workflowsListPanel; - - public ExampleWorkflowsPanel(MainComponent component, MyExperimentClient client, Logger logger) { - super(); - - // set main variables to ensure access to myExperiment, logger and the - // parent component - this.pluginMainComponent = component; - this.myExperimentClient = client; - this.logger = logger; - - this.initialiseUI(); - } - - public void actionPerformed(ActionEvent event) { - if (ACTION_REFRESH.equals(event.getActionCommand())) { - this.refresh(); - } - } - - public void stateChanged(ChangeEvent event) { - - } - - public void clear() { - this.statusLabel.setText(""); - this.workflowsListPanel.clear(); - } - - public void refresh() { - this.pluginMainComponent.getStatusBar().setStatus(this.getClass().getName(), "Fetching example workflows from myExperiment"); - this.statusLabel.setText(""); - - // Make call to myExperiment API in a different thread - // (then use SwingUtilities.invokeLater to update the UI when ready). - new Thread("Refresh for ExampleWorkflowsPanel") { - public void run() { - logger.debug("Refreshing Example Workflows tab"); - - try { - workflows = myExperimentClient.getExampleWorkflows(); - - SwingUtilities.invokeLater(new Runnable() { - public void run() { - repopulate(); - } - }); - } catch (Exception ex) { - logger.error("Failed to refresh Example Workflows panel", ex); - } - } - }.start(); - - } - - public void repopulate() { - logger.debug("Repopulating Example Workflows tab"); - - this.pluginMainComponent.getStatusBar().setStatus(this.getClass().getName(), null); - this.statusLabel.setText("This will contain example resources to" - + " help get you started in Taverna. Coming Soon."); - this.statusLabel.setText(this.workflows.size() + " example workflows found"); - - // cannot cast a list of subclass items into a list of superclass items - - // hence a new list is created - this.workflowsListPanel.setListItems(new ArrayList<Resource>(this.workflows)); - - this.revalidate(); - } - - private void initialiseUI() { - this.setLayout(new BorderLayout()); - - JPanel topPanel = new JPanel(new BorderLayout()); - topPanel.setBorder(BorderFactory.createEtchedBorder()); - this.statusLabel = new JLabel(); - this.statusLabel.setBorder(BorderFactory.createEmptyBorder(0, 7, 0, 0)); - topPanel.add(this.statusLabel, BorderLayout.CENTER); - this.refreshButton = new JButton("Refresh", WorkbenchIcons.refreshIcon); - this.refreshButton.setActionCommand(ACTION_REFRESH); - this.refreshButton.addActionListener(this); - this.refreshButton.setToolTipText("Click this button to refresh the Example Workflows list"); - topPanel.add(this.refreshButton, BorderLayout.EAST); - this.add(topPanel, BorderLayout.NORTH); - - this.workflowsListPanel = new ResourceListPanel(this.pluginMainComponent, this.myExperimentClient, this.logger); - JScrollPane spExampleWorkflowList = new JScrollPane(this.workflowsListPanel); - spExampleWorkflowList.getVerticalScrollBar().setUnitIncrement(ResourcePreviewBrowser.PREFERRED_SCROLL); - - this.add(spExampleWorkflowList, BorderLayout.CENTER); - } -}
