// TODO Auto-generated constructor stub
}
@Override
public JComponent render(JScrollPane parent, Message m) {
final SortableTable table = new SortableTable();
final DefaultTableModel tableModel = new DefaultTableModel() {
/**
*
*/
private static final long serialVersionUID = 5702541447000695825L;
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
tableModel.addColumn("Property");
tableModel.addColumn("Value");
//
// Header properties...
try {
tableModel.addRow(new Object[] { "JMSMessageID", m.getJMSMessageID() });
} catch (Exception ex) {
log.error("no JMSMessageID in message: " + ex.getMessage());
}
try {
tableModel.addRow(new Object[] { "JMSDestination", JMSUtils.getDestinationName(m.getJMSDestination()) });
} catch (Exception ex) {
log.error("no JMSDestination in message: " + ex.getMessage());
}
try {
tableModel.addRow(new Object[] { "JMSTimestamp", new Date(m.getJMSTimestamp()) });
} catch (Exception ex) {
tableModel.addRow(new Object[] { "JMSTimestamp", new Date() });
log.error("no JMSTimestamp in message: " + ex.getMessage());
}
try {
tableModel.addRow(new Object[] { "JMSType", m.getJMSType() });
} catch (Exception ex) {
log.error("no JMSType in message: " + ex.getMessage());
}
try {
tableModel.addRow(new Object[] { "JMSReplyTo", JMSUtils.getDestinationName(m.getJMSReplyTo()) + (m.getJMSReplyTo() != null ? " (" + Domain.getDomain(m.getJMSReplyTo()) + ")" : "") });
} catch (Exception ex) {
log.error("no JMSReplyTo in message: " + ex.getMessage());
}
try {
tableModel.addRow(new Object[] { "JMSCorrelationID", m.getJMSCorrelationID() });
} catch (Exception ex) {
log.error("no JMSCorrelationID in message: " + ex.getMessage());
}
try {
tableModel.addRow(new Object[] { "JMSExpiration", new Long(m.getJMSExpiration()) });
} catch (Exception ex) {
log.error("no JMSExpiration in message: " + ex.getMessage());
}
try {
tableModel.addRow(new Object[] { "JMSPriority", new Long(m.getJMSPriority()) });
} catch (Exception ex) {
log.error("no JMSPriority in message: " + ex.getMessage());
}
try {
if (m.getPropertyNames() != null) {
for (final Enumeration iter = m.getPropertyNames(); iter.hasMoreElements();) {
try {
final String propertyName = (String) iter.nextElement();
final Object propertyValue = m.getObjectProperty(propertyName);
final Object[] row = { propertyName, propertyValue };
tableModel.addRow(row);
} catch (RuntimeException ex) {
ex.printStackTrace();
}
}
}
} catch (Throwable e) {
final Object[] row = { "Error", e.getClass().getName() + ": " + e.getMessage() };
tableModel.addRow(row);
log.error(e.getMessage(), e);
}
table.setModel(tableModel);
return SwingUtils.createJScrollPane(table);
}