(migrating thread from the Tapestry users list)
Thanks Andreas!
That helped a lot -- needed to make sure implementing those functions
was going to get me further.
I added the following implementations of buildEventProperties,
buildTargetProperties, and buildNodeProperties inside tapestry.event = {
... }
/**
* Function: buildEventProperties
*
* 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.
*
* Parameters:
*
* event - The javascript event method is based on, if it isn't a valid
* browser event it will be ignored.
* props - The existing property object to set the values on, if it
doesn't
* exist one will be created.
* args - The arguments from an method-call interception
* Returns:
*
* The desired event properties bound to an object. Ie
obj.target,obj.charCode, etc..
*/
buildEventProperties:function(event, props, args){
if (!props) props={};
var isEvent = (typeof event != "undefined")
&& (event)
&& (typeof Event != "undefined") && (event.eventPhase);
if (isEvent) {
if(event["type"]) props.beventtype=event.type;
if(event["keys"]) props.beventkeys=event.keys;
if(event["charCode"]) props.beventcharCode=event.charCode;
if(event["pageX"]) props.beventpageX=event.pageX;
if(event["pageY"]) props.beventpageY=event.pageY;
if(event["layerX"]) props.beventlayerX=event.layerX;
if(event["layerY"]) props.beventlayerY=event.layerY;
if (event["target"]) this.buildTargetProperties(props,
event.target);
}
props.methodArguments = dojo.toJson( args );
return props;
},
/**
* Function: buildTargetProperties
*
* Generic function to build a properties object populated with
* relevent target data.
*
* Parameters:
*
* props - The object that event properties are being set on to
return to
* the server.
* target - The javscript Event.target object that the original
event was targeted for.
*
* Returns:
* The original props object passed in, populated with any data found.
*/
buildTargetProperties:function(props, target){
if(!target) { return; }
var isNode = target.nodeType && target.cloneNode;
if (isNode) {
return this.buildNodeProperties(props, target);
} else {
dojo.raise("buildTargetProperties() Unknown target type:" +
target);
}
},
/**
* Function: buildNodeProperties
*
* Builds needed target node properties, like the node's id.
*
* Parameters:
* props - The object that event properties are being set on to
return to
* the server.
* node - The dom node specified as the Event.target in a
javascript event.
*/
buildNodeProperties:function(props, node) {
if (node.getAttribute("id")) {
props["beventtarget.id"]=node.getAttribute("id");
}
},
I just copied over the implementations from Tap 4.1.5's core.js, and:
1. replaced dojo.event.browser.isEvent(event) with an inline
implementation
2. replaced dojo.dom.isNode(target) with an inline implementation
3. changed dojo.json.serialize( args ) to dojo.toJson ( args )
This got my simple test case going of an in-page button
triggering-via-AJAX an @EventListener in the backing page.
Thanks!
Jim
Andreas Andreou wrote:
> Hi... good to see people starting work on that!
>
> tapestry.event.buildEventProperties is an obvious omission
> from skeleton/core.js - that file however is just for reference, so
> if you just declare buildEventProperties in your adapter js you
> should be able to go on.
>
> I must admit that I haven't made that much progress lately on that
> project + the issues described at
> http://tacos.sourceforge.net/tacos4.1/tacos-dojo/index.html
> are still pending... so, if you've already got improvements, additions
> i'd be happy to take a look and include them directly into tacos-dojo
>
> Of course, the same apply to tacos-jquery (in case someone is checking
> that out as well - http://andyhot.gr/tacos-demo/jquery/Index.html has an
> 'ugly' little demo...)
>
> On Feb 14, 2008 1:53 AM, Jim <[EMAIL PROTECTED]> wrote:
>
>> Howdy!
>>
>> I'm using Tapestry 4.1.5, and would like to use our own Dojo 1.0.2
>> instead of the default Dojo 0.4.3. I tried using the tacos-dojo module
>> from the Tacos project but there are still bugs with that. I hacked a
>> couple things in the source to get it going, but when running a simple
>> test case of having a button associated with an @EventListener, when I
>> click the button I get the following JS error:
>> "tapestry.event.buildEventProperties is not a function".
>>
>> I checked Tacos' adapter JS file and buildEventProperties wasn't here,
>> but before declaring it to be a Tacos issue:
>> tapestry.event.buildEventProperties exists in
>> tapestry-framework-4.1.5.jar/tapestry-4.1.5/core.js, but not in
>> tapestry-framework-4.1.5.jar/tapestry-4.1.5/skeleton/core.js, which is
>> what the online documentation claims is the JS adapter API to provide
>> implementations for, which probably explains why it wasn't implemented
>> in the Tacos JS adapter-file.
>>
>> Has anyone run into this and/or can tell me if I'm missing something?
>> Is this an oversight in the skeleton/core.js, or is Tap 4.1.5 still not
>> ready for replacing Dojo 0.4.3 with another library?
>>
>> Thanks,
>> Jim
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Tacos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tacos-devel