column = addColumnFunction(bounds, column, function, "Message Body");
}
SortedSet<String> headers = new TreeSet<String>();
for (IExchange exchange : exchanges) {
IMessage in = exchange.getIn();
if (in != null) {
headers.addAll(in.getHeaders().keySet());
}
}
for (final String header : headers) {
final Function1 function = new Function1() {
@Override
public Object apply(Object element) {
if (element instanceof IExchange) {
IExchange exchange = (IExchange) element;
IMessage in = exchange.getIn();
if (in != null) {
return in.getHeaders().get(header);
}
}
return null;
}
};
column = addColumnFunction(bounds, column, function, header);
}
if (browser instanceof ITraceExchangeBrowser) {
if (showToNode) {
final Function1 function = new Function1() {
@Override
public Object apply(Object element) {
IMessage message = Exchanges.asMessage(element);
if (message != null) {
return message.getToNode();
}
return null;
}
};
column = addColumnFunction(bounds, column, function, "Trace Node Id");
}
if (showTimestamp) {
final Function1 function = new Function1() {
@Override
public Object apply(Object element) {
IMessage message = Exchanges.asMessage(element);
if (message != null) {
return message.getTimestamp();
}
return null;
}
};
column = addColumnFunction(bounds, column, function, "Trace Timestamp");
}
if (showRelativeTime) {
final Function1 function = new FunctionLong() {
@Override
public Long apply(Object element) {
IMessage message = Exchanges.asMessage(element);
if (message != null) {
return message.getRelativeTime();
}
return null;
}
};
column = addColumnFunction(bounds, column, function, "Relative Time (ms)");
}
if (showElapsedTime) {
final Function1 function = new FunctionLong() {
@Override
public Long apply(Object element) {
IMessage message = Exchanges.asMessage(element);
if (message != null) {
return message.getElapsedTime();
}
return null;
}
};
column = addColumnFunction(bounds, column, function, "Elapsed Time (ms)");