Fix for consuming esc key PathPainter and minor javadoc refactoring

Change-Id: Id43d5b19fbca0868a95a2d33b451e2f6d5fe88fe
diff --git a/apps/pathpainter/src/main/java/org/onosproject/pathpainter/PathLink.java b/apps/pathpainter/src/main/java/org/onosproject/pathpainter/PathLink.java
index 3335ffd..ed4b429 100644
--- a/apps/pathpainter/src/main/java/org/onosproject/pathpainter/PathLink.java
+++ b/apps/pathpainter/src/main/java/org/onosproject/pathpainter/PathLink.java
@@ -24,7 +24,7 @@
 import java.util.Set;
 
 /**
- * Bi-directional link capable of different hilights.
+ * Bi-directional link capable of different highlights.
  */
 public class PathLink extends BiLink {
 
diff --git a/apps/pathpainter/src/main/java/org/onosproject/pathpainter/PathPainter.java b/apps/pathpainter/src/main/java/org/onosproject/pathpainter/PathPainter.java
index 24f6d29..c198adb 100644
--- a/apps/pathpainter/src/main/java/org/onosproject/pathpainter/PathPainter.java
+++ b/apps/pathpainter/src/main/java/org/onosproject/pathpainter/PathPainter.java
@@ -33,7 +33,7 @@
 import java.util.List;
 
 /**
- * Skeletal ONOS UI Topology-Overlay application component.
+ * ONOS UI PathPainter Topology-Overlay application component.
  */
 @Component(immediate = true)
 public class PathPainter {
diff --git a/apps/pathpainter/src/main/resources/app/view/ppTopov/ppTopov.js b/apps/pathpainter/src/main/resources/app/view/ppTopov/ppTopov.js
index f2f09c5..d2b1fa2 100644
--- a/apps/pathpainter/src/main/resources/app/view/ppTopov/ppTopov.js
+++ b/apps/pathpainter/src/main/resources/app/view/ppTopov/ppTopov.js
@@ -15,8 +15,7 @@
  */
 
 /*
- Sample Demo module. This contains the "business logic" for the topology
- overlay that we are implementing.
+ Module containing the "business logic" for the Path Painter topology overlay.
  */
 
 (function () {
@@ -36,6 +35,7 @@
 
     // internal state
     var currentMode = null;
+    var selected = false;
 
 
     // === ---------------------------
@@ -46,11 +46,17 @@
     // === Main API functions
 
     function clear() {
-        wss.sendEvent(clearMessage);
-        flash.flash('Cleared source and destination');
+        if (selected) {
+            selected = false;
+            wss.sendEvent(clearMessage);
+            flash.flash('Cleared source and destination');
+            return true;
+        }
+        return false;
     }
 
     function setSrc(node) {
+        selected = true;
         wss.sendEvent(srcMessage, {
             id: node.id,
             type: node.type
@@ -59,6 +65,7 @@
     }
 
     function setDst(node) {
+        selected = true;
         wss.sendEvent(dstMessage, {
             id: node.id,
             type: node.type
diff --git a/apps/pathpainter/src/main/resources/app/view/ppTopov/ppTopovOverlay.js b/apps/pathpainter/src/main/resources/app/view/ppTopov/ppTopovOverlay.js
index 322c69e..b2f38b4 100644
--- a/apps/pathpainter/src/main/resources/app/view/ppTopov/ppTopovOverlay.js
+++ b/apps/pathpainter/src/main/resources/app/view/ppTopov/ppTopovOverlay.js
@@ -1,6 +1,6 @@
 // path painter topology overlay - client side
 //
-// This is the glue that binds our business logic (in ppTopovDemo.js)
+// This is the glue that binds our business logic (in ppTopov.js)
 // to the overlay framework.
 
 (function () {
@@ -122,12 +122,10 @@
 
         hooks: {
             // hook for handling escape key
-            // TODO: Must return true to consume ESC, false otherwise.
+            // Must return true to consume ESC, false otherwise.
             escape: function () {
                 selectionCallback();
-                pps.setSrc();
-                pps.setDst();
-                // FIXME: should explicitly return true or false
+                return pps.clear();
             },
 
             // hooks for when the selection changes...