Re: Experiences with upgrading our apps from 5.8.2 to 5.8.6

2024-05-02 Thread Chris Poulsen
> It would help a lot to have an example of class hierarchy not being
handled
well. I'll definitely use it.

OK, I'll try to find some time to see if I can create a minimal example

> Regarding service classes, field injection is indeed supported

I think both cases that caused these issues was related to (field)
injecting an Asset (an icon or similar) and the error was something about
RequestGlobals being null, IIRC

-- 
Chris

On Tue, Apr 30, 2024 at 9:32 PM Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> Hello, Chris!
>
> Thanks for the information. We are aware that there are still some problems
> with 5.8.3 to 5.8.6, especially on projects with components having
> complex dependencies among them, and we're working on it. 5.8.3 introduces
> a lot of changes on how the Tapestry classloading and class transformation
> work and there's an awful lot of corner cases.
>
> It would help a lot to have an example of class hierarchy not being handled
> well. I'll definitely use it.
>
> Regarding service classes, field injection is indeed supported, but I
> consider that constructor-based injection is better. It keeps your service
> classes working even when not using Tapestry-IoC, making automated testing
> way easier, and, in most cases, you can even have your service classes
> completely independent of Tapestry itself.
>
> Cheers!
>
>
> On Tue, Apr 30, 2024 at 5:12 AM Chris Poulsen 
> wrote:
>
> > The upgrades went pretty smoothly in general, good job team!
> >
> > I did encounter a couple of issues that I think it is worth raising the
> > flag on.
> >
> > We run our products in different environments:
> >
> >- On plain Windows servers
> >- In Docker containers (Linux).
> >
> > Things are currently on Java 17, the development docker images are
> running
> > without issues on the Java 21 runtime.
> >
> > Issues encountered:
> >
> >1. TAP5-2605 JS minimizer regression bug in 5.5.0-beta-1
> ><https://issues.apache.org/jira/browse/TAP5-2605> I did a simple fix,
> >mentioned in the comments, this would be nice to get in, so I don't
> > have to
> >decorate the Javascript resource minimizer, just to change the
> >"StreamableResource.toString()" to a dummy value
> >2. Field injection in 2 of our Tapestry services went from an obscure
> >warning on startup to an actual error in production mode (the two
> > services
> >had an "@Inject Asset icon" type of thing, which blew up in production
> >mode=true. It worked in development mode and in both modes in v5.8.2.
> > The
> >fix/workaround was to move to CTOR injection - (that feels more
> correct
> > to
> >me anyway). I don't know if this was ever supposed to work, but it did
> > and
> >it would be nice with some check/nice error in development mode, if
> > this is
> >not supposed to work
> >3. We had a single construct which ended up resulting in
> >java.lang.VerifyError: Bad type on operand stack (basically bad
> bytecode
> >was being produced as I understand it. I'll put a few more details on
> > this
> >below)
> >
> > The java.lang.VerifyError:
> >
> > Log:
> >
> > 2024-04-25T15:17:52.707+02:00 INFO
> >  [org.apache.tapestry5.services.pageload.PageClassLoaderContextManager]
> > (default task-79) Dependency information gathered in 6,126 ms
> > 2024-04-25T15:17:52.707+02:00 INFO
> >  [org.apache.tapestry5.services.pageload.PageClassLoaderContextManager]
> > (default task-79) Starting preloading page classloader contexts
> > 2024-04-25T15:17:52.864+02:00 ERROR [io.undertow.request] (default
> task-79)
> > UT005023: Exception handling request to /administration/:
> > java.lang.RuntimeException: java.lang.VerifyError: Bad type on operand
> > stack
> > Exception Details:
> >   Location:
> >
> >
> >
> com/dezide/author/gui/base/content/FaqIncludeAndConversationBase.onSelectFaqArticle()Ljava/lang/Object;
> > @5: invokevirtual
> >   Reason:
> > Type 'com/dezide/author/gui/pages/faq/SelectFaqArticle' (current
> frame,
> > stack[1]) is not assignable to
> > 'com/dezide/author/gui/base/conversation/ParentConversationPageBase'
> >   Current Frame:
> > bci: @5
> > flags: { }
> > locals: {
> > 'com/dezide/author/gui/base/content/FaqIncludeAndConversationBase' }
> > stack: {
> > 'com/dezide/author/gui/base/content/FaqIncludeAndConversationBase',
>

Experiences with upgrading our apps from 5.8.2 to 5.8.6

2024-04-30 Thread Chris Poulsen
The upgrades went pretty smoothly in general, good job team!

I did encounter a couple of issues that I think it is worth raising the
flag on.

We run our products in different environments:

   - On plain Windows servers
   - In Docker containers (Linux).

Things are currently on Java 17, the development docker images are running
without issues on the Java 21 runtime.

Issues encountered:

   1. TAP5-2605 JS minimizer regression bug in 5.5.0-beta-1
    I did a simple fix,
   mentioned in the comments, this would be nice to get in, so I don't have to
   decorate the Javascript resource minimizer, just to change the
   "StreamableResource.toString()" to a dummy value
   2. Field injection in 2 of our Tapestry services went from an obscure
   warning on startup to an actual error in production mode (the two services
   had an "@Inject Asset icon" type of thing, which blew up in production
   mode=true. It worked in development mode and in both modes in v5.8.2. The
   fix/workaround was to move to CTOR injection - (that feels more correct to
   me anyway). I don't know if this was ever supposed to work, but it did and
   it would be nice with some check/nice error in development mode, if this is
   not supposed to work
   3. We had a single construct which ended up resulting in
   java.lang.VerifyError: Bad type on operand stack (basically bad bytecode
   was being produced as I understand it. I'll put a few more details on this
   below)

The java.lang.VerifyError:

Log:

2024-04-25T15:17:52.707+02:00 INFO
 [org.apache.tapestry5.services.pageload.PageClassLoaderContextManager]
(default task-79) Dependency information gathered in 6,126 ms
2024-04-25T15:17:52.707+02:00 INFO
 [org.apache.tapestry5.services.pageload.PageClassLoaderContextManager]
(default task-79) Starting preloading page classloader contexts
2024-04-25T15:17:52.864+02:00 ERROR [io.undertow.request] (default task-79)
UT005023: Exception handling request to /administration/:
java.lang.RuntimeException: java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:

com/dezide/author/gui/base/content/FaqIncludeAndConversationBase.onSelectFaqArticle()Ljava/lang/Object;
@5: invokevirtual
  Reason:
Type 'com/dezide/author/gui/pages/faq/SelectFaqArticle' (current frame,
stack[1]) is not assignable to
'com/dezide/author/gui/base/conversation/ParentConversationPageBase'
  Current Frame:
bci: @5
flags: { }
locals: {
'com/dezide/author/gui/base/content/FaqIncludeAndConversationBase' }
stack: {
'com/dezide/author/gui/base/content/FaqIncludeAndConversationBase',
'com/dezide/author/gui/pages/faq/SelectFaqArticle' }
  Bytecode:
000: 2a2a b600 3fb6 0043 2ab6 003f 2ab6 0049
010: 2ab4 004b 124d 03bd 0004 b900 5303 004c
020: 2ab4 004b 1255 03bd 0004 b900 5303 004d
030: 2ab6 003f 2bb6 0059 2ab6 003f 2cb6 005c
040: 2ab6 003f b0

at
deployment.dezide-author-1.29.1-rc.1.ear.web.war//org.apache.tapestry5.ioc.internal.StartupDefImpl$1.run(StartupDefImpl.java:84)
at
deployment.dezide-author-1.29.1-rc.1.ear.web.war//org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:56)
at
deployment.dezide-author-1.29.1-rc.1.ear.web.war//org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:60)
at
deployment.dezide-author-1.29.1-rc.1.ear.web.war//org.apache.tapestry5.ioc.internal.RegistryImpl.run(RegistryImpl.java:1286)

It says:

Reason:
Type 'com/dezide/author/gui/pages/faq/SelectFaqArticle' (current frame,
stack[1]) is not assignable to
'com/dezide/author/gui/base/conversation/ParentConversationPageBase'

but the class is defined as:

public class SelectFaqArticle extends ParentConversationPageBase

The code that failed was calling the following in
ParentConversationPageBase:

protected void setupParentConversationalSubPage(
ParentConversationPageBase page )
{
conversationPageManager.setupParentConversationalSubPage( page,
componentResources );
}

I managed to work around this using an interface on the
ParentConversationPageBase instead of the concrete class in the signature.

Changing to:
  interface ParentConversationPage {}
  class ParentConversationPageBase implements ParentConversationPage

and

protected void setupParentConversationalSubPage( ParentConversationPage
page )

got things going again.

It seems like there are some regressions around class hierarchies in the
plastic stuff between 5.8.2 and 5.8.6.

Our actual code is pretty complex (or a mess as some would say), but I can
try to come up with a simple example, if anyone has a hunch on what is
wrong / is willing to try and fix it.

-- 
Chris


Re: Problem running Tapestry 5.8.2 with Hibernate 5.4.32.Final

2023-06-14 Thread Chris Poulsen
>
> How come nobody else has noticed the bug for two years?
>

In general we're isolating the use of Tapestry to our presentation layer -
The datastore access (and business logic) lives in modules and the UI sits
on top of the business logic layer - The lower level modules are usually
wired up with Spring IoC and we bridge the two IoC systems, so Tapestry can
see/inject Spring services, but the opposite is not true.

With a traditional layering like that we never need to access the datastore
directly from Tapestry code - so a lot of the magic Tapestry
modules/features are not in play (like hibernate integration etc).

-- 
Chris

On Sun, Jun 11, 2023 at 7:04 PM Vangel V. Ajanovski 
wrote:

> This bug prompts another question that bothers me.
>
> How come nobody else has noticed the bug for two years? I had a report
> in Sep 2021, which did not get an answer, there is another mention on
> Stack Overflow in the last month and now this thread here opened by Chris.
>
> Is this because the bug only occurs in some very specific environments
> (only some specific OS and some specific JDK combination and some
> specific DB driver), or tapestry-hibernate is not in use any more by
> committers and other developers and tapestry-jpa is the preferred way,
> or both are obsolete nowadays and one should pursue some other approach
> to persistence when using Tapestry?
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: [ANNOUNCEMENT] Tapestry 5.8.1 released!

2022-04-05 Thread Chris Poulsen
Thank you for the release!

I don't know if this is already known, but I just noticed that the heading
links in the "Latest news" on the front page does not work for the two
5.8.x releases.

The (broken) 5.8.1 link in the list is:
https://tapestry.apache.org/2022/04/04/tapestry-581-release.html while the
(working) link from this thread is:
https://tapestry.apache.org/release-notes-581.html

-- 
Chris

On Tue, Apr 5, 2022 at 2:45 PM Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> Thanks Tim for spotting this and Ben for creating this ticket!
>
> On Tue, Apr 5, 2022 at 3:32 AM D Tim Cummings  >
> wrote:
>
> > Thanks Thiago
> >
> > I checked the updates in quickstart and they look great.
> >
> > One minor thing when running quickstart, the ascii art no longer knows
> > which tapestry version is running :(
> >
> >   __  __ 
> > /_  __/__   ___ ___ / /___ __  / __/
> >   / / / _ `/ _ \/ -_|_- > /_/  \_,_/ .__/\__/___/\__/_/  \_, / //
> >  /_/   /___/  UNKNOWN (development mode)
> >
> > Cheers
> >
> > Tim
> >
> > On 4/4/22 21:53, Thiago H. de Paula Figueiredo wrote:
> > > Hello, Tapestry community!
> > >
> > > We've just released Tapestry 5.8.1. It's mostly about getting
> > Tapestry-IoC
> > > to support all Java language features introduced between Java 9 and 17.
> > It
> > > also includes some other bug fixes and small improvements.
> > >
> > > Tapestry 5.8.1 is a drop-in replacement and recommended upgrade for
> > > Tapestry 5.7.0+ projects.
> > >
> > > All the details are in the release notes:
> > > https://tapestry.apache.org/release-notes-581.html.
> > >
> > > As always, if you have questions, post them here in the Tapestry users
> > > mailing list.
> > >
> > > Happy coding!
> > >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>
> --
> Thiago
>


Re: method varargs and property expression

2021-05-27 Thread Chris Poulsen
We never really use much of the expression language, so I can't comment on
that.

This is just a comment on the last example: I'm not sure that you need a
@Property when using the "var:" prefix (if you have a backing property it
ought to be a "prop:" binding, as far as I understand)

-- 
Chris



On Wed, May 26, 2021 at 12:00 PM Numa Schmeder  wrote:

> Hello,
>
> It seems method with varargs doesn’t work with property expression.
> If I put the following property expression, I get an error: Message
> doesn’t have a public “format" method.
> ${messages.format('priceFromPerGuest', travelMinPricePerGuest,
> displayedCurrency)}
> But If I write it as follow is works:
> messages.format('priceFromPerGuest', [travelMinPricePerGuest,
> displayedCurrency])
>
> Is this a bug ?
>
> Tapestry property expression is a bit limiting, particularly in conditions
> where you can’t have logical expression as:  test=“size > 10”
>
> I know the rational is to keep property expression as simple as possible,
> but having some logic expressed in the template is not that bad, because
> it’s in context ans sometimes makes more sense than having everything in
> java code.
>
> Also if you work a lot with collection of objects, you have to create a
> property for each type of element in the collections, the “var” keyword is
> not powerful to be used in complex property expressions.
> Exemple, this won’t work, but it would be very practical:
> 
> ${var:country.getName(locale)} - ${getPopulation(var:country)}
> 
>
> And if you use a generic property tempValue that you could reuse in
> different places, it won’t work because all conduits will be based on the
> Object Type and not Country type.
>
> @Property
> Object tempValue
>
> 
> ${tempValue.getName(locale)} - ${getPopulation(tempValue)}
> 
>
> Could we find a solution to avoir creating a lot of fields for all loops ?
>
> Thank you for your help,
>
> Best!
>
>
>      Numa Schmederwww.dfacto.ch  <
> http://www.dfacto.ch/>
> n...@dfacto.ch    |   M +41 79 538 30 01
>
> DIGITAL STRATEGY   |   DESIGN   |   DEVELOPMENT
>
>
>
>
>


Re: Coffeescript documentation is broken

2021-04-21 Thread Chris Poulsen
Nice! I think it is important that the docs are working - but I also know
how things work in the real world, so thank you :)

I checked a "random" link on the docs page and navigated to the
coffeescript docs on:
https://tapestry.apache.org/5.6.3/coffeescript/t5-core-dom-jquery.html
overall things look good.

The menu in the upper right corner in the coffeescript docs look much
better - However only the first 3 links in the menu works - the rest are
still not correct.

For example AJAX.COFFEE (first of the invalid links) points to
https://tapestry.apache.org/src/main/coffeescript/META-INF/modules/t5/core/ajax.html
where the correct link should probably be:
https://tapestry.apache.org/5.6.3/coffeescript/ajax.html (trial error shows
that the page is there, whether that is correct I do not know).

-- 
Chris





On Wed, Apr 21, 2021 at 1:42 PM Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> Hello!
>
> Thanks again!
>
> I've finally had some time to fix this. I've just committed the changes and
> it takes some time, maybe an hour, for them to be replicated to the site.
>
> On Fri, Apr 16, 2021 at 8:16 AM Chris Poulsen 
> wrote:
>
> > Hi
> >
> > Just checked
> >
> >
> https://tapestry.apache.org/documentation.html#Documentation-APIandComponentReference
> > again, nothing has changed.
> >
> > In the "API (javadoc)" row in the table, only 5.4 and 5.5 links point to
> > the correct page - 5.3.8, 5.6.2 and 5.7.0 (current) links all end with
> > /apidocs/ which basically "hides" the index page with the links to the
> > apidocs and coffeescript pages.
> >
> > Also the contents of the "jump to" (upper right corner) menu on
> > http://tapestry.apache.org/5.7.0/coffeescript/t5-core-dom-jquery.html
> are
> > still broken.
> >
> > --
> > Chris
> >
> >
> > On Wed, Apr 14, 2021 at 11:29 PM Thiago H. de Paula Figueiredo <
> > thiag...@gmail.com> wrote:
> >
> > > Hello! Please check again and let me know whether the problems are
> > actually
> > > fixed.
> > >
> > > On Thu, Mar 25, 2021 at 7:52 AM Chris Poulsen 
> > > wrote:
> > >
> > > > Hi
> > > >
> > > > I was just introducing a new employee to Tapestry and when I wanted
> to
> > > walk
> > > > through the coffeescript docs since I find them a little peculiar, I
> > > > realized that they are hard to find - and their navigation is broken.
> > > >
> > > > The way I found them, was to go to Tapestry->Documentation, clicked
> one
> > > of
> > > > the "API (javadoc) links" (5.4 and 5.5 seems to link correctly) - the
> > > rest
> > > > of the links go directly to the javadoc part (url ends with /apidocs)
> > > >
> > > > Once the docs are located, the menu in the top right corner is
> > > > non-functional - the text of the first link is:
> > > >
> > > >
> > > >
> > >
> >
> "/home/thiago/workspace-tapestry/tapestry-5/tapestry-beanvalidator/src/main/coffeescript/META-INF/modules/t5/beanvalidator/beanvalidator-validation.coffee"
> > > >
> > > > I guess it should be something slightly shorter and at the very least
> > not
> > > > include Thiagos homedir ;)
> > > >
> > > > --
> > > > Chris
> > > >
> > >
> > >
> > > --
> > > Thiago
> > >
> >
>
>
> --
> Thiago
>


Re: Coffeescript documentation is broken

2021-04-16 Thread Chris Poulsen
Hi

Just checked
https://tapestry.apache.org/documentation.html#Documentation-APIandComponentReference
again, nothing has changed.

In the "API (javadoc)" row in the table, only 5.4 and 5.5 links point to
the correct page - 5.3.8, 5.6.2 and 5.7.0 (current) links all end with
/apidocs/ which basically "hides" the index page with the links to the
apidocs and coffeescript pages.

Also the contents of the "jump to" (upper right corner) menu on
http://tapestry.apache.org/5.7.0/coffeescript/t5-core-dom-jquery.html are
still broken.

-- 
Chris


On Wed, Apr 14, 2021 at 11:29 PM Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> Hello! Please check again and let me know whether the problems are actually
> fixed.
>
> On Thu, Mar 25, 2021 at 7:52 AM Chris Poulsen 
> wrote:
>
> > Hi
> >
> > I was just introducing a new employee to Tapestry and when I wanted to
> walk
> > through the coffeescript docs since I find them a little peculiar, I
> > realized that they are hard to find - and their navigation is broken.
> >
> > The way I found them, was to go to Tapestry->Documentation, clicked one
> of
> > the "API (javadoc) links" (5.4 and 5.5 seems to link correctly) - the
> rest
> > of the links go directly to the javadoc part (url ends with /apidocs)
> >
> > Once the docs are located, the menu in the top right corner is
> > non-functional - the text of the first link is:
> >
> >
> >
> "/home/thiago/workspace-tapestry/tapestry-5/tapestry-beanvalidator/src/main/coffeescript/META-INF/modules/t5/beanvalidator/beanvalidator-validation.coffee"
> >
> > I guess it should be something slightly shorter and at the very least not
> > include Thiagos homedir ;)
> >
> > --
> > Chris
> >
>
>
> --
> Thiago
>


Coffeescript documentation is broken

2021-03-25 Thread Chris Poulsen
Hi

I was just introducing a new employee to Tapestry and when I wanted to walk
through the coffeescript docs since I find them a little peculiar, I
realized that they are hard to find - and their navigation is broken.

The way I found them, was to go to Tapestry->Documentation, clicked one of
the "API (javadoc) links" (5.4 and 5.5 seems to link correctly) - the rest
of the links go directly to the javadoc part (url ends with /apidocs)

Once the docs are located, the menu in the top right corner is
non-functional - the text of the first link is:

"/home/thiago/workspace-tapestry/tapestry-5/tapestry-beanvalidator/src/main/coffeescript/META-INF/modules/t5/beanvalidator/beanvalidator-validation.coffee"

I guess it should be something slightly shorter and at the very least not
include Thiagos homedir ;)

-- 
Chris


Re: Re: Spring Security Integration

2020-09-14 Thread Chris Poulsen
We have a couple of tapestry apps that are wired up using boot and spring
security.
A simple setup to get the Tapestry filter in, is something like this (no
web.xml, the listener and production mode symbol can be left out):

@SpringBootApplication
public class AppWebApplicationInitializer extends
SpringBootServletInitializer {

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder
builder) {
return builder.sources( ApplicationConfiguration.class );
}

@Override
public void onStartup(ServletContext servletContext) throws
ServletException {
super.onStartup(servletContext);

// make sure we have proxies for request/response available
servletContext.addListener(RequestContextListener.class);

// add Tapestry
servletContext.setInitParameter( "tapestry.app-package",
"com.company.package");

servletContext.setInitParameter("tapestry.use-external-spring-context",
"true" );
servletContext.addFilter("app", TapestrySpringFilter.class)
.addMappingForUrlPatterns(null, false, "/*");

// default production mode - to allow reacting to it in contribute
application defaults
servletContext.setInitParameter(SymbolConstants.PRODUCTION_MODE,
"true");
}

}

HTH.
-- 
Chris

On Mon, Sep 14, 2020 at 2:24 AM Ronny Latif  wrote:

> I managed to get Tapestry integrated with Springboot using this example
> https://github.com/code8/tapestry-boot.
> Followed by security integration using Apache Shiro.
> http://www.tynamo.org/tapestry-security+guide/
>
> However the drawback that I'm having atm is I lost the ability to
> hot-replace my code.
> Any idea where to look in order to enable tapestry hot-replace again ?
>
> On Sat, Sep 12, 2020 at 12:00 AM Thiago H. de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
> > On Fri, Sep 11, 2020 at 4:48 AM Reinhold Gruber 
> wrote:
> >
> > > Hi!
> > >
> >
> > Hello!
> >
> >
> > > Yes, I looked into the quickstart archetype and Apache Shiro.
> > >
> > > One requirement of the project is to delegate
> > Authentication/Authorization
> > > to an WSO2 Identity Server with the help of OpenId Connect.
> > > This can be done quite easily in Spring Boot + Security.
> > > I did not find this kind of integration in Shiro.
> > >
> >
> > I'm definitely not an expert in that field so I'm afraid I cannot help
> you
> > further here.
> >
> > Have you checked the Tapestry-Spring integration?
> > https://tapestry.apache.org/integrating-with-spring-framework.html
> >
> >
> > >
> > > Regards
> > > Reinhold
> > >
> > >
> > >
> > >
> > > Gesendet: Freitag, 11. September 2020 um 01:11 Uhr
> > > Von: "Thiago H. de Paula Figueiredo" 
> > > An: "Tapestry users" 
> > > Betreff: Re: Spring Security Integration
> > > On Thu, Sep 10, 2020 at 5:50 PM Reinhold Gruber 
> > wrote:
> > >
> > > > Hi!
> > > >
> > >
> > > Hi!
> > >
> > > I have a hard time trying to integrate Tapesty within a Spring Boot
> > > > Application secured by Spring Security.
> > > > Did anyone have success in this area and wants to share his
> experience
> > > and
> > > > knowhow. I thought that it would be enough to simply append the
> > > > TapestryFilter after the Spring FilterChain but apparently it is not.
> > > >
> > >
> > > Have you tried creating a Tapestry project using the archetype
> > > (quickstart)? It's documented here:
> > > https://tapestry.apache.org/getting-started.html. It does create a
> > project
> > > using Spring Boot.
> > >
> > > I know you're looking for Spring Security, but I'd like to mention
> anyway
> > > that Tapestry has a very good integration with Apache Shiro (another
> > > security framework) written by a committer of both Tapestry and Shiro:
> > >
> > >
> >
> http://www.tynamo.org/tapestry-security+guide/[http://www.tynamo.org/tapestry-security+guide/]
> 
> > <
> http://www.tynamo.org/tapestry-security+guide/%5Bhttp://www.tynamo.org/tapestry-security+guide/%5D
> >
> > > <
> >
> http://www.tynamo.org/tapestry-security+guide/%5Bhttp://www.tynamo.org/tapestry-security+guide/%5D
> > >
> > >
> > >
> > > >
> > > > Best Regards
> > > > Reinhold
> > > >
> > > > -
> > > > 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
> > >
> > >
> >
> > --
> > Thiago
> >
>


Re: HTML5 Button Component for tapetry 5.4.x

2019-09-11 Thread Chris Poulsen
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 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 =
> BindingConst

Re: Apache Tapestry for Java 11

2019-09-10 Thread Chris Poulsen
I did roll an "internal" 5.5-beta version based on the code from 12th July
as there are some fixes in HEAD that are not in the beta-2 and that bastard
build is what we currently are using without problems.

If 5.5 isn't 100% ready for release yet, it seems to be really close and it
would be good to get it finalized IMO.

-- 
Chris

On Mon, Sep 9, 2019 at 9:11 PM Charles Roth  wrote:

> Sounds good to me.  We'd be very happy to test a 5.5-beta. (Large
> application that has about 1M LOC, including unit-tests, TML, etc.)
>
> On 9/9/2019 3:08 PM, Dmitry Gusev wrote:
> > Hi Charles,
> >
> > Current state of the master branch should run just fine on Java 11;
> there's
> > no release you can download though.
> >
> > We should probably start a vote on another Tapestry 5.5-beta soon to
> > release current state of the master branch,
> > and maybe make a first 5.5.0 release right after we get some feedback
> from
> > community.
> >
> >
> > On Mon, Sep 9, 2019 at 9:54 PM Charles Roth  wrote:
> >
> >> Is there any new(ish) word on Tapestry 5.5 or any other release that
> >> will run under Java 9, 10, and maybe 11?
> >>
> >> Thanks!
> >>
> >> On 10/8/2018 12:54 PM, Bob Harner wrote:
> >>> Yes. The unreleased 5.5 version passses all tests with the Java 9+
> >>> compatible version of ASM (which was the obstacle for running Tapestry
> >> 5.4
> >>> under Java 9+) and should be usable for Java 9 and 10 now (once
> >> released),
> >>> although it hasn't been tested enough by others. I haven't checked it
> >> with
> >>> Java 11 yet. The Tapestry nightly snapshot process is broken currently,
> >> and
> >>> that's the principal obstacle to the 5.5 release.
> >>>
> >>> https://issues.apache.org/jira/plugins/servlet/mobile#issue/TAP5-2588
> >>>
> >>> My weekends have been occupied by other projects the last few weeks
> but I
> >>> hope to get back on it next weekend.
> >>>
> >>> On Mon, Oct 8, 2018, 9:49 AM gard sæbø 
> >>> wrote:
> >>>
>  Hi!
> 
>  We are upgrading all our Java applications, which currently runs on
> Java
>  8, to Java 11.
> 
>  Our web applications use Apache Tapestry as the frontend framework,
> but
> >> it
>  seems a bit quite on the Tapestry commit log in comparison with other
>  frontend frameworks.
> 
>  Will there be any upgrade which will support Java 11 and future Java
>  versions?
> 
>  Best regards,
>  Gard Sæbø
>  -
>  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: Proxying default methods does not work with 5.5.0-beta-2

2019-07-12 Thread Chris Poulsen
Hi

I've just gotten around to test our products against Tapestry 5.5
(master/HEAD) - Everything seems to work fine with the latest code, good
work!

Would it be possible to get a tagged beta (or rc) version published to some
repository that we can rely on for stable builds?

I can see several 5.4 beta/rc versions in central (
https://mvnrepository.com/artifact/org.apache.tapestry/tapestry-core ),
that would work well for us. I can see a single 5.4-beta on apache staging,
but it seems unclear how long we can expect things to be present in
"staging".

-- 
Chris

On Sat, Jun 22, 2019 at 3:43 AM Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> I've just committed a fix for this issue.
>
> On Mon, May 6, 2019 at 2:35 PM Oliver Kaiser 
> wrote:
>
> > Hi everyone,
> >
> > given something like this:
> >
> > public interface Blub {
> >public default String foo() {
> >  return "Default";
> >}
> > }
> > public class BlubImpl implements Blub {
> >@Override
> >public String foo() {
> >  return "Impl";
> >}
> > }
> >
> > when calling "registry.getService(Blub.class).foo()" using beta-1 this
> > works as expected (BlubImpl is called); when using beta-2 only the
> > default method is called.
> >
> > the log output of PlasticProxyFactory shows that the method is skipped
> > in the generated class
> >
> > seems to be related to this commit
> >
> >
> https://github.com/apache/tapestry-5/commit/709d282bfc626ce55cde07cbf909c0b86c2b4bcb#diff-89a017b694cffee07e15608bc316d0d7
> >
> > now "proxyInterface(Class, PlasticMethod)" only
> > calls "introduceInterface(Class, PasticMethod)" (which skips the method
> > as "isDefaultMethod(m)" returns true); earlier versions had an
> > additional for-loop which handled this case (at least from stepping
> > though in a debugger it looks that way)
> >
> >
> > that's a regression, right?
> >
> >
> > btw: thanks to everyone who worked on the 5.4->5.5 transition; updating
> > was very smooth!
> >
> >
> > Regards,
> > Oliver
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>
> --
> Thiago
>


Re: Looking for open source projects that uses the current version of Tapestry

2019-07-08 Thread Chris Poulsen
Hi,

Using nnn="{}" is probably not correct in any case, I think that
what you think is an expression ends up as just a literal string.
 One can expand properties (and other stuff) in templates using
${}, but that expansion ends up being a string. For component
bindings like the one in your example you should simply reference the
property without {} or ${}.

These things are described here:
http://tapestry.apache.org/component-parameters.html (there is even a
section called: "Don't use the ${...} syntax!" on that page ;) ).

HTH!

-- 
Chris

On Mon, Jul 8, 2019 at 4:22 PM Tobias Scholze 
wrote:

> Hi folks,
> thanks again for helping me out with my last issue yesterday.
>
> Now I recognized that Tapestry 5.4.4 has no Jumpstart Tutorial section and
> some parts has been changed like the "" required now a value
> property but "t:value={myProperty}" will not find that property in the Java
> class etc, pp.
>
> That's why I'm looking for some open source projects (which has public
> accessable code) that uses Tapestry 5.4.4 use them as a "tutorial".
>
> I'm thankful for every tipp :)
>
> Have a great day,
>
> - Tobi
>


Re: Accessing a page over HTTPS results in infinite 302 redirects

2019-06-14 Thread Chris Poulsen
Hi,

We use:

// default to non-secure pages (allows us to support both http and https
based on the request)
configuration.add( SymbolConstants.SECURE_ENABLED, "false" );

And always have an upstream proxy for performing SSL termination. This
relies on the X-Forward-* headers being set and handled correctly by the
various servers.

-- 
Chris

On Fri, Jun 14, 2019 at 10:06 AM Dmitry Gusev 
wrote:

> Hi,
>
> I'd suggest to check value of `Request#isSecure()`, it looks like it's
> false.
>
> It can happen if your WebSphere is behind a proxy/load balancer which
> terminates SSL,
> in this case you may need to configure WebSphere to acknowledge the
> x-forwarded-proto HTTP header.
>
> On Fri, Jun 14, 2019 at 9:17 AM Kim Syväluoma  wrote:
>
> > We have a Tapestry application which we need to use over HTTPS only. We
> > are using Weblogic only.
> >
> > We have these set in the AppModule of the Tapestry application:
> >
> > public static void contributeApplicationDefaults(
> >  final MappedConfiguration configuration) {
> >  configuration.add("tapestry.supported-locales", "en");
> >  configuration.add("tapestry.start-page-name", "start");
> >  configuration.add(SymbolConstants.HOSTPORT_SECURE, "443");
> >  configuration.add(SymbolConstants.SECURE_ENABLED, "true");
> > }
> >
> > public static void contributeMetaDataLocator(final
> > MappedConfiguration configuration) {
> >  configuration.add(MetaDataConstants.SECURE_PAGE, "true");
> > }
> >
> > In the Start page we have a redirect like this:
> >
> > final Object onActivate() {
> >  if (!this.sessionHandler.isLoggedIn()) {
> >  return this.loginPage;
> >  }
> >  return this.mainFrameSet;
> > }
> >
> > We we try to access our app by HTTPS at root or directly at the start
> > page, loginPage or mainFrameSet page we get infinite redirect loop (302)
> > to the same page we are accessing.
> >
> > If we set the MetaDataConstants.SECURE_PAGE to false we can access our
> > app over HTTPS but all page requests/links within the app is then done
> > over HTTP and that does not work.
> > We need to have all functionality within the app to work over, and using
> > only, HTTPS.
> >
> > What have we missed?
> >
> > Br,
> > Kim
> >
> > --
> > ¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤øø¤º°`°º¤ø,¸¸,ø¤
> > Name:   |   Kim Syväluoma|
> > Email:  |   kim@aland.net|
> > Tel (GSM):  |   +358 (0)40 592 5267  |
> > Tel Work:   |   +358 (0)20 7910 666  |
> > =
> >
> > -
> > 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
>


Re: Re: Open Discussion: remove Bootstrap from T5 core

2019-02-19 Thread Chris Poulsen
Hi

I think working on making the framework "core" more css agnostic seems like
a good direction, allowing things to move forward without having to try and
pick (and maintain) the correct bootstrap version (or other css framework
version/flavor). There is a pretty good chance that whatever is selected,
will not fit the requirements of everybody anyway.

It is a while back, but was the tapestry bootstrap integration not
initially handled "externally" by a markup renderer filter (I guess it
removed the tapestry default styling and added the bootstrap equivalent).
Maybe something similar could be used to apply styling (Tapestry-BS3,
Tapestry- BS4 or whatever) to the tapestry components, without having to
dream up new stuff. (Provided that the processing does not become a
significant performance bottle-neck).

-- 
Chris



On Tue, Feb 19, 2019 at 10:05 AM abangkis  wrote:

> Another 👍👍 up.
>
> Btw, could you share the link to the github repo here? Thanks.
>
> On Fri, Feb 15, 2019 at 7:03 PM Jens Breitenstein 
> wrote:
>
> > Thanks for you positive feedback. I suggest the following now:
> >
> > 1) I will use git hub to create a new T5 Fork based on Thiagos
> > 5.5.0-beta-1 and remove all bootstrap dependencies. As soon this
> > compiles we will have a T5.5 version looking like websites in the good
> > old early 80ies.
> >
> > 2) I will try to get our own (unfortunately internal) website up and
> > running again, including the latest BS3, means all BS code is located in
> > my client (it is anyway, because we use a newer BS3).
> >
> > 3) Next I extract all BS3 related code to a new module, thus we have a
> > plain T5.5 without BS, a T5-BS3-extension and a sample APP using the BS3
> > css classes / col definitions in TML code -> everything is like before,
> > existing code should still run without modifications.
> >
> > 
> >
> > 4) I invite you to discuss the implementation details how we can best
> > make use of bootstrap related features without tight coupling so we can
> > basically change between BS3 and BS4. This means we need some way to
> > handle BS related differences like new / missing BS classes (for example
> > panel) and we have to support the different grid definitions aso. One
> > way (for example) might be T5 components to wrap most of the BS classes
> > and each extension lib will take care of the particular BS details. At
> > the very end our TML code never sees BS css classes at all, well at
> > least for the "most common" things. We can start this discussion right
> > now, because this is the tough part to my opinion. I would like to hear
> > / read all your ideas.
> >
> > 5) We / I create a mini App using the new T5-BSx extensions do
> > demonstrate the use of the new BSx handling, we need it for testing /
> > discussing anyway (see 4)
> >
> >
> > We move over our disussion to github to avoid polluting the mailing list.
> >
> > Ok?
> >
> >
> > Jens
> >
> >
> >
> >
> >
> > Am 14.02.19 um 14:07 schrieb Bob Harner:
> > > I agree that Tapestry shouldn't be so tightly coupled to a specific CSS
> > > framework.
> > >
> > > For context and some alternative ideas, see this prior discussion of
> the
> > > same topic:
> > >
> > >
> >
> https://tapestry.markmail.org/search/?q=What+happens+when+Boootstrap+4+is+released%3F
> > >
> > > On Thu, Feb 14, 2019, 4:52 AM Ben Weidig  > >
> > >> Hi Jens,
> > >>
> > >> I like the idea of decoupling the core and Bootstrap to make it easier
> > to
> > >> use other versions.
> > >>
> > >> Maybe the components should be updated to BS4 for T5.5, with a legacy
> > >> fallback or a component swap (can't remember the service doing it, we
> > have
> > >> our own implementation, it's doing an advice on
> > >> ComponentClassResolver#resolveComponentTypeToClassName or
> > >> ComponentInstantiatorSource#getInstantiator).
> > >>
> > >> For 5.4 we've developed an internal solution for using different BS
> > >> versions, here are some specifics.
> > >>
> > >> We have multi-tenant-apps with different BS versions (so far up to 3),
> > so
> > >> we needed a flexible solution that supports the internal BS and other
> > >> versions dynamically.
> > >>
> > >> To make it even more flexible we've added SASS-support and compile
> > >> Bootstrap from the source files, with the possibility to add files
> > >> beforehand to the compilation step with custom variables etc.
> > >>
> > >> The layout component has an annotation that triggers
> > >> a ComponentClassTransformWorker2 attaching a JavaScriptStack
> containing
> > the
> > >> BS version decided by a contributable strategy pipeline.
> > >>
> > >> JavaScript modules were the biggest problems, we started with
> replacing
> > the
> > >> internal modules, but ended up adding additional modules instead. This
> > >> worked fine after getting all the dependencies right, but every BS
> > version
> > >> might break it again, so we're now using the bundled version of BS JS.
> > >>
> > >> We think this could all be cleaned up nicely if the inter

Re: [ANNOUNCEMENT] Tapestry 5.4.4

2019-01-03 Thread Chris Poulsen
Hi

The "fix" for GenericsUtils is attached. I think that Guava is not the
proper general solution as it is a rather huge beast to bring in, just to
get access to its TypeToken. Personally I would prefer a lighter solution.

We have been running this code in production since medio '16 without
requiring any more fixes. I can see from my commit comment back then, that
I initially attempted to fix GenericsUtils itself, then attempted to use
the commons-lang3 (reflect stuff) and finally gave up plugging in Guava as
it was already a dependency of our application. If the reflect stuff from
commons-lang3 could be made to work, that would not require any additional
dependencies being added and be a good solution IMO.

I'm not sure I did create a ticket for the GenericsUtils issue, I may just
have asked on the list to see if anyone else was had experienced something
similar.

Revisiting our override code I also see that we have a custom
PropertyAccessImpl in place, that one fixes some cases where the Java
Introspector fails to locate some setters, but I see that the Tapestry
class has received some changes after our version was created, so I
probably need to check whether that one is still necessary.

-- 
Chris


On Thu, Jan 3, 2019 at 1:05 AM Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Wed, Dec 19, 2018 at 11:26 AM Chris Poulsen 
> wrote:
>
> > Hi
> >
> > Hello!
>
>
> > We are using some pretty complex data models with deep interface
> > hierarchies and generics, and I ended up replacing the internals of
> > GenericsUtils with calls to com.google.common.reflect.TypeToken (Guava)
> to
> > get correct behavior
>
>
> Would it be possible to share your GenericUtils implementation using Guava
> with the Tapestry project? Also, what's the ticket you posted before? We
> definitely want to fix it for the 5.5.0 release. I already got another
> report of a similar problem from another person and it would be nice to
> reuse your solution if possible.
>
>
> > (often tapestry would complain that some "setter" was
> > not found or similar because it resolved the type to something higher in
> > the interface/object hierarchy and missed the correct method override due
> > to typing or something else. (I spent some time on attempting to fix the
> > tapestry implementation, but ended up thinking it was a waste of time
> > trying to replicate functionality that was already coded (more correctly)
> > by other people, and picked guava as that was already present in our
> > dependencies).
> >
> > Perhaps it is possible to find a lightweight,/focused library with a
> > compatible license today, that tapestry could rely on, instead of
> > attempting to implement this on its own.
> >
> > This is obviously not a widespread problem, but it is one of correctness
> > and it tickles my OCD ;)
> >
> > --
> > Chris
> >
> > On Wed, Dec 19, 2018 at 1:23 PM Thiago H. de Paula Figueiredo <
> > thiag...@gmail.com> wrote:
> >
> > > On Wed, Dec 19, 2018 at 8:41 AM Rafael Bugajewski <
> > > raf...@juicycocktail.com>
> > > wrote:
> > >
> > > > Congratulations! Thanks to the core team for your continuous work and
> > the
> > > > effort you put into maintaining Tapestry.
> > > >
> > >
> > > Thanks!
> > >
> > >
> > > > I think the whole industry goes the way of trying to simplify things
> > > (just
> > > > take a look at the most recent programming languages & frameworks).
> If
> > > > we’re talking about modernizing and competing with other frameworks,
> I
> > > > would like to see Tapestry reducing the complexity that is currently
> > > > required to grasp the framework and its various concepts (which are
> > > > technically great, but sometimes hard to understand if you just start
> > > > working with Tapestry). I think this will only work by providing old
> &
> > > new
> > > > APIs at the same time and by making the upgrade path and improvements
> > > very
> > > > clear in the documentation.
> > > >
> > >
> > > Well, some stuff is indeed not simple, and I'd say the form support is
> > the
> > > part which could use some new components to make at least the simpler
> > > scenarios simpler to implement (for example, when there are no loops).
> > > Which other areas do you think could or should be simplified?
> > >
> > >
> > > > Personally I’m also getting into the vibe of smaller services that
> > >

Re: [ANNOUNCEMENT] Tapestry 5.4.4

2018-12-19 Thread Chris Poulsen
Hi

Nice work on moving tapestry forward! It looks like the JDK updates may
just land, before we can't postpone updating our stuff anymore *fingers
crossed* ;)

There are still something fishy in the property access / generics support
implementation, I reported it some years back either on the list or in
jira, but it never got much attention. I do not know if this will get more
apparent as tapestry move towards newer runtimes.

We are using some pretty complex data models with deep interface
hierarchies and generics, and I ended up replacing the internals of
GenericsUtils with calls to com.google.common.reflect.TypeToken (Guava) to
get correct behavior (often tapestry would complain that some "setter" was
not found or similar because it resolved the type to something higher in
the interface/object hierarchy and missed the correct method override due
to typing or something else. (I spent some time on attempting to fix the
tapestry implementation, but ended up thinking it was a waste of time
trying to replicate functionality that was already coded (more correctly)
by other people, and picked guava as that was already present in our
dependencies).

Perhaps it is possible to find a lightweight,/focused library with a
compatible license today, that tapestry could rely on, instead of
attempting to implement this on its own.

This is obviously not a widespread problem, but it is one of correctness
and it tickles my OCD ;)

-- 
Chris

On Wed, Dec 19, 2018 at 1:23 PM Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Wed, Dec 19, 2018 at 8:41 AM Rafael Bugajewski <
> raf...@juicycocktail.com>
> wrote:
>
> > Congratulations! Thanks to the core team for your continuous work and the
> > effort you put into maintaining Tapestry.
> >
>
> Thanks!
>
>
> > I think the whole industry goes the way of trying to simplify things
> (just
> > take a look at the most recent programming languages & frameworks). If
> > we’re talking about modernizing and competing with other frameworks, I
> > would like to see Tapestry reducing the complexity that is currently
> > required to grasp the framework and its various concepts (which are
> > technically great, but sometimes hard to understand if you just start
> > working with Tapestry). I think this will only work by providing old &
> new
> > APIs at the same time and by making the upgrade path and improvements
> very
> > clear in the documentation.
> >
>
> Well, some stuff is indeed not simple, and I'd say the form support is the
> part which could use some new components to make at least the simpler
> scenarios simpler to implement (for example, when there are no loops).
> Which other areas do you think could or should be simplified?
>
>
> > Personally I’m also getting into the vibe of smaller services that
> > communicate with each other, instead of this one monolithic giant that
> > tries to be everything, but is nothing in the end. We use
> bootique-tapestry
> > (and also other Bootique-compatible integrations). I would like to see
> > Tapestry to also go in this direction and improve integration on similar
> > deployment environments.
> >
>
> We could definitely have some ideas to make microservices easier to build
> on the top of Tapestry-IoC.
>
>
> > On the other side, I’m currently pretty happy with the state of Tapestry
> > and with the framework keeping up with modern Java versions.
> >
>
> Thanks!
>
> --
> Thiago
>


Re: DateField behaviour when within a zone

2018-12-06 Thread Chris Poulsen
Hi

 is valid html, while  is valid xhtml, so depending on what
you are outputting open  may be appropriate.

If the built-in datepicker is giving you grief, roll your own... I find
that we (at work) eventually have had to replace almost all of the slightly
fancy "gui" components in tapestry, while the most basic ones still works
like expected (as browsers / styling frameworks etc. gets better and
requires less server-side interaction, the need for server round trips like
the one you mentioned for the date picker diminishes).

Form fields are matched server-side by the "name" attribute (in the servlet
api).

-- 
Chris

On Thu, Dec 6, 2018 at 4:02 AM Christopher Dodunski <
chrisfromtapes...@christopher.net.nz> wrote:

> Just a few short questions to help progress with problem solving.
>
> 1) Is there any known reason why DateField's WebFX DatePicker wouldn't
> work within an embedded Tapestry component?  I've had no problem with it
> working directly in a Tapestry page.  Don't want to be flogging a dead
> horse here.  :-)
>
> 2) In the HTML source below, you can see that Tapestry isn't generating
> well-formed markup in the 2nd example (absent closing  tags).  Is
> this just a red herring?
>
> 3) Despite the DateField tags containing id parameters, could it be that
> these text fields are not discoverable after the server is called to parse
> the date selected using the DatePicker popup?
>
> Again, the datefield itself accepts textual input.  Just the DatePicker
> doesn't work.
>
>
> **THIS DATEFIELD'S DATEPICKER WORKS CORRECTLY**
>
>  action="/harbour/movement/create.registerform" method="post"
> id="registerForm">
> 
> value="K2I7Z6fbINGg1K7hkAtWgn/blEI=:H4sIAJVQu0oDQRS9CRqEIIhPJCgBY7tpTKONiSAWQYRoYze7e92M7M6MMzevxta/8AvE2j6Fnf/gB9haWTibhRg3L4WBYc6cF+fpAxY727AZyTZGKKh8opERHja576MAo+FY6sBhinlNdIgpNKR7FceTGkPu2jtSUlihcc4GktKFlh4a02i5ETeGS3H9UFzrFl5yWcjUIe9JQVqG5yxCgtX6LWuzcshEUG6Q5iI46iqCXJI+qVfbWmMY96rM7OUyg07VtSDz6JRj6JcaSC21f9XPv2+8fo2VuYN7yAzCk4jZ4dX/ho+t0n/2D24+H9+yAF3V2YL1dBj1FIKJay2QPfY1lRWTljpF2En/GtvPb4XoE49+zJaH8KWF5+sS+10opGlS84ALFzU1h+b5BKzF4DxNYrwHxTTJt4Nywcju9Nt9ZeQnifiLOsmZsJ6QNLJx/JrKGnh8A1L3LvkuAwAA"
> name="t:formdata" type="hidden"> name="hidden" type="hidden">
>
> 
> Scheduled Time
> 
> 
> data-format-url="/harbour/movement/create.scheduledtime:format?t:ac=Dashboard"
>
> data-parse-url="/harbour/movement/create.scheduledtime:parse?t:ac=Dashboard"
> data-component-type="core/DateField"> placeholder="scheduled time of movement ("dd mmm 
> hh:mm")" data-required-message="You must provide a
> value for Scheduled Time." data-optionality="required"
> data-validation="true" value="" id="scheduledTime"
> name="scheduledTime" class="form-control"
> type="text"> alt="[Show]" class="btn btn-default" type="button"> class="glyphicon
> glyphicon-calendar">
> 
> 
>
> 
> 
>
>
> **THIS DATEFIELD'S DATEPICKER FAILS**
>
> 
>
>  data-validate="submit"
> action="/harbour/dashboard.movementpanel.filterpane.filterform"
> method="post" id="filterForm">
> 
> value="Uf5iT4YCrKb6BK/NRv8EvGKwvuI=:H4sIAL2UPWgUQRTHXyJRyGEQQS1sLCIS8SZ3eCdBEQneXRSOVW4vShphdnfusjI7M868TU4EawsbKztBsPOj0MIuRVJIrrBR7AVbQQxYGXDGFS0EuV04m/l+7/ef9x7v2WeYWq9AuUHNaiCpjs4mco0lTKCignHSizky7dYkoQPNTMrRgNGwIHWfUEXDVUaQKmZQ366TUGrG48DOiZLCejGkQ6NYLmmZqlmfYaoeVDZOvZrZ2ZyEiTaUQilQS+7RhCEcbN+ka3SeU9Gf91HHon9uoBCmLbmTkQtJrRWQWh0OhsOX/u7GJMBArZ+EEyNguZTKAcmowLY1mK2Xr2x/mIM72+NHVVc+Pd/pvX73uAjKy4WyCUN75SNF1tIy8d0uushj++Qa5SkrP9x8fw+O7f6qgz8Xt+AuTLi87+k2vbGGo/ZV9eaWDj+9kD8cTuQ0wt7u9abXXclj6ixnirCmWpdb/wm179Ky1+g0G+OF5U3XmcqBLws3ntw/n6XrNFRGQLnBINUY2UJ0zPo/mQE1jCwG9pCG2IoZj7KudXx5q/Tx0Jvvf3Wt39W635F8R2pYUlF1i3nVXdUyZMb4aZDExsRSbL2Iar1vj95mQaoCGVEGE1Emwv3oCELJHTZF9PM3+d04L0d/AJVBrr9eBgAA"
> name="t:formdata" type="hidden">
> 
> Start
> 
> data-format-url="/harbour/dashboard.movementpanel.filterpane.panestartdate:format?t:ac=movementZone"
>
> data-parse-url="/harbour/dashboard.movementpanel.filterpane.panestartdate:parse?t:ac=movementZone"
> data-component-type="core/DateField"> name="paneStartDate" class="form-control" type="text"> class="input-group-btn">
> 
>  type="submit">
> 
>
> 
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: How to let custom component participate in form submission

2018-11-04 Thread Chris Poulsen
Hi

It sounds like you are attempting to do something in a way that may not be
ideal (judging from all the hoops you are trying to jump through).

In Tapestry you can usually get really far using the simple building blocks
that are provided. With a few exceptions you are usually taking a bad
course, when you think you need to write all kinds of weird code to make
the framework happy (Exceptions are usually things like when the (complex)
built-in components like grid and tree does not support what you need).

You seem to have a somewhat unclear understanding of component rendering
and form submissions, that could be a place to start. (Hint. take a look at
the Form component
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Form.html
- That is the one that triggers those prepare* events etc, there is no
magic going on in pages with respect to that. As events bubble "up" through
containers, you should not expect your component to receive those events if
it is _inside_ the form. If you want something complex acting like a form
element, use Thiagos suggestion).

I would recommend against trying to implement some kind of pub/sub
mechanism to circumvent the fact that you feel your components are
misbehaving because events bubble up... - It may be possible to get
something to work, but with respect to maintenance and component
re-usability you will most likely end up realizing that you have shoot
yourself in the foot, at some point.

With a few exceptions, I would generally say that using @Persist in
components is a smell, instead pass the information as a parameter - Pages
are ultimately the things driving the components, they should worry about
how to configure the components (if that means that a value should be
persisted, it should happen in the page).

Also if you find yourself needing page life-cycle callbacks in your
component (e.g my component should do this on activate or similar, you are
doing it wrong)

It is hard to come up with something concrete based on the info provided,
but I guess that if you realize how form submission and component render
life cycles interact, it will be easier to fix your problem.

-- 
Chris





On Thu, Nov 1, 2018 at 3:53 PM abangkis  wrote:

> Hi Thiago,
>
> This component is some ui that we extract from few common pages. It shows a
> series of tabs. Each tabs has its own related Hibernate Entity. We don't
> pass all the tabs entity as parameter to the component. Instead we just
> pass the root component and let the rest of the tab get their entity from
> the DAO injected to the component.
>
> The component is encapsulated inside of a form. It works well showing the
> data for each tab. But when we submit the form we receive that error. Since
> the tabs Hibernate Entity is not Persist in the component. Our approach is
> to use @Persist only when we have to. Usually this is handled in the page
> by populating the tabs Hibernate Entities in the page OnPrepare method.
> Translating this approach from a page implementation to the custom
> component isn't as straight forward as I thought. Since OnPrepare isn't
> called in the custom component. (it's part of page life cycle but not part
> of component rendering lifecycle?)
>
> Tried to implement it using Process Submission example from jumpstart
> (since it seems that's how you implement a component that contribute the
> value to form submission process). But still haven't got it working yet.
>
> By the way. Is it common to have @Persist property inside of a component?
> How do you clean the persisted field after submission? Is it enough only by
> calling ComponentResources.discardPersistentField() on the page OnSucces
> method? Or do we need to clean it up on the Component Java code instead?
>
> Sorry if the explanation a bit long and confusing. Thanks.
>
>
>
>
>
>
> On Thu, Nov 1, 2018 at 8:41 PM Thiago H. de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
> > Hello!
> >
> > What exactly is this component trying to do? I couldn't get it by looking
> > at your code snippet.
> >
> > Anyway, the probably best way of doing it if you want to create a
> component
> > which edits something is to subclass AbstractField.
> >
> > The error message says you're trying to pass a null object to BeanDisplay
> > while it renders, so this doesn't seem to be a problem with form
> submission
> > at all, but a problem while rendering the page later.
> >
> > Failure reading parameter 'source' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> > Parameter 'object' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> >
> >
> > On Thu, Nov 1, 2018 at 4:43 AM abangkis  wrote:
> >
> > > Hai guys, still working on my custom component.
> > >
> > > How do we let our custom component participate in form submission.
> > > Apparently there is no onPrepare hook for tapestry custom component.
> > > http://tapestry.apache.org/component-rendering.html

Re: Has anyone tried nesting "toplevel" layout components successfully?

2018-10-15 Thread Chris Poulsen
Hi

Thanks for the input.

I agree with your points and my experience is also that mostly things just
work or you are provided with a helpful error (my naming is to avoid having
to change all the pages that currently refers to "layout" while testing ;)

I have managed to get it to work. I had screwed up somewhere along the way
and managed to not create PageLayout class/tml in the same path in the
final output. It was apparently "working enough" to make it hard to see
what was actually wrong.

Sorry for the noise

-- 
Chris

On Mon, Oct 15, 2018 at 1:12 PM Bob Harner  wrote:

> What you're trying to do is quite common and always works fine in my
> experience. In fact this sort of composition is preferred over having a
> shared base class. I often have a main "Layout" component along with more
> specialized layout components for different sections of a site (e.g.,
> AuthenticatedLayout"), each of which wraps itself in the main Layout
> component. The naming is backward from yours, but it's the same idea. The
> nesting of layout components is really just using Tapestry's basic ability
> to nest components in general.
>
> Can you show us the first few lines of TML from your main pagelayout
> component and your nested layout component?
>
>
> On Mon, Oct 15, 2018, 6:13 AM Chris Poulsen 
> wrote:
>
> > Hi
> >
> > I'm trying to improve on the layout we are using across several tapestry
> > based products.
> > Initially it used an abstract base layout component that the products
> > extend to provide a common line for the layout.
> >
> > I'm trying to simplify this situation by making the layout in the
> framework
> > module a concrete component (lets call it pagelayout), that wrap its
> t:body
> > in  etc.
> >
> > Each product creates its own layout (called layout) component that
> provides
> > the specific menu, topbar etc. and then wraps itself in the layout from
> the
> > framework module.
> >
> > Ordinary pages has t:type=layout in their root element to wrap themselves
> > in the product layout component, which in turn has t:type=pagelayout on
> its
> > root element to wrap itself in the framework layout providing the
> > surrounding html tag.
> >
> > According to the documentation (
> >
> >
> https://tapestry.apache.org/layout-component.html#LayoutComponent-NestedLayouts
> > )
> > this should not be an issue.
> >
> > However when I try to render one of these pages tapestry complains with:
> >
> > Caused by: java.lang.RuntimeException: The root element of the rendered
> > document was , not . A root element of  is needed when
> > linking JavaScript and stylesheet resources.
> > at
> >
> >
> org.apache.tapestry5.internal.services.DocumentLinkerImpl.addScriptElements(DocumentLinkerImpl.java:179)
> > at
> >
> >
> org.apache.tapestry5.internal.services.DocumentLinkerImpl.updateDocument(DocumentLinkerImpl.java:140)
> > at
> >
> >
> org.apache.tapestry5.modules.TapestryModule$25.renderMarkup(TapestryModule.java:1752)
> > at $MarkupRenderer_1760ef286199e.renderMarkup(Unknown Source)
> > at
> >
> >
> com.dezide.author.tapestry.DeferredDialogFilter.renderMarkup(DeferredDialogFilter.java:21)
> > at $MarkupRendererFilter_1760ef286199c.renderMarkup(Unknown
> Source)
> > at $MarkupRenderer_1760ef286199e.renderMarkup(Unknown Source)
> > at $MarkupRenderer_1760ef2861999.renderMarkup(Unknown Source)
> > at
> >
> >
> org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:47)
> > at $PageMarkupRenderer_1760ef2861997.renderPageMarkup(Unknown
> > Source)
> > at
> >
> >
> org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:64)
> > at $PageResponseRenderer_1760ef28618e2.renderPageResponse(Unknown
> > Source)
> > at
> >
> >
> org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:72)
> > at
> >
> >
> org.apache.tapestry5.modules.TapestryModule$34.handle(TapestryModule.java:1974)
> > at $PageRenderRequestHandler_1760ef28618e4.handle(Unknown Source)
> > at $PageRenderRequestHandler_1760ef28618d3.handle(Unknown Source)
> > at
> >
> >
> org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handlePageRender(ComponentRequestHandlerTerminator.java:48)
> > 

Has anyone tried nesting "toplevel" layout components successfully?

2018-10-15 Thread Chris Poulsen
Hi

I'm trying to improve on the layout we are using across several tapestry
based products.
Initially it used an abstract base layout component that the products
extend to provide a common line for the layout.

I'm trying to simplify this situation by making the layout in the framework
module a concrete component (lets call it pagelayout), that wrap its t:body
in  etc.

Each product creates its own layout (called layout) component that provides
the specific menu, topbar etc. and then wraps itself in the layout from the
framework module.

Ordinary pages has t:type=layout in their root element to wrap themselves
in the product layout component, which in turn has t:type=pagelayout on its
root element to wrap itself in the framework layout providing the
surrounding html tag.

According to the documentation (
https://tapestry.apache.org/layout-component.html#LayoutComponent-NestedLayouts)
this should not be an issue.

However when I try to render one of these pages tapestry complains with:

Caused by: java.lang.RuntimeException: The root element of the rendered
document was , not . A root element of  is needed when
linking JavaScript and stylesheet resources.
at
org.apache.tapestry5.internal.services.DocumentLinkerImpl.addScriptElements(DocumentLinkerImpl.java:179)
at
org.apache.tapestry5.internal.services.DocumentLinkerImpl.updateDocument(DocumentLinkerImpl.java:140)
at
org.apache.tapestry5.modules.TapestryModule$25.renderMarkup(TapestryModule.java:1752)
at $MarkupRenderer_1760ef286199e.renderMarkup(Unknown Source)
at
com.dezide.author.tapestry.DeferredDialogFilter.renderMarkup(DeferredDialogFilter.java:21)
at $MarkupRendererFilter_1760ef286199c.renderMarkup(Unknown Source)
at $MarkupRenderer_1760ef286199e.renderMarkup(Unknown Source)
at $MarkupRenderer_1760ef2861999.renderMarkup(Unknown Source)
at
org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:47)
at $PageMarkupRenderer_1760ef2861997.renderPageMarkup(Unknown
Source)
at
org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:64)
at $PageResponseRenderer_1760ef28618e2.renderPageResponse(Unknown
Source)
at
org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:72)
at
org.apache.tapestry5.modules.TapestryModule$34.handle(TapestryModule.java:1974)
at $PageRenderRequestHandler_1760ef28618e4.handle(Unknown Source)
at $PageRenderRequestHandler_1760ef28618d3.handle(Unknown Source)
at
org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handlePageRender(ComponentRequestHandlerTerminator.java:48)
at
org.apache.tapestry5.internal.services.DeferredResponseRenderer.handlePageRender(DeferredResponseRenderer.java:52)
at $ComponentRequestHandler_1760ef28618d4.handlePageRender(Unknown
Source)
at
org.apache.tapestry5.services.InitializeActivePageName.handlePageRender(InitializeActivePageName.java:47)
at $ComponentRequestHandler_1760ef28618d4.handlePageRender(Unknown
Source)
at
org.apache.tapestry5.internal.services.RequestOperationTracker$2.run(RequestOperationTracker.java:73)
at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:56)
... 151 more

The document linker root is the output of rendering the specific page (it
may have wrapped the Layout around it, but it is hard to tell as that one
only provides shared configuration of the pagelayout.

Has anyone successfully used nested layouts like this? The documentation
seems to suggest it should work, but I've tried a lot of different
constructs without success.

-- 
Best regards
Chris


Re: eventlink with multiple context parameters

2018-10-03 Thread Chris Poulsen
I think that you may be hit by some type erasure on the map. That said
Tapestry also has some correctness issues with some generic constructs
where it detects a too generic type in some complex cases.

We are overriding the GenericsUtils class with an implementation that uses
Guava's TypeToken for most of its generics work - That improves the
situation a lot, but if your example code is what you actually use, then
that is probably not the issue here.

In this case I think that you would be best off setting up the eventlink
context in java code. IMO it is better style to have all but the most
simple expressions in the Java class and if you build the Object[]  (the
entire parameter value, not its "parts") in Java, this is not an issue to
begin with.

-- 
Chris

On Tue, Oct 2, 2018 at 4:48 PM D. R.  wrote:

> Hi @all,
>
> I am confused about calling a java method with an eventlink and multiple
> context parameters:
> t:context="[account.get('test').userUuid, friend]" does not work, see
> below please.
>
> Following stuff is in my Java class:
>
> @Property(write = false)
> private final String friend = "friend";
> public AbstractMap getAccount() {
>  UserAccount userAcc = userAccounts.get(loopContactIndex);
>  AbstractMap test = new HashMap UserAccount>();
>  test.put("test", userAcc);
>  return test;
> }
>
> void onChangeRelation(final String uuid, final String relation) {
>  // no chance to come inside here...
> }
>
>
> void onForget(final String uuid) {
> // everything ok here...
> }
>
> It is no problem to call "onForget" with this eventlink:
>   t:context="account.get('test').userUuid"> Forget 
>
> But if I try to call an eventlink like:
>   t:context="[account.get('test').userUuid, friend]"> Change Relation
> 
>
> then I get following exception:
>
> Exception assembling root component of page profile/User: Exception
> assembling embedded component 'usercontactlist' (of type
> com.myapp.t5.components.profile.UserContactList, within profile/User):
> Could not convert '[account.get('test').userUuid, friend]' into a
> component parameter binding: Exception generating conduit for expression
> '[account.get('test').userUuid, friend]': Class java.lang.Object does
> not contain a property (or public field) named 'userUuid'.
>
> Now I tried this eventlink:
>   t:context="[${account.get('test').userUuid}, friend]"> Change Relation
> 
> And the page loads successful.
>
> But a click on this eventlink, calls the wrong method with only one
> parameter which is converted to java.lang.String:
>
> void onChangeRelation(final Object param) {
>  System.out.println(param.getClass().getName() + ": " + param);
> }
>
> Console --> java.lang.String: [018260e7-844c-44a5-aefc-12faa80de42c,
> friend]
>
> means t:context="[${account.get('test').userUuid}, friend]" is
> interpreted as a String.
>
> if I remove the Map and return UserAccount directly in "getAccount()"
> the code works great:
>   t:context="[account.userUuid, friend]"> Change Relation 
>
> Furthermore I tried to replace the AbstractMap with Optional class:
>   t:context="[account.get().userUuid, friend]"> Change Relation
> 
>
> With this I get the same exception:
>
> Exception assembling root component of page profile/User: Exception
> assembling embedded component 'usercontactlist' (of type
> com.myapp.t5.components.profile.UserContactList, within profile/User):
> Could not convert '[account.get().userUuid, friend]' into a component
> parameter binding: Exception generating conduit for expression
> '[account.get().userUuid, friend]': Class java.lang.Object does not
> contain a property (or public field) named 'userUuid'.
>
> Why the second level is treated as Object, if i want to get a value in
> the third level?
> (i know, we could solve that by providing another getter in the java
> class, but this violates "code less, deliver more" :-)
> Why does this occur only in case of an eventlink with multiple parameters?
> What i am doing wrong?
>
> Thanks for help!
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Using JavaScript during Ajax request

2018-09-28 Thread Chris Poulsen
Hi

I'd say that you were off track. Tapestry already provides you with the
means to do what you need (the mentioned ajaxResponseRenderer callback for
ajax requests), so attempting to manipulate the environment to achieve what
is already supported, sounds like the recipe for creating something that
may break on a tapestry upgrade etc.

I can't say what the "intended" purpose of the t:trigger is, but as far as
I can tell from our codebase we mostly use it to plug in behavior
(essentially manipulating the markup writer) at specific points during
template rendering (and we have almost no usages). Almost all the usages we
have seems to be related to making sure that informal parameters end up on
the correct html element.

HTH.

-- 
Chris


On Thu, Sep 27, 2018 at 3:47 PM Davide Vecchi  wrote:

> Thanks guys, that was it. Worked right away.
>
> Now my problem is solved, but I'm wondering how off-track I was when I
> thought that the Trigger component was the way to go about this. Is Trigger
> intended for different situations, or is it just another possible
> appropriate way of solving this problem, or would it have been possible to
> solve this using Trigger but it wouldn't have been the right way ?
>
> In any case, as usual I solved my problem by asking here, thanks again.
>
>
> -Original Message-
> From: JumpStart 
> Sent: Thursday, September 27, 2018 14:21
> To: Tapestry users 
> Subject: Re: Using JavaScript during Ajax request
>
> An example:
>
>
> http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/modal/1
> <
> http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/modal/1
> >
>
>
> > On 27 Sep 2018, at 7:06 pm, Nathan Quirynen 
> wrote:
> >
> > When your request is an ajax call, you can use the following construct
> to use the JavaScriptSupport service:
> >
> > ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
> > @Override
> > public void run(JavaScriptSupport javascriptSupport) {
> >
> > // Your code here
> >
> > }
> > }
> >
> >
> > Op 27/09/2018 om 10:59 schreef Davide Vecchi:
> >> Hello everybody,
> >>
> >> I am having exactly the same problem described in the thread linked
> >> below, that is the exception
> >>
> >> "No object of type
> org.apache.tapestry5.services.javascript.JavaScriptSupport is available
> from the Environment"
> >>
> >> that occurs only if the event handler is handling an Ajax request:
> >>
> >> http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/No
> >> -object-of-type-org-apache-tapestry5-services-javascript-JavaScriptSu
> >> pport-is-available-from-the-E-tp5551633p5551729.html
> >>
> >> My stacktrace is at the bottom of this email.
> >>
> >> The event being handled in my case is the click on an EventLink that
> has its t:zone attribute set to the name of a zone.
> >>
> >> In that thread jochenfrey explains that he solved the problem using the
> Trigger component to "get Tapestry Initializer Calls into the Response",
> which I think is what I need as well.
> >>
> >> However, I don't know where in the template the  tag must be
> placed. I'm also not sure what the event handler of the trigger should do
> in order to provide JavaScript to the EventLink handler. So those are my
> two questions.
> >>
> >> My understanding is that the Trigger event handler should push the
> JavaScriptSupport instance on the stack, so I do:
> >>
> >> environment.push(JavaScriptSupport.class, javaScriptSupport);
> >>
> >> but I'm not sure that's what is needed, and anyway it doesn't work for
> me, it get that exception.
> >>
> >> I have put the  tag immediately after the opening tag of the
> zone the EventLink is bound to:
> >>
> >>
> >> =
> >> ===
> >>
> >> 
> >>
> >> 
> >>
> >> ..
> >> 
> >>
> >> 
> >>
> >> 
> >>
> >>   ..
> >>
> >>   
> >>
> >> ..
> >>  >
> >>   Click me.
> >> 
> >>
> >> 
> >>
> >> 
> >>
> >>   
> >>
> >>
> >> -
> >> -
> >>
> >>@Environmental
> >>private JavaScriptSupport javaScriptSupport;
> >>
> >>@Inject
> >>private Environment environment;
> >>
> >>void onJavaScriptNeeded()
> >>{
> >>   this.environment.push(JavaScriptSupport.class,
> this.javaScriptSupport);
> >>}
> >>
> >>
> >> =
> >> ===
> >>
> >> I don't know if the following matters, however:
> >>
> >>
> >>   *   The zone the EventLink is bound to is defined only in the
> template (in the Java code I never need to return that zone from any method
> or do anything with it so I did not create any Zone field for that zone).
> >>
> >>
>

Re: JavaScript not invoked on zone refresh

2018-09-26 Thread Chris Poulsen
Reacting to the zone events sounds like the best option IMO. Controlling
this from the server side seems needlessly complex and fragile in this case.

Not really related to your issue, but you can call exported module methods
in 5.4 like this:

JSONObject specification = new JSONObject( "diagramClientId",
diagram.getClientId(), "modelJson", modelJson );

jsSupport.require( "pages/contentspace/content-space-index" ).invoke(
"init" ).with( specification );

HTH.

-- 
Chris

On Wed, Sep 26, 2018 at 1:10 AM Christopher Dodunski <
chrisfromtapes...@christopher.net.nz> wrote:

> After exploring a little further, I discovered the below thread on
> invoking javascript from within Tapestry.
>
>
> https://stackoverflow.com/questions/27988473/pass-parameter-from-java-to-js-in-tapestry
>
> Joost writes:
>
> You will need to use the JavaScriptSupport service.
>
> Your java file:
>
> @Import(library = "RoomManagement.js")
> public final class RoomManagement{
>
>   @Inject
>   private JavaScriptSupport javascriptSupport;
>
>   @Property
>   private long contactId;
>
>   @AfterRender
>   private void setup() {
> JSONObject jsonObject = new JSONObject();
> jsonObject.put("contactId", contactId);
> javascriptSupport.addInitializerCall("RoomManagement",jsonObject);
>   }
> }
>
> Your RoomManagement.js
>
> Tapestry.Initializer.RoomManagement = function (parameters) {
> //do whatever you need here
> alert('Your contactId: ' + parameters.contactId);
> };
>
> This looks promising, but I later read that Tapestry's handling of
> javascript has been completely rewritten in Tapestry 5.4, with the above
> being deprecated.  And I've not found any example code of doing tnings the
> new way.  Any pointers would be much appreciated.
>
> My page contains 10 expand/collapse buttons, and I only wish to animate
> the one connected to the zone being updated.  So am thinking of giving
> each button a unique ID, and passing that ID to the javascript so just the
> one button animates.
>
> My needs are pretty straight forward, and reportedly Tapestry's javascript
> handling was completely rewritten in 5.4 to simplify things.  Look forward
> to seeing how things now get done.  :-)
>
> Appreciate any help.
>
> Regards,
>
> Chris.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: JavaScript not invoked on zone refresh

2018-09-24 Thread Chris Poulsen
Hi

Zone updates are updates of parts of the page, so the ready function is not
triggered for those. Consider also performing your initialization on zone
updates. See:
http://tapestry.apache.org/current/coffeescript/events.html#section-20 for
the zone related events.

-- 
Chris

On Tue, Sep 25, 2018 at 7:22 AM Christopher Dodunski <
chrisfromtapes...@christopher.net.nz> wrote:

> Hi all,
>
> I suspect there's a simple solution to this small, but annoying problem.
>
> My Tapestry page uses a simple javascript to rotate an image 90 degrees
> the moment the image is rendered on screen.  It does this by adding a CSS
> class to the button element that contains the image.
>
>
> **The JavaScript**
>
> $(document).ready(function(){
> $('.accordion').addClass('active');
> });
>
>
> **The CSS Classes**
>
> .open-section{
> transform: rotate(0deg);
> transition:1s;
> }
> .close-section{
> transform: rotate(0deg);
> transition:1s;
> }
> .accordion.active .open-section {
> transform: rotate(-90deg);
> transition:1s;
> }
> .accordion.active .close-section {
> transform: rotate(90deg);
> transition:1s;
> }
>
>
> The above works perfectly well when the page first loads, and if I
> manually refresh the page.  But when the button/image appears within a
> zone that is refreshed, the javascript evidently doesn't get invoked, as
> the button image doesn't rotate.
>
> How would one normally resolve this little problem?
>
> Regards,
>
> Chris.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Grid custom no field

2018-04-18 Thread Chris Poulsen
Create a component?

-- 
Chris

On Thu, Apr 19, 2018 at 5:53 AM, abangkis  wrote:

> Hi, when adding a custom no field to my grid, to show the no of the actual
> row, i declared an int on the page and calculate the value by multiplying
> the variables in the grid like the code bellow.
>
> Is there a way to do this automatically, since for now i'm doing it
> manually by copy and pasting the code to every page that uses grid.
>
> Thank you verymuch
>
>  rowIndex="idx" t:inPlace="true"
>t:add="no">
> 
> ${idx}
> 
> 
>
> @InjectComponent
> private Grid grid;
>
> private int idx;
>
>
> public void setIdx(int idx) {
> this.idx = idx;
> }
>
> public int getIdx() {
> return grid.getRowsPerPage() * (grid.getCurrentPage() - 1) + idx + 1;
> }
>
>
> --
> http://www.mreunionlabs.net/ 
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>


Re: Grid component customization

2018-02-06 Thread Chris Poulsen
There is already a decent amount of RenderNotification mixins present on
the various grid components allowing you to manipulate the MarkupWriter per
row, column and header column.

-- 
Chris

On Tue, Feb 6, 2018 at 12:51 PM, Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> Another possibility for doing that is to use Tapestry DOM rewriting. You'd
> create a mixin, apply it to your grids, and the mixin would have an
> afterRender(MarkupWriter writer) method. writer.getDocument() gives you the
> Tapestry DOM element tree. From it, you can find the grids, its tags and
> change them to your pleasure. tapestry-xpath allows you to find DOM
> elements using XPath and may help you in this task.
>
> Have you tried what I suggested (component overriding?)?
>
> On Mon, Feb 5, 2018 at 4:39 PM, Erich Gormann 
> wrote:
>
> > Hi Thiago,
> >
> > Our HTML designer wants to create a fully responsive  website based on
> > Tapestry 5.3.8.
> > So she asked me, if it would be possible, to render some data attributes
> > inside the td tags of the grid.
> >
> > Regards, Erich
> >
> >
> >
> > Am 05.02.2018 18:49, schrieb Thiago H. de Paula Figueiredo:
> >
> >> Hello!
> >>
> >> Well, you can override a component, you can decorate or advise the
> >> ComponentClassResolver service. Specifically, when
> >> the resolveComponentTypeToClassName(String componentType) method is
> >> called,
> >> if componentType.equalsIgnoreCase("GridColumns"), then return the fully
> >> qualified class name of your GridColumns replacement component.
> Otherwise,
> >> let it return normally. That's basically how ComponentSubstitutor is
> >> implemented inside Tapestry itself.
> >>
> >> Just curious: what customizations do you want to do?
> >>
> >> On Sat, Feb 3, 2018 at 9:01 AM, Erich Gormann
> >> wrote:
> >>
> >> Dear Thiago,
> >>>
> >>> first thanks for this solution, but can you please propose a solution
> >>> which works under Tapestry 5.3.8? This would be great.
> >>>
> >>> Anyway, I tried to migrate our applications to 5.4.3 yesterday and
> nearly
> >>> succeeded, but only nearly, due to problems with the removed javassist
> >>> lib.
> >>> ut this would be another topic in this support list.
> >>>
> >>> Thanks and Best Regards
> >>> Erich
> >>>
> >>>
> >>> Am 28.11.2017 16:32, schrieb Thiago H. de Paula Figueiredo:
> >>>
> >>> On Tue, Nov 28, 2017 at 6:33 AM, Erich Gormann
>  wrote:
> 
>  Dear all,
> 
> > Hi!
> >
> 
>  I wanted to customize the GridColumns component, which is embedded
>  inside
> 
> > the Grid component, by trying different approaches.
> >
> > Finally I failed, because it was neither possible by a request filter
> > replacing the GridColumns component at runtime with my customized
> one,
> >
> > This wasn't expected to work, but I'm curious in how you tried to do
>  it.
>  :)
> 
> 
>  nor did it work to use an own template for the Grid component pointing
>  to
> 
> > my customized version of GridColumns.
> >
> > What is the best way to do this? The GridColumns component is a
> private
> > component inside the Grid and I wonder how to replace it.
> >
> > Contribute to the ComponentOverride distributed configuration, which
> > is a
> >
>  Map, the key being the component or page or mixin class
> to
>  be
>  replaced, the value being the replacement.
> 
>  Here's an example from Tapestry's test suite:
> 
>  @Contribute(ComponentReplacer.class)
>  public static void
>  overridePageAndComponentAndMixin(MappedConfiguration
>  configuration) {
>    configuration.add(OverridenPage.class, OverridePage.class);
>    configuration.add(OverridenComponent.class,
>  OverrideComponent.class);
>    configuration.add(OverridenMixin.class, OverrideMixin.class);
>  }
> 
> 
>  -
> >>> 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
>


Re: BeanEditForm onValidate()

2018-01-16 Thread Chris Poulsen
You could try setting a break point in the database update code and some in
the event handlers and the examine the call stack to see where the call
originates from and in which order things happen

-- 
Chris

On Tue, Jan 16, 2018 at 10:51 AM, JumpStart <
geoff.callender.jumpst...@gmail.com> wrote:

> If Hibernate is creating/updating the database definition then you could
> be right. I’m not sure because I use this kind of thing for alternate key:
>
> @Entity
> @Table(name = "Users", uniqueConstraints = { @UniqueConstraint(columnNames
> = { “username" }) })
> public class User ...
>
>
> > On 16 Jan 2018, at 5:42 pm, Christopher Dodunski  christopher.net.nz> wrote:
> >
> > Hi Geoff,
> >
> > Sorry, I'll try that when back at my PC tomorrow.
> >
> > I could be mistaken, but does the 'column' annotation below not set the
> > USER_NAME column in the database as unique?  I assumed this is the reason
> > for the ConstraintViolationException, i.e. the unique field.
> >
> > Irrespective, I'll do as you suggested in onActivate() and see what
> > results.  :-)
> >
> >//@NaturalId
> >@Column(name="USER_NAME", nullable=false, unique=true, length=50)
> >@Validate("required")
> >@NotNull
> >@Size(min = 4, max = 50)
> >@Alphanumeric
> >private String userName;
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
>
>


Re: How to use CSS buttons outside of forms

2017-12-25 Thread Chris Poulsen
I mostly use  elements styled as buttons for this - A standard bootstrap
thing.

It sounds like your CSS is off if your elements disappear when rendering
them with tapestry, take a look at the generated HTML to see what is going
on. Maybe your  is rendered as  (It is "link" components so it
could be plausible, but I do not have the sources handy on this machine to
check).

I guess you could make a plain HTML button that delegates its clicks to a
hidden link using Javascript, if you cannot fix your CSS, but it feels like
a hack compared to just styling the links.

-- 
Chris

On Mon, Dec 25, 2017 at 3:48 AM, Christopher Dodunski <
chrisfromtapes...@christopher.net.nz> wrote:

> This problem has proved trickier to solve than expected.
>
> The below tag produces a displayed button, but obviously without any
> functionality, as the tag contains no Tapestry-specific elements.
>
> 
>
> The problem comes on adding Tapestry markup, with the intention of
> invoking a deleteUser() method in the page class.  Neither of the below
> produce a displayed button.  In other words, as soon as I attempt to
> 'Tapestry-ise' the button, it vanishes.
>
>  class="opto-button delete-user-btn" value="Delete User"/>
>
>  value="Delete User"/>
>
> Chris.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: How to use CSS buttons outside of forms

2017-12-23 Thread Chris Poulsen
Hi,

All the link types extends AbstractLink which supports informal
parameters... So basically just add a  class=""
parameter and it will pass through to the html.

-- 
Chris


On Sat, Dec 23, 2017 at 8:31 AM, Christopher Dodunski <
chrisfromtapes...@christopher.net.nz> wrote:

> Hi all,
>
> The Tapestry 'submit' component allows use of buttons defined in CSS by
> way of the 'class' parameter.  This is perfect for form buttons.  But now
> I want to use these same CSS buttons outside of forms.  The natural choice
> is Tapestry's ActionLink or EventLink component.  But these components
> don't appear to offer class parameter for passing CSS class names.
>
> What do you recommend for wiring CSS buttons in the Tapestry template back
> to Tapestry page class methods?
>
> Thanks & regards,
>
> Chris.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Contribute requirejs.config.paths to ModuleManager

2017-11-27 Thread Chris Poulsen
Hi,

It has been a while since I last fought the module system, but in some
cases I've used a request filter to map between module and asset paths
(triggering on known module paths and then returning permanent redirects to
the actual asset urls in the filter) - This was necessary in order to get
stuff like CK editor to load properly as a module and still allowing it to
dynamically require its plugins IIRC.

-- 
Chris


On Mon, Nov 27, 2017 at 2:14 PM, Svein-Erik Løken  wrote:

> Got this error message (very informative):
>
> org.apache.tapestry5.ioc.util.UnknownValueException
> Unable to create a client URL for classpath resource
> META-INF/modules/react/react.min.js: The resource path was not within an
> aliased path.
> availableValues
> Aliased paths:
> • META-INF/assets
> • META-INF/assets/core
> • META-INF/assets/democore
> • com/demo/core
> • com/demo/module1
> • com/demo/module1
> • org/apache/tapestry5
> • org/apache/tapestry5
>
>
>
> Tried other locations:
>
> public class ReactStack implements JavaScriptStack {
> private final AssetSource assetSource;
>
> public ReactStack(final AssetSource assetSource) {
> this.assetSource = assetSource;
> }
>
> public List getJavaScriptLibraries() {
> List ret = new ArrayList<>();
> //ret.add(assetSource.getClasspathAsset("/META-INF/
> modules/react/react.min.js"));
> //ret.add(assetSource.getClasspathAsset("/META-INF/
> assets/react/react.min.js"));
> //ret.add(assetSource.getClasspathAsset("/META-INF/
> assets/react/react.js"));
> //ret.add(assetSource.getClasspathAsset("/META-INF/
> assets/react.min.js"));
> ret.add(assetSource.getClasspathAsset("/META-INF/
> assets/react.js"));
> return ret;
> }
>
>
> Still getting:
> Loading 1 libraries
> Loading library /assets/meta/z94ea83c9/react.js
> Executing 3 inits
> Loaded module bootstrap/collapse
> GET http://localhost:9876/modules.gz/react.js 404 (No module for path
> 'react.js'.)
>
> Very strange that the virtual link does not work!
>
> S-E
>
>
> From: Thiago H de Paula Figueiredo [via Apache Tapestry Mailing List
> Archives] [mailto:ml+s1045711n5733729...@n5.nabble.com]
> Sent: mandag 27. november 2017 13:32
> To: Svein-Erik Løken 
> Subject: Re: Contribute requirejs.config.paths to ModuleManager
>
> On Sun, Nov 26, 2017 at 10:40 AM, Svein-Erik Løken
>  wrote:
>
> > Source code:
> >
>
> > @Contribute(JavaScriptStackSource.class)
> > public static void addMyStack(MappedConfiguration > JavaScriptStack> configuration) {
> > configuration.addInstance("react", ReactStack.class);
> > }
> >
> > @Contribute(JavaScriptStack.class)
> > @Core
> > public static void addAppModules(OrderedConfiguration
> > configuration) {
> > configuration.add("react", StackExtension.module("react"));
> > }
> >
>
> These look correct. ^^^
>
> > public class ReactStack implements JavaScriptStack {
> > private final AssetSource assetSource;
> >
> > public ReactStack(final AssetSource assetSource) {
> > this.assetSource = assetSource;
> > }
> >
> > public List getJavaScriptLibraries() {
> > List ret = new ArrayList<>();
> > ret.add(assetSource.getClasspathAsset("/META-INF/
> > assets/react.min.js"));
> > return ret;
> > }
> >
> > @Override
> > public List getModules() {
> > List ret = new ArrayList<>();
> > ret.add("react");
> > return ret;
> > }
> >
>
> I believe your error was having the getModules() method above return a list
> with 'react'. According to its JavaDoc, getModules() must return the
> modules on which this stack depends. It doesn't actually depend on the
> 'react' module. Please try having that method return an empty List and tell
> us what happens.
>
> You may also need to move react.min.js to
> /META-INF/modules/react/react.min.js.
>
> 
> If you reply to this email, your message will be added to the discussion
> below:
> http://apache-tapestry-mailing-list-archives.1045711.
> n5.nabble.com/Contribute-requirejs-config-paths-to-ModuleManager-
> tp5733721p5733729.html
> To unsubscribe from mailto:users@tapestry.apache.org Mailing List
> Archives, http://apache-tapestry-mailing-list-archives.1045711.
> n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=
> 2375125&code=c3ZlaW5AamFjaWxsYS5ub3wyMzc1MTI1fC0xNTM4NzY2ODg4.
> http://apache-tapestry-mailing-list-archives.1045711.
> n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%
> 21nabble%3Aemail.naml&base=nabble.naml.namespaces.
> BasicNamespace-nabble.view.web.template.NabbleNamespace-
> nabble.view.web.template.NodeNamespace&breadcrumbs=
> notify_subscribers%21nabble%3Aemail.naml-instant_emails%
> 21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>


Re: Change bootstrap css load order

2017-08-28 Thread Chris Poulsen
Try using a JavaScriptStack instead of adding them directly with link tags.

-- 
Chris

On Tue, Aug 29, 2017 at 6:23 AM, Rural Hunter  wrote:

> Hi,
>
> I have some web pages which have bootstrap and some other css extentions
> depending on bootstrap. We use  tag in TML for other css and reply on
> the bootstrap included in tapestry. The problem is I noticed Tapestry loads
> the internal bootstrap later than those css in  tags which makes the
> page messy. Is there any way to make tapestry load bootstrap before other
> css links?
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Tapestry Ajax Security

2017-04-30 Thread Chris Poulsen
Your means to securing a "traditional tapestry page" (filter based
approach) should be sufficient.

On Mon, May 1, 2017 at 6:39 AM, abangkis  wrote:

> Hi, with the client-side API release in Tapestry 5.4.2 probably there will
> be more people that will depend on the tapestry ajax component.  So I was
> wondering what about the security. Since it will be easily manipulated in
> the client side.
>
> In the traditional tapestry page we can rely on Something like page
> protection filter or apache shiro. In the case of ajax request, from the
> top of my mind, i would probably need to pass a security-token for each of
> my tapestry ajax post and then validate it in the onEvent method. Is this
> something that I would have to implement my self, or already provided by
> the framework?
>
> Thanks in advance
>
> --
> http://www.mreunionlabs.net/ 
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>


Re: RadioGroup Validate Bug

2017-01-04 Thread Chris Poulsen
Hi,

All the info needed seems to be in the issue you link to / in the message
thread the issue link to.

If you insist on relying on the default validation binding and do not want
to wait for someone to pick up the issue, then roll your own radiogroup and
override the default one - if not, just specify the validate parameter on
the component.

-- 
Chris


On Wed, Jan 4, 2017 at 4:07 PM,  wrote:

> Hi all,
>
> This bug seems not be corrected on 5.4.1
> https://issues.apache.org/jira/browse/TAP5-1513
>
> Could you tell me how correct this bug ?
>
> Thanks
>
> Avant d'imprimer, pensez à l'environnement.
>


Re: Data export

2016-12-23 Thread Chris Poulsen
Hi,

One solution is to return a StreamResponse from an event handler.

-- 
Chris

On Fri, Dec 23, 2016 at 9:16 AM,  wrote:

> Hi All,
>
> I'm a newbee on Tapestry which is a powerful and simply Framework !
>
> I'm looking for a tutorial on tapestry5 which explains how to :
> export data from a datagrid in a CSV or XLS file (with Apache POI ?)
> There is an example on https://wiki.apache.org/tapestry/ExportingCSVFiles
> for tapestry4 but not on tapestry5
>
> Another one on integration with Jasper Report to create reports
>
> Thanks in advance
>
> Ch. Foiret
>
> Avant d'imprimer, pensez à l'environnement.
>


Re: Preventing context from passivate

2016-12-01 Thread Chris Poulsen
I would expect action/event links to have page context as they are a part
of the page where they live (for example a logout event link click, would
cause tapestry to activate the containing page and then trigger the logout
event handler on that page).

Things like logout I would handle using a plain html link (in case of a
filter-based system) or using a page link if it is an actual tapestry page
- in most cases it does not make sense to use links that activate their
containing page if you are just interested in leaving it.

-- 
Chris

On Thu, Dec 1, 2016 at 4:21 PM, Adam X  wrote:

> Hello!
>
> In my Layout I have action/event links (logout, etc). If a page inside
> a layout passivates context, layout links get that context. But I
> don't want them to. How do you prevent links from getting page
> passivated context?
>
> Cheers,
> Adam
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Recommended way to instantiate EventContext

2016-11-28 Thread Chris Poulsen
Normally you would return an Object[] from passivate and tapestry will
coerce it into the correct result.

-- 
Chris

On Mon, Nov 28, 2016 at 6:41 PM, Adam X  wrote:

> Okay, I tried @Persist(FLASH) EventContext ec storing it in activation
> and simply returning in passivation and it works.
>
> This came up as I was trying to solve a different problem which is
> still haunting me. Essentially, I did a modal feature just like in the
> jumpstart and it all works very nice:
>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/
> javascript/modal/1
>
> The problem is that my modal zone lives in the Layout component
> (imagine a switch login context feature or something similar, not
> important). Like I said, the modal form works okay, but the problem is
> (and I think it's because it's inside Layout) when zone is updated it
> reloads entire page anyway. That is actually a desired behavior for me
> except that it seems to forget whatever URL context was on the page
> and it reloads the faw url.
>
> So if I invoke my modal form on a transaction listing page:
>
> /transactionlist/fromdate/untildate
>
> where fromdate and untildate are url contexts, the zone reloads page with
> this:
>
> /transactionlist
>
> and I can't seem to figure out how to tell it to reload whatever URL was
> there.
>
> Adam
>
> On Mon, Nov 28, 2016 at 6:23 PM, Adam X  wrote:
> > I'm trying to passivate large number (and dynamic) contexts. The
> > signature of my activation looks like this:
> >
> > @OnEvent(value=EventConstants.ACTIVATE)
> > void parseContext(EventContext ec) {
> >
> > and there is a lot going on in there as far as parsing the context. So
> > I'm trying to do this to passivate:
> >
> > @OnEvent(value=EventConstants.PASSIVATE)
> > Object restoreContext() {
> >
> > trying to return an instance of EventContext but I see there are only
> > two implementations of this interface, both in the internal package
> > which Tapestry discourages from using.
> >
> > Adam
> >
> > On Mon, Nov 28, 2016 at 6:18 PM, Peter Hvass 
> wrote:
> >> Hey again!
> >>
> >> Are you trying to pass a value to the context parameter of an eventlink
> by
> >> any chance?
> >>
> >> You can just use any old properties in Java classes - either the
> Tapestry
> >> way with an @Property attached to a field or a public getter of any old
> >> type. If it's anything beyond standard Java types (i.e.: string, int,
> >> double etc.) then you'll need to provide a bit of extra code to pass it
> in
> >> as context. For multiple context items you would use square brackets.
> >>
> >> i.e.:
> >> @Property
> >> private String somevalue;
> >>
> >> Foo
> >>
> >> void onFoo(String someValue) {
> >>
> >> }
> >>
> >> or-
> >>
> >> @Property
> >> private String bar;
> >>
> >> @Property
> >> private Integer baz;
> >>
> >> Foo
> >>
> >> void onFoo(String bar, Integer baz) {
> >>
> >> }
> >>
> >> Is that sort of what you're looking for?
> >>
> >> Thanks,
> >> Peter
> >>
> >>
> >>
> >> On 28 November 2016 at 19:13, Adam X  wrote:
> >>
> >>> Howdy again!
> >>>
> >>> So what's the approved Tapestry way to create an instance of this
> >>> interface?
> >>>
> >>> Adam
> >>>
> >>> -
> >>> 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: running JS to attach client events to a zones content after it's rendered

2016-10-01 Thread Chris Poulsen
You can bind the button listener on an enclosing element ( document for
example ) or you can bind on one of the zone update events and wire up
things from there (I think i found some tapestry js components that uses a
function called "scan" or "scanner" to initialize dynamically loaded stuff
- there are helpers for the "scanner pattern" in t5/core/dom iirc.

I tend to prefer binding the handlers on the document whenever possible.

-- 
Chris

On Sat, Oct 1, 2016 at 7:58 PM, Qbyte Consulting 
wrote:

> Hi,
>
> I have a zone with some conditional content so it doesn't appear when the
> page is initially loaded but is added later when the zone is rerendered
> with a flag set true.
>
> There is a button in the zone that I need to attach jquery events handling
> functions too from a module. How do I fire the module function each after
> any time the zone is rendered?
>
> John
>


Re: Getting ID of an updated zone

2016-09-17 Thread Chris Poulsen
Check to see what "this" refers to in the handler? Isn't that often the
element that triggered the event?

On Sat, Sep 17, 2016 at 12:25 PM, Adam X  wrote:

> Thanks for the suggestion about t5atmosphere. I will definitely look into
> it.
>
> I do not want to send ids back to the server. I simply want my client
> side javascript get invoked after zone is updated (after zone
> javascript update executed) and I would like to receive an id of the
> zone that was just updated as a function parameter in my javascript.
>
> Adam
>
> On Sat, Sep 17, 2016 at 11:39 AM, Ido Dovrat  wrote:
> > Where do you want to pass this id? Back to the server? If so, maybe it
> > would be more efficient to log this info on the server while you are
> > rendering the new html for the updated zone, before the response is even
> > sent (instead of waiting for the zone to be updated, then sending a new
> > request to the server informing it of the update)?
> >
> > On Sat, Sep 17, 2016 at 11:17 AM, Adam X  wrote:
> >
> >> Hi,
> >>
> >> I'm trying to wrap my head around the new 5.4 JS support. I have the
> >> following module which gets invoked whenever a zone is updated,
> >> however, I have 12 zones on my page periodically updated. I don't know
> >> at runtime which zone is updated, but I need to be notified about it.
> >>
> >> So I have the following module:
> >>
> >> define(["t5/core/dom", "t5/core/events"], function(dom, events) {
> >>
> >> return function() {
> >> dom.onDocument(events.zone.didUpdate, function() {
> >> alert('how can I get ID of a zone that was updated?');
> >> });
> >> }
> >> });
> >>
> >> I have a hard time figuring out how to pass the ID of a zone that was
> >> updated.
> >>
> >> Adam
> >>
> >> -
> >> 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: JS call on AJAX zone update

2016-09-15 Thread Chris Poulsen
You did not specify whether it was a specific zone / zoneupdate you wanted
to react on as opposed to all on page. Hence binding a listener on the
document seemed like a good suggestion.

You should avoid using JS directly in the page (like in your example) - Use
modules instead.

For reference such a module could look like this:

(function()
{
define( [ "t5/core/dom", "t5/core/events" ], function( dom, events )
{
dom.onDocument(events.zone.didUpdate, function() {
alert( 'updated' );
});

return null;
} );

} ).call( this )

On Thu, Sep 15, 2016 at 10:38 AM, Adam X  wrote:

> I was able to do this with an ajax renderer callback. This example
> helped me: http://jumpstart.doublenegative.com.au/jumpstart7/examples/
> javascript/modal/1
>
> Thanks!
>
> On Thu, Sep 15, 2016 at 10:13 AM, Adam X  wrote:
> > Thanks for that pointer. But I'm no javascript expert. I tried the
> > following two attempts, neither worked:
> >
> > 
> > $('#myZone').on("t5:zone:update",function(){
> >   alert('changed');
> > });
> > 
> >
> > Is there something obvious that I'm doing wrong?
> >
> > 
> > $("#myZone").change(function() {
> >   alert('changed');
> > });
> > 
> >
> > Adam
> >
> > On Thu, Sep 15, 2016 at 10:01 AM, Chris Poulsen 
> wrote:
> >> Take a look at
> >> http://tapestry.apache.org/current/coffeescript/events.html#section-16
> to
> >> see which events to listen for
> >>
> >> On Thu, Sep 15, 2016 at 9:40 AM, Adam X  wrote:
> >>
> >>> Hi,
> >>>
> >>> I know I'm missing something, but what's the easiest, cleanest
> >>> Tapestry way to hook a JS function whenever zone is updated via AJAX?
> >>>
> >>> For example, something simple like: alert('zone updated');
> >>>
> >>> Adam
> >>>
> >>> -
> >>> 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: JS call on AJAX zone update

2016-09-15 Thread Chris Poulsen
Take a look at
http://tapestry.apache.org/current/coffeescript/events.html#section-16 to
see which events to listen for

On Thu, Sep 15, 2016 at 9:40 AM, Adam X  wrote:

> Hi,
>
> I know I'm missing something, but what's the easiest, cleanest
> Tapestry way to hook a JS function whenever zone is updated via AJAX?
>
> For example, something simple like: alert('zone updated');
>
> Adam
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Swipe and touch

2016-09-05 Thread Chris Poulsen
I think the way to go is not to expose them / use them directly in onClick.
Instead you bind them in a module (either using t5/core/dom or jquery).
That way you are also keeping your global (script) scope much cleaner.

Lots of the tapestry framework client side code use this pattern.

-- 
Chris


On Mon, Sep 5, 2016 at 11:52 AM, Qbyte Consulting  wrote:

> Okay, after splitting my JS up into logical pieces and deploying them using
> the module approach I can get jquery mobile to work. Perhaps the loading
> times or sequence of script run was breaking things before?
>
> Some trivial behaviours I added to a sidebar including a swipe out:
>
> (function () {
> define(["jquery"], function ($) {
>
> $("#go").click(function () {
> $("#sidebar").show("fast");
> });
> $("#stop").click(function () {
> $("#sidebar").hide("fast");
> });
> $("#sidebar").on("swipeleft", function () {
> $("#sidebar").hide("slow");
> });
> });
> }).call(this);
>
> My locate module, I couldn't get to drips with the utils url extender so
> have coded manually:
>
> (function () {
> define(["t5/core/ajax"], function (ajax) {
> geoLocate = function (eventLinkURI) {
> if (navigator.geolocation) {
> navigator.geolocation
> .getCurrentPosition(function (position)
> {
> var geolink = eventLinkURI
> + "?lat=" + position.coords.latitude
> + "&long=" + position.coords.longitude;
> ajax(geolink, null);
> }, geoError);
> }
> };
> function geoError() {
> alert('There was a problem determining your location. Some
> features may not be available.');
> }
> return {
> geoLocate: geoLocate
> };
> });
> }).call(this);
>
> I still can't figure out how to access functions defined in modules
> directly using onclick= though, any ideas how to export them for direct
> client side access?
>
> On Fri, Sep 2, 2016 at 9:49 PM, Qbyte Consulting <
> qbyteconsult...@gmail.com>
> wrote:
>
> > I tried to add jquery mobile to my T5.4 project for swipe but it cracks
> > up. Same for angularjs.
> >
> > Is there additional config required to add js libraries? Since I have
> > jquery set up already I figured I could just add the mobile.
> >
> > Sent from my iPhone
> >
> > > On 2 Sep 2016, at 19:40, Thiago H de Paula Figueiredo <
> > thiag...@gmail.com> wrote:
> > >
> > >> On Fri, 02 Sep 2016 15:18:24 -0300, Svein-Erik Løken <
> sv...@jacilla.no>
> > wrote:
> > >>
> > >> I cannot find any swipe and touch JavaScript library in Tapestry. Are
> > there any plans to include one in Tapestry in the future?
> > >
> > > No, as it's pretty easy to use almost any JS library or framework
> inside
> > Tapestry. ;) :)
> > >
> > >> If it is - I will use that library now. The Tapestry dev team use to
> > find the best library :) It seems that Hammer JS and Touch Swipe are
> > popular(?). Any recommendation?
> > >
> > > I'm sorry, but I haven't used any of them.
> > >
> > > --
> > > 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: file upload doesn't set file value

2016-09-01 Thread Chris Poulsen
Unfortunately I think Carlos is correct.

-- 
Chris

On Wed, Aug 31, 2016 at 11:18 PM, Pavel Chernyak 
wrote:

> Hi there.
>
> Maybe you shall anotate field file @Persist?
>
>
> On 31 August 2016 at 23:03, Qbyte Consulting 
> wrote:
>
> >
> > I'm always finding that file is null for file upload? If I submit the
> form
> > without async=true then file value is set and it works.
> >
>
>
> --
> With best regards.
> Pavel Chernyak
>


Re: how to pass geolocation coords as hidden values in login form

2016-08-31 Thread Chris Poulsen
javascriptSupport.require( "" ).with(  ) - if your
module returns a function
javascriptSupport.require( "" ).invoke( ""
).with( "" ) if your module export named functions

Take a look at the t5 sources to see how things are used.

-- 
Chris

On Wed, Aug 31, 2016 at 9:36 AM, Qbyte Consulting  wrote:

> How can I trigger the locate function from the component Java after login
> success, what replaces .addScript?
>
> Sent from my iPhone
>
> > On 31 Aug 2016, at 08:07, Chris Poulsen  wrote:
> >
> > The javaScriptSupport.addScript is deprectated in 5.4 iirc.
> >
> > Instead I would use a module for the locate function, the url can be
> passed
> > as an init parameter to require or stored somewhere in the DOM (the
> former
> > probably makes the most sense in this case.
> >
> > Also I would use the tapestry ajax module (
> > http://tapestry.apache.org/current/coffeescript/ajax.html) instead of
> > $.ajax as that will give you some code that understands the responses
> that
> > tapestry may generate in from an event handler (error screen, additional
> > stuff added using ajaxResponseRenderer etc.)
> >
> > There is also a helper for adding url parameters (
> > http://tapestry.apache.org/current/coffeescript/utils.html)
> >
> > --
> > Chris
> >
> >
> > On Wed, Aug 31, 2016 at 1:19 AM, Qbyte Consulting <
> qbyteconsult...@gmail.com
> >> wrote:
> >
> >> I could not get the form method to work, so ended up passing an
> eventlink
> >> url to my javascript and adding parameters to it. Works a treat and
> simple.
> >>
> >>Link link =
> >> componentResources.createEventLink("geolocation", null);
> >>final String eventLinkURI = link.toAbsoluteURI();
> >>ajaxResponseRenderer.addCallback(new
> JavaScriptCallback()
> >> {
> >>@Override
> >>public void run(JavaScriptSupport javascriptSupport)
> {
> >>javascriptSupport.addScript(
> >>"locate('" + eventLinkURI + "');");
> >>}
> >>});
> >>
> >>
> >> function locate(eventLinkURI) {
> >>if (navigator.geolocation) {
> >>navigator.geolocation
> >>.getCurrentPosition(function (position)
> >>{
> >>var geolink = eventLinkURI
> >>+ "?lat=" + position.coords.latitude
> >>+ "&long=" + position.coords.longitude;
> >>$.ajax({url: geolink});
> >>}, geoError);
> >>}
> >> }
> >>
> >>
> >> On Tue, Aug 30, 2016 at 12:11 PM, Chris Poulsen  >
> >> wrote:
> >>
> >>> Use a form, request parameters or url context - The usual way of
> sending
> >>> data to the server.
> >>>
> >>> --
> >>> Chris
> >>>
> >>> On Tue, Aug 30, 2016 at 11:56 AM, Qbyte Consulting <
> >>> qbyteconsult...@gmail.com> wrote:
> >>>
> >>>> I get JS to populate the hidden form fields, they are passed as
> >>> parameters
> >>>> to the page, but they are empty strings?
> >>>>
> >>>> function locate() {
> >>>>//Geolocation
> >>>>if (navigator.geolocation) {
> >>>>navigator.geolocation
> >>>>.getCurrentPosition(function (position)
> >>>>{
> >>>>$("#latitude").val(position.
> >>>> coords.latitude.toString());
> >>>>
> >>>> $("#longitude").val(position.coords.longitude.toString());
> >>>>}, geoError);
> >>>>$("#locateForm").submit();
> >>>>}
> >>>> }
> >>>>
> >>>> On Tue, Aug 30, 2016 at 8:24 AM, Nathan Quirynen <
> >>>> nat...@pensionarchitects.be> wrote:
> >>>>
> >>>>> Hi
> >>>>>
> >>>>> I guess you could do something like the following:
> >>>>>
> >>>>> Create a component just containing two hidden 

Re: how to pass geolocation coords as hidden values in login form

2016-08-31 Thread Chris Poulsen
The javaScriptSupport.addScript is deprectated in 5.4 iirc.

Instead I would use a module for the locate function, the url can be passed
as an init parameter to require or stored somewhere in the DOM (the former
probably makes the most sense in this case.

Also I would use the tapestry ajax module (
http://tapestry.apache.org/current/coffeescript/ajax.html) instead of
$.ajax as that will give you some code that understands the responses that
tapestry may generate in from an event handler (error screen, additional
stuff added using ajaxResponseRenderer etc.)

There is also a helper for adding url parameters (
http://tapestry.apache.org/current/coffeescript/utils.html)

-- 
Chris


On Wed, Aug 31, 2016 at 1:19 AM, Qbyte Consulting  wrote:

> I could not get the form method to work, so ended up passing an eventlink
> url to my javascript and adding parameters to it. Works a treat and simple.
>
> Link link =
> componentResources.createEventLink("geolocation", null);
> final String eventLinkURI = link.toAbsoluteURI();
> ajaxResponseRenderer.addCallback(new JavaScriptCallback()
> {
> @Override
> public void run(JavaScriptSupport javascriptSupport) {
> javascriptSupport.addScript(
> "locate('" + eventLinkURI + "');");
> }
> });
>
>
> function locate(eventLinkURI) {
> if (navigator.geolocation) {
> navigator.geolocation
> .getCurrentPosition(function (position)
> {
> var geolink = eventLinkURI
> + "?lat=" + position.coords.latitude
> + "&long=" + position.coords.longitude;
>     $.ajax({url: geolink});
> }, geoError);
> }
> }
>
>
> On Tue, Aug 30, 2016 at 12:11 PM, Chris Poulsen 
> wrote:
>
> > Use a form, request parameters or url context - The usual way of sending
> > data to the server.
> >
> > --
> > Chris
> >
> > On Tue, Aug 30, 2016 at 11:56 AM, Qbyte Consulting <
> > qbyteconsult...@gmail.com> wrote:
> >
> > > I get JS to populate the hidden form fields, they are passed as
> > parameters
> > > to the page, but they are empty strings?
> > >
> > > function locate() {
> > > //Geolocation
> > > if (navigator.geolocation) {
> > > navigator.geolocation
> > > .getCurrentPosition(function (position)
> > > {
> > > $("#latitude").val(position.
> > > coords.latitude.toString());
> > >
> > > $("#longitude").val(position.coords.longitude.toString());
> > > }, geoError);
> > > $("#locateForm").submit();
> > > }
> > > }
> > >
> > > On Tue, Aug 30, 2016 at 8:24 AM, Nathan Quirynen <
> > > nat...@pensionarchitects.be> wrote:
> > >
> > > > Hi
> > > >
> > > > I guess you could do something like the following:
> > > >
> > > > Create a component just containing two hidden fields and in the after
> > > > render event of this component run a javascript module where you get
> > the
> > > > longitude and latitude and set these values to your hidden fields.
> > > > Add two parameters (latitude and longitude) to the components java
> > class
> > > > to which you pass the latitude and longitude properties from your
> page
> > > that
> > > > have to be set when submitting the form. Use these parameters in your
> > > > component as the values for your hidden fields.
> > > > Then you can add this component inside any form where you need.
> > > >
> > > > Nathan
> > > >
> > > >
> > > >
> > > > On 30/08/16 01:10, Qbyte Consulting wrote:
> > > >
> > > >> Hi,
> > > >>
> > > >> Does anyone have an idea how to pass latitude and longitude as
> hidden
> > > >> values in a login for with T5.4, or any other tricks to get this
> data
> > > into
> > > >> a component?
> > > >>
> > > >> John
> > > >>
> > > >>
> > > >
> > > > 
> -
> > > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > > > For additional commands, e-mail: users-h...@tapestry.apache.org
> > > >
> > > >
> > >
> >
>


Re: how to pass geolocation coords as hidden values in login form

2016-08-30 Thread Chris Poulsen
Use a form, request parameters or url context - The usual way of sending
data to the server.

-- 
Chris

On Tue, Aug 30, 2016 at 11:56 AM, Qbyte Consulting <
qbyteconsult...@gmail.com> wrote:

> I get JS to populate the hidden form fields, they are passed as parameters
> to the page, but they are empty strings?
>
> function locate() {
> //Geolocation
> if (navigator.geolocation) {
> navigator.geolocation
> .getCurrentPosition(function (position)
> {
> $("#latitude").val(position.
> coords.latitude.toString());
>
> $("#longitude").val(position.coords.longitude.toString());
> }, geoError);
> $("#locateForm").submit();
> }
> }
>
> On Tue, Aug 30, 2016 at 8:24 AM, Nathan Quirynen <
> nat...@pensionarchitects.be> wrote:
>
> > Hi
> >
> > I guess you could do something like the following:
> >
> > Create a component just containing two hidden fields and in the after
> > render event of this component run a javascript module where you get the
> > longitude and latitude and set these values to your hidden fields.
> > Add two parameters (latitude and longitude) to the components java class
> > to which you pass the latitude and longitude properties from your page
> that
> > have to be set when submitting the form. Use these parameters in your
> > component as the values for your hidden fields.
> > Then you can add this component inside any form where you need.
> >
> > Nathan
> >
> >
> >
> > On 30/08/16 01:10, Qbyte Consulting wrote:
> >
> >> Hi,
> >>
> >> Does anyone have an idea how to pass latitude and longitude as hidden
> >> values in a login for with T5.4, or any other tricks to get this data
> into
> >> a component?
> >>
> >> John
> >>
> >>
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>


Re: hide special pages ...

2016-08-30 Thread Chris Poulsen
The code pasted is from one of our property block pages. The activate
ensures that the page cannot be accessed as a "normal page"

-- 
Chris

On Tue, Aug 30, 2016 at 10:56 AM, Juan M Garrido de Paz <
juanm.garrido@gmail.com> wrote:

> Hi, yes , I do return that in my activate already. It is for telling
> tapestry not to consider the text following the index page name as context
> param, and instead of that throw 404 error. It works ok.
>
> But what I am asking is about error page location. How to put it under
> web-inf folder? I think it is a best practice to hide it. I mean not just
> error pages... also propertyblocks pages should be hidden from users to
> type their url shouldnt they?
>
> But as my project is jar packaging with embedded tomcat, I dont have webapp
> source folder with web-inf .
>
> Thank you.
> El 30/8/2016 8:53, "Chris Poulsen"  escribió:
>
> > Just return something from you activate, e.g:
> >
> > Object onActivate()
> > {
> > return new HttpError( 404, "Resource not found");
> > }
> >
> >
> > On Tue, Aug 30, 2016 at 1:25 AM, Juan M Garrido de Paz <
> > juanm.garrido@gmail.com> wrote:
> >
> > > Hello, I'm using Tapestry with Spring Boot and embedded tomcat (jar
> > > packaging).
> > >
> > > Is it posible to hide certain pages like for example errors 403, 404,
> > 500;
> > > or the pages for propertyblocks... so that the user can't type their
> url
> > > and get them?
> > >
> > > Thank you.
> > >
> >
>


Re: hide special pages ...

2016-08-29 Thread Chris Poulsen
Just return something from you activate, e.g:

Object onActivate()
{
return new HttpError( 404, "Resource not found");
}


On Tue, Aug 30, 2016 at 1:25 AM, Juan M Garrido de Paz <
juanm.garrido@gmail.com> wrote:

> Hello, I'm using Tapestry with Spring Boot and embedded tomcat (jar
> packaging).
>
> Is it posible to hide certain pages like for example errors 403, 404, 500;
> or the pages for propertyblocks... so that the user can't type their url
> and get them?
>
> Thank you.
>


Re: exception on page render

2016-08-12 Thread Chris Poulsen
It is being referenced from somewhere or you would not get the error...

I would suggest starting from a working basis, like the t5 quickstart (
http://tapestry.apache.org/getting-started.html ) and add one thing at the
time ensuring that everything is working before moving on to next step.

-- 
Chris

On Fri, Aug 12, 2016 at 6:35 PM, Qbyte Consulting  wrote:

> I resolved dependency conflicts and get to rendering a page but this pops
> up, and it's not a resource I uses?
>
> *Render queue error in SetupRender[Index:layout]: Unable to locate asset
> 'context:layout/images/icons-png/action-white.png' (the file does not
> exist).*
>
> On Fri, Aug 12, 2016 at 3:16 PM, Qbyte Consulting <
> qbyteconsult...@gmail.com
> > wrote:
>
> > No I removed it. As I said, even after removing got5, I got a similar
> > stack dump but minus mention of got 5. Sorry to confuse.
> >
> > On Fri, Aug 12, 2016 at 1:19 PM, Chris Poulsen 
> > wrote:
> >
> >> org.got5is still in your stacktrace... So maybe you have a jar
> >> lingering somewhere.
> >>
> >> --
> >> Chris
> >>
> >> On Fri, Aug 12, 2016 at 2:02 PM, Qbyte Consulting <
> >> qbyteconsult...@gmail.com
> >> > wrote:
> >>
> >> > I've been copying code from here https://tapestry-app.apache.or
> >> g/hotels/
> >> > but with my own database and other project dependencies.
> >> >
> >> > On Fri, Aug 12, 2016 at 12:39 PM, Barry Books 
> wrote:
> >> >
> >> > > Which hotel booking app?
> >> > >
> >> > > On Thursday, August 11, 2016, Qbyte Consulting <
> >> > qbyteconsult...@gmail.com>
> >> > > wrote:
> >> > >
> >> > > > I'm writing a T5.4 app from scratch rather than a migration.
> >> > > >
> >> > > > I keep getting this stack dump, I've taken out the got5
> dependency,
> >> but
> >> > > > still get much the same error.
> >> > > >
> >> > > > Any pointers to what this could be? I'm basing my code off the
> hotel
> >> > > > booking example.
> >> > > >
> >> > > > John
> >> > > >
> >> > > > HTTP ERROR 500
> >> > > >
> >> > > > Problem accessing /Context/. Reason:
> >> > > >
> >> > > > INTERNAL_SERVER_ERROR
> >> > > >
> >> > > > Caused by:
> >> > > >
> >> > > > java.lang.AbstractMethodError
> >> > > > at org.apache.tapestry5.internal.services.ajax.
> >> > > > JavaScriptSupportImpl.getModuleNameToStackName(
> >> > > JavaScriptSupportImpl.java:
> >> > > > 340)
> >> > > > at org.apache.tapestry5.internal.services.ajax.
> >> > > > JavaScriptSupportImpl.findStackForModule(JavaScriptSupportIm
> >> pl.java:
> >> > 328)
> >> > > > at org.apache.tapestry5.internal.services.ajax.
> >> > > > JavaScriptSupportImpl.require(JavaScriptSupportImpl.java:451)
> >> > > > at $JavaScriptSupport_149ab64e3d59.require(Unknown
> Source)
> >> > > > at $JavaScriptSupport_149ab64e3cc1.require(Unknown
> Source)
> >> > > > at org.apache.tapestry5.internal.transform.ImportWorker$
> >> > > > ModuleImport.apply(ImportWorker.java:168)
> >> > > > at org.apache.tapestry5.internal.
> transform.ImportWorker$5.
> >> > > > advise(ImportWorker.java:197)
> >> > > > at org.apache.tapestry5.internal.plastic.
> >> > > AbstractMethodInvocation.
> >> > > > proceed(AbstractMethodInvocation.java:92)
> >> > > > at org.apache.tapestry5.internal.
> transform.ImportWorker$8.
> >> > > > advise(ImportWorker.java:271)
> >> > > > at org.apache.tapestry5.internal.plastic.
> >> > > AbstractMethodInvocation.
> >> > > > proceed(AbstractMethodInvocation.java:92)
> >> > > > at org.apache.tapestry5.corelib.c
> >> omponents.ExceptionDisplay.
> >> > > > setupRender(ExceptionDisplay.java)
> >> > > > at org.apache.tapestry5.internal.structure.
> >> > > > ComponentPageElementImpl$SetupRenderPhase.invokeComponent(
> >> > > > Compone

Re: exception on page render

2016-08-12 Thread Chris Poulsen
org.got5is still in your stacktrace... So maybe you have a jar
lingering somewhere.

-- 
Chris

On Fri, Aug 12, 2016 at 2:02 PM, Qbyte Consulting  wrote:

> I've been copying code from here https://tapestry-app.apache.org/hotels/
> but with my own database and other project dependencies.
>
> On Fri, Aug 12, 2016 at 12:39 PM, Barry Books  wrote:
>
> > Which hotel booking app?
> >
> > On Thursday, August 11, 2016, Qbyte Consulting <
> qbyteconsult...@gmail.com>
> > wrote:
> >
> > > I'm writing a T5.4 app from scratch rather than a migration.
> > >
> > > I keep getting this stack dump, I've taken out the got5 dependency, but
> > > still get much the same error.
> > >
> > > Any pointers to what this could be? I'm basing my code off the hotel
> > > booking example.
> > >
> > > John
> > >
> > > HTTP ERROR 500
> > >
> > > Problem accessing /Context/. Reason:
> > >
> > > INTERNAL_SERVER_ERROR
> > >
> > > Caused by:
> > >
> > > java.lang.AbstractMethodError
> > > at org.apache.tapestry5.internal.services.ajax.
> > > JavaScriptSupportImpl.getModuleNameToStackName(
> > JavaScriptSupportImpl.java:
> > > 340)
> > > at org.apache.tapestry5.internal.services.ajax.
> > > JavaScriptSupportImpl.findStackForModule(JavaScriptSupportImpl.java:
> 328)
> > > at org.apache.tapestry5.internal.services.ajax.
> > > JavaScriptSupportImpl.require(JavaScriptSupportImpl.java:451)
> > > at $JavaScriptSupport_149ab64e3d59.require(Unknown Source)
> > > at $JavaScriptSupport_149ab64e3cc1.require(Unknown Source)
> > > at org.apache.tapestry5.internal.transform.ImportWorker$
> > > ModuleImport.apply(ImportWorker.java:168)
> > > at org.apache.tapestry5.internal.transform.ImportWorker$5.
> > > advise(ImportWorker.java:197)
> > > at org.apache.tapestry5.internal.plastic.
> > AbstractMethodInvocation.
> > > proceed(AbstractMethodInvocation.java:92)
> > > at org.apache.tapestry5.internal.transform.ImportWorker$8.
> > > advise(ImportWorker.java:271)
> > > at org.apache.tapestry5.internal.plastic.
> > AbstractMethodInvocation.
> > > proceed(AbstractMethodInvocation.java:92)
> > > at org.apache.tapestry5.corelib.components.ExceptionDisplay.
> > > setupRender(ExceptionDisplay.java)
> > > at org.apache.tapestry5.internal.structure.
> > > ComponentPageElementImpl$SetupRenderPhase.invokeComponent(
> > > ComponentPageElementImpl.java:174)
> > > at org.apache.tapestry5.internal.structure.
> > > ComponentPageElementImpl$AbstractPhase.invoke(
> > > ComponentPageElementImpl.java:133)
> > > at org.apache.tapestry5.internal.structure.
> > > ComponentPageElementImpl$SetupRenderPhase.render(
> > > ComponentPageElementImpl.java:181)
> > > at org.apache.tapestry5.internal.services.RenderQueueImpl.run(
> > > RenderQueueImpl.java:79)
> > > at org.apache.tapestry5.internal.services.PageRenderQueueImpl.
> > > render(PageRenderQueueImpl.java:121)
> > > at $PageRenderQueue_149ab64e3d54.render(Unknown Source)
> > > at $PageRenderQueue_149ab64e3d53.render(Unknown Source)
> > > at org.apache.tapestry5.internal.services.
> > > MarkupRendererTerminator.renderMarkup(MarkupRendererTerminator.java:
> 37)
> > > at org.got5.tapestry5.jquery.services.js.JSModule$1.
> > > renderMarkup(JSModule.java:40)
> > > at $MarkupRenderer_149ab64e3d57.renderMarkup(Unknown Source)
> > > at org.apache.tapestry5.internal.
> services.PageNameMetaInjector.
> > > renderMarkup(PageNameMetaInjector.java:41)
> > > at $MarkupRenderer_149ab64e3d57.renderMarkup(Unknown Source)
> > > at org.apache.tapestry5.modules.TapestryModule$29.
> > > renderMarkup(TapestryModule.java:1807)
> > >
> >
>


Re: TLS termination proxy and Tapestry

2016-07-22 Thread Chris Poulsen
It has been a while since we looked into this, but as far as I can remember
we needed SECURE_ENABLED=false in order to have our apps supporting both
http and https at the same time. None of our app servers are configured to
use ssl that is always handled before the requests hit tapestry.

-- 
Chris

On Fri, Jul 22, 2016 at 1:23 PM, JumpStart <
geoff.callender.jumpst...@gmail.com> wrote:

> When you say you are avoiding absolute URLs, where have you noticed this?
> I can’t recall this being a problem.
>
> Now, I’m no expert on this kind of configuration, and its a while since I
> set this all up, so forgive me if I have my wires crossed. Also, our site’s
> load is small so far but growing so all of this will be up for review soon.
>
> In production we run pure HTTPS. We force all HTTP traffic to HTTPS by
> setting this in AppModule:
>
> public void contributeMetaDataLocator(MappedConfiguration String> configuration) {
> configuration.add(MetaDataConstants.SECURE_PAGE, "true");
> }
>
> We’re using mod_proxy and mod_ssl in Apache, no HAProxy. So Apache is
> terminating the SSL/TLS.
>
> We use:
>
> -Dtapestry.secure-enabled=true
>
> We tell mod_proxy this:
>
> ProxyPreserveHost On
>
> and we use the following to convert the request to AJP, because app
> preserves the HTTPS headers.
>
> ProxyPass /myapp ajp://app:8009/myapp retry=5
> ProxyPassReverse /myapp ajp:app:8009/myapp retry=5
>
> This all works great for us. So what’s the URL issue again?
>
> Geoff
>
> > On 22 Jul 2016, at 5:54 PM, Svein-Erik Løken  wrote:
> >
> > Tanks for confirmation on this!
> >
> > What about make note on this in the documentation
> https://tapestry.apache.org/security.html? <
> https://tapestry.apache.org/security.html?>
> >
> > It's not obvious that X-Forwarded-Proto="https" should be set in the TLS
> termination proxy. Other X-Forwarded- is often set default in the proxy,
> like X-Forwarded-For.
> >
> > And the tapestry.secure-enabled = false.
> >
> >
> > Web sites need to be encrypted in the future to work in Chrome, Firefox…
> Google Will Soon Shame All Websites That Are Unencrypted
> http://motherboard.vice.com/read/google-will-soon-shame-all-websites-that-are-unencrypted-chrome-https
> <
> http://motherboard.vice.com/read/google-will-soon-shame-all-websites-that-are-unencrypted-chrome-https
> >.
> >
> >
> >
> > GeoLocation stopped to work I Chrome for desktop and Android, so I had
> to use encryption.
> >
> >
> >
> >
> > From: Chris Poulsen [via Apache Tapestry Mailing List Archives] [mailto:
> ml-node+s1045711n5732784...@n5.nabble.com  ml-node+s1045711n5732784...@n5.nabble.com>]
> > Sent: 22. juli 2016 11:35
> > To: Svein-Erik Løken mailto:sv...@jacilla.no>>
> > Subject: Re: TLS termination proxy and Tapestry
> >
> > We are always setting tapestry.secure-enabled = false
> >
> > --
> > Chris
> >
> > On Fri, Jul 22, 2016 at 11:29 AM, Dimitris Zenios <[hidden
> email]
> >> wrote:
> >
> >> When i am doing ssl out of the servlet container (eg jetty,apache etc) i
> >> always set secure enables to false.
> >>
> >> On 21 Jul 2016 12:07, "Svein-Erik Løken" <[hidden
> email]> wrote:
> >>
> >>> Using HAProxy or Apache HTTP Server as a TLS termination proxy I found
> >>> that setting X-Forwarded-Proto="https" in the header on the proxy
> >>> org.apache.tapestry5.services.Request::isSecure returns true . That's
> >> good!
> >>> In tapestry.production-mode=true I am getting absolute URLs. E.g.
> >>> http://example.com/index.mycompo.form.
> >>> By setting -Dtapestry.secure-enabled=false seems to solve this. Now I
> am
> >>> getting a relative URL. (/index.mycompo.form).
> >>> I can see that with X-Forwarded-Proto="https" set,
> >>> org.apache.tapestry5.internal.services.
> >>> RequestSecurityManager::checkPageSecurity returns LinkSecurity.SECURE.
> >>> That's good!
> >>>
> >>> For me it seems that this is the correct solution, but I find it nice
> if
> >>> some tapestry experts can confirm this!
> >>>
> >>>
> >>
> >
> > 
> > If you reply to this email, your message will be added to the discussion
> below:
> >
> http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/TLS-termination-proxy-and-Tapestry-tp

Re: TLS termination proxy and Tapestry

2016-07-22 Thread Chris Poulsen
We are always setting tapestry.secure-enabled = false

-- 
Chris

On Fri, Jul 22, 2016 at 11:29 AM, Dimitris Zenios  wrote:

> When i am doing ssl out of the servlet container (eg jetty,apache etc) i
> always set secure enables to false.
>
> On 21 Jul 2016 12:07, "Svein-Erik Løken"  wrote:
>
> > Using HAProxy or Apache HTTP Server as a TLS termination proxy I found
> > that setting X-Forwarded-Proto="https" in the header on the proxy
> > org.apache.tapestry5.services.Request::isSecure returns true . That's
> good!
> > In tapestry.production-mode=true I am getting absolute URLs. E.g.
> > http://example.com/index.mycompo.form.
> > By setting -Dtapestry.secure-enabled=false seems to solve this. Now I am
> > getting a relative URL. (/index.mycompo.form).
> > I can see that with X-Forwarded-Proto="https" set,
> > org.apache.tapestry5.internal.services.
> > RequestSecurityManager::checkPageSecurity returns LinkSecurity.SECURE.
> > That's good!
> >
> > For me it seems that this is the correct solution, but I find it nice if
> > some tapestry experts can confirm this!
> >
> >
>


Re: Problem sending data from a JS Element back to Tapestry

2016-07-21 Thread Chris Poulsen
Hi,

Utils and ajax are injected using requirejs, the top of the module file
looks like this...

(function(){
define(["jquery", "t5/core/ajax", "t5/core/utils",
"components/editor/inline-toolbar" ],
function ($, ajax, utils, toolbar) {



On Thu, Jul 21, 2016 at 10:42 PM, Jochimsen, Janko <
janko.jochim...@urios-beratung.de> wrote:

> Hi Chris,
>
> thanks for your sift answer
>
> I think this is the right direction. I am just stuck with a very –
> probably stupid – problem. I included all relevant paths that I can think
> of with:
>
> define([ "jquery", "t5/core/dom", "t5/core/ajax", "t5/core/utils" ]
>
> the function looks like this:
> var buildUrl = function(link, params) {
> return utils.extendURL(link, {
> params : JSON.stringify(params)
> });
> };
>
>
> Where the calling is:
> var url = buildUrl(callback, {
> 'action' : 'follow',
> 'userid' : '11239528343'
> });
>
>
> but in Firefox console I get still
>
> TypeError: extendURL is not a function
> buildUrl()
>  myBarRender.js:56
> 
>  myBarRender.js:30
> jQuery.event.dispatch()
>  jquery.js:137
> jQuery.event.add/elemData.handle()
>  jquery.js:126
> jQuery.event.trigger()
>
> Any Idea?
>
> Thanks a lot
>
> Janko
>
>
> -Ursprüngliche Nachricht-
> Von: Chris Poulsen [mailto:mailingl...@nesluop.dk]
> Gesendet: Donnerstag, 21. Juli 2016 19:20
> An: Tapestry users 
> Betreff: Re: Problem sending data from a JS Element back to Tapestry
>
> you cannot expect that your parameters end up as event context (unless you
> encode them into your url in that way).
>
> I've had success using:
>
> var url = buildUrl( setupDialogLink, params ); ajax( url, {
> success: function(){ ... }
> });
>
> var buildUrl = function( link, params )
> {
> return utils.extendURL( link, { params: JSON.stringify(params) } ); };
>
> Where ajax/utils are those from t5/core/ajax / t5/core/utils
>
> The handler on the server side looks like this:
>
> handlerName( @RequestParameter( "params" ) JSONObject json )
>
> HTH.
>
> --
> Chris
>
>
>
>
>
> On Thu, Jul 21, 2016 at 5:35 PM, Jochimsen, Janko <
> janko.jochim...@urios-beratung.de> wrote:
>
> > Hello Everybody,
> > I do have a problem with the communication between tapestry and java
> > Script or to be more precise a JQuery Script.
> > As a background Information I am using JQPlot Graphs that work quiet good
> > and I can start them from tapestry without problems.
> > Now I would like to increase the interaction of these elements by sending
> > mouse clicks back to the tapestry system for further use.
> > In order to call the plot I use
> >
> > public void afterRender() {
> > Link link = resources.createEventLink("Call2", spec);
> > String uri = link.toAbsoluteURI();
> > String output = "Call JS with Parameter:[" + uri + "]";
> > logger.info(" OUTPUT: " + output);
> > javaScriptSupport.require("myBarRender").with(uri, spec);
> >
> >   }
> >
> > Where Call2 looks like this:
> > public void onCall2(EventContext eventContext) {
> > if (eventContext != null) {
> >
> >   JSONObject value = null;
> >
> >   StringBuffer sb = new StringBuffer();
> >   CaptureResultCallback callback = new
> > CaptureResultCallback();
> >   resources.triggerEvent(EventConstants.REFRESH, new
> > JSONObject[] { value }, callback);
> >
> >   if (callback.getResult() != null) {
> > Object obj = callback.getResult();
> > sb.append(" CALLBACK = " + obj.toString() +
> "..");
> >   } else {
> > sb.append(" CALLBACK = NULL ");
> >   }
> >   String[] data = eventContext.toStrings();
> >
> >   if (data.length > 0) {
> > for (int i = 0; i < data.length; i++) {
> >   sb.append("data[" + i + "] =" + data);
> >   String s = data[i];
> >   if (s != null) {
> >sb.append("content=&qu

Re: Problem sending data from a JS Element back to Tapestry

2016-07-21 Thread Chris Poulsen
you cannot expect that your parameters end up as event context (unless you
encode them into your url in that way).

I've had success using:

var url = buildUrl( setupDialogLink, params );
ajax( url, {
success: function(){ ... }
});

var buildUrl = function( link, params )
{
return utils.extendURL( link, { params: JSON.stringify(params) } );
};

Where ajax/utils are those from t5/core/ajax / t5/core/utils

The handler on the server side looks like this:

handlerName( @RequestParameter( "params" ) JSONObject json )

HTH.

-- 
Chris





On Thu, Jul 21, 2016 at 5:35 PM, Jochimsen, Janko <
janko.jochim...@urios-beratung.de> wrote:

> Hello Everybody,
> I do have a problem with the communication between tapestry and java
> Script or to be more precise a JQuery Script.
> As a background Information I am using JQPlot Graphs that work quiet good
> and I can start them from tapestry without problems.
> Now I would like to increase the interaction of these elements by sending
> mouse clicks back to the tapestry system for further use.
> In order to call the plot I use
>
> public void afterRender() {
> Link link = resources.createEventLink("Call2", spec);
> String uri = link.toAbsoluteURI();
> String output = "Call JS with Parameter:[" + uri + "]";
> logger.info(" OUTPUT: " + output);
> javaScriptSupport.require("myBarRender").with(uri, spec);
>
>   }
>
> Where Call2 looks like this:
> public void onCall2(EventContext eventContext) {
> if (eventContext != null) {
>
>   JSONObject value = null;
>
>   StringBuffer sb = new StringBuffer();
>   CaptureResultCallback callback = new
> CaptureResultCallback();
>   resources.triggerEvent(EventConstants.REFRESH, new
> JSONObject[] { value }, callback);
>
>   if (callback.getResult() != null) {
> Object obj = callback.getResult();
> sb.append(" CALLBACK = " + obj.toString() + "..");
>   } else {
> sb.append(" CALLBACK = NULL ");
>   }
>   String[] data = eventContext.toStrings();
>
>   if (data.length > 0) {
> for (int i = 0; i < data.length; i++) {
>   sb.append("data[" + i + "] =" + data);
>   String s = data[i];
>   if (s != null) {
>sb.append("content=" + s);
>   }
> }
>   } else {
> sb.append("NO DATA");
>   }
>   logger.info("Got Called from JS with data " +
> sb.toString());
> } else {
>   logger.info("Got Called from JS with data == null");
> }
>   }
>
> On the JavaScript-Side the code looks like this
>
> define([ "jquery" ], function($) {
>
>   return function(callbackuri, context) {
> var s1 = [ 2, 6, 7, 10 ];
> var s2 = [ 7, 5, 3, 2 ];
> var s3 = [ 14, 9, 3, 8 ];
> var callback = callbackuri;
>
> plot3 = $.jqplot('chart3', [ s1, s2, s3 ], {
>   stackSeries : true,
>   captureRightClick : true,
>   seriesDefaults : {
> renderer : $.jqplot.BarRenderer,
> rendererOptions : {
>   highlightMouseDown : true
> },
> pointLabels : {
>   show : true
> }
>   }
> });
> $('#chart3').bind(
> 'jqplotDataRightClick',
> function(ev, seriesIndex, pointIndex, data) {
>   console.log("try to reach callback");
>   //
>   $.ajax(callback, {
>dataType : 'json',
>type : 'post',
>contentType : 'application/json',
>data : JSON.stringify({
>  'action' : 'follow',
>  'userid' : '11239528343'
>}),
>success : function(data) {
>  console.log("Reached Server got
> back ");
>}
> //$.post(callback, $(this).serialize(),
> //function(data, textStatus, jQxhr) {
> // console.log("Reached Server got back ");
> // $('#response pre').html(data);
> //
> //  

Re: Modules not found by Tapestry 5.4.1; serving 'index' instead

2016-06-30 Thread Chris Poulsen
change @Import(module = { "mymodule.js",}) to @Import(module = {
"mymodule"})

-- 
Chris

On Fri, Jul 1, 2016 at 4:31 AM, Claude Andrew  wrote:

> I just upgraded to 5.4.1 from 5.3.  I am switching my js libraries to
> requirejs modules.  Following the guide at
> http://tapestry.apache.org/javascript-modules.html, I placed my module
> files in 'src/main/resources/META-INF/modules' and included one in a page's
> java class:
> @Import(module = { "mymodule.js",})
>
> When I load the page and look at mymodule.js in the browser it shows me the
> html of my index page instead of the javascript in my mymodule.js file.
> This looks as though Tapestry has no idea that it has a resource called
> mymodule.js.
>
> Where have I gone wrong?
>
> I am using Tynamo's Tomcat/Eclipse plugin (
> http://www.tynamo.org/Developing+with+Tomcat+and+Eclipse/)
>
> I have a feeling that perhaps my build or deployment are losing the new
> META-INF directory and Tapestry never sees it but I have no idea where to
> go to test or fix that (shame on me).
>
> More details if useful:
> The path the browser shows for the resource is "
> http://localhost:8080/mymodule.js"; which seems appropriate as my app is
> deployed as ROOT.
> The tail of my page requires my module like this:
> require(["t5/core/pageinit"], function(pi) {
> pi([], [
>   "mymodule.js",
> ]); });
>
> here's my directory structure:
>
> src/main/
> src/main/resources
> src/main/resources/META-INF
> src/main/resources/META-INF/modules
> src/main/resources/META-INF/modules/mymodule.js
> src/main/java
> src/main/webapp
> src/site
> src/test
> etc
>
>
> Thanks in advance,
>
> Claude
>


Re: after migrating to T5.4 home page won't load

2016-06-30 Thread Chris Poulsen
check mvn dependency:tree to see what is actually resolved

-- 
Chris

On Thu, Jun 30, 2016 at 10:52 PM, Qbyte Consulting <
qbyteconsult...@gmail.com> wrote:

> Here are the effective dependencies:
>
> 
> 
>   org.apache.tapestry
>   tapestry-core
>   5.4.1
>   compile
> 
> 
>   org.testng
>   testng
>   5.14.10
>   test
> 
> 
>   org.easymock
>   easymock
>   3.0
>   test
> 
> 
>   org.apache.tapestry
>   tapestry-test
>   5.4.1
>   test
> 
> 
>   javax.servlet
>   servlet-api
>   2.5
>   provided
> 
> 
>   org.apache.tapestry
>   tapestry-javadoc
>   5.4.1
>   provided
> 
> 
>   se.unbound
>   tapestry-breadcrumbs
>   1.9
>   compile
> 
> 
>   epulse.tapestry
>   tapx-datefield
>   1.2
>   compile
> 
> 
>   org.got5
>   tapestry5-jquery
>   4.1.1
>   compile
> 
> 
>   org.apache.tapestry
>   tapestry-jpa
>   5.4.1
>   compile
>   
> 
>   org.eclipse.persistence
>   javax.persistence
> 
>   
> 
> 
>   javax.mail
>   mail
>   1.4.5
>   compile
> 
> 
>   net.sourceforge.jtds
>   jtds
>   1.2.7
>   compile
> 
> 
>   postgresql
>   postgresql
>   9.1-901.jdbc4
>   compile
> 
> 
>   javax.annotation
>   jsr250-api
>   1.0
>   compile
> 
> 
>   org.apache.commons
>   commons-io
>   1.3.2
>   compile
> 
> 
>   eu.epulse.auditmanager
>   sentinelplus
>   1.0.0
>   compile
> 
> 
>   org.apache.tapestry
>   tapestry-kaptcha
>   5.4.1
>   compile
> 
> 
>   commons-beanutils
>   commons-beanutils
>   1.8.3
>   compile
> 
> 
>   org.apache.commons
>   commons-email
>   1.3.2
>   compile
> 
>   
>
> On Thu, Jun 30, 2016 at 7:22 PM, Thiago H de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
> > On Thu, 30 Jun 2016 13:47:31 -0300, Qbyte Consulting <
> > qbyteconsult...@gmail.com> wrote:
> >
> > I got jetty:run to launch the app, but when requesting the home page:
> >>
> >> HTTP ERROR 500
> >>
> >> Problem accessing /audit/. Reason:
> >>
> >> Server Error
> >> Caused by:
> >>
> >> java.lang.AbstractMethodError
> >>
> >
> > This very probably means you have mixed Tapestry versions in your
> > classpath.
> >
> > --
> > 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: problem accessing assets after migration to 5.4

2016-06-30 Thread Chris Poulsen
assets are usually in a specific path (resources/META-INF/assets/...) -
Could it be that your file is not an asset and that it should be loaded
using normal methods (classloader.getResourceAsStream or similar)

-- 
Chris

On Thu, Jun 30, 2016 at 8:23 PM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Thu, 30 Jun 2016 13:13:23 -0300, Qbyte Consulting <
> qbyteconsult...@gmail.com> wrote:
>
> Hi,
>>
>
> Hi!
>
> I've changed my project deps to T5.4. After fixing some depricated page
>> link methods my app compiles. However when I run I get exceptions from a
>> menu loading service:
>>
>> is = assetSource.getClasspathAsset("menu.properties").getResource()
>> .openStream();
>> } catch (RuntimeException e) {
>>
>
> Try "/menu.properties" instead of "menu.properties", please.
>
> --
> 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: Tapestry with Selenium and Cucumber

2016-06-30 Thread Chris Poulsen
The tapestry sources are tested using selenium.

On Thu, Jun 30, 2016 at 5:31 PM, Qbyte Consulting  wrote:

> Hi,
>
> Are there any Tapestry sample projects around with Selenium and/or Cucumber
> tests?
>
> thanks,
> John
>


Re: Caching problem?

2016-06-30 Thread Chris Poulsen
btw the modules path can be both "modules" and "modules.gz" depending on
various things.

On Thu, Jun 30, 2016 at 4:35 PM, Nathan Quirynen <
nat...@pensionarchitects.be> wrote:

> Hey Chris,
>
> Yeah, that's the only option I've found until now using following check as
> you said:
>
> if( ! (path.startsWith("/assets/") || path.startsWith("/modules.gz/")) ) {
>
> // add headers
>
> }
>
> Hope I got everything covered by this, but it's at least an improvement as
> how it was before (caching was turned off for everything) and the problem I
> had with that one asset seems to be solved (still don't really get what was
> happening there though).
>
> Thanks for your thoughts!
>
> Nathan
>
>
>
> On 30/06/16 15:56, Chris Poulsen wrote:
>
>> check the path? (asset paths usually contains "/asset/" and module paths
>> contains "/modules/")
>>
>> On Thu, Jun 30, 2016 at 11:55 AM, Nathan Quirynen <
>> nat...@pensionarchitects.be> wrote:
>>
>> Is there any way to know in a Request filter if it is a page request (not
>>> a request to some asset).
>>>
>>> I thought doing the following:
>>>
>>> PageRenderRequestParameters parameters =
>>> linkEncoder.decodePageRenderRequest(request);
>>>
>>> if (parameters == null) {
>>>
>>>  // not a page request
>>>
>>> }
>>>
>>> But it seems that for every request to an asset it is never null, and
>>> parameters.getLogicalPageName() has the value "Index".
>>>
>>>
>>>
>>> On 29/06/16 18:32, Nathan Quirynen wrote:
>>>
>>> I have found that in one of the applications request filters following is
>>>> added to every response:
>>>>
>>>> Cache-Control: no-cache, no-store, must-revalidate
>>>>
>>>> Pragma: no-cache
>>>>
>>>>
>>>> On 29/06/16 17:33, Nathan Quirynen wrote:
>>>>
>>>> Hi,
>>>>>
>>>>> I have a "weird" problem where this one image won't show up. Never had
>>>>> this problem before the upgrade to 5.4 and since there have been
>>>>> changes
>>>>> with caching, I guess it has something to do with that.
>>>>> I don't know a lot about the caching Tapestry does (or in general), so
>>>>> I
>>>>> hope someone can point me in the right direction to find the problem.
>>>>>
>>>>> After some testing the image does not load when I use Firefox, unless I
>>>>> use the reload function of Firefox that overrides the cache.
>>>>> The difference I find when using this is in the request headers (for
>>>>> all
>>>>> files):
>>>>>
>>>>> Normal load (image does not show up):
>>>>>
>>>>> Cache-Control: max-age=0
>>>>>
>>>>> "Hard" reload (image does show up):
>>>>>
>>>>> Cache-Control: no-cache
>>>>> Pragma: no-cache
>>>>>
>>>>>
>>>>> When inspecting the source code in Firefox, the url seems correct and
>>>>> then the image does show up magically.
>>>>>
>>>>> What could be causing this one file (next to all the other assets that
>>>>> were added in the same version) to have this behaviour? Can this be
>>>>> caused
>>>>> by Tapestry?
>>>>>
>>>>> I have tried clearing Firefox's cache, using a computer that has not
>>>>> opened the application before and also changing the version of the
>>>>> application with no results...
>>>>>
>>>>>
>>>>> Some pointers are appreciated!
>>>>>
>>>>>
>>>>> Nathan
>>>>>
>>>>>
>>>>> -
>>>>> 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
>>>
>>>
>>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Caching problem?

2016-06-30 Thread Chris Poulsen
check the path? (asset paths usually contains "/asset/" and module paths
contains "/modules/")

On Thu, Jun 30, 2016 at 11:55 AM, Nathan Quirynen <
nat...@pensionarchitects.be> wrote:

> Is there any way to know in a Request filter if it is a page request (not
> a request to some asset).
>
> I thought doing the following:
>
> PageRenderRequestParameters parameters =
> linkEncoder.decodePageRenderRequest(request);
>
> if (parameters == null) {
>
> // not a page request
>
> }
>
> But it seems that for every request to an asset it is never null, and
> parameters.getLogicalPageName() has the value "Index".
>
>
>
> On 29/06/16 18:32, Nathan Quirynen wrote:
>
>> I have found that in one of the applications request filters following is
>> added to every response:
>>
>> Cache-Control: no-cache, no-store, must-revalidate
>>
>> Pragma: no-cache
>>
>>
>> On 29/06/16 17:33, Nathan Quirynen wrote:
>>
>>> Hi,
>>>
>>> I have a "weird" problem where this one image won't show up. Never had
>>> this problem before the upgrade to 5.4 and since there have been changes
>>> with caching, I guess it has something to do with that.
>>> I don't know a lot about the caching Tapestry does (or in general), so I
>>> hope someone can point me in the right direction to find the problem.
>>>
>>> After some testing the image does not load when I use Firefox, unless I
>>> use the reload function of Firefox that overrides the cache.
>>> The difference I find when using this is in the request headers (for all
>>> files):
>>>
>>> Normal load (image does not show up):
>>>
>>> Cache-Control: max-age=0
>>>
>>> "Hard" reload (image does show up):
>>>
>>> Cache-Control: no-cache
>>> Pragma: no-cache
>>>
>>>
>>> When inspecting the source code in Firefox, the url seems correct and
>>> then the image does show up magically.
>>>
>>> What could be causing this one file (next to all the other assets that
>>> were added in the same version) to have this behaviour? Can this be caused
>>> by Tapestry?
>>>
>>> I have tried clearing Firefox's cache, using a computer that has not
>>> opened the application before and also changing the version of the
>>> application with no results...
>>>
>>>
>>> Some pointers are appreciated!
>>>
>>>
>>> Nathan
>>>
>>>
>>> -
>>> 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: FW: Null pointer on sort with 5.3.8 that didn't occur with 5.3.7

2016-06-30 Thread Chris Poulsen
I guess using t:add is OK as long as the grid is not performing operations
where it needs to access the property in the data source (for operations
like sorting/filtering).

Generally speaking we (@work) almost always end up using bean models,
except in the most simple cases.

-- 
Chris

On Thu, Jun 30, 2016 at 11:04 AM, Davide Vecchi  wrote:

> Thanks for the pointers, creating a BeanModel and adding my extra columns
> to it sounds like the right way to go. As an emergency solution for now I'm
> just going through all grids and adding the t:add columns into
> t:excludeSort in order to avoid the crashes on sorting. Then I will work on
> the actual solution with the BeanModel.
>
> In the meantime, regardless of these crashes and of whether it's 5.3.7 or
> 5.3.8, I'm still wondering if my way of defining these t:add columns
> (pasted below for convenience) has something wrong in general. Any opinion
> about that would be very useful.
>
> The column is defined like this:
>
> - In the page template, one param of the grid tag is
>
> t:add="prop:gridAdd"
>
> - In the page Java code, there is the corresponding
>
> public String getGridAdd() {
> return " myColumn1, myColumn2, myColumn3, myColumn4";
> }
>
>   where let's say that "myColumn3" is the column whose sorting fails.
>
> - In the page template, within the t:grid tag there is the definition of
> the customized content of that column:
>
> ${ myColumn3}
>
> - In the page Java code, there is the method returning the value for that
> column:
>
> public String getMyColumn3()
> {
> return aStringThatIsNeverNull;
> }
>
> 
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>


Re: FW: Null pointer on sort with 5.3.8 that didn't occur with 5.3.7

2016-06-29 Thread Chris Poulsen
I'm guessing that something in the sorting part attempts to pull out the
value from your passed data source (possibly coerced from a collection).

The thing is that your data source does not contain the property (as it is
synthetic) and you do not really pull the value from the data source ever,
but from the "getMyColumn3" getter instead. The sorting stuff that attempts
to extract the value for comparison has no way of knowing how to retrieve
the value as the conduit is null.

In order to provide the grid with the means to extract the value for
"myColumn3" you should provide a conduit (can be done by creating a
BeanModel and adding your column(s) with proper conduits. Judging from your
example you can specify the data type as text (or string or what ever it is
called in DataTypeConstants).

Then the override (p:myColumn3Cell) and the t:add="." is not
necessary.. You can keep the override if you need to.

-- 
Chris

On Wed, Jun 29, 2016 at 12:04 PM, Davide Vecchi  wrote:

> I changed my plan of finding out what causes this difference between 5.3.7
> and 5.3.8. Instead I will go with some re-design, using some suggestions I
> got here.
>
> However I am still very interested in knowing whether my way of defining
> these t:add columns (pasted below) in general has something wrong or not so
> right or not Tapestry-friendly. If it does, I might try to rectify that to
> see if that helps.
>
> The column is defined like this:
>
> - In the page template, one param of the grid tag is
>
> t:add="prop:gridAdd"
>
> - In the page Java code, there is the corresponding
>
> public String getGridAdd() {
> return " myColumn1, myColumn2, myColumn3, myColumn4";
> }
>
>   where let's say that "myColumn3" is the column whose sorting fails.
>
> - In the page template, within the t:grid tag there is the definition of
> the customized content of that column:
>
> ${ myColumn3}
>
> - In the page Java code, there is the method returning the value for that
> column:
>
> public String getMyColumn3()
> {
> return aStringThatIsNeverNull;
> }
>
> Thanks in advance for any possible feedback or hint or any related thought.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>


Re: Null pointer on sort with 5.3.8 that didn't occur with 5.3.7

2016-06-28 Thread Chris Poulsen
Hook up a debugger and see what is going on when the NPE is thrown?

On Tue, Jun 28, 2016 at 3:43 PM, Davide Vecchi  wrote:

> Thanks, those are interesting options to change my design, which I will
> probably have to do.
>
> But at this stage I need to focus on why the outcome of defining columns
> in that way is different in 5.3.8, because it might be that more areas of
> this web application are affected by differences in 5.3.8 and I haven't
> found out these areas yet.
>
> Or perhaps, would it be correct to say that that way of defining columns
> is not correct in general, regardless of Tapestry version ? Maybe this is
> the case and this incorrect way was being somehow "forgiven" by 5.3.7 ?
>
>
> -Original Message-
> From: Chris Poulsen [mailto:mailingl...@nesluop.dk]
> Sent: Tuesday, June 28, 2016 15:32
> To: Tapestry users 
> Subject: Re: Null pointer on sort with 5.3.8 that didn't occur with 5.3.7
>
> Also you can control the display blocks using the data-type on the bean
> model, if you need something special.
>
> --
> Chris
>
> On Tue, Jun 28, 2016 at 3:30 PM, Chris Poulsen 
> wrote:
>
> > You can use a bean model for variable number of columns, that one also
> > gives you full control over conduits etc.
> >
> > Inject BeanModelSource and create a display model for your data
> > source, use .include (or similar) to whitelist the desired attributes
> > in the generated model and model.add to get your synthetic columns
> defined.
> >
> > --
> > Chris
> >
> > On Tue, Jun 28, 2016 at 3:13 PM, Davide Vecchi  wrote:
> >
> >> Thanks for the answers, it's becoming more clear.
> >>
> >> The possibility suggested by Kalle makes sense, however I made some
> >> test about it and I don't think it's the cause of my problem. This
> >> grid column was being sorted without exceptions with Java 7 +
> >> Tapestry 5.3.7, plus I checked and none of the values in the column
> >> is null. I have also tested calling Arrays.sort with some null
> >> elements and it throws a null pointer both with Java 7 and Java 8.
> >> My problem has most probably to do with the fact that that column is
> >> not part of the grid data source, as Cezary suggested, and it was so
> >> also when we were using Java 7.
> >>
> >> About Cezary's hypothesis, I think my problem is definitely in that
> >> area, but there is probably also something going on related to the
> >> different Tapestry version because the column was defined in the same
> >> way when using
> >> 5.3.7 and in that case there was no exception.
> >>
> >> The column is defined like this:
> >>
> >> - In the page template, one param of the grid tag is
> >>
> >> t:add="prop:gridAdd"
> >>
> >> - In the page Java code, there is the corresponding
> >>
> >> public String getGridAdd() {
> >> return " myColumn1, myColumn2, myColumn3, myColumn4";
> >> }
> >>
> >>   where let's say that "myColumn3" is the column whose sorting fails.
> >>
> >> - In the page template, within the t:grid tag there is the definition
> >> of the customized content of that column:
> >>
> >> ${ myColumn3}
> >>
> >> - In the page Java code, there is the method returning the value for
> >> that
> >> column:
> >>
> >> public String getMyColumn3()
> >> {
> >> return aStringThatIsNeverNull;
> >> }
> >>
> >> So I'm trying to find out if this way of defining my column is not
> >> right in 5.3.8 although it was not failing in 5.3.7, in order to
> rectify it.
> >>
> >>
> >> -Original Message-
> >> From: Cezary Biernacki [mailto:cezary...@gmail.com]
> >> Sent: Monday, June 27, 2016 18:10
> >> To: Tapestry users 
> >> Subject: Re: Null pointer on sort with 5.3.8 that didn't occur with
> >> 5.3.7
> >>
> >> Your stack trace seems to indicate that conduit (a mechanism
> >> connecting Tapestry with a column) is not available. It can happen if
> >> the column is manually added to the model. Was the column sortable with
> Tapestry  5.3.7?
> >> How is this column defined?
> >>
> >> Best regards,
> >> Cezary
> >>
> >>
> >> On Mon, Jun 27, 2016 at 4:43 PM, Davide Vecchi  wrote:
> >>

Re: Null pointer on sort with 5.3.8 that didn't occur with 5.3.7

2016-06-28 Thread Chris Poulsen
Also you can control the display blocks using the data-type on the bean
model, if you need something special.

-- 
Chris

On Tue, Jun 28, 2016 at 3:30 PM, Chris Poulsen 
wrote:

> You can use a bean model for variable number of columns, that one also
> gives you full control over conduits etc.
>
> Inject BeanModelSource and create a display model for your data source,
> use .include (or similar) to whitelist the desired attributes in the
> generated model and model.add to get your synthetic columns defined.
>
> --
> Chris
>
> On Tue, Jun 28, 2016 at 3:13 PM, Davide Vecchi  wrote:
>
>> Thanks for the answers, it's becoming more clear.
>>
>> The possibility suggested by Kalle makes sense, however I made some test
>> about it and I don't think it's the cause of my problem. This grid column
>> was being sorted without exceptions with Java 7 + Tapestry 5.3.7, plus I
>> checked and none of the values in the column is null. I have also tested
>> calling Arrays.sort with some null elements and it throws a null pointer
>> both with Java 7 and Java 8.
>> My problem has most probably to do with the fact that that column is not
>> part of the grid data source, as Cezary suggested, and it was so also when
>> we were using Java 7.
>>
>> About Cezary's hypothesis, I think my problem is definitely in that area,
>> but there is probably also something going on related to the different
>> Tapestry version because the column was defined in the same way when using
>> 5.3.7 and in that case there was no exception.
>>
>> The column is defined like this:
>>
>> - In the page template, one param of the grid tag is
>>
>> t:add="prop:gridAdd"
>>
>> - In the page Java code, there is the corresponding
>>
>> public String getGridAdd() {
>> return " myColumn1, myColumn2, myColumn3, myColumn4";
>> }
>>
>>   where let's say that "myColumn3" is the column whose sorting fails.
>>
>> - In the page template, within the t:grid tag there is the definition of
>> the customized content of that column:
>>
>> ${ myColumn3}
>>
>> - In the page Java code, there is the method returning the value for that
>> column:
>>
>> public String getMyColumn3()
>> {
>> return aStringThatIsNeverNull;
>> }
>>
>> So I'm trying to find out if this way of defining my column is not right
>> in 5.3.8 although it was not failing in 5.3.7, in order to rectify it.
>>
>>
>> -Original Message-
>> From: Cezary Biernacki [mailto:cezary...@gmail.com]
>> Sent: Monday, June 27, 2016 18:10
>> To: Tapestry users 
>> Subject: Re: Null pointer on sort with 5.3.8 that didn't occur with 5.3.7
>>
>> Your stack trace seems to indicate that conduit (a mechanism connecting
>> Tapestry with a column) is not available. It can happen if the column is
>> manually added to the model. Was the column sortable with Tapestry  5.3.7?
>> How is this column defined?
>>
>> Best regards,
>> Cezary
>>
>>
>> On Mon, Jun 27, 2016 at 4:43 PM, Davide Vecchi  wrote:
>>
>> > Hi everybody
>> >
>> > For now I cannot post code to reproduce this problem because it only
>> > occurs with one columns of a specific grid from a big application and
>> > so far I wasn't able to extract the code to reproduce the error into a
>> > runnable example. But after posting this I will keep trying and if I
>> > manage I will post that.
>> >
>> > We migrated this web application from Java 1.7 + Tapestry 5.3.7 to
>> > Java
>> > 1.8 with Tapestry 5.3.8 .
>> >
>> > Clicking on the column header of this column - which contains String
>> > values - causes the exception below.
>> >
>> > While I'm investigating this error I was wondering if someone is aware
>> > of differences in the grid sorting of Tapestry 5.3.8 that might cause
>> > it to throw a null-pointer where Tapestry 5.3.7 wouldn't (and maybe
>> > should; it's likely that there is a mistake of mine that was somehow
>> > being "forgiven" by 5.3.7).
>> >
>> > Stacktrace:
>> >
>> > java.lang.NullPointerException
>> > ?
>> > org.apache.tapestry5.internal.grid.CollectionGridDataSource$2.compare(
>> > CollectionGridDataSource.java:78)
>> > ?
>> > org.apache.tapestry5.internal.grid.CollectionGridDataSource$3.

Re: Null pointer on sort with 5.3.8 that didn't occur with 5.3.7

2016-06-28 Thread Chris Poulsen
You can use a bean model for variable number of columns, that one also
gives you full control over conduits etc.

Inject BeanModelSource and create a display model for your data source, use
.include (or similar) to whitelist the desired attributes in the generated
model and model.add to get your synthetic columns defined.

-- 
Chris

On Tue, Jun 28, 2016 at 3:13 PM, Davide Vecchi  wrote:

> Thanks for the answers, it's becoming more clear.
>
> The possibility suggested by Kalle makes sense, however I made some test
> about it and I don't think it's the cause of my problem. This grid column
> was being sorted without exceptions with Java 7 + Tapestry 5.3.7, plus I
> checked and none of the values in the column is null. I have also tested
> calling Arrays.sort with some null elements and it throws a null pointer
> both with Java 7 and Java 8.
> My problem has most probably to do with the fact that that column is not
> part of the grid data source, as Cezary suggested, and it was so also when
> we were using Java 7.
>
> About Cezary's hypothesis, I think my problem is definitely in that area,
> but there is probably also something going on related to the different
> Tapestry version because the column was defined in the same way when using
> 5.3.7 and in that case there was no exception.
>
> The column is defined like this:
>
> - In the page template, one param of the grid tag is
>
> t:add="prop:gridAdd"
>
> - In the page Java code, there is the corresponding
>
> public String getGridAdd() {
> return " myColumn1, myColumn2, myColumn3, myColumn4";
> }
>
>   where let's say that "myColumn3" is the column whose sorting fails.
>
> - In the page template, within the t:grid tag there is the definition of
> the customized content of that column:
>
> ${ myColumn3}
>
> - In the page Java code, there is the method returning the value for that
> column:
>
> public String getMyColumn3()
> {
> return aStringThatIsNeverNull;
> }
>
> So I'm trying to find out if this way of defining my column is not right
> in 5.3.8 although it was not failing in 5.3.7, in order to rectify it.
>
>
> -Original Message-
> From: Cezary Biernacki [mailto:cezary...@gmail.com]
> Sent: Monday, June 27, 2016 18:10
> To: Tapestry users 
> Subject: Re: Null pointer on sort with 5.3.8 that didn't occur with 5.3.7
>
> Your stack trace seems to indicate that conduit (a mechanism connecting
> Tapestry with a column) is not available. It can happen if the column is
> manually added to the model. Was the column sortable with Tapestry  5.3.7?
> How is this column defined?
>
> Best regards,
> Cezary
>
>
> On Mon, Jun 27, 2016 at 4:43 PM, Davide Vecchi  wrote:
>
> > Hi everybody
> >
> > For now I cannot post code to reproduce this problem because it only
> > occurs with one columns of a specific grid from a big application and
> > so far I wasn't able to extract the code to reproduce the error into a
> > runnable example. But after posting this I will keep trying and if I
> > manage I will post that.
> >
> > We migrated this web application from Java 1.7 + Tapestry 5.3.7 to
> > Java
> > 1.8 with Tapestry 5.3.8 .
> >
> > Clicking on the column header of this column - which contains String
> > values - causes the exception below.
> >
> > While I'm investigating this error I was wondering if someone is aware
> > of differences in the grid sorting of Tapestry 5.3.8 that might cause
> > it to throw a null-pointer where Tapestry 5.3.7 wouldn't (and maybe
> > should; it's likely that there is a mistake of mine that was somehow
> > being "forgiven" by 5.3.7).
> >
> > Stacktrace:
> >
> > java.lang.NullPointerException
> > ?
> > org.apache.tapestry5.internal.grid.CollectionGridDataSource$2.compare(
> > CollectionGridDataSource.java:78)
> > ?
> > org.apache.tapestry5.internal.grid.CollectionGridDataSource$3.compare(
> > CollectionGridDataSource.java:91) ?
> > java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
> > ?  java.util.TimSort.sort(TimSort.java:234)
> > ?  java.util.Arrays.sort(Arrays.java:1512)
> > ?  java.util.ArrayList.sort(ArrayList.java:1454)
> > ?  java.util.Collections.sort(Collections.java:175)
> > ?
> > org.apache.tapestry5.internal.grid.CollectionGridDataSource.prepare(Co
> > llectionGridDataSource.java:97)
> > ?
> > my.package.gui.tapestry.components.AMCGridEmbedded$CachingDataSource.p
> > repare(AMCGridEmbedded.java:853)
> > ?
> > my.package.gui.tapestry.components.AMCGridEmbedded.setupDataSource(AMC
> > GridEmbedded.java:1174)
> > ?
> > my.package.gui.tapestry.components.AMCGridEmbedded.setupRender(AMCGrid
> > Embedded.java:655)
> > ?
> > my.package.gui.tapestry.components.AMCGridEmbedded.advised$setupRender
> > _1a14d3f8fd924(AMCGridEmbedded.java)
> > ?
> > my.package.gui.tapestry.components.AMCGridEmbedded$Invocation_setupRen
> > der_1a14d3f8fd923.proceedToAdvisedMethod(Unknown
> > Source)
> > ?
> >
> org.apache.tapestry5.internal.plastic.Abstr

Re: How to customize the grid to show three s in two rows?

2016-06-22 Thread Chris Poulsen
You should checkout the tapestry source (Grid, GridRows and friends) to see
how the output is generated.

-- 
Chris

On Wed, Jun 22, 2016 at 12:50 PM, g kuczera  wrote:

> Thanks for the idea, Chris. I was going to make the table with styled divs
> and t:Loop, but much better option is to create it with the regular table
> syntax, but having two rows - just like you mentioned - inside the t:Loop.
> So you saved me a lot of time.
>
> PS: I already have it tested, so the rest is just trying to recover the
> styles, which disappeared after replacing the t:Grid with t:Loop (it looks
> that tapestry automatically adds, after generating the html from t:Grid,
> the classes with the names of the columns eg. Some kind
> of topic).
>
> 2016-06-22 9:50 GMT+02:00 Chris Poulsen :
>
> > So:
> > 
> > 
> > 
> > 
> > 
> > 
> >
> > For each row.
> >
> > The grid is not meant to handle something like that.
> >
> > You can roll your own component(s) to render what you need (using loop
> > etc.) or add an extra cell as a regular grid cell and then use a mixin to
> > manipulate the html of the grid to introduce a new row containing the
> cell.
> > The latter being the most "hackish solution" of the two, IMO.
> >
> > --
> > Chris
> >
> > On Wed, Jun 22, 2016 at 8:22 AM, g kuczera  wrote:
> >
> > > Sorry, the image was not embedded correctly. Here is the link:
> > > http://i.imgur.com/OlnNVBn.png
> > >
> > > (two headers before, three headers after).
> > > Now I am examining if it's possible to move the third  component
> down
> > > (below the other two) via css styling.
> > >
> > > 2016-06-22 8:13 GMT+02:00 Chris Poulsen :
> > >
> > > > Your post seems incomplete, so it is not clear to me, what you are
> > trying
> > > > to do.
> > > >
> > > > --
> > > > Chris
> > > >
> > > > On Wed, Jun 22, 2016 at 8:05 AM, g kuczera 
> wrote:
> > > >
> > > > > Currently I got a request to add another visible column to the
> table
> > > > (grid
> > > > > component), but the request was for it to be placed below the rest.
> > > What
> > > > do
> > > > > you think the best approach would be in this case? I see three of
> > them:
> > > > >
> > > > >- add the mentioned column in the *include* parameter and after
> > > > >rendering the page move it below the others (is that even
> > possible?)
> > > > >
> > > > >  > > > > source="casesDataSource" include="id, topic, date"
> row="currentCase"
> > > > > pagerPosition="none">
> > > > >
> > > > >- I tried putting the regular  inside the  with
> > > > >currentCase.date value, but without having it in the include
> > > > parameter, but
> > > > >the grid ignores that and do not render the date value
> > > > >
> > > > > ${currentCase.id}
> > > > >
> > > > > ${currentCase.topic}
> > > > >
> > > > > ${currentCase.date}
> > > > >
> > > > >- the last one would be using the loop component, and put the
> > values
> > > > >inside divs, which can be easily moved around - it would mean
> for
> > me
> > > > >changing the casesDataSource (extended GridDataSource) to
> > something
> > > > >different, because the loop source cannot be feed with it
> > > > >
> > > > > What do you think is possible in this case?
> > > > >
> > > > > Here is the concept art:
> > > > >
> > > > >
> > > > > ​
> > > > >
> > > >
> > >
> >
>


Re: How to customize the grid to show three s in two rows?

2016-06-22 Thread Chris Poulsen
So:







For each row.

The grid is not meant to handle something like that.

You can roll your own component(s) to render what you need (using loop
etc.) or add an extra cell as a regular grid cell and then use a mixin to
manipulate the html of the grid to introduce a new row containing the cell.
The latter being the most "hackish solution" of the two, IMO.

-- 
Chris

On Wed, Jun 22, 2016 at 8:22 AM, g kuczera  wrote:

> Sorry, the image was not embedded correctly. Here is the link:
> http://i.imgur.com/OlnNVBn.png
>
> (two headers before, three headers after).
> Now I am examining if it's possible to move the third  component down
> (below the other two) via css styling.
>
> 2016-06-22 8:13 GMT+02:00 Chris Poulsen :
>
> > Your post seems incomplete, so it is not clear to me, what you are trying
> > to do.
> >
> > --
> > Chris
> >
> > On Wed, Jun 22, 2016 at 8:05 AM, g kuczera  wrote:
> >
> > > Currently I got a request to add another visible column to the table
> > (grid
> > > component), but the request was for it to be placed below the rest.
> What
> > do
> > > you think the best approach would be in this case? I see three of them:
> > >
> > >- add the mentioned column in the *include* parameter and after
> > >rendering the page move it below the others (is that even possible?)
> > >
> > >  > > source="casesDataSource" include="id, topic, date" row="currentCase"
> > > pagerPosition="none">
> > >
> > >- I tried putting the regular  inside the  with
> > >currentCase.date value, but without having it in the include
> > parameter, but
> > >the grid ignores that and do not render the date value
> > >
> > > ${currentCase.id}
> > >
> > > ${currentCase.topic}
> > >
> > > ${currentCase.date}
> > >
> > >- the last one would be using the loop component, and put the values
> > >inside divs, which can be easily moved around - it would mean for me
> > >changing the casesDataSource (extended GridDataSource) to something
> > >different, because the loop source cannot be feed with it
> > >
> > > What do you think is possible in this case?
> > >
> > > Here is the concept art:
> > >
> > >
> > > ​
> > >
> >
>


Re: How to customize the grid to show three s in two rows?

2016-06-21 Thread Chris Poulsen
Your post seems incomplete, so it is not clear to me, what you are trying
to do.

-- 
Chris

On Wed, Jun 22, 2016 at 8:05 AM, g kuczera  wrote:

> Currently I got a request to add another visible column to the table (grid
> component), but the request was for it to be placed below the rest. What do
> you think the best approach would be in this case? I see three of them:
>
>- add the mentioned column in the *include* parameter and after
>rendering the page move it below the others (is that even possible?)
>
>  source="casesDataSource" include="id, topic, date" row="currentCase"
> pagerPosition="none">
>
>- I tried putting the regular  inside the  with
>currentCase.date value, but without having it in the include parameter, but
>the grid ignores that and do not render the date value
>
> ${currentCase.id}
>
> ${currentCase.topic}
>
> ${currentCase.date}
>
>- the last one would be using the loop component, and put the values
>inside divs, which can be easily moved around - it would mean for me
>changing the casesDataSource (extended GridDataSource) to something
>different, because the loop source cannot be feed with it
>
> What do you think is possible in this case?
>
> Here is the concept art:
>
>
> ​
>


Re: Tapestry5.4.0 'ProgressiveDisplay' ajax call fails to render page on IE 11

2016-06-21 Thread Chris Poulsen
Hi,

Sounds like IE is to blame - for once...

Could it be something with compatibility mode that is acting up?
https://msdn.microsoft.com/en-us/library/ff955410(v=vs.85).aspx

-- 
Chris

On Tue, Jun 21, 2016 at 4:29 PM, sheikh hossain  wrote:

> I wonder if there's any issue with ProgressiveDisplay component on IE11.
>
> One of our pages doesn't load entirely showing only 'Loading ...' message
> when being tested on QA server which has IE11 and Jboss wildfly 10.0.0.
> This page works when we test it locally on IE11 with Jboss wildfly 10.0.0.
>
> But when we deploy on our QA server  the page doesn't load the table list.
> Our tapestry project is part of an existing project which uses other
> platforms like Struts. Every tapestry page gets loaded within an 'iframe'
> when clicking on an menu link.
>
> The .tml file has 'ProgressiveDisplay' component as follows.
>
> 
> 
> - - - - - - -
> - - - - - - -
> 
>   update="show">
>  rowsPerPage="20" t:add="${editColumns}" t:exclude="rowid,saved">
> 
>  t:mixins="common/blockingClick">${zone.name}
> 
> - - - - - - - - -
> - - - - - - - - -
>
> 
> 
>
> and the java page file
>
> @Property
> private TaxZone zone;   // just a pojo
> - - -- - - - -
> - - - - - - -
> @Persist
> @Property
> private CollectionGridDataSource gridDataSource;
>
> @InjectComponent
> private Grid2 grid2; // implements GridModel
>
> void onActivate() {
> final String clientName = request.getParameter("clientName");
> if (clientName != null) {
> componentResources.discardPersistentFieldChanges();
> }
> }
>
>
> Object onProgressiveDisplayFromShowZones() throws ClassNotFoundException,
> SQLException, IOException {
> if (theZones != null) {
> return null;
> }
> try {
> - - - - - - - -
> - - - - - - - - -
> // Get the list of zones from the database.
> // Populate the TreeSet
> theZones = new TreeSet(zones);
>- - - - - --
>  }
>  return null;
>}
>
> On our QA server the flow never calls this
> 'onProgressiveDisplayFromShowZones' method.
>
> The flow goes through the 'onActivate' method. It then calls Tapestry's
> 'ProgressiveDisplay.beginRender(). Where it invokes the
> 'deferredZoneUpdate' from 'zone.js' and from there calls 'onActivate' again
> and shows the empty page.
>
> The page does work on our local machine which is being tested only with the
> tapestry related projects and not with the entire projects.
>
> On QA server I have noticed in the IE browser debug mode that 'zone.js' is
> not getting loaded  and also all other t5/core js files such as 'ajax.js'
> and 'jquery.js'. don't get loaded.
>
> I wonder if our Struts application which has the .jsp page and which
> contains the 'iframe' having any effect on loading the progressivedisplay
> ajax call. Although the tapestry projects are in separate .war file and it
> shouldn't conflict with classloaders of other struts .war files.
> Or there could be an issue with IE11. Although it works locally on IE.
>
> The page also works on chrome and firefox on QA.
>
> I would really greatly appreciate any suggestion or advice as to how to
> research more on this progressivedisplay ajax call or IE related issues if
> any or how to fix this issue.
>
> Thank you all.
>


Re: What pattern to use for service disambiguation based on String input?

2016-05-09 Thread Chris Poulsen
If you create a MappedConfiguration you will end
up with a configuration backed by a map of name->impl.

In your service you inject the mapped configuration, check to see if the
configuration contains a generator for your "string" and use the impl if
that is the case

There are many internal tapestry services that uses this pattern, so I
suggest you check out the source and see how they are created.
(NullFieldStrategySourceImpl and related code could be an example)

-- 
Chris


On Mon, May 9, 2016 at 9:22 AM, Rafael Bugajewski 
wrote:

> > On 2016-07-05, at 09:48 AM, Chris Poulsen 
> wrote:
> >
> > It is not really clear to me what you want to do? Are you talking about
> > picking the correct impl once (during initial application setup) or
> > selecting the impl. per request. Is the "input parameter" something that
> is
> > defined during registry bootstrap or passed in on every call?
>
> The “input parameter” is something that is passed in on every call and
> from which I would have to create a mapping for and which then would
> instantiate the corresponding service. It’s just a string that represents a
> product + product version.
>
> > For the latter you could create a map configuration (name->impl), inject
> > that into your service and lookup the named impl. at run time.
>
>
> But wouldn’t this mean if-else blocks in the service where I lookup the
> implementation depending on my input?
>
> >  On 2016-08-05, at 01:41 PM, Barry Books  wrote:
> >
> > Then I would use a strategy service to actually do the work by passing in
> > the class. This service can be used by the previous service so the
> > Generator service just takes a string and returns the license interface.
>
> If I understand things correctly (and I’m not sure, that’s why I ask) then
> the strategy builder service would be the missing link in my desired
> implementation? I already read about it in the official Tapestry User Guide
> (https://tapestry.apache.org/strategybuilder-service.html), but the
> documentation is rather sparse. I found another article at
> http://blog.tapestry5.de/index.php/2010/05/20/advanced-service-builders-in-tapestry-ioc-strategy-pattern/
> that gives an example. From this quote I would think that a strategy
> builder service is the way to go in my case:
>
> > The StrategyBuilder service creates an implementation which uses all the
> configured strategies behind the scenes. It executes all the ugly
> if-else-statements for you. It analyzes the first parameter of each service
> method to select the appropriate strategy.
>
> That’s basically what I want (or at least think I want). Ideally I would
> supply Tapestry with a mapping “input parameter” → “instance”. A ll of the
> instances would implement the same interface and represent different
> products / license generation schemes. I would just call the LicenseService
> which then – with the help of some Tapestry magic – would discriminate
> based on an input parameter and hence “automatically” call the right
> implementation.
>
> Does this clear some things up? With my current Tapestry knowledge and
> thanks to the help of Chris I would probably add a configuration to my
> service. Then I would check the configuration with if-else blocks and
> return the correct instance. I just wonder where the strategy pattern fits
> in (if it fits in at all?) and if it could help me to save some LOCs?
>
> Best,
> Rafael
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: What pattern to use for service disambiguation based on String input?

2016-05-07 Thread Chris Poulsen
It is not really clear to me what you want to do? Are you talking about
picking the correct impl once (during initial application setup) or
selecting the impl. per request. Is the "input parameter" something that is
defined during registry bootstrap or passed in on every call?

For the prior I suppose you could use modules or symbols or a customized
build method.

For the latter you could create a map configuration (name->impl), inject
that into your service and lookup the named impl. at run time.

--
Chris

On Fri, May 6, 2016 at 7:49 PM, Rafael Bugajewski 
wrote:

> Hello,
>
> I use tapestry-ioc in a Jersey JAX-RS application to access my Tapestry
> services. I have a LicenseService that generates a software license with
> the help of another service. This LicenseGeneratorService has
> implementations for different products Product1LicenseGeneratorServiceImpl,
> Product2LicenseGeneratorServiceImpl, ….
>
> Based on a String input parameter I want tapestry-ioc to let the
> LicenseServiceImpl use the correct LicenseGeneratorService implementation.
>
> What’s the cleanest way / pattern to approach this problem with the help
> of tapestry-ioc?
>
> Best,
> Rafael
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Changing Grid.currentPage persistency to flash

2016-05-02 Thread Chris Poulsen
I haven't used the grid with flash persistence, so I cannot comment on that.

But I just want to let you know that you can control the behavior of
@Persist inside the Grid using "Persistence Strategy Inheritance" (
http://tapestry.apache.org/persistent-page-data.html ) without having to
alter the component itself.

--
Chris

On Mon, May 2, 2016 at 11:12 AM, Davide Vecchi  wrote:

> Hi everybody
>
> I see that the instance field that holds the current page number of a grid
> (org.apache.tapestry5.corelib.components.Grid.currentPage) is annotated
> with @Persist .
>
> This has the probably desirable effect that f.ex. if I am on webpage A and
> it has a grid and I browse to its page #2 and then I go to another webpage
> and then I go back to webpage A its grid is still on its page #2 where I
> had left it.
>
> However in my case this is not desirable and I would prefer that the grid
> page number is not remembered across different webpages.
>
> Removing the @Persist annotation of Grid.currentPage instance field
> altogether would cause the impossibility to browse grid pages at all
> because the grid pager does a page reload and this loses the currentPage
> value, but persisting that value just until the next request - to preserve
> that value during the page reload  - seems to work fine: I changed the
> annotation from
>
> @Persist
>
> to
>
> @Persist(PersistenceConstants.FLASH)
>
> and I'm testing my pages to make sure this works. However I am also
> wondering if in theory changing that persistency to flash might be a bad
> idea for reasons that I don't know and that my tests so far are not
> showing. Does anyone have any opinion about this ?
>


Re: Change grid on "onSuccess"

2016-04-27 Thread Chris Poulsen
When you need to persist non-trivial state (and not want to put it in the
session, like standard @Persist does), you need to help tapestry figure out
how to map between a String and the persistent state.

There are some coercers for the most trivial types and projects like
tapestry-hibernate/jpa also automatically let tapestry know how to map
between String and Entity instances.

Some tapestry components allows you to register an encoder for the mapping
back and forth and on some pages you might need to perform the mapping
manually ( using activate/passivate )

Barry suggested a variation of this (because the parameter he passes is a
String which requires no further translation) and then you have the chance
to initialize "users" prior to rendering.

Beware that setupRender phase is not always executed; ajax requests, form
submissions etc. may bypass it - Activate is always performed - So one
should be careful about the amount of work performed during activation.


> And Tapestry thinks "model.Street$0040141f225" is a String but it should
be
> a Bean.
>
> I tried adding Serializable on my Street bean but it doesn't change the
> error.

As tapestry does not know how to map from your "Street"  instance to a
String, if attempts to use the ordinary Java toString(), probably resulting
in something like "Street@141f225" and when this string is passed back in,
it has no chance of getting back to the correct Street instance.

A ValueEncoder could probably do this for you automatically (you
have to let it know how to map from your instance to a String and back
again).

Another possibility is to remove the @Activation* parameters and perform
the mapping in the page activate/passivate methods.

HTH.

-- 
Chris



On Wed, Apr 27, 2016 at 8:20 AM, Morgan Hautman 
wrote:

> Hi,
>
> I didn't managed to get it work with @ActivationRequestParameter.
> I tried everything out and the last try was with @Persist and it worked, so
> I'm keeping that because nothing else works..
>
> Thank you all.
>
> Regards,
> Morgan
>
> 2016-04-26 13:06 GMT+02:00 Barry Books :
>
> > Sorry my previous response a bit short. I was on my phone. Something like
> > this hibernate example should work. It's better to store the query
> > parameters in the URL instead of the session. If you use the session
> > returning to the page will rerun the last query which seems a bit weird
> for
> > a web app. All the work is done in setupRender instead of onSuccess
> because
> > onSuccess ends with a redirect so no page is rendered.
> >
> > @Property
> > List users;
> >
> > @Property
> > @ActivationRequestParameter
> > String lastName;
> >
> > @Inject
> > Session session;
> >
> > @SetupRender
> > void setupRender() {
> >   if ( lastName != null ) {
> >   users = session.createQuery(" from User where lastName =
> > :lastName").setParameter("lastName",lastName).list();
> >   }
> > }
> >
> >
> >
> >
> > On Tuesday, April 26, 2016, Morgan Hautman 
> > wrote:
> >
> > > Hi,
> > >
> > > The problem was that I had no get/setters in my Bean I displayed..
> > >
> > > Now it renders well on the first page but when I click on the second
> > page I
> > > have:
> > >
> > > Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: Could
> not
> > > find a coercion from type java.lang.String to type java.util.Set.
> > >
> > > I think this is because the url looks like this:
> > >
> > >
> >
> http://localhost:8090/***/searchstreet.grid.pager/2?t:ac=model.Street$0040141f225/model.Street$0040868971
> > > .
> > > ..
> > >
> > > And Tapestry thinks "model.Street$0040141f225" is a String but it
> should
> > be
> > > a Bean.
> > >
> > > I tried adding Serializable on my Street bean but it doesn't change the
> > > error.
> > >
> > > Any idea?
> > >
> > > Regards,
> > > Morgan
> > >
> > >
> > > 2016-04-25 16:05 GMT+02:00 Barry Books  > >:
> > >
> > > > Use @pageactvation context and put what's in your onSucess method in
> > > > setupRender
> > > >
> > > > On Monday, April 25, 2016, Morgan Hautman  > > >
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > Thank you guys.
> > > > > I first tried the fix stated by Felix (@PageActivationContext) but
> it
> > > > > doesn't work.
> > > > > I then tried the ajax way Nathan provided and I have better results
> > but
> > > > my
> > > > > grid shows 4 pages/links but I don't see any data.
> > > > >
> > > > > I added
> > > > >
> > > > > 
> > > > > 
> > > > > 
> > > > > *[Grid here]*
> > > > > 
> > > > > 
> > > > >
> > > > > but still no luck, any one has a pointer?
> > > > >
> > > > > Regards,
> > > > > Morgan
> > > > >
> > > > > 2016-04-25 12:07 GMT+02:00 Nathan Quirynen <
> > > nat...@pensionarchitects.be 
> > > > > >:
> > > > >
> > > > > > Hey,
> > > > > >
> > > > > > By returning "this" in the onSuccess event, a redirect happens
> > > > resulting
> > > > > > in a new request. If you want to preserve data between requests,
> > you
> > > > will
> > > > > 

Re: Paged grid with checkbox's fails when switching page

2016-04-13 Thread Chris Poulsen
You can roll your own version of the grid. We have done this to support
filters, include context in pagination links, have better control over the
zone updates etc. I do not think the built in grid/tree components was ever
intended to handle all possible cases.

-- 
Chris

On Thu, Apr 14, 2016 at 4:08 AM, JumpStart <
geoff.callender.jumpst...@gmail.com> wrote:

> I have a lateral suggestion that you might not like. My design “rule of
> thumb” is to use a paged grid for display only. I find it ambiguous to use
> for create/update/delete because when you change pages, or click on a
> column to re-sort the grid, or change the value of a filter field (if you
> have one), then it is not at all clear that it should remember the changes
> you’ve made to fields.
>
> Just my two cents worth.
>
> Geoff
>
> > On 13 Apr 2016, at 9:12 PM, Thiago H de Paula Figueiredo <
> thiag...@gmail.com> wrote:
> >
> > On Tue, 12 Apr 2016 08:32:29 -0300, Ricardo Veloso <
> ricardo.vel...@flowinn.biz> wrote:
> >
> >> Obrigado! :)
> >
> > De nada! É um prazer ajudar!
> >
> > Translating from Portuguese to English:
> >
> >> Thanks!
> >
> > You're welcome! It's a plasure to help!
> >
> >> Issue opened: TAP5-2542 <
> https://issues.apache.org/jira/browse/TAP5-2542>
> >
> > Thanks!
> >
> >> Meanwhile I will try to get a workaround for this, simulating a checkbox
> >> with images and trigger an event when is checked, in order to get things
> >> done on time.
> >
> > You can use an ordinary HTML checkbox (, without
> a t:type attribute), so you don't need to use images. Or maybe you could
> use some AJAX, keeping the checkbox or changing it to an EventLink.
> >
> > --
> > 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: tapestry 4.1.6 and pergmen question

2016-04-06 Thread Chris Poulsen
You could try "CMSClassUnloadingEnabled" to see if that helps

-- 
Chris

On Wed, Apr 6, 2016 at 11:24 PM, Kalle Korhonen 
wrote:

> If you run out of permgen space very quickly, then it's indicative that the
> allocated permgen space is simply too small. Perhaps the new version of
> Tomcat requires more of it for itself, leaving less for your application.
> Is the webapp restarted at times? If so, that can easily cause permgen
> space to fill up because of the way OGNL works. And even if you are not
> restarting the app, you need to exercise all parts of your web application
> to find out the true permgen space consumption of it.
>
> Kalle
>
> On Wed, Apr 6, 2016 at 1:49 PM, Ivano Luberti 
> wrote:
>
> > Hey Tony, if you don't mind, can you send me all the configuration
> > options of Java and Tomcat you are using? So tomcat6.conf and server.xml
> > files?
> >
> > No one else on the list can share its thoughts?
> >
> > Il 05/04/2016 23:03, Ivano Luberti ha scritto:
> > > Hi Tony thanks for the quick answer:
> > >
> > > Il 05/04/2016 21:50, Tony Nelson ha scritto:
> > >> I still have a Tapestry 4 app running with Tomcat 6.0.41, and it runs
> > well enough with:
> > >>
> > >> -XX:MaxPermSize=1024m
> > > with that setting it fails but...
> > >> I also have
> > >>
> > >> -Xmx12g -Xms4g -XX:+UsseConcMarkSweepGC -XX:+UseParNewGC
> > > I have only  -Xmx2g
> > >
> > > I use
> > >
> > > -XX:+UseConcMarkSweepGC
> > >
> > > but not
> > >
> > > -XX:+UseParNewGC
> > >
> > >
> > > but this last one doesn't seem to have an influence on PermGen, does
> it?
> > >
> > >
> >
> > --
> > ==
> > dott. Ivano Mario Luberti
> > Archimede Informatica societa' cooperativa a r. l.
> > Sede Operativa
> > Via Gereschi 36 - 56126- Pisa
> > tel.: +39-050- 580959
> > tel/fax: +39-050-8932061
> > web: www.archicoop.it
> > ==
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>


Re: render nested component

2016-03-21 Thread Chris Poulsen
ventLink
> <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/ComponentResourcesCommon.java#ComponentResourcesCommon.createEventLink%28java.lang.String%2Cjava.lang.Object%5B%5D%29
> >("expandChildren",
> node.getId <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/tree/TreeNode.java#TreeNode.getId%28%29
> >());
>
> 179 <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/corelib/components/Tree.java#179
> >
>
> <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/corelib/components/Tree.java#
> >
>
> Link
> <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/Link.java#Link
> >
> markExpanded = resources
> <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/corelib/components/Tree.java#Tree.0resources
> >.createEventLink
> <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/ComponentResourcesCommon.java#ComponentResourcesCommon.createEventLink%28java.lang.String%2Cjava.lang.Object%5B%5D%29
> >("markExpanded",
> node.getId <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/tree/TreeNode.java#TreeNode.getId%28%29
> >());
>
> 180 <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/corelib/components/Tree.java#180
> >
>
> <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/corelib/components/Tree.java#
> >
>
> Link
> <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/Link.java#Link
> >
> markCollapsed = resources
> <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/corelib/components/Tree.java#Tree.0resources
> >.createEventLink
> <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/ComponentResourcesCommon.java#ComponentResourcesCommon.createEventLink%28java.lang.String%2Cjava.lang.Object%5B%5D%29
> >("markCollapsed",
> node.getId <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/tree/TreeNode.java#TreeNode.getId%28%29
> >());
>
> 181 <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/corelib/components/Tree.java#181
> >
>
> <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/corelib/components/Tree.java#
> >
>
> 182 <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/corelib/components/Tree.java#182
> >
>
> <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/corelib/components/Tree.java#
> >
>
> spec.put
> <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-json/5.3.1/org/apache/tapestry5/json/JSONObject.java#JSONObject.put%28java.lang.String%2Cjava.lang.Object%29
> >("expandChildrenURL",
> expandChildren.toString
> <
> http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/java/lang/Object.java#Object.toString%28%29
> >())
>
> 183 <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/corelib/components/Tree.java#183
> >
>
> <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1/org/apache/tapestry5/corelib/components/Tree.java#
> >
>
> .put
> <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-json/5.3.1/org/apache/tapestry5/json/JSONObject.java#JSONObject.put%28java.lang.String%2Cjava.lang.Object%29
> >("markExpandedURL",
> markExpanded.toString
> <
> http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/java/lang/Object.java#Object.toString%28%29
> >())
>
> 184 <
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tapestry/tapestry-core/5.3.1

Re: render nested component

2016-03-19 Thread Chris Poulsen
Hi,

Take a look at the Tapestry Tree component to see how recursive rendering
can be done.

-- 
Chris

On Fri, Mar 18, 2016 at 6:17 AM, Qbyte Consulting  wrote:

> I am creating a Menu component (for a ul tag) that needs to
> programmatically generate the child links.
>
> I already have a MenuItem component, but this is parameter bound to a
> template, whereas now I need to programmatically drive the parameters.
>
> I either need to be able to create the existing MenuItem objects somehow in
> the Menu component and render them, or I simply write the links out in the
> menu - however since my Menu component isn't extending AbstractLink (like
> MenuItem) I can't use writeLink().
>
> Any ideas what is the simplest approach to resolve this? Code below.
>
> John
>
>
> public class Menu {
>
> /** The text. */
> @Parameter(required = true, allowNull = false, defaultPrefix =
> BindingConstants.LITERAL)
> private String name;
>
> /** The resources. */
> @Inject
> private ComponentResources resources;
>
> /** The component source. */
> @Inject
> private ComponentSource componentSource;
>
> @Inject
> private PageRenderLinkSource linkSource;
>
> /** The messages. */
> @Inject
> private Messages messages;
>
> @Inject
> private MenuService menuService;
>
> /** The state bean. */
> @SessionState(create = false)
> private SessionStateBean stateBean;
>
> /**
>  * If provided, this is the activation context for the target page (the
>  * information will be encoded into the URL). If not provided, then the
>  * target page will provide its own activation context.
>  */
> @Parameter
> private Object[] context;
>
> /**
>  * Begin render.
>  *
>  * @param writer the writer
>  */
> void beginRender(MarkupWriter writer) {
> writer.element("ul");
> for (String pageName :
> menuService.getPageNames(MenuService.Menu.valueOf(name))) {
> renderMenuItem(pageName, writer);
> }
> }
>
> private void renderMenuItem(String page, MarkupWriter writer) {
> Link link = resources.createPageLink(page,
>resources.isBound("context"), context);
>writer.element("li");
> NO!!writeLink(writer, link);
>  writer.writeRaw(messages.get(page.toLowerCase().concat(".link")));
> writer.end();
> writer.end();
> }
>
> /**
>  * After render.
>  *
>  * @param writer the writer
>  */
> void afterRender(MarkupWriter writer) {
>writer.end();
> }
> }
>
>
> public class MenuItem extends AbstractLink {
>
> /**
>  * The logical name of the page to link to.
>  */
> @Parameter(required = true, allowNull = false, defaultPrefix =
> BindingConstants.LITERAL)
> private String page;
>
> /** The text. */
> @Parameter(required = true, allowNull = false, defaultPrefix =
> BindingConstants.LITERAL)
> private String text;
>
> /** The resources. */
> @Inject
> private ComponentResources resources;
>
> /** The component source. */
> @Inject
> private ComponentSource componentSource;
>
> /** The state bean. */
> @SessionState(create = false)
> private SessionStateBean stateBean;
>
> /**
>  * If provided, this is the activation context for the target page (the
>  * information will be encoded into the URL). If not provided, then the
>  * target page will provide its own activation context.
>  */
> @Parameter
> private Object[] context;
>
> /**
>  * Begin render.
>  *
>  * @param writer the writer
>  */
> void beginRender(MarkupWriter writer) {
> if (isDisabled())
>return;
>Link link = resources.createPageLink(page,
>resources.isBound("context"), context);
>writer.element("li");
>writeLink(writer, link);
>writer.writeRaw(text);
> }
>
> /**
>  * After render.
>  *
>  * @param writer the writer
>  */
> void afterRender(MarkupWriter writer) {
> if (isDisabled())
>return;
> writer.end();
> writer.end();
> }
> }
>


Re: SSL on url demand

2016-03-10 Thread Chris Poulsen
I has been a long while since I looked at this, but as far as i can
remember that setting allows the application to work in both http / https
mode depending on the protocol specified by the request (we use T5.4) - so
if the page is requested using https all links that are generated are
respecting that.

-- 
Chris

On Thu, Mar 10, 2016 at 12:34 PM, h3ph3st0s  wrote:

> Chris hi,
> thanks for the answer but this is already tested & it works. But it is
> hard-coded and practically does not allow me to switch on or off the
> overall SSL context per user request.
>
> I have seen other applications that work either http or https
> simultaneously without redeploying new compiled code.
> Is there a way to accomplish this with tapestry ( for java and javascript
> part ) framework version 5.3?
>
> Regards
> Dimitri
>
> On 2016-03-10 12:40, Chris Poulsen wrote:
>
>> I think we're handling it like this:
>>
>> // default to non-secure pages (allows us to support both http and https
>> based on the incoming request)
>> configuration.add( SymbolConstants.SECURE_ENABLED, "false" );
>>
>> HTH.
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: SSL on url demand

2016-03-10 Thread Chris Poulsen
I think we're handling it like this:

// default to non-secure pages (allows us to support both http and https
based on the incoming request)
configuration.add( SymbolConstants.SECURE_ENABLED, "false" );

HTH.

-- 
Chris

On Thu, Mar 10, 2016 at 3:36 AM, JumpStart <
geoff.callender.jumpst...@gmail.com> wrote:

> The simple answer is - the whole world is being moved to HTTPS very
> rapidly so just go with it, for EVERY request. See
> http://motherboard.vice.com/read/google-will-soon-shame-all-websites-that-are-unencrypted-chrome-https
>
> To do this, in your AppModule just set
>
> configuration.add(MetaDataConstants.SECURE_PAGE, "true”);
>
> then in production, staging, UAT, etc. set this system property...
>
> -Dtapestry.secure-enabled=true
>
> and in development you might like to turn it off…
>
> -Dtapestry.secure-enabled=false
>
> Alternatively, if you really must allow some requests to use HTTP, then
> follow the tips in here:
>
> http://tapestry.apache.org/https.html
>
> HTH,
>
> Geoff
>
> > On 9 Mar 2016, at 9:56 PM, h3ph3st0s  wrote:
> >
> > Hi,
> >
> > I built a small tapestry page under jboss. I read that in order to apply
> SSL I had to either put @Secure annotation or configure with
> > configuration.add(MetaDataConstants.SECURE_PAGE, "true");
> >
> > Everything is ok with that, but my issue how can I make this to be
> reconfigured each time depending the url if it has "http" or "https" and
> without restarting application server.
> >
> > The request is that the application should be accessed with or without
> SSL. Jboss is configured ok. But I am stack with this hardcoded "true".
> >
> > Can I override it ?
> > Is there any other workaround ?
> >
> > Just for clarification I wanted something like that ( depending on the
> url ) :
> > String jbossDir= System.getProperty("jboss.server.base.dir");
> >System.out.println(jbossDir);
> >Properties appProp = new Properties();
> >try {
> >appProp.load(new BufferedInputStream(new
> FileInputStream(String.format("%s/app.properties", jbossDir ) )));
> >String ssl = appProp.getProperty("SSL");
> >if ( ssl !=null ) {
> >ssl = ssl.toLowerCase().trim();
> >}
> > *configuration.add(MetaDataConstants.SECURE_PAGE, ssl);*
> >} catch (FileNotFoundException e) {
> >configuration.add(MetaDataConstants.SECURE_PAGE, "true");
> >e.printStackTrace();
> >} catch (IOException e) {
> >configuration.add(MetaDataConstants.SECURE_PAGE, "true");
> >e.printStackTrace();
> >}*
> > **
> > *
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: jss.require(...) code is not executed when using ajaxResponseRenderer.addCallback(new JavaScriptCallback())

2016-02-06 Thread Chris Poulsen
At work we have a product that push javascript commands back to the client
in ajax calls using this technique (T5.4) and it has newer been problematic.

Let me try to explain why I guess the library should be the first place to
look:

I'm guessing that the atmosphere lib plugs into the tapestry processing and
attempts to map between "normal" ajax responses from tapestry and something
that can be delivered through a websocket channel - The library probably
also handles receiving the "something" from the channel on the client side
and determines how to apply the commands from the payload.

Lots of people have the plain JS callback mechanism working correctly,
while you have a pretty complicated piece of code in your setup (a lib that
I'm not even sure is widely used) altering how tapestry output is delivered
and interpreted on the client, possibly performing its own
encoding/decoding of the messages sent. And you are sure that it works
flawlessly, because it seems to be able to perform zone updates correct?

I'm sure that if you can produce a simple failing example without third
party libs. polluting the picture you would have much more luck getting
some responses/the issue fixed... (given that it actually is an issue with
the framework).

-- 
Chris

On Sat, Feb 6, 2016 at 11:13 PM, danny de cock 
wrote:

> the atmos library works fine with the chatdemo page and the table in
> index.java gets updated correctly...
> it seems to me that the jss.require(..).invoke(..).with(..) is not
> executed correctly...
> I think the jss that is triggered through the "new
> JavaScriptCallback().run(JavaScriptSupport jss)" does not function
> correctly...
>
> On 6 February 2016 at 21:45, Chris Poulsen  wrote:
> > Your "onStockPriceReceived2" seems to be triggered from some atmos
> library
> > callback.
> >
> > As your AddPoint button clearly works, then I think it is a stretch to
> say
> > that the callback stuff does not work - It does not work when using the
> > atmos library, but does when called the "normal" way.
> >
> > You should probably start off by making sure that the third party library
> > (atmos) actually works like you expect.
> >
> > --
> > Chris
> >
> >
> >
> > On Sat, Feb 6, 2016 at 9:06 PM, g  wrote:
> >
> >> hello,
> >>
> >> I stripped down the demo to make it easy to test and illustrate the
> issue
> >> :)
> >>
> >> you can download a working project from
> >>
> >>
> http://gwiki.be/tapestry/tapestry-atmosphere-cometd-demo.5.4.0.simplified.tgz
> >>
> >> after unpacking the tar file and executing `mvn jetty:run`, the page
> >> http://localhost:8080/ will show a graph and a table.
> >>
> >> after a couple of seconds, the table will start showing updates. if
> >> the javascript calls would be executed fine, the graph would follow
> >> the updates shown in the table.
> >>
> >> you will see straightforward feedback in the console where you
> >> executed the mvn jetty:run.
> >>
> >> the javascript code that is added through the addDataPoint call in
> >> line 69 of org.lazan.t5.atmosphere.demo.pages.Index.java is not
> >> executed, where the same call to addDataPoint gets executed when
> >> called by addRandomPoint in afterRender and onSuccess.
> >>
> >> click the 'AddPoint' button a couple of times to confirm that the same
> >> addCallback gets executed correctly when clicked interactively, but
> >> not when called automatically...
> >>
> >> thanks for your feedback, g.
> >>
> >> On 5 February 2016 at 13:33, danny de cock 
> wrote:
> >> > yes, they are ajax calls...  I will produce a stripped-down version of
> >> > the project that illustrates the problem...  when adding a submit
> >> > button that executes the same javascript script or when called from
> >> > afterRender, it works, when called through the onAjaxEvent call, it
> >> > does not...
> >> >
> >> > will upload the source  this evening...
> >> >
> >> > thanks, g.
> >> >
> >> > On 5 February 2016 at 13:00, JumpStart
> >> >  wrote:
> >> >> Crazy thought, but have you confirmed with a web inspector that your
> >> request is XHR?
> >> >>
> >> >>> On 5 Feb 2016, at 6:59 PM, g  wrote:
> >> >>>
> >> >>> yes, the js file is a module and is found in META-INF/modules.
> >> >>>
> >> >>> the file look

Re: jss.require(...) code is not executed when using ajaxResponseRenderer.addCallback(new JavaScriptCallback())

2016-02-06 Thread Chris Poulsen
Your "onStockPriceReceived2" seems to be triggered from some atmos library
callback.

As your AddPoint button clearly works, then I think it is a stretch to say
that the callback stuff does not work - It does not work when using the
atmos library, but does when called the "normal" way.

You should probably start off by making sure that the third party library
(atmos) actually works like you expect.

-- 
Chris



On Sat, Feb 6, 2016 at 9:06 PM, g  wrote:

> hello,
>
> I stripped down the demo to make it easy to test and illustrate the issue
> :)
>
> you can download a working project from
>
> http://gwiki.be/tapestry/tapestry-atmosphere-cometd-demo.5.4.0.simplified.tgz
>
> after unpacking the tar file and executing `mvn jetty:run`, the page
> http://localhost:8080/ will show a graph and a table.
>
> after a couple of seconds, the table will start showing updates. if
> the javascript calls would be executed fine, the graph would follow
> the updates shown in the table.
>
> you will see straightforward feedback in the console where you
> executed the mvn jetty:run.
>
> the javascript code that is added through the addDataPoint call in
> line 69 of org.lazan.t5.atmosphere.demo.pages.Index.java is not
> executed, where the same call to addDataPoint gets executed when
> called by addRandomPoint in afterRender and onSuccess.
>
> click the 'AddPoint' button a couple of times to confirm that the same
> addCallback gets executed correctly when clicked interactively, but
> not when called automatically...
>
> thanks for your feedback, g.
>
> On 5 February 2016 at 13:33, danny de cock  wrote:
> > yes, they are ajax calls...  I will produce a stripped-down version of
> > the project that illustrates the problem...  when adding a submit
> > button that executes the same javascript script or when called from
> > afterRender, it works, when called through the onAjaxEvent call, it
> > does not...
> >
> > will upload the source  this evening...
> >
> > thanks, g.
> >
> > On 5 February 2016 at 13:00, JumpStart
> >  wrote:
> >> Crazy thought, but have you confirmed with a web inspector that your
> request is XHR?
> >>
> >>> On 5 Feb 2016, at 6:59 PM, g  wrote:
> >>>
> >>> yes, the js file is a module and is found in META-INF/modules.
> >>>
> >>> the file looks as follows:
> >>> define(["jquery"], function($) {
> >>>var privateFunc = function(args) {
> >>>alert('bingo! it works! ==');
> >>>var arg=args.arg;
> >>>console.log('arg',arg);
> >>>};
> >>>return { publicFunc: privateFunc};
> >>>});
> >>>
> >>> this is a simplification of the javascript file of
> >>>
> https://stackoverflow.com/questions/18796381/tapestry-5-4-call-jquery-more-than-once
> >>>
> >>> the difference between my code and probably your and Geoff's code is
> >>> that I call the ajaxResponseRender.addCallback(...) directly from an
> >>> onAjaxEvent() method and that you are using the ajaxResponseRender it
> >>> only if request.isXHR() is true:
> >>>void onEventHandler(...) {
> >>>if (request.isXHR()) {
> >>>ajaxResponseRenderer.addCallback(new JavaScriptCallback...);
> >>>}
> >>>}
> >>>
> >>> where my handler is structured without the request test:
> >>>void onEventHandler(...) {
> >>>ajaxResponseRenderer.addCallback(new JavaScriptCallback...);
> >>>}
> >>>
> >>> I have already tested whether adding the test would solve the issue,
> >>> but to no avail...
> >>>
> >>> I am porting the cometd-demo from uklance (cf.
> >>> https://github.com/uklance/tapestry-cometd) to tapestry 5.4.  this is
> >>> a push application in which this addCallback structure without the
> >>> request.isXHR-test works fine in 5.3.8...
> >>>
> >>> thanks for your feedback, g.
> >>>
> >>> On 5 February 2016 at 11:23, Carlos Montero Canabal
> >>>  wrote:
>  Hi,
> 
>  Your js file you required is a js module??? I use many times require
> in a callback in tapestry 5.4.0 and it works perfect.
> 
>  Regards
> 
>  Carlos Montero
> 
>  Enviado desde mi iPhone
> 
> > El 5 feb 2016, a las 2:15, g  escribió:
> >
> > hello geoff,
> >
> > thanks for your feedback, and indeed: I believe it looks very much
> > like a tapestry 5.4 bug ;-)
> >
> > thanks & kind regards, g.
> >
> > On 5 February 2016 at 02:00, JumpStart
> >  wrote:
> >> Sorry, just looked at your stack overflow example and I’m baffled
> as to why it wouldn’t work.
> >>
> >> Geoff
> >>
> >>> On 5 Feb 2016, at 8:55 AM, JumpStart <
> geoff.callender.jumpst...@gmail.com> wrote:
> >>>
> >>> Here are some working examples that may help.
> >>>
> >>> In a callback:
> >>>
> >>>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/modal/1
> >>>
> >>> In afterRender:
> >>>
> >>>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/robust
> >>>
> >>> Geoff
> >>>
>  On

Re: [5.4] request from javascript to Tapestry event

2016-02-05 Thread Chris Poulsen
Faking a "click" on an invisible async eventlink could also be a very
simple way to get this working without having to mock around with much
javascript.

-- 
Chris

On Fri, Feb 5, 2016 at 3:04 PM, Chris Poulsen 
wrote:

> Have a look at http://tapestry.apache.org/current/coffeescript/ajax.html
>
> --
> Chris
>
> On Fri, Feb 5, 2016 at 2:54 PM, Nathan Quirynen <
> nat...@pensionarchitects.be> wrote:
>
>> Hi,
>>
>> I have finally started the process of updating to 5.4.
>> Some components have an initializer javascript where an eventlink url is
>> passed as a parameter to be used as the url for a request from javascript
>> to a Tapestry event.
>> To handle the response (zone updates, scripts, ..) I added in the request
>> callback function the following:
>>
>> $.get(spec.eventLink, function(r) {
>>
>> if (r.zones) {
>> $.each(r.zones, function(zoneId){
>> $('#' + zoneId).tapestryZone("applyContentUpdate",
>> r.zones[zoneId]);
>> });
>> }
>>
>> if (r.updateZone) {
>> var spec = {
>> url: r.updateZone.url,
>> params: r.updateZone.params
>> };
>> $('#' + r.updateZone.zoneId).tapestryZone("update", spec);
>> }
>> $.tapestry.utils.loadScriptsInReply(r);
>>
>> });
>>
>> I thought this was not the best solution, but did not find another one at
>> the moment and it worked.
>> Now in 5.4 it does not work anymore, so how do I have to fire requests to
>> tapestry events from javascript and make it handle the response?
>>
>> Nathan
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>


Re: [5.4] request from javascript to Tapestry event

2016-02-05 Thread Chris Poulsen
Have a look at http://tapestry.apache.org/current/coffeescript/ajax.html

-- 
Chris

On Fri, Feb 5, 2016 at 2:54 PM, Nathan Quirynen  wrote:

> Hi,
>
> I have finally started the process of updating to 5.4.
> Some components have an initializer javascript where an eventlink url is
> passed as a parameter to be used as the url for a request from javascript
> to a Tapestry event.
> To handle the response (zone updates, scripts, ..) I added in the request
> callback function the following:
>
> $.get(spec.eventLink, function(r) {
>
> if (r.zones) {
> $.each(r.zones, function(zoneId){
> $('#' + zoneId).tapestryZone("applyContentUpdate",
> r.zones[zoneId]);
> });
> }
>
> if (r.updateZone) {
> var spec = {
> url: r.updateZone.url,
> params: r.updateZone.params
> };
> $('#' + r.updateZone.zoneId).tapestryZone("update", spec);
> }
> $.tapestry.utils.loadScriptsInReply(r);
>
> });
>
> I thought this was not the best solution, but did not find another one at
> the moment and it worked.
> Now in 5.4 it does not work anymore, so how do I have to fire requests to
> tapestry events from javascript and make it handle the response?
>
> Nathan
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Commit After not working after migrating to IntelliJ

2016-02-04 Thread Chris Poulsen
I have not used the hibernate integration myself. But my guess is that you
should depend on tapestry-hibernate instead of tapestry-hibernate-core
As far as I can tell from the sources, the CommitAfterWorker class lives in
that module.

HTH.

-- 
Chris

On Thu, Feb 4, 2016 at 2:39 PM, abangkis  wrote:

> Hi Dmitry, thanks for the response. I understand that if you wan't to do a
> commit from your DAO (for example if your DAO is invoke by a scheduler, or
> other non user interaction) you need to add the transaction advice. But in
> my understanding if the action is from a tapestry page, you just need to
> add the commit after annotation on the page. I did this successfully in a
> few project when I'm still using eclipse. So i was wondering if this an
> intellij/jetty/gradle thing that a more experienced user of the IDE might
> know.
>
> On another note, this is also the first time I''m using maven based
> dependency, maybe there's something on there too :)
>
> On Thu, Feb 4, 2016 at 8:29 PM, Dmitry Gusev 
> wrote:
>
> > Hi,
> >
> > I think you're missing the transaction advice, it's mentioned at the
> bottom
> > on this page:
> > https://tapestry.apache.org/hibernate-user-guide.html
> >
> > Finally, you should use the HibernateTransactionAdvisor to add
> transaction
> > advice:
> > @Match("*DAO")
> > public static void adviseTransactions(HibernateTransactionAdvisor
> advisor,
> > MethodAdviceReceiver receiver)
> > {
> > advisor.addTransactionCommitAdvice(receiver);
> > }
> >
> > This advice method is configured to match against any service whose id
> ends
> > with "DAO", such as "PersonDAO".
> >
> > The advisor scans the service interface and identifies any methods with
> the
> > @CommitAfter annotation.
> >
> > On Thu, Feb 4, 2016 at 4:03 PM, abangkis  wrote:
> >
> > > I managed to setup and import the simple project to github if anyone
> have
> > > the time to look at it. https://github.com/abangkis/CommitTest. First
> > time
> > > using git, let me know if something is missing.
> > >
> > > Thanks
> > >
> > > On Thu, Feb 4, 2016 at 5:53 AM, abangkis  wrote:
> > >
> > > > Hello, I've just recently migrated from Eclipse + Ant + Tomcat to
> > > IntelliJ
> > > > IDEA 15 CE + Gradle + Jetty. At first all of my development setup is
> > > > working fine and then I realized that my @CommitAfter annotation is
> not
> > > > being honored, while other query runs fine. I'm using Tapestry 5.4.0
> > from
> > > > jcenter.
> > > >
> > > > To confirm my problem, I created a simple project with a single page
> > with
> > > > an add method:
> > > >
> > > > @CommitAfter
> > > > public void onActionFromAdd(){
> > > > logger.debug("trying add with commit after");
> > > >
> > > > User user = new User();
> > > > user.setPassword("");
> > > > user.setName("testing user 3");
> > > >
> > > > userManager.add(user);
> > > > //try {
> > > > //manager.commit();
> > > > //} catch (Exception e) {
> > > > //e.printStackTrace();
> > > > //}
> > > >
> > > > }
> > > >
> > > >
> > > > If i manually commit using Injected HibernateSessionManager in the
> > page,
> > > > it will work. But using @CommitAfter annotation isn't. Anybody know
> why
> > > is
> > > > this happening?
> > > >
> > > > Thanks
> > > >
> > > > --
> > > > http://www.mreunionlabs.net/ 
> > > > twitter : @mreunionlabs @abangkis
> > > > page : https://plus.google.com/104168782385184990771
> > > >
> > >
> > >
> > >
> > > --
> > > http://www.mreunionlabs.net/ 
> > > twitter : @mreunionlabs @abangkis
> > > page : https://plus.google.com/104168782385184990771
> > >
> >
> >
> >
> > --
> > Dmitry Gusev
> >
> > AnjLab Team
> > http://anjlab.com
> >
>
>
>
> --
> http://www.mreunionlabs.net/ 
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>


Re: 5.4-rc-1 - problem when *add* a column to a *grid*, but it is working OK in 5.4-beta-26

2015-12-14 Thread Chris Poulsen
I don't know what you mean by having tried many library combinations. But
Tapestry related libs should all be the same version and without duplicates
in your runtime.

The error you are getting happens because the BeanModel for your grid
already contains a property called "delete".

So if you actually tried using  and got the error, something is really off...

You can try to attach a debugger to either Grid, BeanModelUtils or
BeanModelImpl to see what your generated model contains... or create / bind
a bean model explicitly and debug using that.

-- 
Chris

On Mon, Dec 14, 2015 at 12:04 PM, Vangel V. Ajanovski 
wrote:

> First of all, I have made a mistake in the subject - it was supposed to be
> 5.4-rc-1
>
> On 14.12.2015 09:18, Chris Poulsen wrote:
>
>> show. (If you are not using include, a number of things can go wrong like:
>> the Degree class may evolved, the hibernate stuff may have added extra
>> runtime properties that the introspector is picking up, the JDK version
>> may
>> have changed which means that the introspector behavior may have changed,
>> new data type analyzers may have been added etc.)
>>
> The added property is not a member of this class properties, so I see no
> real reason why including the other properties should matter. But, I do get
> why you are suggesting that.
>
> On the other hand, I would prefer not to use the "include" since it
> polutes the (H)THML with with internal (read: database) details. On the
> other hand, "add" is just a view layer thing, since you add an interaction
> element to the (H)TML.
>
> But, this debate is fruitless, because it does not matter.
> I tried using "include", the problem remains.
>
> I guess the real reason for this happening is some incompatibility,
> between some of the libraries, but I have spent many hours to find the
> problem and tried many combinations  without luck. So any ideas towards
> finding a solution would be great.
>
>


Re: 5.4-ga-1 - problem when *add* a column to a *grid*, but it is working OK in 5.4-beta-26

2015-12-14 Thread Chris Poulsen
Hi,

I don't know if there is an issue with the GA, but you are relying on
introspection to find your bean properties; that is asking for trouble IMO.

Always use property whitelisting to achieve a stable set of properties for
your grids. Basically make sure to "include" the properties you want to
show. (If you are not using include, a number of things can go wrong like:
the Degree class may evolved, the hibernate stuff may have added extra
runtime properties that the introspector is picking up, the JDK version may
have changed which means that the introspector behavior may have changed,
new data type analyzers may have been added etc.)

-- 
Chris



On Mon, Dec 14, 2015 at 2:31 AM, Vangel V. Ajanovski 
wrote:

> When adding a new column to a grid like this:
>
> 
> 
> delete
> 
> 
>
> I am getting an
> org.apache.tapestry5.ioc.internal.OperationException
> Render queue error in CleanupRender[admin/DegreeList:grid]: Bean editor
> model for mk.ukim.finki.isis.dossier.entities.Degree already contains a
> property model for property 'delete'.
>
> The error occurs on 5.4-rc-1, but not on 5.4-beta-26.
> The same piece of code has been working without such a problem with
> previous versions for the last 3 years at least.
>
> Java:
> openjdk version "1.8.0_66"
> OpenJDK Runtime Environment (build 1.8.0_66-b17)
> OpenJDK 64-Bit Server VM (build 25.66-b17, mixed mode)
>
> Source where problem occurs:
>
> https://develop.finki.ukim.mk/projects/isis/browser/trunk/src/main/resources/mk/ukim/finki/isis/dossier/pages/admin/DegreeList.tml
>
> https://develop.finki.ukim.mk/projects/isis/browser/trunk/src/main/java/mk/ukim/finki/isis/dossier/pages/admin/DegreeList.java
>
> Project pom.xml:
> https://develop.finki.ukim.mk/projects/isis/browser/trunk/pom.xml
>
>


Re: Retrieving the Class of an enum backing a Grid column

2015-12-09 Thread Chris Poulsen
Maybe you can find it in the PropertyModel for the column? (
http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/beaneditor/PropertyModel.html#getPropertyType%28%29
)

-- 
Chris

On Wed, Dec 9, 2015 at 5:10 PM, Davide Vecchi  wrote:

> Hi everybody,
>
> I'm writing a custom component to be used by the Grid component, such that
> - in a very few words -  when the user clicks on an icon placed in the
> header of a column whose datatype is an Enumeration, I show a dropdown
> containing all the existing members of that enumeration.
>
> Tapestry definitely has great support for this kind of things, see f.ex.
> the Enum example of the doc for the Select component<
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Select.html>
> . However in this case I cannot use that approach because I'm not creating
> a page but a component that needs to work with specific enums that become
> known only at runtime.
>
> The part where I'm stuck is that I don't know how to retrieve the
> java.lang.Class of the enum that is the datatype of my column. Once I have
> the Class of the enum I can call Class.getEnumConstants(), obtaining a List
> of the members of that particular enum, and pass that list to
> SelectModelFactory.create(List, String) to create a SelectModel that I
> can reference in the t:model attribute of my  tag in the template.
>
> So, is it possible to retrieve the Class of the enum that is the datatype
> of a Grid column ?
>


Default css class on input[type='file']?

2015-11-19 Thread Chris Poulsen
Hi,

I noticed TAP5-2518 was created (and closed). We've actually been hit by
the same issue in our product.

After upgrading from an older 5.4 beta some of our pages did not look
correct due to the added "form-control" class on the file inputs. (Added in
TAP5-2408 - The issue mentions the reason to be "for consistency" - but in
practice it breaks the layout).

I tried googling to see how people suggest handling file inputs in
bootstrap, most suggestions was about using various classes (btn and the
like) - none had the form-control class on the input.

The breakage that we are seeing is that the form-control class adds a box
and an explicit height on the input (a height that is too large for the box
in firefox)

Basically I think everyone would be better off without the form-control
class on the file input.

Does anyone else have any thoughts on this?

-- 
Chris


Improving linksubmit in form loop?

2015-11-03 Thread Chris Poulsen
Hi,

I've been working on a dynamic ajax form in 5.4; that allows users to
configure a list of things. The idea is that add / edit / delete operations
carry all data with them (form submits). The list is rendered as a list of
form-fields per row using a t:loop.

There have been some challenges, but I've managed to solve most of them
using the built in stuff (Somewhat creative use of t:trigger /
t:submitnotifier for managing the dynamic list of objects during
render/submit).

However I've not been successful adding a delete link (t:submitlink) to
each row. I want to indicate the particular row using the t:context
parameter, but that seems to be resolved in the "processSubmission" call.
And that is too late as both the current row / loop index are null
(obviously as they are a render thing).

I've hit many similar questions in google and most have been answered with
"set t:defer=false", but that does not make a difference in this case as
the context depends on the loop state during rendering.

So I decided to try an fix the problem with the context being resolved "too
late" and I would like some feedback on whether the suggested approach is
viable/correct or why not!

My attempted fix is a copy of the linksubmit that serializes the passed
context into its ProcessSubmission ComponentAction. I serialize/deserialize
the context using ContextPathEncoder (like the link components) - as I
figured that links are basically doing the same (serializing the event
context into a string and deserializing it back later on).

With this new linksubmit it seems like defer is not really needed anymore,
it does not matter if my links are deferred or not as the processSubmission
already has the correct state.

If my approach is sane, it could maybe be useful for someone else. If not
I'd be interested in fixing it - If possible.

The relevant parts of my linksubmit2 class are pasted below, the rest is a
copy of the standard linksubmit.

-- 
Chris


... Begin of paste
@Inject
private ContextPathEncoder contextPathEncoder;

private static class ProcessSubmission implements
ComponentAction
{
private final String clientId;
private final String encodedEventContext;

public ProcessSubmission(String clientId, String
encodedEventContext )
{
this.clientId = clientId;
this.encodedEventContext = encodedEventContext;
}

public void execute(LinkSubmit2 component)
{
component.processSubmission(clientId, encodedEventContext );
}
}

private void processSubmission(String clientId, String
encodedEventContext )
{
this.clientId = clientId;
final Object[] context = contextPathEncoder.decodePath(
encodedEventContext ).toStrings();

String raw = request.getParameter( Form.SUBMITTING_ELEMENT_ID);

if ( InternalUtils.isNonBlank( raw) && new JSONArray(
raw).getString( 0).equals( clientId))
{
Runnable notification = new Runnable()
{
public void run()
{
resources.triggerEvent(event, context, eventCallback);
}
};

if (defer)
formSupport.defer(notification);
else
heartbeat.defer(notification);
}
}

void beginRender(MarkupWriter writer)
{
if (!disabled)
{
clientId = javascriptSupport.allocateClientId(resources);
String encodedContext = contextPathEncoder.encodeIntoPath(
context );
formSupport.store(this, new ProcessSubmission(clientId,
encodedContext ));

writer.element("a",

   "href", "#",

   "data-submit-mode", mode.name().toLowerCase(),

   "id", clientId);

... End of paste


Re: javassist/hibernate enhanced class problem

2015-10-30 Thread Chris Poulsen
Mabet use an interface for the objects? Then the implementation class can
change all it wants to.

On Thu, Oct 29, 2015 at 11:40 PM, Paul Stanton  wrote:

> further, it is not the 'save' that javassistifies the object, it is
> 'session.load' ! so if you do a session.load(id) and a criteria.list()
> which returns the same entity, the list will contain a javassisted version
> of the object, which doesn't play nice with tapestry.grid. using 'get'
> instead of 'load' seems to avoid this.
>
>
> On 30/10/2015 9:13 AM, Paul Stanton wrote:
>
>> Hi Thiago,
>>
>> Using 'merge' instead of 'save' does not resolve the issue. I still have
>> to evict.
>>
>> On 29/10/2015 11:04 PM, Thiago H de Paula Figueiredo wrote:
>>
>>> On Thu, 29 Oct 2015 07:23:07 -0200, Paul Stanton 
>>> wrote:
>>>
>>> I have found an issue I believe with tapestery (grid component in this
 case) where it cannot inspect details of hibernate 'enhanced' objects. This
 happens when I save an object to the database and then query it out again -
 the instance is returned from cache as a botched/modified javassist
 version. I believe I can 'evict' between the save and the query, or
 close/open a new session to avoid this. Will report back.

>>>
>>> How are you saving the object in first place? The most recommended way
>>> is using object = session.merge(object), not session.save(object).
>>>
>>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: AW: How to send additional data with an ajax response

2015-10-29 Thread Chris Poulsen
I haven't checked out all of the callback types, but we often use the
javascript callback to do extra stuff on the calling page.

Something like:

ajaxResponseRenderer.addCallback( new JavaScriptCallback()
{
@Override
public void run( JavaScriptSupport javascriptSupport )
{
javascriptSupport.require( "" ).invoke(
").with(
 wrote:

> On Thu, 29 Oct 2015 05:59:30 -0200, Poggenpohl, Daniel <
> daniel.poggenp...@isst.fraunhofer.de> wrote:
>
> Hello,
>>
>> do you have example code returning not only the body, but also additional
>> data, for me?
>>
>
> Have you even considered my suggestion of using data tags inside the
> rendered HTML to provide the data?
>
>
> --
> 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: How to send additional data with an ajax response

2015-10-28 Thread Chris Poulsen
Ajax response renderer may also be a viable solution for returning multiple
things. I tend to prefer that over returning getBody() for exactly that
reason.

-- 
Chris


On Wed, Oct 28, 2015 at 2:05 PM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Wed, 28 Oct 2015 08:16:21 -0200, Poggenpohl, Daniel <
> daniel.poggenp...@isst.fraunhofer.de> wrote:
>
> Hello everyone,
>>
>
> Hi!
>
> we have a problem where we update some page with an ajax request, but need
>> additional data to be sent with the ajax response. This additional data
>> should then be consumed on the client side by an ajaxComplete event. Does
>> anyone know how a Tapestry event method can return more than just getBody()
>> in the response?
>>
>
> Why don't you use data attributes in the returned HTML instead?
>
> --
> 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: Standard BeanModel for my own classes

2015-10-12 Thread Chris Poulsen
Take a look at data type analyzers and their corresponding property
display/edit blocks to get this working.

Jumpstart has an example:
http://jumpstart.doublenegative.com.au/jumpstart/examples/lang/propertyeditors

-- 
Chris

On Mon, Oct 12, 2015 at 11:32 AM, Poggenpohl, Daniel <
daniel.poggenp...@isst.fraunhofer.de> wrote:

> Hi,
>
> I've created some classes that are used rather prominently in my Tapestry
> 5.3.8 application.
>
> The classes have some attributes that are themselves simple string
> wrappers.
>
> So, for example, I have:
>
> SomeClass.java
> --
> UidString someUid;
> [...]
>
> And UidString is basically a String wrapper with some additional
> validation:
>
> UidString.java
> 
> String uidString;
> public String toString() {return uidString;}
> public String get() {return uidString;}
> [...]
>
> Anyway, when I use the SomeClass in a grid, the UidString isnt'
> recognized, so that I either have to add the column by myself every time or
> create a custom bean model for the class.
> I chose the latter. Now I have a method creating the bean model for me and
> use it every time with t:model="mySomeClassBeanModel" every time I have a
> grid containing SomeClass.
>
> Can I register the bean model in Tapestry so I don't have to set the model
> myself?
>
> Are there other ways to recognize/configure the String wrappers?
>
> Regards,
> Daniel P.
>


Re: Custom ValueEncoder & IOC

2015-09-14 Thread Chris Poulsen
Can't you could just bind it in your app module?

--
Chris


On Mon, Sep 14, 2015 at 3:35 PM, Damon Childs  wrote:

> How do i get a custom ValueEncoder under control of IOC?
>
> I have a ValueEncoder that translates a id to a Object from a db.
>
> public class PropertyTypeEncoder implements
> ValueEncoder {
>
> @Inject
> private Session session;
>
> public  PropertyTypeEncoder(Session session) {
> this.session = session;
> }
>
> public String toClient(LookupPropertyType value) {
> return String.valueOf(value.getId());
> }
>
> public LookupPropertyType toValue(String id) {
> Criteria criteria =
> session.createCriteria(LookupPropertyType.class);
> criteria.add(Restrictions.eq("id", Long.parseLong(id)));
> LookupPropertyType type =
> (LookupPropertyType)criteria.uniqueResult();
> return type;
> }
> }
>
> To get it created of the web form I have:
>  @Property
> private final PropertyTypeEncoder propertyTypeEncoder = new
> PropertyTypeEncoder(this.session);
>
> Im passing the Hibernate session via the constructer since this would not
> be under the IOC’s control.
>
> Is there a way to create this using the IOC so the inject works?
>
> Thanks,
> Damon
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Inspection of Tapestry applications in IntelliJ

2015-08-25 Thread Chris Poulsen
There have been some improvements in the recent v15 EAPs.

Also you can adjust the unused inspection to not trigger on certain
annotations. (I think it is some sub-menu found under the "light bulb" when
having an unused field marked)

On Tue, Aug 25, 2015 at 2:29 PM, Poggenpohl, Daniel <
daniel.poggenp...@isst.fraunhofer.de> wrote:

> Hello again,
>
> right after solving after another problem, I thought that maybe you could
> help me with another one regarding IntelliJ and Tapestry.
>
> The IDE has Tapestry support, but it seems to use a rather old Tapestry
> version (5.1?).
> The code inspections seem to be relatively dumb because @Property
> annotated members are seen as "never used". In tml files, sometimes I get
> error messages like "can't coerce List to selectModel" or "Cannot resolve
> symbol ${someSymbol}" when I have a getSomeSymbol() in my java class.
>
> How do you deal with that?
>
> Regards,
> Daniel P.
>


Re: Debugging Tapestry with IntelliJ IDEA

2015-08-25 Thread Chris Poulsen
We usually simply set -Dtapestry.production-mode=false in the JVM when we
want dev mode.

On Tue, Aug 25, 2015 at 1:51 PM, Poggenpohl, Daniel <
daniel.poggenp...@isst.fraunhofer.de> wrote:

> Hi everyone,
>
> it seems that production mode (is set to true) is the problem.
>
> We use build profiles and have three stages:
> 1. Local development
> 2. Deploying to a Test VM for load tests
> 3. Deploying to the official VM
>
> Our tapestry module POM reflects this.
> When I add a property
> development
> to the POM, it should load the additional DevelopmentModule which sets the
> production mode to false.
> The DevelopmentModule isn't loaded, though.
>
> Isn't this the way to go?
>
> Regards,
> Daniel P.
>
> -Ursprüngliche Nachricht-
> Von: Stephen Nutbrown [mailto:steves...@gmail.com]
> Gesendet: Dienstag, 25. August 2015 13:26
> An: Tapestry users
> Betreff: Re: Debugging Tapestry with IntelliJ IDEA
>
> Just to confirm it also works fine here too. I've found IntelliJ to be
> absolutely fantastic so far. I'm running it using jetty but I know there is
> an option for tomcat... I don't know if that could make a difference?
> On 25 Aug 2015 11:33 am, "Chris Poulsen"  wrote:
>
> > It works fine with IDEA here. A possibility could be that you are
> > running in production mode?
> >
> > On Tue, Aug 25, 2015 at 12:04 PM, Poggenpohl, Daniel <
> > daniel.poggenp...@isst.fraunhofer.de> wrote:
> >
> > > Hello everyone,
> > >
> > > we are evaluating IntelliJ IDEA for development and so far it has
> > > been quite good.
> > > But the Tapestry specifics seem to hinder further evaluation.
> > > Does anyone here use IntelliJ for development?
> > >
> > > When we debug code, page properties are always seen as having a "null"
> > > value instead of the proxy that Eclipse used to show. What are we
> > > doing wrong?
> > >
> > > Regards,
> > > Daniel P.
> > >
> >
>


Re: Debugging Tapestry with IntelliJ IDEA

2015-08-25 Thread Chris Poulsen
It works fine with IDEA here. A possibility could be that you are running
in production mode?

On Tue, Aug 25, 2015 at 12:04 PM, Poggenpohl, Daniel <
daniel.poggenp...@isst.fraunhofer.de> wrote:

> Hello everyone,
>
> we are evaluating IntelliJ IDEA for development and so far it has been
> quite good.
> But the Tapestry specifics seem to hinder further evaluation.
> Does anyone here use IntelliJ for development?
>
> When we debug code, page properties are always seen as having a "null"
> value instead of the proxy that Eclipse used to show. What are we doing
> wrong?
>
> Regards,
> Daniel P.
>


Re: Pages, embedded components, dialogs, persisting entities across requests and submitting forms

2015-07-20 Thread Chris Poulsen
Case one is a candidate for activation and case 2 could be a matter of
using form context / prepare events.

Beware that the activate event is triggered in many situations.

-- 
Chris

On Mon, Jul 20, 2015 at 3:39 PM, Chris Poulsen 
wrote:

> @BeginRender is only triggered during rendering.
>
> Page activation is always called and there are a couple of "prepare"
> events fired when you have a form in the mix.
>
> --
> Chris
>
> On Mon, Jul 20, 2015 at 3:31 PM, Poggenpohl, Daniel <
> daniel.poggenp...@isst.fraunhofer.de> wrote:
>
>> Hello everyone,
>>
>> I want to finally adress the problem that crops up when persisting page
>> properties (which I do not want to).
>>
>> For example, I have a Page P1, containing a component C1. I also define a
>> jquery dialog J1 in my page, which is opened inside C1 via a
>> dialogajaxlink. The dialog contains component C2.
>> So, basically:
>> P1->C1
>> P1->J1->C2
>>
>> For this example, I have to entity classes: E1 and E2.
>> E1 contains a list of E2's.
>>
>> P1 receives an activation context, the id of an E1.
>> In setupRender I fetch the E1 entity and use it to render the page.
>> C1 currently receives the E1 entity as a parameter and accesses one of
>> the contained E2's.
>>
>> Now, C1 is shown, I click something and raise an event that should update
>> the shown C1.
>> If I @Persist the E1 entity, all is okay, because the ID and class is
>> saved between requests and so the E1 entity can be retrieved again.
>>
>> 1.   But I don't want to store with @Persist. What are my options?
>>
>> Let's do another:
>> In another example, P1 displays E1 entities and loops the component C1
>> over all E2 entities contained in E1. In every C1 loop iteration
>> (containing an E2 entity) there is a button opening the dialog J1
>> respectively the component C2 with the E2 id as a parameter, to edit E2's
>> in a Form.
>>
>>
>> 2.   When I submit the form to update the E2, what should I do then?
>> The id parameter is lost if @Persist is not used with E1, because then the
>> E1 entity is lost and thus no list of E2's can be reproduced.
>>
>> I hope that wasn't too formal and someone can help me understand.
>>
>> Regards,
>> Daniel P.
>>
>
>


Re: Pages, embedded components, dialogs, persisting entities across requests and submitting forms

2015-07-20 Thread Chris Poulsen
@BeginRender is only triggered during rendering.

Page activation is always called and there are a couple of "prepare" events
fired when you have a form in the mix.

-- 
Chris

On Mon, Jul 20, 2015 at 3:31 PM, Poggenpohl, Daniel <
daniel.poggenp...@isst.fraunhofer.de> wrote:

> Hello everyone,
>
> I want to finally adress the problem that crops up when persisting page
> properties (which I do not want to).
>
> For example, I have a Page P1, containing a component C1. I also define a
> jquery dialog J1 in my page, which is opened inside C1 via a
> dialogajaxlink. The dialog contains component C2.
> So, basically:
> P1->C1
> P1->J1->C2
>
> For this example, I have to entity classes: E1 and E2.
> E1 contains a list of E2's.
>
> P1 receives an activation context, the id of an E1.
> In setupRender I fetch the E1 entity and use it to render the page.
> C1 currently receives the E1 entity as a parameter and accesses one of the
> contained E2's.
>
> Now, C1 is shown, I click something and raise an event that should update
> the shown C1.
> If I @Persist the E1 entity, all is okay, because the ID and class is
> saved between requests and so the E1 entity can be retrieved again.
>
> 1.   But I don't want to store with @Persist. What are my options?
>
> Let's do another:
> In another example, P1 displays E1 entities and loops the component C1
> over all E2 entities contained in E1. In every C1 loop iteration
> (containing an E2 entity) there is a button opening the dialog J1
> respectively the component C2 with the E2 id as a parameter, to edit E2's
> in a Form.
>
>
> 2.   When I submit the form to update the E2, what should I do then?
> The id parameter is lost if @Persist is not used with E1, because then the
> E1 entity is lost and thus no list of E2's can be reproduced.
>
> I hope that wasn't too formal and someone can help me understand.
>
> Regards,
> Daniel P.
>


Re: BeanEditForm in jquery.dialog - problem with validation

2015-07-15 Thread Chris Poulsen
Try bindnig the BeanEditForm to the zone to prevent full page reload on
submit (zone="^")

On Wed, Jul 15, 2015 at 4:34 PM, Matthias Bieber  wrote:

> Hello,
>
> I have a BeanEditForm inside a jquery.dialog. The dialog will be opened if
> you click on a link.
> I want to validate the input by using onValidateFrom..Form..() and
> form.recordError().
>
> Once the submit button has been clicked, the page will be reloaded and the
> jquery.dialog disappears.
> After opening the dialog again, the BeanEditForm has been reset. So the
> error message has not been displayed.
>
> Do you know how to keep the dialog open with the current error message?
>
> Thank you.
>
>
> Index.tml:
>t:sidebarTitle="Framework Version"
>   xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd";
>   xmlns:p="tapestry:parameter">
>  t:dialog="newPersonDialog"
> t:zone="newPersonDialogZone">
> Create Person
> 
>
>  params="newPersonDialogParams">
> 
>  t:cancel="true" exclude="id, owner"/>
> 
> 
> 
>
> Index.java:
> @Property
> private Person person;
>
> @Component(id = "personForm")
> private BeanEditForm form;
> @InjectComponent
> private Zone newPersonDialogZone;
>
> public Index()
> {
> person = new Person();
> }
>
> @Log
> void onValidateFromPersonForm()
> {
> String name = person.getName();
>
> if(name == null || name.isEmpty())
> form.recordError("Please enter a name");
> }
>
> Object onActionFromCreatePerson() {
> return newPersonDialogZone.getBody();
> }
>
> public JSONObject getNewPersonDialogParams() {
> JSONObject obj = new JSONObject();
> obj.put("autoopen", "true");
> obj.put("modal", "true");
> obj.put("title", "Title");
> obj.put("height", "auto");
> obj.put("width", "auto");
> return obj;
> }
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


  1   2   3   >