Re: 'Simulating' commandLink from Javascript

2006-02-03 Thread Laurie Harper
I guess that'd be one work-around. I think in this case I'll be better 
off biting the bullet and creating a component.


L.

Mike Kienenberger wrote:

What about putting a command-link on your page and use style="display:none"?

-Mike

On 2/1/06, Laurie Harper <[EMAIL PROTECTED]> wrote:

Ryan Wynn wrote:

On 2/1/06, Laurie Harper <[EMAIL PROTECTED]> wrote:

Hi, I need to do the equivalent of clicking a commandLink in Javascript;
in other words, I need to write an onClick handler that does the same
thing as clicking on a commandLink would. Is there a standard way to do
that? I'm not sure if the JSF spec includes any specifics on client-side
APIs.


I have found that it is different for IE vs. Netscape/Firefox. I'm not
a js expert but it works.

This is how I invoke a hidden commandLink in a table row...
[...]


Thanks for the response, but that's not what I'm trying to do. I don't
need to locate and invoke an existing command link; I don't have a
command link to invoke. I need to achieve the same effect as clicking a
command link would give.

In other words, I need to write a Javascript function which, when
invoked, does the same thing the onClick handler a commandLink generates
would do.

The best I can come up with so far is to create a custom component which
extends HtmlCommandLink and overrides the encode/decode methods, but
creating a whole new component just to be able to create Javascript
onClick handlers seems rather excessive.

L.








Re: Dojo integration (was "Re: 'Simulating' commandLink from Javascript'")

2006-02-03 Thread Martin Marinschek
Yes, but that is all really in the beginning, currently.

We well be working over the next few months on that.

regards,

Martin

On 2/3/06, Rogers Reilly <[EMAIL PROTECTED]> wrote:
> Martin Marinschek wrote:
>
> >Our final goal is to get rid of prototype and use dojo instead as our
> >base-library for AJAX.
> >
> >So we want to further AJAXify our component set with the help of dojo,
> >and replace the existing implementations with dojo-functionality.
> >
> >
> >
> Fantastic, thanks for the clarification Martin.  Sounds like Dojo will
> be used under the covers, then.  At some point, it might be useful to
> expose which Dojo components are being loaded into the page, so
> developers can know which ones they're getting for free and don't need
> to load.
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces


Re: Dojo integration (was "Re: 'Simulating' commandLink from Javascript'")

2006-02-03 Thread Rogers Reilly

Martin Marinschek wrote:


Our final goal is to get rid of prototype and use dojo instead as our
base-library for AJAX.

So we want to further AJAXify our component set with the help of dojo,
and replace the existing implementations with dojo-functionality.

 

Fantastic, thanks for the clarification Martin.  Sounds like Dojo will 
be used under the covers, then.  At some point, it might be useful to 
expose which Dojo components are being loaded into the page, so 
developers can know which ones they're getting for free and don't need 
to load.


Re: Dojo integration (was "Re: 'Simulating' commandLink from Javascript'")

2006-02-02 Thread Martin Marinschek
Our final goal is to get rid of prototype and use dojo instead as our
base-library for AJAX.

So we want to further AJAXify our component set with the help of dojo,
and replace the existing implementations with dojo-functionality.

The problem with prototype is lacking namespacing...

regards,

Martin

On 2/3/06, Rogers Reilly <[EMAIL PROTECTED]> wrote:
> Laurie Harper wrote:
>
> > Hmm, OK, thanks; that makes sense. So, it's either time to start
> > wrapping Dojo widgets with JSF components, or time to learn about
> > Shale's remoting features ;-)
>
> Picking up on this- I'm just about to refactor two Dojo/JSP projects
> (one work, one personal) into Dojo/Shale/JSF/Hibernate projects, and
> this sliver of the stack is exactly what I'm wrestling with.  My first
> thought was to define a relatively narrow Dojo interface for thick
> client-side stuff (letting MyFaces do simple stuff like autocompletes),
> keeping the server fairly decoupled, but now I'm wondering if they can
> be wired more tightly.
>
> Somebody posted on the Dojo mailing list about weaving Dojo libraries
> into MyFaces ... it wasn't clear (to me, at least) whether this was just
> for the purpose of using it for behind-the-scenes utility functions, or
> for AJAX-ifying current JSF components, or for wrapping Dojo widgets as
> Laurie mentioned.  Does anyone know where MyFaces is going in this
> regard?  I expect at first I'll be doing a lot of hand-wired Shale
> remoting in widgets, but it'd be great to have some idea of where to
> expect "help" in the future.
>
> -Rogers
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces


Dojo integration (was "Re: 'Simulating' commandLink from Javascript'")

2006-02-02 Thread Rogers Reilly

Laurie Harper wrote:

Hmm, OK, thanks; that makes sense. So, it's either time to start 
wrapping Dojo widgets with JSF components, or time to learn about 
Shale's remoting features ;-)


Picking up on this- I'm just about to refactor two Dojo/JSP projects 
(one work, one personal) into Dojo/Shale/JSF/Hibernate projects, and 
this sliver of the stack is exactly what I'm wrestling with.  My first 
thought was to define a relatively narrow Dojo interface for thick 
client-side stuff (letting MyFaces do simple stuff like autocompletes), 
keeping the server fairly decoupled, but now I'm wondering if they can 
be wired more tightly.


Somebody posted on the Dojo mailing list about weaving Dojo libraries 
into MyFaces ... it wasn't clear (to me, at least) whether this was just 
for the purpose of using it for behind-the-scenes utility functions, or 
for AJAX-ifying current JSF components, or for wrapping Dojo widgets as 
Laurie mentioned.  Does anyone know where MyFaces is going in this 
regard?  I expect at first I'll be doing a lot of hand-wired Shale 
remoting in widgets, but it'd be great to have some idea of where to 
expect "help" in the future.


-Rogers


Re: 'Simulating' commandLink from Javascript

2006-02-02 Thread Mike Kienenberger
What about putting a command-link on your page and use style="display:none"?

-Mike

On 2/1/06, Laurie Harper <[EMAIL PROTECTED]> wrote:
> Ryan Wynn wrote:
> > On 2/1/06, Laurie Harper <[EMAIL PROTECTED]> wrote:
> >> Hi, I need to do the equivalent of clicking a commandLink in Javascript;
> >> in other words, I need to write an onClick handler that does the same
> >> thing as clicking on a commandLink would. Is there a standard way to do
> >> that? I'm not sure if the JSF spec includes any specifics on client-side
> >> APIs.
> >
> >
> > I have found that it is different for IE vs. Netscape/Firefox. I'm not
> > a js expert but it works.
> >
> > This is how I invoke a hidden commandLink in a table row...
> > [...]
>
>
> Thanks for the response, but that's not what I'm trying to do. I don't
> need to locate and invoke an existing command link; I don't have a
> command link to invoke. I need to achieve the same effect as clicking a
> command link would give.
>
> In other words, I need to write a Javascript function which, when
> invoked, does the same thing the onClick handler a commandLink generates
> would do.
>
> The best I can come up with so far is to create a custom component which
> extends HtmlCommandLink and overrides the encode/decode methods, but
> creating a whole new component just to be able to create Javascript
> onClick handlers seems rather excessive.
>
> L.
>
>


Re: 'Simulating' commandLink from Javascript

2006-02-02 Thread Laurie Harper

Volker Weber wrote:

Hi Laurie,

Laurie Harper wrote:

Thanks for the response, but that's not what I'm trying to do. I don't
need to locate and invoke an existing command link; I don't have a
command link to invoke. I need to achieve the same effect as clicking a
command link would give.

In other words, I need to write a Javascript function which, when
invoked, does the same thing the onClick handler a commandLink generates
would do.

The best I can come up with so far is to create a custom component which
extends HtmlCommandLink and overrides the encode/decode methods, but
creating a whole new component just to be able to create Javascript
onClick handlers seems rather excessive.


To invoke a action on the server you need to have a component, because
the event is created inside the decode of the component.

On the client side you need the cliendId of this Component to do the
same thing as a onClick handler of a commandLink would do.


Hmm, OK, thanks; that makes sense. So, it's either time to start 
wrapping Dojo widgets with JSF components, or time to learn about 
Shale's remoting features ;-)


L.



Re: 'Simulating' commandLink from Javascript

2006-02-02 Thread Volker Weber
Hi Laurie,

Laurie Harper wrote:
> 
> Thanks for the response, but that's not what I'm trying to do. I don't
> need to locate and invoke an existing command link; I don't have a
> command link to invoke. I need to achieve the same effect as clicking a
> command link would give.
> 
> In other words, I need to write a Javascript function which, when
> invoked, does the same thing the onClick handler a commandLink generates
> would do.
> 
> The best I can come up with so far is to create a custom component which
> extends HtmlCommandLink and overrides the encode/decode methods, but
> creating a whole new component just to be able to create Javascript
> onClick handlers seems rather excessive.

To invoke a action on the server you need to have a component, because
the event is created inside the decode of the component.

On the client side you need the cliendId of this Component to do the
same thing as a onClick handler of a commandLink would do.

Regards,
  Volker

> 
> L.
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.


Re: 'Simulating' commandLink from Javascript

2006-02-01 Thread Laurie Harper

Ryan Wynn wrote:

On 2/1/06, Laurie Harper <[EMAIL PROTECTED]> wrote:

Hi, I need to do the equivalent of clicking a commandLink in Javascript;
in other words, I need to write an onClick handler that does the same
thing as clicking on a commandLink would. Is there a standard way to do
that? I'm not sure if the JSF spec includes any specifics on client-side
APIs.



I have found that it is different for IE vs. Netscape/Firefox. I'm not
a js expert but it works.

This is how I invoke a hidden commandLink in a table row...
[...]



Thanks for the response, but that's not what I'm trying to do. I don't 
need to locate and invoke an existing command link; I don't have a 
command link to invoke. I need to achieve the same effect as clicking a 
command link would give.


In other words, I need to write a Javascript function which, when 
invoked, does the same thing the onClick handler a commandLink generates 
would do.


The best I can come up with so far is to create a custom component which 
extends HtmlCommandLink and overrides the encode/decode methods, but 
creating a whole new component just to be able to create Javascript 
onClick handlers seems rather excessive.


L.



Re: 'Simulating' commandLink from Javascript

2006-02-01 Thread Ryan Wynn
On 2/1/06, Laurie Harper <[EMAIL PROTECTED]> wrote:
> Hi, I need to do the equivalent of clicking a commandLink in Javascript;
> in other words, I need to write an onClick handler that does the same
> thing as clicking on a commandLink would. Is there a standard way to do
> that? I'm not sure if the JSF spec includes any specifics on client-side
> APIs.


I have found that it is different for IE vs. Netscape/Firefox. I'm not
a js expert but it works.

This is how I invoke a hidden commandLink in a table row...


commandLink



function invokeRowLink(row) {
if (navigator.appName.indexOf("Netscape") != -1) {
invokeRowLinkNS(row);
} else {
invokeRowLinkIE(row);
}
}


function doClickNS(anchor) {
var evt = anchor.ownerDocument.createEvent('MouseEvents');
evt.initMouseEvent('click', false, true,
anchor.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false,
false, 0, null);
anchor.dispatchEvent(evt);
}



function invokeRowLinkNS(row) {
if (row.hasChildNodes) {
tds = row.getElementsByTagName("td");
for(x=0;x