Added: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/ProgressBar.js
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/ProgressBar.js?view=auto&rev=474551
==============================================================================
--- 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/ProgressBar.js
 (added)
+++ 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/ProgressBar.js
 Mon Nov 13 14:54:45 2006
@@ -0,0 +1,289 @@
+/*
+       Copyright (c) 2004-2006, The Dojo Foundation
+       All Rights Reserved.
+
+       Licensed under the Academic Free License version 2.1 or above OR the
+       modified BSD license. For more information on Dojo licensing, see:
+
+               http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.widget.ProgressBar");
+
+// requires here
+dojo.require("dojo.widget.*"); // necessary
+dojo.require("dojo.event");
+dojo.require("dojo.dom.*");
+dojo.require("dojo.html.style");
+dojo.require("dojo.string.*");
+dojo.require("dojo.lfx.*");
+
+dojo.widget.defineWidget(
+       "dojo.widget.ProgressBar",
+       dojo.widget.HtmlWidget,
+       {
+               // Constructor arguments
+               progressValue: "0",
+               maxProgressValue: 100,
+               width: 300,
+               height: 30,
+               frontPercentClass: "frontPercent",
+               backPercentClass: "backPercent",
+               frontBarClass: "frontBar",
+               backBarClass: "backBar",
+               hasText: "false",
+               isVertical:"false",
+               showOnlyIntegers: "false",
+               dataSource: "",
+               pollInterval: "3000",
+               duration: "1000",
+//             leftImage: null,
+//             centerImage: null,
+//             rightImage: null,
+               templatePath: 
dojo.uri.dojoUri("src/widget/templates/ProgressBar.html"),
+               templateCssPath: 
dojo.uri.dojoUri("src/widget/templates/ProgressBar.css"),
+               
+       
+               // attach points
+               containerNode: null,
+               internalProgress: null,
+       
+               // private members
+               _pixelUnitRatio: 0.0,
+               // _pixelRatio := width/100
+               _pixelPercentRatio: 0.0,
+               _unitPercentRatio: 0.0,
+               _unitPixelRatio: 0.0,
+               _floatDimension: 0.0,
+               _intDimension: 0,
+               _progressPercentValue: "0%",
+               _floatMaxProgressValue: 0.0,
+               _dimension: "width",
+               _pixelValue: 0,
+               _oInterval: null,
+               _animation: null,
+               _animationStopped: true,
+               _progressValueBak: false,
+               _hasTextBak: false,
+               // public functions
+               fillInTemplate: function(args, frag){
+                       this.internalProgress.className = this.frontBarClass;
+                       this.containerNode.className = this.backBarClass;
+                       if (this.isVertical == "true"){
+                               this.internalProgress.style.bottom="0px";
+                               this.internalProgress.style.left="0px";
+                               this._dimension = "height";
+                       } else {
+                               this.internalProgress.style.top="0px";
+                               this.internalProgress.style.left="0px";
+                               this._dimension = "width";
+                       }
+                       this.frontPercentLabel.className = 
this.frontPercentClass;
+                       this.backPercentLabel.className = this.backPercentClass;
+                       this.progressValue = "" + this.progressValue; 
+                       this.domNode.style.height = this.height; 
+                       this.domNode.style.width = this.width;
+                       this._intDimension = parseInt("0" + eval("this." + 
this._dimension));
+                       this._floatDimension = parseFloat("0" + 
eval("this."+this._dimension));
+                       this._pixelPercentRatio = this._floatDimension/100;
+                       this.setMaxProgressValue(this.maxProgressValue, true);
+                       
this.setProgressValue(dojo.string.trim(this.progressValue), true);
+                       dojo.debug("float dimension: " + this._floatDimension);
+                       dojo.debug("this._unitPixelRatio: " + 
this._unitPixelRatio);
+                       this.showText(this.hasText);
+               },
+               showText: function(visible){
+                       if (visible == "true"){
+                               this.backPercentLabel.style.display="block";
+                               this.frontPercentLabel.style.display="block";
+                       } else {
+                               this.backPercentLabel.style.display="none";
+                               this.frontPercentLabel.style.display="none";
+                       }
+                       this.hasText = visible;
+               },
+               postCreate: function(args, frag){
+                       // labels position
+                       this.render();
+               },
+               _backupValues: function(){
+                       this._progressValueBak = this.progressValue;
+                       this._hasTextBak = this.hasText;
+               },
+               _restoreValues: function(){
+                               this.setProgressValue(this._progressValueBak);
+                               this.showText(this._hasTextBak);
+               },
+               _setupAnimation: function(){
+                       var _self = this;
+                       dojo.debug("internalProgress width: " + 
this.internalProgress.style.width);
+                       this._animation = 
dojo.lfx.html.slideTo(this.internalProgress, 
+                               {top: 0, left: 
this.width-parseInt(this.internalProgress.style.width)}, 
parseInt(this.duration), null, 
+                                       function(){
+                                               var _backAnim = 
dojo.lfx.html.slideTo(_self.internalProgress, 
+                                               { top: 0, left: 0 }, 
parseInt(_self.duration));
+                                               dojo.event.connect(_backAnim, 
"onEnd", function(){
+                                                       if 
(!_self._animationStopped){
+                                                               
_self._animation.play();
+                                                       }
+                                                       });
+                                               if (!_self._animationStopped){
+                                                       _backAnim.play();
+                                               }
+                                               _backAnim = null; // <-- to 
avoid memory leaks in IE
+                                       }
+                               );
+               },
+               getMaxProgressValue: function(){
+                       return this.maxProgressValue;
+               },
+               setMaxProgressValue: function(maxValue, noRender){
+                       if (!this._animationStopped){
+                               return;
+                       }
+                       this.maxProgressValue = maxValue;
+                       this._floatMaxProgressValue = parseFloat("0" + 
this.maxProgressValue);
+                       this._pixelUnitRatio = 
this._floatDimension/this.maxProgressValue;
+                       this._unitPercentRatio = 
this._floatMaxProgressValue/100;
+                       this._unitPixelRatio = 
this._floatMaxProgressValue/this._floatDimension;
+                       this.setProgressValue(this.progressValue, true);
+                       if (!noRender){
+                               this.render();
+                       }
+               },
+               setProgressValue: function(value, noRender){
+                       if (!this._animationStopped){
+                               return;
+                       }
+                       // transformations here
+                       this._progressPercentValue = "0%";
+                       var _value=dojo.string.trim("" + value);
+                       var _floatValue = parseFloat("0" + _value);
+                       var _intValue = parseInt("0" + _value);
+                       var _pixelValue = 0;
+                       if (dojo.string.endsWith(_value, "%", false)){
+                               this._progressPercentValue = 
Math.min(_floatValue.toFixed(1), 100) + "%";
+                               _value = 
Math.min((_floatValue)*this._unitPercentRatio, this.maxProgressValue);
+                               _pixelValue = 
Math.min((_floatValue)*this._pixelPercentRatio, eval("this."+this._dimension));
+                       } else {
+                               this.progressValue = Math.min(_floatValue, 
this.maxProgressValue);
+                               this._progressPercentValue = 
Math.min((_floatValue/this._unitPercentRatio).toFixed(1), 100) + "%";
+                               _pixelValue = 
Math.min(_floatValue/this._unitPixelRatio, eval("this."+this._dimension));
+                       }
+                       this.progressValue = dojo.string.trim(_value);
+                       this._pixelValue = _pixelValue;
+                       if (!noRender){
+                               this.render();
+                       }
+               },
+               setCurrentPercentProgress: function(percentProgress){
+                       this._setCurrentPixelProgress(percentProgress);
+               },
+               getProgressValue: function(){
+                       return this.progressValue;
+               },
+               getProgressPercentValue: function(){
+                       return this._progressPercentValue;
+               },
+               setDataSource: function(dataSource){
+                       this.dataSource = dataSource;
+               },
+               setPollInterval: function(pollInterval){
+                       this.pollInterval = pollInterval;
+               },
+               start: function(){
+                       var _showFunction = dojo.lang.hitch(this, 
this._showRemoteProgress);
+                       this._oInterval = setInterval(_showFunction, 
this.pollInterval);
+               },
+               startAnimation: function(){
+                       if (this._animationStopped) {
+                               this._backupValues();
+                               this.setProgressValue("10%");
+                               this._animationStopped = false;
+                               this._setupAnimation();
+                               this.showText(false);
+                               this.internalProgress.style.height="105%";
+                               this._animation.play();
+                       }
+               },
+               stopAnimation: function(){
+                       if (this._animation) {
+                               this._animationStopped = true;
+                               this._animation.stop();
+                               this.internalProgress.style.height="100%";
+                               this.internalProgress.style.left = "0px";
+                               this._restoreValues();
+                               this._setLabelPosition();
+                       }
+               },
+               _showRemoteProgress: function(){
+                       var _self = this;
+//                     dojo.debug("getMax: "+this.getMaxProgressValue()+" 
getprval: "+this.getProgressValue());
+                       if ( (this.getMaxProgressValue() == 
this.getProgressValue()) &&
+                               this._oInterval){
+                               clearInterval(this._oInterval);
+                               this._oInterval = null;
+                               this.setProgressValue("100%");
+                               return; 
+                       }
+                       var bArgs = {
+                               url: _self.dataSource,
+                               method: "POST",
+                               mimetype: "text/json",
+                               error: function(type, errorObj){
+                                       dojo.debug("[ProgressBar] 
showRemoteProgress error");
+                               },
+                               load: function(type, data, evt){
+                                       //dojo.debug(data["progress"]);
+                                       _self.setProgressValue(
+                                               (_self._oInterval ? 
data["progress"] : "100%")
+                                       );
+//                             dojo.debug("_oInterval: "+_self._oInterval);
+                               }
+                       };
+                       dojo.io.bind(bArgs);
+               },
+               render: function(){
+                       
this._setPercentLabel(dojo.string.trim(this._progressPercentValue));
+                       this._setPixelValue(this._pixelValue);
+                       this._setLabelPosition();
+               },
+               // private functions
+               _setLabelPosition: function(){
+                       var _widthFront = 
+                               
dojo.html.getContentBox(this.frontPercentLabel).width;
+                       var _heightFront = 
+                               
dojo.html.getContentBox(this.frontPercentLabel).height;
+                       var _widthBack = 
+                               
dojo.html.getContentBox(this.backPercentLabel).width;
+                       var _heightBack = 
+                               
dojo.html.getContentBox(this.backPercentLabel).height;
+                       var _leftFront = (this.width - _widthFront)/2 + "px";
+                       var _bottomFront = (parseInt(this.height) - 
parseInt(_heightFront))/2 + "px";
+                       var _leftBack = (this.width - _widthBack)/2 + "px";
+                       var _bottomBack = (parseInt(this.height) - 
parseInt(_heightBack))/2 + "px";
+                       this.frontPercentLabel.style.left = _leftFront;
+                       this.backPercentLabel.style.left = _leftBack; 
+                       this.frontPercentLabel.style.bottom = _bottomFront;
+                       this.backPercentLabel.style.bottom = _bottomBack; 
+//                     dojo.debug("bottom: 
"+this.backPercentLabel.style.bottom);
+//                     dojo.debug("BOTTOM: "+_bottom);
+               },
+               _setPercentLabel: function(percentValue){
+                       dojo.dom.removeChildren(this.frontPercentLabel);
+                       dojo.dom.removeChildren(this.backPercentLabel);
+                       var _percentValue = this.showOnlyIntegers == "false" ? 
+                               percentValue : parseInt(percentValue) + "%";
+                       this.frontPercentLabel.
+                               
appendChild(document.createTextNode(_percentValue));
+                       this.backPercentLabel.
+                               
appendChild(document.createTextNode(_percentValue));
+               },
+               _setPixelValue: function(value){
+                       eval("this.internalProgress.style." + this._dimension + 
" = " + value + " + 'px'");
+                       this.onChange();
+               },
+               onChange: function(){
+               }
+       });
+       

Propchange: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/ProgressBar.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RadioGroup.js
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RadioGroup.js?view=auto&rev=474551
==============================================================================
--- 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RadioGroup.js
 (added)
+++ 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RadioGroup.js
 Mon Nov 13 14:54:45 2006
@@ -0,0 +1,204 @@
+/*
+       Copyright (c) 2004-2006, The Dojo Foundation
+       All Rights Reserved.
+
+       Licensed under the Academic Free License version 2.1 or above OR the
+       modified BSD license. For more information on Dojo licensing, see:
+
+               http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.widget.RadioGroup");
+
+dojo.require("dojo.lang.common");
+dojo.require("dojo.event.browser");
+dojo.require("dojo.html.selection");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.HtmlWidget");
+
+// summary:
+//     Widget that provides useful/common functionality that may be desirable
+//     when interacting with ul/ol html lists.
+//     
+// The core behaviour of the lists this widget manages is expected to be 
determined
+// by the css class names defined: 
+//     
+//      "radioGroup" - Applied to main ol or ul 
+//      "selected"     - Applied to the currently selected li, if any.
+//   "itemContent" - Applied to the content contained in a li, this widget 
embeds a span 
+//                                     within each <li></li> to contain the 
contents of the li.
+// This widget was mostly developed under supervision/guidance from Tom Trenka.
+dojo.widget.defineWidget(
+       "dojo.widget.RadioGroup", 
+       dojo.widget.HtmlWidget,
+       function(){
+               //      summary
+               //      Initializes all properties for the widget.
+               
+               // Node: Currently selected li, if any
+               this.selectedItem=null;
+               // Node array: Array of li nodes being managed by widget
+               this.items=[];
+               // String array: List of optional ids specifying which li's 
should be selected by default
+               this.selected=[];
+               
+               // String: Css class applied to main ol or ul, value is 
"radioGroup"
+               this.groupCssClass="radioGroup";
+               // String: Css class applied to the currently selected li, if 
any. value of "selected"
+               this.selectedCssClass="selected";
+               // String: Css class Applied to the content contained in a li, 
this widget embeds a span 
+               // within each <li></li> to contain the contents of the li. 
value is "itemContent"
+               this.itemContentCssClass="itemContent";
+       },
+       {
+               isContainer:false,
+               templatePath: null,
+               templateCssPath: null,
+               
+               postCreate:function(){
+                       // summary: Parses content of widget and sets up the 
default state of any 
+                       // default selections / etc. The onSelect function will 
also be fired for any
+                       // default selections.
+                       this.parseStructure();
+                       dojo.html.addClass(this.domNode, this.groupCssClass);
+                       this.setupChildren();
+                       
+                       dojo.event.browser.addListener(this.domNode, "onclick", 
dojo.lang.hitch(this, "onSelect"));
+                       if (this.selectedItem){
+                               this.selectItem(this.selectedItem);
+                       }
+               },
+               
+               parseStructure:function() {
+                       // summary: Sets local radioGroup and items properties, 
also validates
+                   // that domNode contains an expected list.
+                   // 
+                   // Exception raised if a ul or ol node can't be found in 
this widgets domNode.
+                       if(this.domNode.tagName.toLowerCase() != "ul" 
+                               && this.domNode.tagName.toLowerCase() != "ol") {
+                               dojo.raise("RadioGroup: Expected ul or ol 
content.");
+                               return;
+                       }
+                       
+                       this.items=[];  //      reset the items.
+                       var nl=this.domNode.getElementsByTagName("li");
+                       for (var i=0; i<nl.length; i++){
+                               if(nl[i].parentNode==this.domNode){
+                                       this.items.push(nl[i]);
+                               }
+                       }
+               },
+               
+               add:function(node){
+                       // summary: Allows the app to add a node on the fly, 
finishing up
+                   // the setup so that we don't need to deal with it on a
+                   // widget-wide basis.
+                       if(node.parentNode!=this.domNode){
+                               this.domNode.appendChild(node);
+                       }
+                       this.items.push(node);
+                       this.setup(node);
+               },
+               
+               remove:function(node){
+                       // summary: Removes the specified node from this group, 
if it exists.
+                       var idx=-1;
+                       for(var i=0; i<this.items.length; i++){
+                               if(this.items[i]==node){
+                                       idx=i;
+                                       break;
+                               }
+                       }
+                       if(idx<0) {return;}
+                       this.items.splice(idx,1);
+                       node.parentNode.removeChild(node);
+               },
+               
+               clear:function(){
+                       // summary: Removes all items in this list
+                       for(var i=0; i<this.items.length; i++){
+                               this.domNode.removeChild(this.items[i]);
+                       }
+                       this.items=[];
+               },
+               
+               clearSelections:function(){
+                       // summary: Clears any selected items from being 
selected
+                       for(var i=0; i<this.items.length; i++){
+                               dojo.html.removeClass(this.items[i], 
this.selectedCssClass);
+                       }
+                       this.selectedItem=null;
+               },
+               
+               setup:function(node){
+                       var span = document.createElement("span");
+                       dojo.html.disableSelection(span);
+                       dojo.html.addClass(span, this.itemContentCssClass);
+                       dojo.dom.moveChildren(node, span);
+                       node.appendChild(span);
+                       
+                       if (this.selected.length > 0) {
+                               var uid = dojo.html.getAttribute(node, "id");
+                               if (uid && uid == this.selected){
+                                       this.selectedItem = node;
+                               }
+                       }
+                       dojo.event.browser.addListener(node, "onclick", 
dojo.lang.hitch(this, "onItemSelect"));
+                       if (dojo.html.hasAttribute(node, "onitemselect")) {
+                               var tn = dojo.lang.nameAnonFunc(new 
Function(dojo.html.getAttribute(node, "onitemselect")), 
+                                                                               
                this);
+                               dojo.event.browser.addListener(node, "onclick", 
dojo.lang.hitch(this, tn));
+                       }
+               },
+               
+               setupChildren:function(){
+                       for (var i=0; i<this.items.length; i++){
+                               this.setup(this.items[i]);
+                       }
+               },
+               
+               selectItem:function(node, event, nofire){
+                       // summary: Sets the selectedItem to passed in node, 
applies
+                       // css selection class on new item
+                       if(this.selectedItem){
+                               dojo.html.removeClass(this.selectedItem, 
this.selectedCssClass);
+                       }
+                       
+                       this.selectedItem = node;
+                       dojo.html.addClass(this.selectedItem, 
this.selectedCssClass);
+                       
+                       // if this is the result of an event, stop here.
+                       if (!dj_undef("currentTarget", event)){
+                               return;
+                       }
+                       
+                       //      if there's no nofire flag, passed when this is 
nailed internally.
+                       if(!nofire){
+                               if(dojo.render.html.ie){
+                                       this.selectedItem.fireEvent("onclick");
+                               }else{
+                                       var e = 
document.createEvent("MouseEvents");
+                                       e.initEvent("click", true, false);
+                                       this.selectedItem.dispatchEvent(e);
+                               }
+                       }
+               },
+               
+               getValue:function() {
+                       // summary: Gets the currently selected item, if any.
+                       return this.selectedItem; /*Node*/
+               },
+               
+               onSelect:function(e) { 
+                       // summary: When the ul or ol contained by this widget 
is selected this function
+                       // is fired. A good function to listen to via 
dojo.event.connect. 
+               },
+               
+               onItemSelect:function(e) {
+                       // summary: when an individual li is selected
+                       if (!dj_undef("currentTarget", e)){
+                               this.selectItem(e.currentTarget, e);
+                       }
+               }
+       }
+);

Propchange: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RadioGroup.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RealNumberTextbox.js
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RealNumberTextbox.js?view=auto&rev=474551
==============================================================================
--- 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RealNumberTextbox.js
 (added)
+++ 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RealNumberTextbox.js
 Mon Nov 13 14:54:45 2006
@@ -0,0 +1,73 @@
+/*
+       Copyright (c) 2004-2006, The Dojo Foundation
+       All Rights Reserved.
+
+       Licensed under the Academic Free License version 2.1 or above OR the
+       modified BSD license. For more information on Dojo licensing, see:
+
+               http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.widget.RealNumberTextbox");
+
+dojo.require("dojo.widget.IntegerTextbox");
+dojo.require("dojo.validate.common");
+
+/*
+  ****** RealNumberTextbox ******
+
+  A subclass that extends IntegerTextbox.
+  Over-rides isValid/isInRange to test for real number input.
+  Has 5 new properties that can be specified as attributes in the markup.
+
+  @attr places    The exact number of decimal places.  If omitted, it's 
unlimited and optional.
+  @attr exponent  Can be true or false.  If omitted the exponential part is 
optional.
+  @attr eSigned   Is the exponent signed?  Can be true or false, if omitted 
the sign is optional.
+  @attr min  Minimum signed value.  Default is -Infinity
+  @attr max  Maximum signed value.  Default is +Infinity
+*/
+dojo.widget.defineWidget(
+       "dojo.widget.RealNumberTextbox",
+       dojo.widget.IntegerTextbox,
+       {
+               mixInProperties: function(localProperties, frag){
+                       // First initialize properties in super-class.
+                       
dojo.widget.RealNumberTextbox.superclass.mixInProperties.apply(this, arguments);
+       
+                       // Get properties from markup attributes, and assign to 
flags object.
+                       if (localProperties.places){ 
+                               this.flags.places = 
Number(localProperties.places);
+                       }
+                       if((localProperties.exponent == "true")||
+                               (localProperties.exponent == "always")){
+                               this.flags.exponent = true;
+                       }else if((localProperties.exponent == 
"false")||(localProperties.exponent == "never")){
+                               this.flags.exponent = false;
+                       }else{
+                               this.flags.exponent = [ true, false ]; // 
optional
+                       }
+                       if((localProperties.esigned == 
"true")||(localProperties.esigned == "always")){
+                               this.flags.eSigned = true;
+                       }else if((localProperties.esigned == 
"false")||(localProperties.esigned == "never")){
+                               this.flags.eSigned = false;
+                       }else{
+                               this.flags.eSigned = [ true, false ]; // 
optional
+                       }
+                       if(localProperties.min){ 
+                               this.flags.min = 
parseFloat(localProperties.min);
+                       }
+                       if(localProperties.max){ 
+                               this.flags.max = 
parseFloat(localProperties.max);
+                       }
+               },
+
+               // Over-ride for real number validation
+               isValid: function(){
+                       return dojo.validate.isRealNumber(this.textbox.value, 
this.flags);
+               },
+               isInRange: function(){
+                       return dojo.validate.isInRange(this.textbox.value, 
this.flags);
+               }
+
+       }
+);

Propchange: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RealNumberTextbox.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RegexpTextbox.js
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RegexpTextbox.js?view=auto&rev=474551
==============================================================================
--- 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RegexpTextbox.js
 (added)
+++ 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RegexpTextbox.js
 Mon Nov 13 14:54:45 2006
@@ -0,0 +1,48 @@
+/*
+       Copyright (c) 2004-2006, The Dojo Foundation
+       All Rights Reserved.
+
+       Licensed under the Academic Free License version 2.1 or above OR the
+       modified BSD license. For more information on Dojo licensing, see:
+
+               http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.widget.RegexpTextbox");
+
+dojo.require("dojo.widget.ValidationTextbox");
+
+/*
+  ****** RegexpTextbox ******
+
+  A subclass of ValidationTextbox.
+  Over-rides isValid to test input based on a regular expression.
+  Has a new property that can be specified as attributes in the markup. 
+
+  @attr regexp     The regular expression string to use
+  @attr flags      Flags to pass to the regular expression (e.g. 'i', 'g', etc)
+*/
+dojo.widget.defineWidget(
+       "dojo.widget.RegexpTextbox",
+       dojo.widget.ValidationTextbox,
+       {
+           mixInProperties: function(localProperties, frag){
+               // First initialize properties in super-class.
+               
dojo.widget.RegexpTextbox.superclass.mixInProperties.apply(this, arguments);
+
+               // Get properties from markup attibutes, and assign to flags 
object.
+               if(localProperties.regexp){
+                   this.flags.regexp = localProperties.regexp;
+               }
+               if(localProperties.flags){
+                   this.flags.flags = localProperties.flags;
+               }
+           },
+
+           // Over-ride for integer validation
+           isValid: function(){
+               var regexp = new RegExp(this.flags.regexp, this.flags.flags);
+               return regexp.test(this.textbox.value);
+           }
+       }
+);

Propchange: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RegexpTextbox.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RemoteTabController.js
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RemoteTabController.js?view=auto&rev=474551
==============================================================================
--- 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RemoteTabController.js
 (added)
+++ 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RemoteTabController.js
 Mon Nov 13 14:54:45 2006
@@ -0,0 +1,50 @@
+/*
+       Copyright (c) 2004-2006, The Dojo Foundation
+       All Rights Reserved.
+
+       Licensed under the Academic Free License version 2.1 or above OR the
+       modified BSD license. For more information on Dojo licensing, see:
+
+               http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.widget.RemoteTabController");
+
+//Summary
+//Remote Tab Controller widget.  Can be located independently of a tab
+//container and control the selection of its tabs
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.TabContainer");
+dojo.require("dojo.event.*");
+
+dojo.deprecated("dojo.widget.RemoteTabController is slated for removal in 0.5; 
use PageController or TabController instead.", "0.5");
+
+dojo.widget.defineWidget(
+    "dojo.widget.RemoteTabController",
+    dojo.widget.TabController,
+       {
+        templateCssPath: 
dojo.uri.dojoUri("src/widget/templates/RemoteTabControl.css"),
+               templateString: '<div dojoAttachPoint="domNode" 
wairole="tablist"></div>',
+
+               "class": "dojoRemoteTabController",
+
+               // String
+               //      ID of page container that I connect to
+               tabContainer: "",
+       
+               postMixInProperties: function(){
+                       this.containerId = this.tabContainer;
+                       
dojo.widget.RemoteTabController.superclass.postMixInProperties.apply(this, 
arguments);
+               },
+                       
+               fillInTemplate: function() {
+                       dojo.html.addClass(this.domNode, this["class"]);  // 
"class" is a reserved word in JS
+
+                       if (this.tabContainer) {
+                               dojo.addOnLoad(dojo.lang.hitch(this, 
"setupTabs"));
+                       }
+
+                       
dojo.widget.RemoteTabController.superclass.fillInTemplate.apply(this, 
arguments);
+               }
+       }
+);

Propchange: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/RemoteTabController.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Repeater.js
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Repeater.js?view=auto&rev=474551
==============================================================================
--- 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Repeater.js
 (added)
+++ 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Repeater.js
 Mon Nov 13 14:54:45 2006
@@ -0,0 +1,140 @@
+/*
+       Copyright (c) 2004-2006, The Dojo Foundation
+       All Rights Reserved.
+
+       Licensed under the Academic Free License version 2.1 or above OR the
+       modified BSD license. For more information on Dojo licensing, see:
+
+               http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.widget.Repeater");
+dojo.require("dojo.widget.HtmlWidget");
+dojo.require("dojo.string");
+dojo.require("dojo.event.*");
+dojo.require("dojo.experimental");
+dojo.experimental("dojo.widget.Repeater");
+
+dojo.widget.defineWidget("dojo.widget.Repeater", dojo.widget.HtmlWidget,
+       {
+               name: "",
+               rowTemplate: "",
+               myObject: null,
+               pattern: "",
+               useDnd: false,
+               isContainer: true,
+
+               initialize: function(args,frag) {
+                       var node = this.getFragNodeRef(frag);
+                       node.removeAttribute("dojotype");
+                       this.setRow(dojo.string.trim(node.innerHTML), {});
+                       node.innerHTML="";
+                       frag=null;
+               },
+
+               postCreate: function(args,frag){
+                       if (this.useDnd) {
+                               dojo.require("dojo.dnd.*");
+                               var dnd = new 
dojo.dnd.HtmlDropTarget(this.domNode, [this.widgetId]);
+                       }
+               },
+
+               reIndexRows: function() {
+                       for(var i=0,len=this.domNode.childNodes.length; 
i<len;i++) {
+                               var elems = ["INPUT", "SELECT", "TEXTAREA"];
+                               for (var k=0; k < elems.length; k++) {
+                                       var list = 
this.domNode.childNodes[i].getElementsByTagName(elems[k]);
+                                       for (var j=0,len2=list.length; j<len2; 
j++) {
+                                               var name = list[j].name;
+                                               var 
index=dojo.string.escape("regexp", this.pattern);
+                                               index = 
index.replace(/%\\{index\\}/g,"%{index}");
+                                               var nameRegexp = 
dojo.string.substituteParams(index, {"index": "[0-9]*"});
+                                               var newName= 
dojo.string.substituteParams(this.pattern, {"index": "" + i});
+                                               var re=new 
RegExp(nameRegexp,"g");
+                                               list[j].name = 
name.replace(re,newName);
+                                       }
+                               }
+                       }
+               },
+
+               onDeleteRow: function(e) {
+                       var index=dojo.string.escape("regexp", this.pattern);
+                       index = index.replace(/%\\{index\\}/g,"%{index}");
+                       var nameRegexp = dojo.string.substituteParams(index, 
{"index": "([0-9]*)"});
+                       var re=new RegExp(nameRegexp,"g");
+                       this.deleteRow(re.exec(e.target.name)[1]);
+               },
+               hasRows: function() {
+                       if (this.domNode.childNodes.length > 0) {
+                               return true;
+                       }
+                       return false;
+               },
+
+               getRowCount: function() {
+                       return this.domNode.childNodes.length;
+               },
+
+               deleteRow: function(idx) {
+                       this.domNode.removeChild(this.domNode.childNodes[idx]);
+                       this.reIndexRows();
+               },
+
+               changeRowPosition: function(e) {
+                       if (e.dragStatus == "dropFailure") {
+                               
this.domNode.removeChild(e["dragSource"].domNode);
+                       } else if (e.dragStatus == "dropSuccess") {
+                               //  nothing to do
+                       } // else-if
+                       this.reIndexRows();
+               },
+               setRow: function(template, myObject) {
+                       template = dojo.string.substituteParams(template, 
{"index": "0"});
+                       this.rowTemplate=template;
+                       this.myObject = myObject;
+               },
+               getRow: function() {
+                       return this.rowTemplate;
+               },
+               onAddRow: function(e) {
+               },
+               addRow: function() {
+                       var node = document.createElement('span');
+                       node.innerHTML=this.getRow();
+                       if (node.childNodes.length == 1) {
+                               node=node.childNodes[0];
+                       }
+                       this.domNode.appendChild(node);
+                       var parser = new dojo.xml.Parse();
+                       var frag = parser.parseElement(node, null, true);
+                       dojo.widget.getParser().createSubComponents(frag, this);
+                       var elems = ["INPUT", "SELECT", "IMG"];
+                       for (var k=0; k < elems.length; k++) {
+                               var list = node.getElementsByTagName(elems[k]);
+                               for(var i=0, len=list.length; i<len; i++) {
+                                       var child = list[i];
+                                       if(child.nodeType != 1) {continue};
+                                       if (child.getAttribute("rowFunction") 
!= null) {
+                                               
if(typeof(this.myObject[child.getAttribute("rowFunction")]) == "undefined") {
+                                                       dojo.debug("Function " 
+ child.getAttribute("rowFunction") + " not found");
+                                               } else { 
+                                                       
this.myObject[child.getAttribute("rowFunction")](child);
+                                               }
+                                       } else if 
(child.getAttribute("rowAction") != null) {
+                                               
if(child.getAttribute("rowAction") == "delete") {
+                                                       
child.name=dojo.string.substituteParams(this.pattern, {"index": "0"});
+                                                       
dojo.event.connect(child, "onclick", this, "onDeleteRow");
+                                               } // if
+                                       } // else-if
+                               } // for
+                       } // for
+                       this.reIndexRows();
+                       if (this.useDnd) { // bind to DND
+                               node=new dojo.dnd.HtmlDragSource(node, 
this.widgetId);
+                               dojo.event.connect(node, "onDragEnd", this, 
"changeRowPosition");
+                       }
+                       this.onAddRow();
+               }
+});
+
+

Propchange: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/Repeater.js
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizableTextarea.js
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizableTextarea.js?view=diff&rev=474551&r1=474550&r2=474551
==============================================================================
--- 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizableTextarea.js
 (original)
+++ 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizableTextarea.js
 Mon Nov 13 14:54:45 2006
@@ -1,5 +1,5 @@
 /*
-       Copyright (c) 2004-2005, The Dojo Foundation
+       Copyright (c) 2004-2006, The Dojo Foundation
        All Rights Reserved.
 
        Licensed under the Academic Free License version 2.1 or above OR the
@@ -9,24 +9,16 @@
 */
 
 dojo.provide("dojo.widget.ResizableTextarea");
-dojo.require("dojo.html");
 dojo.require("dojo.widget.*");
-dojo.require("dojo.widget.LayoutPane");
+dojo.require("dojo.widget.LayoutContainer");
 dojo.require("dojo.widget.ResizeHandle");
 
-dojo.widget.tags.addParseTreeHandler("dojo:resizabletextarea");
-
-dojo.widget.ResizableTextarea = function(){
-       dojo.widget.HtmlWidget.call(this);
-}
-
-dojo.inherits(dojo.widget.ResizableTextarea, dojo.widget.HtmlWidget);
-
-dojo.lang.extend(dojo.widget.ResizableTextarea, {
-       templatePath: 
dojo.uri.dojoUri("src/widget/templates/HtmlResizableTextarea.html"),
-       templateCssPath: 
dojo.uri.dojoUri("src/widget/templates/HtmlResizableTextarea.css"),
-       widgetType: "ResizableTextarea",
-       tagName: "dojo:resizabletextarea",
+dojo.widget.defineWidget(
+       "dojo.widget.ResizableTextarea",
+       dojo.widget.HtmlWidget,
+{
+       templatePath: 
dojo.uri.dojoUri("src/widget/templates/ResizableTextarea.html"),
+       templateCssPath: 
dojo.uri.dojoUri("src/widget/templates/ResizableTextarea.css"),
        isContainer: false,
        textAreaNode: null,
        textAreaContainer: null,
@@ -43,10 +35,10 @@
                this.textAreaNode = this.getFragNodeRef(frag).cloneNode(true);
 
                // FIXME: Safari apparently needs this!
-               document.body.appendChild(this.domNode);
+               dojo.body().appendChild(this.domNode);
 
                this.rootLayout = dojo.widget.createWidget(
-                       "LayoutPane",
+                       "LayoutContainer",
                        {
                                minHeight: 50,
                                minWidth: 100
@@ -56,7 +48,7 @@
 
 
                this.textAreaContainer = dojo.widget.createWidget(
-                       "LayoutPane",
+                       "LayoutContainer",
                        { layoutAlign: "client" },
                        this.textAreaContainerNode
                );
@@ -69,7 +61,7 @@
                }
 
                this.statusBar = dojo.widget.createWidget(
-                       "LayoutPane",
+                       "LayoutContainer",
                        { 
                                layoutAlign: "bottom", 
                                minHeight: 28
@@ -79,7 +71,7 @@
                this.rootLayout.addChild(this.statusBar);
 
                this.statusLabel = dojo.widget.createWidget(
-                       "LayoutPane",
+                       "LayoutContainer",
                        { 
                                layoutAlign: "client", 
                                minWidth: 50

Modified: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizeHandle.js
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizeHandle.js?view=diff&rev=474551&r1=474550&r2=474551
==============================================================================
--- 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizeHandle.js
 (original)
+++ 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizeHandle.js
 Mon Nov 13 14:54:45 2006
@@ -1,5 +1,5 @@
 /*
-       Copyright (c) 2004-2005, The Dojo Foundation
+       Copyright (c) 2004-2006, The Dojo Foundation
        All Rights Reserved.
 
        Licensed under the Academic Free License version 2.1 or above OR the
@@ -9,44 +9,24 @@
 */
 
 dojo.provide("dojo.widget.ResizeHandle");
-dojo.provide("dojo.widget.html.ResizeHandle");
 
 dojo.require("dojo.widget.*");
-dojo.require("dojo.html");
-dojo.require("dojo.style");
-dojo.require("dojo.dom");
-dojo.require("dojo.event");
-
-dojo.widget.html.ResizeHandle = function(){
-       dojo.widget.HtmlWidget.call(this);
-}
-
-dojo.inherits(dojo.widget.html.ResizeHandle, dojo.widget.HtmlWidget);
-
-dojo.lang.extend(dojo.widget.html.ResizeHandle, {
-       widgetType: "ResizeHandle",
+dojo.require("dojo.html.layout");
+dojo.require("dojo.event.*");
 
+dojo.widget.defineWidget(
+       "dojo.widget.ResizeHandle",
+       dojo.widget.HtmlWidget,
+{
        isSizing: false,
        startPoint: null,
        startSize: null,
-
-       grabImg: null,
+       minSize: null,
 
        targetElmId: '',
-       imgSrc: dojo.uri.dojoUri("src/widget/templates/grabCorner.gif"),
-
-       templateCssPath: 
dojo.uri.dojoUri("src/widget/templates/HtmlResizeHandle.css"),
-       templateString: '<div dojoAttachPoint="domNode"><img 
dojoAttachPoint="grabImg" /></div>',
-
-       fillInTemplate: function(){
-
-               dojo.style.insertCssFile(this.templateCssPath);
 
-               dojo.html.addClass(this.domNode, 'dojoHtmlResizeHandle');
-               dojo.html.addClass(this.grabImg, 'dojoHtmlResizeHandleImage');
-
-               this.grabImg.src = this.imgSrc;
-       },
+       templateCssPath: 
dojo.uri.dojoUri("src/widget/templates/ResizeHandle.css"),
+       templateString: '<div class="dojoHtmlResizeHandle"><div></div></div>',
 
        postCreate: function(){
                dojo.event.connect(this.domNode, "onmousedown", this, 
"beginSizing");
@@ -55,24 +35,24 @@
        beginSizing: function(e){
                if (this.isSizing){ return false; }
 
-               this.targetElm = dojo.widget.byId(this.targetElmId);
-               if (!this.targetElm){ return; }
-
-               var screenX = window.event ? window.event.clientX : e.pageX;
-               var screenY = window.event ? window.event.clientY : e.pageY;
+               // get the target dom node to adjust.  targetElmId can refer to 
either a widget or a simple node
+               this.targetWidget = dojo.widget.byId(this.targetElmId);
+               this.targetDomNode = this.targetWidget ? 
this.targetWidget.domNode : dojo.byId(this.targetElmId);
+               if (!this.targetDomNode){ return; }
 
                this.isSizing = true;
                this.startPoint  = {'x':e.clientX, 'y':e.clientY};
-               this.startSize  = 
{'w':dojo.style.getOuterWidth(this.targetElm.domNode), 
'h':dojo.style.getOuterHeight(this.targetElm.domNode)};
+               var mb = dojo.html.getMarginBox(this.targetDomNode);
+               this.startSize  = {'w':mb.width, 'h':mb.height};
 
                dojo.event.kwConnect({
-                       srcObj: dojo.html.body(), 
+                       srcObj: dojo.body(), 
                        srcFunc: "onmousemove",
                        targetObj: this,
                        targetFunc: "changeSizing",
                        rate: 25
                });
-               dojo.event.connect(dojo.html.body(), "onmouseup", this, 
"endSizing");
+               dojo.event.connect(dojo.body(), "onmouseup", this, "endSizing");
 
                e.preventDefault();
        },
@@ -80,22 +60,44 @@
        changeSizing: function(e){
                // On IE, if you move the mouse above/to the left of the object 
being resized,
                // sometimes clientX/Y aren't set, apparently.  Just ignore the 
event.
-               if(!e.clientX  || !e.clientY){ return; }
+               try{
+                       if(!e.clientX  || !e.clientY){ return; }
+               }catch(e){
+                       // sometimes you get an exception accessing above 
fields...
+                       return;
+               }
                var dx = this.startPoint.x - e.clientX;
                var dy = this.startPoint.y - e.clientY;
-               this.targetElm.resizeTo(this.startSize.w - dx, this.startSize.h 
- dy);
-
+               
+               var newW = this.startSize.w - dx;
+               var newH = this.startSize.h - dy;
+
+               // minimum size check
+               if (this.minSize) {
+                       var mb = dojo.html.getMarginBox(this.targetDomNode);
+                       if (newW < this.minSize.w) {
+                               newW = mb.width;
+                       }
+                       if (newH < this.minSize.h) {
+                               newH = mb.height;
+                       }
+               }
+               
+               if(this.targetWidget){
+                       this.targetWidget.resizeTo(newW, newH);
+               }else{
+                       dojo.html.setMarginBox(this.targetDomNode, { width: 
newW, height: newH});
+               }
+               
                e.preventDefault();
        },
 
        endSizing: function(e){
-               dojo.event.disconnect(dojo.html.body(), "onmousemove", this, 
"changeSizing");
-               dojo.event.disconnect(dojo.html.body(), "onmouseup", this, 
"endSizing");
+               dojo.event.disconnect(dojo.body(), "onmousemove", this, 
"changeSizing");
+               dojo.event.disconnect(dojo.body(), "onmouseup", this, 
"endSizing");
 
                this.isSizing = false;
        }
 
 
 });
-
-dojo.widget.tags.addParseTreeHandler("dojo:ResizeHandle");


Reply via email to