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 2014/04/14 20:30:58 UTC
[56/90] [abbrv] AIRAVATA-1124
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/utils/ErrorMessages.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/utils/ErrorMessages.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/utils/ErrorMessages.java
new file mode 100644
index 0000000..cd061ed
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/utils/ErrorMessages.java
@@ -0,0 +1,240 @@
+/*
+ *
+ * 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.utils;
+
+public interface ErrorMessages {
+
+ /**
+ * URL_EMPTY
+ */
+ public static final String URL_EMPTY = "URL cannot be empty.";
+
+ /**
+ * URL_WRONG
+ */
+ public static final String URL_WRONG = "URL is in wrong format.";
+
+ /**
+ * GPEL_USERNAME_EMPTY
+ */
+ public static final String USERNAME_EMPTY = "Username cannot be empty.";
+
+ /**
+ * GPEL_PASSPHRASE_EMPTY
+ */
+ public static final String PASSWORD_EMPTY = "Password cannot be empty.";
+
+ /**
+ * Error message when it fails to open the file.
+ */
+ public static final String OPEN_FILE_ERROR = "Failed to open the file.";
+
+ /**
+ * Error message when it fails to write the file.
+ */
+ public static final String WRITE_FILE_ERROR = "Failed to write the file.";
+
+ /**
+ * Error message when it fails to load the graph
+ */
+ public static final String GRAPH_LOAD_ERROR = "Failed to load the workflow.";
+
+ /**
+ * Error message when it fails to save the graph
+ */
+ public static final String GRAPH_SAVE_ERROR = "Failed to save the workflow.";
+
+ /**
+ * Error message when the format of a workflow (graph) is wrong.
+ */
+ public static final String GRAPH_FORMAT_ERROR = "The workflow file is in wrong format.";
+
+ /**
+ * Errro message indicating the workflow is not complete to create a workflow script.
+ */
+ public static final String GRAPH_NOT_READY_ERROR = "The workflow is not compelete.";
+
+ /**
+ * Error message when it fails to load a component list.
+ */
+ public static final String COMPONENT_LIST_LOAD_ERROR = "Failed to load a component list.";
+
+ /**
+ * Error message when it fails to load a component.
+ */
+ public static final String COMPONENT_LOAD_ERROR = "Failed to load the component.";
+
+ /**
+ * Error message when the format of a component is wrong.
+ */
+ public static final String COMPONENT_FORMAT_ERROR = "The component is in wrong format.";
+
+ /**
+ * GPEL_ERROR
+ */
+ public static final String GPEL_ERROR = "Error occured while communicating with the GPEL Engine.";
+
+ /**
+ * GPEL_CONNECTION_ERROR
+ */
+ public static final String GPEL_CONNECTION_ERROR = "Failed to connect to the GPEL Engine.";
+
+ /**
+ * GPEL_URL_EMPTY
+ */
+ public static final String GPEL_URL_EMPTY = "GPEL Engine URL cannot be empty.";
+
+ /**
+ * Error if the format of the URL of the GPEL Engine is wrong.
+ */
+ public static final String GPEL_WRONG_URL = "The URL of the GPEL Engine is in a wrong format.";
+
+ /**
+ * Error while loading a list of workflows from GPEL Engine.
+ */
+ public static final String GPEL_WORKFLOW_LIST_LOAD_ERROR = "Failed to get list of workflows from GPEL Engine.";
+
+ /**
+ * GPEL_WORKFLOW_NOT_FOUND_ERROR
+ */
+ public static final String GPEL_WORKFLOW_NOT_FOUND_ERROR = "The specified workflow doesn't exist in the GPEL Engine.";
+
+ /**
+ * GPEL_MAX_EMPTY
+ */
+ public static final String GPEL_MAX_EMPTY = "Maximum cannot be empty.";
+
+ /**
+ * GPEL_MAX_WRONG
+ */
+ public static final String GPEL_MAX_WRONG = "Maximum needs to be an integer.";
+
+ /**
+ * WORKFLOW_WSDL_ERROR
+ */
+ public static final String WORKFLOW_WSDL_NOT_EXIST = "You need to generate BPEL script first.";
+
+ /**
+ * WORKFLOW_WSDL_ERROR
+ */
+ public static final String WORKFLOW_WSDL_ERROR = "The workflow WSDL is in wrong format.";
+
+ /**
+ * Error while subscribing to notification.
+ */
+ public static final String MONITOR_SUBSCRIPTION_ERROR = "Failed to subscribe to notification.";
+
+ /**
+ * Some other error related to monitoring.
+ */
+ public static final String MONITOR_ERROR = "Monitor error.";
+
+ /**
+ * KARMA_CONNECTION_ERROR
+ */
+ public static final String KARMA_CONNECTION_ERROR = "Failed to connect to the Karma service.";
+
+ /**
+ * TOPIC_EMPTY_ERROR
+ */
+ public static final String TOPIC_EMPTY_ERROR = "Topic cannot be empty.";
+
+ /**
+ * BROKER_URL_NOT_SET_ERROR
+ */
+ public static final String BROKER_URL_NOT_SET_ERROR = "Broker URL is not set.";
+
+ /**
+ * Error while loading a list of workflows from Registry.
+ */
+ public static final String REGISTRY_WORKFLOW_LIST_LOAD_ERROR = "Failed to get list of workflows from Registry.";
+
+ /**
+ * GFAC_URL_WRONG
+ */
+ public static final String GFAC_URL_WRONG = "GFac URL is in wrong format.";
+
+ /**
+ * DSC_URL_WRONG
+ */
+ public static final String DSC_URL_WRONG = "DSC URL is in wrong format.";
+
+ /**
+ * MYPROXY_LOAD_ERROR
+ */
+ public static final String MYPROXY_LOAD_ERROR = "Failed to load a proxy";
+
+ /**
+ * MYPROXY_HOST_EMPTY
+ */
+ public static final String MYPROXY_HOST_EMPTY = "MyProxy server cannot be empty.";
+
+ /**
+ * MYPROXY_PORT_EMPTY
+ */
+ public static final String MYPROXY_PORT_EMPTY = "MyProxy server port cannot be empty.";
+
+ /**
+ * MYPROXY_PORT_WRONG
+ */
+ public static final String MYPROXY_PORT_WRONG = "MyProxy server port needs to be an integer.";
+
+ /**
+ * MYPROXY_LIFETIME_EMPTY
+ */
+ public static final String MYPROXY_LIFETIME_EMPTY = "Lifetime cannot be empty.";
+
+ /**
+ * MYPROXY_LIFETIME_WRONG
+ */
+ public static final String MYPROXY_LIFETIME_WRONG = "Lifetime needs to be an integer.";
+
+ /**
+ * MYPROXY_PASSPHRASE_WRONG
+ */
+ public static final String MYPROXY_PASSPHRASE_WRONG = "Passphrase must be at least 6 characters long";
+
+ /**
+ * Error message for unexpected errors. When you see this, fix it!!
+ */
+ public static final String UNEXPECTED_ERROR = "Unexpected error.";
+
+ /**
+ * Warning message for no component selected.
+ */
+ public static final String NO_COMPONENT_SELECTED_WARNING = "You need to select a component to add from the Component Selector.";
+
+ /**
+ * Warning message when a user tries to set a default value before a parameter node is connected.
+ */
+ public static final String INPUT_NOT_CONNECTED_WARNING = "You need to connect the input to an input of a service first to configure.";
+
+ /**
+ * Warning message when a user tries to set a value before a parameter node is connected.
+ */
+ public static final String CONSTANT_NOT_CONNECTED_WARNING = "You need to connect the constant to an input of a service first to configure.";
+
+ String CREDENTIALS_WRONG = "Please check credentials";
+ String GIVEN_WORKFLOW_NAME_IS_WRONG = "Given Workflow Name is Wrong ";
+ String REPOSITORY_CONFIGURATION_IS_WRONG_FAILED_TO_LOAD_THE_WORKFLOW = "Repository Configuration is Wrong, Failed to load the Workflow";
+ String WORKFLOW_IS_WRONG = "Workflow is Wrong";
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/ComponentViewer.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/ComponentViewer.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/ComponentViewer.java
new file mode 100644
index 0000000..a56c94f
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/ComponentViewer.java
@@ -0,0 +1,139 @@
+/*
+ *
+ * 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.views;
+
+import java.awt.Color;
+
+import javax.swing.JEditorPane;
+import javax.swing.SwingUtilities;
+
+import org.apache.airavata.workflow.model.component.Component;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.xbaya.ui.graph.GraphCanvas;
+import org.apache.airavata.xbaya.ui.graph.GraphCanvasEvent;
+import org.apache.airavata.xbaya.ui.graph.GraphCanvasListener;
+import org.apache.airavata.xbaya.ui.graph.GraphCanvasEvent.GraphCanvasEventType;
+import org.apache.airavata.xbaya.ui.widgets.XBayaComponent;
+import org.apache.airavata.xbaya.ui.widgets.component.ComponentSelector;
+import org.apache.airavata.xbaya.ui.widgets.component.ComponentSelectorEvent;
+import org.apache.airavata.xbaya.ui.widgets.component.ComponentSelectorListener;
+import org.apache.airavata.xbaya.ui.widgets.component.ComponentSelectorEvent.ComponentSelectorEventType;
+
+import xsul5.XmlConstants;
+
+public class ComponentViewer implements GraphCanvasListener, ComponentSelectorListener, XBayaComponent {
+
+ /**
+ * The title
+ */
+ public static final String TITLE = "Component Information";
+
+ private static final String DEFAULT_HTML_MESSAGE = "<html> Select a component from the " + ComponentSelector.TITLE
+ + ".</html>";
+
+ private Component currentComponent;
+
+ private JEditorPane editorPane;
+
+ /**
+ * Creates a ComponentViewer.
+ */
+ public ComponentViewer() {
+ super();
+
+ this.currentComponent = null;
+
+ this.editorPane = new JEditorPane();
+ this.editorPane.setEditable(false);
+ this.editorPane.setBackground(Color.WHITE);
+
+ this.editorPane.setContentType(XmlConstants.CONTENT_TYPE_HTML);
+ this.editorPane.setText(DEFAULT_HTML_MESSAGE);
+ }
+
+ /**
+ * @return the GUI component
+ */
+ public JEditorPane getSwingComponent() {
+ return this.editorPane;
+ }
+
+ /**
+ * Sets a component to show.
+ *
+ * @param component
+ * the component to show
+ */
+ public void setComponent(final Component component) {
+ // logger.entering(component);
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ if (component == null) {
+ ComponentViewer.this.editorPane.setText(DEFAULT_HTML_MESSAGE);
+ } else if (component != ComponentViewer.this.currentComponent) {
+ ComponentViewer.this.editorPane.setText(component.toHTML());
+ // To prevent from scrolling down to the bottom.
+ ComponentViewer.this.editorPane.setCaretPosition(0);
+ }
+ ComponentViewer.this.currentComponent = component;
+ }
+ });
+ // logger.exiting();
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.GraphCanvasListener#graphCanvasChanged(org.apache.airavata.xbaya.ui.graph.GraphCanvasEvent)
+ */
+ public void graphCanvasChanged(GraphCanvasEvent event) {
+ GraphCanvasEventType type = event.getType();
+ GraphCanvas graphCanvas = event.getGraphCanvas();
+ switch (type) {
+ case NODE_SELECTED:
+ Node node = graphCanvas.getSelectedNode();
+ if (node == null) {
+ setComponent(null);
+ } else {
+ setComponent(node.getComponent());
+ }
+ break;
+ case GRAPH_LOADED:
+ case NAME_CHANGED:
+ case INPUT_PORT_SELECTED:
+ case OUTPUT_PORT_SELECTED:
+ // do nothing
+ }
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.widgets.component.ComponentSelectorListener#componentSelectorChanged(org.apache.airavata.xbaya.ui.widgets.component.ComponentSelectorEvent)
+ */
+ public void componentSelectorChanged(ComponentSelectorEvent event) {
+ ComponentSelectorEventType type = event.getType();
+ switch (type) {
+ case COMPONENT_SELECTED:
+ Component component = event.getComponent();
+ setComponent(component);
+ break;
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/JCRBrowserPanel.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/JCRBrowserPanel.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/JCRBrowserPanel.java
new file mode 100644
index 0000000..33338f0
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/JCRBrowserPanel.java
@@ -0,0 +1,287 @@
+/*
+ *
+ * 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.views;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Observable;
+import java.util.Observer;
+
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.JTree;
+import javax.swing.KeyStroke;
+import javax.swing.border.EmptyBorder;
+import javax.swing.tree.DefaultTreeModel;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.workflow.model.component.registry.JCRComponentRegistry;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.registrybrowser.nodes.AbstractAiravataTreeNode;
+import org.apache.airavata.xbaya.registrybrowser.nodes.AiravataTreeNodeFactory;
+import org.apache.airavata.xbaya.registrybrowser.nodes.RegistryTreeCellRenderer;
+import org.apache.airavata.xbaya.ui.actions.AbstractBrowserActionItem;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.AddAction;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.BrowserAction;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.CopyAction;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.DeleteAction;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.EditAction;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.ImportAction;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.RefreshAction;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.ViewAction;
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class JCRBrowserPanel extends JPanel implements Observer {
+ private List<AbstractBrowserActionItem> browserActions = new ArrayList<AbstractBrowserActionItem>();
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4490110894914580271L;
+ private XBayaEngine engine;
+ private JTree tree;
+ private JPopupMenu popupMenu;
+ private AbstractBrowserActionItem actionDelete;
+
+ /**
+ * Create the dialog.
+ */
+ public JCRBrowserPanel(XBayaEngine engine) {
+ setEngine(engine);
+ initGUI();
+ }
+
+ private void initGUI() {
+ setBounds(100, 100, 450, 300);
+ this.setBorder(new EmptyBorder(5, 5, 5, 5));
+ this.setLayout(new BorderLayout(0, 0));
+ {
+ JScrollPane scrollPane = new JScrollPane();
+ this.add(scrollPane, BorderLayout.CENTER);
+ {
+ tree = new JTree(AiravataTreeNodeFactory.getTreeNode(getJCRRegistry() == null ? "No registry specified"
+ : getEngine(), null));
+ tree.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_F5) {
+ triggerNodeAction(RefreshAction.ID);
+ }
+ }
+ });
+ tree.setCellRenderer(new RegistryTreeCellRenderer());
+ scrollPane.setViewportView(tree);
+
+ popupMenu = new JPopupMenu();
+ popupMenu.setLabel("");
+ addPopup(tree, popupMenu);
+
+ AbstractBrowserActionItem actionRefresh = new RefreshAction();
+ actionRefresh.getMenuItem().setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
+ actionRefresh.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ triggerNodeAction(RefreshAction.ID);
+ }
+ });
+
+ actionDelete = new DeleteAction();
+ actionDelete.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ triggerNodeAction(DeleteAction.ID);
+ }
+ });
+ AddAction actionAdd = new AddAction();
+ actionAdd.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ triggerNodeAction(AddAction.ID);
+ }
+ });
+
+ EditAction actionEdit = new EditAction();
+ actionEdit.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ triggerNodeAction(EditAction.ID);
+ }
+ });
+ ImportAction actionImport = new ImportAction();
+ actionImport.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ triggerNodeAction(ImportAction.ID);
+ }
+ });
+ CopyAction actionCopy = new CopyAction();
+ actionCopy.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ triggerNodeAction(CopyAction.ID);
+ }
+ });
+ ViewAction actionView = new ViewAction();
+ actionView.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ triggerNodeAction(ViewAction.ID);
+ }
+ });
+ BrowserAction actionBrowser = new BrowserAction();
+ actionBrowser.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ triggerNodeAction(BrowserAction.ID);
+ }
+ });
+
+ tree.addMouseListener(new MouseAdapter(){
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ if (e.getClickCount() == 2){
+ triggerNodeAction(null);
+ }
+ }
+ });
+ browserActions.add(actionAdd);
+ browserActions.add(actionView);
+ browserActions.add(actionImport);
+ browserActions.add(actionEdit);
+ browserActions.add(actionRefresh);
+ browserActions.add(actionDelete);
+ browserActions.add(actionCopy);
+ browserActions.add(actionBrowser);
+
+// popupMenu.add(actionAdd.getMenuItem());
+// popupMenu.add(actionDelete.getMenuItem());
+// popupMenu.add(actionRefresh.getMenuItem());
+ }
+ }
+ }
+
+ public void close() {
+ setVisible(false);
+ }
+
+ public void open() {
+ setVisible(true);
+ }
+
+ public XBayaEngine getEngine() {
+ return engine;
+ }
+
+ public void setEngine(XBayaEngine engine) {
+ if (this.engine != null) {
+ this.engine.getConfiguration().deleteObserver(this);
+ }
+ this.engine = engine;
+ if (this.engine != null) {
+ this.engine.getConfiguration().addObserver(this);
+ }
+ }
+
+ private AiravataAPI getJCRRegistry() {
+ try {
+ return getEngine().getConfiguration().getAiravataAPI();
+ } catch (Exception e) {
+ // JCR registry not specified yet
+ return null;
+ }
+ }
+
+ public void update(Observable observable, Object o) {
+ if (getEngine().getConfiguration() == observable) {
+ if (o instanceof JCRComponentRegistry) {
+ resetModel();
+ } else if (o instanceof AiravataAPI) {
+ resetModel();
+ }
+ }
+ }
+
+ private void resetModel() {
+ tree.setModel(new DefaultTreeModel(AiravataTreeNodeFactory.getTreeNode(
+ getJCRRegistry() == null ? "No registry specified" : getEngine(), null)));
+ }
+
+ private void addPopup(Component component, final JPopupMenu popup) {
+ component.addMouseListener(new MouseAdapter() {
+ public void mousePressed(MouseEvent e) {
+ if (e.isPopupTrigger()) {
+ showMenu(e);
+ }
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ if (e.isPopupTrigger()) {
+ showMenu(e);
+ }
+ }
+
+ private void showMenu(MouseEvent e) {
+ int selRow = tree.getRowForLocation(e.getX(), e.getY());
+ if (selRow != -1 && e.isPopupTrigger()) {
+ tree.setSelectionRow(selRow);
+ Object o = tree.getLastSelectedPathComponent();
+ popup.removeAll();
+ if (o instanceof AbstractAiravataTreeNode) {
+ AbstractAiravataTreeNode node = ((AbstractAiravataTreeNode) o);
+ for (AbstractBrowserActionItem action : browserActions) {
+ boolean actionSupported = node.isActionSupported(action);
+ action.setVisible(actionSupported);
+ if (actionSupported) {
+ action.setCaption(node.getActionCaption(action));
+ action.setIcon(node.getActionIcon(action));
+ action.setDescription(node.getActionDescription(action));
+ popup.add(action.getMenuItem());
+ }
+ }
+ }
+
+ if (popup.getSubElements().length>0) {
+ popup.show(e.getComponent(), e.getX(), e.getY());
+ }
+ }
+ }
+ });
+ }
+
+ private void triggerNodeAction(String action) {
+ Object o = tree.getLastSelectedPathComponent();
+ if (o instanceof AbstractAiravataTreeNode) {
+ AbstractAiravataTreeNode node = ((AbstractAiravataTreeNode) o);
+ try {
+ if (action==null){
+ action=node.getDefaultAction();
+ }
+ if (action!=null) {
+ node.triggerAction(tree, action);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ getEngine().getGUI().getErrorWindow().error(e);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/MonitorPanel.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/MonitorPanel.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/MonitorPanel.java
new file mode 100644
index 0000000..33adeef
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/MonitorPanel.java
@@ -0,0 +1,307 @@
+/*
+ *
+ * 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.views;
+
+import java.awt.BorderLayout;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Iterator;
+
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSlider;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+import javax.swing.event.MouseInputAdapter;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+
+import org.apache.airavata.common.utils.BrowserLauncher;
+import org.apache.airavata.common.utils.SwingUtil;
+import org.apache.airavata.ws.monitor.Monitor;
+import org.apache.airavata.ws.monitor.EventDataRepository;
+import org.apache.airavata.ws.monitor.MonitorUtil;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.monitor.MonitorWindow;
+import org.apache.airavata.xbaya.ui.monitor.MonitorEventHandler;
+import org.apache.airavata.xbaya.ui.widgets.XBayaComponent;
+import org.xmlpull.infoset.XmlElement;
+
+public class MonitorPanel implements XBayaComponent, TableModelListener {
+
+ /**
+ * The title.
+ */
+ public static final String TITLE = "Monitoring";
+
+ private XBayaGUI xbayaGUI;
+
+ private EventDataRepository tableSliderModel;
+
+ private JTable table;
+
+ private JScrollPane scrollPane;
+
+ private JSlider slider;
+
+ private JPanel panel;
+
+ /**
+ *
+ * Constructs a MonitorPanel.
+ *
+ * @param engine
+ */
+ public MonitorPanel(XBayaGUI xbayaGUI, Monitor monitor) {
+ this(xbayaGUI, null, monitor);
+ }
+
+ /**
+ * Constructs a NotificationPane.
+ *
+ * @param engine
+ * The XBayaEngine.
+ */
+ public MonitorPanel(XBayaGUI xbayaGUI, String nodeID, Monitor monitor) {
+ this.xbayaGUI=xbayaGUI;
+ if (null == nodeID) {
+ this.tableSliderModel = monitor.getEventDataRepository();
+ } else {
+ this.tableSliderModel = monitor.getEventData(nodeID);
+ }
+ init();
+ this.tableSliderModel.addTableModelListener(this);
+
+ // Also create a handler to change colors of graphs here.
+ MonitorEventHandler eventHandler = new MonitorEventHandler(this.xbayaGUI);
+ this.tableSliderModel.addChangeListener(eventHandler);
+ }
+
+ /**
+ * Returns the scroll pane.
+ *
+ * @return The scroll pane
+ */
+ public JPanel getSwingComponent() {
+ return this.panel;
+ }
+
+ /**
+ * @see javax.swing.event.TableModelListener#tableChanged(javax.swing.event.TableModelEvent)
+ */
+ public void tableChanged(final TableModelEvent event) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ tableChangedInSwingThread(event);
+ }
+ });
+
+ }
+
+ private void tableChangedInSwingThread(TableModelEvent event) {
+ // logger.entering(event);
+ // logger.entering("firstRow: " + event.getFirstRow());
+ // logger.entering("lastRow: " + event.getLastRow());
+ int type = event.getType();
+ if (type == TableModelEvent.INSERT) {
+ int firstRow = event.getFirstRow();
+
+ // check if we need to scroll down the scroll bar.
+ boolean move = false;
+
+ Rectangle visibleRect = this.table.getVisibleRect();
+ // logger.info("visibleRect: " + visibleRect);
+ Rectangle bottomCellRect = this.table.getCellRect(firstRow - 1, 0, true);
+ // logger.info("bottomCellRect: " + bottomCellRect);
+ move = bottomCellRect.intersects(visibleRect);
+ // logger.info("move: " + move);
+
+ if (move) {
+ // When the scroll bar is at the bottom and the slider is at the
+ // right, scroll down.
+ // If the slider is not at the right, this method won't be
+ // called.
+ Rectangle newBottomCellRect = this.table.getCellRect(this.table.getRowCount() - 1, 0, true);
+ // logger.info("cellRect: " + newBottomCellRect);
+ this.table.scrollRectToVisible(newBottomCellRect);
+ }
+
+ // Sometimes, it fails to reprint without this.
+ this.scrollPane.repaint();
+
+ } else if (type == TableModelEvent.DELETE) {
+ // Nothing
+ } else {
+ // No other cases.
+ }
+
+ int size = this.tableSliderModel.getEventSize();
+ boolean empty = (size == 0);
+ this.slider.setEnabled(!empty);
+ }
+
+ private void init() {
+ this.table = new JTable(this.tableSliderModel) {
+ @Override
+ public String getToolTipText(MouseEvent event) {
+ String tip = null;
+ Point point = event.getPoint();
+ int colIndex = columnAtPoint(point);
+ if (colIndex == EventDataRepository.Column.MESSAGE.ordinal()) {
+ tip = "Double click here to see the full message.";
+ }
+ return tip;
+ }
+ };
+
+ this.table.getTableHeader().setReorderingAllowed(false);
+
+ this.table.addMouseListener(new MouseInputAdapter() {
+ private MonitorWindow window;
+
+ @Override
+ public void mouseClicked(MouseEvent event) {
+ Point point = event.getPoint();
+ int row = MonitorPanel.this.table.rowAtPoint(point);
+ if (row >= 0 && row < MonitorPanel.this.table.getRowCount()) {
+ XmlElement message = MonitorPanel.this.tableSliderModel.getEvent(row).getEvent();
+
+ int clickCount = event.getClickCount();
+ if (clickCount == 1) {
+ if (MonitorUtil.getType(message) == MonitorUtil.EventType.PUBLISH_URL) {
+ int column = MonitorPanel.this.table.columnAtPoint(point);
+ if (column == EventDataRepository.Column.MESSAGE.ordinal()) {
+ String url = MonitorUtil.getLocation(message);
+ try {
+ BrowserLauncher.openURL(url);
+ } catch (Exception e) {
+ MonitorPanel.this.xbayaGUI.getErrorWindow().error(e.getMessage(), e);
+ }
+ }
+ } else if (MonitorUtil.getType(message) == MonitorUtil.EventType.SENDING_RESULT) {
+ if (null != message && null != message.element("result")
+ && null != message.element("result").element("body")
+ && null != message.element("result").element("body").element("Body")) {
+ XmlElement body = message.element("result").element("body").element("Body");
+ Iterator bodyItr = body.children().iterator();
+ // find the first body Element
+ findAndLaunchBrowser(bodyItr);
+ // XmlElement output = message.element("result").element("body").
+ // element("Body").element("Visualize_OutputParams").element("Visualized_Output");
+ // Iterator children = output.children().iterator();
+ // while (children.hasNext()) {
+ // Object object = (Object) children.next();
+ // if(object instanceof String){
+ // try {
+ // new URL(((String)object).trim());
+ // try {
+ // BrowserLauncher.openURL(((String)object).trim());
+ // } catch (Throwable e) {
+ // //do nothing
+ // }
+ // } catch (MalformedURLException e) {
+ // //do nothing
+ // }
+ // }
+ //
+ // }
+ }
+ }
+ } else if (clickCount >= 2) {
+ // Handle double clicks to pop up a window.
+ if (this.window == null) {
+ this.window = new MonitorWindow(MonitorPanel.this.xbayaGUI);
+ }
+ this.window.show(message);
+ }
+ }
+ }
+
+ /**
+ * @param bodyItr
+ */
+ private void findAndLaunchBrowser(Iterator bodyItr) {
+ if (bodyItr.hasNext()) {
+ Object firstElement = bodyItr.next();
+ if (firstElement instanceof XmlElement) {
+ findAndLuanchBrowser((XmlElement) firstElement);
+ }
+ }
+ }
+
+ /**
+ * @param firstElement
+ */
+ private void findAndLuanchBrowser(XmlElement firstElement) {
+ Iterator children = ((XmlElement) firstElement).children().iterator();
+ while (children.hasNext()) {
+ Object object = (Object) children.next();
+ if (object instanceof String) {
+ try {
+ new URL(((String) object).trim());
+ try {
+ BrowserLauncher.openURL(((String) object).trim());
+ } catch (Throwable e) {
+ // do nothing
+ }
+ } catch (MalformedURLException e) {
+ // do nothing
+ }
+ } else if (object instanceof XmlElement) {
+ findAndLuanchBrowser((XmlElement) object);
+ }
+ }
+ }
+ });
+
+ // Adjust size of columns
+ TableColumnModel columnModel = this.table.getColumnModel();
+ int columnCount = columnModel.getColumnCount();
+ for (int i = 0; i < columnCount; i++) {
+ TableColumn column = columnModel.getColumn(i);
+ if (i == columnCount - 1) {
+ column.setPreferredWidth(500);
+ } else {
+ column.setPreferredWidth(50);
+ }
+ }
+ this.table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
+
+ this.scrollPane = new JScrollPane(this.table);
+ this.scrollPane.setMinimumSize(SwingUtil.MINIMUM_SIZE);
+ this.scrollPane.setDoubleBuffered(true);
+
+ this.slider = new JSlider(this.tableSliderModel);
+ this.slider.setSnapToTicks(true);
+ this.slider.setEnabled(false);
+
+ this.panel = new JPanel();
+ this.panel.setLayout(new BorderLayout());
+ this.panel.add(this.scrollPane, BorderLayout.CENTER);
+ this.panel.add(this.slider, BorderLayout.SOUTH);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/ParameterPropertyPanel.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/ParameterPropertyPanel.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/ParameterPropertyPanel.java
new file mode 100644
index 0000000..d11887b
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/ParameterPropertyPanel.java
@@ -0,0 +1,194 @@
+/*
+ *
+ * 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.views;
+
+import java.awt.event.ActionEvent;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.border.TitledBorder;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import org.apache.airavata.common.utils.WSConstants;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.graph.system.ParameterNode;
+import org.apache.airavata.xbaya.core.workflow.ParameterListModel;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaComponent;
+import org.apache.airavata.xbaya.ui.widgets.XBayaList;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextArea;
+import org.xmlpull.infoset.XmlElement;
+
+public class ParameterPropertyPanel implements XBayaComponent {
+
+ private String title;
+
+ private XBayaList parameterList;
+
+ private ParameterListModel listModel;
+
+ private GridPanel panel;
+
+ private XBayaTextArea metadataTextArea;
+
+ private JButton upButton;
+
+ private JButton downButton;
+
+ /**
+ * Constructs a ParameterReorderingPanel.
+ *
+ * @param title
+ */
+ public ParameterPropertyPanel(String title) {
+ this.title = title;
+ initGUI();
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.widgets.XBayaComponent#getSwingComponent()
+ */
+ public JComponent getSwingComponent() {
+ return getPanel().getSwingComponent();
+ }
+
+ /**
+ * @return The Swing Panel.
+ */
+ public GridPanel getPanel() {
+ return this.panel;
+ }
+
+ /**
+ * @param parameterNodes
+ * @param nodes
+ */
+ public void setParameterNodes(List<? extends ParameterNode> parameterNodes) {
+ this.listModel = new ParameterListModel(parameterNodes);
+ this.parameterList.getList().setModel(this.listModel);
+ }
+
+ /**
+ * @param metadata
+ */
+ public void setMetadata(XmlElement metadata) {
+ String metadataText;
+ if (metadata == null) {
+ metadataText = WSConstants.EMPTY_APPINFO;
+ } else {
+ metadataText = XMLUtil.xmlElementToString(metadata);
+ }
+ this.metadataTextArea.setText(metadataText);
+ }
+
+ /**
+ * @return The metadata.
+ */
+ public String getMetadata() {
+ return this.metadataTextArea.getText();
+ }
+
+ private void up() {
+ int index = this.parameterList.getSelectedIndex();
+ this.parameterList.setSelectedIndex(index - 1);
+ this.listModel.up(index);
+ }
+
+ private void down() {
+ int index = this.parameterList.getSelectedIndex();
+ this.parameterList.setSelectedIndex(index + 1);
+ this.listModel.down(index);
+ }
+
+ private void selectionChanged() {
+ int index = this.parameterList.getSelectedIndex();
+ if (index < 0) {
+ // Nothing is selected.
+ this.upButton.setEnabled(false);
+ this.downButton.setEnabled(false);
+ } else {
+ if (index == 0) {
+ this.upButton.setEnabled(false);
+ } else {
+ this.upButton.setEnabled(true);
+ }
+ if (index == this.listModel.getSize() - 1) {
+ this.downButton.setEnabled(false);
+ } else {
+ this.downButton.setEnabled(true);
+ }
+ }
+ }
+
+ private void initGUI() {
+ this.parameterList = new XBayaList();
+ this.parameterList.addListSelectionListener(new ListSelectionListener() {
+ public void valueChanged(ListSelectionEvent event) {
+ selectionChanged();
+ }
+ });
+
+ this.upButton = new JButton("UP");
+ this.upButton.setEnabled(false);
+ this.upButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ up();
+ }
+ });
+
+ this.downButton = new JButton("DOWN");
+ this.downButton.setEnabled(false);
+ this.downButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ down();
+ }
+ });
+
+ GridPanel buttonPanel = new GridPanel();
+ buttonPanel.add(this.upButton);
+ buttonPanel.add(this.downButton);
+ buttonPanel.layout(2, 1, GridPanel.WEIGHT_NONE, 0);
+
+ GridPanel reorderingPanel = new GridPanel();
+ reorderingPanel.add(this.parameterList);
+ reorderingPanel.add(buttonPanel);
+ reorderingPanel.layout(1, 2, 0, 0);
+
+ this.metadataTextArea = new XBayaTextArea();
+ JLabel metadataLabel = new JLabel("Metadata");
+ metadataLabel.setLabelFor(this.metadataTextArea.getSwingComponent());
+
+ this.panel = new GridPanel();
+ this.panel.add(reorderingPanel);
+ this.panel.add(metadataLabel);
+ this.panel.add(this.metadataTextArea);
+ this.panel.layout(3, 1, 2, 0);
+
+ TitledBorder border = BorderFactory.createTitledBorder(this.title);
+ this.panel.getSwingComponent().setBorder(border);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/PortViewer.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/PortViewer.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/PortViewer.java
new file mode 100644
index 0000000..4c2ba02
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/views/PortViewer.java
@@ -0,0 +1,167 @@
+/*
+ *
+ * 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.views;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GridLayout;
+
+import javax.swing.JComponent;
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.border.EtchedBorder;
+import javax.swing.border.TitledBorder;
+
+import org.apache.airavata.common.utils.SwingUtil;
+import org.apache.airavata.workflow.model.graph.DataPort;
+import org.apache.airavata.workflow.model.graph.Port;
+import org.apache.airavata.xbaya.ui.graph.GraphCanvas;
+import org.apache.airavata.xbaya.ui.graph.GraphCanvasEvent;
+import org.apache.airavata.xbaya.ui.graph.GraphCanvasListener;
+import org.apache.airavata.xbaya.ui.graph.GraphCanvasEvent.GraphCanvasEventType;
+
+import xsul5.XmlConstants;
+
+public class PortViewer implements GraphCanvasListener {
+
+ /**
+ * The title.
+ */
+ public static final String TITLE = "Parameters";
+
+ private JPanel panel;
+
+ private JEditorPane outputEditor;
+
+ private JEditorPane inputEditor;
+
+ /**
+ * Creates a PortInformation
+ */
+ public PortViewer() {
+ this.panel = new JPanel();
+ this.panel.setMinimumSize(SwingUtil.MINIMUM_SIZE);
+ this.panel.setPreferredSize(new Dimension(0, 150));
+
+ JPanel inBox = new JPanel(new BorderLayout());
+ inBox.setBorder(new TitledBorder(new EtchedBorder(), "Input Parameter"));
+ this.inputEditor = createEditorPane();
+ JScrollPane inputScrollPane = new JScrollPane(this.inputEditor);
+ inputScrollPane.setMinimumSize(SwingUtil.MINIMUM_SIZE);
+ inBox.add(inputScrollPane, BorderLayout.CENTER);
+ inBox.setMinimumSize(SwingUtil.MINIMUM_SIZE);
+
+ JPanel outBox = new JPanel(new BorderLayout());
+ outBox.setBorder(new TitledBorder(new EtchedBorder(), "Output Parameter"));
+ this.outputEditor = createEditorPane();
+ JScrollPane outScrollPane = new JScrollPane(this.outputEditor);
+ outScrollPane.setMinimumSize(SwingUtil.MINIMUM_SIZE);
+ outBox.add(outScrollPane, BorderLayout.CENTER);
+ outBox.setMinimumSize(SwingUtil.MINIMUM_SIZE);
+
+ this.panel.setLayout(new GridLayout(1, 2));
+ this.panel.add(outBox);
+ this.panel.add(inBox);
+ }
+
+ /**
+ * @return The panel
+ */
+ public JComponent getSwingComponent() {
+ return this.panel;
+ }
+
+ /**
+ * @param port
+ */
+ public void setOutputPort(Port port) {
+ showPortInfo(this.outputEditor, port);
+ }
+
+ /**
+ * @param port
+ */
+ public void setInputPort(Port port) {
+ showPortInfo(this.inputEditor, port);
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.GraphCanvasListener#graphCanvasChanged(org.apache.airavata.xbaya.ui.graph.GraphCanvasEvent)
+ */
+ public void graphCanvasChanged(GraphCanvasEvent event) {
+ GraphCanvasEventType type = event.getType();
+ GraphCanvas graphCanvas = event.getGraphCanvas();
+ switch (type) {
+ case INPUT_PORT_SELECTED:
+ Port inputPort = graphCanvas.getSelectedInputPort();
+ setInputPort(inputPort);
+ break;
+ case OUTPUT_PORT_SELECTED:
+ Port outputPort = graphCanvas.getSelectedOutputPort();
+ setOutputPort(outputPort);
+ break;
+ case GRAPH_LOADED:
+ case NAME_CHANGED:
+ case NODE_SELECTED:
+ // do nothing
+ }
+ }
+
+ /**
+ * Shows the information of a selected port on the list specified.
+ *
+ * @param editor
+ * @param port
+ */
+ private void showPortInfo(JEditorPane editor, Port port) {
+ if (port == null) {
+ editor.setText("");
+ } else {
+ // TODO dispatch to each port?.
+ StringBuilder buf = new StringBuilder();
+ buf.append("<strong>Component: " + port.getNode().getName() + "</strong><br>");
+ buf.append("<strong>Port: " + port.getName() + "<br></strong>");
+ if (port instanceof DataPort) {
+ buf.append("<strong>Type</strong>: " + ((DataPort) port).getType() + "<br>");
+ } else {
+ // TODO
+ }
+ buf.append("<strong>Description</strong>: " + port.getComponentPort().getDescription() + "<br>");
+ editor.setText(buf.toString());
+
+ // To prevent from scrolling down to the bottom.
+ editor.setCaretPosition(0);
+ }
+ }
+
+ private JEditorPane createEditorPane() {
+ JEditorPane editorPane = new JEditorPane();
+ editorPane.setMinimumSize(SwingUtil.MINIMUM_SIZE);
+ editorPane.setEditable(false);
+ editorPane.setBackground(Color.WHITE);
+ editorPane.setContentType(XmlConstants.CONTENT_TYPE_HTML);
+ return editorPane;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/GridPanel.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/GridPanel.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/GridPanel.java
new file mode 100644
index 0000000..026980b
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/GridPanel.java
@@ -0,0 +1,165 @@
+/*
+ *
+ * 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.util.List;
+
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+import org.apache.airavata.common.utils.SwingUtil;
+
+public class GridPanel implements XBayaComponent {
+
+ /**
+ * Wight none of rows or eolumns. Used by layout().
+ */
+ public final static int WEIGHT_NONE = SwingUtil.WEIGHT_NONE;
+
+ /**
+ * Weight all rows or columns equally. Used by layout().
+ */
+ public final static int WEIGHT_EQUALLY = SwingUtil.WEIGHT_EQUALLY;
+
+ private JPanel contentPanel;
+
+ private JComponent rootComponent;
+
+ private boolean scroll=false;
+
+ /**
+ * Constructs a GridPanel.
+ */
+ public GridPanel() {
+ this(false);
+ }
+
+ /**
+ * Constructs a GridPanel.
+ *
+ * @param scroll
+ * true if scroll is needed; false otherwise.
+ */
+ public GridPanel(boolean scroll) {
+ init(scroll);
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.widgets.XBayaComponent#getSwingComponent()
+ */
+ public JComponent getSwingComponent() {
+ return this.rootComponent;
+ }
+
+ /**
+ * @return The panel.
+ */
+ public JPanel getContentPanel() {
+ return this.contentPanel;
+ }
+
+ /**
+ * @param component
+ */
+ public void add(XBayaComponent component) {
+ add(component.getSwingComponent());
+ }
+
+ /**
+ * @param component
+ * @param index
+ */
+ public void add(XBayaComponent component, int index) {
+ add(component.getSwingComponent(), index);
+ }
+
+ /**
+ * @param component
+ */
+ public void add(JComponent component) {
+ this.contentPanel.add(component);
+ }
+
+ /**
+ * @param component
+ * @param index
+ */
+ public void add(JComponent component, int index) {
+ this.contentPanel.add(component, index);
+ }
+
+ /**
+ * @param index
+ */
+ public void remove(int index) {
+ this.contentPanel.remove(index);
+ }
+
+ /**
+ * Layouts the child components of a specified parent component using GridBagLayout.
+ *
+ * @param numRow
+ * The number of rows
+ * @param numColumn
+ * The number of columns
+ * @param weightedRow
+ * The row to weight
+ * @param weightedColumn
+ * The column to weight
+ */
+ public void layout(int numRow, int numColumn, int weightedRow, int weightedColumn) {
+ SwingUtil.layoutToGrid(this.contentPanel, numRow, numColumn, weightedRow, weightedColumn);
+ }
+
+ /**
+ * @param rowWeights
+ * @param columnWeights
+ */
+ public void layout(double[] rowWeights, double[] columnWeights) {
+ SwingUtil.layoutToGrid(this.contentPanel, rowWeights, columnWeights);
+ }
+
+ /**
+ * @param rowWeights
+ * @param columnWeights
+ */
+ public void layout(List<Double> rowWeights, List<Double> columnWeights) {
+ SwingUtil.layoutToGrid(this.contentPanel, rowWeights, columnWeights);
+ }
+
+ private void init(boolean scroll) {
+ this.contentPanel = new JPanel();
+ if (scroll) {
+ this.contentPanel.setOpaque(true);
+ JScrollPane scrollPane = new JScrollPane(this.contentPanel);
+ this.rootComponent = scrollPane;
+ } else {
+ this.rootComponent = this.contentPanel;
+ }
+ this.scroll=scroll;
+ }
+
+ public void resetPanel(){
+ init(scroll);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/ScrollPanel.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/ScrollPanel.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/ScrollPanel.java
new file mode 100644
index 0000000..a566f6c
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/ScrollPanel.java
@@ -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.awt.BorderLayout;
+import java.awt.Dimension;
+
+import javax.swing.BorderFactory;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.border.Border;
+
+import org.apache.airavata.common.utils.SwingUtil;
+
+public class ScrollPanel implements XBayaComponent {
+
+ private JPanel panel;
+
+ private JComponent component;
+
+ /**
+ * Creates a ScrollPanel.
+ *
+ * @param component
+ * @param title
+ */
+ public ScrollPanel(XBayaComponent component, String title) {
+ this(component.getSwingComponent(), title);
+ }
+
+ /**
+ * Creates a ScrollPanel.
+ *
+ * @param component
+ * @param title
+ */
+ public ScrollPanel(JComponent component, String title) {
+ this(component, title, true);
+ }
+
+ /**
+ * Creates a ScrollPanel.
+ *
+ * @param component
+ * @param title
+ * @param scroll
+ */
+ public ScrollPanel(XBayaComponent component, String title, boolean scroll) {
+ this(component.getSwingComponent(), title, scroll);
+ }
+
+ /**
+ * Creates a ScrollPanel.
+ *
+ * @param component
+ * @param title
+ * @param scroll
+ */
+ public ScrollPanel(JComponent component, String title, boolean scroll) {
+ this.component = component;
+ init(component, title, scroll);
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.widgets.XBayaComponent#getSwingComponent()
+ */
+ public JPanel getSwingComponent() {
+ return getPanel();
+ }
+
+ /**
+ * @return The panel.
+ */
+ public JPanel getPanel() {
+ return this.panel;
+ }
+
+ /**
+ * @param preferredSize
+ */
+ public void setPrefferedSize(Dimension preferredSize) {
+ this.component.setPreferredSize(preferredSize);
+ }
+
+ private void init(JComponent comp, String title, boolean scroll) {
+ this.panel = new JPanel();
+ this.panel.setLayout(new BorderLayout());
+
+ JLabel titleLabel = new JLabel(title);
+ Border border = BorderFactory.createEtchedBorder();
+ titleLabel.setBorder(border);
+ this.panel.add(titleLabel, BorderLayout.NORTH);
+
+ if (scroll) {
+ JScrollPane scrollPane = new JScrollPane(comp);
+ scrollPane.setMinimumSize(SwingUtil.MINIMUM_SIZE);
+ this.panel.add(scrollPane, BorderLayout.CENTER);
+ } else {
+ comp.setMinimumSize(SwingUtil.MINIMUM_SIZE);
+ this.panel.add(comp, BorderLayout.CENTER);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/TabLabelButton.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/TabLabelButton.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/TabLabelButton.java
new file mode 100644
index 0000000..7531b38
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/TabLabelButton.java
@@ -0,0 +1,142 @@
+/*
+ *
+ * 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.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.plaf.basic.BasicButtonUI;
+
+public class TabLabelButton extends JPanel implements ActionListener{
+
+ private static final long serialVersionUID = 1L;
+
+ private JTabbedPane tabPanel;
+
+ private ActionListener closeButtonListener;
+
+
+ public TabLabelButton(final JTabbedPane pane, String closeButtonTip) {
+ super();
+ setTabPanel(pane);
+ FlowLayout layout = new FlowLayout(FlowLayout.LEFT);
+ layout.setAlignment(FlowLayout.LEFT);
+ layout.setVgap(0);
+ layout.setHgap(0);
+ setLayout(layout);
+ setOpaque(false);
+ JLabel label = new JLabel() {
+ String previousText=null;
+ private static final long serialVersionUID = 1L;
+
+ public String getText() {
+ int i = pane.indexOfTabComponent(TabLabelButton.this);
+ if (i != -1) {
+ if (!pane.getTitleAt(i).equals(previousText)){
+ previousText=pane.getTitleAt(i);
+ TabLabelButton.this.updateUI();
+ }
+ return previousText;
+ }
+ return null;
+ }
+ };
+
+ add(label);
+ label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
+ final JButton button = new JButton(){
+ private static final long serialVersionUID = 1L;
+ protected void paintComponent(Graphics g) {
+ super.paintComponent(g);
+ //Only if the selected tab is this tab we draw the close
+ if (pane.indexOfTabComponent(TabLabelButton.this)==pane.getSelectedIndex()){
+ Graphics2D drawer = (Graphics2D) g.create();
+ if (getModel().isPressed()) {
+ drawer.translate(1, 1);
+ }
+ drawer.setStroke(new BasicStroke(2));
+ drawer.setColor(Color.GRAY);
+ if (getModel().isRollover()) {
+ drawer.setColor(new Color(200,0,0));
+ }
+ setBorderPainted(getModel().isRollover());
+ int delta = 7;
+ int right = (getWidth()-1) - delta;
+ int bottom = (getHeight()-1) - delta;
+ drawer.drawLine(delta, delta, right, bottom);
+ drawer.drawLine(right, delta, delta, bottom);
+ drawer.dispose();
+ }
+ }
+ };
+ button.setPreferredSize(new Dimension(20, 20));
+ button.setToolTipText(closeButtonTip);
+ button.setUI(new BasicButtonUI());
+ button.setContentAreaFilled(false);
+ button.setFocusable(false);
+ button.setBorder(BorderFactory.createLineBorder(Color.GRAY));
+ button.setBorderPainted(false);
+ button.setRolloverEnabled(true);
+ button.addActionListener(this);
+
+ add(button);
+ setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
+ }
+
+ public JTabbedPane getTabPanel() {
+ return tabPanel;
+ }
+
+ public void setTabPanel(JTabbedPane tabPanel) {
+ this.tabPanel = tabPanel;
+ }
+
+ public ActionListener getCloseButtonListener() {
+ return closeButtonListener;
+ }
+
+ public void setCloseButtonListener(ActionListener closeButtonListener) {
+ this.closeButtonListener = closeButtonListener;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ if (getTabPanel().indexOfTabComponent(TabLabelButton.this)==getTabPanel().getSelectedIndex()){
+ if (getCloseButtonListener()!=null){
+ getCloseButtonListener().actionPerformed(event);
+ }
+ }else{
+ getTabPanel().setSelectedIndex(getTabPanel().indexOfTabComponent(TabLabelButton.this));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/TableRenderable.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/TableRenderable.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/TableRenderable.java
new file mode 100644
index 0000000..2a19a1d
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/TableRenderable.java
@@ -0,0 +1,31 @@
+/*
+ *
+ * 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 TableRenderable {
+ public int getColumnCount();
+
+ public String getColumnTitle(int index);
+
+ public Object getValue(int index);
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/ToolbarButton.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/ToolbarButton.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/ToolbarButton.java
new file mode 100644
index 0000000..4a31eae
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/ToolbarButton.java
@@ -0,0 +1,109 @@
+/*
+ *
+ * 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.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+
+import javax.swing.Icon;
+import javax.swing.JButton;
+
+public class ToolbarButton extends JButton implements ActionListener, MouseListener{
+ private ActionListener buttonClickListener;
+ private static final long serialVersionUID = -8266744670729158206L;
+ private boolean showCaption=false;
+ private String caption;
+ private int order;
+
+ public ToolbarButton(Icon icon, String text, String description, int order) {
+ super(icon);
+ setOrder(order);
+ setToolTipText(description);
+ setCaption(text);
+ setBorderPainted(false);
+ setFocusable(false);
+// setBorder(BorderFactory.create);
+ setRolloverEnabled(true);
+ addMouseListener(this);
+ addActionListener(this);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (getButtonClickListener()!=null){
+ getButtonClickListener().actionPerformed(e);
+ }
+ }
+
+ public ActionListener getButtonClickListener() {
+ return buttonClickListener;
+ }
+
+ public void setButtonClickListener(ActionListener buttonClickListener) {
+ this.buttonClickListener = buttonClickListener;
+ }
+
+ public boolean isShowCaption() {
+ return showCaption;
+ }
+
+ public void setShowCaption(boolean showCaption) {
+ this.showCaption = showCaption;
+ }
+
+ public String getCaption() {
+ return caption;
+ }
+
+ public void setCaption(String caption) {
+ this.caption = caption;
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ if (isEnabled()) {
+ setBorderPainted(true);
+ }
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ setBorderPainted(false);
+ }
+
+ @Override
+ public void mouseClicked(MouseEvent e) {}
+ @Override
+ public void mousePressed(MouseEvent e) {}
+ @Override
+ public void mouseReleased(MouseEvent e) {}
+
+ public int getOrder() {
+ return order;
+ }
+
+ public void setOrder(int order) {
+ this.order = order;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaComboBox.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaComboBox.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaComboBox.java
new file mode 100644
index 0000000..7f58c6a
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaComboBox.java
@@ -0,0 +1,100 @@
+/*
+ *
+ * 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.ItemListener;
+
+import javax.swing.ComboBoxModel;
+import javax.swing.JComboBox;
+
+public class XBayaComboBox implements XBayaComponent {
+
+ /**
+ * DEFAULT_COLUMNS
+ */
+ public static final int DEFAULT_COLUMNS = 30;
+
+ private JComboBox comboBox;
+
+ /**
+ * Constructs a XBayaTextArea.
+ *
+ * @param model
+ */
+ public XBayaComboBox(ComboBoxModel model) {
+ init(model);
+ }
+
+ /**
+ * @return The swing component.
+ */
+ public JComboBox getSwingComponent() {
+ return getJComboBox();
+ }
+
+ /**
+ * @return The text. It never returns null.
+ */
+ public String getText() {
+ return (String) this.comboBox.getSelectedItem();
+ }
+
+ /**
+ * @param str
+ */
+ public void setSelectedItem(String str) {
+ this.comboBox.setSelectedItem(str);
+ }
+
+ /**
+ * @param model
+ */
+ public void setModel(ComboBoxModel model) {
+ this.comboBox.setModel(model);
+ }
+
+ /**
+ * @return The text field
+ */
+ public JComboBox getJComboBox() {
+ return this.comboBox;
+ }
+
+ /**
+ * @param editable
+ */
+ public void setEditable(boolean editable) {
+ this.comboBox.setEditable(editable);
+ }
+
+ private void init(ComboBoxModel model) {
+ this.comboBox = new JComboBox(model);
+ this.comboBox.setEditable(false);
+ }
+
+ /**
+ * @param listener
+ */
+ public void addItemListener(ItemListener listener) {
+ this.comboBox.addItemListener(listener);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaComponent.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaComponent.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaComponent.java
new file mode 100644
index 0000000..96ec49f
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaComponent.java
@@ -0,0 +1,35 @@
+/*
+ *
+ * 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 javax.swing.JComponent;
+
+public interface XBayaComponent {
+
+ /**
+ * Returns the swing component.
+ *
+ * @return The swing component.
+ */
+ public JComponent getSwingComponent();
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaLabel.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaLabel.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaLabel.java
new file mode 100644
index 0000000..1ebc2c4
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/XBayaLabel.java
@@ -0,0 +1,95 @@
+/*
+ *
+ * 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 javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.SwingConstants;
+
+
+public class XBayaLabel implements XBayaComponent {
+
+ private JLabel label;
+
+ /**
+ * Constructs a XBayaLabel.
+ *
+ * @param text
+ * @param component
+ * The component to be labeled for.
+ */
+ public XBayaLabel(String text, XBayaComponent component) {
+ this(text, component.getSwingComponent());
+ }
+
+ /**
+ * Constructs a XBayaLabel.
+ *
+ * @param text
+ * @param component
+ * The component to be labeled for.
+ */
+ public XBayaLabel(String text, JComponent component) {
+ init();
+ setText(text);
+ setLabelFor(component);
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.widgets.XBayaComponent#getSwingComponent()
+ */
+ public JLabel getSwingComponent() {
+ return getJLabel();
+ }
+
+ /**
+ * @param text
+ */
+ public void setText(String text) {
+ this.label.setText(text + ": ");
+ }
+
+ /**
+ * @return The text field
+ */
+ public JLabel getJLabel() {
+ return this.label;
+ }
+
+ /**
+ * @param component
+ */
+ public void setLabelFor(XBayaComponent component) {
+ setLabelFor(component.getSwingComponent());
+ }
+
+ /**
+ * @param component
+ */
+ public void setLabelFor(JComponent component) {
+ this.label.setLabelFor(component);
+ }
+
+ private void init() {
+ this.label = new JLabel();
+ this.label.setHorizontalAlignment(SwingConstants.TRAILING);
+ }
+}
\ No newline at end of file