Re: HTML5 Button Component for tapetry 5.4.x

2019-09-13 Thread Luca Arzeni
Hi Chris,
see the reply to Thiago for my use case.
Thanks,
Luca

> Sent: Wednesday, September 11, 2019 at 2:58 PM
> From: "Chris Poulsen" 
> To: "Tapestry users" 
> Subject: Re: HTML5 Button Component for tapetry 5.4.x
>
> We usually just style the various Tapestry link components to get buttons
> with the desired behavior.
>
> --
> Chris
>
> On Wed, Sep 11, 2019 at 1:45 PM Luca Arzeni  wrote:
>
> > Hi there,
> > I googled a little around, but I was not able to find a tapestry component
> > that generates a button.
> >
> > Here you can find a first attempt to create such component.
> > It was shameless copied from the Submit component already present in
> > tapestry.
> >
> > I would be happy if someone more expert than me could revise it and add to
> > the core components.
> >
> > Regards,
> > larzeni
> >
> > package org.apache.tapestry5.corelib.components;
> >
> > import org.apache.tapestry5.BindingConstants;
> > import org.apache.tapestry5.ClientElement;
> > import org.apache.tapestry5.ComponentAction;
> > import org.apache.tapestry5.ComponentResources;
> > import org.apache.tapestry5.EventConstants;
> > import org.apache.tapestry5.MarkupWriter;
> > import org.apache.tapestry5.TrackableComponentEventCallback;
> > import org.apache.tapestry5.annotations.Environmental;
> > import org.apache.tapestry5.annotations.Events;
> > import org.apache.tapestry5.annotations.Import;
> > import org.apache.tapestry5.annotations.Parameter;
> > import org.apache.tapestry5.annotations.SupportsInformalParameters;
> > import org.apache.tapestry5.corelib.SubmitMode;
> > import org.apache.tapestry5.corelib.components.Form;
> > import org.apache.tapestry5.corelib.components.Loop;
> > import org.apache.tapestry5.internal.util.Holder;
> > import org.apache.tapestry5.ioc.annotations.Inject;
> > import org.apache.tapestry5.ioc.internal.util.InternalUtils;
> > import org.apache.tapestry5.json.JSONArray;
> > import org.apache.tapestry5.services.FormSupport;
> > import org.apache.tapestry5.services.Heartbeat;
> > import org.apache.tapestry5.services.Request;
> > import org.apache.tapestry5.services.javascript.JavaScriptSupport;
> >
> > /**
> >  * Corresponds to  or  > type="image">, a client-side element that can force the
> >  * enclosing form to submit. The submit responsible for the form
> > submission will post a notification that allows the
> >  * application to know that it was the responsible entity. The
> > notification is named
> >  * {@linkplain EventConstants#SELECTED selected}, by default, and has no
> > context.
> >  *
> >  * @tapestrydoc
> >  */
> > @SupportsInformalParameters
> > @Events(EventConstants.SELECTED + " by default, may be overridden")
> > @Import(module="t5/core/forms")
> > public class Html5Button implements ClientElement {
> >
> > /**
> >  * If true (the default), then any notification sent by the
> > component will be deferred until the end of the form
> >  * submission (this is usually desirable). In general, this can be
> > left as the default except when the Submit
> >  * component is rendering inside a {@link Loop}, in which case
> > defer should be bound to false (otherwise, the
> >  * event context will always be the final value of the Loop).
> >  */
> > @Parameter
> > private boolean defer = true;
> >
> > /**
> >  * The name of the event that will be triggered if this component
> > is the cause of the form submission. The default
> >  * is {@link EventConstants#SELECTED}.
> >  */
> > @Parameter(allowNull = false, defaultPrefix =
> > BindingConstants.LITERAL)
> > private String event = EventConstants.SELECTED;
> >
> > /**
> >  * If true, then the field will render out with a disabled
> > attribute
> >  * (to turn off client-side behavior). When the form is submitted,
> > the
> >  * bound value is evaluated again and, if true, the field's value
> > is
> >  * ignored (not even validated) and the component's events are not
> > fired.
> >  */
> > @Parameter("false")
> > private boolean disabled;
> >
> > @Parameter(defaultPrefix = BindingConstants.LITERAL)
> > private String type;
> >
> > /**
> >  * The list of valu

Re: HTML5 Button Component for tapetry 5.4.x

2019-09-13 Thread Luca Arzeni
Hi Thiago,

I was trying to use html5 client validation.
Tapestry docs says that you can enable it in AppModule, adding:

configuration.add(SymbolConstants.ENABLE_HTML5_SUPPORT, "true");

And this works fine, but then, at least in Chromium and Firefox, you need a 
 in the form to trigger it.

You can't use a LinkSubmit (which generates an "" tag), since the LinkSubmit 
calls only javascript validation, and not the Html5 form validation.

But the  is severely limited when it comes to 
customization, as it cannot contain internal element, so you cannot use 
bootstrap glyphs to style it, for example. You could hide the  and workaround it's restrictions using some js, but this is too 
ugly to be a "real" solution.

So I need to place a  inside the form. The button can be 
styled at your wish using bootstrap, and, as side effect, you can place more 
than one button inside the form, so I can have a "save" and "save and new", 
which is one of my requirements.

Thanks for your job,
Luca


> Sent: Thursday, September 12, 2019 at 3:05 AM
> From: "Thiago H. de Paula Figueiredo" 
> To: "Tapestry users" 
> Subject: Re: HTML5 Button Component for tapetry 5.4.x
>
> On Wed, Sep 11, 2019 at 8:45 AM Luca Arzeni  wrote:
>
> > Hi there,
> >
>
> Hello!
>
>
> > I googled a little around, but I was not able to find a tapestry component
> > that generates a button.
> >
>
> What's exactly the use case you're thinking here? I cannot remember the
> last time I used one and I'm not exactly an HTML expert nor a designer, so
> I'm curious what you used it for. :)
>
> For submitting forms, if you have a single button, you don't even need to
> use the Submit component. An ordinary  suffices for
> the From component. Submit's main reason to exist is when you have more
> than one button, so it triggers an event so you know which one was used.
>
> Welcome to the Tapestry users mailing list!
>
>
> >
> > Here you can find a first attempt to create such component.
> > It was shameless copied from the Submit component already present in
> > tapestry.
> >
> > I would be happy if someone more expert than me could revise it and add to
> > the core components.
> >
> > Regards,
> > larzeni
> >
> > package org.apache.tapestry5.corelib.components;
> >
> > import org.apache.tapestry5.BindingConstants;
> > import org.apache.tapestry5.ClientElement;
> > import org.apache.tapestry5.ComponentAction;
> > import org.apache.tapestry5.ComponentResources;
> > import org.apache.tapestry5.EventConstants;
> > import org.apache.tapestry5.MarkupWriter;
> > import org.apache.tapestry5.TrackableComponentEventCallback;
> > import org.apache.tapestry5.annotations.Environmental;
> > import org.apache.tapestry5.annotations.Events;
> > import org.apache.tapestry5.annotations.Import;
> > import org.apache.tapestry5.annotations.Parameter;
> > import org.apache.tapestry5.annotations.SupportsInformalParameters;
> > import org.apache.tapestry5.corelib.SubmitMode;
> > import org.apache.tapestry5.corelib.components.Form;
> > import org.apache.tapestry5.corelib.components.Loop;
> > import org.apache.tapestry5.internal.util.Holder;
> > import org.apache.tapestry5.ioc.annotations.Inject;
> > import org.apache.tapestry5.ioc.internal.util.InternalUtils;
> > import org.apache.tapestry5.json.JSONArray;
> > import org.apache.tapestry5.services.FormSupport;
> > import org.apache.tapestry5.services.Heartbeat;
> > import org.apache.tapestry5.services.Request;
> > import org.apache.tapestry5.services.javascript.JavaScriptSupport;
> >
> > /**
> >  * Corresponds to  or  > type="image">, a client-side element that can force the
> >  * enclosing form to submit. The submit responsible for the form
> > submission will post a notification that allows the
> >  * application to know that it was the responsible entity. The
> > notification is named
> >  * {@linkplain EventConstants#SELECTED selected}, by default, and has no
> > context.
> >  *
> >  * @tapestrydoc
> >  */
> > @SupportsInformalParameters
> > @Events(EventConstants.SELECTED + " by default, may be overridden")
> > @Import(module="t5/core/forms")
> > public class Html5Button implements ClientElement {
> >
> > /**
> >  * If true (the default), then any notification sent by the
> > component will be deferred until the end of the form
> >  * submission (this is usually desirable). In general, this can be
> > left as the default except when the Submi

HTML5 Button Component for tapetry 5.4.x

2019-09-11 Thread Luca Arzeni
Hi there,
I googled a little around, but I was not able to find a tapestry component that 
generates a button.

Here you can find a first attempt to create such component.
It was shameless copied from the Submit component already present in tapestry.

I would be happy if someone more expert than me could revise it and add to the 
core components.

Regards,
larzeni

package org.apache.tapestry5.corelib.components;

import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ClientElement;
import org.apache.tapestry5.ComponentAction;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.EventConstants;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.TrackableComponentEventCallback;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Events;
import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.SupportsInformalParameters;
import org.apache.tapestry5.corelib.SubmitMode;
import org.apache.tapestry5.corelib.components.Form;
import org.apache.tapestry5.corelib.components.Loop;
import org.apache.tapestry5.internal.util.Holder;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
import org.apache.tapestry5.json.JSONArray;
import org.apache.tapestry5.services.FormSupport;
import org.apache.tapestry5.services.Heartbeat;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;

/**
 * Corresponds to input type="submit" or input type="image", a 
client-side element that can force the
 * enclosing form to submit. The submit responsible for the form submission 
will post a notification that allows the
 * application to know that it was the responsible entity. The notification is 
named
 * {@linkplain EventConstants#SELECTED selected}, by default, and has no 
context.
 *
 * @tapestrydoc
 */
@SupportsInformalParameters
@Events(EventConstants.SELECTED + " by default, may be overridden")
@Import(module="t5/core/forms")
public class Html5Button implements ClientElement {

/**
 * If true (the default), then any notification sent by the component 
will be deferred until the end of the form
 * submission (this is usually desirable). In general, this can be left 
as the default except when the Submit
 * component is rendering inside a {@link Loop}, in which case defer 
should be bound to false (otherwise, the
 * event context will always be the final value of the Loop).
 */
@Parameter
private boolean defer = true;

/**
 * The name of the event that will be triggered if this component is 
the cause of the form submission. The default
 * is {@link EventConstants#SELECTED}.
 */
@Parameter(allowNull = false, defaultPrefix = BindingConstants.LITERAL)
private String event = EventConstants.SELECTED;

/**
 * If true, then the field will render out with a disabled attribute
 * (to turn off client-side behavior). When the form is submitted, the
 * bound value is evaluated again and, if true, the field's value is
 * ignored (not even validated) and the component's events are not 
fired.
 */
@Parameter("false")
private boolean disabled;

@Parameter(defaultPrefix = BindingConstants.LITERAL)
private String type;

/**
 * The list of values that will be made available to event handler 
method of this component when the form is
 * submitted.
 *
 * @since 5.1.0.0
 */
@Parameter
private Object[] context;

/**
 * Defines the mode, or client-side behavior, for the submit. The 
default is {@link SubmitMode#NORMAL}; clicking the
 * button submits the form with validation. {@link SubmitMode#CANCEL} 
indicates the form should be submitted as a cancel,
 * with no client-side validation. {@link SubmitMode#UNCONDITIONAL} 
bypasses client-side validation, but does not indicate
 * that the form was cancelled.
 *
 * @see EventConstants#CANCELED
 * @since 5.2.0
 */
@Parameter(allowNull = false, defaultPrefix = BindingConstants.LITERAL)
private SubmitMode mode = SubmitMode.NORMAL;

/**
 * CSS class for the element.
 *
 * @since 5.4
 */
@Parameter(name = "class", defaultPrefix = BindingConstants.LITERAL, 
value = "message:private-core-components.submit.class")
private String cssClass;

@Environmental
private FormSupport formSupport;

@Environmental
private Heartbeat heartbeat;

@Inject
private ComponentResources resources;

@Inject
private Request request;

@Inject
private JavaScriptSupport 

A definitive word on @EJB and CDI

2019-02-21 Thread Luca Arzeni
Hi,
I'm using tapestry5.4 with java 8, in a JEE environment. Actually, I'm using 
JBoss 7.1.eap Application Server (which is, more or less, the same of WildFly8).

I'm packaging my tapestry5 WAR inside an EAR, and I need to access some 
stateless session beans declared in another JAR.

The current way I'm accessing the ejbeans is looking into the jndi tree in the 
web appModule with a code similar to the following:

public static IMyEjbInterface buildMyEjbImplementation() {
// yes, I know that this works only under jboss :-)
return = MyTools.jndiLookup("java:myJar/"+ 
MyEjbImplementation.class.getSimpleName());
}

This way I can inject the stateless session bean into my pages using the 
tapestry @Inject annotation.

I fell my solution is a little  bit clumsy, so I was wandering if there was a 
better way to do this.
I would be happy to learn the "tapestry5 recommended way" to reach this goal.

As first attempt, I thought that the simpler way is to inject the ejb directly 
into the page using an @EJB annotation.

Looking into docs and googling around I found the following options:

1) tapestry wiki: https://wiki.apache.org/tapestry/JEE-Annotation. This is a 
mix between flowlogix and tapestry jumpstart. This page has not been updated 
from 2011, so I wonder if it is something more up to date...

2) flowlogix: https://github.com/flowlogix/flowlogix. The last commit is two 
year old, but it seems to be stopped at tapestry 5.3

3) tapestry jump start: there is a working example, updated for tapestry 5.4, 
but it's scope is limited only to the @EJB annotation.

4) tapestry-cdi. This looks the most promising, I could use also some other 
annotation (I need @Singleton, for example), and I see that it is built inside 
the tapestry code source tree, so it should be updated and compatible with last 
version of the framework, but:

  a) I could not find a maven/gradle already built jar (eg: no 
org.apache.tapestry:tapstry-cdi:5.4.x)
  b) I cannot find this module in the staging/org/apache/tapestry/ repositories
  c) I could only find it by downloading sources or binaries of tapestry5 
directly from tapestry5 web site.

So the question is: is tapestry-cdi the right way to go or it is "abandonware"?

Why tapestry-cdi it is not distributed with the others tapestry jars in 
mavencentral, jcenter or others repositories?

What is the recommended way to inject an EJB inside a tapestry page?

Thank you,
larzeni

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



Re: Access request from tml / standard servlet api role support

2018-04-30 Thread Luca Arzeni
Hi Thiago,
thanks for the hint, I didn't knew that I can @Inject HttpServletRequest! 

One never stops learning...

Thanks, Luca

> Sent: Saturday, April 28, 2018 at 8:55 PM
> From: "Thiago H. de Paula Figueiredo" 
> To: "Tapestry users" 
> Subject: Re: Access request from tml / standard servlet api role support
>
> Hello, everyone!
> 
> On Sat, Apr 28, 2018 at 8:45 AM, Dmitry Gusev 
> wrote:
> 
> > As others pointed in this thread, the Tapestry way of dealing with your
> > requirement is to create a new component,
> > similar to `t:If`, that would accept a role name as it's parameter so you
> > could render it's body conditionally if user is in role, i.e.:
> >
> > public class HasRole extends
> > org.apache.tapestry5.corelib.base.AbstractConditional
> > {
> > @Inject RequestGlobals requestGlobals;
> > @Parameter(required=true, defaultPrefix=BindingConstants.LITERAL)
> > String role;
> >
> > @Override
> > protected boolean test()
> > {
> > return requestGlobals.getHTTPServletRequest().isUserInRole(role);
> > }
> > }
> >
> > Above code is almost a copy-paste of tapestry-security's HasRole component
> > [4].
> >
> 
> I believe that, for the context of the question (i.e. not being able to use
> tapestry-security), that's the Right Way of doing this. You want something
> code encapsulated so it can be easily reused in Tapestry? Put it in a
> component (or a mixin in some cases), and Tapestry makes it very simple to
> do it. It may be possible to plug authentication and authorization logic
> from Spring Security into Shiro, which is incredibly well-architected and
> flexible, but I guess it's overkill here.
> 
> I'd just make a little change: @Inject HttpServletRequest directly instead
> of getting it through RequestGlobals.
> 
> -- 
> Thiago
> 

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



Re: Access request from tml / standard servlet api role support

2018-04-30 Thread Luca Arzeni
Hello Thiago,
ciao is fine, you are right!

The idea of binding prefix is interesting, I never thought of using it this way!
Thanks again,
Luca


> Sent: Saturday, April 28, 2018 at 8:55 PM
> From: "Thiago H. de Paula Figueiredo" <thiag...@gmail.com>
> To: "Tapestry users" <users@tapestry.apache.org>
> Subject: Re: Access request from tml / standard servlet api role support
>
> On Sat, Apr 28, 2018 at 7:51 AM, Luca Arzeni <l.arz...@iname.com> wrote:
> 
> > Hi,
> >
> 
> Hello, Luca! (Ciao? :D )
> 
> 
> > this is an idea, but I was hoping to have direct access to the request.
> > In tapestry3 there was a direct way to access the Visit Object, and the
> > ognl was well documented, but it seems that there is no more similar in
> > tapestry5.
> >
> 
> There isn't and that's by design. The Tapestry 5 philosophy, at least the
> internal one, is to have the least code in templates possible, so
> ressurecting Tapestry 4-'s direct access to the request object wouldn't
> make sense, IMHO. You can always create your own binding prefixes, though,
> so you can do basically everything with Tapestry expressions as long as
> you're willing to implement a binding prefix.
> 
> 
> >
> > Thank you,
> > larzeni
> >
> >
> > > Sent: Saturday, April 28, 2018 at 12:41 AM
> > > From: "pico.dev" <pico@gmail.com>
> > > To: "Tapestry users" <users@tapestry.apache.org>
> > > Subject: Re: Access request from tml / standard servlet api role support
> > >
> > > Hi,
> > >
> > > Maybe you can implement a new conditional component that checks the role
> > > and render or not its body. Something like this:
> > >
> > > 
> > > SAVE DATA
> > > 
> > >
> > > See https://tapestry.apache.org/component-rendering.html
> > >
> > > Regards,
> > >
> > > El sáb., 28 abr. 2018 a las 0:12, Luca Arzeni (<l.arz...@iname.com>)
> > > escribió:
> > >
> > > > Hi,
> > > > I'm using tapestry5.4 with java 8.
> > > >
> > > > I am using the standard servlet API to check if a user is in role or
> > not,
> > > > to hide or show buttons, links, and so on.
> > > >
> > > > For example, I need to show a button to the user only if the user has
> > been
> > > > granted a role.
> > > >
> > > > My usual way to to this is:
> > > >
> > > > 1) create a method in the page, for example:
> > > >
> > > > @Inject
> > > > RequestGlobals m_requestGlobals;
> > > >
> > > > public boolean isUserAdmin() {
> > > > if (m_requestGlobals == null) {
> > > > return false;
> > > > }
> > > > return m_requestGlobals.isUserInRole("ADMIN");
> > > > }
> > > >
> > > > 2) then, in the tml, check the method using a t:if component, for
> > example:
> > > >
> > > > 
> > > > SAVE
> > DATA
> > > > 
> > > >
> > > > This is not so good, since I must reimplement the same method in many
> > > > pages.
> > > >
> > > > Is there any way could I access the requestGlobals directly from tml?
> > > >
> > > > My goql would be to write, directly in the tml, something like:
> > > >
> > > >
> > > > 
> > > > SAVE DATA
> > > > 
> > > >
> > > >
> > > > Is it possible to do this with tapestry5?
> > > >
> > > > Thanks in advance,
> > > > larzeni
> > > >
> > > > -
> > > > 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
> >
> >
> 
> 
> -- 
> Thiago
>

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



Re: Access request from tml / standard servlet api role support

2018-04-30 Thread Luca Arzeni
Hi Dmitry,
I ended up doing a component as you suggested.
I will take a look at tapestry-security when I have a little more time.
Thanks again,
larzeni


> Sent: Saturday, April 28, 2018 at 1:45 PM
> From: "Dmitry Gusev" <dmitry.gu...@gmail.com>
> To: "Tapestry users" <users@tapestry.apache.org>
> Subject: Re: Access request from tml / standard servlet api role support
>
> Hi Luca,
> 
> Component parameters syntax is built about binding expressions [1], i.e.
> "prefix:expression".
> 
> By default the prefix is "prop:", unless explicitly overridden for specific
> parameter [2].
> 
> You can find detailed explanation for property expressions, including its
> BNF grammar, in official Tapestry documentation [3].
> 
> Property expressions are always evaluated in the context of current
> page/component.
> 
> It's called "property" expression, because it uses JavaBean-notation
> properties (@Property annotation can generate get/set methods around field
> at runtime).
> 
> So in order for your expression `request.isUserInRole("ADMIN")` to work,
> the `request` must be a @Property (or has `getRequest()` method) in your
> page/component, i.e.:
> 
> @Inject
> @Property
> Request request;
> 
> There are no special cases for the built-in services in the BNF
> for property expressions [3].
> 
> As others pointed in this thread, the Tapestry way of dealing with your
> requirement is to create a new component,
> similar to `t:If`, that would accept a role name as it's parameter so you
> could render it's body conditionally if user is in role, i.e.:
> 
> public class HasRole extends
> org.apache.tapestry5.corelib.base.AbstractConditional
> {
> @Inject RequestGlobals requestGlobals;
> @Parameter(required=true, defaultPrefix=BindingConstants.LITERAL)
> String role;
> 
> @Override
> protected boolean test()
> {
> return requestGlobals.getHTTPServletRequest().isUserInRole(role);
> }
> }
> 
> Above code is almost a copy-paste of tapestry-security's HasRole component
> [4].
> 
> The only difference is this component uses servlet API directly for role
> checking,
> while is tapestry-security is built around Apache Shiro [5],
> and provides more advanced security model than simple role model of the
> servlet API.
> 
> I highly recommend tapestry-security if you need anything more than
> built-in servlet API role model.
> 
> [1]
> http://tapestry.apache.org/component-parameters.html#ComponentParameters-BindingExpressions
> [2]
> https://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/annotations/Parameter.html#defaultPrefix()
> [3] http://tapestry.apache.org/property-expressions.html
> [4] http://www.tynamo.org/tapestry-security+guide/
> [5] https://shiro.apache.org
> 
> On Sat, Apr 28, 2018 at 1:12 AM, Luca Arzeni <l.arz...@iname.com> wrote:
> 
> > Hi,
> > I'm using tapestry5.4 with java 8.
> >
> > I am using the standard servlet API to check if a user is in role or not,
> > to hide or show buttons, links, and so on.
> >
> > For example, I need to show a button to the user only if the user has been
> > granted a role.
> >
> > My usual way to to this is:
> >
> > 1) create a method in the page, for example:
> >
> > @Inject
> > RequestGlobals m_requestGlobals;
> >
> > public boolean isUserAdmin() {
> > if (m_requestGlobals == null) {
> > return false;
> > }
> > return m_requestGlobals.isUserInRole("ADMIN");
> > }
> >
> > 2) then, in the tml, check the method using a t:if component, for example:
> >
> > 
> > SAVE DATA
> > 
> >
> > This is not so good, since I must reimplement the same method in many
> > pages.
> >
> > Is there any way could I access the requestGlobals directly from tml?
> >
> > My goql would be to write, directly in the tml, something like:
> >
> >
> > 
> > SAVE DATA
> > 
> >
> >
> > Is it possible to do this with tapestry5?
> >
> > Thanks in advance,
> > larzeni
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
> 
> 
> -- 
> Dmitry Gusev
> 
> AnjLab Team
> http://anjlab.com
> 

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



Re: Access request from tml / standard servlet api role support

2018-04-28 Thread Luca Arzeni
Hi Kalle,
we are forced to use spring security, and cannot migrate to shiro.
Beside it, I don't like the idea to glue my code to external libraries, using 
annotations or other code that may have a different lifecycle.

I can wait as I want to update my code, but, if there is a security issue, I 
must be immediately able to update my security libs.
I like much more to declare security constraint outside my app (spring allows 
to do this with an xml file inside the WEB_INF folder) and use the standard 
servlet api, so I can migrate to a new version whenever I need.

I will take a look at the code. I guess I will need to create a custom 
component, but, in my humble opinion, it's a too big effort to write a 
component simply to access access the request object from a tml.

Anyway, thanks for your hint,
larzeni

> Sent: Saturday, April 28, 2018 at 12:52 AM
> From: "Kalle Korhonen" <kalle.o.korho...@gmail.com>
> To: "Tapestry users" <users@tapestry.apache.org>
> Subject: Re: Access request from tml / standard servlet api role support
>
> Tapestry-security (http://www.tynamo.org/tapestry-security+guide/) supports
> request.isuserInRole and provides components similar to the one suggested,
> i.e.
> 
> 
> SAVE DATA
> 
> 
> Kalle
> 
> 
> 
> 
> On Fri, Apr 27, 2018 at 3:41 PM, pico.dev <pico@gmail.com> wrote:
> 
> > Hi,
> >
> > Maybe you can implement a new conditional component that checks the role
> > and render or not its body. Something like this:
> >
> > 
> > SAVE DATA
> > 
> >
> > See https://tapestry.apache.org/component-rendering.html
> >
> > Regards,
> >
> > El sáb., 28 abr. 2018 a las 0:12, Luca Arzeni (<l.arz...@iname.com>)
> > escribió:
> >
> > > Hi,
> > > I'm using tapestry5.4 with java 8.
> > >
> > > I am using the standard servlet API to check if a user is in role or not,
> > > to hide or show buttons, links, and so on.
> > >
> > > For example, I need to show a button to the user only if the user has
> > been
> > > granted a role.
> > >
> > > My usual way to to this is:
> > >
> > > 1) create a method in the page, for example:
> > >
> > > @Inject
> > > RequestGlobals m_requestGlobals;
> > >
> > > public boolean isUserAdmin() {
> > > if (m_requestGlobals == null) {
> > > return false;
> > > }
> > > return m_requestGlobals.isUserInRole("ADMIN");
> > > }
> > >
> > > 2) then, in the tml, check the method using a t:if component, for
> > example:
> > >
> > > 
> > > SAVE DATA
> > > 
> > >
> > > This is not so good, since I must reimplement the same method in many
> > > pages.
> > >
> > > Is there any way could I access the requestGlobals directly from tml?
> > >
> > > My goql would be to write, directly in the tml, something like:
> > >
> > >
> > > 
> > > SAVE DATA
> > > 
> > >
> > >
> > > Is it possible to do this with tapestry5?
> > >
> > > Thanks in advance,
> > > larzeni
> > >
> > > -
> > > 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: Access request from tml / standard servlet api role support

2018-04-28 Thread Luca Arzeni
Yeah, that was my old way of doing this thing, but it ties classes too much, so 
I discarded that code.
Thank you,
larzeni

> Sent: Saturday, April 28, 2018 at 12:49 AM
> From: "pico.dev" <pico@gmail.com>
> To: "Tapestry users" <users@tapestry.apache.org>
> Subject: Re: Access request from tml / standard servlet api role support
>
> Maybe other alternative is create a base page class that has this and
> some/all application pages extends
> 
> @Inject
> RequestGlobals m_requestGlobals;
> 
> public boolean isUserAdmin()
> 
> El sáb., 28 abr. 2018 a las 0:41, pico.dev (<pico@gmail.com>) escribió:
> 
> > Hi,
> >
> > Maybe you can implement a new conditional component that checks the role
> > and render or not its body. Something like this:
> >
> > 
> > SAVE DATA
> > 
> >
> > See https://tapestry.apache.org/component-rendering.html
> >
> > Regards,
> >
> > El sáb., 28 abr. 2018 a las 0:12, Luca Arzeni (<l.arz...@iname.com>)
> > escribió:
> >
> >> Hi,
> >> I'm using tapestry5.4 with java 8.
> >>
> >> I am using the standard servlet API to check if a user is in role or not,
> >> to hide or show buttons, links, and so on.
> >>
> >> For example, I need to show a button to the user only if the user has
> >> been granted a role.
> >>
> >> My usual way to to this is:
> >>
> >> 1) create a method in the page, for example:
> >>
> >> @Inject
> >> RequestGlobals m_requestGlobals;
> >>
> >> public boolean isUserAdmin() {
> >> if (m_requestGlobals == null) {
> >> return false;
> >> }
> >> return m_requestGlobals.isUserInRole("ADMIN");
> >> }
> >>
> >> 2) then, in the tml, check the method using a t:if component, for example:
> >>
> >> 
> >> SAVE DATA
> >> 
> >>
> >> This is not so good, since I must reimplement the same method in many
> >> pages.
> >>
> >> Is there any way could I access the requestGlobals directly from tml?
> >>
> >> My goql would be to write, directly in the tml, something like:
> >>
> >>
> >> 
> >> SAVE DATA
> >> 
> >>
> >>
> >> Is it possible to do this with tapestry5?
> >>
> >> Thanks in advance,
> >> larzeni
> >>
> >> -
> >> 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: Access request from tml / standard servlet api role support

2018-04-28 Thread Luca Arzeni
Hi,
this is an idea, but I was hoping to have direct access to the request.
In tapestry3 there was a direct way to access the Visit Object, and the ognl 
was well documented, but it seems that there is no more similar in tapestry5.

Thank you,
larzeni


> Sent: Saturday, April 28, 2018 at 12:41 AM
> From: "pico.dev" <pico@gmail.com>
> To: "Tapestry users" <users@tapestry.apache.org>
> Subject: Re: Access request from tml / standard servlet api role support
>
> Hi,
> 
> Maybe you can implement a new conditional component that checks the role
> and render or not its body. Something like this:
> 
> 
> SAVE DATA
> 
> 
> See https://tapestry.apache.org/component-rendering.html
> 
> Regards,
> 
> El sáb., 28 abr. 2018 a las 0:12, Luca Arzeni (<l.arz...@iname.com>)
> escribió:
> 
> > Hi,
> > I'm using tapestry5.4 with java 8.
> >
> > I am using the standard servlet API to check if a user is in role or not,
> > to hide or show buttons, links, and so on.
> >
> > For example, I need to show a button to the user only if the user has been
> > granted a role.
> >
> > My usual way to to this is:
> >
> > 1) create a method in the page, for example:
> >
> > @Inject
> > RequestGlobals m_requestGlobals;
> >
> > public boolean isUserAdmin() {
> > if (m_requestGlobals == null) {
> > return false;
> > }
> > return m_requestGlobals.isUserInRole("ADMIN");
> > }
> >
> > 2) then, in the tml, check the method using a t:if component, for example:
> >
> > 
> > SAVE DATA
> > 
> >
> > This is not so good, since I must reimplement the same method in many
> > pages.
> >
> > Is there any way could I access the requestGlobals directly from tml?
> >
> > My goql would be to write, directly in the tml, something like:
> >
> >
> > 
> > SAVE DATA
> > 
> >
> >
> > Is it possible to do this with tapestry5?
> >
> > Thanks in advance,
> > larzeni
> >
> > -
> > 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



Access request from tml / standard servlet api role support

2018-04-27 Thread Luca Arzeni
Hi,
I'm using tapestry5.4 with java 8.

I am using the standard servlet API to check if a user is in role or not, to 
hide or show buttons, links, and so on.

For example, I need to show a button to the user only if the user has been 
granted a role.

My usual way to to this is:

1) create a method in the page, for example:

@Inject
RequestGlobals m_requestGlobals;

public boolean isUserAdmin() {
if (m_requestGlobals == null) {
return false;
}
return m_requestGlobals.isUserInRole("ADMIN");
}

2) then, in the tml, check the method using a t:if component, for example:


SAVE DATA


This is not so good, since I must reimplement the same method in many pages.

Is there any way could I access the requestGlobals directly from tml?

My goql would be to write, directly in the tml, something like:



SAVE DATA



Is it possible to do this with tapestry5?

Thanks in advance,
larzeni

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



Classloader issues under JBoss 6.X - 7.X - Patch Included

2017-12-01 Thread Luca Arzeni
Hi to all,
few years ago, I raised an alert concerning the compatibility between Tapestry5 
and JBoss; the thread was:

"Is tapestry plastic incompatible with JEE specs?"

https://mail-archives.apache.org/mod_mbox/tapestry-users/201512.mbox/%3Ctrinity-fc3b0e36-0402-4d71-b48a-4a464cbd6474-1449857158334@3capp-mailcom-lxa14%3E

At that time I found a workaround and concluded that there was no way to solve 
the issue, thinking that was a problem related to the jboss classloader (or, 
more generally, between an appserver classloader and the behaviour of plastic).

Few days ago, working on a new project under JBoss 7.0.0.GA, I was again badly 
hitted by this problem, but this time I investigated more thoroughly the issue 
and I found the source of all evil: the class 
"org.apache.tapestry5.internal.plastic.asm.ClassWriter" of plastic.

The classloader used to find (and load) the classes by plastic is really not 
compatible with an appserver. An appserver is required to enforce classloaded 
isolation and plastic ignores this.
Anyway plastic can be patched to solve the issue; here I attach a patch, please 
I ask to some developer to kindly forward and apply this patch to the 5.4.x 
branch and to the 5.5.

I also want to give thanks to these guys to help me to focus the problem:

https://stackoverflow.com/questions/42423907/unable-to-move-tapestry-jars-out-of-the-war-with-page-code-inside-the-war-still
https://blog.progs.be/50/tapestry-classloading-problems-on-jboss

Regards,
Luca Arzeni


*** Here is the original code: ***

1752 protected String getCommonSuperClass(final String type1, final String 
type2) {
1753 Class c, d;
1754 ClassLoader classLoader = getClass().getClassLoader();
1755 try {
1756 c = Class.forName(type1.replace('/', '.'), false, classLoader);
1757 d = Class.forName(type2.replace('/', '.'), false, classLoader);
1758 } catch (Exception e) {
1759 throw new RuntimeException(e.toString());
1760 }
1761 if (c.isAssignableFrom(d)) {
1762 return type1;
1763 }
1764 if (d.isAssignableFrom(c)) {
1765 return type2;
1766 }
1767 if (c.isInterface() || d.isInterface()) {
1768 return "java/lang/Object";
1769 } else {
1770 do {
1771 c = c.getSuperclass();
1772 } while (!c.isAssignableFrom(d));
1773 return c.getName().replace('.', '/');
1774 }
1775 }

*** Here is the patch: ***

1752protected String getCommonSuperClass(final String type1, final String 
type2) {
1753Class c, d;
1754ClassLoader classLoader = getClass().getClassLoader();
1755try {
1756c = Class.forName(type1.replace('/', '.'), false, classLoader);
1757d = Class.forName(type2.replace('/', '.'), false, classLoader);
1758} catch (Exception e) {
// --- ARZILLO PATCH BEGIN 
---

System.err.println("WARNING: type1:" + type1 + ", type2: " + 
type2 + ", exception: " + e + ", classLoader: " + classLoader +", attempting to 
use the classloader of the current thread");

classLoader = Thread.currentThread().getContextClassLoader();
if ( classLoader != null ) {

try {
c = Class.forName(type1.replace('/', '.'), 
false, classLoader);
d = Class.forName(type2.replace('/', '.'), 
false, classLoader);
}
catch (Exception e_inner) {
System.err.println("ERROR 1: type1:" + type1 + ", 
type2: " + type2 + ", e_inner: " + e_inner + ", classLoader: " + classLoader 
+", failed even using the classloader of the current thread");
throw new RuntimeException(e_inner.toString());
}
}
else {
System.err.println("ERROR 2: type1:" + type1 + ", 
type2: " + type2 + ", exception: " + e + ", classLoader: " + classLoader +", 
unable to get the classloader of the current thread");
throw new RuntimeException(e.toString());
}
// --- ARZILLO PATCH END 
---
1760}
1761if (c.isAssignableFrom(d)) {
1762return type1;
1763}
1764if (d.isAssignableFrom(c)) {
1765return type2;
1766}
1767if (c.isInterface() || d.isInterface()) {
1768return "java/lang/Object";
1779} else {
1770do {
1771c = c.getSuperclass();
1772} while (!c.isAssignableFrom(d));

Re: Is tapestry plastic incompatible with JEE specs? SADLY YES, BUT HERE IS A WORKAROUND

2015-12-15 Thread Luca Arzeni
Hi Jens,
to build the ear you should be in the root folder (tmp) and run the following 
task;

gradle ear

You will find the ear in the

./build/libs/Troubleshooting-1.0.ear

To deploy under jboss you should copy the ear in the standalone/deploments 
folder.

Thanks for you help,
Luca

> Sent: Tuesday, December 15, 2015 at 12:54 PM
> From: "Jens Breitenstein" <mailingl...@j-b-s.de>
> To: "Tapestry users" <users@tapestry.apache.org>
> Subject: Re: Is tapestry plastic incompatible with JEE specs? SADLY YES, BUT 
> HERE IS A WORKAROUND
>
> Hi Larzeni,
> 
> The project you provided as download only builds a WAR not EAR. As the 
> WAR declares all dependencies as "provided" it won't run anyway. Can you 
> provide the EAR gradle project? I downloaded Wildfly, Graddle but I need 
> your full "environment" to test it.
> Can you update it, please? I have to admit I never used Gradle before, 
> so maybe it's my fault, but at least my Intellij does not bring up an 
> EAR artifact either...
> 
> Jens
> 
> 
> Am 15/12/15 um 11:00 schrieb Luca Arzeni:
> > After struggling for a couple of week I have to admit my defeat.
> >
> > I've found no way to make the project to work.
> >
> > And NO, there is NO WAY to circument this issue using 
> > jboss-deployment-structure.xml, "Dependencies" iin manifest entries, or 
> > placing tapestry jars inside the jboss modules folder and folks like them.
> >
> > BUT, if some poor soul like me should face this issue, this is the 
> > workaround that I've found:
> >
> > 1) individuate the classes that causes you app to crash
> > 2) leave these classes in war/classes folder (not sure if this is needed, 
> > but I have no time to debunk also this point)
> > 3) generate an additional jar (say "classLoaderFucker.jar") which contains 
> > ONLY the classes that causes you app to crash
> > 4) place this jar in the ear/lib folder.
> >
> > This way plastic will find the classes that he needs in the ear lib folder 
> > (in it's same classloader), and will no more cause classloader issues.
> >
> > I fully understand that THIS IS NOT A SOLUTION, but simply a cumbersome 
> > workaround, and the procedure is a trial and error attempt to patch the 
> > issue, but at least my app is (for now...) working.
> >
> > (sadly) Thanks to all,
> > larzeni
> >
> >
> >> Sent: Friday, December 11, 2015 at 7:05 PM
> >> From: "Luca Arzeni" <l.arz...@iname.com>
> >> To: "Tapestry Users" <users@tapestry.apache.org>
> >> Subject: Is tapestry plastic incompatible with JEE specs?
> >>
> >> Hi there,
> >> my environment is:
> >> JBoss 7.2+  (actually 6.1.1.GA) or Wildfly 8.0 Final
> >> Tapestry5 5.3.7
> >>
> >> I'm developing a little ear, which has the following structure
> >>
> >> myear.ear
> >> |  core-1.1.jar
> >> |  webclient-1.1.war
> >> |  lib/
> >> |  plastic-5.3.7.jar
> >> |  tapestry5-annotations-5.3.7.jar
> >> |  tapestry-core-5.3.7.jar
> >> |  tapestry-func-5.3.7.jar
> >> |  tapestry-ioc-5.3.7.jar
> >> |  tapestry-json-5.3.7.jar
> >> |  tapestry-upload-5.3.7.jar
> >> |  ... omissis ...
> >>
> >> the core-1.1.jar module contains few EJBs,
> >> the webclient-1.1.war module contains my t5 app (pages, components and so 
> >> on)
> >>
> >> I routinely use and appreciate t5 IOC, so I used it also in the core 
> >> module; at this point I need to have the t5 jars available to the core AND 
> >> to the webclient, so I put them in the shared "lib" folder of the EAR.
> >>
> >> So far, so good: the app worked and I had no problem.
> >>
> >> Today I was needing to place an object (a simple bean with 3 strings 
> >> attributes and their getters and setters) and serialize/deserialize it 
> >> into a file.
> >>
> >> The bean is needed only in the webclient (I need to place it in session), 
> >> so I placed it in the webclient.war.
> >>
> >> Now my webapp crashed when I try to instantiate a page that refers to the 
> >> bean.
> >>
> >> Looking at the problem, it seems to be caused by plastic that tries to 
> >> reach the class by using the jboss classloader.
> >>
> >> This is the relevant part of the stack:
> >>
> >> ---
> >> org.apache.tapestry5.internal.plastic.asm.ClassWriter.getCo

Re: Is tapestry plastic incompatible with JEE specs? SADLY YES, BUT HERE IS A WORKAROUND

2015-12-15 Thread Luca Arzeni
After struggling for a couple of week I have to admit my defeat.

I've found no way to make the project to work.

And NO, there is NO WAY to circument this issue using 
jboss-deployment-structure.xml, "Dependencies" iin manifest entries, or placing 
tapestry jars inside the jboss modules folder and folks like them.

BUT, if some poor soul like me should face this issue, this is the workaround 
that I've found:

1) individuate the classes that causes you app to crash 
2) leave these classes in war/classes folder (not sure if this is needed, but I 
have no time to debunk also this point)
3) generate an additional jar (say "classLoaderFucker.jar") which contains ONLY 
the classes that causes you app to crash 
4) place this jar in the ear/lib folder.

This way plastic will find the classes that he needs in the ear lib folder (in 
it's same classloader), and will no more cause classloader issues.

I fully understand that THIS IS NOT A SOLUTION, but simply a cumbersome 
workaround, and the procedure is a trial and error attempt to patch the issue, 
but at least my app is (for now...) working.

(sadly) Thanks to all,
larzeni


> Sent: Friday, December 11, 2015 at 7:05 PM
> From: "Luca Arzeni" <l.arz...@iname.com>
> To: "Tapestry Users" <users@tapestry.apache.org>
> Subject: Is tapestry plastic incompatible with JEE specs?
>
> Hi there, 
> my environment is:
> JBoss 7.2+  (actually 6.1.1.GA) or Wildfly 8.0 Final
> Tapestry5 5.3.7
> 
> I'm developing a little ear, which has the following structure
> 
> myear.ear
> |  core-1.1.jar
> |  webclient-1.1.war
> |  lib/
>|  plastic-5.3.7.jar
>|  tapestry5-annotations-5.3.7.jar
>|  tapestry-core-5.3.7.jar
>|  tapestry-func-5.3.7.jar
>|  tapestry-ioc-5.3.7.jar
>|  tapestry-json-5.3.7.jar
>|  tapestry-upload-5.3.7.jar
>|  ... omissis ...
> 
> the core-1.1.jar module contains few EJBs,
> the webclient-1.1.war module contains my t5 app (pages, components and so on)
> 
> I routinely use and appreciate t5 IOC, so I used it also in the core module; 
> at this point I need to have the t5 jars available to the core AND to the 
> webclient, so I put them in the shared "lib" folder of the EAR.
> 
> So far, so good: the app worked and I had no problem.
> 
> Today I was needing to place an object (a simple bean with 3 strings 
> attributes and their getters and setters) and serialize/deserialize it into a 
> file.
> 
> The bean is needed only in the webclient (I need to place it in session), so 
> I placed it in the webclient.war.
> 
> Now my webapp crashed when I try to instantiate a page that refers to the 
> bean.
> 
> Looking at the problem, it seems to be caused by plastic that tries to reach 
> the class by using the jboss classloader.
> 
> This is the relevant part of the stack:
> 
> ---
> org.apache.tapestry5.internal.plastic.asm.ClassWriter.getCommonSuperClass(ClassWriter.java:1588)
> org.apache.tapestry5.internal.plastic.asm.ClassWriter.getMergedType(ClassWriter.java:1559)
> org.apache.tapestry5.internal.plastic.asm.Frame.merge(Frame.java:1406)
> org.apache.tapestry5.internal.plastic.asm.Frame.merge(Frame.java:1308)
> org.apache.tapestry5.internal.plastic.asm.MethodWriter.visitMaxs(MethodWriter.java:1353)
> org.apache.tapestry5.internal.plastic.asm.tree.MethodNode.accept(MethodNode.java:635)
> org.apache.tapestry5.internal.plastic.asm.tree.MethodNode.accept(MethodNode.java:557)
> org.apache.tapestry5.internal.plastic.asm.tree.ClassNode.accept(ClassNode.java:361)
> org.apache.tapestry5.internal.plastic.PlasticClassPool.toBytecode(PlasticClassPool.java:187)
> org.apache.tapestry5.internal.plastic.PlasticClassPool.realize(PlasticClassPool.java:140)
> org.apache.tapestry5.internal.plastic.PlasticClassPool.realizeTransformedClass(PlasticClassPool.java:122)
> org.apache.tapestry5.internal.plastic.PlasticClassImpl.createInstantiator(PlasticClassImpl.java:358)
> org.apache.tapestry5.internal.plastic.PlasticClassPool.loadAndTransformClass(PlasticClassPool.java:350)
> org.apache.tapestry5.internal.plastic.PlasticClassLoader.loadClass(PlasticClassLoader.java:38)
> java.lang.ClassLoader.loadClass(ClassLoader.java:358)
> java.lang.Class.getDeclaredFields0(Native Method)
> java.lang.Class.privateGetDeclaredFields(Class.java:2509)
> java.lang.Class.getDeclaredField(Class.java:1959)
> ---
> 
> In the JEE spec it is written that the war classloader must be isolated from 
> the EAR classloader.
> 
> In my understanding this means that t5 plastic (which lives in the EAR 
> classloader) cannot reach the classes that are in the war (separate 
> classloader).
> 
> I could place the jars in the war/lib folder, but at this point the core 
> module cannot see them.

Re: Is tapestry plastic incompatible with JEE specs?

2015-12-12 Thread Luca Arzeni
  at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) 
[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
 [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) 
[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_45]
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: 
com.amadego.cast.webclient.data.LocalitaData from [Module 
"deployment.Troubleshooting-1.0.ear:main" from Service Module Loader]
at 
org.apache.tapestry5.internal.plastic.asm.ClassWriter.getCommonSuperClass(ClassWriter.java:1588)
 [plastic-5.3.7.jar:]
at 
org.apache.tapestry5.internal.plastic.asm.ClassWriter.getMergedType(ClassWriter.java:1559)
 [plastic-5.3.7.jar:]
at 
org.apache.tapestry5.internal.plastic.asm.Frame.merge(Frame.java:1406) 
[plastic-5.3.7.jar:]
at 
org.apache.tapestry5.internal.plastic.asm.Frame.merge(Frame.java:1308) 
[plastic-5.3.7.jar:]
at 
org.apache.tapestry5.internal.plastic.asm.MethodWriter.visitMaxs(MethodWriter.java:1353)
 [plastic-5.3.7.jar:]
at 
org.apache.tapestry5.internal.plastic.asm.tree.MethodNode.accept(MethodNode.java:635)
 [plastic-5.3.7.jar:]
at 
org.apache.tapestry5.internal.plastic.asm.tree.MethodNode.accept(MethodNode.java:557)
 [plastic-5.3.7.jar:]
at 
org.apache.tapestry5.internal.plastic.asm.tree.ClassNode.accept(ClassNode.java:361)
 [plastic-5.3.7.jar:]
at 
org.apache.tapestry5.internal.plastic.PlasticClassPool.toBytecode(PlasticClassPool.java:187)
 [plastic-5.3.7.jar:]
at 
org.apache.tapestry5.internal.plastic.PlasticClassPool.realize(PlasticClassPool.java:140)
 [plastic-5.3.7.jar:]
at 
org.apache.tapestry5.internal.plastic.PlasticClassPool.realizeTransformedClass(PlasticClassPool.java:122)
 [plastic-5.3.7.jar:]
at 
org.apache.tapestry5.internal.plastic.PlasticClassImpl.createInstantiator(PlasticClassImpl.java:358)
 [plastic-5.3.7.jar:]
at 
org.apache.tapestry5.internal.plastic.PlasticClassPool.loadAndTransformClass(PlasticClassPool.java:350)
 [plastic-5.3.7.jar:]
at 
org.apache.tapestry5.internal.plastic.PlasticClassLoader.loadClass(PlasticClassLoader.java:38)
 [plastic-5.3.7.jar:]
at java.lang.ClassLoader.loadClass(ClassLoader.java:247) 
[rt.jar:1.6.0_45]
at 
org.apache.tapestry5.internal.plastic.PlasticClassPool.getClassInstantiator(PlasticClassPool.java:516)
 [plastic-5.3.7.jar:]
at 
org.apache.tapestry5.plastic.PlasticManager.getClassInstantiator(PlasticManager.java:189)
 [plastic-5.3.7.jar:]
at 
org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl$2.invoke(ComponentInstantiatorSourceImpl.java:235)
 [tapestry-core-5.3.7.jar:]
at 
org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl$2.invoke(ComponentInstantiatorSourceImpl.java:229)
 [tapestry-core-5.3.7.jar:]
at 
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74)
 [tapestry-ioc-5.3.7.jar:]
... 73 more





> Sent: Friday, December 11, 2015 at 11:16 PM
> From: "Thiago H de Paula Figueiredo" <thiag...@gmail.com>
> To: "Tapestry users" <users@tapestry.apache.org>
> Subject: Re: Is tapestry plastic incompatible with JEE specs?
>
> On Fri, 11 Dec 2015 19:20:14 -0200, Luca Arzeni <l.arz...@iname.com> wrote:
> 
> > Hi Jens,
> 
> Hi!
> 
> > I like it, but if these problems cannot be solved, it may be better for  
> > me to migrate to Guice or Spring.
> 
> Common, you don't need or want to do that. Have you checked that the  
> incredibly useful Tapestry JumpStart runs on JBoss?  
> http://jumpstart.doublenegative.com.au/jumpstart6.0/servers_jboss_7.html.  
> Or this? https://wiki.apache.org/tapestry/HowToRunTapestry5OnJBoss7Dot1
> 
> By the way, please post the full stack trace. The important part of it got  
> left out when you copied 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
> 
> 

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



Re: Is tapestry plastic incompatible with JEE specs?

2015-12-12 Thread Luca Arzeni
Hi Jens,
core module contains some EJBs: I'm using JPA for the persistence and SLSB as 
facade to achieve a transactional demarcation strategy. So I could roughly say 
that the core module contains the persistence layer and the business logic, 
which is used by different client application, few of them are webapps, while 
other are desktop apps.

I use this strategy in the web app and in a desktop GUI app:
- the web apps use the SLSB approach, looking up the beans in the webapp 
module, and allowing them to be injected  the pages ad T5 services;
- the desktop and command line apps use directly the IOC of T5 to inject 
services when I need them

So, an EAR usually contains three or more war module and a EJB module, while 
desktop and command line apps are usually a GUI around some services.

As you can undestand, the real app is more complex than the simple project that 
I used for test, and replicating EJB and T5 jars every where could make my EAR 
to explode for size and complexity.

Anyway the testcase, that I used to pinpoint the problem, should be simple 
enough to demonstrate the issue. 

I often see that people is deploy t5 as war inside tomcat or jetty. 

I'm wondering if there is someone around that is usually deploying EARs with 
jboss and glassfish that has found similar issues...

Thanks,
Luca



> Sent: Saturday, December 12, 2015 at 2:02 PM
> From: "mailingl...@j-b-s.de" <mailingl...@j-b-s.de>
> To: "Tapestry users" <users@tapestry.apache.org>
> Subject: Re: Is tapestry plastic incompatible with JEE specs?
>
> What is in your core Module? Services using T5 IOC? Why is the core Module 
> not part of the war?
> To me it looks more like a structural / serup problem than a real Tapestry 
> issue, to be honest. But I can be entirely wrong because I do not know the 
> requirements of your project and why it is structured this way.
> 
> If you need these libs in different classloaders not belonging to same 
> hiererchy, you can't share them. The same class loaded from different 
> classloaders will cause trouble anyway, too. Maybe you only need it on 
> compile time and "maven provided" on your war pom.xml is the solution?
> 
> Jens
> 
> Von meinem iPhone gesendet
> 
> > Am 11.12.2015 um 22:20 schrieb Luca Arzeni <l.arz...@iname.com>:
> > 
> > Hi Jens,
> > the point is that I need them in the lib since I use them also in the core 
> > module.
> > 
> > I can place them in the lib AND in the war, but I cannot place them ONLY in 
> > the war.
> > 
> > Also, I ask about compatibility because if I have properly spotted the 
> > issue, some kind of problem could arise also in the core (read: ejb.jar) 
> > module.
> > 
> > The real showstopper is the pervasive usage that I'm doing of tapestry IOC.
> > 
> > I like it, but if these problems cannot be solved, it may be better for me 
> > to migrate to Guice or Spring.
> > 
> > Thanks,
> > larzeni
> > 
> > 
> >> Sent: Friday, December 11, 2015 at 8:00 PM
> >> From: "mailingl...@j-b-s.de" <mailingl...@j-b-s.de>
> >> To: "Tapestry users" <users@tapestry.apache.org>
> >> Subject: Re: Is tapestry plastic incompatible with JEE specs?
> >> 
> >> Hi!
> >> 
> >> IWhy not having all T5 related jars in your war? Any particular reason why 
> >> they are located in your ear?
> >> 
> >> Jens
> >> 
> >> 
> >> 
> >> Von meinem iPhone gesendet
> >> 
> >>> Am 11.12.2015 um 19:05 schrieb Luca Arzeni <l.arz...@iname.com>:
> >>> 
> >>> Hi there, 
> >>> my environment is:
> >>> JBoss 7.2+  (actually 6.1.1.GA) or Wildfly 8.0 Final
> >>> Tapestry5 5.3.7
> >>> 
> >>> I'm developing a little ear, which has the following structure
> >>> 
> >>> myear.ear
> >>> |  core-1.1.jar
> >>> |  webclient-1.1.war
> >>> |  lib/
> >>>  |  plastic-5.3.7.jar
> >>>  |  tapestry5-annotations-5.3.7.jar
> >>>  |  tapestry-core-5.3.7.jar
> >>>  |  tapestry-func-5.3.7.jar
> >>>  |  tapestry-ioc-5.3.7.jar
> >>>  |  tapestry-json-5.3.7.jar
> >>>  |  tapestry-upload-5.3.7.jar
> >>>  |  ... omissis ...
> >>> 
> >>> the core-1.1.jar module contains few EJBs,
> >>> the webclient-1.1.war module contains my t5 app (pages, components and so 
> >>> on)
> >>> 
> >>> I routinely use and appreciate t5 IOC, so I used it also in the core 
> >>> module; at

Re: Is tapestry plastic incompatible with JEE specs?

2015-12-12 Thread Luca Arzeni
Hi Dimitris,

NO WAY: I've checked with tapestry 5.3.8 and also with 5.4-rc1 but found no 
difference, the issue is always there.

By the way, kudos to the development team for the error page of t5.4, it's 
fairly well structured.

Still looking for a solution.

See you!


> Sent: Saturday, December 12, 2015 at 7:14 PM
> From: "Dimitris Zenios" <dimitris.zen...@gmail.com>
> To: "Tapestry users" <users@tapestry.apache.org>
> Subject: Re: Is tapestry plastic incompatible with JEE specs?
>
> HI Luca Arzeni
> 
> Just for testing could you try with Tapestry 5.4-rc-1?
> 
> Tapestry 5.4 bundles a newer asm version. Don't forget that tapestry
> plastic is a wrapper around asm
> 
> Dimitris Zenios
> 
> 
> 
> On Sat, Dec 12, 2015 at 7:06 PM, Luca Arzeni <l.arz...@iname.com> wrote:
> 
> > Here you are: this is a test case that shows the issue.
> >
> > In the linked file, you'll find a simple working/crashing example, with a
> > gradle script to build it (in ts really simple, but just to play it safe).
> > You can download it at:
> >
> > https://app.box.com/s/eoie31up2z8djdwja77136649c8vogv0
> >
> > There is also a readme.txt that explains the issue and the test that I've
> > done.
> >
> > After the deployment, you can reach the app at the URL:
> >
> > http://localhost:8080/webclient/
> >
> > I packed into the tar.gz also the application exception page, from which
> > you can read the full stack trace.
> >
> > Anyway, if you prefer, here is the full stack trace.
> >
> > Thanks for your help,
> > larzeni
> >
> >
> > 18:02:53,903 ERROR [Registry] java.lang.ClassNotFoundException:
> > com.amadego.cast.webclient.data.LocalitaData from [Module
> > "deployment.Troubleshooting-1.0.ear:main" from Service Module Loader]
> > 18:02:53,903 ERROR [Registry] Operations trace:
> > 18:02:53,903 ERROR [Registry] [ 1] Constructing instance of page class
> > com.amadego.cast.webclient.pages.Start
> > 18:02:53,904 ERROR [Registry] [ 2] Creating ComponentAssembler for
> > com.amadego.cast.webclient.pages.Start
> > 18:02:53,904 ERROR [Registry] [ 3] Creating instantiator for component
> > class com.amadego.cast.webclient.pages.Start
> > 18:02:53,904 ERROR [RequestExceptionHandler] Processing of request failed
> > with uncaught exception: java.lang.ClassNotFoundException:
> > com.amadego.cast.webclient.data.LocalitaData from [Module
> > "deployment.Troubleshooting-1.0.ear:main" from Service Module Loader]:
> > org.apache.tapestry5.ioc.internal.OperationException:
> > java.lang.ClassNotFoundException:
> > com.amadego.cast.webclient.data.LocalitaData from [Module
> > "deployment.Troubleshooting-1.0.ear:main" from Service Module Loader]
> > at
> > org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:121)
> > [tapestry-ioc-5.3.7.jar:]
> > at
> > org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:88)
> > [tapestry-ioc-5.3.7.jar:]
> > at
> > org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)
> > [tapestry-ioc-5.3.7.jar:]
> > at
> > org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124)
> > [tapestry-ioc-5.3.7.jar:]
> > at
> > org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.createInstantiatorForClass(ComponentInstantiatorSourceImpl.java:227)
> > [tapestry-core-5.3.7.jar:]
> > at
> > org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.getInstantiator(ComponentInstantiatorSourceImpl.java:217)
> > [tapestry-core-5.3.7.jar:]
> > at
> > $ComponentInstantiatorSource_5ee3f5f438c.getInstantiator(Unknown Source)
> >  at
> > org.apache.tapestry5.internal.pageload.PageLoaderImpl$4.invoke(PageLoaderImpl.java:225)
> > [tapestry-core-5.3.7.jar:]
> > at
> > org.apache.tapestry5.internal.pageload.PageLoaderImpl$4.invoke(PageLoaderImpl.java:222)
> > [tapestry-core-5.3.7.jar:]
> > at
> > org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74)
> > [tapestry-ioc-5.3.7.jar:]
> > at
> > org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)
> > [tapestry-ioc-5.3.7.jar:]
> > at
> > org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124)
> > [tapestry-ioc-5.3.7.jar:]
> > 

Re: Is tapestry plastic incompatible with JEE specs?

2015-12-11 Thread Luca Arzeni
Hi Jens,
the point is that I need them in the lib since I use them also in the core 
module.

I can place them in the lib AND in the war, but I cannot place them ONLY in the 
war.

Also, I ask about compatibility because if I have properly spotted the issue, 
some kind of problem could arise also in the core (read: ejb.jar) module.

The real showstopper is the pervasive usage that I'm doing of tapestry IOC.

I like it, but if these problems cannot be solved, it may be better for me to 
migrate to Guice or Spring.

Thanks,
larzeni


> Sent: Friday, December 11, 2015 at 8:00 PM
> From: "mailingl...@j-b-s.de" <mailingl...@j-b-s.de>
> To: "Tapestry users" <users@tapestry.apache.org>
> Subject: Re: Is tapestry plastic incompatible with JEE specs?
>
> Hi!
> 
> IWhy not having all T5 related jars in your war? Any particular reason why 
> they are located in your ear?
> 
> Jens
> 
> 
> 
> Von meinem iPhone gesendet
> 
> > Am 11.12.2015 um 19:05 schrieb Luca Arzeni <l.arz...@iname.com>:
> > 
> > Hi there, 
> > my environment is:
> > JBoss 7.2+  (actually 6.1.1.GA) or Wildfly 8.0 Final
> > Tapestry5 5.3.7
> > 
> > I'm developing a little ear, which has the following structure
> > 
> > myear.ear
> > |  core-1.1.jar
> > |  webclient-1.1.war
> > |  lib/
> >   |  plastic-5.3.7.jar
> >   |  tapestry5-annotations-5.3.7.jar
> >   |  tapestry-core-5.3.7.jar
> >   |  tapestry-func-5.3.7.jar
> >   |  tapestry-ioc-5.3.7.jar
> >   |  tapestry-json-5.3.7.jar
> >   |  tapestry-upload-5.3.7.jar
> >   |  ... omissis ...
> > 
> > the core-1.1.jar module contains few EJBs,
> > the webclient-1.1.war module contains my t5 app (pages, components and so 
> > on)
> > 
> > I routinely use and appreciate t5 IOC, so I used it also in the core 
> > module; at this point I need to have the t5 jars available to the core AND 
> > to the webclient, so I put them in the shared "lib" folder of the EAR.
> > 
> > So far, so good: the app worked and I had no problem.
> > 
> > Today I was needing to place an object (a simple bean with 3 strings 
> > attributes and their getters and setters) and serialize/deserialize it into 
> > a file.
> > 
> > The bean is needed only in the webclient (I need to place it in session), 
> > so I placed it in the webclient.war.
> > 
> > Now my webapp crashed when I try to instantiate a page that refers to the 
> > bean.
> > 
> > Looking at the problem, it seems to be caused by plastic that tries to 
> > reach the class by using the jboss classloader.
> > 
> > This is the relevant part of the stack:
> > 
> > ---
> > org.apache.tapestry5.internal.plastic.asm.ClassWriter.getCommonSuperClass(ClassWriter.java:1588)
> > org.apache.tapestry5.internal.plastic.asm.ClassWriter.getMergedType(ClassWriter.java:1559)
> > org.apache.tapestry5.internal.plastic.asm.Frame.merge(Frame.java:1406)
> > org.apache.tapestry5.internal.plastic.asm.Frame.merge(Frame.java:1308)
> > org.apache.tapestry5.internal.plastic.asm.MethodWriter.visitMaxs(MethodWriter.java:1353)
> > org.apache.tapestry5.internal.plastic.asm.tree.MethodNode.accept(MethodNode.java:635)
> > org.apache.tapestry5.internal.plastic.asm.tree.MethodNode.accept(MethodNode.java:557)
> > org.apache.tapestry5.internal.plastic.asm.tree.ClassNode.accept(ClassNode.java:361)
> > org.apache.tapestry5.internal.plastic.PlasticClassPool.toBytecode(PlasticClassPool.java:187)
> > org.apache.tapestry5.internal.plastic.PlasticClassPool.realize(PlasticClassPool.java:140)
> > org.apache.tapestry5.internal.plastic.PlasticClassPool.realizeTransformedClass(PlasticClassPool.java:122)
> > org.apache.tapestry5.internal.plastic.PlasticClassImpl.createInstantiator(PlasticClassImpl.java:358)
> > org.apache.tapestry5.internal.plastic.PlasticClassPool.loadAndTransformClass(PlasticClassPool.java:350)
> > org.apache.tapestry5.internal.plastic.PlasticClassLoader.loadClass(PlasticClassLoader.java:38)
> > java.lang.ClassLoader.loadClass(ClassLoader.java:358)
> > java.lang.Class.getDeclaredFields0(Native Method)
> > java.lang.Class.privateGetDeclaredFields(Class.java:2509)
> > java.lang.Class.getDeclaredField(Class.java:1959)
> > ---
> > 
> > In the JEE spec it is written that the war classloader must be isolated 
> > from the EAR classloader.
> > 
> > In my understanding this means that t5 plastic (which lives in the EAR 
> > classloader) cannot reach the classes that are in the war (separate 
> > classloader).
> > 
> > I could place the jars in the war/lib folder, bu

Is tapestry plastic incompatible with JEE specs?

2015-12-11 Thread Luca Arzeni
Hi there, 
my environment is:
JBoss 7.2+  (actually 6.1.1.GA) or Wildfly 8.0 Final
Tapestry5 5.3.7

I'm developing a little ear, which has the following structure

myear.ear
|  core-1.1.jar
|  webclient-1.1.war
|  lib/
   |  plastic-5.3.7.jar
   |  tapestry5-annotations-5.3.7.jar
   |  tapestry-core-5.3.7.jar
   |  tapestry-func-5.3.7.jar
   |  tapestry-ioc-5.3.7.jar
   |  tapestry-json-5.3.7.jar
   |  tapestry-upload-5.3.7.jar
   |  ... omissis ...

the core-1.1.jar module contains few EJBs,
the webclient-1.1.war module contains my t5 app (pages, components and so on)

I routinely use and appreciate t5 IOC, so I used it also in the core module; at 
this point I need to have the t5 jars available to the core AND to the 
webclient, so I put them in the shared "lib" folder of the EAR.

So far, so good: the app worked and I had no problem.

Today I was needing to place an object (a simple bean with 3 strings attributes 
and their getters and setters) and serialize/deserialize it into a file.

The bean is needed only in the webclient (I need to place it in session), so I 
placed it in the webclient.war.

Now my webapp crashed when I try to instantiate a page that refers to the bean.

Looking at the problem, it seems to be caused by plastic that tries to reach 
the class by using the jboss classloader.

This is the relevant part of the stack:

---
org.apache.tapestry5.internal.plastic.asm.ClassWriter.getCommonSuperClass(ClassWriter.java:1588)
org.apache.tapestry5.internal.plastic.asm.ClassWriter.getMergedType(ClassWriter.java:1559)
org.apache.tapestry5.internal.plastic.asm.Frame.merge(Frame.java:1406)
org.apache.tapestry5.internal.plastic.asm.Frame.merge(Frame.java:1308)
org.apache.tapestry5.internal.plastic.asm.MethodWriter.visitMaxs(MethodWriter.java:1353)
org.apache.tapestry5.internal.plastic.asm.tree.MethodNode.accept(MethodNode.java:635)
org.apache.tapestry5.internal.plastic.asm.tree.MethodNode.accept(MethodNode.java:557)
org.apache.tapestry5.internal.plastic.asm.tree.ClassNode.accept(ClassNode.java:361)
org.apache.tapestry5.internal.plastic.PlasticClassPool.toBytecode(PlasticClassPool.java:187)
org.apache.tapestry5.internal.plastic.PlasticClassPool.realize(PlasticClassPool.java:140)
org.apache.tapestry5.internal.plastic.PlasticClassPool.realizeTransformedClass(PlasticClassPool.java:122)
org.apache.tapestry5.internal.plastic.PlasticClassImpl.createInstantiator(PlasticClassImpl.java:358)
org.apache.tapestry5.internal.plastic.PlasticClassPool.loadAndTransformClass(PlasticClassPool.java:350)
org.apache.tapestry5.internal.plastic.PlasticClassLoader.loadClass(PlasticClassLoader.java:38)
java.lang.ClassLoader.loadClass(ClassLoader.java:358)
java.lang.Class.getDeclaredFields0(Native Method)
java.lang.Class.privateGetDeclaredFields(Class.java:2509)
java.lang.Class.getDeclaredField(Class.java:1959)
---

In the JEE spec it is written that the war classloader must be isolated from 
the EAR classloader.

In my understanding this means that t5 plastic (which lives in the EAR 
classloader) cannot reach the classes that are in the war (separate 
classloader).

I could place the jars in the war/lib folder, but at this point the core module 
cannot see them.

The only viable solution that I found is to place the bean classes in the 
shared lib folder, by extracting them from the war, but this is only a 
temporary patch.

In the past I developed another ear and I had a similar issue trying to 
instantiate a page from another page. I solved it by avoiding the link between 
the two pages; but now I'm starting to think that it was another "face" of the 
same problem.

Now, since these issues are becoming too frequent to work around them, and I'm 
wandering if there is a real solution or there's a real compatibility issue 
between T5 and JEE specs.

Is there anyone that can help me?

Thanks,
larzeni





-
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: Filling some filed of a form selecting a row from a grid

2015-08-03 Thread Luca Arzeni
Hi Thiago,
I really appreciate your help!

May be that my problems came from the fact that I've always seen this job 
solved with a button that shows a picklist.

I'm used to see something like the behaviour of OpenXava, take a look at this:

http://www.openxava.org/InvoiceDemo/m/Invoice

When you press the new button, the system allows you to create a new 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.

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?

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.

I know that I can do this using a select/dropdown/autocomplete to select the 
customer directly from the invoice form, but since there are many of them, I 
cannot show all of them in a drop down, so I need the user to filter/find the 
one that he needs.

Thanks,
larzeni


 Sent: Monday, August 03, 2015 at 10:08 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 15:32:06 -0300, Luca Arzeni l.arz...@iname.com wrote:
 
  I have built a JPA datasource provider that is similar to the hibernate  
  one, and it manages filtering, sorting and paging so the size of a grid  
  is not an issue; I was declaring that the dataset is verylarge only to  
  explain the reason why I cannot use an autocomplete/drop down field.
 
 You don't need to show all the options . . .
 
  Regarding the user interface question, well, ehrrr... ehm... I was  
  using tapestry exactly to build the user interface,
 
 I wasn't talking about the coding part, but how to present a good user  
 interface so the user can do their tasks on it easily and intuitively.
 
  so I was appreciating the grid that allows me to show many columns to  
  the user. I was simply hoping to find a standard way to solve this  
  issue, if I'm the first one to have this need may be I choose the wrong  
  tool for this task :-)
 
 Grid is awesome for showing tabular data, if that's your question. You've  
 mentioned 100 thousands rows, so I thought that was your concern, but not  
 it seems to me it isn't.
 
 To be honest, I still think your question is vague and not very well  
 phrased, so it's hard to give a good answer. You may try to use zones so  
 you don't need to write any JavaScript to make your selection be applied  
 to the first form.
 
 -- 
 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



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

2015-08-03 Thread Luca Arzeni
Hi,
I'm using tapestry 5.3.7 unde jboss6 (java6). 

I'm developing an invoice form.

I already have a customer list, built with a grid.

While filling the invoice form, I need to show the customer grid, select one of 
the customers, and retrieve his data (first and last name, addreess, city, zip 
code phone numbers and so on...), to fill some fields of the invoice form.

I would not like to use a select on the invoice data, since I have a large list 
of customers.

What is the best practise to face this issue?

Thanks larzeni





-
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-03 Thread Luca Arzeni
Thanks Thiago,

I have built a JPA datasource provider that is similar to the hibernate one, 
and it manages filtering, sorting and paging so the size of a grid is not an 
issue; I was declaring that the dataset is verylarge only to explain the reason 
why I cannot use an autocomplete/drop down field.

Regarding the user interface question, well, ehrrr... ehm... I was using 
tapestry exactly to build the user interface, so I was appreciating the grid 
that allows me to show many columns to the user. I was simply hoping to find a 
standard way to solve this issue, if I'm the first one to have this need may 
be I choose the wrong tool for this task :-)

Thanks again,
Luca



 Sent: Monday, August 03, 2015 at 7:42 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 13:55:54 -0300, Luca Arzeni l.arz...@iname.com wrote:
 
  The point here is that the list needs to be shown in a grid since it has  
  more than 100.000 items, and I need to allow the user to filter it  
  according to few criteria (that I've already implemented in the page  
  that contains the grid).
 
 Remember the source parameter of Grid receives a GridDataSource object,  
 not a List, so just implement it to do the search you need to do with  
 paging (i.e. retrieve just the objects you'll show right now).  
 tapestry-hibernate already has HibernateGridDataSource, which already  
 implements a part of it (pagination) and you just need to provide the  
 query criteria.
 
  By the way: the user needs to see a list of customers since many users  
  have similar values (same name, same city...) so he needs to examinate  
  more than one field to choose the right one (which is the reason why a  
  show a list of customers in a grid).
 
 This looks more of an user interface question than a Tapestry one, to be  
 honest . . .
 
 -- 
 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: Filling some filed of a form selecting a row from a grid

2015-08-03 Thread Luca Arzeni
Thanks Jens,
I will take a look.

I was hoping that there was already a tapestry-zed solution since to me it 
seems a common need...

Do you know if tapestry 5.4 has some native support for jquery tables?

Thanks,
larzeni



 Sent: Monday, August 03, 2015 at 7:03 PM
 From: mailingl...@j-b-s.de mailingl...@j-b-s.de
 To: Tapestry users users@tapestry.apache.org
 Subject: Re: Filling some filed of a form selecting a row from a grid

 Maybe you have a look at jquery tables + ajax? 
 
 https://www.datatables.net/examples/data_sources/server_side.html
 
 Jens
 
 
 Von meinem iPhone gesendet
 
  Am 03.08.2015 um 17:55 schrieb Luca Arzeni l.arz...@iname.com:
  
  Thanks Kalle,
  I appreciate your hint and I already used a solution like this for a 
  shorter list of items.
  
  The point here is that the list needs to be shown in a grid since it has 
  more than 100.000 items, and I need to allow the user to filter it 
  according to few criteria (that I've already implemented in the page that 
  contains the grid).
  
  If you have used a ERP application you will recognize here a recurrent 
  pattern: user needs to fill some fields, hit a lookup button, the button 
  open a new page containing a list of items. The user select one of these 
  item and fills the fields of the originating form.
  
  By the way: the user needs to see a list of customers since many users have 
  similar values (same name, same city...) so he needs to examinate more than 
  one field to choose the right one (which is the reason why a show a list of 
  customers in a grid).
  
  Thanks again for your help, but I need a different solution here!
  larzeni
  
  
  
  
  
  Sent: Monday, August 03, 2015 at 6:37 PM
  From: Kalle Korhonen kalle.o.korho...@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, Aug 3, 2015 at 7:58 AM, Luca Arzeni l.arz...@iname.com wrote:
  
  Hi,
  I'm using tapestry 5.3.7 unde jboss6 (java6).
  I'm developing an invoice form.
  I already have a customer list, built with a grid.
  While filling the invoice form, I need to show the customer grid, select
  one of the customers, and retrieve his data (first and last name, 
  addreess,
  city, zip code phone numbers and so on...), to fill some fields of the
  invoice form.
  I would not like to use a select on the invoice data, since I have a large
  list of customers.
  What is the best practise to face this issue?
  
  
  The typical solution is to use some type of autocomplete field, where the
  user can start typing on a field and the system makes a lookup on the
  background and provides a list of matches based on the input. There's an
  autocomplete mixins available for a regular input field, see
  http://tapestry.apache.org/component-mixins.html. It may or may not work
  out-of-the-box but at least it'll give you ideas on how to build yours.
  
  Kalle
  
  
  -
  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
 
 

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



Re: Tapestry 5.3.7 - best way to customize Grid Pager

2015-06-03 Thread Luca Arzeni
Hi Dimitris,
indeed I would like to go with the release 5.4, but I need to release to our 
customer at the end of june, and I have no clue of the release date of t5.4.

So I'm stuck with 5.3.7/5.3.8

Thanks,
larzeni

 Sent: Wednesday, June 03, 2015 at 2:52 PM
 From: Dimitris Zenios dimitris.zen...@gmail.com
 To: Tapestry users users@tapestry.apache.org
 Subject: Re: Tapestry 5.3.7 - best way to customize Grid Pager

 You can use tapestry 5.4 and ComponentOverride. Also tapestry 5.4 comes
 bundled with bootstrap and jquery
 
 On Wed, Jun 3, 2015 at 3:39 PM, Luca Arzeni l.arz...@iname.com wrote:
 
  Hi,
  I'm using Tapestry5 (5.3.7), and bootstrap for reponsive layout.
 
  I'using tapestry5 grid component, and I would linke to customize the pager
  to have a html list (ul/li) of links to jump to search result pages and not
  a simple list of links as produced by t5 native GridPager component.
 
  AFAIK, I cannot change the GridPager since is a private component of
  org.apache.tapestry5.corelib.components.Grid
 
  @Component(parameters = { source=dataSource, rowsPerPage=rowsPerPage,
  currentPage=currentPage, zone=zone })
  private GridPager pager;
 
  Ideally I would like to write a custom pager and contribute it to t5 grid
  but it seems to be impossible.
 
  May I ask you what is the best way to accomplish this goal?
 
  Am I forced to create a custom Grid component?
 
  Thanks,
  larzeni
 
  -
  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



Tapestry 5.3.7 - best way to customize Grid Pager

2015-06-03 Thread Luca Arzeni
Hi,
I'm using Tapestry5 (5.3.7), and bootstrap for reponsive layout.

I'using tapestry5 grid component, and I would linke to customize the pager to 
have a html list (ul/li) of links to jump to search result pages and not a 
simple list of links as produced by t5 native GridPager component.

AFAIK, I cannot change the GridPager since is a private component of 
org.apache.tapestry5.corelib.components.Grid

@Component(parameters = { source=dataSource, rowsPerPage=rowsPerPage, 
currentPage=currentPage, zone=zone })
private GridPager pager;

Ideally I would like to write a custom pager and contribute it to t5 grid but 
it seems to be impossible.

May I ask you what is the best way to accomplish this goal?

Am I forced to create a custom Grid component?

Thanks,
larzeni

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