From xap-commits-return-410-apmail-incubator-xap-commits-archive=incubator.apache.org@incubator.apache.org Fri Sep 01 19:27:36 2006 Return-Path: Delivered-To: apmail-incubator-xap-commits-archive@locus.apache.org Received: (qmail 17045 invoked from network); 1 Sep 2006 19:27:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Sep 2006 19:27:36 -0000 Received: (qmail 97189 invoked by uid 500); 1 Sep 2006 19:27:35 -0000 Delivered-To: apmail-incubator-xap-commits-archive@incubator.apache.org Received: (qmail 97166 invoked by uid 500); 1 Sep 2006 19:27:35 -0000 Mailing-List: contact xap-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: xap-dev@incubator.apache.org Delivered-To: mailing list xap-commits@incubator.apache.org Received: (qmail 97157 invoked by uid 99); 1 Sep 2006 19:27:35 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Sep 2006 12:27:35 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Sep 2006 12:27:33 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 3BE9A1A981A; Fri, 1 Sep 2006 12:27:13 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r439431 - in /incubator/xap/trunk/src: dojo/src/widget/ xap/bridges/dojo/ xap/components/dojo/ xap/taghandling/ Date: Fri, 01 Sep 2006 19:27:11 -0000 To: xap-commits@incubator.apache.org From: jmargaris@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060901192713.3BE9A1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: jmargaris Date: Fri Sep 1 12:27:10 2006 New Revision: 439431 URL: http://svn.apache.org/viewvc?rev=439431&view=rev Log: new widgets and examples Added: incubator/xap/trunk/src/xap/bridges/dojo/PasswordFieldBridge.js (with props) incubator/xap/trunk/src/xap/bridges/dojo/TextAreaBridge.js (with props) incubator/xap/trunk/src/xap/bridges/dojo/TextFieldBridge.js (with props) incubator/xap/trunk/src/xap/components/dojo/TextField.js (with props) Modified: incubator/xap/trunk/src/dojo/src/widget/TabContainer.js incubator/xap/trunk/src/xap/bridges/dojo/SplitPaneBridge.js incubator/xap/trunk/src/xap/bridges/dojo/TabBridge.js incubator/xap/trunk/src/xap/bridges/dojo/TabPaneBridge.js incubator/xap/trunk/src/xap/components/dojo/BorderPanel.js incubator/xap/trunk/src/xap/taghandling/plugin.xml Modified: incubator/xap/trunk/src/dojo/src/widget/TabContainer.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/widget/TabContainer.js?rev=439431&r1=439430&r2=439431&view=diff ============================================================================== --- incubator/xap/trunk/src/dojo/src/widget/TabContainer.js (original) +++ incubator/xap/trunk/src/dojo/src/widget/TabContainer.js Fri Sep 1 12:27:10 2006 @@ -84,7 +84,7 @@ } }, - addChild: function(child, overrideContainerNode, pos, ref, insertIndex){ + addChild: function(child, overrideContainerNode, pos, ref, insertIndex){ this._setupTab(child); dojo.widget.html.TabContainer.superclass.addChild.call(this,child, overrideContainerNode, pos, ref, insertIndex); Added: incubator/xap/trunk/src/xap/bridges/dojo/PasswordFieldBridge.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/PasswordFieldBridge.js?rev=439431&view=auto ============================================================================== --- incubator/xap/trunk/src/xap/bridges/dojo/PasswordFieldBridge.js (added) +++ incubator/xap/trunk/src/xap/bridges/dojo/PasswordFieldBridge.js Fri Sep 1 12:27:10 2006 @@ -0,0 +1,88 @@ +/* + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + /** + * @fileoverview + * + * A bridge class that controls a textfield peer. + */ + +Xap.provide("xap.bridges.dojo.PasswordFieldBridge"); + +Xap.require("xap.bridges.dojo.DojoWidgetBridge"); +Xap.require("xap.components.dojo.PasswordField"); +Xap.require("xap.session.ClientEvent"); + + /** + * @fileoverview + * + * A bridge class with dojo toolkit box panel peer. + */ + +xap.bridges.dojo.PasswordFieldBridge= function() { + xap.bridges.dojo.DojoWidgetBridge.call(this); +} + + +Xap.setupClassAsSubclassOf( + "xap.bridges.dojo.PasswordFieldBridge", + "xap.bridges.dojo.DojoWidgetBridge" +); + + + +xap.bridges.dojo.PasswordFieldBridge.prototype.init = function() { + this.superclass.init.call(this); + + //add listener last so we don't fire for the initial set + dojo.event.connect(this.getPeer(), "onblur",this,"onblur"); +} + +xap.bridges.dojo.PasswordFieldBridge.prototype.getPeerString = function(){ + return "PasswordField" ; +} + + +/** + * + * + * Attribute definitions + * + */ + + +/** + * No new dynamic attributes + */ +xap.bridges.dojo.PasswordFieldBridge.prototype.getNewAllowedAttributes = function(){ + return ["text"]; +} + +xap.bridges.dojo.PasswordFieldBridge.prototype.setTextAttribute = function( value ){ + this.getPeer().setText(value); +} + +xap.bridges.dojo.PasswordFieldBridge.prototype.onblur = function( ){ + var text = this.getPeer().getText(); + this.writeBackAttribute("text",text); + var clientEvent = new xap.session.ClientEvent(this.getElement(),this.getSession()); + clientEvent.text = text; + this.fireEvent("onEdit",null,null,clientEvent); +} + + + Propchange: incubator/xap/trunk/src/xap/bridges/dojo/PasswordFieldBridge.js ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/xap/trunk/src/xap/bridges/dojo/SplitPaneBridge.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/SplitPaneBridge.js?rev=439431&r1=439430&r2=439431&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/bridges/dojo/SplitPaneBridge.js (original) +++ incubator/xap/trunk/src/xap/bridges/dojo/SplitPaneBridge.js Fri Sep 1 12:27:10 2006 @@ -62,14 +62,6 @@ return mappings; } -//TODO we need to use the addchild method instead here -//to add children to the split pane -xp.bridges.dojo.SplitPaneBridge.prototype.getNodeForChildren = function(){ -// This is the large pane in the middle of the widget, and so the best parent for other -// components: - return this.getRootDomNode() ; -} - /** XML attribute set method for "width" */ xap.bridges.dojo.SplitPaneBridge.prototype.setWidthAttribute = function(value){ this.getRootDomNode().style.width = value ; Modified: incubator/xap/trunk/src/xap/bridges/dojo/TabBridge.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/TabBridge.js?rev=439431&r1=439430&r2=439431&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/bridges/dojo/TabBridge.js (original) +++ incubator/xap/trunk/src/xap/bridges/dojo/TabBridge.js Fri Sep 1 12:27:10 2006 @@ -24,7 +24,7 @@ Xap.provide("xap.bridges.dojo.Tab"); Xap.require("xap.bridges.dojo.DojoWidgetBridge"); -Xap.require("dojo.widget.LayoutContainer"); +Xap.require("xap.components.dojo.FreePanel"); @@ -36,6 +36,9 @@ xap.bridges.dojo.TabBridge= function() { xap.bridges.dojo.DojoWidgetBridge.call(this); + + //prevent firing onSelect for tabs that are already selected + this._wasSelected = false; } @@ -46,23 +49,39 @@ -xap.bridges.dojo.TabBridge.prototype.getPeerString = function(){ - return "LayoutContainer" ; -} +xap.bridges.dojo.TabBridge.prototype.init = function() { + this.superclass.init.call(this); + var parentElement = this.getElement().parentNode; + var parentHandler = this.getUiContentHandler().getHandlerForElement( parentElement ); + this._tabContainer = parentHandler.getPeer(); + + //add listener last so we don't fire for the initial set + dojo.event.connect(this._tabContainer, "selectTab",this,"onSelect"); +} +xap.bridges.dojo.TabBridge.prototype.unload = function(){ + dojo.event.disconnect(this._tabContainer, "selectTab",this,"onSelect"); +} -/** - * - * @return an object mapping allowed XAL properties to their Dojo equivalents - */ -xap.bridges.dojo.TabBridge.prototype.getXalToToolkitMapper = function(){ +xap.bridges.dojo.TabBridge.prototype.onSelect = function(){ - //the initial attribute text maps to the label property - var mappings = this.superclass.getXalToToolkitMapper(); - mappings.text = "label"; - return mappings; + if (this._tabContainer.selectedTabWidget == this.getPeer() && !this._wasSelected){ + this.writeBackAttribute("selected","true"); + this.fireEvent("onSelect"); + this._wasSelected = true; + } + else{ + this.writeBackRemoveAttribute("selected"); + this._wasSelected = false; + } +} + + +xap.bridges.dojo.TabBridge.prototype.getPeerString = function(){ + return "FreePanel" ; } + /** * @@ -72,11 +91,23 @@ */ -/** - * No new dynamic attributes - */ xap.bridges.dojo.TabBridge.prototype.getNewAllowedAttributes = function(){ - return []; + return ["text", "selected"]; +} + +//TODO make dynamic +xap.bridges.dojo.TabBridge.prototype.setTextAttribute = function(value){ + this.getPeer().label = value; +} + +xap.bridges.dojo.TabBridge.prototype.setSelectedAttribute = function(value){ + + //TODO if this is set programitically we don't want to fire + //an event, maybe some goofy flag like "IS_PARSING" would be ok + this.getPeer().selected=true; //hint for tab container + if (this._tabContainer){ + this._tabContainer.selectTab(this.getPeer()); + } } Modified: incubator/xap/trunk/src/xap/bridges/dojo/TabPaneBridge.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/TabPaneBridge.js?rev=439431&r1=439430&r2=439431&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/bridges/dojo/TabPaneBridge.js (original) +++ incubator/xap/trunk/src/xap/bridges/dojo/TabPaneBridge.js Fri Sep 1 12:27:10 2006 @@ -50,6 +50,20 @@ return "TabContainer" ; } +xap.bridges.dojo.TabPaneBridge.prototype.addChild = function(childHandler, index){ + var oldSelectedTab = this.getPeer().selectedTabWidget; + this.superclass.addChild.call(this,childHandler, index ); + var newSelectedTab = this.getPeer().selectedTabWidget; + + //after a child is added if some new tab is selected + //we select it here because tabContainer doesn't seem to handle + //that except for one time in postCreate + if(newSelectedTab && ( newSelectedTab!=oldSelectedTab) ){ + this.getPeer().selectTab(newSelectedTab, true); + } +} + + /** XML attribute set method for "width" */ xap.bridges.dojo.TabPaneBridge.prototype.setWidthAttribute = function(value){ Added: incubator/xap/trunk/src/xap/bridges/dojo/TextAreaBridge.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/TextAreaBridge.js?rev=439431&view=auto ============================================================================== --- incubator/xap/trunk/src/xap/bridges/dojo/TextAreaBridge.js (added) +++ incubator/xap/trunk/src/xap/bridges/dojo/TextAreaBridge.js Fri Sep 1 12:27:10 2006 @@ -0,0 +1,88 @@ +/* + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + /** + * @fileoverview + * + * A bridge class that controls a textfield peer. + */ + +Xap.provide("xap.bridges.dojo.TextAreaBridge"); + +Xap.require("xap.bridges.dojo.DojoWidgetBridge"); +Xap.require("xap.components.dojo.TextArea"); +Xap.require("xap.session.ClientEvent"); + + /** + * @fileoverview + * + * A bridge class with dojo toolkit box panel peer. + */ + +xap.bridges.dojo.TextAreaBridge= function() { + xap.bridges.dojo.DojoWidgetBridge.call(this); +} + + +Xap.setupClassAsSubclassOf( + "xap.bridges.dojo.TextAreaBridge", + "xap.bridges.dojo.DojoWidgetBridge" +); + + + +xap.bridges.dojo.TextAreaBridge.prototype.init = function() { + this.superclass.init.call(this); + + //add listener last so we don't fire for the initial set + dojo.event.connect(this.getPeer(), "onblur",this,"onblur"); +} + +xap.bridges.dojo.TextAreaBridge.prototype.getPeerString = function(){ + return "TextArea" ; +} + + +/** + * + * + * Attribute definitions + * + */ + + +/** + * No new dynamic attributes + */ +xap.bridges.dojo.TextAreaBridge.prototype.getNewAllowedAttributes = function(){ + return ["text"]; +} + +xap.bridges.dojo.TextAreaBridge.prototype.setTextAttribute = function( value ){ + this.getPeer().setText(value); +} + +xap.bridges.dojo.TextAreaBridge.prototype.onblur = function( ){ + var text = this.getPeer().getText(); + this.writeBackAttribute("text",text); + var clientEvent = new xap.session.ClientEvent(this.getElement(),this.getSession()); + clientEvent.text = text; + this.fireEvent("onEdit",null,null,clientEvent); +} + + + Propchange: incubator/xap/trunk/src/xap/bridges/dojo/TextAreaBridge.js ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/xap/trunk/src/xap/bridges/dojo/TextFieldBridge.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/TextFieldBridge.js?rev=439431&view=auto ============================================================================== --- incubator/xap/trunk/src/xap/bridges/dojo/TextFieldBridge.js (added) +++ incubator/xap/trunk/src/xap/bridges/dojo/TextFieldBridge.js Fri Sep 1 12:27:10 2006 @@ -0,0 +1,88 @@ +/* + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + /** + * @fileoverview + * + * A bridge class that controls a textfield peer. + */ + +Xap.provide("xap.bridges.dojo.TextFieldBridge"); + +Xap.require("xap.bridges.dojo.DojoWidgetBridge"); +Xap.require("xap.components.dojo.TextField"); +Xap.require("xap.session.ClientEvent"); + + /** + * @fileoverview + * + * A bridge class with dojo toolkit box panel peer. + */ + +xap.bridges.dojo.TextFieldBridge= function() { + xap.bridges.dojo.DojoWidgetBridge.call(this); +} + + +Xap.setupClassAsSubclassOf( + "xap.bridges.dojo.TextFieldBridge", + "xap.bridges.dojo.DojoWidgetBridge" +); + + + +xap.bridges.dojo.TextFieldBridge.prototype.init = function() { + this.superclass.init.call(this); + + //add listener last so we don't fire for the initial set + dojo.event.connect(this.getPeer(), "onblur",this,"onblur"); +} + +xap.bridges.dojo.TextFieldBridge.prototype.getPeerString = function(){ + return "TextField" ; +} + + +/** + * + * + * Attribute definitions + * + */ + + +/** + * No new dynamic attributes + */ +xap.bridges.dojo.TextFieldBridge.prototype.getNewAllowedAttributes = function(){ + return ["text"]; +} + +xap.bridges.dojo.TextFieldBridge.prototype.setTextAttribute = function( value ){ + this.getPeer().setText(value); +} + +xap.bridges.dojo.TextFieldBridge.prototype.onblur = function( ){ + var text = this.getPeer().getText(); + this.writeBackAttribute("text",text); + var clientEvent = new xap.session.ClientEvent(this.getElement(),this.getSession()); + clientEvent.text = text; + this.fireEvent("onEdit",null,null,clientEvent); +} + + + Propchange: incubator/xap/trunk/src/xap/bridges/dojo/TextFieldBridge.js ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/xap/trunk/src/xap/components/dojo/BorderPanel.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/components/dojo/BorderPanel.js?rev=439431&r1=439430&r2=439431&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/components/dojo/BorderPanel.js (original) +++ incubator/xap/trunk/src/xap/components/dojo/BorderPanel.js Fri Sep 1 12:27:10 2006 @@ -20,37 +20,78 @@ dojo.lang.extend(xap.components.dojo.BorderPanel, { templateString: ''+ - '' + - ''+ - '' + - '
', + '' + + ''+ + '' + + '', templateCssPath: null , widgetType: "BorderPanel", isContainer: true, addChild: function(child, position){ + + var adjustWidth = false; + var adjustHeight = false; if (position=="north"){ this.containerNode = this.north; + adjustWidth = true; } else if (position=="south"){ this.containerNode = this.south; + adjustWidth = true; } else if (position=="east"){ this.containerNode = this.east; + adjustHeight = true; } else if (position=="west"){ this.containerNode = this.west; + adjustHeight = true; } else{ this.containerNode = this.center; + adjustWidth = true; + adjustHeight = true; + } + + //if we already have child nodes that's bad! + if (this.containerNode.childNodes.length!=0){ + return; } - child.domNode.style.width="100%"; - child.domNode.style.height="100%"; + + //IMPORTANT should we do this in a setTimeout() after + //we give the table a chance to layout first? probably + if (adjustWidth){ + child.domNode.style.width="100%"; + } + if (adjustHeight){ + child.domNode.style.height="100%"; + } xap.components.dojo.BorderPanel.superclass.addChild.call(this,child); - } + }, + + removeChild: function(child) { + var containerNode = child.domNode.parentNode; + xap.components.dojo.BorderPanel.superclass.removeChild.call(this,child); + resetNode(containerNode); + }, + + resetNode : function(containerNode){ + var nodeStyle = containerNode.style; + if (containerNode==this.north || containerNode==this.south){ + nodeStyle.width=""; + nodeStyle.height="1px"; + } + else if (containerNode==this.east || containerNode==this.west){ + nodeStyle.width="1px"; + nodeStyle.height=""; + } + else{ + nodeStyle.width= "99%"; + nodeStyle.height = "99%"; + } + } } -); - - +); \ No newline at end of file Added: incubator/xap/trunk/src/xap/components/dojo/TextField.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/components/dojo/TextField.js?rev=439431&view=auto ============================================================================== --- incubator/xap/trunk/src/xap/components/dojo/TextField.js (added) +++ incubator/xap/trunk/src/xap/components/dojo/TextField.js Fri Sep 1 12:27:10 2006 @@ -0,0 +1,39 @@ +//IMPORTANT move this to some shared area +dojo.widget.manager.registerWidgetPackage("xap.components.dojo"); + +Xap.provide("xap.components.dojo.TextField"); + +dojo.require("dojo.widget.*"); +dojo.require("dojo.widget.HtmlWidget"); +dojo.require("dojo.dom"); +dojo.require("dojo.html"); +dojo.require("dojo.style"); +dojo.require("dojo.event"); + +dojo.widget.tags.addParseTreeHandler("dojo:TextField"); + +xap.components.dojo.TextField = function(){ + dojo.widget.HtmlWidget.call(this); +} +dojo.inherits(xap.components.dojo.TextField, dojo.widget.HtmlWidget); + +dojo.lang.extend(xap.components.dojo.TextField, { + + templateString: '', + templateCssPath: null , + widgetType: "TextField", + isContainer: false, + + //hook for attach event + onblur: function(){ + }, + + setText: function( text ){ + this.domNode.value = text; + }, + + getText: function(){ + return this.domNode.value; + } +} +); \ No newline at end of file Propchange: incubator/xap/trunk/src/xap/components/dojo/TextField.js ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/xap/trunk/src/xap/taghandling/plugin.xml URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/taghandling/plugin.xml?rev=439431&r1=439430&r2=439431&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/taghandling/plugin.xml (original) +++ incubator/xap/trunk/src/xap/taghandling/plugin.xml Fri Sep 1 12:27:10 2006 @@ -34,6 +34,9 @@ + + +