Re: Frontend Frameworks / Libraries

2015-08-07 Thread Kalle Korhonen
On Fri, Aug 7, 2015 at 3:40 PM, françois facon  wrote:

> About Ember, I looking for an equivalent of
> https://docs.angularjs.org/tutorial.
>

I haven't found anything quite as comprehensive for Ember. One issue with
Ember is that many of these tutorials are outdated because its changed so
fast. The official documentation is often too simplistic when you are new
to it but trying to build something real. However, this one is fairly
up-to-date and helped me quite a bit when I started out:
http://www.fnaweso.me/ember-js-nested-routing-with-multiple-outlets/

At least for me, working with AngularJS feels more like working with T5
services and its IoC whereas working with Ember feels more like writing T5
components and I felt right at home with all the Ember conventions. And
while it's relatively easy to bootstrap AngularJS to run as part of T5 app,
it really doesn't make sense with all the bits and pieces of Ember tooling,
the CLI etc (there was an earlier thread about that and I followed Andreas
Andreou's advice). Ember is more comprehensive than AngularJS and its
router is incredibly useful for mapping out a structure for larger spas.

Kalle



> 2015-08-07 22:18 GMT+02:00 Kalle Korhonen :
>
> > It's pretty easy. Don't build component event requests but just send
> > REST(-like) requests that are either processed by plain Tapestry pages
> and
> > its EventContext. If you are building a more comprehensive spa then
> > consider pairing the client with JAX-WS resource backend (i.e.
> > http://www.tynamo.org/tapestry-resteasy+guide/ for T5). Incidentally,
> I've
> > been working with spas lately as well, and moved from AngularJS to Ember.
> >
> > Kalle
> >
> > On Fri, Aug 7, 2015 at 12:46 PM, Bob Harner  wrote:
> >
> > > Yes a page/event. As long as the URL looks like a tapestry event
> request,
> > > you can handle the request in an event handler method within the page's
> > > Java class, and return JSON.
> > >
> > > On Fri, Aug 7, 2015 at 2:40 PM, George Christman <
> > gchrist...@cardaddy.com>
> > > wrote:
> > >
> > > > Hi guys, I've been playing around with AngularJS and backbone
> recently
> > > and
> > > > I'm wondering if it's pretty easy to use with Tapestry? I'm more
> > > concerned
> > > > with ajax events etc. I know in grails you can just point your url
> to a
> > > > controller/action, would we do something similar in Tapestry, but
> > > obviously
> > > > not a controller, but a page / event?
> > > >
> > >
> >
>


Re: Frontend Frameworks / Libraries

2015-08-07 Thread françois facon
Hi George,

I like to use a Tapestry page to bootstrap a AngularJs application. For
instance
https://github.com/ffacon/tapestry5-angular-demo/blob/master/src/main/java/dev/openshift/tapestry/angular/pages/Index.java
serve a RequireJS configuration file  and use page/ event to serve data to
the spa.

If you want you Tapestry to answer to GET Request send by AngularJS, you
just need need to do configure your httpProvider like this :
$httpProvider.defaults.headers.common["X-Requested-With"] =
'XMLHttpRequest';

I am not sure that using a RequireJS is the best way to bootstrap a
AngularJS app so if like me you prefer to use Tapestry Javascript Stack see
also https://github.com/ffacon/BookCat.

As suggested by Kalle, for POST and others HTTP verbs, I would use
tapestry-resteasy.

About Ember, I looking for an equivalent of
https://docs.angularjs.org/tutorial.

François

2015-08-07 22:18 GMT+02:00 Kalle Korhonen :

> It's pretty easy. Don't build component event requests but just send
> REST(-like) requests that are either processed by plain Tapestry pages and
> its EventContext. If you are building a more comprehensive spa then
> consider pairing the client with JAX-WS resource backend (i.e.
> http://www.tynamo.org/tapestry-resteasy+guide/ for T5). Incidentally, I've
> been working with spas lately as well, and moved from AngularJS to Ember.
>
> Kalle
>
> On Fri, Aug 7, 2015 at 12:46 PM, Bob Harner  wrote:
>
> > Yes a page/event. As long as the URL looks like a tapestry event request,
> > you can handle the request in an event handler method within the page's
> > Java class, and return JSON.
> >
> > On Fri, Aug 7, 2015 at 2:40 PM, George Christman <
> gchrist...@cardaddy.com>
> > wrote:
> >
> > > Hi guys, I've been playing around with AngularJS and backbone recently
> > and
> > > I'm wondering if it's pretty easy to use with Tapestry? I'm more
> > concerned
> > > with ajax events etc. I know in grails you can just point your url to a
> > > controller/action, would we do something similar in Tapestry, but
> > obviously
> > > not a controller, but a page / event?
> > >
> >
>


Re: Frontend Frameworks / Libraries

2015-08-07 Thread Kalle Korhonen
It's pretty easy. Don't build component event requests but just send
REST(-like) requests that are either processed by plain Tapestry pages and
its EventContext. If you are building a more comprehensive spa then
consider pairing the client with JAX-WS resource backend (i.e.
http://www.tynamo.org/tapestry-resteasy+guide/ for T5). Incidentally, I've
been working with spas lately as well, and moved from AngularJS to Ember.

Kalle

On Fri, Aug 7, 2015 at 12:46 PM, Bob Harner  wrote:

> Yes a page/event. As long as the URL looks like a tapestry event request,
> you can handle the request in an event handler method within the page's
> Java class, and return JSON.
>
> On Fri, Aug 7, 2015 at 2:40 PM, George Christman 
> wrote:
>
> > Hi guys, I've been playing around with AngularJS and backbone recently
> and
> > I'm wondering if it's pretty easy to use with Tapestry? I'm more
> concerned
> > with ajax events etc. I know in grails you can just point your url to a
> > controller/action, would we do something similar in Tapestry, but
> obviously
> > not a controller, but a page / event?
> >
>


Re: Frontend Frameworks / Libraries

2015-08-07 Thread Bob Harner
Yes a page/event. As long as the URL looks like a tapestry event request,
you can handle the request in an event handler method within the page's
Java class, and return JSON.

On Fri, Aug 7, 2015 at 2:40 PM, George Christman 
wrote:

> Hi guys, I've been playing around with AngularJS and backbone recently and
> I'm wondering if it's pretty easy to use with Tapestry? I'm more concerned
> with ajax events etc. I know in grails you can just point your url to a
> controller/action, would we do something similar in Tapestry, but obviously
> not a controller, but a page / event?
>


Re: Multiple domains, one webapp

2015-08-07 Thread George Christman
I use to host tons of dealer websites on a single Tapestry application all
with their own unique domain. I used a combination of Mod rewrite and
Tapestry's URL rewriter. It worked flawlessly.

On Fri, Aug 7, 2015 at 8:00 AM, Svein-Erik Løken  wrote:

> >
> > > WOW! Multi-module in Tapestry with Live Class Reloading is fantastic!
> > > Thanks for pointing me in the right direction Thiago!
> >
> > Yay! Virtual high-five! :D Tapestry is awesome, isn't it? ;)
> >
>
> Oh yea! T5.4 is a success!
>
> > specify @SubModule(HappyModule.class) (or @ImportModule in T5.4) in your
> Tanks Kalle! A good replacement for
> 
>
>
> I am moving a lot of code to my common module. I think the biggest
> challenge is how to access assets from JavaScript.
>
> I moved the box_1.png, box_2.png, ... images to my common modules
> META-INF.assets.jacillacore.img.destinationStatus
>
> public static void
> contributeComponentClassResolver(Configuration
> configuration) {
> configuration.add(new LibraryMapping("jacillacore",
> "com.jacilla.core"));
> }
>
> My original code:
> var iconUrl = "/img/destinationStatus/box_" + prepStatus + ".png";
>
> Tried:
> var iconUrl = "${asset:jacillacore/img/destinationStatus/box_" +
> prepStatus + ".png}";
> and:
> var iconUrl = "/jacillacore/assets/jacillacore/img/destinationStatus/box_"
> + prepStatus + ".png";
>
>
> It did not work! Is it possible to access then directly for javascript?
>
> To make it work I had to send the asset url's to the javascript module:
> final JSONObject statusImages = new JSONObject();
> for (int i = 1; i <= maxStatus; i++) {
> final String format =
> String.format("/META-INF/assets/jacillacore/img/destinationStatus/box_%d.png",
> i);
> Asset asset = assetSource.getExpandedAsset(format);
> statusImages.put(String.valueOf(i), asset.toClientURL());
> }
> return new JSONObject(
> "statusImages", statusImages,
> "symbols", symbols);
>
> Is this the correct way of doing this in T5.4, or could it be simpler?
>
>
>
>
>
>


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


Frontend Frameworks / Libraries

2015-08-07 Thread George Christman
Hi guys, I've been playing around with AngularJS and backbone recently and
I'm wondering if it's pretty easy to use with Tapestry? I'm more concerned
with ajax events etc. I know in grails you can just point your url to a
controller/action, would we do something similar in Tapestry, but obviously
not a controller, but a page / event?


RE: Multiple domains, one webapp

2015-08-07 Thread Svein-Erik Løken
> 
> > WOW! Multi-module in Tapestry with Live Class Reloading is fantastic!
> > Thanks for pointing me in the right direction Thiago!
> 
> Yay! Virtual high-five! :D Tapestry is awesome, isn't it? ;)
> 

Oh yea! T5.4 is a success!

> specify @SubModule(HappyModule.class) (or @ImportModule in T5.4) in your
Tanks Kalle! A good replacement for  


I am moving a lot of code to my common module. I think the biggest challenge is 
how to access assets from JavaScript.

I moved the box_1.png, box_2.png, ... images to my common modules 
META-INF.assets.jacillacore.img.destinationStatus

public static void 
contributeComponentClassResolver(Configuration configuration) {
configuration.add(new LibraryMapping("jacillacore", 
"com.jacilla.core"));
}

My original code:
var iconUrl = "/img/destinationStatus/box_" + prepStatus + ".png";

Tried: 
var iconUrl = "${asset:jacillacore/img/destinationStatus/box_" + prepStatus + 
".png}";
and:
var iconUrl = "/jacillacore/assets/jacillacore/img/destinationStatus/box_" + 
prepStatus + ".png";


It did not work! Is it possible to access then directly for javascript?

To make it work I had to send the asset url's to the javascript module:
final JSONObject statusImages = new JSONObject();
for (int i = 1; i <= maxStatus; i++) {
final String format = 
String.format("/META-INF/assets/jacillacore/img/destinationStatus/box_%d.png", 
i);
Asset asset = assetSource.getExpandedAsset(format);
statusImages.put(String.valueOf(i), asset.toClientURL());
}
return new JSONObject(
"statusImages", statusImages,
"symbols", symbols);

Is this the correct way of doing this in T5.4, or could it be simpler?