From 00d6ae56b61dd565e1ac0d8eef9ef6c192e4ff8b Mon Sep 17 00:00:00 2001 From: nifi Date: Tue, 12 Jan 2010 15:42:08 +0000 Subject: [PATCH] Added option to filter on concatenated mote id and log message + removed compiler warnings --- tools/cooja/config/quickhelp.txt | 9 ++++---- .../se/sics/cooja/plugins/LogListener.java | 23 ++++++++++++++++--- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/tools/cooja/config/quickhelp.txt b/tools/cooja/config/quickhelp.txt index 04186c7ea..23970a2f0 100644 --- a/tools/cooja/config/quickhelp.txt +++ b/tools/cooja/config/quickhelp.txt @@ -22,11 +22,12 @@ Right-click the main area for a popup menu with more options. \

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.\

Filter examples: \ -

Hello
logs containing the string Hello\ -

^Contiki
logs starting with Contiki\ +

Hello
logs containing the string 'Hello'\ +

^Contiki
logs starting with 'Contiki'\

^[CR]
logs starting either a C or an R\ -

'Hello'$
logs ending with 'Hello'\ -

^ID:[2-3]$
logs from motes 2 and 3 +

Hello$
logs ending with 'Hello'\ +

^ID:[2-5]$
logs from motes 2 to 5\ +

^ID:[2-5]§Contiki
logs from motes 2 to 5 starting with 'Contiki' se.sics.cooja.plugins.TimeLine = \ Timeline\ diff --git a/tools/cooja/java/se/sics/cooja/plugins/LogListener.java b/tools/cooja/java/se/sics/cooja/plugins/LogListener.java index 75b765984..43b2280a4 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/LogListener.java +++ b/tools/cooja/java/se/sics/cooja/plugins/LogListener.java @@ -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();