use of org.apache.airavata.xbaya.messaging.EventData in project airavata by apache.
the class MonitorPanel method init.
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()) {
EventData message = MonitorPanel.this.tableSliderModel.getEvent(row);
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);
}
use of org.apache.airavata.xbaya.messaging.EventData in project airavata by apache.
the class WorkflowModifier method getOutput.
private String getOutput(String nodeID, String messageName, String parameterName) throws MonitorException {
List<EventData> events = this.eventData.getEvents();
for (EventData event : events) {
// String value = parameter.requiredText();
return event.getMessage();
}
// TODO
String message = "Couldn't find a notification of the output from the service with nodeID, " + nodeID;
throw new MonitorException(message);
}
use of org.apache.airavata.xbaya.messaging.EventData in project airavata by apache.
the class WorkflowModifier method getWorkflowInput.
private String getWorkflowInput(String nodeID) throws MonitorException {
logger.debug("Node:" + nodeID);
List<EventData> events = this.eventData.getEvents();
for (EventData event : events) {
// String value = parameter.requiredText();
return event.getMessage();
}
// TODO
String message = "Couldn't find a notification of about the input with nodeID, " + nodeID;
throw new MonitorException(message);
}
Aggregations