You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2006/05/26 18:17:02 UTC

svn commit: r409691 - in /tapestry/tapestry4/trunk: framework/src/java/org/apache/tapestry/asset/AssetService.java framework/src/js/tapestry/event.js framework/src/js/tests/test_event.js status.xml

Author: jkuhnert
Date: Fri May 26 09:17:02 2006
New Revision: 409691

URL: http://svn.apache.org/viewvc?rev=409691&view=rev
Log:
Committing before applying patch. 

Added:
    tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js   (with props)
    tapestry/tapestry4/trunk/framework/src/js/tests/test_event.js   (with props)
Modified:
    tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/asset/AssetService.java
    tapestry/tapestry4/trunk/status.xml

Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/asset/AssetService.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/asset/AssetService.java?rev=409691&r1=409690&r2=409691&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/asset/AssetService.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/asset/AssetService.java Fri May 26 09:17:02 2006
@@ -136,7 +136,7 @@
      * them to not expire ... but a year will do.
      */
 
-    private final long _expireTime = _startupTime + 365 * 24 * 60 * 60 * 1000;
+    private final long _expireTime = _startupTime + 365 * 24 * 60 * 60 * 1000L;
 
     /** @since 4.0 */
 

Added: tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js?rev=409691&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js Fri May 26 09:17:02 2006
@@ -0,0 +1,54 @@
+dojo.provide("tapestry.event");
+
+dojo.require("dojo.event.browser");
+dojo.require("dojo.dom");
+
+tapestry.event = {
+	
+	/**
+	 * Takes an incoming browser generated event (like key/mouse events) and
+	 * creates a js object holding the basic values of the event in order for 
+	 * it to be submitted to the server.
+	 * 
+	 * @param event The javascript event method is based on, if it isn't a valid
+	 * 				browser event it will be ignored.
+	 * @param props The existing property object to set the values on, if it doesn't
+	 * 				exist one will be created.
+	 * @return The desired event properties bound to an object. Ie obj.target,obj.charCode, etc..
+	 */
+	buildEventProperties:function(event, props){
+		if (!dojo.event.browser.isEvent(event)) return {};
+		if (!props) props={};
+		
+		if(event["type"]) props.type=event.type;
+		if(event["keys"]) props.keys=encodeUriComponent(event.keys);
+		if(event["pageX"]) props.pageX=evt.pageX;
+		if(event["pageY"]) props.pageY=evt.pageY;
+		if(event["layerX"]) props.layerX=evt.layerX;
+		if(event["layerY"]) props.layerY=evt.layerY;
+		
+		if (event["target"]) props.target=encodeURI(this.buildTargetProperties(event.target));
+		
+		return props;
+	},
+	
+	/**
+	 * Generic function to build a properties object populated with
+	 * relevent target data.
+	 */
+	buildTargetProperties:function(target){
+		if(!target) return;
+		
+		if (dojo.dom.isNode(target))
+			return this.buildNodeProperties(target);
+		else
+			dojo.raise("buildTargetProperties() Unknown target type:" + target);
+	},
+	
+	/**
+	 * Builds needed target node properties, like the nodes id.
+	 */
+	buildNodeProperties:function(node) {
+		return {id:node.getAttribute("id")};
+	}
+}
\ No newline at end of file

Propchange: tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/framework/src/js/tests/test_event.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/tests/test_event.js?rev=409691&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/tests/test_event.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/tests/test_event.js Fri May 26 09:17:02 2006
@@ -0,0 +1,23 @@
+dojo.setModulePrefix("tapestry", "../tapestry");
+
+dojo.require("tapestry.event");
+dojo.require("tapestry.test");
+
+// override to make sure our fake events pass
+dojo.event.browser.isEvent=function() { return true; }
+
+function test_eventCapture_props(){
+	var fevent=document.createEvent('UIEvents');
+	fevent.type="testType";
+	
+	var tnode = document.createElement("div");
+	tnode.setAttribute("id", "testid");
+	fevent.target=tnode;
+	
+	var props = tapestry.event.buildEventProperties(fevent);
+	
+	jum.assertTrue("evType", dojo.event.browser.isEvent(fevent));
+	jum.assertTrue("testNullProp", tapestry.event.buildEventProperties({}));
+	jum.assertTrue("type", props.type != "undefined");
+	jum.assertEquals("targetEncoded", "gobbly", props.target);
+}

Propchange: tapestry/tapestry4/trunk/framework/src/js/tests/test_event.js
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tapestry/tapestry4/trunk/status.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/status.xml?rev=409691&r1=409690&r2=409691&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/status.xml (original)
+++ tapestry/tapestry4/trunk/status.xml Fri May 26 09:17:02 2006
@@ -85,6 +85,10 @@
         Added isReadOnly method to EnhancementOperation interface to support discovering properties
         without having to throw exceptions.
       </action>
+      <action type="fix" dev="JK" due-to="Marcel Juffermans" fixes-bug="TAPESTRY-955">
+        Asset service incorrectly calculating expiration time, was causing numeric overflow
+        operations.
+      </action>
     </release>
     <release version="4.0.1" date="unreleased" >
       <action type="fix" dev="JK" fixes-bug="TAPESTRY-863" due-to="unknown contributor">



Re: svn commit: r409691 - in /tapestry/tapestry4/trunk: framework/src/java/org/apache/tapestry/asset/AssetService.java framework/src/js/tapestry/event.js framework/src/js/tests/test_event.js status.xml

Posted by Jesse Kuhnert <jk...@gmail.com>.
No I hadn't known this component existed at all.

I had discovered windows WSH (web scripting host) which allows js based unit
tests to run with a real IE backing up the window/document objects.

Mozilla is a little trickier, but thanks to IBM we have java XPCOM which
allows basically the same thing. (I am guessing floyd is using this) I had
planned on delving further into the XPCOM api but now that I see this I will
invesitgate it instead :)

Thank you ~SO~ much. You have no idea how much the ajax sort of community
has needed/wanted something like this. Will have to try it out to see if
it's really what it says it is.


On 5/31/06, Kalle Korhonen <ka...@gmail.com> wrote:
>
> OT, but since you mentioned it, are you aware of Floyd
> (https://floyd.dev.java.net/ and
>
> http://www.openqa.org/floyd/HowToUnitTestTheUserInterfaceOfWebApplications.pdf
> ).
> If yes, how does it compare to the stuff you are using and would you
> see any problems in using Floyd for Tapestry specific apps?
>
> Kalle
>
> On 5/26/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> > P.S. I found a way to let us have complete in-browser tests for mozilla
> as
> > well. (ie using gecko/spidermonkey as the rendering/js engine ).
> Combined
> > with wsh for ie we'll be able to have complete in-browser unit tests.
> ....Am
> > probably not going to do the mozilla thing for a while still as it'll
> > require too much concentrated effort.
> >
> > On 5/26/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> > >
> > > Looks like it. The checkin was a little incomplete, just making sure I
> > > could tell the difference between incoming patches and existing code.
> > >
> > >
> > > On 5/26/06, andyhot@di.uoa.gr <an...@di.uoa.gr> wrote:
> > > >
> > > > From jkuhnert@apache.org:
> > > >
> > > >
> > > >
> ==============================================================================
> > > > > --- tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js
> > > > (added)
> > > > > +++ tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js
> Fri
> > > > May 26
> > > >
> > > > > +
> > > > > +             if(event["type"]) props.type=event.type;
> > > > > +             if(event["keys"]) props.keys=encodeUriComponent(
> > > > event.keys);
> > > > > +             if(event["pageX"]) props.pageX=evt.pageX;
> > > > > +             if(event["pageY"]) props.pageY=evt.pageY;
> > > > > +             if(event["layerX"]) props.layerX=evt.layerX;
> > > > > +             if(event["layerY"]) props.layerY=evt.layerY;
> > > >
> > > > Haven't tried this, but isn't 'evt' in the 4 previous lines a typo ?
> > > >
> > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: dev-help@tapestry.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Jesse Kuhnert
> > > Tacos/Tapestry, team member/developer
> > >
> > > Open source based consulting work centered around
> > > dojo/tapestry/tacos/hivemind.
> > >
> >
> >
> >
> > --
> > Jesse Kuhnert
> > Tacos/Tapestry, team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

Re: svn commit: r409691 - in /tapestry/tapestry4/trunk: framework/src/java/org/apache/tapestry/asset/AssetService.java framework/src/js/tapestry/event.js framework/src/js/tests/test_event.js status.xml

Posted by Kalle Korhonen <ka...@gmail.com>.
OT, but since you mentioned it, are you aware of Floyd
(https://floyd.dev.java.net/ and
http://www.openqa.org/floyd/HowToUnitTestTheUserInterfaceOfWebApplications.pdf).
If yes, how does it compare to the stuff you are using and would you
see any problems in using Floyd for Tapestry specific apps?

Kalle

On 5/26/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> P.S. I found a way to let us have complete in-browser tests for mozilla as
> well. (ie using gecko/spidermonkey as the rendering/js engine ). Combined
> with wsh for ie we'll be able to have complete in-browser unit tests. ....Am
> probably not going to do the mozilla thing for a while still as it'll
> require too much concentrated effort.
>
> On 5/26/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> >
> > Looks like it. The checkin was a little incomplete, just making sure I
> > could tell the difference between incoming patches and existing code.
> >
> >
> > On 5/26/06, andyhot@di.uoa.gr <an...@di.uoa.gr> wrote:
> > >
> > > From jkuhnert@apache.org:
> > >
> > >
> > > ==============================================================================
> > > > --- tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js
> > > (added)
> > > > +++ tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js Fri
> > > May 26
> > >
> > > > +
> > > > +             if(event["type"]) props.type=event.type;
> > > > +             if(event["keys"]) props.keys=encodeUriComponent(
> > > event.keys);
> > > > +             if(event["pageX"]) props.pageX=evt.pageX;
> > > > +             if(event["pageY"]) props.pageY=evt.pageY;
> > > > +             if(event["layerX"]) props.layerX=evt.layerX;
> > > > +             if(event["layerY"]) props.layerY=evt.layerY;
> > >
> > > Haven't tried this, but isn't 'evt' in the 4 previous lines a typo ?
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: dev-help@tapestry.apache.org
> > >
> > >
> >
> >
> > --
> > Jesse Kuhnert
> > Tacos/Tapestry, team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind.
> >
>
>
>
> --
> Jesse Kuhnert
> Tacos/Tapestry, team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: svn commit: r409691 - in /tapestry/tapestry4/trunk: framework/src/java/org/apache/tapestry/asset/AssetService.java framework/src/js/tapestry/event.js framework/src/js/tests/test_event.js status.xml

Posted by Jesse Kuhnert <jk...@gmail.com>.
P.S. I found a way to let us have complete in-browser tests for mozilla as
well. (ie using gecko/spidermonkey as the rendering/js engine ). Combined
with wsh for ie we'll be able to have complete in-browser unit tests. ....Am
probably not going to do the mozilla thing for a while still as it'll
require too much concentrated effort.

On 5/26/06, Jesse Kuhnert <jk...@gmail.com> wrote:
>
> Looks like it. The checkin was a little incomplete, just making sure I
> could tell the difference between incoming patches and existing code.
>
>
> On 5/26/06, andyhot@di.uoa.gr <an...@di.uoa.gr> wrote:
> >
> > From jkuhnert@apache.org:
> >
> >
> > ==============================================================================
> > > --- tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js
> > (added)
> > > +++ tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js Fri
> > May 26
> >
> > > +
> > > +             if(event["type"]) props.type=event.type;
> > > +             if(event["keys"]) props.keys=encodeUriComponent(
> > event.keys);
> > > +             if(event["pageX"]) props.pageX=evt.pageX;
> > > +             if(event["pageY"]) props.pageY=evt.pageY;
> > > +             if(event["layerX"]) props.layerX=evt.layerX;
> > > +             if(event["layerY"]) props.layerY=evt.layerY;
> >
> > Haven't tried this, but isn't 'evt' in the 4 previous lines a typo ?
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: dev-help@tapestry.apache.org
> >
> >
>
>
> --
> Jesse Kuhnert
> Tacos/Tapestry, team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind.
>



-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

Re: svn commit: r409691 - in /tapestry/tapestry4/trunk: framework/src/java/org/apache/tapestry/asset/AssetService.java framework/src/js/tapestry/event.js framework/src/js/tests/test_event.js status.xml

Posted by Jesse Kuhnert <jk...@gmail.com>.
Looks like it. The checkin was a little incomplete, just making sure I could
tell the difference between incoming patches and existing code.

On 5/26/06, andyhot@di.uoa.gr <an...@di.uoa.gr> wrote:
>
> From jkuhnert@apache.org:
>
>
> ==============================================================================
> > --- tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js (added)
> > +++ tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js Fri May
> 26
>
> > +
> > +             if(event["type"]) props.type=event.type;
> > +             if(event["keys"]) props.keys=encodeUriComponent(event.keys
> );
> > +             if(event["pageX"]) props.pageX=evt.pageX;
> > +             if(event["pageY"]) props.pageY=evt.pageY;
> > +             if(event["layerX"]) props.layerX=evt.layerX;
> > +             if(event["layerY"]) props.layerY=evt.layerY;
>
> Haven't tried this, but isn't 'evt' in the 4 previous lines a typo ?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

Re: svn commit: r409691 - in /tapestry/tapestry4/trunk: framework/src/java/org/apache/tapestry/asset/AssetService.java framework/src/js/tapestry/event.js framework/src/js/tests/test_event.js status.xml

Posted by an...@di.uoa.gr.
>From jkuhnert@apache.org: 
 
============================================================================== 
> --- tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js (added) 
> +++ tapestry/tapestry4/trunk/framework/src/js/tapestry/event.js Fri May 26 
 
> +		 
> +		if(event["type"]) props.type=event.type; 
> +		if(event["keys"]) props.keys=encodeUriComponent(event.keys); 
> +		if(event["pageX"]) props.pageX=evt.pageX; 
> +		if(event["pageY"]) props.pageY=evt.pageY; 
> +		if(event["layerX"]) props.layerX=evt.layerX; 
> +		if(event["layerY"]) props.layerY=evt.layerY; 
 
Haven't tried this, but isn't 'evt' in the 4 previous lines a typo ? 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org