You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2006/08/03 19:06:05 UTC
svn commit: r428478 - in /incubator/xap/trunk/WebContent/examples/dojo:
colorPicker.html colorPicker.js colorPicker.xal colorPickerHandler.js
Author: mturyn
Date: Thu Aug 3 12:06:05 2006
New Revision: 428478
URL: http://svn.apache.org/viewvc?rev=428478&view=rev
Log: (empty)
Added:
incubator/xap/trunk/WebContent/examples/dojo/colorPicker.html (with props)
incubator/xap/trunk/WebContent/examples/dojo/colorPicker.js (with props)
incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal (with props)
incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js (with props)
Added: incubator/xap/trunk/WebContent/examples/dojo/colorPicker.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/colorPicker.html?rev=428478&view=auto
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/colorPicker.html (added)
+++ incubator/xap/trunk/WebContent/examples/dojo/colorPicker.html Thu Aug 3 12:06:05 2006
@@ -0,0 +1,91 @@
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>A Dojo "ColorPalette" wrapped by an AbstractBlackBoxWidgetBridge subclass.</title>
+
+ <style type="text/css">
+ <!--
+ @import url(../../css/xapDefault.css);
+ -->
+ </style>
+
+ <!-- Keep dojo from trying to scan this whole page for dojoType'd tags: -->
+ <script type="text/javascript">
+ djConfig = {
+ parseWidgets: true
+ };
+ </script>
+
+ <script language="JavaScript" type="text/javascript" src="../../src/dojo/dojo.js"></script>
+ <script language="JavaScript" type="text/javascript" src="../../src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript" src="../../src/xap/Xap.js"></script>
+
+
+ <script language="JavaScript" type="text/javascript">
+ // These should be in this order, as this is what their dependencies
+ // look like
+ Xap.addDebuggables(
+ "xap.session.ClientSession",
+ "xap.taghandling.AbstractTagImpl",
+ "xap.bridges.basic.AbstractBlackBoxWidgetBridge",
+ "xap.bridges.dojo.DojoWidgetBridge",
+ "xap.bridges.dojo.DojoColorPaletteBridge"
+ ) ;
+ </script>
+
+ <script language="JavaScript" type="text/javascript">
+ Xap.bootstrap( "../../", true );
+ </script>
+<!-- Do this as late as possible---brings in script tags: -->
+<script language="JavaScript"> Xap._loadDebuggables();</script>
+
+
+ <!-- SECTION 2 -->
+ <script type="text/javascript">
+ // Load Dojo's code concerned with a Button or Button2 widget,
+ // including the object dojo.widget needed to create one
+ dojo.require("dojo.widget.*");
+ dojo.require("dojo.event.*");
+ dojo.require("dojo.widget.ColorPalette");
+ </script>
+
+ <script language="JavaScript" src="colorPicker.js"> </script>
+ <script language="JavaScript" src="colorPickerHandler.js"> </script>
+
+
+
+
+ </head>
+
+ <body onload="divv=document.getElementById('dp') ;dojo.widget.createWidget('ColorPalette',{widgetId:'dp'},divv);Xap.scanPage();if(document.showStatus){document.showStatus();}; ">
+ <script type="text/javascript">
+ DBG = new AjxDebug( AjxDebug.NONE, null, false );
+ </script>
+ <h1>A Dojo "ColorPalette" wrapped by an AbstractBlackBoxWidgetBridge subclass, managed by a xaplet in a different cell.</h1>
+
+ <table id="bigtable" border="4px" borderColor="#8866AA" width="80%" height="80%"
+ style="left:10%;top:10%"
+ cellpadding="20em" cellspacing="2px"
+ >
+ <tr><th width="30%">0.</th><th>1.</th></tr>
+ <tr><td>This is put here by plain old Dojo.<div id="dp"/><td/><td></td></tr>
+ <tr><td id="xapStat"></td>
+ <td><div context="../../" id="applicationHome"
+ appName="MyApp" src="colorPicker.xal" toolkit="dojo">This cell is the xap ClientSession "MyApp"'s home-base.</div>
+ </td>
+ </tr>
+ <tr><td>This ColorPicker was put here via a xap application:<div height="5em" id="targetNode" valign="top" align="left"/></div></td><td></td></tr>
+ <tr><td height="30px" bgColor="#FFFFee"><div id="dump">.</div></td><td id="mouseOverDisplayer"/><td/></tr>
+ </table>
+
+
+ <!-- MyApp as the app name is a top-level alias for session
+ as this event handler illustrates -->
+ <button onclick="alert(MyApp.getDocumentContainer().getUiDocument().toXml());Xap.getAllDependencies('xap')">hello</button>
+
+
+ <div id="foot">FOOTER TEXT</dev>
+
+
+</body>
+</html>
Propchange: incubator/xap/trunk/WebContent/examples/dojo/colorPicker.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/WebContent/examples/dojo/colorPicker.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/colorPicker.js?rev=428478&view=auto
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/colorPicker.js (added)
+++ incubator/xap/trunk/WebContent/examples/dojo/colorPicker.js Thu Aug 3 12:06:05 2006
@@ -0,0 +1,41 @@
+document.showStatus = function(){
+ var session = window["MyApp"] ;
+
+ var node = session.domContainer ;
+ var front = "" ;
+ var path = "";
+ while( node.parentNode ){
+ var siblings = node.parentNode.childNodes ;
+ if (path.length>0){
+ path = "<strong>/</strong>" + path ;
+ }
+ var idx = -1 ;
+ var nodeLikeThisOneName= node.nodeName ;
+ var nodeLikeThisOneNameIndex = -1 ;
+ // Which node is this (e.g., which TR child of a TBODY?)
+ while( ++idx < siblings.length ){
+ if( nodeLikeThisOneName == siblings[idx].nodeName ){
+ // This is {<last count>+1} node like this under
+ // the parent (e.g., the 3rd <td> under a <tr>)
+ ++nodeLikeThisOneNameIndex ;
+ }
+ if( siblings[idx] == node ){
+ path = "<strong>" +node.nodeName +"</strong>" +"<font color='#4444FF'>["+nodeLikeThisOneNameIndex+"]</font>" + path ;
+ break ;
+ }
+ }
+ node = node.parentNode ;
+ }
+ document.getElementById("xapStat").innerHTML =
+ "Found xap tag with <br> appName:"
+ + session.appName
+ + ", <br> and source "
+ + session.src
+ + "<br> under element: "
+ + "<code>"+path +"</code>"
+ ;
+}
+
+
+
+
Propchange: incubator/xap/trunk/WebContent/examples/dojo/colorPicker.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal?rev=428478&view=auto
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal (added)
+++ incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal Thu Aug 3 12:06:05 2006
@@ -0,0 +1,27 @@
+<xal xmlns="http://www.openxal.org/xal">
+
+
+ <mco:mco
+ xmlns:mco="http://www.openxal.org/mco"
+ id="handler"
+ src="colorPickerHandler"
+ />
+
+
+
+ <xm:modifications xmlns:xm="http://www.openxal.org/xmodify">
+ <xm:append select="/xal">
+
+ <colorPalette xmlns="http://www.dojotoolkit.org/"
+ elementId="targetNode"
+ height="60px"
+ width="90px"
+ x="10px"
+ y="10px"
+ onCommand="mco:handler.onPick(event)"
+ />
+ </xm:append>
+
+
+ </xm:modifications>
+</xal>
\ No newline at end of file
Propchange: incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js?rev=428478&view=auto
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js (added)
+++ incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js Thu Aug 3 12:06:05 2006
@@ -0,0 +1,62 @@
+// For MCO:
+function colorPickerHandler() { }
+
+colorPickerHandler.prototype = new Object() ;
+
+
+colorPickerHandler.colours = ["<font color='#660000'>",
+ "<font color='#aa00aa'>",
+ "<font color='#000000'>"
+ ];
+
+colorPickerHandler.prototype.onPicked = function () {
+xap.util.Utils.interrogate(arguments) ;
+srcNode = arguments[0] ;
+
+ var attributes = srcNode.attributes;
+
+ var i0 = Math.floor(3*Math.random() );
+ var i1 = (i0+1)%3 ;
+ var i2 = (i0+2)%3 ;
+
+ var resultString = "<br/><br/>"+colorPickerHandler.colours[i0]
+ +"An MCO call got the attributes of the XAP button: " ;
+ if(!attributes){
+ resultString += "<br/><NONE>" ;
+ } else {
+ for (var ii = 0; ii <attributes.length; ++ii ){
+ resultString +="<br/> "
+ + colorPickerHandler.colours[i1]
+ +attributes[ii].nodeName
+ +"</font>" ;
+ resultString +=":"+ colorPickerHandler.colours[i2]
+ +attributes[ii].nodeValue+"</font>" ;
+ }
+ }
+ xap.showStatus() ;
+ var ticker = document.getElementById("xapStat") ;
+ ticker.innerHTML = ticker.innerHTML + resultString ;
+
+}
+
+
+colorPickerHandler.prototype.onPick = function( event){
+
+ var uiDoc = event.session.getDocumentContainer().getUiDocument();
+
+ var srcObj = uiDoc.getElementById(event.id) ;
+
+ var palette = event.source._attributeChangeListeners[0]._peer ;
+
+ var report = report = xap.util.Utils.fullDump(palette,1,true);
+ report = report.replace(/&/gm, "&")
+ report = report.replace(/</gm, "<")
+ report = report.replace(/>/gm, ">")
+ report = report.replace(/\n/mg,"<br/>") ;
+ report = report.replace(/ /mg," ") ;
+
+ var ticker = document.getElementById("dump") ;
+
+ ticker.innerHTML += "<br><br/>Color: "+ report ;
+
+}
Propchange: incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js
------------------------------------------------------------------------------
svn:eol-style = native