Added: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/ajax/dojo/src/xml/htmlUtil.js URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/ajax/dojo/src/xml/htmlUtil.js?rev=373750&view=auto ============================================================================== --- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/ajax/dojo/src/xml/htmlUtil.js (added) +++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/ajax/dojo/src/xml/htmlUtil.js Mon Jan 30 23:42:27 2006 @@ -0,0 +1,121 @@ +/* + Copyright (c) 2004-2005, 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.xml.htmlUtil"); +dojo.require("dojo.html"); +dojo.require("dojo.style"); +dojo.require("dojo.dom"); + +dj_deprecated("dojo.xml.htmlUtil is deprecated, use dojo.html instead"); + +dojo.xml.htmlUtil = new function(){ + this.styleSheet = dojo.style.styleSheet; + + this._clobberSelection = function(){return dojo.html.clearSelection.apply(dojo.html, arguments);} + this.disableSelect = function(){return dojo.html.disableSelection.apply(dojo.html, arguments);} + this.enableSelect = function(){return dojo.html.enableSelection.apply(dojo.html, arguments);} + + this.getInnerWidth = function(){return dojo.style.getInnerWidth.apply(dojo.style, arguments);} + + this.getOuterWidth = function(node){ + dj_unimplemented("dojo.xml.htmlUtil.getOuterWidth"); + } + + this.getInnerHeight = function(){return dojo.style.getInnerHeight.apply(dojo.style, arguments);} + + this.getOuterHeight = function(node){ + dj_unimplemented("dojo.xml.htmlUtil.getOuterHeight"); + } + + this.getTotalOffset = function(){return dojo.style.getTotalOffset.apply(dojo.style, arguments);} + this.totalOffsetLeft = function(){return dojo.style.totalOffsetLeft.apply(dojo.style, arguments);} + + this.getAbsoluteX = this.totalOffsetLeft; + + this.totalOffsetTop = function(){return dojo.style.totalOffsetTop.apply(dojo.style, arguments);} + + this.getAbsoluteY = this.totalOffsetTop; + + this.getEventTarget = function(){return dojo.html.getEventTarget.apply(dojo.html, arguments);} + this.getScrollTop = function() {return dojo.html.getScrollTop.apply(dojo.html, arguments);} + this.getScrollLeft = function() {return dojo.html.getScrollLeft.apply(dojo.html, arguments);} + + this.evtTgt = this.getEventTarget; + + this.getParentOfType = function(){return dojo.html.getParentOfType.apply(dojo.html, arguments);} + this.getAttribute = function(){return dojo.html.getAttribute.apply(dojo.html, arguments);} + this.getAttr = function (node, attr) { // for backwards compat (may disappear!!!) + dj_deprecated("dojo.xml.htmlUtil.getAttr is deprecated, use dojo.xml.htmlUtil.getAttribute instead"); + return dojo.xml.htmlUtil.getAttribute(node, attr); + } + this.hasAttribute = function(){return dojo.html.hasAttribute.apply(dojo.html, arguments);} + + this.hasAttr = function (node, attr) { // for backwards compat (may disappear!!!) + dj_deprecated("dojo.xml.htmlUtil.hasAttr is deprecated, use dojo.xml.htmlUtil.hasAttribute instead"); + return dojo.xml.htmlUtil.hasAttribute(node, attr); + } + + this.getClass = function(){return dojo.html.getClass.apply(dojo.html, arguments)} + this.hasClass = function(){return dojo.html.hasClass.apply(dojo.html, arguments)} + this.prependClass = function(){return dojo.html.prependClass.apply(dojo.html, arguments)} + this.addClass = function(){return dojo.html.addClass.apply(dojo.html, arguments)} + this.setClass = function(){return dojo.html.setClass.apply(dojo.html, arguments)} + this.removeClass = function(){return dojo.html.removeClass.apply(dojo.html, arguments)} + + // Enum type for getElementsByClass classMatchType arg: + this.classMatchType = { + ContainsAll : 0, // all of the classes are part of the node's class (default) + ContainsAny : 1, // any of the classes are part of the node's class + IsOnly : 2 // only all of the classes are part of the node's class + } + + this.getElementsByClass = function() {return dojo.html.getElementsByClass.apply(dojo.html, arguments)} + this.getElementsByClassName = this.getElementsByClass; + + this.setOpacity = function() {return dojo.style.setOpacity.apply(dojo.style, arguments)} + this.getOpacity = function() {return dojo.style.getOpacity.apply(dojo.style, arguments)} + this.clearOpacity = function() {return dojo.style.clearOpacity.apply(dojo.style, arguments)} + + this.gravity = function(){return dojo.html.gravity.apply(dojo.html, arguments)} + + this.gravity.NORTH = 1; + this.gravity.SOUTH = 1 << 1; + this.gravity.EAST = 1 << 2; + this.gravity.WEST = 1 << 3; + + this.overElement = function(){return dojo.html.overElement.apply(dojo.html, arguments)} + + this.insertCssRule = function(){return dojo.style.insertCssRule.apply(dojo.style, arguments)} + + this.insertCSSRule = function(selector, declaration, index){ + dj_deprecated("dojo.xml.htmlUtil.insertCSSRule is deprecated, use dojo.xml.htmlUtil.insertCssRule instead"); + return dojo.xml.htmlUtil.insertCssRule(selector, declaration, index); + } + + this.removeCssRule = function(){return dojo.style.removeCssRule.apply(dojo.style, arguments)} + + this.removeCSSRule = function(index){ + dj_deprecated("dojo.xml.htmlUtil.removeCSSRule is deprecated, use dojo.xml.htmlUtil.removeCssRule instead"); + return dojo.xml.htmlUtil.removeCssRule(index); + } + + this.insertCssFile = function(){return dojo.style.insertCssFile.apply(dojo.style, arguments)} + + this.insertCSSFile = function(URI, doc, checkDuplicates){ + dj_deprecated("dojo.xml.htmlUtil.insertCSSFile is deprecated, use dojo.xml.htmlUtil.insertCssFile instead"); + return dojo.xml.htmlUtil.insertCssFile(URI, doc, checkDuplicates); + } + + this.getBackgroundColor = function() {return dojo.style.getBackgroundColor.apply(dojo.style, arguments)} + + this.getUniqueId = function() { return dojo.dom.getUniqueId(); } + + this.getStyle = function() {return dojo.style.getStyle.apply(dojo.style, arguments)} +}
Added: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/ajax/dojo/src/xml/svgUtil.js URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/ajax/dojo/src/xml/svgUtil.js?rev=373750&view=auto ============================================================================== --- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/ajax/dojo/src/xml/svgUtil.js (added) +++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/ajax/dojo/src/xml/svgUtil.js Mon Jan 30 23:42:27 2006 @@ -0,0 +1,32 @@ +/* + Copyright (c) 2004-2005, 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.xml.svgUtil"); +// FIXME: add imports for deps! + +dojo.xml.svgUtil = new function(){ + + this.getInnerWidth = function(node){ + // FIXME: need to find out from dylan how to + } + + this.getOuterWidth = function(node){ + + } + + this.getInnerHeight = function(node){ + + } + + this.getOuterHeight = function(node){ + + } + +} Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ClasspathAssetFactory.java URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ClasspathAssetFactory.java?rev=373750&r1=373749&r2=373750&view=diff ============================================================================== --- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ClasspathAssetFactory.java (original) +++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/asset/ClasspathAssetFactory.java Mon Jan 30 23:42:27 2006 @@ -44,14 +44,14 @@ { Resource asset = baseResource.getRelativeResource(path); Resource localized = _localizer.findLocalization(asset, locale); - + if (localized == null) throw new ApplicationRuntimeException(AssetMessages.missingAsset(path, baseResource), location, null); - + return createAsset(localized, location); } - + public IAsset createAbsoluteAsset(String path, Locale locale, Location location) { Resource base = new ClasspathResource(_classResolver, path); @@ -85,4 +85,4 @@ { _localizer = localizer; } -} \ No newline at end of file +} Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/html/Shell.java URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/html/Shell.java?rev=373750&r1=373749&r2=373750&view=diff ============================================================================== --- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/html/Shell.java (original) +++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/html/Shell.java Mon Jan 30 23:42:27 2006 @@ -88,15 +88,20 @@ if (delegate != null) delegate.render(writer, cycle); + IRender ajaxDelegate = getAjaxDelegate(); + + if (isAjaxEnabled() && ajaxDelegate != null) + ajaxDelegate.render(writer, cycle); + IAsset stylesheet = getStylesheet(); - + if (stylesheet != null) writeStylesheetLink(writer, cycle, stylesheet); - + Iterator i = (Iterator) getValueConverter().coerceValue( getStylesheets(), Iterator.class); - + while (i.hasNext()) { stylesheet = (IAsset) i.next(); @@ -167,7 +172,7 @@ writeMetaTag(writer, "http-equiv", "Refresh", buffer.toString()); } - + private void writeMetaTag(IMarkupWriter writer, String key, String value, String content) { writer.beginEmpty("meta"); @@ -175,7 +180,11 @@ writer.attribute("content", content); writer.println(); } - + + public abstract boolean isAjaxEnabled(); + + public abstract IRender getAjaxDelegate(); + public abstract IRender getDelegate(); public abstract int getRefresh(); Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/html/Shell.jwc URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/html/Shell.jwc?rev=373750&r1=373749&r2=373750&view=diff ============================================================================== --- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/html/Shell.jwc (original) +++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/html/Shell.jwc Mon Jan 30 23:42:27 2006 @@ -82,9 +82,38 @@ </description> </parameter> + <parameter name="ajaxDelegate" + default-value="bean:coreAjaxDelegate" > + <description> + If specified, allows for the default ajaxDelegate that renders the dojo script + includes to be overriden. + </description> + </parameter> + + <parameter name="ajaxEnabled" + default-value="false" > + <description> + If set to true, will include the required javascript libraries that make all + of the ajax functionality possible. + </description> + </parameter> + + <parameter name="dojoSource" + default-value="asset:defaultDojoSource" > + <description> + If specified, allows for the default dojo source included to be overriden. + </description> + </parameter> + <inject property="valueConverter" object="service:tapestry.coerce.ValueConverter"/> <inject property="pageService" object="engine-service:page"/> <inject property="applicationSpecification" object="infrastructure:applicationSpecification"/> <inject property="baseTagWriter" object="service:tapestry.url.BaseTagWriter"/> + + <bean name="coreAjaxDelegate" class="org.apache.tapestry.ajax.AjaxShellDelegate"> + <set name="dojoSource" value="dojoSource" /> + </bean> + + <asset name="defaultDojoSource" path="/org/apache/tapestry/ajax/dojo" /> </component-specification> Modified: jakarta/tapestry/trunk/framework/src/js/build.xml URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/build.xml?rev=373750&r1=373749&r2=373750&view=diff ============================================================================== --- jakarta/tapestry/trunk/framework/src/js/build.xml (original) +++ jakarta/tapestry/trunk/framework/src/js/build.xml Mon Jan 30 23:42:27 2006 @@ -56,6 +56,7 @@ <property name="profile" value="tapestry" /> </ant> + <!-- <delete dir="dojo" /> <copy todir="." overwrite="true" > @@ -63,6 +64,7 @@ <exclude name="dojo/demos/**" /> </fileset> </copy> + --> </target> </project> Modified: jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/ClasspathAssetFactoryTest.java URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/ClasspathAssetFactoryTest.java?rev=373750&r1=373749&r2=373750&view=diff ============================================================================== --- jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/ClasspathAssetFactoryTest.java (original) +++ jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/asset/ClasspathAssetFactoryTest.java Mon Jan 30 23:42:27 2006 @@ -19,6 +19,7 @@ import org.apache.hivemind.ApplicationRuntimeException; import org.apache.hivemind.Location; import org.apache.hivemind.Resource; +import org.apache.hivemind.impl.LocationImpl; import org.apache.hivemind.test.HiveMindTestCase; import org.apache.hivemind.util.ClasspathResource; import org.apache.tapestry.IAsset; @@ -102,7 +103,7 @@ "/org/apache/tapestry/asset/relative-resource.txt", Locale.FRENCH, l); - + assertTrue(asset instanceof PrivateAsset); assertEquals("/org/apache/tapestry/asset/relative-resource_fr.txt", asset .getResourceLocation().getPath()); @@ -142,6 +143,59 @@ verifyControls(); } + public void testCreateDirectoryAsset() + { + IEngineService assetService = newService(); + Location l = newLocation(); + + replayControls(); + + ClasspathAssetFactory factory = new ClasspathAssetFactory(); + factory.setClassResolver(getClassResolver()); + factory.setAssetService(assetService); + factory.setLocalizer(new DefaultResourceLocalizer()); + + String path = "/org/apache/tapestry/ajax/dojo"; + + Resource subResource = new ClasspathResource(getClassResolver(), path); + IAsset asset = factory.createAsset(subResource, l); + + assertTrue(asset instanceof PrivateAsset); + assertEquals(path, asset + .getResourceLocation().getPath()); + assertSame(l, asset.getLocation()); + + verifyControls(); + } + + public void testCreateRelativeDirectoryAsset() + { + IEngineService assetService = newService(); + Resource shell = new ClasspathResource(getClassResolver(), + "/org/apache/tapestry/html/Shell.jwc"); + Location l = new LocationImpl(shell); + + replayControls(); + + ClasspathAssetFactory factory = new ClasspathAssetFactory(); + factory.setClassResolver(getClassResolver()); + factory.setAssetService(assetService); + factory.setLocalizer(new DefaultResourceLocalizer()); + + String path = "/org/apache/tapestry/ajax/dojo"; + + IAsset asset = factory.createAsset(shell, path, + Locale.getDefault(), + l); + + assertTrue(asset instanceof PrivateAsset); + assertEquals(path, asset + .getResourceLocation().getPath()); + assertSame(l, asset.getLocation()); + + verifyControls(); + } + /** * Tests relative sub-directory paths. */ Modified: jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/services/impl/EngineFactoryTest.java URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/services/impl/EngineFactoryTest.java?rev=373750&r1=373749&r2=373750&view=diff ============================================================================== --- jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/services/impl/EngineFactoryTest.java (original) +++ jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/services/impl/EngineFactoryTest.java Mon Jan 30 23:42:27 2006 @@ -152,4 +152,4 @@ verifyControls(); } -} \ No newline at end of file +} --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
