Re: Filling some filed of a form selecting a row from a grid

2015-08-04 Thread Thiago H de Paula Figueiredo

On Mon, 03 Aug 2015 18:24:45 -0300, Luca Arzeni l.arz...@iname.com wrote:


Hi Thiago,


Hi!


invoice.

At this point you need to select a customer: you can insert a customer  
number, but, if you don't know it, you can press the search button at  
the right of the customer number and the system will open a popup  
showing you a list of customers.


You can choose one of them, and, after the selection, the popup will  
close, and the data of the selected customer will fill in you form.

I was trying to mimic this behavior.


Ok, now I think it's better explained.

What would be your way to do this? May be there is a simpler way, that I  
didn't spot, for solving this problem in tapestry?


I'd do what I proposed above.

Tapestry or not, there are basically two ways of doing what you want: 1)
doing an AJAX request that, after the option is selected, rerenders the
form with the corresponding fields filled and 2) use some JavaScript to
copy the values from the listing to the form. 1) can be easily done in
Tapestry using two zones: one around the form, one for showing the options
(list of customers). In the options, you'd have an EventLink which would
have the customer id as its context and its handler would use it to
pre-fill the properties which are bound to the form's search fields. 2) is
very easy if you know *basic* JavaScript. Like this (not tested, not
dynamic, but can be very easily made dynamic):
document.getElementById('address').value =
document.getElementById('address-from-grid').value.

Also, I understand that the fields in the invoice form could be wrapped  
in a zone and updated after the selection, but I don't understand how  
can I show a popup to the user, allow him to choose the customer, and  
get the data back to my form.


Unless you're talking about the much hated browser popups, popups are
merely CSS things. With CSS and a little bit of JavaScript you can make
parts of your page resize, appear or disappear. Anyway, that's outside the
scope of this mailing list.

--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: prefilling password

2015-08-04 Thread Lance Java
I've always considered this a bit of a security flaw. Using the javascript
console you can show the password in plain text.

Eg:

alert(document.getElementById('password').value);
On 3 Aug 2015 21:13, Thiago H de Paula Figueiredo thiag...@gmail.com
wrote:

 On Mon, 03 Aug 2015 15:04:27 -0300, Christine myli...@christine.nl
 wrote:

 I have a form with a password field. It gets pre-filled with a previously
 used password string. How can I prevent the browser and/or Tapestry from
 putting a value in the password field?


 This is actually done by the browser, not Tapestry, which never prefills
 password fields. I believe you should add autocomplete=false to your form
 or password field. More information here:
 https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
 .

 --
 Thiago H. de Paula Figueiredo
 Tapestry, Java and Hibernate consultant and developer
 http://machina.com.br

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




Re: Filling some filed of a form selecting a row from a grid

2015-08-04 Thread Luca Arzeni
Thank you Thiago, I got it!
Bye,
larzen


 Sent: Monday, August 03, 2015 at 11:56 PM
 From: Thiago H de Paula Figueiredo thiag...@gmail.com
 To: Tapestry users users@tapestry.apache.org
 Subject: Re: Filling some filed of a form selecting a row from a grid

 On Mon, 03 Aug 2015 18:24:45 -0300, Luca Arzeni l.arz...@iname.com wrote:
 
  Hi Thiago,
 
 Hi!
 
  invoice.
 
  At this point you need to select a customer: you can insert a customer  
  number, but, if you don't know it, you can press the search button at  
  the right of the customer number and the system will open a popup  
  showing you a list of customers.
 
  You can choose one of them, and, after the selection, the popup will  
  close, and the data of the selected customer will fill in you form.
  I was trying to mimic this behavior.
 
 Ok, now I think it's better explained.
 
  What would be your way to do this? May be there is a simpler way, that I  
  didn't spot, for solving this problem in tapestry?
 
 I'd do what I proposed above.
 
 Tapestry or not, there's basically two ways of doing what you want: 1)  
 doing an AJAX request that, after the option is selected, rerenders the  
 form with the corresponding fields filled and 2) use some JavaScript to  
 copy the values from the listing to the form. 1) can be easily done in  
 Tapestry using two zones: one around the form, one for showing the options  
 (list of customers). In the options, you'd have an EventLink which would  
 have the customer id as its context and its handler would use it to  
 pre-fill the properties which are bound to the form's search fields. 2) is  
 very easy if you know *basic* JavaScript. Like this (not tested, not  
 dynamic, but can be very easily made dynamic):  
 document.getElementById('address').value =  
 document.getElementById('address-from-grid').value.
 
  Also, I understand that the fields in the invoice form could be wrapped  
  in a zone and updated after the selection, but I don't understand how  
  can I show a popup to the user, allow him to choose the customer, and  
  get the data back to my form.
 
 Unless you're talking about the much rated browser popups, popups are  
 merely CSS things. With CSS and a little bit of JavaScript you can make  
 parts of your page resize, appear or disappear. Anyway, that's outside the  
 scope of this mailing list.
 
 -- 
 Thiago H. de Paula Figueiredo
 Tapestry, Java and Hibernate consultant and developer
 http://machina.com.br
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 
 

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



Re: Working with JPA - Page Requests - Checking if object with id exists - Redirecting if false

2015-08-04 Thread Geoff Callender
Have you read this?


http://jumpstart.doublenegative.com.au/jumpstart7/examples/infrastructure/handlingabadcontext/1

My personal preference is to treat ids that don’t exist, and ids that you are 
not authorised to, the same way: display a does not exist” message on the same 
page. It will be detected in setupRender() or, if there’s a Form, in 
onPrepareForRender(). To keep it simple and consistent you can create an 
ExistenceChecker component that you use like this:

t:form t:id=form context=“personId validate=this
t:existencechecker exists=“person name=message:Person-name
:
/t:existencechecker
/t:form

ExistenceChecker could start like this:

public class ExistenceChecker {

/**
 * Usually set by testing the entity of interest, eg. exists=“person” 
 * (which will be true if client is not null); or
 * the entity list of interest, eg. exists=evaluations” 
 * (which will be true if the list is not null and not empty).
 */
@Parameter(required = true)
@Property
private boolean exists;

/**
 * This name will be displayed to the user, substituted into the 
object-doesnotexist message.
 */
@Parameter(required = true)
private String name;

Here’s my ExistenceChecker.tml:

!DOCTYPE html
html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_4.xsd; 
xmlns:p=tapestry:parameter

t:content

t:if test=exists
t:body /
/t:if
t:if test=!exists
div class=alert ${alertClass} 
text-center${doesNotExistMessage}/div
/t:if

/t:content

/html

HTH,

Geoff


 On 4 Aug 2015, at 7:15 pm, Poggenpohl, Daniel 
 daniel.poggenp...@isst.fraunhofer.de wrote:
 
 Hello everyone,
 
 as the subject describes, we are trying to decide when to redirect the user 
 to the error page.
 
 Tapestry reads the context from the url. As it may happen, a (malicious or 
 not) user can decide to try out IDs with a URL. When in the page request 
 process should I look in the database, check if the object exists, and 
 redirect to an error page if necessary?
 
 Regards,
 Daniel P.



Re: Working with JPA - Page Requests - Checking if object with id exists - Redirecting if false

2015-08-04 Thread Thiago H de Paula Figueiredo
On Tue, 04 Aug 2015 06:15:08 -0300, Poggenpohl, Daniel  
daniel.poggenp...@isst.fraunhofer.de wrote:



Hello everyone,

as the subject describes, we are trying to decide when to redirect the  
user to the error page.


Tapestry reads the context from the url. As it may happen, a (malicious  
or not) user can decide to try out IDs with a URL. When in the page  
request process should I look in the database, check if the object  
exists, and redirect to an error page if necessary?


onActivate() and return a non-null (and non-this) value to tell Tapestry  
to do a redirection. See also  
http://tapestry.apache.org/page-navigation.html.


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



RE: Multiple domains, one webapp

2015-08-04 Thread Svein-Erik Løken
  4) You can't use Tapestry's Live Class Reloading on any class in the
  common
  JAR (e.g. Tapestry IOC service implementation classes).
 
  I think 4) is the biggest downside in a multi-module project. Do you
  think Tapestry can do a Live Class Reloading of the common JAR included
  with contributeCoreLibComponentClasses?
 
 If this is about Eclipse (I'm not sure about other IDEs, since I haven't
 used any besides Eclipse for many years), if you have all the projects
 open at the same time, you can use live class reloading on all of them at
 the same, and I do this all the time.
 

Really! I am using IntelliJ IDEA Ultimate and NEED this functionality. Today I 
need to recompile all maven projects and restart jetty for every change to 
components and JavaScript modules (all resources) in the common JAR.

The common JAR project is included in the Project view. Has anyone solved this 
in IntelliJ IDEA?



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


Re: Multiple domains, one webapp

2015-08-04 Thread Thiago H de Paula Figueiredo
On Tue, 04 Aug 2015 10:27:01 -0300, Svein-Erik Løken sv...@jacilla.no  
wrote:



 4) You can't use Tapestry's Live Class Reloading on any class in the
 common
 JAR (e.g. Tapestry IOC service implementation classes).

 I think 4) is the biggest downside in a multi-module project. Do you
 think Tapestry can do a Live Class Reloading of the common JAR  
included

 with contributeCoreLibComponentClasses?

If this is about Eclipse (I'm not sure about other IDEs, since I haven't
used any besides Eclipse for many years), if you have all the projects
open at the same time, you can use live class reloading on all of them  
at

the same, and I do this all the time.



Really! I am using IntelliJ IDEA Ultimate and NEED this functionality.  
Today I need to recompile all maven projects and restart jetty for every  
change to components and JavaScript modules (all resources) in the  
common JAR.


If you're including your common project as a JAR in the classpath of your  
main project, live class reloading will never work. On the other hand, if  
you include your common project's target folder (where the .class files  
are generated) in the classpath of your main project, it should work. I'm  
sure there's a way of doing that in IDEA. There has to be one. IDEA would  
suck if there wasn't, and apparently IDEA is the opposite of suck. :)


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Working with JPA - Page Requests - Checking if object with id exists - Redirecting if false

2015-08-04 Thread Poggenpohl, Daniel
Hello everyone,

as the subject describes, we are trying to decide when to redirect the user to 
the error page.

Tapestry reads the context from the url. As it may happen, a (malicious or not) 
user can decide to try out IDs with a URL. When in the page request process 
should I look in the database, check if the object exists, and redirect to an 
error page if necessary?

Regards,
Daniel P.


RE: Multiple domains, one webapp

2015-08-04 Thread Svein-Erik Løken
 1) You have to maintain three projects (or a Maven multi-module project if
 you're using Maven) instead of one.
 2) You'll have two different app servers to configure  maintain.
 3) You'll probably need to maintain database credentials in two different
 places.
 4) You can't use Tapestry's Live Class Reloading on any class in the common
 JAR (e.g. Tapestry IOC service implementation classes).


I think 4) is the biggest downside in a multi-module project. Do you think 
Tapestry can do a Live Class Reloading of the common JAR included with 
contributeCoreLibComponentClasses?



 5) If you use an automated build server like Jenkins then you'll have to
 set up and maintain triple the number of jobs.
 6) Your build process will be slower and more error prone because you'll
 often have to build the common JAR before building and deploying you'll
 have different log files.

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



Re: Working with JPA - Page Requests - Checking if object with id exists - Redirecting if false

2015-08-04 Thread Thiago H de Paula Figueiredo
On Tue, 04 Aug 2015 09:07:45 -0300, Geoff Callender  
geoff.callender.jumpst...@gmail.com wrote:



On the minus side, it gets called more than you might expect:

	http://jumpstart.doublenegative.com.au/jumpstart7/examples/navigation/onactivateandonpassivate/3  
http://jumpstart.doublenegative.com.au/jumpstart7/examples/navigation/onactivateandonpassivate/3


Yep, but if you don't do it on onActivate(), you may miss security checks  
for event handlers, just checking page render requets. :)


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: Multiple domains, one webapp

2015-08-04 Thread Thiago H de Paula Figueiredo
On Tue, 04 Aug 2015 10:05:49 -0300, Svein-Erik Løken sv...@jacilla.no  
wrote:


4) You can't use Tapestry's Live Class Reloading on any class in the  
common

JAR (e.g. Tapestry IOC service implementation classes).


I think 4) is the biggest downside in a multi-module project. Do you  
think Tapestry can do a Live Class Reloading of the common JAR included  
with contributeCoreLibComponentClasses?


If this is about Eclipse (I'm not sure about other IDEs, since I haven't  
used any besides Eclipse for many years), if you have all the projects  
open at the same time, you can use live class reloading on all of them at  
the same, and I do this all the time.


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: Working with JPA - Page Requests - Checking if object with id exists - Redirecting if false

2015-08-04 Thread Geoff Callender
Just be aware that there are pluses and minuses to doing it in onActivate(). On 
the plus side, onActivate() is an event handler, so it can control what’s 
displayed next by its return type. The return type could even be new 
HttpError(404, Page not found);


http://jumpstart.doublenegative.com.au/jumpstart7/examples/navigation/returntypes1
 
http://jumpstart.doublenegative.com.au/jumpstart7/examples/navigation/returntypes1

On the minus side, it gets called more than you might expect:


http://jumpstart.doublenegative.com.au/jumpstart7/examples/navigation/onactivateandonpassivate/3
 
http://jumpstart.doublenegative.com.au/jumpstart7/examples/navigation/onactivateandonpassivate/3

Geoff

 On 4 Aug 2015, at 9:51 pm, Thiago H de Paula Figueiredo thiag...@gmail.com 
 wrote:
 
 On Tue, 04 Aug 2015 06:15:08 -0300, Poggenpohl, Daniel 
 daniel.poggenp...@isst.fraunhofer.de wrote:
 
 Hello everyone,
 
 as the subject describes, we are trying to decide when to redirect the user 
 to the error page.
 
 Tapestry reads the context from the url. As it may happen, a (malicious or 
 not) user can decide to try out IDs with a URL. When in the page request 
 process should I look in the database, check if the object exists, and 
 redirect to an error page if necessary?
 
 onActivate() and return a non-null (and non-this) value to tell Tapestry to 
 do a redirection. See also http://tapestry.apache.org/page-navigation.html.
 
 -- 
 Thiago H. de Paula Figueiredo
 Tapestry, Java and Hibernate consultant and developer
 http://machina.com.br
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 



Re: Multiple domains, one webapp

2015-08-04 Thread Stephen Nutbrown
Hi,

Many thanks for all of your thoughts on this. I have chosen to go with
having a common project as a jar and setting up maven to build this project
first and use it as a dependency for the other two. This means i'll be able
to put the various entities in there that are shared between both web
applications. I am not *too* concerned about live class reloading if it's
only for the shared JAR since it will contain mainly only entities and it
doesn't take long whilst developing to just hit run again if I can't
figure out a better way. I would imagine these entities will remain
relatively static throughout the restructing as they are mapped to database
tables using hibernate and everything currently works, they are just going
to be moved.

Another factor in deciding to use this approach is that I have been told we
are having one side of the website launch before the other and this
division of the projects into separate web apps makes it slightly easier.

I'm looking at the documentation at he moment for how to create a jar file
for tapestry to use and I intend to use the documentation here:
https://tapestry.apache.org/component-libraries.html

I did spot that it says clearly at the top: This page has not yet been
fully updated for Tapestry 5.4. Things are different and simpler in 5.4
than in previous releases. but i'm going to have to just run with it and
find out what those changes are as I go along.

I think long term, having them split into two webapps that just share the
same model (the database and various entities) makes most sense. In the
meantime, whilst making this decision I have been working on the front end,
but after a while of reading up I am thinking (for us) this is the best
solution.

Any light on what the documentation is hinting at with the updates for that
page would be fantastic if anyone has any ideas.

Thanks,
Steve

On 4 August 2015 at 15:40, Thiago H de Paula Figueiredo thiag...@gmail.com
wrote:

 On Tue, 04 Aug 2015 10:27:01 -0300, Svein-Erik Løken sv...@jacilla.no
 wrote:

  4) You can't use Tapestry's Live Class Reloading on any class in the
  common
  JAR (e.g. Tapestry IOC service implementation classes).
 
  I think 4) is the biggest downside in a multi-module project. Do you
  think Tapestry can do a Live Class Reloading of the common JAR included
  with contributeCoreLibComponentClasses?

 If this is about Eclipse (I'm not sure about other IDEs, since I haven't
 used any besides Eclipse for many years), if you have all the projects
 open at the same time, you can use live class reloading on all of them at
 the same, and I do this all the time.


 Really! I am using IntelliJ IDEA Ultimate and NEED this functionality.
 Today I need to recompile all maven projects and restart jetty for every
 change to components and JavaScript modules (all resources) in the common
 JAR.


 If you're including your common project as a JAR in the classpath of your
 main project, live class reloading will never work. On the other hand, if
 you include your common project's target folder (where the .class files are
 generated) in the classpath of your main project, it should work. I'm sure
 there's a way of doing that in IDEA. There has to be one. IDEA would suck
 if there wasn't, and apparently IDEA is the opposite of suck. :)

 --
 Thiago H. de Paula Figueiredo
 Tapestry, Java and Hibernate consultant and developer
 http://machina.com.br

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




Re: Multiple domains, one webapp

2015-08-04 Thread Lance Java
Further from Thiagos connents...

In eclipse, when using the m2e plugin you can right click on a project

Properties - Maven - Resolve dependencies from Workplace projects

This is flagged on by default. Perhaps intellij has a similar configuration
option?

It's rare that eclipse can do something that intellij cant.


Re: Multiple domains, one webapp

2015-08-04 Thread Stephen Nutbrown
It's checked by default on my Eclipse Lunar - I haven't used it yet as i'm
just diving into making this shared module to see how it goes.

Thanks,
Steve

On 4 August 2015 at 16:15, Lance Java lance.j...@googlemail.com wrote:

 Further from Thiagos connents...

 In eclipse, when using the m2e plugin you can right click on a project

 Properties - Maven - Resolve dependencies from Workplace projects

 This is flagged on by default. Perhaps intellij has a similar configuration
 option?

 It's rare that eclipse can do something that intellij cant.



Re: Multiple domains, one webapp

2015-08-04 Thread Stephen Nutbrown
Thanks. I have got the example set up from the documentation for the happy
lib.  I found some bits that seemed not quite right along the way. Perhaps
it is possible to attach full working examples to the documentation as a
zip or git repo. I am happy to attach it here for reference, any chance
someone can update it in the documentation?

Thanks,
Steve
On 4 Aug 2015 19:29, Thiago H de Paula Figueiredo thiag...@gmail.com
wrote:

 On Tue, 04 Aug 2015 12:19:40 -0300, Stephen Nutbrown steves...@gmail.com
 wrote:

 It's checked by default on my Eclipse Lunar - I haven't used it yet as i'm
 just diving into making this shared module to see how it goes.


 As long as the compiler target folder of the included
 library/module/subproject is included in the classpath of the main project,
 regardless of what tool you're using, live class reloading will work after
 a class in the library/module/subproject is recompiled. Maybe Eclipse makes
 it easier because it compiles automatically on save. I don't know how IDEA
 handles this.


 --
 Thiago H. de Paula Figueiredo
 Tapestry, Java and Hibernate consultant and developer
 http://machina.com.br

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




Re: Multiple domains, one webapp

2015-08-04 Thread Thiago H de Paula Figueiredo
On Tue, 04 Aug 2015 18:15:20 -0300, Stephen Nutbrown steves...@gmail.com  
wrote:


Thanks. I have got the example set up from the documentation for the  
happy lib.  I found some bits that seemed not quite right along the way.


Which ones? If there's anything wrong on the documentation, we should fix  
it.


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: Multiple domains, one webapp

2015-08-04 Thread Thiago H de Paula Figueiredo
On Tue, 04 Aug 2015 12:12:02 -0300, Stephen Nutbrown steves...@gmail.com  
wrote:



Hi,


Hi!

I'm looking at the documentation at he moment for how to create a jar  
file for tapestry to use and I intend to use the documentation here:

https://tapestry.apache.org/component-libraries.html

I did spot that it says clearly at the top: This page has not yet been
fully updated for Tapestry 5.4. Things are different and simpler in 5.4
than in previous releases. but i'm going to have to just run with it and
find out what those changes are as I go along.


I don't think this has really changed in Tapestry 5.4. At least I cannot  
recall anything like that. Anyway, I think creating component libraries in  
any Tapestry version is already easy and the pre-5.4 way of doing that  
will continue to work in 5.4+, as the project has always been very  
concerned with backward compatibility.


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: Multiple domains, one webapp

2015-08-04 Thread Thiago H de Paula Figueiredo
On Tue, 04 Aug 2015 12:19:40 -0300, Stephen Nutbrown steves...@gmail.com  
wrote:


It's checked by default on my Eclipse Lunar - I haven't used it yet as  
i'm just diving into making this shared module to see how it goes.


As long as the compiler target folder of the included  
library/module/subproject is included in the classpath of the main  
project, regardless of what tool you're using, live class reloading will  
work after a class in the library/module/subproject is recompiled. Maybe  
Eclipse makes it easier because it compiles automatically on save. I don't  
know how IDEA handles this.



--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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