use of org.apache.airavata.xbaya.ui.experiment.RegistrySearchResult in project airavata by apache.
the class WorkflowImportWindow method initGUI.
/**
* Initializes the GUI
*/
private void initGUI() {
this.list = new XbayaEnhancedList<RegistrySearchResult>();
this.list.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() >= 2) {
// double click is same as cliking the OK button.
WorkflowImportWindow.this.okButton.doClick();
}
if (WorkflowImportWindow.this.list.getSelectedIndex() == -1) {
WorkflowImportWindow.this.okButton.setEnabled(false);
WorkflowImportWindow.this.deleteButton.setEnabled(false);
} else {
WorkflowImportWindow.this.okButton.setEnabled(true);
WorkflowImportWindow.this.deleteButton.setEnabled(true);
}
// if (WorkflowImportWindow.this.list.getSelectedIndex() == 2) {
// WorkflowImportWindow.this.okButton.setEnabled(false);
// WorkflowImportWindow.this.deleteButton.setEnabled(true);
// } else if (WorkflowImportWindow.this.list.getSelectedIndex() != 1) {
// WorkflowImportWindow.this.okButton.setEnabled(true);
// WorkflowImportWindow.this.deleteButton.setEnabled(true);
// } else {
// WorkflowImportWindow.this.okButton.setEnabled(false);
// WorkflowImportWindow.this.deleteButton.setEnabled(false);
// }
}
});
GridPanel mainPanel = new GridPanel();
TitledBorder border = new TitledBorder(new EtchedBorder(), "Select a workflow to load");
mainPanel.getSwingComponent().setBorder(border);
mainPanel.add(this.list);
mainPanel.layout(1, 1, 0, 0);
JPanel buttonPanel = new JPanel();
this.okButton = new JButton("Load");
this.okButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
ok();
}
});
buttonPanel.add(this.okButton);
this.deleteButton = new JButton("Delete");
this.deleteButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
delete();
}
});
buttonPanel.add(this.deleteButton);
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
hide();
}
});
buttonPanel.add(cancelButton);
this.dialog = new XBayaDialog(this.engine.getGUI(), "Load a Workflow from the Registry", mainPanel, buttonPanel);
this.dialog.setDefaultButton(this.okButton);
}
use of org.apache.airavata.xbaya.ui.experiment.RegistrySearchResult in project airavata by apache.
the class WorkflowImportWindow method delete.
private void delete() {
for (RegistrySearchResult i : this.list.getSelectedValues()) {
try {
getClient().deleteWorkflow(i.getResourceName());
} catch (Exception e) {
engine.getGUI().getErrorWindow().error(e);
}
}
this.list.removeSelectedRows();
hide();
}
use of org.apache.airavata.xbaya.ui.experiment.RegistrySearchResult in project airavata by apache.
the class WorkflowImportWindow method show.
/**
* Shows the window.
*/
public void show() {
/*
* this.list.getList().setListData( new String[]{ "Loading the workflow list from the Registry.",
* "Please wait for a moment."});
*/
this.list.setEnabled(false);
this.okButton.setEnabled(false);
this.deleteButton.setEnabled(false);
new Thread() {
@Override
public void run() {
try {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
// FIXME: Update the gateway id fetched from UI
List<String> resultList = getClient().getAllWorkflows(engine.getConfiguration().getThriftClientData(ThriftServiceType.API_SERVICE).getGatewayId());
if (resultList == null || resultList.size() == 0) {
/*
* OGCEXRegistryLoaderWindow.this.list.getList(). setListData( new
* String[]{"No workflow"});
*/
} else {
Vector<RegistrySearchResult> results = new Vector<RegistrySearchResult>();
String val = null;
for (String key : resultList) {
results.add(new RegistrySearchResult(new QName(key), key, key));
}
WorkflowImportWindow.this.list.setListData(results);
WorkflowImportWindow.this.list.setEnabled(true);
}
} catch (InvalidRequestException e) {
log.error(e.getMessage(), e);
} catch (AiravataClientException e) {
log.error(e.getMessage(), e);
} catch (AiravataSystemException e) {
log.error(e.getMessage(), e);
} catch (TException e) {
log.error(e.getMessage(), e);
}
}
});
} catch (RuntimeException e) {
WorkflowImportWindow.this.engine.getGUI().getErrorWindow().error(ErrorMessages.REGISTRY_WORKFLOW_LIST_LOAD_ERROR, e);
hide();
} catch (Error e) {
WorkflowImportWindow.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
hide();
}
}
}.start();
// This has to be the last because it blocks when the dialog is modal.
this.dialog.show();
}
use of org.apache.airavata.xbaya.ui.experiment.RegistrySearchResult in project airavata by apache.
the class WorkflowImportWindow method ok.
private void ok() {
List<RegistrySearchResult> selectedValues = this.list.getSelectedValues();
try {
for (RegistrySearchResult result : selectedValues) {
org.apache.airavata.model.Workflow workflow = getClient().getWorkflow(result.getResourceName());
XmlElement workflowElement = XMLUtil.stringToXmlElement(workflow.getGraph());
Workflow w = new Workflow(workflowElement);
GraphCanvas newGraphCanvas = engine.getGUI().newGraphCanvas(true);
newGraphCanvas.setWorkflow(w);
engine.getGUI().getGraphCanvas().setWorkflowFile(null);
}
hide();
} catch (Exception e) {
engine.getGUI().getErrorWindow().error(e);
}
}
Aggregations