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/18 03:57:49 UTC
svn commit: r432483 - in /incubator/xap/trunk: WebContent/examples/dojo/
src/xap/bridges/dojo/
Author: mturyn
Date: Thu Aug 17 20:57:48 2006
New Revision: 432483
URL: http://svn.apache.org/viewvc?rev=432483&view=rev
Log:
Improved javadoc in classes, improved display in example.
Modified:
incubator/xap/trunk/WebContent/examples/dojo/colorPicker.html
incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal
incubator/xap/trunk/src/xap/bridges/dojo/DojoColorPaletteBridge.js
incubator/xap/trunk/src/xap/bridges/dojo/DojoDatePickerBridge.js
incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js
Modified: incubator/xap/trunk/WebContent/examples/dojo/colorPicker.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/colorPicker.html?rev=432483&r1=432482&r2=432483&view=diff
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/colorPicker.html (original)
+++ incubator/xap/trunk/WebContent/examples/dojo/colorPicker.html Thu Aug 17 20:57:48 2006
@@ -68,13 +68,13 @@
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>This is put here by plain Dojo.<div id="dp"/><td/><td></td></tr>
<tr><td id="xapStat"></td>
<td><div id="applicationHome1"
xapId="ColorPicker" xapSrc="colorPicker.xal" xapToolkit="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="colorPickerHome" valign="top" align="left"/></div></td><td></td></tr>
+ <tr><td>This ColorPicker was put here via a xap application, which also sized it:<div height="5em" id="colorPickerHome" valign="top" align="left"/></div></td><td></td></tr>
<tr><td height="30px" >
<div id="displayColour">
<font size="+2" face="Garamond">Pick a color...
Modified: incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal?rev=432483&r1=432482&r2=432483&view=diff
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal (original)
+++ incubator/xap/trunk/WebContent/examples/dojo/colorPicker.xal Thu Aug 17 20:57:48 2006
@@ -15,10 +15,10 @@
<colorPalette xmlns="http://www.dojotoolkit.org/"
displayerId="colorPickerHome"
id="theColorPicker"
- height="60px"
- width="90px"
- x="10px"
- y="10px"
+ width="300px"
+ height="120px"
+ x="450px"
+ y="120px"
onCommand="mco:handler.onPick(event)"
/>
</xm:append>
Modified: incubator/xap/trunk/src/xap/bridges/dojo/DojoColorPaletteBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/DojoColorPaletteBridge.js?rev=432483&r1=432482&r2=432483&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/DojoColorPaletteBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/DojoColorPaletteBridge.js Thu Aug 17 20:57:48 2006
@@ -29,10 +29,12 @@
*
*
* @class xap.bridges.dojo.DojoColorPaletteBridge is the bridge between an XML element
- * representing a control and a subclass of ColorPalette. This class
- * is typically not used directly but is extended by other classes
- * for its subclasses.
- *
+ * representing a control and a dojo ColorPalette widget. This class
+ * doesn't do very much by itself, most of the machinery being in its superclasses.
+ * <br/>The only method typically needed for a Dojo widget bridge that is not
+ * present here is <code>attributeSet</code>---the superclass method suffices here. A
+ * container would also want <code>getDisplayNode()</code> set to its node where the
+ * children should be appended.
* @author mturyn
*/
xap.bridges.dojo.DojoColorPaletteBridge = function(){
@@ -57,12 +59,7 @@
return "ColorPalette" ;
}
-/*
- * Unknown bug requires that we have this, otherwise get into an infinite loop. Fix later.
-*/
-xap.bridges.dojo.DojoColorPaletteBridge.prototype.attributeSet = function(){
- //TO_DO anything useful here?
-};
+
/**
* The operation we'd like to attach to our <code>onCommand</code> event
@@ -81,9 +78,13 @@
**/
xap.bridges.dojo.DojoColorPaletteBridge.prototype.setPeer = function(aWidget){
this.superclass.setPeer.call(this,aWidget) ;
+
+ // Hard to believe, but there's nothing like this defined
+ // for the raw palette:
aWidget.onColorSelect = function(aColor){
aWidget._color = aColor ;
}
+ //...nor this:
aWidget.getColor = function(){
return aWidget._color ;
}
Modified: incubator/xap/trunk/src/xap/bridges/dojo/DojoDatePickerBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/DojoDatePickerBridge.js?rev=432483&r1=432482&r2=432483&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/DojoDatePickerBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/DojoDatePickerBridge.js Thu Aug 17 20:57:48 2006
@@ -50,18 +50,38 @@
xap.bridges.dojo.DojoDatePickerBridge.prototype._peer = null ;
-
+/**
+ * @return the string Dojo will use to create this bridge's peer:
+**/
xap.bridges.dojo.DojoDatePickerBridge.prototype.getPeerString = function(){
return "DatePicker" ;
}
-
+/**
+ * @return the peer event to connect to our own <code>_onCommandEvent</code>,
+ * which is just a wrapper for <code>this.fireEvent("onCommand")</code>.
+**/
xap.bridges.dojo.DojoDatePickerBridge.prototype.getPeerOnCommandEvent = function(){
return "onSetDate" ;
}
+
+/**
+ * Sets the widget as our peer, upgrades it with new methods to adapt it to our use:
+**/
+xap.bridges.dojo.DojoDatePickerBridge.prototype.setPeer = function(aDatePicker){
+ this.superclass.setPeer.call(this,aDatePicker) ;
+ aDatePicker._formatString="yyyy-MM-dd" ;
+ aDatePicker.setFormatString = function(aString){
+ aDatePicker._formatString = aString ;
+ }
+ aDatePicker.getFormatString = function(){
+ return aDatePicker._formatString ;
+ }
+}
+
/**
* This method is called whenever an attribute
* on the XML element that maps to this bridge class
@@ -77,7 +97,8 @@
This method isn't needed, since the two-levels-up ancestor
class AbstractBlackBoxWidget has a default attributeSet() that
-will automatically go from "formatString" to peer.setFormatString().
+will automatically go from "formatString" to peer.setFormatString()---
+that's why we've attached a setFormatString method to the peer in setPeer.
xap.bridges.dojo.DojoDatePickerBridge.prototype.attributeSet = function( event ) {
var name = event.getName();
@@ -94,26 +115,14 @@
*/
-/**
- * Sets the widget as our peer, upgrades it with new methods to adapt it to our use:
-**/
-xap.bridges.dojo.DojoDatePickerBridge.prototype.setPeer = function(aDatePicker){
- this.superclass.setPeer.call(this,aDatePicker) ;
- aDatePicker._formatString="yyyy-MM-dd" ;
- aDatePicker.setFormatString = function(aString){
- aDatePicker._formatString = aString ;
- }
- aDatePicker.getFormatString = function(){
- return aDatePicker._formatString ;
- }
-}
-
-// Just testing that the superclass event-mapper doesn't destroy any explicitly-defined
-// events:
+/**
+ * Just testing that the superclass' event-mapper doesn't destroy any explicitly-defined
+ * events---if this weren't defined here, a default <code>onIncrementYear</code>
+ * would be created for the peer wrappering <code>this.fireEvent("onIncrementYear")</code>.
+**/
xap.bridges.dojo.DojoDatePickerBridge.prototype.onIncrementYear = function(){
- this.fireEvent("onIncrementYear") ;
- var bkpt = true ;
+ alert("Year value changed to \"" +dojo.date.toString(this.getPeer().date,"#yyyy")+"\".") ;
}
Modified: incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js?rev=432483&r1=432482&r2=432483&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js Thu Aug 17 20:57:48 2006
@@ -146,9 +146,10 @@
// eventual Dojo widget?
for( var fieldName in this._creationProperties ){
if( !tmp.style[fieldName]){
- tmp.style[fieldName] = this._creationProperties[fieldName] ;
+ tmp.style[fieldName] = this._creationProperties[fieldName] ;
+ }
}
- }
+
tmp.parent = parentPeerNode ;
parentPeerNode.appendChild(tmp) ;
@@ -158,7 +159,7 @@
}
// The candy in the middle of the wrapper:
- var peer = dojo.widget.createWidget(dojoType,propertyMap,tmp);
+ var peer = dojo.widget.createWidget(dojoType,propertyMap,tmp);
this.setPeer(peer ) ;
}
@@ -209,7 +210,6 @@
shouldResize = true ; ;
}
else if ( name=="x" ) {
- // peer.setLocation( value, null );
peer.domNode.style.left = value ;
shouldResize = true ;
}