Re: component paramter frustrations

2013-12-05 Thread John
here is the template with the problematic actionlink highlighted


http://tapestry.apache.org/schema/tapestry_5_3.xsd";
  xmlns:p="tapestry:parameter"  xmlns:tx="tapestry-library:tapx">






${message:text.diarydenied}

   








${name}

${message:text.diaryinstructions}

${message:label.appointmentdate}(${timeZoneName})




${startDateDay}

${startDateNum}

${startDateMon}









${startTimeFmt}
 ${entryDetails}






${message:text.pickadate}

${message:text.anotherdate}:



${startDateDay}

${startDateNum}

${startDateMon}












${message:text.proposalinstructions}

${message:label.proposal}




${message:text.callininstructions}

${message:label.callintime}













the debug log shows the parameters are passed from the browser, but do not get 
to the page class:

components.Diary REQ: reservationIdParm=4
components.Diary REQ: t:ac=admin
components.Diary REQ: t:zoneid=timeZone
components.Diary REQ: venueIdParm=1
components.Diary REQ: workIdParm=2
components.Diary preload:{venueIdParm=null, workIdParm=null, 
reservationIdParm=null}

public class Diary {

@Parameter
private Integer workIdParm;
@Parameter
private Integer venueIdParm;
@Parameter
private Integer reservationIdParm;
@Property
private HashMap parms;

private void presetup() {
bookingForm.clearErrors();
parms = new HashMap();
parms.put("workIdParm", workIdParm);
parms.put("venueIdParm", venueIdParm);
parms.put("reservationIdParm", reservationIdParm);
for (String pname : request.getParameterNames()) {
log.debug("REQ: " + pname + "=" + request.getParameter(pname));
}
log.debug("preload:" + parms);
}

void onActionFromTimeClicked(long timeClicked) {
presetup();
startTimex = new Date(timeClicked);
startDatex = new Date((startTimex.getTime() / TimeConstants.MS_DAY) * 
TimeConstants.MS_DAY);
log.debug("selected " + new Date(timeClicked) + " " + startDatex);
loadTimes(15);
loadCallInTimes();
ajaxResponseRenderer.addRender(timeZone).addRender(formZone);
}

The page class thows a NPE on subsequent use of the workIdParm.

I'd really like the @Paremeter members to be added to all the client side links 
by default, seems like boilerplate code to me.

  - Original Message - 
  From: Thiago H de Paula Figueiredo 
  To: Tapestry users 
  Sent: Thursday, December 05, 2013 1:36 PM
  Subject: Re: component paramter frustrations


  Without the code *and* template we cannot help you. We could only guess  
  what's happening.

  -- 
  Thiago H. de Paula Figueiredo
  Tapestry, Java and Hibernate consultant and developer
  http://machina.com.br
  Help me spend a whole month working on Tapestry bug fixes and  
  improvements: http://igg.me/at/t5month

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


Re: BeanEditForm autofocus issue with JSR 303 validaiton mixed with tapestry validation (Tapestry 5.4-alpha-29)

2013-12-05 Thread Balázs Palcsó
I forgot to post the definition of @Validate("password") which makes the
password field the first required field in the form (and making it to owner
of the focus on the form)

@Contribute(ValidatorMacro.*class*)

*public* *static* *void*
combinePasswordValidators(*final*MappedConfiguration
configuration) {

configuration.add("password", "required,minlength=5,maxlength=50,regexp=" +
ValidationConstants.*PASSWORD_REGEXP*);

}




On 5 December 2013 21:43, Balázs Palcsó  wrote:

> Hi All,
>
> I have the following BeanEditForm:
>
>  t:submitLabel="${message:registrationButton-label}"
>
> include=
> *"username,lastName,firstName,email,phone,password,confirmPassword,newsletter"*
> >
>
> 
>
> Backed by a User class with these properties:
>
> @NotNull
>
> @NotBlank
>
> @Size(min = 3, max = 30)
>
> *private* String firstName;
>
>
>  @NotNull
>
> @NotBlank
>
> @Size(min = 3, max = 30)
>
> *private* String lastName;
>
>
>  @NotNull
>
> @NotBlank
>
> @Size(min = 3, max = 20)
>
> @Pattern(regexp = ValidationConstants.*USERNAME_REGEXP*, message =
> "{com.ajanlatotkapok.user.User.username-pattern-message}")
>
> *private* String username;
>
>
>  @NotNull
>
> @NotBlank
>
> @Email
>
> *private* String email;
>
>
>  @Pattern(regexp = ValidationConstants.*PHONE_NUMBER_REGEXP*, message =
> "{phone-regexp-message}")
>
> @Size(min = 9, max = 20)
>
> *private* String phone;
>
>
>  @Validate("password")
>
> @Transient
>
> *private* String password;
>
>
>  @Validate("password")
>
> @Transient
>
> *private* String confirmPassword;
>
> By default the autofocus is enabled for the BeanEditForm and it seems that
> only tapestry's @Validate fields are considered when determining which
> field is the first required field on the form ignoring @NotNull and
> @NotBlank JSR-303 annotations.
>
> As a workaround I can annotate all required fields
> with @Validate("required"), though I would prefer to stick with only
> JSR-303 where I can.
>
> Shall I raise a bug in JIRA?
>
> Thanks and regards,
> Balazs Palcso
>
>
>
>


Fwd: BeanEditForm autofocus issue with JSR 303 validaiton mixed with tapestry validation (Tapestry 5.4-alpha-29)

2013-12-05 Thread Balázs Palcsó
Hi All,

I have the following BeanEditForm:





Backed by a User class with these properties:

@NotNull

@NotBlank

@Size(min = 3, max = 30)

*private* String firstName;


 @NotNull

@NotBlank

@Size(min = 3, max = 30)

*private* String lastName;


 @NotNull

@NotBlank

@Size(min = 3, max = 20)

@Pattern(regexp = ValidationConstants.*USERNAME_REGEXP*, message =
"{com.ajanlatotkapok.user.User.username-pattern-message}")

*private* String username;


 @NotNull

@NotBlank

@Email

*private* String email;


 @Pattern(regexp = ValidationConstants.*PHONE_NUMBER_REGEXP*, message =
"{phone-regexp-message}")

@Size(min = 9, max = 20)

*private* String phone;


 @Validate("password")

@Transient

*private* String password;


 @Validate("password")

@Transient

*private* String confirmPassword;

By default the autofocus is enabled for the BeanEditForm and it seems that
only tapestry's @Validate fields are considered when determining which
field is the first required field on the form ignoring @NotNull and
@NotBlank JSR-303 annotations.

As a workaround I can annotate all required fields
with @Validate("required"), though I would prefer to stick with only
JSR-303 where I can.

Shall I raise a bug in JIRA?

Thanks and regards,
Balazs Palcso


tapestry-bootstrap question

2013-12-05 Thread Nicolas Barrera
Hi,

Just wandering why should I use the fwtype parameter as in the jumpstart
bootstrap example (
http://jumpstart.doublenegative.com.au/jumpstart/examples/styling/bootstrap/1
)

Refresh


I 've been using the tapestry-bootstrap library and using the class
parameter instead and obtained same results


Refresh




Nicolás.-


Re: using tapx-templating with T5.4

2013-12-05 Thread Thiago H de Paula Figueiredo
On Thu, 05 Dec 2013 13:16:37 -0200, Lenny Primak   
wrote:



I just went through this exercise on my client's project.
I explored both tapestry-offline and just using HtmlUnit GET a page,
then clean it up and send it out as Email.
We wound up using Freemarker for this.  Template syntax is largely the  
same, there is no cleanup necessary and it works better for Email  
purpose than Tapestry templating.


Tapestry templates were built to generate (X)HTML markup, same for its  
components, so it's not a generic template engine. Freemarker is a generic  
template engine, so it's a better choice then Tapestry templates for  
non-webapp stuff (at least most scenarios).


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
Help me spend a whole month working on Tapestry bug fixes and  
improvements: http://igg.me/at/t5month


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



Re: using tapx-templating with T5.4

2013-12-05 Thread Lenny Primak
I just went through this exercise on my client's project.
I explored both tapestry-offline and just using HtmlUnit GET a page,
then clean it up and send it out as Email.

We wound up using Freemarker for this.  Template syntax is largely the same,
there is no cleanup necessary and it works better for Email purpose than 
Tapestry templating.


On Dec 5, 2013, at 5:34 AM, Martin Nagl wrote:

> Hi all,
> 
> I need to generate nice HTML formatted emails from my future tapestry app.
> It would be cool if I could use tapestry templating capabilities for that.
> I know there is tapx-templating project, but I found it incompatible with
> 5.4.
> 
> Are there any plans to make tapx-templating compatible with Tapestry 5.4?
> Or is there any alternative approach for generating HTML from my .tml files
> offline?
> 
> BTW thanks for the work on 5.4. Finally I can have Bootstrap & JQuery in my
> T5 app by default.
> 
> Regards
> Martin Nagl
> 
> 
> 


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



Re: component paramter frustrations

2013-12-05 Thread Thiago H de Paula Figueiredo
Without the code *and* template we cannot help you. We could only guess  
what's happening.


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
Help me spend a whole month working on Tapestry bug fixes and  
improvements: http://igg.me/at/t5month


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



Re: component paramter frustrations

2013-12-05 Thread John
I am trying to preserve the components parameter values between event 
invocations by storing them in a map that gets passed to all my action links 
and forms.

I have added t:parameters="parms" to all my action links and see that in 
request object the parameters are set. However in the code below the presetup 
routine can get null values for the assoicated @Parameter members. On the first 
invocation of onActionFromTimeClicked the @Parameter members do get set but on 
subsequent invocations they become are null even though teh request passes 
values?

When I inspect the links in the browser the parameter values are all there. Why 
does the component sometimes not set parameters?

John


public class Diary {

@Parameter
private Integer workIdParm;
@Parameter
private Integer venueIdParm;
@Parameter
private Integer reservationIdParm;
@Property
private HashMap parms;
...


private void presetup() {
bookingForm.clearErrors();
parms = new HashMap();
parms.put("workIdParm", workIdParm);
parms.put("venueIdParm", venueIdParm);
parms.put("reservationIdParm", reservationIdParm);
for (String pname : request.getParameterNames()) {
log.debug("REQ: " + pname + "=" + request.getParameter(pname));
}
log.debug("preload:" + parms);
}

@SetupRender
void setup() throws Exception {
log.debug("setup diary parms=" + workIdParm + "," + venueIdParm + "," + 
reservationIdParm);
Reservation reservation = null;
if (reservationIdParm != null) {
reservation = reservationFacade.getReservation(reservationIdParm);
log.debug("load parms from reservation" + workIdParm + "," + 
venueIdParm);
}
presetup();
...
}

void onActionFromTimeClicked(long timeClicked) {
presetup();
startTimex = new Date(timeClicked);
startDatex = new Date((startTimex.getTime() / TimeConstants.MS_DAY) * 
TimeConstants.MS_DAY);
log.debug("selected " + new Date(timeClicked) + " " + startDatex);
loadTimes(15);
loadCallInTimes();
ajaxResponseRenderer.addRender(timeZone).addRender(formZone);
}

...
}

  - Original Message - 
  From: Thiago H de Paula Figueiredo 
  To: Tapestry users 
  Sent: Monday, December 02, 2013 3:59 PM
  Subject: Re: component paramter frustrations


  On Mon, 02 Dec 2013 12:14:39 -0200, John  wrote:

  > Yes that's right, my page is passing some key id values to deeper  
  > components, but the paramter value is lost after the intitial component  
  > render. That's my challenge.

  How are you updating the page after the initial render? Zone updates?  
  EventLink? Form? As Lance said, you should use the event context of  
  EventLink and ActionLink and even Form so you don't miss them.

  -- 
  Thiago H. de Paula Figueiredo
  Tapestry, Java and Hibernate consultant and developer
  http://machina.com.br
  Help me spend a whole month working on Tapestry bug fixes and  
  improvements: http://igg.me/at/t5month

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


Re: using tapx-templating with T5.4

2013-12-05 Thread Lance Java
Try tapestry-offline https://github.com/uklance/tapestry-offline

Unlike tapx-templating, tapestry-offline can happily live inside a tapestry
web application.


DateField date format troubles

2013-12-05 Thread lacko
Hallo everyone!



I'm starting to be desperate about DateField component. In my case, this 
component works only for default format settings, other format makes it 
unusable and buggy. 

This is basic example I've tried without success:







  

  






-The value is viewed correctly (e.g. 2013-12-05), but when I clict some 
value from visual calendar, it is placed into textfied in default format ( 
12/05/2013) and error occures when you tried to submit value, as it can't be
parsed by specified -MM-dd format.




I've tried to customize datefield by CustomDatepicker mixin, so I've added 
params getter method into my page class:


public JSONObject getParams() {

  return new JSONObject("dateFormat", "yy-mm-dd");

}





and adjust template regardingly:




 





This makes it slightly better. Value picked in calendar popup is placed in 
textfield in correct format. BUT, textfield value disapears when it is 
submited! When I inspect the code in Chrome, I can see that value attribute 
is filled as it should be:










but the value is simply missing in textfield rendered on page.

I've tried also to modify code in DateField class directly and interested 
thing is, that when I write second input tag, completely same as original 
one (sure, same id and name is wrong, but just for try) with writer.elemet(.
..), the second input shows the value correctly (it just doesn't have class=
"hasDatepicker" attribute set).




Documentation says about ajax validation, but I can't see (or maybe can't 
detect) any ajax calls. Should I set or configure something special?

I'm using Tapestry 5.3.7. I have set "SUPPRESS_PROTOTYPE" to "true".





I would be glad for any hint how to get it work, or tutorial how to get 
other datepicker component (able to handle different date formats) to work 
in Tapestry. 

Best regards

Ladislav


using tapx-templating with T5.4

2013-12-05 Thread Martin Nagl
Hi all,

I need to generate nice HTML formatted emails from my future tapestry app.
It would be cool if I could use tapestry templating capabilities for that.
I know there is tapx-templating project, but I found it incompatible with
5.4.

Are there any plans to make tapx-templating compatible with Tapestry 5.4?
Or is there any alternative approach for generating HTML from my .tml files
offline?

BTW thanks for the work on 5.4. Finally I can have Bootstrap & JQuery in my
T5 app by default.

Regards
Martin Nagl