airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1220856 - in /incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya: appwrapper/ experiment/gui/ menues/xbaya/ registry/ registrybrowser/ registrybrowser/nodes/
Date Mon, 19 Dec 2011 17:18:33 GMT
Author: samindaw
Date: Mon Dec 19 17:18:32 2011
New Revision: 1220856

URL: http://svn.apache.org/viewvc?rev=1220856&view=rev
Log:
removing working dir field (no longer required)
workflow import from registry from reg browser + save workflow to registry updates saved status
of the graph canvas

Modified:
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ApplicationDescriptionAdvancedOptionDialog.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/HostDescriptionDialog.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/experiment/gui/RegistryLoaderWindow.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/menues/xbaya/XBayaMenuItem.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/RegistryAccesser.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/JCRBrowserPanel.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowTemplateNode.java

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ApplicationDescriptionAdvancedOptionDialog.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ApplicationDescriptionAdvancedOptionDialog.java?rev=1220856&r1=1220855&r2=1220856&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ApplicationDescriptionAdvancedOptionDialog.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ApplicationDescriptionAdvancedOptionDialog.java
Mon Dec 19 17:18:32 2011
@@ -53,7 +53,6 @@ import org.apache.airavata.xbaya.gui.XBa
 public class ApplicationDescriptionAdvancedOptionDialog extends JDialog {
     private static final long serialVersionUID = 3920479739097405014L;
     private XBayaTextField txtInputDir;
-    private XBayaTextField txtWorkingDir;
     private XBayaTextField txtOutputDir;
     private XBayaTextField txtSTDIN;
     private XBayaTextField txtSTDOUT;
@@ -112,7 +111,7 @@ public class ApplicationDescriptionAdvan
 	private void initGUI() {
         setTitle("Application Description Advance Options");
         setModal(true);
-        setBounds(100, 100, 600, 350);
+        setBounds(100, 100, 600, 320);
         setLocationRelativeTo(null);
         GridPanel buttonPane = new GridPanel();
         okButton = new JButton("Update");
@@ -139,9 +138,7 @@ public class ApplicationDescriptionAdvan
     	GridPanel panel = new GridPanel();
         
         txtInputDir = new XBayaTextField();
-        txtWorkingDir = new XBayaTextField();
         
-        XBayaLabel lblWorkingDirectory = new XBayaLabel("Working Directory",txtWorkingDir);
         XBayaLabel lblInputDirectory = new XBayaLabel("Input directory",txtInputDir);
 
         JLabel lblLocations = new JLabel("Locations");
@@ -223,8 +220,6 @@ public class ApplicationDescriptionAdvan
         GridPanel leftPanel = new GridPanel();
         leftPanel.add(lblLocations);
         leftPanel.add(new JLabel());
-        leftPanel.add(lblWorkingDirectory);
-        leftPanel.add(txtWorkingDir);
         leftPanel.add(lblInputDirectory);
         leftPanel.add(txtInputDir);
         leftPanel.add(lblOutputDirectory);
@@ -238,7 +233,7 @@ public class ApplicationDescriptionAdvan
         leftPanel.add(lblStderr);
         leftPanel.add(txtSTDERR);
         
-        SwingUtil.layoutToGrid(leftPanel.getSwingComponent(), 8, 2, SwingUtil.WEIGHT_NONE,
1);
+        SwingUtil.layoutToGrid(leftPanel.getSwingComponent(), 7, 2, SwingUtil.WEIGHT_NONE,
1);
         
         GridPanel rightPanel = new GridPanel();
         rightPanel.add(lblEnvironmentalVariables);
@@ -302,7 +297,6 @@ public class ApplicationDescriptionAdvan
     }
 
     private void saveApplicationDescriptionAdvancedOptions() {
-    	getShellApplicationDescriptionType().setStaticWorkingDirectory(txtWorkingDir.getText());
     	getShellApplicationDescriptionType().setInputDataDirectory(txtInputDir.getText());
     	getShellApplicationDescriptionType().setOutputDataDirectory(txtOutputDir.getText());
     	getShellApplicationDescriptionType().setStandardInput(txtSTDIN.getText());
@@ -312,7 +306,6 @@ public class ApplicationDescriptionAdvan
     }
 
     private void loadApplicationDescriptionAdvancedOptions() {
-        txtWorkingDir.setText(getShellApplicationDescriptionType().getScratchWorkingDirectory());
         txtInputDir.setText(getShellApplicationDescriptionType().getInputDataDirectory());
         txtOutputDir.setText(getShellApplicationDescriptionType().getOutputDataDirectory());
         txtSTDIN.setText(getShellApplicationDescriptionType().getStandardInput());

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/HostDescriptionDialog.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/HostDescriptionDialog.java?rev=1220856&r1=1220855&r2=1220856&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/HostDescriptionDialog.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/HostDescriptionDialog.java
Mon Dec 19 17:18:32 2011
@@ -44,6 +44,7 @@ import org.apache.airavata.xbaya.XBayaEn
 import org.apache.airavata.xbaya.gui.GridPanel;
 import org.apache.airavata.xbaya.gui.XBayaLabel;
 import org.apache.airavata.xbaya.gui.XBayaTextField;
+import org.apache.tika.parser.txt.TXTParser;
 
 public class HostDescriptionDialog extends JDialog {
 
@@ -76,12 +77,22 @@ public class HostDescriptionDialog exten
     private String hostId;
 
     private JButton okButton;
-
+    
+    private boolean newHost;
+    
+    private HostDescription originalHostDescription;
+    
+    public HostDescriptionDialog(XBayaEngine engine) {
+    	this(engine,true,null);
+    }
+    
     /**
      * @param engine XBaya workflow engine
      */
-    public HostDescriptionDialog(XBayaEngine engine) {
+    public HostDescriptionDialog(XBayaEngine engine, boolean newHost, HostDescription originalHostDescription)
{
         this.engine = engine;
+        setNewHost(newHost);
+        setOriginalHostDescription(originalHostDescription);
         setRegistry(engine.getConfiguration().getJcrComponentRegistry().getRegistry());
         initGUI();
     }
@@ -216,8 +227,33 @@ public class HostDescriptionDialog exten
         getRootPane().setDefaultButton(okButton);
         chkGobusHost.setSelected(false);
         updateGlobusHostTypeAndControls();
+        if (!isNewHost()) {
+			loadData();
+		}
     }
 
+    private String arrayToString(String[] list) {
+    	String result="";
+		for (String s : list) {
+			if (result.equals("")){
+				result=s;
+			}else{
+				result+=","+s;
+			}
+		}
+		return result;
+	}
+    private void loadData() {
+    	HostDescriptionType t = getOriginalHostDescription().getType();
+    	hostIdTextField.setText(t.getHostName());
+		hostAddressTextField.setText(t.getHostAddress());
+		if (t instanceof GlobusHostType){
+			globusGateKeeperTextField.setText(arrayToString(((GlobusHostType) t).getGlobusGateKeeperEndPointArray()));
+			GridFTPTextField.setText(arrayToString(((GlobusHostType) t).getGridFTPEndPointArray()));
+		}
+		hostIdTextField.setEditable(isNewHost());
+	}
+    
     public String getHostId() {
         return getHostDescription().getType().getHostName();
     }
@@ -316,4 +352,20 @@ public class HostDescriptionDialog exten
 		gridFTPLabel.getSwingComponent().setEnabled(isGlobusHostType());
 		GridFTPTextField.setEnabled(isGlobusHostType());
 	}
+
+	public boolean isNewHost() {
+		return newHost;
+	}
+
+	public void setNewHost(boolean newHost) {
+		this.newHost = newHost;
+	}
+
+	public HostDescription getOriginalHostDescription() {
+		return originalHostDescription;
+	}
+
+	public void setOriginalHostDescription(HostDescription originalHostDescription) {
+		this.originalHostDescription = originalHostDescription;
+	}
 }
\ No newline at end of file

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/experiment/gui/RegistryLoaderWindow.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/experiment/gui/RegistryLoaderWindow.java?rev=1220856&r1=1220855&r2=1220856&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/experiment/gui/RegistryLoaderWindow.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/experiment/gui/RegistryLoaderWindow.java
Mon Dec 19 17:18:32 2011
@@ -40,6 +40,7 @@ import javax.swing.border.TitledBorder;
 import javax.xml.namespace.QName;
 
 import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.graph.gui.GraphCanvas;
 import org.apache.airavata.xbaya.gui.ErrorMessages;
 import org.apache.airavata.xbaya.gui.GridPanel;
 import org.apache.airavata.xbaya.gui.XBayaDialog;
@@ -154,7 +155,11 @@ public class RegistryLoaderWindow {
 
         try {
             Workflow workflow = new RegistryAccesser(this.engine).getWorkflow(result.getResourceName());
-            RegistryLoaderWindow.this.engine.setWorkflow(workflow);
+            GraphCanvas newGraphCanvas = engine.getGUI().newGraphCanvas(true);
+            newGraphCanvas.setWorkflow(workflow);
+            //this.engine.setWorkflow(workflow);
+            engine.getGUI().getGraphCanvas().setWorkflowFile(null);
+//            RegistryLoaderWindow.this.engine.setWorkflow(workflow);
         } catch (Exception e) {
             RegistryLoaderWindow.this.engine.getErrorWindow().error(e);
         }

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/menues/xbaya/XBayaMenuItem.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/menues/xbaya/XBayaMenuItem.java?rev=1220856&r1=1220855&r2=1220856&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/menues/xbaya/XBayaMenuItem.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/menues/xbaya/XBayaMenuItem.java
Mon Dec 19 17:18:32 2011
@@ -258,7 +258,11 @@ public class XBayaMenuItem {
         this.saveWorkflowtoRegistryItem.addActionListener(new AbstractAction() {
 			private static final long serialVersionUID = 1L;
             public void actionPerformed(ActionEvent e) {
-                registryAccesser.saveWorkflow();
+                if (registryAccesser.saveWorkflow()){
+                	if (engine.getGUI().getGraphCanvas().getWorkflowFile()==null){
+                		engine.getGUI().getGraphCanvas().workflowSaved();
+                	}
+                }
             }
         });
     }

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/RegistryAccesser.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/RegistryAccesser.java?rev=1220856&r1=1220855&r2=1220856&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/RegistryAccesser.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/RegistryAccesser.java
Mon Dec 19 17:18:32 2011
@@ -29,6 +29,7 @@ import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.xml.namespace.QName;
 
+import org.apache.airavata.common.utils.StringUtil;
 import org.apache.airavata.common.utils.XMLUtil;
 import org.apache.airavata.registry.api.Registry;
 import org.apache.airavata.xbaya.XBayaConfiguration;
@@ -39,7 +40,6 @@ import org.apache.airavata.xbaya.compone
 import org.apache.airavata.xbaya.experiment.gui.RegistryWorkflowPublisherWindow;
 import org.apache.airavata.xbaya.graph.GraphException;
 import org.apache.airavata.xbaya.jython.script.JythonScript;
-import org.apache.airavata.common.utils.StringUtil;
 import org.apache.airavata.xbaya.util.XBayaUtil;
 import org.apache.airavata.xbaya.wf.Workflow;
 import org.ietf.jgss.GSSCredential;
@@ -103,7 +103,7 @@ public class RegistryAccesser {
     /**
      * Save workflow in to Registry
      */
-    public void saveWorkflow() {
+    public boolean saveWorkflow() {
         if (XBayaUtil.acquireJCRRegistry(this.engine)) {
             try {
 
@@ -120,7 +120,7 @@ public class RegistryAccesser {
                         buf.append("\n");
                     }
                     this.engine.getErrorWindow().warning(buf.toString());
-                    return;
+                    return false;
                 }
                 RegistryWorkflowPublisherWindow registryPublishingWindow = new RegistryWorkflowPublisherWindow(
                         this.engine);
@@ -157,14 +157,15 @@ public class RegistryAccesser {
                 String owner = this.engine.getConfiguration().getRegigstryUserName();
 
                 Registry registry = this.connectToRegistry();
-                registry.saveWorkflow(workflowQName, workflow.getName(), workflow.getDescription(),
workflowAsString,
+                boolean result = registry.saveWorkflow(workflowQName, workflow.getName(),
workflow.getDescription(), workflowAsString,
                         owner, registryPublishingWindow.isMakePublic());
                 registryPublishingWindow.hide();
-
+                return result;
             } catch (Exception e) {
                 this.engine.getErrorWindow().error(e.getMessage(), e);
             }
         }
+		return false;
     }
 
     /**

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/JCRBrowserPanel.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/JCRBrowserPanel.java?rev=1220856&r1=1220855&r2=1220856&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/JCRBrowserPanel.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/JCRBrowserPanel.java
Mon Dec 19 17:18:32 2011
@@ -29,7 +29,6 @@ import java.awt.event.KeyAdapter;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Observable;
@@ -50,6 +49,7 @@ import org.apache.airavata.xbaya.registr
 import org.apache.airavata.xbaya.registrybrowser.menu.AddAction;
 import org.apache.airavata.xbaya.registrybrowser.menu.DeleteAction;
 import org.apache.airavata.xbaya.registrybrowser.menu.EditAction;
+import org.apache.airavata.xbaya.registrybrowser.menu.ImportAction;
 import org.apache.airavata.xbaya.registrybrowser.menu.RefreshAction;
 import org.apache.airavata.xbaya.registrybrowser.nodes.AbstractAiravataTreeNode;
 import org.apache.airavata.xbaya.registrybrowser.nodes.AiravataTreeNodeFactory;
@@ -126,6 +126,12 @@ public class JCRBrowserPanel extends JPa
                         triggerNodeAction(EditAction.ID);
                     }
                 });
+                ImportAction actionImport = new ImportAction();
+                actionImport.addActionListener(new ActionListener() {
+                    public void actionPerformed(ActionEvent arg0) {
+                        triggerNodeAction(ImportAction.ID);
+                    }
+                });
                 tree.addMouseListener(new MouseAdapter(){
 					@Override
 					public void mouseClicked(MouseEvent e) {
@@ -134,10 +140,11 @@ public class JCRBrowserPanel extends JPa
 						}
 					}
                 });
-                browserActions.add(actionRefresh);
                 browserActions.add(actionAdd);
-                browserActions.add(actionDelete);
+                browserActions.add(actionImport);
                 browserActions.add(actionEdit);
+                browserActions.add(actionRefresh);
+                browserActions.add(actionDelete);
 
 //                popupMenu.add(actionAdd.getMenuItem());
 //                popupMenu.add(actionDelete.getMenuItem());
@@ -243,7 +250,9 @@ public class JCRBrowserPanel extends JPa
             	if (action==null){
             		action=node.getDefaultAction();
             	}
-                node.triggerAction(tree, action);
+                if (action!=null) {
+					node.triggerAction(tree, action);
+				}
             } catch (Exception e) {
                 e.printStackTrace();
                 getEngine().getErrorWindow().error(e);

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowTemplateNode.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowTemplateNode.java?rev=1220856&r1=1220855&r2=1220856&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowTemplateNode.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowTemplateNode.java
Mon Dec 19 17:18:32 2011
@@ -26,16 +26,18 @@ import java.util.List;
 
 import javax.jcr.PathNotFoundException;
 import javax.swing.Icon;
-import javax.swing.JOptionPane;
 import javax.swing.JTree;
 import javax.swing.tree.TreeNode;
 import javax.xml.namespace.QName;
 
 import org.apache.airavata.registry.api.exception.ServiceDescriptionRetrieveException;
+import org.apache.airavata.xbaya.graph.gui.GraphCanvas;
+import org.apache.airavata.xbaya.registry.RegistryAccesser;
 import org.apache.airavata.xbaya.registrybrowser.menu.AbstractBrowserActionItem;
 import org.apache.airavata.xbaya.registrybrowser.menu.DeleteAction;
-import org.apache.airavata.xbaya.registrybrowser.menu.EditAction;
+import org.apache.airavata.xbaya.registrybrowser.menu.ImportAction;
 import org.apache.airavata.xbaya.registrybrowser.model.XBayaWorkflowTemplate;
+import org.apache.airavata.xbaya.wf.Workflow;
 
 public class XBayaWorkflowTemplateNode extends AbstractAiravataTreeNode {
     private XBayaWorkflowTemplate xbayaWorkflow;
@@ -70,16 +72,18 @@ public class XBayaWorkflowTemplateNode e
 
     @Override
     public List<String> getSupportedActions() {
-        return Arrays.asList(DeleteAction.ID);
+        return Arrays.asList(ImportAction.ID,DeleteAction.ID);
     }
 
     public boolean triggerAction(JTree tree, String action) throws Exception {
         if (action.equals(DeleteAction.ID)) {
             deleteHostDescription(tree);
             return true;
-        } else if (action.equals(EditAction.ID)) {
-            JOptionPane.showMessageDialog(null, "TODO");
-            // TODO
+        } else if (action.equals(ImportAction.ID)) {
+        	Workflow workflow = new RegistryAccesser(getXBayaEngine()).getWorkflow(getXbayaWorkflow().getWorkflowName());
+            GraphCanvas newGraphCanvas = getXBayaEngine().getGUI().newGraphCanvas(true);
+            newGraphCanvas.setWorkflow(workflow);
+            getXBayaEngine().getGUI().getGraphCanvas().setWorkflowFile(null);
             return true;
         }
         return super.triggerAction(tree, action);
@@ -98,8 +102,8 @@ public class XBayaWorkflowTemplateNode e
     public String getActionCaption(AbstractBrowserActionItem action) {
         if (action.getID().equals(DeleteAction.ID)) {
             return "Remove";
-        } else if (action.getID().equals(EditAction.ID)) {
-            return "Edit";
+        } else if (action.getID().equals(ImportAction.ID)) {
+            return "Import";
         }
         return action.getDefaultCaption();
     }
@@ -113,4 +117,9 @@ public class XBayaWorkflowTemplateNode e
     public String getActionDescription(AbstractBrowserActionItem action) {
         return null;
     }
+    
+    @Override
+    public String getDefaultAction() {
+    	return ImportAction.ID;
+    }
 }



Mime
View raw message