[freenet-cvs] r11457 - trunk/freenet/src/freenet/clients/http

Jogy at freenetproject.org Jogy at freenetproject.org
Sun Dec 17 02:20:16 UTC 2006


Author: Jogy
Date: 2006-12-17 02:20:15 +0000 (Sun, 17 Dec 2006)
New Revision: 11457

Modified:
   trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
Log:
hide peercircle if not advanced darknet, small graphic tweaks

Modified: trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java	2006-12-17 01:52:27 UTC (rev 11456)
+++ trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java	2006-12-17 02:20:15 UTC (rev 11457)
@@ -543,14 +543,16 @@
 				peerForm.addChild("input", new String[] { "type", "name", "value" }, new String[] { "submit", "doAction", "Go" });
 				
     		// BEGIN PEER LOCATION DISTRIBUTION CIRCLE
-  			HTMLNode peerCircleTable = peerTableInfobox.addChild("table", "class", "column");
-  			HTMLNode peerCircleTableRow = peerCircleTable.addChild("tr");
-  			HTMLNode nextPeerCircleTableCell = peerCircleTableRow.addChild("td", "class", "first");
-        //  
- 				HTMLNode peerCircleInfobox = nextPeerCircleTableCell.addChild("div", "class", "infobox");
-  			peerCircleInfobox.addChild("div", "class", "infobox-header", "Peer Location Distribution");
-  			HTMLNode peerCircleInfoboxContent = peerCircleInfobox.addChild("div", "class", "infobox-content");
-  			addPeerCircle(peerCircleInfoboxContent);
+				if (advancedEnabled) {
+    			HTMLNode peerCircleTable = peerTableInfobox.addChild("table", "class", "column");
+    			HTMLNode peerCircleTableRow = peerCircleTable.addChild("tr");
+    			HTMLNode nextPeerCircleTableCell = peerCircleTableRow.addChild("td", "class", "first");
+          //  
+   				HTMLNode peerCircleInfobox = nextPeerCircleTableCell.addChild("div", "class", "infobox");
+    			peerCircleInfobox.addChild("div", "class", "infobox-header", "Peer Location Distribution");
+    			HTMLNode peerCircleInfoboxContent = peerCircleInfobox.addChild("div", "class", "infobox-content");
+    			addPeerCircle(peerCircleInfoboxContent);
+    		}
     		// END PEER LOCATION DISTRIBUTION CIRCLE
 			}
 			// END PEER TABLE
@@ -615,16 +617,18 @@
 		this.writeReply(ctx, 200, "text/html", "OK", pageBuffer.toString());
 	}
 	
+	private final static int PEER_CIRCLE_RADIUS = 100;
+	
 	private void addPeerCircle (HTMLNode htmlNode)
 	{
-		HTMLNode peerCircleInfoboxContentDiv = htmlNode.addChild("div", new String[] { "style", "class" }, new String[] {"position: relative; height:210px", "peercircle" });
-		peerCircleInfoboxContentDiv.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0),     "mark" }, "+");
+		HTMLNode peerCircleInfoboxContentDiv = htmlNode.addChild("div", new String[] { "style", "class" }, new String[] {"position: relative; height: " + (PEER_CIRCLE_RADIUS * 2 + 10) + "px", "peercircle" });
+		peerCircleInfoboxContentDiv.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0),     "mark" }, "|");
 		peerCircleInfoboxContentDiv.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.125), "mark" }, "+");
-		peerCircleInfoboxContentDiv.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.25),  "mark" }, "+");
+		peerCircleInfoboxContentDiv.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.25),  "mark" }, "--");
 		peerCircleInfoboxContentDiv.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.375), "mark" }, "+");
-		peerCircleInfoboxContentDiv.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.5),   "mark" }, "+");
+		peerCircleInfoboxContentDiv.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.5),   "mark" }, "|");
 		peerCircleInfoboxContentDiv.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.625), "mark" }, "+");
-		peerCircleInfoboxContentDiv.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.75),  "mark" }, "+");
+		peerCircleInfoboxContentDiv.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.75),  "mark" }, "--");
 		peerCircleInfoboxContentDiv.addChild("span", new String[] { "style", "class" }, new String[] { generatePeerCircleStyleString(0.875), "mark" }, "+");
 		//
 		PeerNodeStatus[] peerNodeStatuses = node.getPeerNodeStatuses();
@@ -638,11 +642,10 @@
 	
 	private String generatePeerCircleStyleString (double peerLocation)
 	{
-	 int radius = 100;
    peerLocation *= Math.PI * 2;
 	 //
-	 double x = radius + Math.sin(peerLocation) * radius;
-	 double y = radius - Math.cos(peerLocation) * radius;
+	 double x = PEER_CIRCLE_RADIUS + Math.sin(peerLocation) * PEER_CIRCLE_RADIUS;
+	 double y = PEER_CIRCLE_RADIUS - Math.cos(peerLocation) * PEER_CIRCLE_RADIUS;
 	 //
 	 return "position: absolute; top: " + y + "px; left: " + x + "px";
 	}




More information about the cvs mailing list