Components and sub packages, how to reference within templates?

2010-08-07 Thread Christian Koller
Hi Josh

Many thanks, I'm sure i tried the dot notation several time yesterday and it 
wasn't working.
Today after a fresh system restart a tried again and it works without any 
problems.

On 07.08.2010, at 05:16, Josh Canfield wrote:

 t:subpackage.myComponent t:id=myComponent startTime='08h 00m'
 endTime='20h 00m'/
 
 or
 
 div t:type=subpackage/myComponent ...
 
 the slash isn't valid XML in the element name.
 
 Josh
 
 On Fri, Aug 6, 2010 at 6:25 PM, Christian Koller
 christian.kol...@net-m.ch wrote:
 According the documentation it should be possible to put components to a sub 
 package of the package components.
 
 Quote:
 Sub-Folders / Sub-Packages
 Classes do not have to go directly inside the package (pages, components, 
 mixins, etc.). It is valid to create a sub-package to store some of the 
 classes. The sub-package name becomes part of the page name or component 
 type. Thus you might define a page component 
 com.example.myapp.pages.admin.CreateUser and the logical page name (which 
 often shows up inside URLs) will be admin/CreateUser.
 
 
 But I ask me how I can reference the component in the template, because this 
 one isn't working:
 
 t:subpackage/myComponent t:id=myComponent startTime='08h 00m' 
 endTime='20h 00m'/
 
 Any ideas?
 thx
 chris
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 
 
 
 -- 
 --
 http://www.bodylabgym.com - a private, by appointment only, one-on-one
 health and fitness facility.
 --
 http://www.ectransition.com - Quality Electronic Cigarettes at a
 reasonable price!
 --
 TheDailyTube.com. Sign up and get the best new videos on the internet
 delivered fresh to your inbox.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 

Christian Koller
Sofwareentwickler
 
net mobile Schweiz AG
Seestrasse 45
CH ñ 8702 Zollikon
 
Tel: + 41 (0) 44 918 99 99
Fax: + 41 (0) 44 918 99 98
Direkt:  + 41 (0) 44 918 99 72

Mail: christian.kol...@net-m.ch
Web:  www.net-m.ch


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



Re: how to contribute a 'component context' service

2010-08-07 Thread Christophe Cordenier
Hi !

As Howard suggested, you may have a look into TapestryModule, you will see
how RenderSupportImpl is built and pushed into the environment (cf.
contributeMarkupRenderer)

Also as Thiago mentioned it, ComponentResources is not a service, it can be
injected into pages because Tapestry 'shadows' @Inject to the
environment.peek() method

HTH

2010/8/7 Paul Stanton p...@mapshed.com.au

 That doesn't seem to work Thiago, or maybe I'm missing something:

 public class TapestryExtensionImpl implements TapestryExtension
 {
   @Inject
   private Environment environment;

   @SuppressWarnings(unchecked)
   public T T getPage(ClassT pageClass)
   {
   ComponentSource componentSource =
 environment.peekRequired(ComponentSource.class);
   return (T) componentSource.getPage(pageClass);
   }
 }

 Caused by: java.lang.RuntimeException: No object of type
 org.apache.tapestry5.services.ComponentSource is available from the
 Environment.  Available types are
 org.apache.tapestry5.services.ComponentEventResultProcessor.
   at
 org.apache.tapestry5.internal.services.EnvironmentImpl.peekRequired(EnvironmentImpl.java:79)
   at $Environment_12a4a4a9c82.peekRequired($Environment_12a4a4a9c82.java)
   at $Environment_12a4a4a9bbb.peekRequired($Environment_12a4a4a9bbb.java)
   at
 com.mapshed.vha.services.TapestryExtensionImpl.getPage(TapestryExtensionImpl.java:21)


 Thiago H. de Paula Figueiredo wrote:

 On Fri, 06 Aug 2010 17:38:53 -0300, Paul Stanton p...@mapshed.com.au
 wrote:

  Thiago,


 Hi!

  By declare your class as a service do you mean bind it? ie:

public static void bind(ServiceBinder binder) {
binder.bind(TapestryExtension.class, TapestryExtensionImpl.class);
}


 Yes.

  or do i need to 'contribute' it somewhere? Because it isn't working.:


 ComponentResources ins't a service. There's class transformation applied
 to component and pages classes that inject it. You should get it from the
 Environment service by using the peek() or peekRequired() methods.


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




-- 
Regards,
Christophe Cordenier.

Committer on Apache Tapestry 5
Co-creator of wooki @wookicentral.com


Re: Classloader problem, loader constraint violation

2010-08-07 Thread Christophe Cordenier
Hi !

A few questions

Why do wrapped Upload component instance ? What is the complete package of
UploadFileWrapper ?

2010/8/6 LLTYK ll...@mailinator.com


 Any ideas? A search says don't put the wrong things in the base package,
 but UploadFileWrapper isn't in any tapestry packages.


 2010-08-06 15:56:57,343 [qtp1741911230-24] ERROR
 org.apache.tapestry5.services.TapestryModule.RequestExceptionHandler  -
 Processing of request failed with uncaught exception: loader constraint
 violation: when resolving method

 com.x.y.UploadFileWrapper.setUploadFile(Lorg/apache/tapestry5/upload/components/Upload;)V
 the class loader (instance of

 org/apache/tapestry5/internal/services/ComponentInstantiatorSourceImpl$PackageAwareLoader)
 of the current class, $PropertyConduit_12a48f3ea42, and the class loader
 (instance of org/eclipse/jetty/webapp/WebAppClassLoader) for resolved
 class,
 com/x/y/UploadFileWrapper, have different Class objects for the type
 org/apache/tapestry5/upload/components/Upload used in the signature



 Here's the similar thread:

 http://tapestry-users.832.n2.nabble.com/Simplified-paths-for-dynamic-asset-context-td4087004.html#a4089097
 --
 View this message in context:
 http://tapestry-users.832.n2.nabble.com/Classloader-problem-loader-constraint-violation-tp5381992p5381992.html
 Sent from the Tapestry Users mailing list archive at Nabble.com.

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




-- 
Regards,
Christophe Cordenier.

Committer on Apache Tapestry 5
Co-creator of wooki @wookicentral.com


Re: how to contribute a 'component context' service

2010-08-07 Thread Igor Drobiazko
The exception message is telling you that ComponentResources is not
available in the registry. This service is only available for injection in
components and pages.

On Fri, Aug 6, 2010 at 10:38 PM, Paul Stanton p...@mapshed.com.au wrote:

 Thiago,

 By declare your class as a service do you mean bind it? ie:

   public static void bind(ServiceBinder binder) {
   binder.bind(TapestryExtension.class, TapestryExtensionImpl.class);
   }

 or do i need to 'contribute' it somewhere? Because it isn't working.:

 2010-08-07 06:33:33,406 http-80-6  DEBUG
 package.services.AppModule.TapestryExtension  - Invoking constructor
 package.services.TapestryExtensionImpl() (at TapestryExtensionImpl.java:9)
 via package.services.AppModule.bind(ServiceBinder) (at AppModule.java:35).
 2010-08-07 06:33:33,421 http-80-6  ERROR
 org.apache.tapestry5.ioc.Registry- No service implements the interface
 org.apache.tapestry5.ComponentResources.
 2010-08-07 06:33:33,421 http-80-6  ERROR
 org.apache.tapestry5.ioc.Registry- Operations trace:
 2010-08-07 06:33:33,421 http-80-6  ERROR
 org.apache.tapestry5.ioc.Registry- [ 1] Realizing service
 TapestryExtension
 2010-08-07 06:33:33,421 http-80-6  ERROR
 org.apache.tapestry5.ioc.Registry- [ 2] Invoking
 package.services.TapestryExtensionImpl() (at TapestryExtensionImpl.java:9)
 via package.services.AppModule.bind(ServiceBinder) (at AppModule.java:35)
 2010-08-07 06:33:33,437 http-80-6  ERROR
 org.apache.tapestry5.ioc.Registry- [ 3] Calculating injection value for
 field 'resources' (org.apache.tapestry5.ComponentResources)
 2010-08-07 06:33:33,437 http-80-6  ERROR
 org.apache.tapestry5.ioc.Registry- [ 4] Resolving object of type
 org.apache.tapestry5.ComponentResources using MasterObjectProvider
 2010-08-07 06:33:33,453 http-80-6  ERROR
 package.services.AppModule.TapestryExtension  - Construction of service
 TapestryExtension failed: Error invoking constructor
 package.services.TapestryExtensionImpl() (at TapestryExtensionImpl.java:9)
 via package.services.AppModule.bind(ServiceBinder) (at AppModule.java:35)
 (for service 'TapestryExtension'): No service implements the interface
 org.apache.tapestry5.ComponentResources.
 java.lang.RuntimeException: Error invoking constructor
 package.services.TapestryExtensionImpl() (at TapestryExtensionImpl.java:9)
 via package.services.AppModule.bind(ServiceBinder) (at AppModule.java:35)
 (for service 'TapestryExtension'): No service implements the interface
 org.apache.tapestry5.ComponentResources.
   at
 org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:76)
   at
 org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
   at
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
   at
 org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
   at
 org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
   at
 org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
   at
 org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29)
   at
 org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46)
   at
 org.apache.tapestry5.ioc.internal.AdvisorStackBuilder.createObject(AdvisorStackBuilder.java:60)
   at
 org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:52)
   at
 org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
   at
 org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
   at
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
   at
 org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
   at
 org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
   at
 org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
   at
 org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:68)
   at
 org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:57)
   at
 $TapestryExtension_12a491b407b.delegate($TapestryExtension_12a491b407b.java)
   at
 $TapestryExtension_12a491b407b.getPage($TapestryExtension_12a491b407b.java)
 Caused by: java.lang.RuntimeException: No service implements the interface
 org.apache.tapestry5.ComponentResources.
   at
 org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:560)
   at
 

Re: how to contribute a 'component context' service

2010-08-07 Thread Thiago H. de Paula Figueiredo
On Fri, 06 Aug 2010 23:11:52 -0300, Paul Stanton p...@mapshed.com.au  
wrote:



That doesn't seem to work Thiago, or maybe I'm missing something:

public class TapestryExtensionImpl implements TapestryExtension
{
@Inject
private Environment environment;

@SuppressWarnings(unchecked)
public T T getPage(ClassT pageClass)
{
ComponentSource componentSource =  
environment.peekRequired(ComponentSource.class);

return (T) componentSource.getPage(pageClass);
}
}


ComponentSource is a service, not an environmental object, so you should  
inject it directly.


As Christophe said, you can learn a lot of Tapestry by looking at the  
TapestryModule source. That's how I got most of my Tapestry knowledge.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



DISCUSSION: Time zones and date selection

2010-08-07 Thread Howard Lewis Ship
This is something that's been nagging me. Although there's a bunch of good
options for selecting a date (or date/time) as JavaScript components bult
into Tapestry, or available elsewhere ... none of them address the issue of
the client and the server operating in different time zones.

At the very least, these components probably should include a time zone drop
down list (or other means of selection).

I haven't been able to find a sure-fire way of determing the user's time
zone from the HttpRequest.

I'm curious what kinds of solutions the community have used to address this
issue. It would be nice to come up with a true solution for Tapestry 5.3.

One option is a bit of JavaScript that reports the client's time zone (or
just time) to the server so that the server can identify their time zone
automatically.

-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to learn
how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com


Re: Upgrading from 5.1 to 5.2

2010-08-07 Thread Guerin Laurent

Hi Andreas,

Thank you for your random choice :-)

With Katia (co-author) we are planning to upgrade this little Tapestry  
demo to 5.2 version soon and add some enhanced components.

Thank you for your advices and your pull request on GitHub.

Regards,

Laurent Guerin

Envoyé de mon iPhone

Le 7 août 2010 à 04:26, Andreas Andreou andre...@gmail.com a  
écrit :



So, i picked a random 5.1 project from github (
http://github.com/lguerin/tapestwitter )
forked it, upgraded it to 5.2 and fixed all deprecation warnings...
take a look /comment at the
change logs at [1] and [2]

I've found 2 small things worth noticing:
1) the project was building a JSONObject and outputting it INSIDE a js
string - because by default
the json is now pretty-printed, the newlines where causing js errors.
The fix was to use json.toString(true)
2) The old renderSupport.addInit could accept a JSONArray and map the
elements to the function's arguments
Now you should build a JSONObject which will become the only argument
of the function and use javaScriptSupport...
Of course that's already documented and explained at [3] but i'm
thinking the old way will appear more straightforward
to some (i did spend some minutes trying to find how to send that
second parameter before understanding that i should
just bundle it along with the first inside a json)


[1] 
http://github.com/andyhot/tapestwitter/commit/2dd797629cd0506a9fc5625e71100170c0cde300
[2] 
http://github.com/andyhot/tapestwitter/commit/b815eb395d9e820833ebf875a310b6d440f65f46
[3] 
http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/RenderSupport.html#addInit%28java.lang.String,%20org.apache.tapestry5.json.JSONArray%29


--
Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
Tapestry PMC / Tacos developer
Open Source / JEE Consulting

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



Re: DISCUSSION: Time zones and date selection

2010-08-07 Thread Christophe Cordenier
Hi

Just an add, related issue was reported there
https://issues.apache.org/jira/browse/TAP5-841


2010/8/7 Howard Lewis Ship hls...@gmail.com

 This is something that's been nagging me. Although there's a bunch of good
 options for selecting a date (or date/time) as JavaScript components bult
 into Tapestry, or available elsewhere ... none of them address the issue of
 the client and the server operating in different time zones.

 At the very least, these components probably should include a time zone
 drop
 down list (or other means of selection).

 I haven't been able to find a sure-fire way of determing the user's time
 zone from the HttpRequest.

 I'm curious what kinds of solutions the community have used to address this
 issue. It would be nice to come up with a true solution for Tapestry 5.3.

 One option is a bit of JavaScript that reports the client's time zone (or
 just time) to the server so that the server can identify their time zone
 automatically.

 --
 Howard M. Lewis Ship

 Creator of Apache Tapestry

 The source for Tapestry training, mentoring and support. Contact me to
 learn
 how I can get you up and productive in Tapestry fast!

 (971) 678-5210
 http://howardlewisship.com




-- 
Regards,
Christophe Cordenier.

Committer on Apache Tapestry 5
Co-creator of wooki @wookicentral.com


Embedded Form component becomes null in Tap 5.2.0-Snapshot

2010-08-07 Thread Shing Hing Man
Hi,

I have an embedded form component that is null inside a onSubmit method. 
It was not the case in Tap 5.1.

In .tml :
t:form t:id=myForm 
   
/t:form

In Java page
 
@Component(id = myForm)
private Form form;

@OnEvent(component = myForm, value = submit)
public void submit() {
   // form is null below !   
   ValidationTracker validationTracker = form.getDefaultTracker(); 
}

When the form is submitted, inside the submit method, form is null. 
I am using 
tapestry-core:5.2.0-20100801.103309-116

Below is the stack trace.

# com.man.testTapestry5.pages.test.Sum.submit(Sum.java:172)
# 
com.man.testTapestry5.pages.test.Sum$MethodAccess_submit_12a4dd6b537.invoke(Sum$MethodAccess_submit_12a4dd6b537.java)
# 
org.apache.tapestry5.internal.transform.BaseEventHandlerMethodInvoker.invokeEventHandlerMethod(BaseEventHandlerMethodInvoker.java:52)
# 
org.apache.tapestry5.internal.transform.OnEventWorker$4.invokeEventHandlers(OnEventWorker.java:157)
# 
org.apache.tapestry5.internal.transform.OnEventWorker$4.advise(OnEventWorker.java:136)
# 
org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:86)
# com.man.testTapestry5.pages.test.Sum.dispatchComponentEvent(Sum.java)
# 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:942)
# 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1132)
# 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$3000(ComponentPageElementImpl.java:72)
# 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$7.invoke(ComponentPageElementImpl.java:1077)
# 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$7.invoke(ComponentPageElementImpl.java:1074)
# 
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
# 
org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
# org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1057)
# 
org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:141)
# 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1073)
# 
org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.triggerContextEvent(InternalComponentResourcesImpl.java:287)
# org.apache.tapestry5.corelib.components.Form._$advised$onAction(Form.java:548)
# 
org.apache.tapestry5.corelib.components.Form$onAction$invocation_12a4dd6c009.invokeAdvisedMethod(Form$onAction$invocation_12a4dd6c009.java)
# 
org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:77)
# 
org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:37)
# org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54)
# 
org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:86)
# org.apache.tapestry5.corelib.components.Form.onAction(Form.java)
# 
org.apache.tapestry5.corelib.components.Form$MethodAccess_onAction_12a4dd6b53f.invoke(Form$MethodAccess_onAction_12a4dd6b53f.java)
# 
org.apache.tapestry5.internal.transform.BaseEventHandlerMethodInvoker.invokeEventHandlerMethod(BaseEventHandlerMethodInvoker.java:52)
# 
org.apache.tapestry5.internal.transform.OnEventWorker$4.invokeEventHandlers(OnEventWorker.java:157)
# 
org.apache.tapestry5.internal.transform.OnEventWorker$4.advise(OnEventWorker.java:136)
# 
org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:86)
# org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
# 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:950)
# 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1132)
# 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$3000(ComponentPageElementImpl.java:72)
# 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$7.invoke(ComponentPageElementImpl.java:1077)
# 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$7.invoke(ComponentPageElementImpl.java:1074)
# 
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
# 
org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
# org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1057)
# 
org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:141)
# 

RE : Upgrading from 5.1 to 5.2

2010-08-07 Thread Laurent Guerin
Hi Andreas,

With Katia (co-author) we are planning to upgrade this little Tapestry demo
to 5.2 version soon and add some enhanced components.
Thank you for your advices.

Regards,

Laurent Guerin

 Message d'origine
De: Andreas Andreou [mailto:andre...@gmail.com]
Date: sam. 07/08/2010 04:26
À: Tapestry users
Objet : Upgrading from 5.1 to 5.2

So, i picked a random 5.1 project from github (
http://github.com/lguerin/tapestwitter )
forked it, upgraded it to 5.2 and fixed all deprecation warnings...
take a look /comment at the
change logs at [1] and [2]

I've found 2 small things worth noticing:
1) the project was building a JSONObject and outputting it INSIDE a js
string - because by default
the json is now pretty-printed, the newlines where causing js errors.
The fix was to use json.toString(true)
2) The old renderSupport.addInit could accept a JSONArray and map the
elements to the function's arguments
Now you should build a JSONObject which will become the only argument
of the function and use javaScriptSupport...
Of course that's already documented and explained at [3] but i'm
thinking the old way will appear more straightforward
to some (i did spend some minutes trying to find how to send that
second parameter before understanding that i should
just bundle it along with the first inside a json)


[1]
http://github.com/andyhot/tapestwitter/commit/2dd797629cd0506a9fc5625e71100170c0cde300
[2]
http://github.com/andyhot/tapestwitter/commit/b815eb395d9e820833ebf875a310b6d440f65f46
[3]
http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/RenderSupport.html#addInit%28java.lang.String,%20org.apache.tapestry5.json.JSONArray%29


-- 
Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
Tapestry PMC / Tacos developer
Open Source / JEE Consulting

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


Re: Upgrading from 5.1 to 5.2

2010-08-07 Thread Laurent Guerin

Hi Andreas,

Thank you for your random choice :-)

With Katia (co-author) we are planning to upgrade this little Tapestry  
demo to 5.2 version soon and add some enhanced components.

Thank you for your advices and your pull request.

Regards,

Laurent Guerin

Envoyé de mon iPhone

Le 7 août 2010 à 04:26, Andreas Andreou andre...@gmail.com a  
écrit :



So, i picked a random 5.1 project from github (
http://github.com/lguerin/tapestwitter )
forked it, upgraded it to 5.2 and fixed all deprecation warnings...
take a look /comment at the
change logs at [1] and [2]

I've found 2 small things worth noticing:
1) the project was building a JSONObject and outputting it INSIDE a js
string - because by default
the json is now pretty-printed, the newlines where causing js errors.
The fix was to use json.toString(true)
2) The old renderSupport.addInit could accept a JSONArray and map the
elements to the function's arguments
Now you should build a JSONObject which will become the only argument
of the function and use javaScriptSupport...
Of course that's already documented and explained at [3] but i'm
thinking the old way will appear more straightforward
to some (i did spend some minutes trying to find how to send that
second parameter before understanding that i should
just bundle it along with the first inside a json)


[1] 
http://github.com/andyhot/tapestwitter/commit/2dd797629cd0506a9fc5625e71100170c0cde300
[2] 
http://github.com/andyhot/tapestwitter/commit/b815eb395d9e820833ebf875a310b6d440f65f46
[3] 
http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/RenderSupport.html#addInit%28java.lang.String,%20org.apache.tapestry5.json.JSONArray%29


--
Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
Tapestry PMC / Tacos developer
Open Source / JEE Consulting

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



Re: Embedded Form component becomes null in Tap 5.2.0-Snapshot

2010-08-07 Thread Shing Hing Man
Hi, 
  In fact, in
   
  ValidationTracker validationTracker = form.getDefaultTracker(); 

form is not null. It was form.getDefaultTracker() that is returning null (which 
is not expected).
Instead of trying to check and record errors using
  ValidationTracker, I follow the advice in 
http://tapestry.apache.org/tapestry5.2-dev/guide/validation.html

to use  form.getHasErrors, form.recordError. 
My code is working in Tap 5.2 snapshot.

Shing 


--- On Sun, 8/8/10, Shing Hing Man mat...@yahoo.com wrote:

 From: Shing Hing Man mat...@yahoo.com
 Subject: Embedded Form component becomes null in Tap 5.2.0-Snapshot
 To: tapestry Tapestry tapestry-u...@jakarta.apache.org
 Date: Sunday, 8 August, 2010, 2:50
 Hi,
 
 I have an embedded form component that is null inside a
 onSubmit method. 
 It was not the case in Tap 5.1.
 
 In .tml :
 t:form t:id=myForm 
    
 /t:form
 
 In Java page
  
 @Component(id = myForm)
 private Form form;
 
 @OnEvent(component = myForm, value = submit)
 public void submit() {
    // form is null below
 !   
    ValidationTracker validationTracker =
 form.getDefaultTracker(); 
 }
 
 When the form is submitted, inside the submit method, form
 is null. 
 I am using 
 tapestry-core:5.2.0-20100801.103309-116
 
 Below is the stack trace.
 
 #
 com.man.testTapestry5.pages.test.Sum.submit(Sum.java:172)
 #
 com.man.testTapestry5.pages.test.Sum$MethodAccess_submit_12a4dd6b537.invoke(Sum$MethodAccess_submit_12a4dd6b537.java)
 #
 org.apache.tapestry5.internal.transform.BaseEventHandlerMethodInvoker.invokeEventHandlerMethod(BaseEventHandlerMethodInvoker.java:52)
 #
 org.apache.tapestry5.internal.transform.OnEventWorker$4.invokeEventHandlers(OnEventWorker.java:157)
 #
 org.apache.tapestry5.internal.transform.OnEventWorker$4.advise(OnEventWorker.java:136)
 #
 org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:86)
 #
 com.man.testTapestry5.pages.test.Sum.dispatchComponentEvent(Sum.java)
 #
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:942)
 #
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1132)
 #
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$3000(ComponentPageElementImpl.java:72)
 #
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl$7.invoke(ComponentPageElementImpl.java:1077)
 #
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl$7.invoke(ComponentPageElementImpl.java:1074)
 #
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
 #
 org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
 #
 org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1057)
 #
 org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:141)
 #
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1073)
 #
 org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.triggerContextEvent(InternalComponentResourcesImpl.java:287)
 #
 org.apache.tapestry5.corelib.components.Form._$advised$onAction(Form.java:548)
 #
 org.apache.tapestry5.corelib.components.Form$onAction$invocation_12a4dd6c009.invokeAdvisedMethod(Form$onAction$invocation_12a4dd6c009.java)
 #
 org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:77)
 #
 org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:37)
 #
 org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54)
 #
 org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:86)
 #
 org.apache.tapestry5.corelib.components.Form.onAction(Form.java)
 #
 org.apache.tapestry5.corelib.components.Form$MethodAccess_onAction_12a4dd6b53f.invoke(Form$MethodAccess_onAction_12a4dd6b53f.java)
 #
 org.apache.tapestry5.internal.transform.BaseEventHandlerMethodInvoker.invokeEventHandlerMethod(BaseEventHandlerMethodInvoker.java:52)
 #
 org.apache.tapestry5.internal.transform.OnEventWorker$4.invokeEventHandlers(OnEventWorker.java:157)
 #
 org.apache.tapestry5.internal.transform.OnEventWorker$4.advise(OnEventWorker.java:136)
 #
 org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:86)
 #
 org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
 #
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:950)
 #
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1132)
 #
 

T5: How to have .tml/.properties files in the same directory as the .java files

2010-08-07 Thread Patrick Moore
Hi there --

I am working to move our project from T4 to T5. In T4 we are using the tacos
component resolver that allows the templates and properties files to be in
the same directory.  In T5 how can we do the same thing?

In T4, I have found that having all 3 files .java, .properties, .tml in the
same directory makes editing enormously easier. So this is really, really
important to me. Switching between template and .java when the files are
scattered is a pain.

If there is no existing way, does anyone have some suggestions on how to
gracefully add this in. In T4 it wasn't that hard and it seems like it
should be even easier in T5.

-Pat


Re: T5: How to have .tml/.properties files in the same directory as the .java files

2010-08-07 Thread Josh Canfield
 I am working to move our project from T4 to T5. In T4 we are using the tacos
 component resolver that allows the templates and properties files to be in
 the same directory.  In T5 how can we do the same thing?

Hmm... Just do it. The .tml and properties can be in the same package
structure as the classes.

Josh

On Sat, Aug 7, 2010 at 4:34 PM, Patrick Moore patmo...@amplafi.com wrote:
 Hi there --

 I am working to move our project from T4 to T5. In T4 we are using the tacos
 component resolver that allows the templates and properties files to be in
 the same directory.  In T5 how can we do the same thing?

 In T4, I have found that having all 3 files .java, .properties, .tml in the
 same directory makes editing enormously easier. So this is really, really
 important to me. Switching between template and .java when the files are
 scattered is a pain.

 If there is no existing way, does anyone have some suggestions on how to
 gracefully add this in. In T4 it wasn't that hard and it seems like it
 should be even easier in T5.

 -Pat




-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

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