Re: Ckeditor for T5.4 complete with code sample

2014-03-25 Thread George Christman
Thiago I agree it does belong on github, but unfortunately I have no
experience with using github and I probably wouldn't be able to maintained
it. It's probably better off with the Tynamo guys where it can be
maintained.

I think what Tapestry needs is a central git repository where the community
can contribute third party components like these. I think that would really
help to build our community bigger and stronger. I have no issue
contributing my components, I just lack the time to build blogs or maintain
the code.


On Tue, Mar 25, 2014 at 10:30 AM, Balázs Palcsó wrote:

> Hi,
>
> Tynamo also has a CKEditor integration plugin :
> https://github.com/tynamo/tapestry-ckeditor
> http://tynamo.org/tapestry-ckeditor+guide
>
> It would worth considering to contribute to the existing one instead of
> creating a new one.
>
> Please note that Tynamo's tapestry-ckeditor is currently not working with
> the current 5.4-beta3 version due to this regression issue:
> https://issues.apache.org/jira/browse/TAP5-2300
>
>
>
>
>
> On 25 March 2014 13:35, Thiago H de Paula Figueiredo  >wrote:
>
> > On Tue, 25 Mar 2014 10:27:45 -0300, Geoff Callender <
> > geoff.callender.jumpst...@gmail.com> wrote:
> >
> >  Very cool.
> >>
> >
> > Yep. Deserves its own repository in GitHub and JAR in the Maven Central
> > Repository. :) I can help you with that if you want.
> >
> > --
> > 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
> >
> >
>



-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York


Re: Tapestry5 - Weaves 3.0 repository

2014-03-25 Thread Boris Horvat
Hm...I can try that. Thanks

Was hoping that they do have a repository somewhere and that I just missed
it


On Tue, Mar 25, 2014 at 10:30 PM, Daniel Jue  wrote:

> I had to do something like this recently for a piece of Neo4J that had no
> repo -- I forked the project I was interested in (and also made my fixes to
> it) then looked on stack overflow for instructions on creating a maven repo
> on github.
> The posts I used to do this:
>
> http://stackoverflow.com/questions/14013644/hosting-a-maven-repository-on-github
> http://blog.rueedlinger.ch/2012/09/use-github-as-maven-remote-repository/
>
> My example:
> https://github.com/danieljue/batch-import-graphene
>
> You can copy most of the relevant pieces out of the POM there.
>
> There was also a piece in my settings.xml that lists the server name that
> the property "github" points to, along with my user and password for
> deployment.  Then a simple
>
> mvn clean compile deploy
>
> will put the maven pieces on github in a branch of the project.  The
> instructions on my readme show what to put in your POM to create a
> dependency that downloads from github.
>
> I also submit a pull request so the original project creator can just merge
> the changes.
>
>
>
>
>
> On Tue, Mar 25, 2014 at 5:20 PM, Boris Horvat  >wrote:
>
> > Hi everyone,
> >
> > Does anyone know if Weaves 3.0 (https://github.com/intercommit/Weaves)
> has
> > a maven repositroy somewhere?
> >
> > I can download it from git and build it so I can mange but I would be
> more
> > happy if I can just add dependency in .pom and be done with it (this is
> > somewhat needed if one wants to automate the build).
> >
> > Cheers
> >
> > --
> > Sincerely
> > *Boris Horvat*
> >
>



-- 
Sincerely
*Boris Horvat*


Re: Tapestry5 - Weaves 3.0 repository

2014-03-25 Thread Daniel Jue
I had to do something like this recently for a piece of Neo4J that had no
repo -- I forked the project I was interested in (and also made my fixes to
it) then looked on stack overflow for instructions on creating a maven repo
on github.
The posts I used to do this:
http://stackoverflow.com/questions/14013644/hosting-a-maven-repository-on-github
http://blog.rueedlinger.ch/2012/09/use-github-as-maven-remote-repository/

My example:
https://github.com/danieljue/batch-import-graphene

You can copy most of the relevant pieces out of the POM there.

There was also a piece in my settings.xml that lists the server name that
the property "github" points to, along with my user and password for
deployment.  Then a simple

mvn clean compile deploy

will put the maven pieces on github in a branch of the project.  The
instructions on my readme show what to put in your POM to create a
dependency that downloads from github.

I also submit a pull request so the original project creator can just merge
the changes.





On Tue, Mar 25, 2014 at 5:20 PM, Boris Horvat wrote:

> Hi everyone,
>
> Does anyone know if Weaves 3.0 (https://github.com/intercommit/Weaves) has
> a maven repositroy somewhere?
>
> I can download it from git and build it so I can mange but I would be more
> happy if I can just add dependency in .pom and be done with it (this is
> somewhat needed if one wants to automate the build).
>
> Cheers
>
> --
> Sincerely
> *Boris Horvat*
>


Tapestry5 - Weaves 3.0 repository

2014-03-25 Thread Boris Horvat
Hi everyone,

Does anyone know if Weaves 3.0 (https://github.com/intercommit/Weaves) has
a maven repositroy somewhere?

I can download it from git and build it so I can mange but I would be more
happy if I can just add dependency in .pom and be done with it (this is
somewhat needed if one wants to automate the build).

Cheers

-- 
Sincerely
*Boris Horvat*


Re: componenent or mixin to trigger event when visible

2014-03-25 Thread John
Just saw that this was included in Tapestry jQuery, not documented yet though.
  - Original Message -
  From: Lance Java
  To: Tapestry users
  Sent: Sunday, March 23, 2014 7:40 PM
  Subject: Re: componenent or mixin to trigger event when visible


  Here is some related reading
  
http://tawus.wordpress.com/2012/11/25/scrolling-pages-tapestry5-onscrollbeyond/
  On 23 Mar 2014 09:37, "John"  wrote:

  > I want to update a zone when the top of a scrollable div becomes visible.
  > The use case is to display older messages in a list of messages as the user
  > sctolls up.
  >
  > I'm thinking of using the tapestry jquery bind mixin. Any other
  > suggestions?
  >
  > John
  >
  > ---
  > This email is free from viruses and malware because avast! Antivirus
  > protection is active.
  > http://www.avast.com
  >


---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


Issue with using tooltip and popovers, missing initialization script?

2014-03-25 Thread Jim Romaine
Hello,

We are using tapestry5.4 beta-3 and was attempting to add bootstrap
tooltip and popover scripts.

When using just the attributes as described on
http://getbootstrap.com/javascript/#popovers, it appeared that the
attributes were not being recognized.

We were able to get the tooltip & popover to work by including the
following scripts, which suggests that the initializer scripts are
missing?

Below sample is working:

test.java:
package org.company.demo;

import org.apache.tapestry5.annotations.Import;

@Import(module = {"bootstrap/modal", "bootstrap/popover", "tooltip-popover"})
public class Test {
}

test.tml:

http://www.w3.org/1999/xhtml";
  xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd";
  xmlns:p="tapestry:parameter">





Tight
pants next level keffiyeh you probably
haven't heard of them. Photo booth beard raw denim letterpress vegan
messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie
sustainable quinoa 8-bit american apparel have a terry
richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo
thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's
cleanse vegan chambray. A really ironic artisan whatever
keytar, scenester farm-to-table banksy Austin twitter handle freegan
cred raw denim single-origin coffee viral.


Hover to toggle popover
Hover over me

Popover on Click






the above will work with the following file added
tooltip-popover:
define(["jquery", "bootstrap/tooltip", "bootstrap/popover"], function($) {

init = function() {
$('[data-toggle="tooltip"]').tooltip({'placement': 'auto right'});

$('[data-toggle="popover-click"]').popover({
trigger: 'click',
'placement': 'auto right'
});

$('[data-toggle="popover-hover"]').popover({
trigger: 'hover',
'placement': 'auto right'
});
};

return init;
});

Is there supposed to be an initializer added to existing code for the
tootlip and popover libriaries?

Thanks,
Jim

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



Re: componenent or mixin to trigger event when visible

2014-03-25 Thread John
Thanks for that Lance, I tested this code and it worked fine for scrolling a 
whole page, but not when inside a div with overflow? I also could not find the 
css, the original article is 404.

The technique is a lot slicker than the hacked up solution I made by messing 
with the jquery.bind mixin.

John
  - Original Message -
  From: Lance Java
  To: Tapestry users
  Sent: Sunday, March 23, 2014 7:40 PM
  Subject: Re: componenent or mixin to trigger event when visible


  Here is some related reading
  
http://tawus.wordpress.com/2012/11/25/scrolling-pages-tapestry5-onscrollbeyond/
  On 23 Mar 2014 09:37, "John"  wrote:

  > I want to update a zone when the top of a scrollable div becomes visible.
  > The use case is to display older messages in a list of messages as the user
  > sctolls up.
  >
  > I'm thinking of using the tapestry jquery bind mixin. Any other
  > suggestions?
  >
  > John
  >
  > ---
  > This email is free from viruses and malware because avast! Antivirus
  > protection is active.
  > http://www.avast.com
  >


---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


Re: convert mixin to component

2014-03-25 Thread Thiago H de Paula Figueiredo

On Tue, 25 Mar 2014 13:18:13 -0300, John  wrote:

Has anyone changed a mixin into a component? Was it easy and could you  
please share the steps?


Components and mixins are very similar already, with very few differences:

1) Components can have templates, mixins cannot.

2) Mixins can only be used applied to a component.

3) They're put in different packages.

Both can have parameters, handle component rendering events and generate  
HTML through MarkupWriter.


The steps, besides moving the mixin class to the components package, are  
very specific to what the mixin does. Without the mixin source, we cannot  
help further.


--
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: Updating a zone from a property method

2014-03-25 Thread Thiago H de Paula Figueiredo

On Tue, 25 Mar 2014 12:33:30 -0300, Davide Vecchi  wrote:


Hi,


Hi!

The jumpstart examples linked by Geoff Callender are also useful but  
they show how to update a zone in response to a user's action (clicking  
on a link or button) while in my case I need to update a zone in  
response to "nothing" - that is, in response to an error occurred during  
the initial page loading, before any possible user's action.


That's the whole point: you don't need AJAX nor zones for that. A zone is  
meant to be updated after the initial page loading, usually by user  
action, but also possibly by some timer.





I have a zone to show possible errors that might occur in a get* method
called by Tapestry during page rendering to retrieve the value for a
property (String myValue in the example below).



Why do you want for that to happen inside a getter? It does look like a
wrong thing for me. Getters are mostly expected to not have  
side-effects.


This point is quite unclear to me. I did so because I think that in a  
web page the getter is the right place to put the code that retrieves a  
value to show in the page.


Yeah, I agree with you. I'm sorry for posting that paragraph.

I could calculate in the setupRender method the return values for all  
the getters, store them in @Persist fields and just return those fields  
from the getters.


If these values are used in the initial page rendering, as it's the case  
here, you don't need to @Persist them at all. The values of the fields  
will be kept until the request is finished.



 Plus I don't know if one can update a zone from the setupRender method.


It makes absolutely no sense to do that, as I already explained above,  
because zones are not meant to be updated during the page rendering.


--
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



convert mixin to component

2014-03-25 Thread John
Has anyone changed a mixin into a component? Was it easy and could you please 
share the steps?

John

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


RE: Updating a zone from a property method

2014-03-25 Thread Davide Vecchi
Hi,

> You're trying to use AjaxResponseRenderer during the initial render of the  
> zone, which is a normal, full-page, non-AJAX request, not when the zone is  
> being updated during an AJAX request. In addition, your getter, which is  
> the method that sets the error message, is only invoked *after* the zone  
> is rendered. There's nothing in your page that triggers the AJAX update so  
> you can show the error.

Thanks to you and Geoff Callender for pointing this out, now I see it. I needed 
to update the error zone so I copied the use of AjaxResponseRenderer from 
another page, without checking too much how it was used there. As often is the 
case in this business, taking shortcuts to save time wastes time.  I will have 
to read more about how to update zones.

The jumpstart examples linked by Geoff Callender are also useful but they show 
how to update a zone in response to a user's action (clicking on a link or 
button) while in my case I need to update a zone in response to "nothing" - 
that is, in response to an error occurred during the initial page loading, 
before any possible user's action.

>> I have a zone to show possible errors that might occur in a get* method  
>> called by Tapestry during page rendering to retrieve the value for a  
>> property (String myValue in the example below).

>Why do you want for that to happen inside a getter? It does look like a  
>wrong thing for me. Getters are mostly expected to not have side-effects.

This point is quite unclear to me. I did so because I think that in a web page 
the getter is the right place to put the code that retrieves a value to show in 
the page.

I could calculate in the setupRender method the return values for all the 
getters, store them in @Persist fields and just return those fields from the 
getters. But I would be calculating values that might never be requested by the 
page because which values are requested by the page can depend on what the user 
clicks on that page. Plus I don't know if one can update a zone from the 
setupRender method.
Regardless, I currently believe that the best place to calculate a value to 
show in the page is the getter for that value.

In my understanding my approach looks exactly like the 

serverTime1:  ${serverTime1}

and the corresponding

public Date getServerTime1() {
return new Date();
}

bits from the jumpstart eventlink example mentioned above 
(http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/eventlink) .
Just like in my case, in that example the getter is first called at page 
loading time, before the user can click anything, because the value has to be 
already there as soon as the page is loaded.

I totally agree that these getters should just return a value without changing 
anything outside their scope, but if they have to calculate or retrieve the 
value to return, then they can always throw exceptions, which I would like to 
handle by updating a zone.

So we can stick to the jumpstart example and say that that getServerTime1() 
method throws an exception when called at page loading time and that we want to 
handle that situation by updating an "error" zone somewhere else in the page. 
Can that be done in a Tapestry-friendly way ?

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


Re: Ckeditor for T5.4 complete with code sample

2014-03-25 Thread Balázs Palcsó
Hi,

Tynamo also has a CKEditor integration plugin :
https://github.com/tynamo/tapestry-ckeditor
http://tynamo.org/tapestry-ckeditor+guide

It would worth considering to contribute to the existing one instead of
creating a new one.

Please note that Tynamo's tapestry-ckeditor is currently not working with
the current 5.4-beta3 version due to this regression issue:
https://issues.apache.org/jira/browse/TAP5-2300





On 25 March 2014 13:35, Thiago H de Paula Figueiredo wrote:

> On Tue, 25 Mar 2014 10:27:45 -0300, Geoff Callender <
> geoff.callender.jumpst...@gmail.com> wrote:
>
>  Very cool.
>>
>
> Yep. Deserves its own repository in GitHub and JAR in the Maven Central
> Repository. :) I can help you with that if you want.
>
> --
> 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: Updating a zone from a property method

2014-03-25 Thread Geoff Callender
Not sure if I'm understanding your sequence, but I don't see an AJAX
request there. Tapestry can return zone(s) in response to an AJAX request
(ie. XHR). Do these help?

http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/eventlink
http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/form

Geoff


On 25 March 2014 23:41, Davide Vecchi  wrote:

> Sorry for the double post. After I posted the first one I realized I had
> unsubscribed from the mailing list some time ago, so I subscribed and sent
> the question again. I thought the one I had sent while unsubscribed
> wouldn't show up (it hadn't at that time). My apologies.
>
> -Original Message-
> Sent: Tuesday, March 25, 2014 12:27
> To: users@tapestry.apache.org
> Subject: Updating a zone from a property method
>
> I have a zone to show possible errors that might occur in a get* method
> called by Tapestry during page rendering to retrieve the value for a
> property (String myValue in the example below).
>
> So in this getMyValue() method I set the error message into another
> property (@Property String errorMessage) and I call addRender to update the
> template zone errorZone, where ${errorMessage} is placed.
>
> My problem is that this call to addRender has no effect: the errorMessage
> is not shown. But if I just reload the page it is shown.
>
> Below is a testable example. I'm trying to find out what's the right way
> to update a zone from a get* method called by Tapestry during page
> rendering.
>
> #
> TestRender.tml:
> #
>
>
> http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
>
>
>
>   
>
>  ${errorMessage}
>
>   
>
>
>
>myValue: ${myValue}
>
> 
>
>
> #
> TestRender.java:
> #
>
> import java.util.Date;
>
> import org.apache.tapestry5.PersistenceConstants;
> import org.apache.tapestry5.annotations.InjectComponent;
> import org.apache.tapestry5.annotations.Persist;
> import org.apache.tapestry5.annotations.Property;
> import org.apache.tapestry5.corelib.components.Zone;
> import org.apache.tapestry5.ioc.annotations.Inject;
> import org.apache.tapestry5.services.ajax.AjaxResponseRenderer;
>
> public class TestRender
> {
>
>@Persist(PersistenceConstants.FLASH)
>@Property
>private boolean  isError;
>
>@Persist(PersistenceConstants.FLASH)
>@Property
>private String   errorMessage;
>
>@InjectComponent
>@Property
>private Zone errorZone;
>
>@Inject
>private AjaxResponseRenderer ajaxResponseRenderer;
>
>@Persist
>private String   myValue;
>
>public void setupRender()
>{
>   System.out.println(new Date() + " setupRender() was
> executed. It does nothing at all.");
>}
>
>public String getMyValue()
>{
>   if (this.myValue == null)
>   {
>  System.out.println(new Date() + " myValue was null,
> so getMyValue() is setting it...");
>
>  this.myValue = "My value at " + new Date();
>
>  this.isError = true;
>  this.errorMessage = "Let's say there was an error so
> I want to show this error message.";
>
>  this.ajaxResponseRenderer.addRender(this.errorZone);
>
>  /* I expected this addRender to cause the error
> message to be shown right away
> without the need to reload the page, but this is
> not the case. */
>
>  System.out.println(new Date() + " getMyValue() has
> just called addRender.");
>   }
>   else
>   {
>  System.out.println(new Date() + " myValue was NOT
> null, so getMyValue() did nothing at all.");
>   }
>   return this.myValue;
>}
> }
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Updating a zone from a property method

2014-03-25 Thread Thiago H de Paula Figueiredo

Hi!

On Tue, 25 Mar 2014 08:26:33 -0300, Davide Vecchi  wrote:

I have a zone to show possible errors that might occur in a get* method  
called by Tapestry during page rendering to retrieve the value for a  
property (String myValue in the example below).


Why do you want for that to happen inside a getter? It does look like a  
wrong thing for me. Getters are mostly expected to not have side-effects.


So in this getMyValue() method I set the error message into another  
property (@Property String errorMessage) and I call addRender to update  
the template zone errorZone, where ${errorMessage} is placed.


You're trying to use AjaxResponseRenderer during the initial render of the  
zone, which is a normal, full-page, non-AJAX request, not when the zone is  
being updated during an AJAX request. In addition, your getter, which is  
the method that sets the error message, is only invoked *after* the zone  
is rendered. There's nothing in your page that triggers the AJAX update so  
you can show the error.


--
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: Ckeditor for T5.4 complete with code sample

2014-03-25 Thread Thiago H de Paula Figueiredo
On Tue, 25 Mar 2014 10:27:45 -0300, Geoff Callender  
 wrote:



Very cool.


Yep. Deserves its own repository in GitHub and JAR in the Maven Central  
Repository. :) I can help you with that if you want.


--
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: Ckeditor for T5.4 complete with code sample

2014-03-25 Thread Geoff Callender
Very cool.


On 24 March 2014 07:15, George Christman  wrote:

> Hi Guys, I do not have a blog or time to create one atm, but I'd like to
> share the code to create a ckeditor incase anybody else wanted to use it.
>
> Start by downloading ckeditor from ckeditor.com and install it in
> META-INF/modules. I added another directory for vendor which is where I
> installed the ckeditor folder and it's code base.
>
> META-INF/modules/vendor/ckeditor/ "ckeditor code base goes here"
>
> in modules I added a script to load ckeditor with requirejs like so.
>
> META-INF/modules/ckeditor-config.js
>
>  requirejs.config({
> shim: {
> 'ckeditor-jquery': ['jquery', 'ckeditor-core']
> },
> paths: {
> 'ckeditor-core': 'vendor/ckeditor/ckeditor',
> 'ckeditor-jquery': 'vendor/ckeditor/adapters/jquery'
> }
> });
> define(["jquery", "ckeditor-jquery"], function($) {
>
> init = function(spec) {
> $('#' + spec.id).ckeditor();
> };
>
> return init;
> });
>
> Now create a mixin CKEditor.java
>
> public class CKEditor {
>
> @InjectContainer
> private Field field;
>
> @Inject
> private JavaScriptSupport javaScriptSupport;
>
> public void afterRender() {
> JSONObject json = new JSONObject();
> json.put("id", field.getClientId());
> javaScriptSupport.require("editor").with(json);
> }
> }
>
> add to your textarea component, mixins="ckeditor"
>
> Add a request filter to handle the assets, "based on Thiagos work"
>
> public class CkeditorRequestFilter implements RequestFilter {
>
> /**
>  * Folders containing WYMeditor assets.
>  */
> final private static String[] FILE_FOLDER = {"/skins/",
> "/contents.css", "/plugins/"};
>
> final private AssetSource assetSource;
>
> /**
>  * Single constructor of this class.
>  *
>  * @param assetSource an {@link AssetSource}.
>  */
> public CkeditorRequestFilter(AssetSource assetSource) {
> super();
> this.assetSource = assetSource;
> }
>
> public boolean service(Request request, Response response,
> RequestHandler handler) throws IOException {
>
> String path = request.getPath();
> boolean handled = false;
>
> // we only handle requests for ckeditor asset URLs and which
> weren't redirected already
> if (path.contains("/vendor/ckeditor") &&
> request.getParameter("redirected") == null) {
>
> for (String folder : FILE_FOLDER) {
>
> if (path.contains(folder)) {
>
> // extract the ckeditor asset being requested.
> path = path.substring(path.indexOf('/',
> path.indexOf("/modules.gz/") + 1));
>
> // find its location in the classpath.
> String location = "/META-INF/modules" + path;
>
> // create an Asset pointing to it.
> Its URL will contain the right checksum
> // for this file
> Asset asset = assetSource.getClasspathAsset(location);
>
> // we create the redirection target
> URL with "/?redirected" in the end
> // so we can spot and avoid redirection infinite loops.
> final String redirectionUrl = asset.toClientURL() +
> "/?redirected";
>
> // finally, we redirect.
> response.sendRedirect(redirectionUrl);
> handled = true;
> break;
>
> }
>
> }
>
> }
>
> // if we didn't redirect, we pass this request to the next
> RequestFilter in the pipeline
> return handled ? handled : handler.service(request, response);
>
> }
>
> }
>
> Lastly, add a request filter to your app module and create an
> ClasspathAssetAliasManager
>
> public void contributeRequestHandler(OrderedConfiguration
> configuration,
> @Local RequestFilter filter) {
> configuration.addInstance("ckeditor", CkeditorRequestFilter.class);
> }
>
> public static void
> contributeClasspathAssetAliasManager(MappedConfiguration
> configuration) {
> configuration.add("ck", "META-INF/modules/vendor");
> }
>
> Feel free to improve or use on a blog, the request filter may not be 100%
> correct, but it does work without issue.
>


Re: [5.4B3] File Upload Error

2014-03-25 Thread Geoff Callender
I upgraded commons-io to 2.4 specifically for tapestry-upload-5.4-* about 3
months ago and it did the trick.


On 25 March 2014 06:21, Bob Harner  wrote:

> Mike,
>
> Not a direct answer to your question, but as part of resolving
> TAP5-2295 recently I did change Tapestry-upload's commons-io
> dependency from 2.0.1 to 2.2. That change has not yet made it into any
> regular or beta release yet, though.
>
> On Mon, Mar 24, 2014 at 2:46 PM, Michael Gentry 
> wrote:
> > Hi everyone,
> >
> > I was trying to add a file upload component to a page.  After adding the
> > tapestry-upload dependency to my POM, I kept getting exceptions trying to
> > convert CoffeeScript Files to JavaScript files:
> >
> > [ERROR] TapestryModule.RequestExceptionHandler Processing of request
> failed
> > with uncaught exception: java.lang.NoSuchMethodError:
> >
> org.apache.commons.io.IOUtils.toString(Ljava/io/InputStream;Ljava/nio/charset/Charset;)Ljava/lang/String;
> >
> > java.lang.NoSuchMethodError:
> >
> org.apache.commons.io.IOUtils.toString(Ljava/io/InputStream;Ljava/nio/charset/Charset;)Ljava/lang/String;
> >
> >
> > After doing a little exploring, I found the commons-io dependency in
> > tapestry-upload:
> >
> > 
> >   commons-io
> >   commons-io
> >   2.0.1
> >   compile
> > 
> >
> > I then overrode tapestry-upload's commons-io with version 2.4 and the
> > exception went away and CoffeeScript to JavaScript conversion started
> > working again.
> >
> > Has anyone else used tapestry-upload in 5.4?  Did you encounter issues
> with
> > this JAR and/or have to update the version?
> >
> > Thanks,
> >
> > mrg
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


RE: Updating a zone from a property method

2014-03-25 Thread Davide Vecchi
Sorry for the double post. After I posted the first one I realized I had 
unsubscribed from the mailing list some time ago, so I subscribed and sent the 
question again. I thought the one I had sent while unsubscribed wouldn't show 
up (it hadn't at that time). My apologies.

-Original Message-
Sent: Tuesday, March 25, 2014 12:27
To: users@tapestry.apache.org
Subject: Updating a zone from a property method

I have a zone to show possible errors that might occur in a get* method called 
by Tapestry during page rendering to retrieve the value for a property (String 
myValue in the example below).

So in this getMyValue() method I set the error message into another property 
(@Property String errorMessage) and I call addRender to update the template 
zone errorZone, where ${errorMessage} is placed.

My problem is that this call to addRender has no effect: the errorMessage is 
not shown. But if I just reload the page it is shown.

Below is a testable example. I'm trying to find out what's the right way to 
update a zone from a get* method called by Tapestry during page rendering.

#
TestRender.tml:
#


http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>

   

  

 ${errorMessage}

  

   

   myValue: ${myValue}




#
TestRender.java:
#

import java.util.Date;

import org.apache.tapestry5.PersistenceConstants;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.ajax.AjaxResponseRenderer;

public class TestRender
{

   @Persist(PersistenceConstants.FLASH)
   @Property
   private boolean  isError;

   @Persist(PersistenceConstants.FLASH)
   @Property
   private String   errorMessage;

   @InjectComponent
   @Property
   private Zone errorZone;

   @Inject
   private AjaxResponseRenderer ajaxResponseRenderer;

   @Persist
   private String   myValue;

   public void setupRender()
   {
  System.out.println(new Date() + " setupRender() was executed. It 
does nothing at all.");
   }

   public String getMyValue()
   {
  if (this.myValue == null)
  {
 System.out.println(new Date() + " myValue was null, so 
getMyValue() is setting it...");

 this.myValue = "My value at " + new Date();

 this.isError = true;
 this.errorMessage = "Let's say there was an error so I 
want to show this error message.";

 this.ajaxResponseRenderer.addRender(this.errorZone);

 /* I expected this addRender to cause the error message to 
be shown right away
without the need to reload the page, but this is not 
the case. */

 System.out.println(new Date() + " getMyValue() has just 
called addRender.");
  }
  else
  {
 System.out.println(new Date() + " myValue was NOT null, so 
getMyValue() did nothing at all.");
  }
  return this.myValue;
   }
}


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



Updating a zone from a property method

2014-03-25 Thread Davide Vecchi
I have a zone to show possible errors that might occur in a get* method called 
by Tapestry during page rendering to retrieve the value for a property (String 
myValue in the example below).

So in this getMyValue() method I set the error message into another property 
(@Property String errorMessage) and I call addRender to update the template 
zone errorZone, where ${errorMessage} is placed.

My problem is that this call to addRender has no effect: the errorMessage is 
not shown. But if I just reload the page it is shown.

Below is a testable example. I'm trying to find out what's the right way to 
update a zone from a get* method called by Tapestry during page rendering.

#
TestRender.tml:
#


http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>

   

  

 ${errorMessage}

  

   

   myValue: ${myValue}




#
TestRender.java:
#

import java.util.Date;

import org.apache.tapestry5.PersistenceConstants;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.ajax.AjaxResponseRenderer;

public class TestRender
{

   @Persist(PersistenceConstants.FLASH)
   @Property
   private boolean  isError;

   @Persist(PersistenceConstants.FLASH)
   @Property
   private String   errorMessage;

   @InjectComponent
   @Property
   private Zone errorZone;

   @Inject
   private AjaxResponseRenderer ajaxResponseRenderer;

   @Persist
   private String   myValue;

   public void setupRender()
   {
  System.out.println(new Date() + " setupRender() was executed. It 
does nothing at all.");
   }

   public String getMyValue()
   {
  if (this.myValue == null)
  {
 System.out.println(new Date() + " myValue was null, so 
getMyValue() is setting it...");

 this.myValue = "My value at " + new Date();

 this.isError = true;
 this.errorMessage = "Let's say there was an error so I 
want to show this error message.";

 this.ajaxResponseRenderer.addRender(this.errorZone);

 /* I expected this addRender to cause the error message to 
be shown right away
without the need to reload the page, but this is not 
the case. */

 System.out.println(new Date() + " getMyValue() has just 
called addRender.");
  }
  else
  {
 System.out.println(new Date() + " myValue was NOT null, so 
getMyValue() did nothing at all.");
  }
  return this.myValue;
   }
}



Updating a zone from a property method

2014-03-25 Thread Davide Vecchi
I have a zone to show possible errors that might occur in a get* method called 
by Tapestry during page rendering to retrieve the value for a property (String 
myValue in the example below).

So in this getMyValue() method I set the error message into another property 
(@Property String errorMessage) and I call addRender to update the template 
zone errorZone, where ${errorMessage} is placed.

My problem is that this call to addRender has no effect: the errorMessage is 
not shown. But if I just reload the page it is shown.

Below is a testable example. I'm trying to find out what's the right way to 
update a zone from a get* method called by Tapestry during page rendering.

#
TestRender.tml:
#


http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>

   

  

 ${errorMessage}

  

   

   myValue: ${myValue}




#
TestRender.java:
#

import java.util.Date;

import org.apache.tapestry5.PersistenceConstants;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.ajax.AjaxResponseRenderer;

public class TestRender
{

   @Persist(PersistenceConstants.FLASH)
   @Property
   private boolean  isError;

   @Persist(PersistenceConstants.FLASH)
   @Property
   private String   errorMessage;

   @InjectComponent
   @Property
   private Zone errorZone;

   @Inject
   private AjaxResponseRenderer ajaxResponseRenderer;

   @Persist
   private String   myValue;

   public void setupRender()
   {
  System.out.println(new Date() + " setupRender() was executed. It 
does nothing at all.");
   }

   public String getMyValue()
   {
  if (this.myValue == null)
  {
 System.out.println(new Date() + " myValue was null, so 
getMyValue() is setting it...");

 this.myValue = "My value at " + new Date();

 this.isError = true;
 this.errorMessage = "Let's say there was an error so I 
want to show this error message.";

 this.ajaxResponseRenderer.addRender(this.errorZone);

 /* I expected this addRender to cause the error message to 
be shown right away
without the need to reload the page, but this is not 
the case. */

 System.out.println(new Date() + " getMyValue() has just 
called addRender.");
  }
  else
  {
 System.out.println(new Date() + " myValue was NOT null, so 
getMyValue() did nothing at all.");
  }
  return this.myValue;
   }
}




Rendering multiple zone in nested component.

2014-03-25 Thread abangkis
Hello,

I have 3 nested object. A survey, a section and a question. A survey will
contain sections and a section will contain questions. I want to create a
single page editor for this nested object using ajax.

In add survey page i have created two zone, survey zone and
sectionListZone. The survey zone content will depend on a flag. It can show
an input form for the survey or a view of the survey data. The
sectionListZone content is a SectionHolder component (custom component for
handling the section).

The SectionHolder component also contains two zone, sZone and qZone. The
sZone content also depend on a flag, to show an input form for the section
or to view the section data. The qZone content is a QuestionHolder
component (custom component for handling the questions).

I've managed to create the add survey page to add & view the survey data. I
also manage to create the section holder component by using the same
pattern as the add survey page (using ajax response renderer to render both
zone when the form is submitted). The problem is in the SectionHolder
component i can't render multiple zone using ajax renderer. Returning a
block from onSuccess will work. But using ajax renderer to render the zone
will result this error :

Element 'sZone' does not have an associated Tapestry.ZoneManager object.

Communication with the server failed: TypeError: Cannot call method
'getStorage' of null

Here's my code for the Add Survey page & the Section Holder.
Thanks

=== Add Survey TML ===


 
 
 

 


 






 






 
 
 
 SURVEY BLOCK 
Title : ${survey?.title}
 Edit
 



 



== Add Survey.Java =
@Inject
private AjaxResponseRenderer ajaxRenderer;
 @Inject
private Block addSurveyBlock, viewSurveyBlock, viewSectionListBlock,
emptyBlock;

@Inject
private Request request;

@InjectComponent
private Zone surveyZone, sectionListZone;

@Property
 @Persist // TODO erase this when we use database
private Survey survey;

@Persist
 private boolean isReadyToPublish;
 @Persist
private boolean isEditSurvey;
 @Persist
private boolean isSectionShown;

void onSuccess() {
isEditSurvey = false;
isSectionShown = true;
 if(request.isXHR()) {
ajaxRenderer.addRender(surveyZone).addRender(sectionListZone);
 }
}
 public Object getSurveyBlock() {
 return isEditSurvey ? addSurveyBlock : viewSurveyBlock;
}
 public Object getSectionListBlock() {
return isSectionShown? viewSectionListBlock : emptyBlock;
}

void onActionFromEditSurvey() {
isEditSurvey = true;
if(request.isXHR()) {
 ajaxRenderer.addRender(surveyZone);
}
}


=== SectionHolder Component tml ===

Section
 

 Section 1


 
 
 


 

 



 Question Block




=== Section Holder.java ===

@Inject
private Request request;

@Inject
private AjaxResponseRenderer ajaxRenderer;

@InjectComponent
private Zone sZone, qZone;

@Property
private String name;
 void onSuccess() {
System.out.println("Success!");
 if(request.isXHR()) {
ajaxRenderer.addRender(sZone).addRender(qZone);
 }
}

-- 
http://www.mreunionlabs.net/ 
twitter : @mreunionlabs
page : https://plus.google.com/104168782385184990771