Added option to filter on concatenated mote id and log message + removed compiler warnings

This commit is contained in:
nifi 2010-01-12 15:42:08 +00:00
parent 8ee7b3c3be
commit 00d6ae56b6
2 changed files with 25 additions and 7 deletions

View File

@ -22,11 +22,12 @@ Right-click the main area for a popup menu with more options. \
<p>You may filter shown logs by entering regular expressions in the bottom text field. \
Filtering is performed on both the Mote and the Data columns.\
<p><b>Filter examples:</b> \
<br><br>Hello<br><i>logs containing the string Hello</i>\
<br><br>^Contiki<br><i>logs starting with Contiki</i>\
<br><br>Hello<br><i>logs containing the string 'Hello'</i>\
<br><br>^Contiki<br><i>logs starting with 'Contiki'</i>\
<br><br>^[CR]<br><i>logs starting either a C or an R</i>\
<br><br>'Hello'$<br><i>logs ending with 'Hello'</i>\
<br><br>^ID:[2-3]$<br><i>logs from motes 2 and 3</i>
<br><br>Hello$<br><i>logs ending with 'Hello'</i>\
<br><br>^ID:[2-5]$<br><i>logs from motes 2 to 5</i>\
<br><br>^ID:[2-5]§Contiki<br><i>logs from motes 2 to 5 starting with 'Contiki'</i>
se.sics.cooja.plugins.TimeLine = \
<b>Timeline</b>\

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: LogListener.java,v 1.21 2009/12/14 13:25:04 fros4943 Exp $
* $Id: LogListener.java,v 1.22 2010/01/12 15:42:08 nifi Exp $
*/
package se.sics.cooja.plugins;
@ -96,10 +96,12 @@ public class LogListener extends VisPlugin {
private final static int COLUMN_TIME = 0;
private final static int COLUMN_FROM = 1;
private final static int COLUMN_DATA = 2;
private final static int COLUMN_CONCAT = 3;
private final static String[] COLUMN_NAMES = {
"Time",
"Mote",
"Message"
"Message",
"#"
};
private final JTable logTable;
@ -143,6 +145,8 @@ public class LogListener extends VisPlugin {
return log.strID;
} else if (col == COLUMN_DATA) {
return log.ev.getMessage();
} else if (col == COLUMN_CONCAT) {
return log.strID + '§' + log.ev.getMessage();
}
return null;
}
@ -174,6 +178,7 @@ public class LogListener extends VisPlugin {
return super.getToolTipText(e);
}
};
logTable.getColumnModel().removeColumn(logTable.getColumnModel().getColumn(COLUMN_CONCAT));
logTable.setFillsViewportHeight(true);
logTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
logTable.setFont(new Font("Monospaced", Font.PLAIN, 12));
@ -340,7 +345,7 @@ public class LogListener extends VisPlugin {
private void setFilter(String text) {
try {
if (text != null && text.length() > 0) {
logFilter.setRowFilter(RowFilter.regexFilter(text, 1, 2));
logFilter.setRowFilter(RowFilter.regexFilter(text, COLUMN_FROM, COLUMN_DATA, COLUMN_CONCAT));
} else {
logFilter.setRowFilter(null);
}
@ -385,6 +390,8 @@ public class LogListener extends VisPlugin {
}
private Action saveAction = new AbstractAction("Save to file") {
private static final long serialVersionUID = -4140706275748686944L;
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser();
int returnVal = fc.showSaveDialog(GUI.getTopParentContainer());
@ -429,6 +436,8 @@ public class LogListener extends VisPlugin {
};
private Action timeLineAction = new AbstractAction("to Timeline") {
private static final long serialVersionUID = -6358463434933029699L;
public void actionPerformed(ActionEvent e) {
TimeLine plugin = (TimeLine) simulation.getGUI().getStartedPlugin(TimeLine.class.getName());
if (plugin == null) {
@ -448,6 +457,8 @@ public class LogListener extends VisPlugin {
};
private Action radioLoggerAction = new AbstractAction("to Radio Logger") {
private static final long serialVersionUID = -3041714249257346688L;
public void actionPerformed(ActionEvent e) {
RadioLogger plugin = (RadioLogger) simulation.getGUI().getStartedPlugin(RadioLogger.class.getName());
if (plugin == null) {
@ -468,6 +479,8 @@ public class LogListener extends VisPlugin {
private Action clearAction = new AbstractAction("Clear") {
private static final long serialVersionUID = -2115620313183440224L;
public void actionPerformed(ActionEvent e) {
int size = logs.size();
if (size > 0) {
@ -478,6 +491,8 @@ public class LogListener extends VisPlugin {
};
private Action copyAction = new AbstractAction("Copy selected") {
private static final long serialVersionUID = -8433490108577001803L;
public void actionPerformed(ActionEvent e) {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
@ -499,6 +514,8 @@ public class LogListener extends VisPlugin {
};
private Action copyAllAction = new AbstractAction("Copy all") {
private static final long serialVersionUID = -5038884975254178373L;
public void actionPerformed(ActionEvent e) {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();