You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2012/05/18 17:44:32 UTC

svn commit: r1340137 [5/5] - in /incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya: ./ appwrapper/ component/registry/ core/ core/amazon/ core/generators/ core/ide/ core/workflow/ graph/controller/ interpretor/ invoker/...

Added: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaTextComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaTextComponent.java?rev=1340137&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaTextComponent.java (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaTextComponent.java Fri May 18 15:44:22 2012
@@ -0,0 +1,37 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.widgets;
+
+
+public interface XBayaTextComponent extends XBayaComponent {
+
+    /**
+     * @param text
+     */
+    public void setText(String text);
+
+    /**
+     * @return The text
+     */
+    public String getText();
+
+}
\ No newline at end of file

Added: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaTextField.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaTextField.java?rev=1340137&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaTextField.java (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaTextField.java Fri May 18 15:44:22 2012
@@ -0,0 +1,124 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.widgets;
+
+import java.net.URI;
+
+import javax.swing.JTextField;
+
+import org.apache.airavata.common.utils.StringUtil;
+
+public class XBayaTextField implements XBayaTextComponent {
+
+    /**
+     * DEFAULT_COLUMNS
+     */
+    public static final int DEFAULT_COLUMNS = 30;
+
+    private JTextField textArea;
+
+    /**
+     * Constructs a XBayaTextArea.
+     */
+    public XBayaTextField() {
+        init();
+    }
+
+    /**
+     * Constructs a XBayaTextField.
+     * 
+     * @param initStr
+     */
+    public XBayaTextField(String initStr) {
+        init();
+        this.textArea.setText(initStr);
+    }
+
+    /**
+     * @return The swing component.
+     */
+    public JTextField getSwingComponent() {
+        return getTextField();
+    }
+
+    /**
+     * @param uri
+     */
+    public void setText(URI uri) {
+        setText(StringUtil.toString(uri));
+    }
+
+    /**
+     * @param text
+     */
+    public void setText(String text) {
+        if (text == null) {
+            text = "";
+        } else {
+            text = text.trim();
+        }
+        this.textArea.setText(text);
+        this.textArea.setCaretPosition(0);
+    }
+
+    /**
+     * @return The text. It never returns null.
+     */
+    public String getText() {
+        return this.textArea.getText().trim();
+    }
+
+    /**
+     * @return The text field
+     */
+    public JTextField getTextField() {
+        return this.textArea;
+    }
+
+    /**
+     * @param editable
+     */
+    public void setEditable(boolean editable) {
+        this.textArea.setEditable(editable);
+    }
+
+    /**
+     * @param columns
+     */
+    public void setColumns(int columns) {
+        this.textArea.setColumns(columns);
+    }
+
+    /**
+     * Sets whether or not this component is enabled.
+     * 
+     * @param enabled
+     */
+    public void setEnabled(boolean enabled) {
+        this.textArea.setEnabled(enabled);
+    }
+
+    private void init() {
+        this.textArea = new JTextField(DEFAULT_COLUMNS);
+        this.textArea.setEditable(true);
+    }
+}
\ No newline at end of file

Added: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaToolBar.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaToolBar.java?rev=1340137&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaToolBar.java (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaToolBar.java Fri May 18 15:44:22 2012
@@ -0,0 +1,362 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.widgets;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.swing.AbstractAction;
+import javax.swing.BorderFactory;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JToolBar;
+import javax.swing.border.Border;
+
+import org.apache.airavata.common.utils.SwingUtil;
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.workflow.model.wf.WorkflowExecutionState;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+
+import com.amazonaws.transform.MapEntry;
+
+public class XBayaToolBar implements XBayaComponent {
+
+    private XBayaEngine engine;
+
+    private JToolBar toolbar;
+
+    private JButton play;
+
+    private JButton step;
+
+    private JButton stop;
+    
+    private Map<String,List<ToolbarButton>> toolbarButtons = new HashMap<String,List<ToolbarButton>>();
+
+    private static Map<String,Integer> groupOrder;
+    /**
+     * IMAGES_STOP_JPEG
+     */
+    public static final String IMAGES_STOP_JPEG = "stop.jpeg";
+    /**
+     * IMAGES_PAUSE_JPEG
+     */
+    public static final String IMAGES_PAUSE_JPEG = "pause.jpeg";
+    /**
+     * IMAGES_PLAY_JPEG
+     */
+    public static final String IMAGES_PLAY_JPEG = "play.jpeg";
+    /**
+     * IMAGES_STEP_JPEG
+     */
+    private static final String IMAGES_STEP_JPEG = "step.gif";
+
+    private AbstractAction playAction;
+
+    private AbstractAction stepAction;
+
+    private AbstractAction stopAction;
+
+    private ImageIcon PLAY_ICON;
+
+    private ImageIcon PAUSE_ICON;
+
+    /**
+     * Creates a toolbar.
+     * 
+     * @param client
+     */
+    public XBayaToolBar(XBayaEngine client) {
+        this.engine = client;
+        init();
+    }
+
+    /**
+     * Returns the toolbar.
+     * 
+     * @return The toolbar
+     */
+    public JComponent getSwingComponent() {
+        return this.toolbar;
+    }
+
+    private void init() {
+
+        this.toolbar = new JToolBar();
+        this.toolbar.setFloatable(false);
+        Border border = BorderFactory.createEtchedBorder();
+        this.toolbar.setBorder(border);
+
+        JButton addNodeButton = new JButton("Add Node");
+        addNodeButton.addActionListener(new AbstractAction() {
+            private static final long serialVersionUID = 1L;
+
+            public void actionPerformed(ActionEvent event) {
+                try {
+                    XBayaToolBar.this.engine.getGUI().addNode();
+                } catch (RuntimeException e) {
+                    XBayaToolBar.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                } catch (Error e) {
+                    XBayaToolBar.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                }
+            }
+        });
+
+        JButton removeNodeButton = new JButton("Remove Node");
+        removeNodeButton.addActionListener(new AbstractAction() {
+            private static final long serialVersionUID = 1L;
+
+            public void actionPerformed(ActionEvent event) {
+                try {
+                    XBayaToolBar.this.engine.getGUI().getGraphCanvas().removeSelectedNode();
+                } catch (GraphException e) {
+                    // Should not happen
+                    XBayaToolBar.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                } catch (RuntimeException e) {
+                    XBayaToolBar.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                } catch (Error e) {
+                    XBayaToolBar.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                }
+            }
+        });
+
+        JButton connectEdgeButton = new JButton("Connect/Disconnect");
+        connectEdgeButton.addActionListener(new AbstractAction() {
+            private static final long serialVersionUID = 1L;
+
+            public void actionPerformed(ActionEvent event) {
+                try {
+                    XBayaToolBar.this.engine.getGUI().getGraphCanvas().addOrRemoveEdge();
+                } catch (RuntimeException e) {
+                    XBayaToolBar.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                } catch (Error e) {
+                    XBayaToolBar.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                }
+            }
+        });
+
+        this.play = new JButton();
+        PAUSE_ICON = SwingUtil.createImageIcon(IMAGES_PAUSE_JPEG);
+        PLAY_ICON = SwingUtil.createImageIcon(IMAGES_PLAY_JPEG);
+        this.playAction = new AbstractAction(null, PAUSE_ICON) {
+            /**
+             * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+             */
+            public void actionPerformed(ActionEvent e1) {
+                try {
+                    Workflow workflow = engine.getWorkflow();
+                    WorkflowExecutionState executionState = workflow.getExecutionState();
+                    if (executionState == WorkflowExecutionState.RUNNING || executionState == WorkflowExecutionState.STEP) {
+                        workflow.setExecutionState(WorkflowExecutionState.PAUSED);
+                        play.setIcon(PLAY_ICON);
+                    } else if (executionState == WorkflowExecutionState.PAUSED) {
+                        workflow.setExecutionState(WorkflowExecutionState.RUNNING);
+                        play.setIcon(PAUSE_ICON);
+                    } else {
+                        throw new IllegalStateException("Unknown state :" + executionState);
+                    }
+                } catch (RuntimeException e) {
+                    XBayaToolBar.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                } catch (Error e) {
+                    XBayaToolBar.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                }
+
+            }
+        };
+        this.play.setAction(this.playAction);
+
+        this.step = new JButton();
+        this.stepAction = new AbstractAction(null, SwingUtil.createImageIcon(IMAGES_STEP_JPEG)) {
+            /**
+             * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+             */
+            public void actionPerformed(ActionEvent e2) {
+                try {
+                    if (engine.getWorkflow().getExecutionState() == WorkflowExecutionState.PAUSED) {
+                        engine.getWorkflow().setExecutionState(WorkflowExecutionState.STEP);
+                    } else {
+                        throw new IllegalStateException("Unknown state :" + engine.getWorkflow().getExecutionState());
+                    }
+                } catch (RuntimeException e) {
+                    XBayaToolBar.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                } catch (Error e) {
+                    XBayaToolBar.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                }
+
+            }
+        };
+        this.step.setAction(stepAction);
+
+        this.stop = new JButton();
+        this.stopAction = new AbstractAction(null, SwingUtil.createImageIcon(IMAGES_STOP_JPEG)) {
+            /**
+             * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+             */
+            public void actionPerformed(ActionEvent e1) {
+                try {
+                    if (engine.getWorkflow().getExecutionState() != WorkflowExecutionState.NONE
+                            || engine.getWorkflow().getExecutionState() != WorkflowExecutionState.STOPPED) {
+                        engine.getWorkflow().setExecutionState(WorkflowExecutionState.STOPPED);
+                    } else {
+                        throw new IllegalStateException("Unknown state :" + engine.getWorkflow().getExecutionState());
+                    }
+                } catch (RuntimeException e) {
+                    XBayaToolBar.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                } catch (Error e) {
+                    XBayaToolBar.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                }
+
+            }
+        };
+        this.stop.setAction(stopAction);
+
+//        this.toolbar.add(addNodeButton);
+//        this.toolbar.add(removeNodeButton);
+//        this.toolbar.addSeparator();
+//        this.toolbar.add(connectEdgeButton);
+        
+    }
+
+    public ToolbarButton addToolbarButton(String group, String caption, Icon icon, String description, ActionListener onClick, int order){
+    	ToolbarButton toolbarButton = new ToolbarButton(icon, caption, description, order);
+    	toolbarButton.setButtonClickListener(onClick);
+    	getToolBarButtonList(group).add(toolbarButton);
+    	rearrangeToolbarButtons();
+    	return toolbarButton;
+    }
+    
+    private void sortButtons(List<ToolbarButton> buttons){
+    	ToolbarButton[] buttonList=buttons.toArray(new ToolbarButton[]{});
+    	ToolbarButton temp;
+    	for (int i=0;i<buttonList.length-1;i++) {
+			for(int j=i+1;j<buttonList.length;j++){
+				if (buttonList[i].getOrder()!=-1){
+					if (buttonList[i].getOrder()>buttonList[j].getOrder()){
+						temp=buttonList[i];
+						buttonList[i]=buttonList[j];
+						buttonList[j]=temp;
+					}
+				}
+			}
+		}
+    	buttons.clear();
+    	buttons.addAll(Arrays.asList(buttonList));
+    }
+    
+    private void rearrangeToolbarButtons(){
+    	toolbar.removeAll();
+    	String[] groupIds = getSortedGroupIdList();
+    	Map<String, List<ToolbarButton>> tempToolbarButtons=new HashMap<String, List<ToolbarButton>>();
+    	tempToolbarButtons.putAll(toolbarButtons);
+    	for (String groupId : groupIds) {
+    		tempToolbarButtons.remove(groupId);
+    		if (toolbarButtons.containsKey(groupId) && toolbarButtons.get(groupId)!=null) {
+				List<ToolbarButton> buttons = toolbarButtons.get(groupId);
+				addButtonsToToolbar(buttons);
+			}
+		}
+    	for (String groupId : tempToolbarButtons.keySet()) {
+    		List<ToolbarButton> buttons = tempToolbarButtons.get(groupId);
+			addButtonsToToolbar(buttons);
+		}
+    }
+
+	private void addButtonsToToolbar(List<ToolbarButton> buttons) {
+		sortButtons(buttons);
+		for (ToolbarButton button : buttons) {
+			toolbar.add(button);
+		}
+		toolbar.addSeparator();
+	}
+
+	private String[] getSortedGroupIdList() {
+		String[] groupIds = getGroupOrder().keySet().toArray(new String[]{});
+    	for(int i=0;i<groupIds.length-1;i++){
+    		for(int j=i+1;j<groupIds.length;j++){
+        		if (getGroupOrder().get(groupIds[i])>getGroupOrder().get(groupIds[j])){
+        			String temp=groupIds[i];
+        			groupIds[i]=groupIds[j];
+        			groupIds[j]=temp;
+        		}
+        	}	
+    	}
+		return groupIds;
+	}
+    
+
+    /**
+     * Returns the playAction.
+     * 
+     * @return The playAction
+     */
+    public AbstractAction getPlayAction() {
+        return this.playAction;
+    }
+
+    /**
+     * Returns the stepAction.
+     * 
+     * @return The stepAction
+     */
+    public AbstractAction getStepAction() {
+        return this.stepAction;
+    }
+
+    /**
+     * Returns the stopAction.
+     * 
+     * @return The stopAction
+     */
+    public AbstractAction getStopAction() {
+        return this.stopAction;
+    }
+
+    private List<ToolbarButton> getToolBarButtonList(String group){
+    	if (!toolbarButtons.containsKey(group)){
+    		toolbarButtons.put(group, new ArrayList<ToolbarButton>());
+    	}
+    	return toolbarButtons.get(group);
+    }
+    
+    public static void setGroupOrder(String groupId, int order){
+    	getGroupOrder().put(groupId, order);
+    }
+
+	public static Map<String,Integer> getGroupOrder() {
+		if (groupOrder==null){
+    		groupOrder=new HashMap<String, Integer>();
+    	}
+		return groupOrder;
+	}
+
+}
\ No newline at end of file

Added: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XbayaEnhancedList.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XbayaEnhancedList.java?rev=1340137&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XbayaEnhancedList.java (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XbayaEnhancedList.java Fri May 18 15:44:22 2012
@@ -0,0 +1,308 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.widgets;
+
+import java.awt.Dimension;
+import java.awt.event.MouseAdapter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.ScrollPaneConstants;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.DefaultTableModel;
+
+
+/**
+ * @param <T>
+ */
+public class XbayaEnhancedList<T extends TableRenderable> implements XBayaComponent {
+
+    private static final int DEFAULT_WIDTH = 400;
+
+    private static final int DEFAULT_HEIGHT = 200;
+
+    private boolean checkbox;
+
+    private DefaultTableModel model;
+
+    private JTable table;
+
+    private JScrollPane scrollPane;
+
+    private Vector<T> tableList;
+
+    /**
+     * Constructs a XbayaEnhancedList.
+     * 
+     */
+    public XbayaEnhancedList() {
+        this(true);
+    }
+
+    /**
+     * 
+     * Constructs a XbayaEnhancedList.
+     * 
+     * @param checkbox
+     */
+    public XbayaEnhancedList(boolean checkbox) {
+        this.checkbox = checkbox;
+        init();
+    }
+
+    /**
+     * Init XbayaEnhancedList
+     */
+    private void init() {
+
+        this.tableList = new Vector<T>();
+
+        this.table = new JTable(new DefaultTableModel());
+        this.table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        this.table.setRowSelectionAllowed(true);
+
+        this.scrollPane = new JScrollPane(this.table);
+        this.scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+        setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
+    }
+
+    /**
+     * @return The swing component.
+     */
+    public JScrollPane getSwingComponent() {
+        return getScrollPane();
+    }
+
+    /**
+     * @return The scroll pane.
+     */
+    public JScrollPane getScrollPane() {
+        return this.scrollPane;
+    }
+
+    /**
+     * @param width
+     * @param height
+     */
+    public void setSize(int width, int height) {
+        Dimension size = new Dimension(width, height);
+        this.scrollPane.setMinimumSize(size);
+        this.scrollPane.setPreferredSize(size);
+    }
+
+    /**
+     * @return table
+     */
+    public JTable getTable() {
+        return this.table;
+    }
+
+    /**
+     * @param tableData
+     * @param listData
+     */
+    public void setListData(Iterable<T> tableData) {
+
+        /*
+         * Create a model for the table for the first time
+         */
+        if (this.model == null) {
+
+            this.model = new DefaultTableModel() {
+                /*
+                 * JTable uses this method to determine the default renderer/ editor for each cell. If we didn't
+                 * implement this method, then the last column would contain text ("true"/"false"), rather than a check
+                 * box.
+                 */
+                @SuppressWarnings("unchecked")
+                @Override
+                public Class getColumnClass(int c) {
+                    if (getValueAt(0, c) == null)
+                        return String.class;
+                    return getValueAt(0, c).getClass();
+                }
+
+                /*
+                 * Don't need to implement this method unless your table's editable.
+                 */
+                @Override
+                public boolean isCellEditable(int row, int col) {
+                    // Note that the data/cell address is constant,
+                    // no matter where the cell appears onscreen.
+                    if (XbayaEnhancedList.this.checkbox && col > 0) {
+                        return false;
+                    } else {
+                        return true;
+                    }
+                }
+            };
+
+            /*
+             * Setup Column Title
+             */
+            boolean noData = true;
+            for (T entry : tableData) {
+                if (this.checkbox) {
+                    this.model.addColumn("Selection");
+                }
+
+                for (int i = 0; i < entry.getColumnCount(); i++) {
+                    this.model.addColumn(entry.getColumnTitle(i));
+                }
+                noData = false;
+                break;
+            }
+
+            // empty input
+            if (noData) {
+                this.model = null;
+                return;
+            }
+
+            this.table.setModel(this.model);
+        }
+
+        clear();
+
+        ArrayList<Object> objList = new ArrayList<Object>();
+        for (T entry : tableData) {
+
+            // add checkbox if needed
+            if (this.checkbox) {
+                objList.add(Boolean.FALSE);
+            }
+
+            for (int i = 0; i < entry.getColumnCount(); i++) {
+                objList.add(entry.getValue(i));
+            }
+            this.model.addRow(objList.toArray());
+            this.tableList.add(entry);
+
+            // clear list
+            objList.clear();
+        }
+    }
+
+    /**
+     * @return T
+     */
+    public T getSelectedValue() {
+        int result = getSelectedIndex();
+        if (result < 0) {
+            return null;
+        }
+        return this.tableList.get(result);
+    }
+
+    /**
+     * @return selected values
+     */
+    public List<T> getSelectedValues() {
+        List<T> resultList = new ArrayList<T>();
+        for (Integer i : getSelectedIndices()) {
+            resultList.add(this.tableList.get(i.intValue()));
+        }
+        return resultList;
+    }
+
+    /**
+     * remove rows selected This method must be called at the last step
+     */
+    public void removeSelectedRows() {
+        int count = 0;
+        for (Integer i : getSelectedIndices()) {
+            this.model.removeRow(i.intValue() - count);
+            this.tableList.remove(i.intValue() - count);
+            count++;
+        }
+    }
+
+    /**
+     * Clear the list contents
+     */
+    public void clear() {
+        if (this.model != null) {
+            for (int i = this.model.getRowCount() - 1; i >= 0; i--) {
+                this.model.removeRow(i);
+            }
+        }
+        this.tableList.clear();
+    }
+
+    /**
+     * @param enabled
+     */
+    public void setEnabled(boolean enabled) {
+        this.table.setEnabled(enabled);
+    }
+
+    /**
+     * Returns the first selected index; returns -1 if there is no selected item.
+     * 
+     * @return The first selected index; -1 if there is no selected item.
+     */
+    public int getSelectedIndex() {
+        List<Integer> intList = getSelectedIndices();
+        if (intList.size() > 1) {
+            return -2;
+        } else if (intList.size() == 0) {
+            return -1;
+        }
+        return intList.get(0).intValue();
+    }
+
+    /**
+     * @return selected indices
+     */
+    public List<Integer> getSelectedIndices() {
+        List<Integer> intList = new ArrayList<Integer>();
+
+        if (!this.checkbox) {
+            intList.add(new Integer(this.table.getSelectedRow()));
+        } else {
+            for (int i = 0; i < this.getTable().getModel().getRowCount(); i++) {
+                if (((Boolean) this.getTable().getModel().getValueAt(i, 0)).booleanValue()) {
+                    intList.add(new Integer(i));
+                }
+            }
+        }
+        return intList;
+    }
+
+    /**
+     * @param listener
+     */
+    public void addListSelectionListener(ListSelectionListener listener) {
+        this.table.getSelectionModel().addListSelectionListener(listener);
+    }
+
+    /**
+     * @param adapter
+     */
+    public void addMouseListener(MouseAdapter adapter) {
+        this.table.addMouseListener(adapter);
+    }
+}
\ No newline at end of file

Copied: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/amazon/S3Tree.java (from r1339949, incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/amazonEC2/S3Tree.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/amazon/S3Tree.java?p2=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/amazon/S3Tree.java&p1=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/amazonEC2/S3Tree.java&r1=1339949&r2=1340137&rev=1340137&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/amazonEC2/S3Tree.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/amazon/S3Tree.java Fri May 18 15:44:22 2012
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.airavata.xbaya.ui.amazonEC2;
+package org.apache.airavata.xbaya.ui.widgets.amazon;
 
 import javax.swing.JTree;
 import javax.swing.tree.DefaultMutableTreeNode;

Copied: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/amazon/S3TreeModel.java (from r1339949, incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/amazonEC2/S3TreeModel.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/amazon/S3TreeModel.java?p2=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/amazon/S3TreeModel.java&p1=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/amazonEC2/S3TreeModel.java&r1=1339949&r2=1340137&rev=1340137&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/amazonEC2/S3TreeModel.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/amazon/S3TreeModel.java Fri May 18 15:44:22 2012
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.airavata.xbaya.ui.amazonEC2;
+package org.apache.airavata.xbaya.ui.widgets.amazon;
 
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;

Copied: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelector.java (from r1339949, incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentSelector.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelector.java?p2=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelector.java&p1=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentSelector.java&r1=1339949&r2=1340137&rev=1340137&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentSelector.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelector.java Fri May 18 15:44:22 2012
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.airavata.xbaya.ui.component;
+package org.apache.airavata.xbaya.ui.widgets.component;
 
 import java.awt.Point;
 import java.awt.Rectangle;
@@ -60,9 +60,9 @@ import org.apache.airavata.xbaya.compone
 import org.apache.airavata.xbaya.component.registry.ComponentReference;
 import org.apache.airavata.xbaya.component.registry.ComponentRegistry;
 import org.apache.airavata.xbaya.component.registry.ComponentRegistryException;
-import org.apache.airavata.xbaya.ui.ErrorMessages;
-import org.apache.airavata.xbaya.ui.XBayaComponent;
-import org.apache.airavata.xbaya.ui.component.ComponentSelectorEvent.ComponentSelectorEventType;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+import org.apache.airavata.xbaya.ui.widgets.XBayaComponent;
+import org.apache.airavata.xbaya.ui.widgets.component.ComponentSelectorEvent.ComponentSelectorEventType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Copied: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelectorEvent.java (from r1339949, incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentSelectorEvent.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelectorEvent.java?p2=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelectorEvent.java&p1=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentSelectorEvent.java&r1=1339949&r2=1340137&rev=1340137&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentSelectorEvent.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelectorEvent.java Fri May 18 15:44:22 2012
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.airavata.xbaya.ui.component;
+package org.apache.airavata.xbaya.ui.widgets.component;
 
 import org.apache.airavata.workflow.model.component.Component;
 

Copied: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelectorListener.java (from r1339949, incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentSelectorListener.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelectorListener.java?p2=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelectorListener.java&p1=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentSelectorListener.java&r1=1339949&r2=1340137&rev=1340137&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentSelectorListener.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelectorListener.java Fri May 18 15:44:22 2012
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.airavata.xbaya.ui.component;
+package org.apache.airavata.xbaya.ui.widgets.component;
 
 public interface ComponentSelectorListener {
 

Copied: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSourceTransferable.java (from r1339949, incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentSourceTransferable.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSourceTransferable.java?p2=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSourceTransferable.java&p1=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentSourceTransferable.java&r1=1339949&r2=1340137&rev=1340137&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentSourceTransferable.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSourceTransferable.java Fri May 18 15:44:22 2012
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.airavata.xbaya.ui.component;
+package org.apache.airavata.xbaya.ui.widgets.component;
 
 import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;

Copied: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentTreeModel.java (from r1339949, incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentTreeModel.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentTreeModel.java?p2=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentTreeModel.java&p1=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentTreeModel.java&r1=1339949&r2=1340137&rev=1340137&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentTreeModel.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentTreeModel.java Fri May 18 15:44:22 2012
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.airavata.xbaya.ui.component;
+package org.apache.airavata.xbaya.ui.widgets.component;
 
 import javax.swing.tree.DefaultTreeModel;
 

Copied: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentTreeNode.java (from r1339949, incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentTreeNode.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentTreeNode.java?p2=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentTreeNode.java&p1=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentTreeNode.java&r1=1339949&r2=1340137&rev=1340137&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/component/ComponentTreeNode.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentTreeNode.java Fri May 18 15:44:22 2012
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.airavata.xbaya.ui.component;
+package org.apache.airavata.xbaya.ui.widgets.component;
 
 import java.util.List;
 

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/AmazonUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/AmazonUtil.java?rev=1340137&r1=1340136&r2=1340137&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/AmazonUtil.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/AmazonUtil.java Fri May 18 15:44:22 2012
@@ -25,7 +25,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.airavata.xbaya.ui.amazonEC2.AmazonCredential;
+import org.apache.airavata.xbaya.core.amazon.AmazonCredential;
 
 import com.amazonaws.auth.BasicAWSCredentials;
 import com.amazonaws.services.ec2.AmazonEC2;

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java?rev=1340137&r1=1340136&r2=1340137&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java Fri May 18 15:44:22 2012
@@ -58,7 +58,7 @@ import org.apache.airavata.xbaya.invoker
 import org.apache.airavata.xbaya.invoker.WorkflowInvokerWrapperForGFacInvoker;
 import org.apache.airavata.xbaya.lead.LeadContextHeaderHelper;
 import org.apache.airavata.xbaya.monitor.MonitorConfiguration;
-import org.apache.airavata.xbaya.ui.component.JCRRegistryWindow;
+import org.apache.airavata.xbaya.ui.dialogs.registry.JCRRegistryWindow;
 import org.apache.axis2.util.XMLUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;