openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r1041342 - in /openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest: images/home.jpg jest.js
Date Thu, 02 Dec 2010 11:59:11 GMT
Author: ppoddar
Date: Thu Dec  2 11:59:10 2010
New Revision: 1041342

URL: http://svn.apache.org/viewvc?rev=1041342&view=rev
Log:
OPENJPA-1851: Add a client to JEST

Added:
    openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/images/home.jpg
  (with props)
Modified:
    openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.js

Added: openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/images/home.jpg
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/images/home.jpg?rev=1041342&view=auto
==============================================================================
Binary file - no diff available.

Propchange: openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/images/home.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Modified: openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.js
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.js?rev=1041342&r1=1041341&r2=1041342&view=diff
==============================================================================
--- openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.js
(original)
+++ openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.js
Thu Dec  2 11:59:10 2010
@@ -607,34 +607,8 @@ function render(/* string */ uri, /* id 
         	} else {
         		newDivs = renderXMLResponse(data, contentType);
         	} 
-        	var displayNode = document.createElement("table");
+        	var displayNode = createDisplayModeControl(displayFormats);
         	targetNode.appendChild(displayNode);
-        	for (var row = 0; row < 2; row++) {
-        		var tr = document.createElement("tr");
-        		var td = document.createElement("td");
-        		td.setTextContent(row == 0 ? "Display" : "Mode");
-        		tr.appendChild(td);
-	        	for (var i = 0; i < displayFormats.length; i++) {
-	        		var mode = displayFormats[i];
-	        		td = document.createElement("td");
-	        		if (row == 1) {
-	        			td.innerHTML = mode;
-	        		} else {
-		        		var radio = document.createElement("input");
-		        		radio.setAttribute("type", "radio");
-		        		radio.setAttribute("value", mode);
-		        		radio.setAttribute("name", "display.mode");
-		        		if (i == 0) radio.setAttribute("checked", "checked");
-		        		radio.appendChild(document.createTextNode(mode.toUpperCase()));
-		        		td.appendChild(radio);
-		        		
-		        		radio.setAttribute('onchange', createModeSwitch(mode, displayFormats));
-	        		}
-	        		tr.appendChild(td);
-	        	}
-        		displayNode.appendChild(tr);
-        	}
-
         	for (var i = 0; i < newDivs.length; i++) {
         		targetNode.appendChild(newDivs[i]);
         	}
@@ -651,6 +625,36 @@ function render(/* string */ uri, /* id 
     return false;
 }
 
+function createDisplayModeControl(displayFormats) {
+	var displayNode = document.createElement("table");
+	for (var row = 0; row < 2; row++) {
+		var tr = document.createElement("tr");
+		var td = document.createElement("td");
+		td.innerHTML = (row == 0 ? "Display" : "Mode");
+		tr.appendChild(td);
+    	for (var i = 0; i < displayFormats.length; i++) {
+    		var mode = displayFormats[i];
+    		td = document.createElement("td");
+    		if (row == 1) {
+    			td.innerHTML = mode;
+    		} else {
+        		var radio = document.createElement("input");
+        		radio.setAttribute("type", "radio");
+        		radio.setAttribute("value", mode);
+        		radio.setAttribute("name", "display.mode");
+        		if (i == 0) radio.setAttribute("checked", "checked");
+        		radio.appendChild(document.createTextNode(mode.toUpperCase()));
+        		td.appendChild(radio);
+        		
+        		radio.setAttribute('onchange', createModeSwitch(mode, displayFormats));
+    		}
+    		tr.appendChild(td);
+    	}
+		displayNode.appendChild(tr);
+	}
+	return displayNode;
+}
+
 function createModeSwitch(/* string */ visible, /* string[] */ all) {
 	var array = '[';
 	for (var i = 0; i < all.length; i++) {
@@ -720,9 +724,9 @@ function renderInstancesFromXMLAsDojo(/*
     dojo.forEach(panels, function(item, index) {
     	var domNode = item.domNode;
     	domNode.style.width = "200px";
-    	domNode.style.position = "relative";
-    	domNode.style.left  = 10;//100 + (index % 5)*300 + "px";
-    	domNode.style.top   = 10;//100 + Math.floor(index / 5)*200 +"px";
+    	domNode.style.position = "absolute";
+    	domNode.style.left  = 100 + (index % 5)*300 + "px";
+    	domNode.style.top   = 100 + Math.floor(index / 5)*200 +"px";
     	target.appendChild(domNode);
     });
     return target;
@@ -925,6 +929,7 @@ function renderJSONResponse(/*JSON*/json
  */
 function renderXMLasXML(/*XML DOM*/dom) {
 	var newDiv = document.createElement('div');
+	newDiv.style.backgroundColor = 'white';
 	var pre    = document.createElement('pre');
 	newDiv.appendChild(pre);
 	// replace all < character to &lt; so that they display properly
@@ -933,39 +938,6 @@ function renderXMLasXML(/*XML DOM*/dom) 
 	return newDiv;
 }
 
-function renderXMLasXML2(/*XML DOM*/dom, /*int*/ indent) {
-	var div = document.createElement('div');
-    dojo.forEach(dom, function(item) {
-    	var tag = item.nodeName;
-    	var childDiv = document.createElement('div');
-    	div.appendChild(childDiv);
-    	childDiv.style.position = 'relative';
-    	childDiv.style.left = (indent + 1) + 'em';
-    	var span = document.createElement('span');
-    	span.className = tag.toLowerCase();
-    	span.setTextContent('&lt;' + tag);
-    	childDiv.appendChild(span);
-    	dojo.forEach(item.getAttributes(), function(attr) {
-    		var attrName = document.createElement('span');
-    		attrName.setTextContent(' ' + attr.nodeName + '="' + attr.nodeValue + '"');
-    		childDiv.appendChild(attrName);
-    	});
-    	if (item.has)
-    	dojo.forEach(item.childNodes) {
-    		
-    	}
-    });
-
-	dojo.forEach(dom)
-	var pre    = document.createElement('pre');
-	newDiv.appendChild(pre);
-	// replace all < character to &lt; so that they display properly
-	var replaced = dojox.xml.parser.innerXML(dom).replace(/</g, '&lt;');
-	pre.innerHTML = replaced;
-	return newDiv;
-}
-
-
 function renderJSON(target, data) {
 	target.innerHTML = data;
 }



Mime
View raw message