a problem about tapestry5's minxins

2012-06-06 Thread yeehuqiu
with tapestry5.3. I have some codes 
eg:
package com.ailk.mapp.tapestry.app.mixins;

import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ClientElement;
import org.apache.tapestry5.annotations.AfterRender;
import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.InjectContainer;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;

@Import (library=confirm.js)
public class Confirm {

@Parameter(value = Are you sure?, defaultPrefix =
BindingConstants.LITERAL)
private String message;
@Inject
private JavaScriptSupport javaScriptSupport;
@InjectContainer
private ClientElement element;
@AfterRender
public void afterRender() {

System.out.println(confirm--);
javaScriptSupport.addScript(new Confirm('%s', '%s');,
element.getClientId(), message);
}
}

Confirm.java 's path is
/mapp/src/main/java/com/ailk/mapp/tapestry/app/mixins/Confirm.java
and confirm.js's code

var Confirm = Class.create();
Confirm.prototype = {
initialize: function(element, message) {

alert(=confirmjs)
this.message = message;
Event.observe($(element), 'click',
this.doConfirm.bindAsEventListener(this));
},

doConfirm: function(e) {
if(! confirm(this.message))
e.stop();
}
}

confirm.js 's path is
/mapp/src/main/*resources*/com/ailk/mapp/tapestry/app/mixins/confirm.js

when I user them in my page .but it doesn't work .
input t:type=submit value=delete t:mixins=confirm t:message=Are you
sure you want to delete this item?   /.
where is my problem. why it doesn't work? 
thanks in advance!
 

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/a-problem-about-tapestry5-s-minxins-tp5713655.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: a problem about tapestry5's minxins

2012-06-06 Thread Howard Lewis Ship
What have you done so far to diagnose this problem?

For example, if I were dealing with this (I often do) I start by
checking that the page, and the JavaScript, rendered as I expected.

I'd then check the browser console for errors.

I'd also set breakpoints in my JS code to see if and when it is executed.

When debugging, you always want to go from a position of certainty to
another position of certainty. This requires you to gather facts as
you go.

On Tue, Jun 5, 2012 at 11:54 PM, yeehuqiu yeehu...@gmail.com wrote:
 with tapestry5.3. I have some codes
 eg:
 package com.ailk.mapp.tapestry.app.mixins;

 import org.apache.tapestry5.BindingConstants;
 import org.apache.tapestry5.ClientElement;
 import org.apache.tapestry5.annotations.AfterRender;
 import org.apache.tapestry5.annotations.Import;
 import org.apache.tapestry5.annotations.InjectContainer;
 import org.apache.tapestry5.annotations.Parameter;
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.services.javascript.JavaScriptSupport;

 @Import (library=confirm.js)
 public class Confirm {

        @Parameter(value = Are you sure?, defaultPrefix =
 BindingConstants.LITERAL)
        private String message;
        @Inject
        private JavaScriptSupport javaScriptSupport;
        @InjectContainer
        private ClientElement element;
        @AfterRender
        public void afterRender() {

                System.out.println(confirm--);
        javaScriptSupport.addScript(new Confirm('%s', '%s');,
 element.getClientId(), message);
        }
 }

 Confirm.java 's path is
 /mapp/src/main/java/com/ailk/mapp/tapestry/app/mixins/Confirm.java
 and confirm.js's code

 var Confirm = Class.create();
 Confirm.prototype = {
        initialize: function(element, message) {

                        alert(=confirmjs)
                this.message = message;
                Event.observe($(element), 'click',
 this.doConfirm.bindAsEventListener(this));
        },

        doConfirm: function(e) {
                if(! confirm(this.message))
                        e.stop();
        }
 }

 confirm.js 's path is
 /mapp/src/main/*resources*/com/ailk/mapp/tapestry/app/mixins/confirm.js

 when I user them in my page .but it doesn't work .
 input t:type=submit value=delete t:mixins=confirm t:message=Are you
 sure you want to delete this item?   /.
 where is my problem. why it doesn't work?
 thanks in advance!


 --
 View this message in context: 
 http://tapestry.1045711.n5.nabble.com/a-problem-about-tapestry5-s-minxins-tp5713655.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org




-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: a problem about tapestry5's minxins

2012-06-06 Thread yeehuqiu
 I ‘m learning tapestry5 just beginning. Now I'm doing a example about
deleting some records.So  I have searched some tutorial.But I can't
understand all those tutorial. Now I click the SUBMIT button. It doesn't
popup the confirm delete dialog box. (I'm doing the example reference
tutorial).So, I don't know the reason that  It doesn't popup the confirm
box.
HELP ME PLEASE. THANKS VERY MUCH!

2012/6/7 Howard Lewis Ship [via Tapestry] 
ml-node+s1045711n5713672...@n5.nabble.com

 What have you done so far to diagnose this problem?

 For example, if I were dealing with this (I often do) I start by
 checking that the page, and the JavaScript, rendered as I expected.

 I'd then check the browser console for errors.

 I'd also set breakpoints in my JS code to see if and when it is executed.

 When debugging, you always want to go from a position of certainty to
 another position of certainty. This requires you to gather facts as
 you go.

 On Tue, Jun 5, 2012 at 11:54 PM, yeehuqiu [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5713672i=0
 wrote:

  with tapestry5.3. I have some codes
  eg:
  package com.ailk.mapp.tapestry.app.mixins;
 
  import org.apache.tapestry5.BindingConstants;
  import org.apache.tapestry5.ClientElement;
  import org.apache.tapestry5.annotations.AfterRender;
  import org.apache.tapestry5.annotations.Import;
  import org.apache.tapestry5.annotations.InjectContainer;
  import org.apache.tapestry5.annotations.Parameter;
  import org.apache.tapestry5.ioc.annotations.Inject;
  import org.apache.tapestry5.services.javascript.JavaScriptSupport;
 
  @Import (library=confirm.js)
  public class Confirm {
 
 @Parameter(value = Are you sure?, defaultPrefix =
  BindingConstants.LITERAL)
 private String message;
 @Inject
 private JavaScriptSupport javaScriptSupport;
 @InjectContainer
 private ClientElement element;
 @AfterRender
 public void afterRender() {
 
 System.out.println(confirm--);
 javaScriptSupport.addScript(new Confirm('%s', '%s');,
  element.getClientId(), message);
 }
  }
 
  Confirm.java 's path is
  /mapp/src/main/java/com/ailk/mapp/tapestry/app/mixins/Confirm.java
  and confirm.js's code
 
  var Confirm = Class.create();
  Confirm.prototype = {
 initialize: function(element, message) {
 
 alert(=confirmjs)
 this.message = message;
 Event.observe($(element), 'click',
  this.doConfirm.bindAsEventListener(this));
 },
 
 doConfirm: function(e) {
 if(! confirm(this.message))
 e.stop();
 }
  }
 
  confirm.js 's path is
  /mapp/src/main/*resources*/com/ailk/mapp/tapestry/app/mixins/confirm.js
 
  when I user them in my page .but it doesn't work .
  input t:type=submit value=delete t:mixins=confirm t:message=Are
 you
  sure you want to delete this item?   /.
  where is my problem. why it doesn't work?
  thanks in advance!
 
 
  --
  View this message in context:
 http://tapestry.1045711.n5.nabble.com/a-problem-about-tapestry5-s-minxins-tp5713655.html
  Sent from the Tapestry - User mailing list archive at Nabble.com.
 
  -
  To unsubscribe, e-mail: [hidden 
  email]http://user/SendEmail.jtp?type=nodenode=5713672i=1
  For additional commands, e-mail: [hidden 
  email]http://user/SendEmail.jtp?type=nodenode=5713672i=2
 



 --
 Howard M. Lewis Ship

 Creator of Apache Tapestry

 The source for Tapestry training, mentoring and support. Contact me to
 learn how I can get you up and productive in Tapestry fast!

 (971) 678-5210
 http://howardlewisship.com

 -
 To unsubscribe, e-mail: [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5713672i=3
 For additional commands, e-mail: [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5713672i=4



 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://tapestry.1045711.n5.nabble.com/a-problem-about-tapestry5-s-minxins-tp5713655p5713672.html
  To unsubscribe from a problem about tapestry5's minxins, click 
 herehttp://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5713655code=eWVlaHVxaXVAZ21haWwuY29tfDU3MTM2NTV8LTE3NDYyMDg3NDg=
 .
 NAMLhttp://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




-- 

thanks and regards!

=

MSN: yeehu...@gmail.com

=


--
View this message in context: 
http://tapestry

Re: a problem about tapestry5's minxins

2012-06-06 Thread Taha Siddiqi
Have you tried firebox or some other js debugger to check if there is an error ?

On Jun 7, 2012, at 8:04 AM, yeehuqiu wrote:

 I ‘m learning tapestry5 just beginning. Now I'm doing a example about
 deleting some records.So  I have searched some tutorial.But I can't
 understand all those tutorial. Now I click the SUBMIT button. It doesn't
 popup the confirm delete dialog box. (I'm doing the example reference
 tutorial).So, I don't know the reason that  It doesn't popup the confirm
 box.
 HELP ME PLEASE. THANKS VERY MUCH!
 
 2012/6/7 Howard Lewis Ship [via Tapestry] 
 ml-node+s1045711n5713672...@n5.nabble.com
 
 What have you done so far to diagnose this problem?
 
 For example, if I were dealing with this (I often do) I start by
 checking that the page, and the JavaScript, rendered as I expected.
 
 I'd then check the browser console for errors.
 
 I'd also set breakpoints in my JS code to see if and when it is executed.
 
 When debugging, you always want to go from a position of certainty to
 another position of certainty. This requires you to gather facts as
 you go.
 
 On Tue, Jun 5, 2012 at 11:54 PM, yeehuqiu [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5713672i=0
 wrote:
 
 with tapestry5.3. I have some codes
 eg:
 package com.ailk.mapp.tapestry.app.mixins;
 
 import org.apache.tapestry5.BindingConstants;
 import org.apache.tapestry5.ClientElement;
 import org.apache.tapestry5.annotations.AfterRender;
 import org.apache.tapestry5.annotations.Import;
 import org.apache.tapestry5.annotations.InjectContainer;
 import org.apache.tapestry5.annotations.Parameter;
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.services.javascript.JavaScriptSupport;
 
 @Import (library=confirm.js)
 public class Confirm {
 
   @Parameter(value = Are you sure?, defaultPrefix =
 BindingConstants.LITERAL)
   private String message;
   @Inject
   private JavaScriptSupport javaScriptSupport;
   @InjectContainer
   private ClientElement element;
   @AfterRender
   public void afterRender() {
 
   System.out.println(confirm--);
   javaScriptSupport.addScript(new Confirm('%s', '%s');,
 element.getClientId(), message);
   }
 }
 
 Confirm.java 's path is
 /mapp/src/main/java/com/ailk/mapp/tapestry/app/mixins/Confirm.java
 and confirm.js's code
 
 var Confirm = Class.create();
 Confirm.prototype = {
   initialize: function(element, message) {
 
   alert(=confirmjs)
   this.message = message;
   Event.observe($(element), 'click',
 this.doConfirm.bindAsEventListener(this));
   },
 
   doConfirm: function(e) {
   if(! confirm(this.message))
   e.stop();
   }
 }
 
 confirm.js 's path is
 /mapp/src/main/*resources*/com/ailk/mapp/tapestry/app/mixins/confirm.js
 
 when I user them in my page .but it doesn't work .
 input t:type=submit value=delete t:mixins=confirm t:message=Are
 you
 sure you want to delete this item?   /.
 where is my problem. why it doesn't work?
 thanks in advance!
 
 
 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/a-problem-about-tapestry5-s-minxins-tp5713655.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.
 
 -
 To unsubscribe, e-mail: [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5713672i=1
 For additional commands, e-mail: [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5713672i=2
 
 
 
 
 --
 Howard M. Lewis Ship
 
 Creator of Apache Tapestry
 
 The source for Tapestry training, mentoring and support. Contact me to
 learn how I can get you up and productive in Tapestry fast!
 
 (971) 678-5210
 http://howardlewisship.com
 
 -
 To unsubscribe, e-mail: [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5713672i=3
 For additional commands, e-mail: [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5713672i=4
 
 
 
 --
 If you reply to this email, your message will be added to the discussion
 below:
 
 http://tapestry.1045711.n5.nabble.com/a-problem-about-tapestry5-s-minxins-tp5713655p5713672.html
 To unsubscribe from a problem about tapestry5's minxins, click 
 herehttp://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5713655code=eWVlaHVxaXVAZ21haWwuY29tfDU3MTM2NTV8LTE3NDYyMDg3NDg=
 .
 NAMLhttp://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
 
 
 
 
 -- 
 
 thanks and regards!
 
 =
 
 MSN: yeehu

Re: a problem about tapestry5's minxins

2012-06-06 Thread Thiago H de Paula Figueiredo

On Wed, 06 Jun 2012 23:34:52 -0300, yeehuqiu yeehu...@gmail.com wrote:


 I ‘m learning tapestry5 just beginning.


IMHO, mixins are an advanced concept, so my advice is that you shouldn't  
try to write your own nor trying to understand now. You're mixing too many  
things (pages, components, mixins, using JavaScript in Tapestry) to learn  
at the same time and this bringing you confusion and not knowledge. Before  
mixins, you need to really understand pages and components. In other  
words, start from the basics. ;)


Regarding your problem, the first thing you need to do, as already said  
here, is to check for JavaScript errors. Firebug is a very nice tool for  
that (and lots of other web development too).


--
Thiago H. de Paula Figueiredo

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org