Problem using EventListener annotation
Hi, I'm currently using Tapestry 4.1.3 and I'm trying to copy the EventListener annotation example from: http://tapestry.apache.org/tapestry4.1/ajax/eventlistener.html. The example shows how a method can be annotated with EventListener to respond to DOM events. Unfortunately the EventListener method is never being called when I try to run it. Everything compiles ok, and I've been able to use other Tapestry functionality (such as submit button listeners) on this page. Below is my code, can anyone help me out? Home.html ... body div id=myFavoriteDivBig brother is watching you./div /body ... Home.page ?xml version=1.0? !DOCTYPE page-specification PUBLIC -//Apache Software Foundation//Tapestry Specification 4.0//EN http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd; page-specification class=pages.HomePage /page-specification HomePage.java package pages; import org.apache.tapestry.annotations.EventListener; import org.apache.tapestry.event.BrowserEvent; import org.apache.tapestry.html.BasePage; import org.apache.tapestry.record.PropertyChangeObserver; public class HomePage extends BasePage { @Override public String getClientId() { // TODO Auto-generated method stub return null; } @Override public void setClientId(String arg0) { // TODO Auto-generated method stub } public PropertyChangeObserver getPropertyChangeObserver() { // TODO Auto-generated method stub return null; } @EventListener(elements = myFavoriteDiv, events = onmouseover) public void watchText(BrowserEvent e) { System.out.println(mouseover detected); System.out.println(e); } } -- View this message in context: http://www.nabble.com/Problem-using-EventListener-annotation-tp15072602p15072602.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem using EventListener annotation
Thank for the help. Adding @Shell and @Body components resolved the problem. Marcus Schulte wrote: 1. Make sure, your template includes a @Shell and a @Body component as shown here: http://tapestry.apache.org/tapestry4.1/ajax/basics.html 2. please also try to keep your page-class abstract and remove the auto-generated stubs of methods. Tapestry generates a concrete class for each component/page at runtime (should not be the cause of your trouble, though). 2008/1/24, HBKTron [EMAIL PROTECTED]: Hi, I'm currently using Tapestry 4.1.3 and I'm trying to copy the EventListener annotation example from: http://tapestry.apache.org/tapestry4.1/ajax/eventlistener.html. The example shows how a method can be annotated with EventListener to respond to DOM events. Unfortunately the EventListener method is never being called when I try to run it. Everything compiles ok, and I've been able to use other Tapestry functionality (such as submit button listeners) on this page. Below is my code, can anyone help me out? Home.html ... body div id=myFavoriteDivBig brother is watching you./div /body ... Home.page ?xml version=1.0? !DOCTYPE page-specification PUBLIC -//Apache Software Foundation//Tapestry Specification 4.0//EN http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd; page-specification class=pages.HomePage /page-specification HomePage.java package pages; import org.apache.tapestry.annotations.EventListener; import org.apache.tapestry.event.BrowserEvent; import org.apache.tapestry.html.BasePage; import org.apache.tapestry.record.PropertyChangeObserver; public class HomePage extends BasePage { @Override public String getClientId() { // TODO Auto-generated method stub return null; } @Override public void setClientId(String arg0) { // TODO Auto-generated method stub } public PropertyChangeObserver getPropertyChangeObserver() { // TODO Auto-generated method stub return null; } @EventListener(elements = myFavoriteDiv, events = onmouseover) public void watchText(BrowserEvent e) { System.out.println(mouseover detected); System.out.println(e); } } -- View this message in context: http://www.nabble.com/Problem-using-EventListener-annotation-tp15072602p15072602.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Marcus Schulte http://marcus-schulte.blogspot.com -- View this message in context: http://www.nabble.com/Problem-using-EventListener-annotation-tp15072602p15074453.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Drawing error with Tapestry Dojo Dialog Component
Hi, I'm having a drawing error while trying to learn how to use the Tapestry Dialog component from Dojo. http://tapestry.apache.org/tapestry4.1/components/dojo/dialog.html Basically I have an initially hidden dialog box that I'd like to show after a DirectLink component is clicked. The dialog box appearing works fine, but any content I put inside the box is drawn outside of it by browsers (tested with Firefox 2.0.0.11 and Safari 3.0.4). If I refresh the page manually, then the dialog box content appears inside correctly. I have read the above link carefully, but still can't see what I'm doing wrong. Ideally I'd like to have something simple like the Show Dialog DirectLink in the TimeTracker application. http://opencomponentry.com:8080/timetracker/app Below is my code, any help would be greatly appreciated thanks :) NOTE: Although I wouldn't make the boolean that decides whether or not the dialog is hidden a HomePage class attribute in practice, I did in this example to simplify the code. Thanks again! Home.html html jwcid=@Shell title=Basic AJAX Page headmeta http-equiv=Content-Type content=text/html; charset=UTF-8 style type=text/css .dialog { background-color: white; width: 400px; height: 300px; } /style /head body jwcid=@Body Show Dialog div jwcid=[EMAIL PROTECTED] hidden=ognl:dialogHidden style=display:none; p class=dialogSample dialog content/p /div /body /html HomePage.java package pages; import org.apache.tapestry.IRequestCycle; import org.apache.tapestry.html.BasePage; public abstract class HomePage extends BasePage { private boolean dialogHidden = true; public boolean getDialogHidden() { return dialogHidden; } public void setDialogHidden(boolean flag) { dialogHidden = flag; } public void onShowDialog(IRequestCycle cycle) { setDialogHidden(false); } public void onHideDialog(IRequestCycle cycle) { setDialogHidden(true); } } -- View this message in context: http://www.nabble.com/Drawing-error-with-Tapestry-Dojo-Dialog-Component-tp15076602p15076602.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]