simulation.getCooja().signalMoteHighlight(d.mote);
}
});
/* Automatically update column widths */
final TableColumnAdjuster adjuster = new TableColumnAdjuster(logTable, 0);
adjuster.packColumns();
logTable.getColumnModel().getColumn(COLUMN_DATA).setWidth(400);
/* Popup menu */
JPopupMenu popupMenu = new JPopupMenu();
bufferMenu.addMenuListener(new MenuListener() {
public void menuSelected(MenuEvent e) {
updateBufferMenu();
}
public void menuDeselected(MenuEvent e) {
}
public void menuCanceled(MenuEvent e) {
}
});
popupMenu.add(bufferMenu);
parserMenu.addMenuListener(new MenuListener() {
public void menuSelected(MenuEvent e) {
updateParserMenu();
}
public void menuDeselected(MenuEvent e) {
}
public void menuCanceled(MenuEvent e) {
}
});
popupMenu.add(parserMenu);
popupMenu.addSeparator();
JMenu copyClipboard = new JMenu("Copy to clipboard");
copyClipboard.add(new JMenuItem(copyAllAction));
copyClipboard.add(new JMenuItem(copyAction));
popupMenu.add(copyClipboard);
popupMenu.add(new JMenuItem(clearAction));
popupMenu.addSeparator();
popupMenu.add(new JMenuItem(saveAction));
popupMenu.addSeparator();
JMenu focusMenu = new JMenu("Show in");
focusMenu.add(new JMenuItem(showInAllAction));
focusMenu.addSeparator();
focusMenu.add(new JMenuItem(timeLineAction));
focusMenu.add(new JMenuItem(radioLoggerAction));
focusMenu.add(new JMenuItem(bufferListenerAction));
popupMenu.add(focusMenu);
popupMenu.addSeparator();
colorCheckbox = new JCheckBoxMenuItem("Mote-specific coloring");
popupMenu.add(colorCheckbox);
colorCheckbox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
backgroundColors = colorCheckbox.isSelected();
repaint();
}
});
inverseFilterCheckbox = new JCheckBoxMenuItem("Inverse filter");
popupMenu.add(inverseFilterCheckbox);
inverseFilterCheckbox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
inverseFilter = inverseFilterCheckbox.isSelected();
if (inverseFilter) {
filterLabel.setText("Exclude:");
} else {
filterLabel.setText("Filter:");
}
setFilter(getFilter());
repaint();
}
});
hideReadsCheckbox = new JCheckBoxMenuItem("Hide READs", hideReads);
popupMenu.add(hideReadsCheckbox);
hideReadsCheckbox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
hideReads = hideReadsCheckbox.isSelected();
setFilter(getFilter());
repaint();
}
});
withStackTraceCheckbox = new JCheckBoxMenuItem("Capture stack traces", withStackTrace);
popupMenu.add(withStackTraceCheckbox);
withStackTraceCheckbox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
withStackTrace = withStackTraceCheckbox.isSelected();
setFilter(getFilter());
repaint();
}
});
logTable.setComponentPopupMenu(popupMenu);
/* Column width adjustment */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
/* Make sure this happens *after* adding history */
adjuster.setDynamicAdjustment(true);
adjuster.setAdjustColumn(COLUMN_DATA, false);
}
});
logUpdateAggregator.start();
simulation.getEventCentral().addMoteCountListener(logOutputListener = new MoteCountListener() {