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());
}
});
}
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);
}
});
}
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);
}
}
Aggregations