Search in sources :

Example 1 with ComponentRegistry

use of org.apache.airavata.workflow.model.component.ComponentRegistry in project airavata by apache.

the class ComponentSelector method update.

/**
 * Updates all the registry entries.
 *
 * @throws ComponentRegistryException
 */
public void update() throws ComponentRegistryException {
    final List<ComponentRegistry> registries = new ArrayList<ComponentRegistry>();
    if (SwingUtilities.isEventDispatchThread()) {
        getRegistries(registries);
    } else {
        try {
            SwingUtilities.invokeAndWait(new Runnable() {

                public void run() {
                    getRegistries(registries);
                }
            });
        } catch (InterruptedException e) {
            // Should not happen.
            throw new WorkflowRuntimeException(e);
        } catch (InvocationTargetException e) {
            // Should not happen.
            throw new WorkflowRuntimeException(e);
        }
    }
    final List<ComponentTreeNode> newSubTrees = new ArrayList<ComponentTreeNode>();
    for (ComponentRegistry registry : registries) {
        ComponentTreeNode componentTree = ComponentController.getComponentTree(registry);
        newSubTrees.add(componentTree);
    }
    SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            ComponentTreeNode root = ComponentSelector.this.treeModel.getRoot();
            ComponentSelector.this.treeModel.removeChildren(root);
            logger.debug("Removed all");
            for (ComponentTreeNode subTree : newSubTrees) {
                ComponentSelector.this.treeModel.addNodeInto(subTree, root);
            }
            makeVisible((ComponentTreeNode) root.getFirstChild());
        }
    });
}
Also used : ComponentRegistry(org.apache.airavata.workflow.model.component.ComponentRegistry) ArrayList(java.util.ArrayList) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 2 with ComponentRegistry

use of org.apache.airavata.workflow.model.component.ComponentRegistry in project airavata by apache.

the class ComponentSelector method reloadComponentRegistryNode.

private void reloadComponentRegistryNode(final ComponentTreeNode selectedNode) throws ComponentRegistryException {
    ComponentRegistry registry = selectedNode.getComponentRegistry();
    final ComponentTreeNode componentTree = ComponentController.getComponentTree(registry);
    SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            ComponentTreeNode root = ComponentSelector.this.treeModel.getRoot();
            int index = root.getIndex(selectedNode);
            ComponentSelector.this.treeModel.removeNodeFromParent(selectedNode);
            ComponentSelector.this.treeModel.insertNodeInto(componentTree, root, index);
        }
    });
}
Also used : ComponentRegistry(org.apache.airavata.workflow.model.component.ComponentRegistry)

Example 3 with ComponentRegistry

use of org.apache.airavata.workflow.model.component.ComponentRegistry in project airavata by apache.

the class ComponentRegistryLoader method update.

@Override
public void update(Observable observable, Object o) {
    if ((observable instanceof XBayaConfiguration) && (o instanceof ComponentRegistry)) {
        ComponentRegistry componentRegistry = (ComponentRegistry) o;
        load(componentRegistry);
    }
}
Also used : XBayaConfiguration(org.apache.airavata.xbaya.XBayaConfiguration) ComponentRegistry(org.apache.airavata.workflow.model.component.ComponentRegistry)

Aggregations

ComponentRegistry (org.apache.airavata.workflow.model.component.ComponentRegistry)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)1 XBayaConfiguration (org.apache.airavata.xbaya.XBayaConfiguration)1