You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2011/10/22 21:30:07 UTC
svn commit: r1187758 [13/15] - in /incubator/airavata/trunk: ./
modules/commons/gfac-schema/src/main/java/org/apache/airavata/commons/gfac/type/app/
modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/
modules/commons/registry-a...
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/JCRBrowserPanel.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/JCRBrowserPanel.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/JCRBrowserPanel.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/JCRBrowserPanel.java Sat Oct 22 19:29:52 2011
@@ -33,180 +33,184 @@ import org.apache.airavata.xbaya.registr
import org.apache.airavata.xbaya.registrybrowser.nodes.AiravataTreeNodeFactory;
import org.apache.airavata.xbaya.registrybrowser.nodes.RegistryTreeCellRenderer;
-public class JCRBrowserPanel extends JPanel implements Observer{
- private List<AbstractBrowserActionItem> browserActions=new ArrayList<AbstractBrowserActionItem>();
- /**
+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":getJCRRegistry(),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();
- browserActions.add(actionRefresh);
- actionRefresh.getMenuItem().setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
- actionRefresh.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- triggerNodeAction(RefreshAction.ID);
- }
- });
-
- actionDelete = new DeleteAction();
- browserActions.add(actionDelete);
- actionDelete.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- triggerNodeAction(DeleteAction.ID);
- }
- });
- AddAction actionAdd = new AddAction();
- browserActions.add(actionAdd);
- actionAdd.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- triggerNodeAction(AddAction.ID);
- }
- });
-
- AddAction actionEdit = new AddAction();
- browserActions.add(actionEdit);
- actionEdit.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- triggerNodeAction(EditAction.ID);
- }
- });
-
- 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 Registry getJCRRegistry(){
- try {
- return getEngine().getConfiguration().getJcrComponentRegistry().getRegistry();
- } catch (Exception e) {
- //JCR registry not specified yet
- return null;
- }
- }
-
- @Override
- public void update(Observable observable, Object o) {
- if (getEngine().getConfiguration()==observable){
- if (o instanceof JCRComponentRegistry){
- resetModel();
- } else if (o instanceof Registry){
- resetModel();
- }
- }
- }
-
- private void resetModel() {
- tree.setModel(new DefaultTreeModel(AiravataTreeNodeFactory.getTreeNode(getJCRRegistry()==null?"No registry specified":getJCRRegistry(),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();
- 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.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 {
- node.triggerAction(tree, action);
- } catch (Exception e) {
- e.printStackTrace();
- getEngine().getErrorWindow().error(e);
- }
- }
- }
+ 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"
+ : getJCRRegistry(), 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();
+ browserActions.add(actionRefresh);
+ actionRefresh.getMenuItem().setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
+ actionRefresh.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ triggerNodeAction(RefreshAction.ID);
+ }
+ });
+
+ actionDelete = new DeleteAction();
+ browserActions.add(actionDelete);
+ actionDelete.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ triggerNodeAction(DeleteAction.ID);
+ }
+ });
+ AddAction actionAdd = new AddAction();
+ browserActions.add(actionAdd);
+ actionAdd.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ triggerNodeAction(AddAction.ID);
+ }
+ });
+
+ AddAction actionEdit = new AddAction();
+ browserActions.add(actionEdit);
+ actionEdit.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ triggerNodeAction(EditAction.ID);
+ }
+ });
+
+ 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 Registry getJCRRegistry() {
+ try {
+ return getEngine().getConfiguration().getJcrComponentRegistry().getRegistry();
+ } catch (Exception e) {
+ // JCR registry not specified yet
+ return null;
+ }
+ }
+
+ @Override
+ public void update(Observable observable, Object o) {
+ if (getEngine().getConfiguration() == observable) {
+ if (o instanceof JCRComponentRegistry) {
+ resetModel();
+ } else if (o instanceof Registry) {
+ resetModel();
+ }
+ }
+ }
+
+ private void resetModel() {
+ tree.setModel(new DefaultTreeModel(AiravataTreeNodeFactory.getTreeNode(
+ getJCRRegistry() == null ? "No registry specified" : getJCRRegistry(), 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();
+ 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.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 {
+ node.triggerAction(tree, action);
+ } catch (Exception e) {
+ e.printStackTrace();
+ getEngine().getErrorWindow().error(e);
+ }
+ }
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/AbstractBrowserActionItem.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/AbstractBrowserActionItem.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/AbstractBrowserActionItem.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/AbstractBrowserActionItem.java Sat Oct 22 19:29:52 2011
@@ -5,65 +5,65 @@ import java.awt.event.ActionListener;
import javax.swing.Icon;
import javax.swing.JMenuItem;
-public abstract class AbstractBrowserActionItem{
+public abstract class AbstractBrowserActionItem {
- private String caption;
- private Icon icon;
- private JMenuItem menuItem;
- private String description;
-
- public abstract String getID();
-
- public void setIcon(Icon icon){
- this.icon=icon;
- getMenuItem().setIcon(getIcon());
- }
-
- public Icon getIcon(){
- return icon;
- }
-
- public String getCaption() {
- return caption;
- }
-
- public void setCaption(String caption) {
- this.caption = caption;
- getMenuItem().setText(getCaption());
- }
-
- public JMenuItem getMenuItem(){
- if (menuItem==null){
- menuItem=new JMenuItem(getCaption());
- }
- menuItem.setText(getCaption());
- return menuItem;
- }
-
- public void addActionListener(ActionListener listener){
- getMenuItem().addActionListener(listener);
- }
-
- public void removeActionListener(ActionListener listener){
- getMenuItem().removeActionListener(listener);
- }
-
- public void setVisible(boolean visible){
- getMenuItem().setVisible(visible);
- }
-
- public void setEnabled(boolean enabled){
- getMenuItem().setEnabled(enabled);
- }
-
- public abstract String getDefaultCaption();
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- getMenuItem().setToolTipText(getDescription());
- }
+ private String caption;
+ private Icon icon;
+ private JMenuItem menuItem;
+ private String description;
+
+ public abstract String getID();
+
+ public void setIcon(Icon icon) {
+ this.icon = icon;
+ getMenuItem().setIcon(getIcon());
+ }
+
+ public Icon getIcon() {
+ return icon;
+ }
+
+ public String getCaption() {
+ return caption;
+ }
+
+ public void setCaption(String caption) {
+ this.caption = caption;
+ getMenuItem().setText(getCaption());
+ }
+
+ public JMenuItem getMenuItem() {
+ if (menuItem == null) {
+ menuItem = new JMenuItem(getCaption());
+ }
+ menuItem.setText(getCaption());
+ return menuItem;
+ }
+
+ public void addActionListener(ActionListener listener) {
+ getMenuItem().addActionListener(listener);
+ }
+
+ public void removeActionListener(ActionListener listener) {
+ getMenuItem().removeActionListener(listener);
+ }
+
+ public void setVisible(boolean visible) {
+ getMenuItem().setVisible(visible);
+ }
+
+ public void setEnabled(boolean enabled) {
+ getMenuItem().setEnabled(enabled);
+ }
+
+ public abstract String getDefaultCaption();
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ getMenuItem().setToolTipText(getDescription());
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/AddAction.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/AddAction.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/AddAction.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/AddAction.java Sat Oct 22 19:29:52 2011
@@ -1,20 +1,20 @@
package org.apache.airavata.xbaya.registrybrowser.menu;
public class AddAction extends AbstractBrowserActionItem {
- public static String ID="action.add";
-
- public AddAction() {
- setCaption(getDefaultCaption());
- }
-
- @Override
- public String getID() {
- return ID;
- }
+ public static String ID = "action.add";
- @Override
- public String getDefaultCaption() {
- return "Add";
- }
+ public AddAction() {
+ setCaption(getDefaultCaption());
+ }
+
+ @Override
+ public String getID() {
+ return ID;
+ }
+
+ @Override
+ public String getDefaultCaption() {
+ return "Add";
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/DeleteAction.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/DeleteAction.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/DeleteAction.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/DeleteAction.java Sat Oct 22 19:29:52 2011
@@ -1,16 +1,19 @@
package org.apache.airavata.xbaya.registrybrowser.menu;
public class DeleteAction extends AbstractBrowserActionItem {
- public static String ID="action.delete";
- public DeleteAction() {
- setCaption(getDefaultCaption());
- }
- @Override
- public String getID() {
- return ID;
- }
- @Override
- public String getDefaultCaption() {
- return "Remove";
- }
+ public static String ID = "action.delete";
+
+ public DeleteAction() {
+ setCaption(getDefaultCaption());
+ }
+
+ @Override
+ public String getID() {
+ return ID;
+ }
+
+ @Override
+ public String getDefaultCaption() {
+ return "Remove";
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/EditAction.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/EditAction.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/EditAction.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/EditAction.java Sat Oct 22 19:29:52 2011
@@ -1,16 +1,16 @@
package org.apache.airavata.xbaya.registrybrowser.menu;
public class EditAction extends AbstractBrowserActionItem {
- public static String ID="action.edit";
-
- @Override
- public String getID() {
- return ID;
- }
+ public static String ID = "action.edit";
- @Override
- public String getDefaultCaption() {
- return "Edit";
- }
+ @Override
+ public String getID() {
+ return ID;
+ }
+
+ @Override
+ public String getDefaultCaption() {
+ return "Edit";
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/RefreshAction.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/RefreshAction.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/RefreshAction.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/menu/RefreshAction.java Sat Oct 22 19:29:52 2011
@@ -1,20 +1,20 @@
package org.apache.airavata.xbaya.registrybrowser.menu;
-public class RefreshAction extends AbstractBrowserActionItem{
- public static String ID="action.refresh";
-
- public RefreshAction() {
- setCaption(getDefaultCaption());
- }
+public class RefreshAction extends AbstractBrowserActionItem {
+ public static String ID = "action.refresh";
- @Override
- public String getID() {
- return ID;
- }
+ public RefreshAction() {
+ setCaption(getDefaultCaption());
+ }
- @Override
- public String getDefaultCaption() {
- return "Refresh";
- }
+ @Override
+ public String getID() {
+ return ID;
+ }
+
+ @Override
+ public String getDefaultCaption() {
+ return "Refresh";
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/ApplicationDeploymentDescriptionWrap.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/ApplicationDeploymentDescriptionWrap.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/ApplicationDeploymentDescriptionWrap.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/ApplicationDeploymentDescriptionWrap.java Sat Oct 22 19:29:52 2011
@@ -10,56 +10,56 @@ import org.apache.airavata.registry.api.
import org.apache.airavata.registry.api.exception.ServiceDescriptionRetrieveException;
public class ApplicationDeploymentDescriptionWrap {
- private ApplicationDeploymentDescription applicationDeploymentDescription;
- private String service;
- private String host;
- private Registry registry;
-
- public ApplicationDeploymentDescriptionWrap(Registry registry, ApplicationDeploymentDescription applicationDeploymentDescription, String service, String host){
- setApplicationDeploymentDescription(applicationDeploymentDescription);
- setService(service);
- setHost(host);
- setRegistry(registry);
- }
-
- public ApplicationDeploymentDescription getDescription() {
- return applicationDeploymentDescription;
- }
-
- public void setApplicationDeploymentDescription(
- ApplicationDeploymentDescription applicationDeploymentDescription) {
- this.applicationDeploymentDescription = applicationDeploymentDescription;
- }
-
- public String getService() {
- return service;
- }
-
- public ServiceDescription getServiceDescription() throws PathNotFoundException, ServiceDescriptionRetrieveException{
- return getRegistry().getServiceDescription(getService());
- }
-
- public void setService(String service) {
- this.service = service;
- }
-
- public String getHost() {
- return host;
- }
-
- public HostDescription getHostDescription() throws PathNotFoundException, HostDescriptionRetrieveException{
- return getRegistry().getHostDescription(getHost());
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public Registry getRegistry() {
- return registry;
- }
-
- public void setRegistry(Registry registry) {
- this.registry = registry;
- }
+ private ApplicationDeploymentDescription applicationDeploymentDescription;
+ private String service;
+ private String host;
+ private Registry registry;
+
+ public ApplicationDeploymentDescriptionWrap(Registry registry,
+ ApplicationDeploymentDescription applicationDeploymentDescription, String service, String host) {
+ setApplicationDeploymentDescription(applicationDeploymentDescription);
+ setService(service);
+ setHost(host);
+ setRegistry(registry);
+ }
+
+ public ApplicationDeploymentDescription getDescription() {
+ return applicationDeploymentDescription;
+ }
+
+ public void setApplicationDeploymentDescription(ApplicationDeploymentDescription applicationDeploymentDescription) {
+ this.applicationDeploymentDescription = applicationDeploymentDescription;
+ }
+
+ public String getService() {
+ return service;
+ }
+
+ public ServiceDescription getServiceDescription() throws PathNotFoundException, ServiceDescriptionRetrieveException {
+ return getRegistry().getServiceDescription(getService());
+ }
+
+ public void setService(String service) {
+ this.service = service;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public HostDescription getHostDescription() throws PathNotFoundException, HostDescriptionRetrieveException {
+ return getRegistry().getHostDescription(getHost());
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public Registry getRegistry() {
+ return registry;
+ }
+
+ public void setRegistry(Registry registry) {
+ this.registry = registry;
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/ApplicationDeploymentDescriptions.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/ApplicationDeploymentDescriptions.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/ApplicationDeploymentDescriptions.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/ApplicationDeploymentDescriptions.java Sat Oct 22 19:29:52 2011
@@ -12,31 +12,33 @@ import org.apache.airavata.registry.api.
import org.apache.airavata.registry.api.exception.ServiceDescriptionRetrieveException;
public class ApplicationDeploymentDescriptions {
- private Registry registry;
-
- public ApplicationDeploymentDescriptions(Registry registry){
- setRegistry(registry);
- }
+ private Registry registry;
- public Registry getRegistry() {
- return registry;
- }
+ public ApplicationDeploymentDescriptions(Registry registry) {
+ setRegistry(registry);
+ }
- public void setRegistry(Registry registry) {
- this.registry = registry;
- }
-
- public List<ApplicationDeploymentDescriptionWrap> getDescriptions() throws DeploymentDescriptionRetrieveException{
- List<ApplicationDeploymentDescriptionWrap> list=new ArrayList<ApplicationDeploymentDescriptionWrap>();
- try {
- Map<ApplicationDeploymentDescription, String> deploymentDescriptions = getRegistry().searchDeploymentDescription();
- for (ApplicationDeploymentDescription descriptionWrap : deploymentDescriptions.keySet()) {
- String[] descDetails = deploymentDescriptions.get(descriptionWrap).split("\\$");
- list.add(new ApplicationDeploymentDescriptionWrap(getRegistry(), descriptionWrap, descDetails[0],descDetails[1]));
- }
- } catch (PathNotFoundException e) {
- //has no descriptions defined
- }
- return list;
- }
+ public Registry getRegistry() {
+ return registry;
+ }
+
+ public void setRegistry(Registry registry) {
+ this.registry = registry;
+ }
+
+ public List<ApplicationDeploymentDescriptionWrap> getDescriptions() throws DeploymentDescriptionRetrieveException {
+ List<ApplicationDeploymentDescriptionWrap> list = new ArrayList<ApplicationDeploymentDescriptionWrap>();
+ try {
+ Map<ApplicationDeploymentDescription, String> deploymentDescriptions = getRegistry()
+ .searchDeploymentDescription();
+ for (ApplicationDeploymentDescription descriptionWrap : deploymentDescriptions.keySet()) {
+ String[] descDetails = deploymentDescriptions.get(descriptionWrap).split("\\$");
+ list.add(new ApplicationDeploymentDescriptionWrap(getRegistry(), descriptionWrap, descDetails[0],
+ descDetails[1]));
+ }
+ } catch (PathNotFoundException e) {
+ // has no descriptions defined
+ }
+ return list;
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/GFacURL.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/GFacURL.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/GFacURL.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/GFacURL.java Sat Oct 22 19:29:52 2011
@@ -5,27 +5,27 @@ import java.net.URL;
import org.apache.airavata.registry.api.Registry;
public class GFacURL {
- private Registry registry;
- private URL gfacURL;
-
- public GFacURL(Registry registry, URL gfacURL){
- setRegistry(registry);
- setGfacURL(gfacURL);
- }
-
- public Registry getRegistry() {
- return registry;
- }
-
- public void setRegistry(Registry registry) {
- this.registry = registry;
- }
-
- public URL getGfacURL() {
- return gfacURL;
- }
-
- public void setGfacURL(URL gfacURL) {
- this.gfacURL = gfacURL;
- }
+ private Registry registry;
+ private URL gfacURL;
+
+ public GFacURL(Registry registry, URL gfacURL) {
+ setRegistry(registry);
+ setGfacURL(gfacURL);
+ }
+
+ public Registry getRegistry() {
+ return registry;
+ }
+
+ public void setRegistry(Registry registry) {
+ this.registry = registry;
+ }
+
+ public URL getGfacURL() {
+ return gfacURL;
+ }
+
+ public void setGfacURL(URL gfacURL) {
+ this.gfacURL = gfacURL;
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/GFacURLs.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/GFacURLs.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/GFacURLs.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/GFacURLs.java Sat Oct 22 19:29:52 2011
@@ -8,31 +8,31 @@ import java.util.List;
import org.apache.airavata.registry.api.Registry;
public class GFacURLs {
- private Registry registry;
-
- public GFacURLs(Registry registry){
- setRegistry(registry);
- }
+ private Registry registry;
- public Registry getRegistry() {
- return registry;
- }
+ public GFacURLs(Registry registry) {
+ setRegistry(registry);
+ }
- public void setRegistry(Registry registry) {
- this.registry = registry;
- }
-
- public List<GFacURL> getURLS(){
- List<GFacURL> urls=new ArrayList<GFacURL>();
- List<String> gfacDescriptorList = getRegistry().getGFacDescriptorList();
- for (String urlString : gfacDescriptorList) {
- try {
- urls.add(new GFacURL(getRegistry(),new URL(urlString)));
- } catch (MalformedURLException e) {
- //practically speaking this exception should not be possible. just in case,
- e.printStackTrace();
- }
- }
- return urls;
- }
+ public Registry getRegistry() {
+ return registry;
+ }
+
+ public void setRegistry(Registry registry) {
+ this.registry = registry;
+ }
+
+ public List<GFacURL> getURLS() {
+ List<GFacURL> urls = new ArrayList<GFacURL>();
+ List<String> gfacDescriptorList = getRegistry().getGFacDescriptorList();
+ for (String urlString : gfacDescriptorList) {
+ try {
+ urls.add(new GFacURL(getRegistry(), new URL(urlString)));
+ } catch (MalformedURLException e) {
+ // practically speaking this exception should not be possible. just in case,
+ e.printStackTrace();
+ }
+ }
+ return urls;
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/HostDescriptions.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/HostDescriptions.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/HostDescriptions.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/HostDescriptions.java Sat Oct 22 19:29:52 2011
@@ -10,26 +10,26 @@ import org.apache.airavata.registry.api.
import org.apache.airavata.registry.api.exception.HostDescriptionRetrieveException;
public class HostDescriptions {
- private Registry registry;
-
- public HostDescriptions(Registry registry){
- setRegistry(registry);
- }
+ private Registry registry;
- public Registry getRegistry() {
- return registry;
- }
+ public HostDescriptions(Registry registry) {
+ setRegistry(registry);
+ }
- public void setRegistry(Registry registry) {
- this.registry = registry;
- }
-
- public List<HostDescription> getDescriptions() throws HostDescriptionRetrieveException{
- try {
- return getRegistry().searchHostDescription(".*");
- } catch (PathNotFoundException e) {
- //has no descriptions defined
- return new ArrayList<HostDescription>();
- }
- }
+ public Registry getRegistry() {
+ return registry;
+ }
+
+ public void setRegistry(Registry registry) {
+ this.registry = registry;
+ }
+
+ public List<HostDescription> getDescriptions() throws HostDescriptionRetrieveException {
+ try {
+ return getRegistry().searchHostDescription(".*");
+ } catch (PathNotFoundException e) {
+ // has no descriptions defined
+ return new ArrayList<HostDescription>();
+ }
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/ServiceDescriptions.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/ServiceDescriptions.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/ServiceDescriptions.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/ServiceDescriptions.java Sat Oct 22 19:29:52 2011
@@ -10,26 +10,26 @@ import org.apache.airavata.registry.api.
import org.apache.airavata.registry.api.exception.ServiceDescriptionRetrieveException;
public class ServiceDescriptions {
- private Registry registry;
-
- public ServiceDescriptions(Registry registry){
- setRegistry(registry);
- }
+ private Registry registry;
- public Registry getRegistry() {
- return registry;
- }
+ public ServiceDescriptions(Registry registry) {
+ setRegistry(registry);
+ }
- public void setRegistry(Registry registry) {
- this.registry = registry;
- }
-
- public List<ServiceDescription> getDescriptions() throws ServiceDescriptionRetrieveException{
- try {
- return getRegistry().searchServiceDescription("");
- } catch (PathNotFoundException e) {
- //has no descriptions defined
- return new ArrayList<ServiceDescription>();
- }
- }
+ public Registry getRegistry() {
+ return registry;
+ }
+
+ public void setRegistry(Registry registry) {
+ this.registry = registry;
+ }
+
+ public List<ServiceDescription> getDescriptions() throws ServiceDescriptionRetrieveException {
+ try {
+ return getRegistry().searchServiceDescription("");
+ } catch (PathNotFoundException e) {
+ // has no descriptions defined
+ return new ArrayList<ServiceDescription>();
+ }
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/XBayaWorkflow.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/XBayaWorkflow.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/XBayaWorkflow.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/XBayaWorkflow.java Sat Oct 22 19:29:52 2011
@@ -4,26 +4,26 @@ import javax.jcr.Node;
import javax.jcr.RepositoryException;
public class XBayaWorkflow {
- private Node workflowNode;
-
- public XBayaWorkflow(Node workflowNode) {
- setWorkflowNode(workflowNode);
- }
+ private Node workflowNode;
- public Node getWorkflowNode() {
- return workflowNode;
- }
+ public XBayaWorkflow(Node workflowNode) {
+ setWorkflowNode(workflowNode);
+ }
- public void setWorkflowNode(Node workflowNode) {
- this.workflowNode = workflowNode;
- }
-
- public String getWorkflowName(){
- try {
- return getWorkflowNode().getName();
- } catch (RepositoryException e) {
- e.printStackTrace();
- return null;
- }
- }
+ public Node getWorkflowNode() {
+ return workflowNode;
+ }
+
+ public void setWorkflowNode(Node workflowNode) {
+ this.workflowNode = workflowNode;
+ }
+
+ public String getWorkflowName() {
+ try {
+ return getWorkflowNode().getName();
+ } catch (RepositoryException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/XBayaWorkflows.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/XBayaWorkflows.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/XBayaWorkflows.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/model/XBayaWorkflows.java Sat Oct 22 19:29:52 2011
@@ -10,26 +10,26 @@ import javax.xml.namespace.QName;
import org.apache.airavata.registry.api.Registry;
public class XBayaWorkflows {
- private Registry registry;
-
- public XBayaWorkflows(Registry registry) {
- setRegistry(registry);
- }
+ private Registry registry;
- public Registry getRegistry() {
- return registry;
- }
+ public XBayaWorkflows(Registry registry) {
+ setRegistry(registry);
+ }
- public void setRegistry(Registry registry) {
- this.registry = registry;
- }
-
- public List<XBayaWorkflow> getWorkflows(){
- List<XBayaWorkflow> workflows=new ArrayList<XBayaWorkflow>();
- Map<QName, Node> workflowMap = registry.getWorkflows(registry.getUsername());
- for (Node xBayaWorkflowNode : workflowMap.values()) {
- workflows.add(new XBayaWorkflow(xBayaWorkflowNode));
- }
- return workflows;
- }
+ public Registry getRegistry() {
+ return registry;
+ }
+
+ public void setRegistry(Registry registry) {
+ this.registry = registry;
+ }
+
+ public List<XBayaWorkflow> getWorkflows() {
+ List<XBayaWorkflow> workflows = new ArrayList<XBayaWorkflow>();
+ Map<QName, Node> workflowMap = registry.getWorkflows(registry.getUsername());
+ for (Node xBayaWorkflowNode : workflowMap.values()) {
+ workflows.add(new XBayaWorkflow(xBayaWorkflowNode));
+ }
+ return workflows;
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AbstractAiravataTreeNode.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AbstractAiravataTreeNode.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AbstractAiravataTreeNode.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AbstractAiravataTreeNode.java Sat Oct 22 19:29:52 2011
@@ -22,163 +22,163 @@ import org.apache.airavata.xbaya.registr
public abstract class AbstractAiravataTreeNode implements TreeNode {
- private TreeNode parent;
- private Color backgroundSelectionColor;
- private DefaultTreeCellRenderer defaultCellRenderer = new DefaultTreeCellRenderer();
- private List<TreeNode> children;
-
- public AbstractAiravataTreeNode(TreeNode parent) {
- setParent(parent);
- }
-
- @Override
- public Enumeration children() {
- this.children = listOfChildren();
- Collections.enumeration(children);
- return Collections.enumeration(children);
- }
-
- protected abstract List<TreeNode> getChildren();
-
- private List<TreeNode> listOfChildren(){
- children = (children==null) ? getChildren() : children;
- return children;
- }
-
- @Override
- public boolean getAllowsChildren() {
- return listOfChildren().size()>0;
- }
-
- @Override
- public TreeNode getChildAt(int index) {
- return listOfChildren().get(index);
- }
-
- @Override
- public int getChildCount() {
- return listOfChildren().size();
- }
-
- @Override
- public int getIndex(TreeNode node) {
- return listOfChildren().indexOf(node);
- }
-
- @Override
- public TreeNode getParent() {
- return parent;
- }
-
- @Override
- public boolean isLeaf() {
- return listOfChildren().size()==0;
- }
-
- public void setParent(TreeNode parent) {
- this.parent = parent;
- }
-
- public abstract String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus);
-
- public abstract Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus);
- public void setBackgroundSelectionColor(Color c)
- {
- backgroundSelectionColor = c;
- }
- public Color getBackgroundSelectionColor()
- {
- return backgroundSelectionColor;
- }
-
- public Component getNodeComponent(boolean selected, boolean expanded, boolean leaf, boolean hasFocus){
- return null;
- }
-
- public Component getNodeComponent(JTree tree, Object value,
- boolean selected, boolean expanded, boolean leaf, int row,
- boolean hasFocus) {
- Component nodeComponent = getNodeComponent(selected, expanded, leaf, hasFocus);
- if (nodeComponent==null) {
- nodeComponent=getDefaultCellRenderer().getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
- if (nodeComponent instanceof JLabel) {
- JLabel lbl = (JLabel) nodeComponent;
- lbl.setText(getCaption(selected, expanded, leaf, hasFocus));
- lbl.setIcon(getIcon(selected, expanded, leaf, hasFocus));
- }
- }
- return nodeComponent;
- }
-
- protected DefaultTreeCellRenderer getDefaultCellRenderer() {
- return defaultCellRenderer;
- }
-
- protected List<TreeNode> getTreeNodeList(Object[] list, TreeNode parent){
- List<TreeNode> nodes = new ArrayList<TreeNode>();
- for (Object o : list) {
- nodes.add(AiravataTreeNodeFactory.getTreeNode(o,parent));
- }
- return nodes;
- }
-
- protected List<TreeNode> emptyList(){
- return new ArrayList<TreeNode>();
- }
-
- public void refresh(){
- this.children=null;
- }
-
- public abstract List<String> getSupportedActions();
-
- public boolean isActionSupported(AbstractBrowserActionItem action){
- return getSupportedActions().contains(action.getID());
- }
-
- public boolean triggerAction(JTree tree,String action) throws Exception{
- return triggerAction(tree, action, false);
- }
-
- public boolean triggerAction(JTree tree,String action, boolean force) throws Exception{
- if (action.equals(RefreshAction.ID)){
- refresh();
- ((DefaultTreeModel)tree.getModel()).reload(this);
- return true;
- }
- return false;
- }
-
- protected TreeNode getRootNode(){
- TreeNode rootNode=this;
- while(rootNode.getParent()!=null){
- rootNode=rootNode.getParent();
- }
- return rootNode;
- }
-
- public Registry getRegistry(){
- TreeNode rootNode = getRootNode();
- if (rootNode instanceof RegistryNode){
- return ((RegistryNode)rootNode).getRegistry();
- }
- return null;
- }
-
- protected boolean askQuestion(String title, String question){
- return JOptionPane.showConfirmDialog(null, question, title, JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION;
- }
-
- protected void reloadTreeNode(JTree tree, TreeNode node) {
- TreePath selectionPath = tree.getSelectionPath();
- ((DefaultTreeModel) tree.getModel()).nodeChanged(node);
- ((DefaultTreeModel) tree.getModel()).reload(node);
- tree.expandPath(selectionPath);
- }
-
- public abstract String getActionCaption(AbstractBrowserActionItem action);
-
- public abstract Icon getActionIcon(AbstractBrowserActionItem action);
-
- public abstract String getActionDescription(AbstractBrowserActionItem action);
+ private TreeNode parent;
+ private Color backgroundSelectionColor;
+ private DefaultTreeCellRenderer defaultCellRenderer = new DefaultTreeCellRenderer();
+ private List<TreeNode> children;
+
+ public AbstractAiravataTreeNode(TreeNode parent) {
+ setParent(parent);
+ }
+
+ @Override
+ public Enumeration children() {
+ this.children = listOfChildren();
+ Collections.enumeration(children);
+ return Collections.enumeration(children);
+ }
+
+ protected abstract List<TreeNode> getChildren();
+
+ private List<TreeNode> listOfChildren() {
+ children = (children == null) ? getChildren() : children;
+ return children;
+ }
+
+ @Override
+ public boolean getAllowsChildren() {
+ return listOfChildren().size() > 0;
+ }
+
+ @Override
+ public TreeNode getChildAt(int index) {
+ return listOfChildren().get(index);
+ }
+
+ @Override
+ public int getChildCount() {
+ return listOfChildren().size();
+ }
+
+ @Override
+ public int getIndex(TreeNode node) {
+ return listOfChildren().indexOf(node);
+ }
+
+ @Override
+ public TreeNode getParent() {
+ return parent;
+ }
+
+ @Override
+ public boolean isLeaf() {
+ return listOfChildren().size() == 0;
+ }
+
+ public void setParent(TreeNode parent) {
+ this.parent = parent;
+ }
+
+ public abstract String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus);
+
+ public abstract Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus);
+
+ public void setBackgroundSelectionColor(Color c) {
+ backgroundSelectionColor = c;
+ }
+
+ public Color getBackgroundSelectionColor() {
+ return backgroundSelectionColor;
+ }
+
+ public Component getNodeComponent(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+ return null;
+ }
+
+ public Component getNodeComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf,
+ int row, boolean hasFocus) {
+ Component nodeComponent = getNodeComponent(selected, expanded, leaf, hasFocus);
+ if (nodeComponent == null) {
+ nodeComponent = getDefaultCellRenderer().getTreeCellRendererComponent(tree, value, selected, expanded,
+ leaf, row, hasFocus);
+ if (nodeComponent instanceof JLabel) {
+ JLabel lbl = (JLabel) nodeComponent;
+ lbl.setText(getCaption(selected, expanded, leaf, hasFocus));
+ lbl.setIcon(getIcon(selected, expanded, leaf, hasFocus));
+ }
+ }
+ return nodeComponent;
+ }
+
+ protected DefaultTreeCellRenderer getDefaultCellRenderer() {
+ return defaultCellRenderer;
+ }
+
+ protected List<TreeNode> getTreeNodeList(Object[] list, TreeNode parent) {
+ List<TreeNode> nodes = new ArrayList<TreeNode>();
+ for (Object o : list) {
+ nodes.add(AiravataTreeNodeFactory.getTreeNode(o, parent));
+ }
+ return nodes;
+ }
+
+ protected List<TreeNode> emptyList() {
+ return new ArrayList<TreeNode>();
+ }
+
+ public void refresh() {
+ this.children = null;
+ }
+
+ public abstract List<String> getSupportedActions();
+
+ public boolean isActionSupported(AbstractBrowserActionItem action) {
+ return getSupportedActions().contains(action.getID());
+ }
+
+ public boolean triggerAction(JTree tree, String action) throws Exception {
+ return triggerAction(tree, action, false);
+ }
+
+ public boolean triggerAction(JTree tree, String action, boolean force) throws Exception {
+ if (action.equals(RefreshAction.ID)) {
+ refresh();
+ ((DefaultTreeModel) tree.getModel()).reload(this);
+ return true;
+ }
+ return false;
+ }
+
+ protected TreeNode getRootNode() {
+ TreeNode rootNode = this;
+ while (rootNode.getParent() != null) {
+ rootNode = rootNode.getParent();
+ }
+ return rootNode;
+ }
+
+ public Registry getRegistry() {
+ TreeNode rootNode = getRootNode();
+ if (rootNode instanceof RegistryNode) {
+ return ((RegistryNode) rootNode).getRegistry();
+ }
+ return null;
+ }
+
+ protected boolean askQuestion(String title, String question) {
+ return JOptionPane.showConfirmDialog(null, question, title, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
+ }
+
+ protected void reloadTreeNode(JTree tree, TreeNode node) {
+ TreePath selectionPath = tree.getSelectionPath();
+ ((DefaultTreeModel) tree.getModel()).nodeChanged(node);
+ ((DefaultTreeModel) tree.getModel()).reload(node);
+ tree.expandPath(selectionPath);
+ }
+
+ public abstract String getActionCaption(AbstractBrowserActionItem action);
+
+ public abstract Icon getActionIcon(AbstractBrowserActionItem action);
+
+ public abstract String getActionDescription(AbstractBrowserActionItem action);
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AiravataTreeNodeFactory.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AiravataTreeNodeFactory.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AiravataTreeNodeFactory.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AiravataTreeNodeFactory.java Sat Oct 22 19:29:52 2011
@@ -16,31 +16,31 @@ import org.apache.airavata.xbaya.registr
import org.apache.airavata.xbaya.registrybrowser.model.XBayaWorkflows;
public class AiravataTreeNodeFactory {
- public static TreeNode getTreeNode(Object o,TreeNode parent){
- if (o instanceof Registry){
- return new RegistryNode((Registry)o,parent);
- }else if (o instanceof GFacURLs){
- return new GFacURLsNode((GFacURLs)o,parent);
- }else if (o instanceof GFacURL){
- return new GFacURLNode((GFacURL)o,parent);
- }else if (o instanceof HostDescriptions){
- return new HostDescriptionsNode((HostDescriptions)o,parent);
- }else if (o instanceof HostDescription){
- return new HostDescriptionNode((HostDescription)o,parent);
- }else if (o instanceof ServiceDescriptions){
- return new ServiceDescriptionsNode((ServiceDescriptions)o,parent);
- }else if (o instanceof ServiceDescription){
- return new ServiceDescriptionNode((ServiceDescription)o,parent);
- }else if (o instanceof ApplicationDeploymentDescriptions){
- return new ApplicationDeploymentDescriptionsNode((ApplicationDeploymentDescriptions)o,parent);
- }else if (o instanceof ApplicationDeploymentDescriptionWrap){
- return new ApplicationDeploymentDescriptionNode((ApplicationDeploymentDescriptionWrap)o,parent);
- }else if (o instanceof XBayaWorkflows){
- return new XBayaWorkflowsNode((XBayaWorkflows)o,parent);
- }else if (o instanceof XBayaWorkflow){
- return new XBayaWorkflowNode((XBayaWorkflow)o,parent);
- }else{
- return new DefaultMutableTreeNode(o);
- }
- }
+ public static TreeNode getTreeNode(Object o, TreeNode parent) {
+ if (o instanceof Registry) {
+ return new RegistryNode((Registry) o, parent);
+ } else if (o instanceof GFacURLs) {
+ return new GFacURLsNode((GFacURLs) o, parent);
+ } else if (o instanceof GFacURL) {
+ return new GFacURLNode((GFacURL) o, parent);
+ } else if (o instanceof HostDescriptions) {
+ return new HostDescriptionsNode((HostDescriptions) o, parent);
+ } else if (o instanceof HostDescription) {
+ return new HostDescriptionNode((HostDescription) o, parent);
+ } else if (o instanceof ServiceDescriptions) {
+ return new ServiceDescriptionsNode((ServiceDescriptions) o, parent);
+ } else if (o instanceof ServiceDescription) {
+ return new ServiceDescriptionNode((ServiceDescription) o, parent);
+ } else if (o instanceof ApplicationDeploymentDescriptions) {
+ return new ApplicationDeploymentDescriptionsNode((ApplicationDeploymentDescriptions) o, parent);
+ } else if (o instanceof ApplicationDeploymentDescriptionWrap) {
+ return new ApplicationDeploymentDescriptionNode((ApplicationDeploymentDescriptionWrap) o, parent);
+ } else if (o instanceof XBayaWorkflows) {
+ return new XBayaWorkflowsNode((XBayaWorkflows) o, parent);
+ } else if (o instanceof XBayaWorkflow) {
+ return new XBayaWorkflowNode((XBayaWorkflow) o, parent);
+ } else {
+ return new DefaultMutableTreeNode(o);
+ }
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ApplicationDeploymentDescriptionNode.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ApplicationDeploymentDescriptionNode.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ApplicationDeploymentDescriptionNode.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ApplicationDeploymentDescriptionNode.java Sat Oct 22 19:29:52 2011
@@ -17,85 +17,84 @@ import org.apache.airavata.xbaya.registr
import org.apache.airavata.xbaya.registrybrowser.model.ApplicationDeploymentDescriptionWrap;
public class ApplicationDeploymentDescriptionNode extends AbstractAiravataTreeNode {
- private ApplicationDeploymentDescriptionWrap applicationDeploymentDescriptionWrap;
- public ApplicationDeploymentDescriptionNode(ApplicationDeploymentDescriptionWrap applicationDeploymentDescriptionWrap,TreeNode parent) {
- super(parent);
- setApplicationDeploymentDescriptionWrap(applicationDeploymentDescriptionWrap);
- }
-
- @Override
- protected List<TreeNode> getChildren() {
- return emptyList();
- }
-
- @Override
- public String getCaption(boolean selected, boolean expanded, boolean leaf,
- boolean hasFocus) {
- return getApplicationDeploymentDescriptionWrap().getDescription().getId();
- }
-
- @Override
- public Icon getIcon(boolean selected, boolean expanded, boolean leaf,
- boolean hasFocus) {
- return SwingUtil.createImageIcon("application.png");
- }
-
- public ApplicationDeploymentDescriptionWrap getApplicationDeploymentDescriptionWrap() {
- return applicationDeploymentDescriptionWrap;
- }
-
- public void setApplicationDeploymentDescriptionWrap(
- ApplicationDeploymentDescriptionWrap applicationDeploymentDescriptionWrap) {
- this.applicationDeploymentDescriptionWrap = applicationDeploymentDescriptionWrap;
- }
-
- @Override
- public List<String> getSupportedActions() {
- return Arrays.asList(EditAction.ID, DeleteAction.ID);
- }
-
- public boolean triggerAction(JTree tree,String action) throws Exception{
- if (action.equals(DeleteAction.ID)){
- deleteApplicationDescription(tree);
- return true;
- }else if (action.equals(EditAction.ID)){
- JOptionPane.showMessageDialog(null, "TODO");
- return true;
- }
- return super.triggerAction(tree, action);
- }
-
- private void deleteApplicationDescription(JTree tree)
- throws PathNotFoundException,
- DeploymentDescriptionRetrieveException {
- if (askQuestion("Application description", "Are you sure that you want to remove the application description \""+getApplicationDeploymentDescriptionWrap().getDescription().getId()+"\"?")) {
- getRegistry().deleteDeploymentDescription(
- getApplicationDeploymentDescriptionWrap().getService(),
- getApplicationDeploymentDescriptionWrap().getHost(),
- getApplicationDeploymentDescriptionWrap()
- .getDescription().getId());
- ((AbstractAiravataTreeNode)getParent()).refresh();
- reloadTreeNode(tree, getParent());
- }
- }
-
- @Override
- public String getActionCaption(AbstractBrowserActionItem action) {
- if (action.getID().equals(DeleteAction.ID)){
- return "Remove";
- }else if (action.getID().equals(EditAction.ID)){
- return "Edit";
- }
- return action.getDefaultCaption();
- }
-
- @Override
- public Icon getActionIcon(AbstractBrowserActionItem action) {
- return null;
- }
-
- @Override
- public String getActionDescription(AbstractBrowserActionItem action) {
- return null;
- }
+ private ApplicationDeploymentDescriptionWrap applicationDeploymentDescriptionWrap;
+
+ public ApplicationDeploymentDescriptionNode(
+ ApplicationDeploymentDescriptionWrap applicationDeploymentDescriptionWrap, TreeNode parent) {
+ super(parent);
+ setApplicationDeploymentDescriptionWrap(applicationDeploymentDescriptionWrap);
+ }
+
+ @Override
+ protected List<TreeNode> getChildren() {
+ return emptyList();
+ }
+
+ @Override
+ public String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+ return getApplicationDeploymentDescriptionWrap().getDescription().getId();
+ }
+
+ @Override
+ public Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+ return SwingUtil.createImageIcon("application.png");
+ }
+
+ public ApplicationDeploymentDescriptionWrap getApplicationDeploymentDescriptionWrap() {
+ return applicationDeploymentDescriptionWrap;
+ }
+
+ public void setApplicationDeploymentDescriptionWrap(
+ ApplicationDeploymentDescriptionWrap applicationDeploymentDescriptionWrap) {
+ this.applicationDeploymentDescriptionWrap = applicationDeploymentDescriptionWrap;
+ }
+
+ @Override
+ public List<String> getSupportedActions() {
+ return Arrays.asList(EditAction.ID, DeleteAction.ID);
+ }
+
+ public boolean triggerAction(JTree tree, String action) throws Exception {
+ if (action.equals(DeleteAction.ID)) {
+ deleteApplicationDescription(tree);
+ return true;
+ } else if (action.equals(EditAction.ID)) {
+ JOptionPane.showMessageDialog(null, "TODO");
+ return true;
+ }
+ return super.triggerAction(tree, action);
+ }
+
+ private void deleteApplicationDescription(JTree tree) throws PathNotFoundException,
+ DeploymentDescriptionRetrieveException {
+ if (askQuestion("Application description",
+ "Are you sure that you want to remove the application description \""
+ + getApplicationDeploymentDescriptionWrap().getDescription().getId() + "\"?")) {
+ getRegistry().deleteDeploymentDescription(getApplicationDeploymentDescriptionWrap().getService(),
+ getApplicationDeploymentDescriptionWrap().getHost(),
+ getApplicationDeploymentDescriptionWrap().getDescription().getId());
+ ((AbstractAiravataTreeNode) getParent()).refresh();
+ reloadTreeNode(tree, getParent());
+ }
+ }
+
+ @Override
+ public String getActionCaption(AbstractBrowserActionItem action) {
+ if (action.getID().equals(DeleteAction.ID)) {
+ return "Remove";
+ } else if (action.getID().equals(EditAction.ID)) {
+ return "Edit";
+ }
+ return action.getDefaultCaption();
+ }
+
+ @Override
+ public Icon getActionIcon(AbstractBrowserActionItem action) {
+ return null;
+ }
+
+ @Override
+ public String getActionDescription(AbstractBrowserActionItem action) {
+ return null;
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ApplicationDeploymentDescriptionsNode.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ApplicationDeploymentDescriptionsNode.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ApplicationDeploymentDescriptionsNode.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ApplicationDeploymentDescriptionsNode.java Sat Oct 22 19:29:52 2011
@@ -19,95 +19,96 @@ import org.apache.airavata.xbaya.registr
import org.apache.airavata.xbaya.registrybrowser.model.ApplicationDeploymentDescriptions;
public class ApplicationDeploymentDescriptionsNode extends AbstractAiravataTreeNode {
- private ApplicationDeploymentDescriptions applicationDeploymentDescriptions;
- public ApplicationDeploymentDescriptionsNode(ApplicationDeploymentDescriptions applicationDeploymentDescriptions,TreeNode parent) {
- super(parent);
- setApplicationDeploymentDescriptions(applicationDeploymentDescriptions);
- }
-
- @Override
- protected List<TreeNode> getChildren() {
- try {
- return getTreeNodeList(getApplicationDeploymentDescriptions().getDescriptions().toArray(), this);
- } catch (DeploymentDescriptionRetrieveException e) {
- e.printStackTrace();
- return emptyList();
- }
- }
-
- @Override
- public String getCaption(boolean selected, boolean expanded, boolean leaf,
- boolean hasFocus) {
- return "Applications";
- }
-
- @Override
- public Icon getIcon(boolean selected, boolean expanded, boolean leaf,
- boolean hasFocus) {
- return SwingUtil.createImageIcon("applications.png");
- }
-
- public ApplicationDeploymentDescriptions getApplicationDeploymentDescriptions() {
- return applicationDeploymentDescriptions;
- }
-
- public void setApplicationDeploymentDescriptions(
- ApplicationDeploymentDescriptions applicationDeploymentDescriptions) {
- this.applicationDeploymentDescriptions = applicationDeploymentDescriptions;
- }
-
- @Override
- public List<String> getSupportedActions() {
- return Arrays.asList(AddAction.ID, RefreshAction.ID, DeleteAction.ID);
- }
-
- public boolean triggerAction(JTree tree,String action) throws Exception{
- if (action.equals(DeleteAction.ID)){
- deleteApplicationDescription(tree);
- return true;
- }else if (action.equals(AddAction.ID)){
- ApplicationDescriptionDialog applicationDescriptionDialog = new ApplicationDescriptionDialog(getRegistry());
- applicationDescriptionDialog.open();
- if (applicationDescriptionDialog.isApplicationDescCreated()) {
- refresh();
- reloadTreeNode(tree, this);
- }
- return true;
- }
- return super.triggerAction(tree, action);
- }
-
- private void deleteApplicationDescription(JTree tree)
- throws Exception {
- if (askQuestion("Application descriptions", "Are you sure that you want to remove all application descriptions in this registry?")) {
- Registry registry = getRegistry();
- List<ApplicationDeploymentDescriptionWrap> descriptions = getApplicationDeploymentDescriptions().getDescriptions();
- for (ApplicationDeploymentDescriptionWrap descriptionWrap : descriptions) {
- registry.deleteDeploymentDescription(descriptionWrap.getService(), descriptionWrap.getHost(), descriptionWrap.getDescription().getId());
- }
- refresh();
- reloadTreeNode(tree, this);
- }
- }
-
- @Override
- public String getActionCaption(AbstractBrowserActionItem action) {
- if (action.getID().equals(DeleteAction.ID)){
- return "Remove all applications";
- }else if (action.getID().equals(AddAction.ID)){
- return "New application...";
- }
- return action.getDefaultCaption();
- }
-
- @Override
- public Icon getActionIcon(AbstractBrowserActionItem action) {
- return null;
- }
-
- @Override
- public String getActionDescription(AbstractBrowserActionItem action) {
- return null;
- }
+ private ApplicationDeploymentDescriptions applicationDeploymentDescriptions;
+
+ public ApplicationDeploymentDescriptionsNode(ApplicationDeploymentDescriptions applicationDeploymentDescriptions,
+ TreeNode parent) {
+ super(parent);
+ setApplicationDeploymentDescriptions(applicationDeploymentDescriptions);
+ }
+
+ @Override
+ protected List<TreeNode> getChildren() {
+ try {
+ return getTreeNodeList(getApplicationDeploymentDescriptions().getDescriptions().toArray(), this);
+ } catch (DeploymentDescriptionRetrieveException e) {
+ e.printStackTrace();
+ return emptyList();
+ }
+ }
+
+ @Override
+ public String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+ return "Applications";
+ }
+
+ @Override
+ public Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+ return SwingUtil.createImageIcon("applications.png");
+ }
+
+ public ApplicationDeploymentDescriptions getApplicationDeploymentDescriptions() {
+ return applicationDeploymentDescriptions;
+ }
+
+ public void setApplicationDeploymentDescriptions(ApplicationDeploymentDescriptions applicationDeploymentDescriptions) {
+ this.applicationDeploymentDescriptions = applicationDeploymentDescriptions;
+ }
+
+ @Override
+ public List<String> getSupportedActions() {
+ return Arrays.asList(AddAction.ID, RefreshAction.ID, DeleteAction.ID);
+ }
+
+ public boolean triggerAction(JTree tree, String action) throws Exception {
+ if (action.equals(DeleteAction.ID)) {
+ deleteApplicationDescription(tree);
+ return true;
+ } else if (action.equals(AddAction.ID)) {
+ ApplicationDescriptionDialog applicationDescriptionDialog = new ApplicationDescriptionDialog(getRegistry());
+ applicationDescriptionDialog.open();
+ if (applicationDescriptionDialog.isApplicationDescCreated()) {
+ refresh();
+ reloadTreeNode(tree, this);
+ }
+ return true;
+ }
+ return super.triggerAction(tree, action);
+ }
+
+ private void deleteApplicationDescription(JTree tree) throws Exception {
+ if (askQuestion("Application descriptions",
+ "Are you sure that you want to remove all application descriptions in this registry?")) {
+ Registry registry = getRegistry();
+ List<ApplicationDeploymentDescriptionWrap> descriptions = getApplicationDeploymentDescriptions()
+ .getDescriptions();
+ for (ApplicationDeploymentDescriptionWrap descriptionWrap : descriptions) {
+ registry.deleteDeploymentDescription(descriptionWrap.getService(), descriptionWrap.getHost(),
+ descriptionWrap.getDescription().getId());
+ }
+ refresh();
+ reloadTreeNode(tree, this);
+ }
+ }
+
+ @Override
+ public String getActionCaption(AbstractBrowserActionItem action) {
+ if (action.getID().equals(DeleteAction.ID)) {
+ return "Remove all applications";
+ } else if (action.getID().equals(AddAction.ID)) {
+ return "New application...";
+ }
+ return action.getDefaultCaption();
+ }
+
+ @Override
+ public Icon getActionIcon(AbstractBrowserActionItem action) {
+ return null;
+ }
+
+ @Override
+ public String getActionDescription(AbstractBrowserActionItem action) {
+ return null;
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/GFacURLNode.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/GFacURLNode.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/GFacURLNode.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/GFacURLNode.java Sat Oct 22 19:29:52 2011
@@ -11,55 +11,53 @@ import org.apache.airavata.xbaya.registr
import org.apache.airavata.xbaya.registrybrowser.model.GFacURL;
public class GFacURLNode extends AbstractAiravataTreeNode {
- private GFacURL gfacURL;
-
- public GFacURLNode(GFacURL gfacURL, TreeNode parent) {
- super(parent);
- setGfacURL(gfacURL);
- }
-
- @Override
- protected List<TreeNode> getChildren() {
- return emptyList();
- }
-
- @Override
- public String getCaption(boolean selected, boolean expanded, boolean leaf,
- boolean hasFocus) {
- return getGfacURL().getGfacURL().toString();
- }
-
- @Override
- public Icon getIcon(boolean selected, boolean expanded, boolean leaf,
- boolean hasFocus) {
- return SwingUtil.createImageIcon("registry.png");
- }
-
- public GFacURL getGfacURL() {
- return gfacURL;
- }
-
- public void setGfacURL(GFacURL gfacURL) {
- this.gfacURL = gfacURL;
- }
-
- @Override
- public List<String> getSupportedActions() {
- return Arrays.asList();
- }
-
- @Override
- public String getActionCaption(AbstractBrowserActionItem action) {
- return null;
- }
-
- @Override
- public Icon getActionIcon(AbstractBrowserActionItem action) {
- return null;
- }
-
- @Override
- public String getActionDescription(AbstractBrowserActionItem action) {
- return null;
- }
+ private GFacURL gfacURL;
+
+ public GFacURLNode(GFacURL gfacURL, TreeNode parent) {
+ super(parent);
+ setGfacURL(gfacURL);
+ }
+
+ @Override
+ protected List<TreeNode> getChildren() {
+ return emptyList();
+ }
+
+ @Override
+ public String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+ return getGfacURL().getGfacURL().toString();
+ }
+
+ @Override
+ public Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+ return SwingUtil.createImageIcon("registry.png");
+ }
+
+ public GFacURL getGfacURL() {
+ return gfacURL;
+ }
+
+ public void setGfacURL(GFacURL gfacURL) {
+ this.gfacURL = gfacURL;
+ }
+
+ @Override
+ public List<String> getSupportedActions() {
+ return Arrays.asList();
+ }
+
+ @Override
+ public String getActionCaption(AbstractBrowserActionItem action) {
+ return null;
+ }
+
+ @Override
+ public Icon getActionIcon(AbstractBrowserActionItem action) {
+ return null;
+ }
+
+ @Override
+ public String getActionDescription(AbstractBrowserActionItem action) {
+ return null;
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/GFacURLsNode.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/GFacURLsNode.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/GFacURLsNode.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/GFacURLsNode.java Sat Oct 22 19:29:52 2011
@@ -12,51 +12,53 @@ import org.apache.airavata.xbaya.registr
import org.apache.airavata.xbaya.registrybrowser.model.GFacURLs;
public class GFacURLsNode extends AbstractAiravataTreeNode {
- private GFacURLs gfacURLs;
- public GFacURLsNode(GFacURLs gfacURLs, TreeNode parent) {
- super(parent);
- setGfacURLs(gfacURLs);
- }
- @Override
- protected List<TreeNode> getChildren() {
- return getTreeNodeList(getGfacURLs().getURLS().toArray(),this);
- }
-
- @Override
- public String getCaption(boolean selected, boolean expanded, boolean leaf,
- boolean hasFocus) {
- return "GFac Locations";
- }
-
- @Override
- public Icon getIcon(boolean selected, boolean expanded, boolean leaf,
- boolean hasFocus) {
- return SwingUtil.createImageIcon("gfac_urls.png");
- }
- public GFacURLs getGfacURLs() {
- return gfacURLs;
- }
- public void setGfacURLs(GFacURLs gfacURLs) {
- this.gfacURLs = gfacURLs;
- }
-
- @Override
- public List<String> getSupportedActions() {
- return Arrays.asList(RefreshAction.ID);
- }
-
- @Override
- public String getActionCaption(AbstractBrowserActionItem action) {
- return action.getDefaultCaption();
- }
-
- @Override
- public Icon getActionIcon(AbstractBrowserActionItem action) {
- return null;
- }
-
- @Override
- public String getActionDescription(AbstractBrowserActionItem action) {
- return null;
- }
+ private GFacURLs gfacURLs;
+
+ public GFacURLsNode(GFacURLs gfacURLs, TreeNode parent) {
+ super(parent);
+ setGfacURLs(gfacURLs);
+ }
+
+ @Override
+ protected List<TreeNode> getChildren() {
+ return getTreeNodeList(getGfacURLs().getURLS().toArray(), this);
+ }
+
+ @Override
+ public String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+ return "GFac Locations";
+ }
+
+ @Override
+ public Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+ return SwingUtil.createImageIcon("gfac_urls.png");
+ }
+
+ public GFacURLs getGfacURLs() {
+ return gfacURLs;
+ }
+
+ public void setGfacURLs(GFacURLs gfacURLs) {
+ this.gfacURLs = gfacURLs;
+ }
+
+ @Override
+ public List<String> getSupportedActions() {
+ return Arrays.asList(RefreshAction.ID);
+ }
+
+ @Override
+ public String getActionCaption(AbstractBrowserActionItem action) {
+ return action.getDefaultCaption();
+ }
+
+ @Override
+ public Icon getActionIcon(AbstractBrowserActionItem action) {
+ return null;
+ }
+
+ @Override
+ public String getActionDescription(AbstractBrowserActionItem action) {
+ return null;
+ }
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/HostDescriptionNode.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/HostDescriptionNode.java?rev=1187758&r1=1187757&r2=1187758&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/HostDescriptionNode.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/HostDescriptionNode.java Sat Oct 22 19:29:52 2011
@@ -17,80 +17,78 @@ import org.apache.airavata.xbaya.registr
import org.apache.airavata.xbaya.registrybrowser.menu.EditAction;
public class HostDescriptionNode extends AbstractAiravataTreeNode {
- private HostDescription hostDescription;
-
- public HostDescriptionNode(HostDescription hostDescription, TreeNode parent) {
- super(parent);
- setHostDescription(hostDescription);
- }
-
- @Override
- protected List<TreeNode> getChildren() {
- return emptyList();
- }
-
- @Override
- public String getCaption(boolean selected, boolean expanded, boolean leaf,
- boolean hasFocus) {
- return getHostDescription().getId();
- }
-
- @Override
- public Icon getIcon(boolean selected, boolean expanded, boolean leaf,
- boolean hasFocus) {
- return SwingUtil.createImageIcon("host.png");
- }
-
- public HostDescription getHostDescription() {
- return hostDescription;
- }
-
- public void setHostDescription(HostDescription hostDescription) {
- this.hostDescription = hostDescription;
- }
-
- @Override
- public List<String> getSupportedActions() {
- return Arrays.asList(EditAction.ID, DeleteAction.ID);
- }
-
- public boolean triggerAction(JTree tree,String action) throws Exception{
- if (action.equals(DeleteAction.ID)){
- deleteHostDescription(tree);
- return true;
- }else if (action.equals(EditAction.ID)){
- JOptionPane.showMessageDialog(null, "TODO");
- return true;
- }
- return super.triggerAction(tree, action);
- }
-
- private void deleteHostDescription(JTree tree)
- throws PathNotFoundException, HostDescriptionRetrieveException {
- if (askQuestion("Host description", "Are you sure that you want to remove the host description \""+getHostDescription().getId()+"\"?")) {
- getRegistry().deleteHostDescription(getHostDescription().getId());
- ((AbstractAiravataTreeNode)getParent()).refresh();
- reloadTreeNode(tree, getParent());
- }
- }
-
- @Override
- public String getActionCaption(AbstractBrowserActionItem action) {
- if (action.getID().equals(DeleteAction.ID)){
- return "Remove";
- }else if (action.getID().equals(EditAction.ID)){
- return "Edit";
- }
- return action.getDefaultCaption();
- }
-
- @Override
- public Icon getActionIcon(AbstractBrowserActionItem action) {
- return null;
- }
-
- @Override
- public String getActionDescription(AbstractBrowserActionItem action) {
- return null;
- }
+ private HostDescription hostDescription;
+
+ public HostDescriptionNode(HostDescription hostDescription, TreeNode parent) {
+ super(parent);
+ setHostDescription(hostDescription);
+ }
+
+ @Override
+ protected List<TreeNode> getChildren() {
+ return emptyList();
+ }
+
+ @Override
+ public String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+ return getHostDescription().getId();
+ }
+
+ @Override
+ public Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+ return SwingUtil.createImageIcon("host.png");
+ }
+
+ public HostDescription getHostDescription() {
+ return hostDescription;
+ }
+
+ public void setHostDescription(HostDescription hostDescription) {
+ this.hostDescription = hostDescription;
+ }
+
+ @Override
+ public List<String> getSupportedActions() {
+ return Arrays.asList(EditAction.ID, DeleteAction.ID);
+ }
+
+ public boolean triggerAction(JTree tree, String action) throws Exception {
+ if (action.equals(DeleteAction.ID)) {
+ deleteHostDescription(tree);
+ return true;
+ } else if (action.equals(EditAction.ID)) {
+ JOptionPane.showMessageDialog(null, "TODO");
+ return true;
+ }
+ return super.triggerAction(tree, action);
+ }
+
+ private void deleteHostDescription(JTree tree) throws PathNotFoundException, HostDescriptionRetrieveException {
+ if (askQuestion("Host description", "Are you sure that you want to remove the host description \""
+ + getHostDescription().getId() + "\"?")) {
+ getRegistry().deleteHostDescription(getHostDescription().getId());
+ ((AbstractAiravataTreeNode) getParent()).refresh();
+ reloadTreeNode(tree, getParent());
+ }
+ }
+
+ @Override
+ public String getActionCaption(AbstractBrowserActionItem action) {
+ if (action.getID().equals(DeleteAction.ID)) {
+ return "Remove";
+ } else if (action.getID().equals(EditAction.ID)) {
+ return "Edit";
+ }
+ return action.getDefaultCaption();
+ }
+
+ @Override
+ public Icon getActionIcon(AbstractBrowserActionItem action) {
+ return null;
+ }
+
+ @Override
+ public String getActionDescription(AbstractBrowserActionItem action) {
+ return null;
+ }
}