FELIX-790 -Add button to clear the list

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@707596 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 58a0d65..b07a67a 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
@@ -107,6 +107,22 @@
         }
     }
 
+    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+    throws ServletException, IOException
+    {
+        // for now we only have the clear action
+        if ( getParameter(req, "clear") != null )
+        {
+            synchronized ( this.events )
+            {
+                this.events.clear();
+            }
+        }
+        final String uri = req.getRequestURI();
+        resp.sendRedirect( uri );
+        return;
+    }
+
     protected void renderContent( HttpServletRequest request, HttpServletResponse response )
     throws ServletException, IOException
     {
diff --git a/webconsole/src/main/resources/res/ui/events.js b/webconsole/src/main/resources/res/ui/events.js
index 82a7093..ebc9968 100644
--- a/webconsole/src/main/resources/res/ui/events.js
+++ b/webconsole/src/main/resources/res/ui/events.js
@@ -83,7 +83,7 @@
     var properties = dataEntry.properties;
 
     parent.appendChild( td( "content", null, [ text( new Date(dataEntry.received) ) ] ) );
-    parent.appendChild( td( "content", { "width": "20%", [ text( topic ) ] ) );
+    parent.appendChild( td( "content", { "width": "20%"}, [ text( topic ) ] ) );
 
     var tableE = createElement("table");
     var bodyE = createElement("tbody");
@@ -97,6 +97,18 @@
     parent.appendChild( td( "content", null, [tableE] ) );
 }
 
+function installForm( )
+{
+    document.write( "<tr class='content'>" );
+    document.write( "<td class='content'>&nbsp;</td>" );
+    document.write( "<td class='content'>&nbsp;</td>" );
+    document.write( "<td class='content' align='right' noWrap>" );
+    document.write( "<form method='post' enctype='multipart/form-data'>" );
+    document.write( "<input class='submit' style='width:auto' type='submit' name='clear' value='Clear List'>" );
+    document.write( "</form>" );
+    document.write( "</td>" );
+    document.write( "</tr>" );
+}
 
 
 function renderEvents( /* Array of Data Objects */ bundleData )
@@ -107,6 +119,8 @@
     
     header( columns );
 
+    installForm();
+    
     if (bundleData.error)
     {
         error( columns, bundleData.error );
@@ -116,5 +130,7 @@
         data ( bundleData.data );
     }
 
+    installForm();
+
     footer( columns );
 }