FELIX-790 - Display received date.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@707587 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/EventAdminServlet.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/EventAdminServlet.java
index 8fa969c..58a0d65 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/EventAdminServlet.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/EventAdminServlet.java
@@ -98,7 +98,7 @@
         {
             synchronized ( this.events )
             {
-                this.events.add(event);
+                this.events.add(new EventInfo(event));
                 if ( events.size() > this.maxSize )
                 {
                     events.remove(0);
@@ -141,8 +141,7 @@
             // display list in reverse order
             for(int index = copiedEvents.size() -1; index >= 0; index--)
             {
-                eventJson( jw, (Event)copiedEvents.get(index), index );
-                index++;
+                eventJson( jw, (EventInfo)copiedEvents.get(index), index );
             }
 
             jw.endArray();
@@ -160,12 +159,15 @@
         Util.endScript( pw );
     }
 
-    private void eventJson( JSONWriter jw, Event e, int index)
+    private void eventJson( JSONWriter jw, EventInfo info, int index)
     throws JSONException
     {
+        final Event e = info.event;
         jw.object();
         jw.key( "id" );
         jw.value( String.valueOf(index) );
+        jw.key( "received");
+        jw.value( info.received );
         jw.key( "topic" );
         jw.value( e.getTopic());
         jw.key( "properties" );
@@ -184,4 +186,16 @@
         jw.endObject();
     }
 
+    private static final class EventInfo
+    {
+
+        public final Event event;
+        public final long  received;
+
+        public EventInfo(final Event e)
+        {
+            this.event = e;
+            this.received = System.currentTimeMillis();
+        }
+    }
 }
diff --git a/webconsole/src/main/resources/res/ui/events.js b/webconsole/src/main/resources/res/ui/events.js
index 76c8655..82a7093 100644
--- a/webconsole/src/main/resources/res/ui/events.js
+++ b/webconsole/src/main/resources/res/ui/events.js
@@ -24,7 +24,8 @@
     document.write( "</tr>" );
 
     document.write( "<tr class='content'>" );
-    document.write( "<th class='content' width='20%'>Topic</th>" );
+    document.write( "<th class='content'>Received</th>" );
+    document.write( "<th class='content'>Topic</th>" );
     document.write( "<th class='content'>Properties</th>" );
     document.write( "</tr>" );
 
@@ -81,7 +82,8 @@
     var topic = dataEntry.topic;
     var properties = dataEntry.properties;
 
-    parent.appendChild( td( "content", { width: "20%"}, [ text( topic ) ] ) );
+    parent.appendChild( td( "content", null, [ text( new Date(dataEntry.received) ) ] ) );
+    parent.appendChild( td( "content", { "width": "20%", [ text( topic ) ] ) );
 
     var tableE = createElement("table");
     var bodyE = createElement("tbody");
@@ -100,8 +102,8 @@
 function renderEvents( /* Array of Data Objects */ bundleData )
 {
 
-    // topic and properties
-    var columns = 2;
+    // date, topic and properties
+    var columns = 3;
     
     header( columns );