You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Bauer, Paul-Michael" <PB...@LNC.com> on 2005/01/07 02:24:46 UTC

contrib:Table, JavaScript, and DirectLinks

Tapestry users,

I am writing a Tapestry app with a summary/detail set of screens.

Clicking anywhere in a summary row (generated by contrib:Table
components) allows the user to drill down to the detail screen.

I have a _gross_ hack for this involving JavaScript and a DirectLink
component.

Here is my current solution:

<GROSS HACK>

--- In .page specification ----------------------
<component id="detailLink" type="DirectLink">
	<binding name="listener" expression="listeners.DetailListener"
/></component>


--- Method (called from ognl) defined in .java page class ---
public String getDetailActionScript()
{
	TableRows rows = (TableRows)getComponent("rows");
	SplashMessage currentRow = (SplashMessage)rows.getTableRow();

	DirectLink link = (DirectLink)getComponent("detailLink");
	
	// set properties attribute of DirectLink so our listener can
	// pick up an id in the parameter array
	try {
		BeanUtils.setProperty(link, "parameters",
currentRow.getId());
	} catch (Exception ignore) {}
		
	String url = link.getLink(getRequestCycle()).getURL();
	
	return "go('" + url + "')";
}

--- In .html template ---------------------------
<script
...
function go(url) {
	window.location=url;
}

</script>
...
<tr jwcid="rows@contrib:TableRows"
	class="ognl:beans.evenOdd.next"
	onclick="ognl:detailActionScript"
	onmouseover="rowMouseOver(this)" 
	onmouseout="rowMouseOut(this)">

...
</tr>
</table>

<!-- To get rid of warning that component wasn't used -->
<span jwcid="detailLink" />

</GROSS HACK>

Dumping a DirectLink component into my page like this smells bad.
The code in getDetailActionScript() is also nearly un-maintainable.

Does anyone have ideas to make this all more Tapestry-like?

Thanks to all for reading,
Paul-Michael Bauer


DISCLAIMER:
**This E-mail and any of its attachments may contain Lincoln National Corporation proprietary information, which is privileged, confidential, or subject to copyright belonging to the Lincoln National Corporation family of companies. This E-mail is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this E-mail, you are hereby notified that any dissemination, distribution, copying, or action taken in relation to the contents of and attachments to this E-mail is strictly prohibited and may be unlawful. If you have received this E-mail in error, please notify the sender immediately and permanently delete the original and any copy of this E-mail and any printout. Thank You.**

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


Re: contrib:Table, JavaScript, and DirectLinks

Posted by Johan Maasing <jo...@zoom.nu>.
> I am writing a Tapestry app with a summary/detail set of screens.
> 
> Clicking anywhere in a summary row (generated by contrib:Table
> components) allows the user to drill down to the detail screen.
> 
> I have a _gross_ hack for this involving JavaScript and a DirectLink
> component.
> 
> Here is my current solution:

I recently tried to do something similar. Being a tapestry newbie it 
took some mucking about until I gor it to work. Anyways I've attached a 
HTML-file where I jotted down how I did it. Hopefully it can give some 
ideas or at least something for you veterans to laugh at :-)


Elementary question: How does component pass reference to itself when invoking IActionListener

Posted by kranga <kr...@k2d2.org>.
The actionTriggered takes a reference to the calling component, but there
doesn't seem to be any method on the request cycle that eventually makes its
way to the listener to find out who called to get a reference to the calling
component.

I know I can use the set/get Attribute() method and pass a reference, but
thats a kludge at best. What am I missing?



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


Re: good place to order many copies of Howard's book

Posted by Jim Zajkowski <ji...@jimz.net>.
On Jan 7, 2005, at 4:18 PM, Andrew Arrow wrote:

> Is there a good place to order many copies of Howard's book?

Did you try e-mailing Manning and see if they'll give you a discount?

--Jim

-- 
Jim Zajkowski          OpenPGP 0x21135C3    http://www.jimz.net/pgp.asc
System Administrator  8A9E 1DDF 944D 83C3 AEAB  8F74 8697 A823 2113 5C53
UM Life Sciences Institute



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


good place to order many copies of Howard's book

Posted by Andrew Arrow <an...@verizon.net>.
Is there a good place to order many copies of Howard's book?  My company is 
thinking about getting 20 copies or so for a class on Tapestry.  We were just 
going to order from best price here:

http://www.shopzilla.com/12--Tapestry_in_Action_-_cat_id--8096__prod_id--11326315

unless there is a sneaky Tapestry-User-Mailing-List-Place to order from?

Thanks,
-Andrew


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


Re: contrib:Table, JavaScript, and DirectLinks

Posted by Derek Brown <ze...@yahoo.com>.
Hello,

I have taken the same approach. But my question is how
do I get a Integer parameter set. When i do something
like obj.getId() - This usally returns a
java.lang.Integer, but this shows up as a service
parameter sp=S(id). So now I have to use instance of
in the action to watch for both strings or integers.
How can I make sure it gets set as an Integer and not
a String?

Thanks


--- "Bauer, Paul-Michael" <PB...@LNC.com> wrote:

> Tapestry users,
> 
> I am writing a Tapestry app with a summary/detail
> set of screens.
> 
> Clicking anywhere in a summary row (generated by
> contrib:Table
> components) allows the user to drill down to the
> detail screen.
> 
> I have a _gross_ hack for this involving JavaScript
> and a DirectLink
> component.
> 
> Here is my current solution:
> 
> <GROSS HACK>
> 
> --- In .page specification ----------------------
> <component id="detailLink" type="DirectLink">
> 	<binding name="listener"
> expression="listeners.DetailListener"
> /></component>
> 
> 
> --- Method (called from ognl) defined in .java page
> class ---
> public String getDetailActionScript()
> {
> 	TableRows rows = (TableRows)getComponent("rows");
> 	SplashMessage currentRow =
> (SplashMessage)rows.getTableRow();
> 
> 	DirectLink link =
> (DirectLink)getComponent("detailLink");
> 	
> 	// set properties attribute of DirectLink so our
> listener can
> 	// pick up an id in the parameter array
> 	try {
> 		BeanUtils.setProperty(link, "parameters",
> currentRow.getId());
> 	} catch (Exception ignore) {}
> 		
> 	String url =
> link.getLink(getRequestCycle()).getURL();
> 	
> 	return "go('" + url + "')";
> }
> 
> --- In .html template ---------------------------
> <script
> ...
> function go(url) {
> 	window.location=url;
> }
> 
> </script>
> ...
> <tr jwcid="rows@contrib:TableRows"
> 	class="ognl:beans.evenOdd.next"
> 	onclick="ognl:detailActionScript"
> 	onmouseover="rowMouseOver(this)" 
> 	onmouseout="rowMouseOut(this)">
> 
> ...
> </tr>
> </table>
> 
> <!-- To get rid of warning that component wasn't
> used -->
> <span jwcid="detailLink" />
> 
> </GROSS HACK>
> 
> Dumping a DirectLink component into my page like
> this smells bad.
> The code in getDetailActionScript() is also nearly
> un-maintainable.
> 
> Does anyone have ideas to make this all more
> Tapestry-like?
> 
> Thanks to all for reading,
> Paul-Michael Bauer
> 
> 
> DISCLAIMER:
> **This E-mail and any of its attachments may contain
> Lincoln National Corporation proprietary
> information, which is privileged, confidential, or
> subject to copyright belonging to the Lincoln
> National Corporation family of companies. This
> E-mail is intended solely for the use of the
> individual or entity to which it is addressed. If
> you are not the intended recipient of this E-mail,
> you are hereby notified that any dissemination,
> distribution, copying, or action taken in relation
> to the contents of and attachments to this E-mail is
> strictly prohibited and may be unlawful. If you have
> received this E-mail in error, please notify the
> sender immediately and permanently delete the
> original and any copy of this E-mail and any
> printout. Thank You.**
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 
> 



		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com 

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