Re: Test if production or test mode..

2012-07-28 Thread sommeralex
Thank you all for your answers. 

What I now did is just this in one of my pages:

JAVA

@Property   
@Symbol(tapestry.production-mode)
private boolean productionMode;

TML

t:if test=productionMode

productionMode!

/t:if


My FrontendModule

public static void contributeApplicationDefaults(MappedConfigurationString,
String configuration) {

configuration.add(tapestry.production-mode, true);

}

The String productionMode! is never printed. Using Tapestry 5.3.1.





--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Test-if-production-or-test-mode-tp5714658p5714849.html
Sent from the Tapestry - User 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



Re: Test if production or test mode..

2012-07-28 Thread Taha Siddiqi
With @Symbol you must use @Inject too

@Proeprty
@Inject
@Symbol(SymbolConstants.PRODUCTION_MODE)
private boolean productionMode

BTW you can also use :-

t:if test='symbol:tapestry.production-mode'
   ${symbol:tapestry.production-mode}
/t:if

regards
Taha


On Jul 28, 2012, at 2:19 PM, sommeralex wrote:

 Thank you all for your answers. 
 
 What I now did is just this in one of my pages:
 
 JAVA
 
 @Property 
 @Symbol(tapestry.production-mode)
 private boolean productionMode;
 
 TML
 
 t:if test=productionMode
   
 productionMode!
   
 /t:if
 
 
 My FrontendModule
 
 public static void contributeApplicationDefaults(MappedConfigurationString,
 String configuration) {
 
 configuration.add(tapestry.production-mode, true);
 
 }
 
 The String productionMode! is never printed. Using Tapestry 5.3.1.
 
 
 
 
 
 --
 View this message in context: 
 http://tapestry.1045711.n5.nabble.com/Test-if-production-or-test-mode-tp5714658p5714849.html
 Sent from the Tapestry - User 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
 


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



Re: Test if production or test mode..

2012-07-28 Thread sommeralex
thank you very much, it works!

2012/7/28 Taha Hafeez [via Tapestry] 
ml-node+s1045711n5714850...@n5.nabble.com

 With @Symbol you must use @Inject too

 @Proeprty
 @Inject
 @Symbol(SymbolConstants.PRODUCTION_MODE)
 private boolean productionMode

 BTW you can also use :-

 t:if test='symbol:tapestry.production-mode'
${symbol:tapestry.production-mode}
 /t:if

 regards
 Taha


 On Jul 28, 2012, at 2:19 PM, sommeralex wrote:

  Thank you all for your answers.
 
  What I now did is just this in one of my pages:
 
  JAVA
 
  @Property
  @Symbol(tapestry.production-mode)
  private boolean productionMode;
 
  TML
 
  t:if test=productionMode
 
  productionMode!
 
  /t:if
 
 
  My FrontendModule
 
  public static void
 contributeApplicationDefaults(MappedConfigurationString,
  String configuration) {
 
  configuration.add(tapestry.production-mode, true);
 
  }
 
  The String productionMode! is never printed. Using Tapestry 5.3.1.
 
 
 
 
 
  --
  View this message in context:
 http://tapestry.1045711.n5.nabble.com/Test-if-production-or-test-mode-tp5714658p5714849.html

  Sent from the Tapestry - User mailing list archive at Nabble.com.
 
  -
  To unsubscribe, e-mail: [hidden 
  email]http://user/SendEmail.jtp?type=nodenode=5714850i=0
  For additional commands, e-mail: [hidden 
  email]http://user/SendEmail.jtp?type=nodenode=5714850i=1
 


 -
 To unsubscribe, e-mail: [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5714850i=2
 For additional commands, e-mail: [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5714850i=3



 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://tapestry.1045711.n5.nabble.com/Test-if-production-or-test-mode-tp5714658p5714850.html
  To unsubscribe from Test if production or test mode.., click 
 herehttp://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5714658code=YWxleGFuZGVyLnNvbW1lckBnbWFpbC5jb218NTcxNDY1OHwxMDUzMzQxMzM4
 .
 NAMLhttp://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml





--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Test-if-production-or-test-mode-tp5714658p5714851.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: Test if production or test mode..

2012-07-28 Thread Chris Mylonas
Hi - I took the liberty in creating a JIRA for adding this example to the 
symbols page.
Handy example for someone getting into symbolic stuff (excuse my pun-tiness)

https://issues.apache.org/jira/browse/TAP5-1982

Here is the documentation I reckon could do with some more
http://tapestry.apache.org/symbols.html

For the quick and the dirty, it's a good example of injecting a symbol.
Dunno if it's jumpstart-worthy or stuff it into the archetype for more sample 
stuff without overwhelming a noob.

My 2c
Cheers
Chris


On 28/07/2012, at 7:02 PM, sommeralex wrote:

 thank you very much, it works!
 
 2012/7/28 Taha Hafeez [via Tapestry] 
 ml-node+s1045711n5714850...@n5.nabble.com
 
 With @Symbol you must use @Inject too
 
 @Proeprty
 @Inject
 @Symbol(SymbolConstants.PRODUCTION_MODE)
 private boolean productionMode
 
 BTW you can also use :-
 
 t:if test='symbol:tapestry.production-mode'
   ${symbol:tapestry.production-mode}
 /t:if
 
 regards
 Taha
 
 
 On Jul 28, 2012, at 2:19 PM, sommeralex wrote:
 
 Thank you all for your answers.
 
 What I now did is just this in one of my pages:
 
 JAVA
 
 @Property
 @Symbol(tapestry.production-mode)
 private boolean productionMode;
 
 TML
 
 t:if test=productionMode
 
 productionMode!
 
 /t:if
 
 
 My FrontendModule
 
 public static void
 contributeApplicationDefaults(MappedConfigurationString,
 String configuration) {
 
 configuration.add(tapestry.production-mode, true);
 
 }
 
 The String productionMode! is never printed. Using Tapestry 5.3.1.
 
 
 
 
 
 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/Test-if-production-or-test-mode-tp5714658p5714849.html
 
 Sent from the Tapestry - User mailing list archive at Nabble.com.
 
 -
 To unsubscribe, e-mail: [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5714850i=0
 For additional commands, e-mail: [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5714850i=1
 
 
 
 -
 To unsubscribe, e-mail: [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5714850i=2
 For additional commands, e-mail: [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5714850i=3
 
 
 
 --
 If you reply to this email, your message will be added to the discussion
 below:
 
 http://tapestry.1045711.n5.nabble.com/Test-if-production-or-test-mode-tp5714658p5714850.html
 To unsubscribe from Test if production or test mode.., click 
 herehttp://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5714658code=YWxleGFuZGVyLnNvbW1lckBnbWFpbC5jb218NTcxNDY1OHwxMDUzMzQxMzM4
 .
 NAMLhttp://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
 
 
 
 
 
 --
 View this message in context: 
 http://tapestry.1045711.n5.nabble.com/Test-if-production-or-test-mode-tp5714658p5714851.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.



Re: Test if production or test mode..

2012-07-23 Thread Christian Riedel
…and if you worry about having too many annotations in the constructor, you can 
also omit the @Inject annoation for symbols in recent Tapestry versions (I 
think  5.2). 

@Symbol(SymbolConstants.PRODUCTION_MODE) boolean productionMode


Am 22.07.2012 um 15:34 schrieb Lance Java:

 You can use @Inject, @Value and @Symbol in tapestry services. @Property can
 only be used in pages and components, NOT services.
 
 The following should work in a service:
 
 @Inject @Symbol(tapestry.production-mode)
 private boolean productionMode;
 
 You could also do this:
 
 @Inject @Value(${tapestry.production-mode})
 private boolean productionMode;
 
 I never use private field injection in my services (@Inject) as it makes it
 difficult to test but the option is there if you want it.
 
 
 
 --
 View this message in context: 
 http://tapestry.1045711.n5.nabble.com/Test-if-production-or-test-mode-tp5714658p5714674.html
 Sent from the Tapestry - User 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
 


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



Re: Test if production or test mode..

2012-07-23 Thread Thiago H de Paula Figueiredo
On Sat, 21 Jul 2012 12:47:10 -0300, sommeralex  
alexander.som...@gmail.com wrote:



@Value(${tapestry.production-mode})
@Property
private boolean productionMode;


You don't need @Property for injecting stuff. In addition, using @Symbol,  
you don't need to use expansions:


@Inject
@Symbol(SymbolConstants.PRODUCTION_MODE) // or  
@Symbol(tapestry.production-mode), works the same.

private boolean productionMode;


this way sounds much easier than the crpytic form in the constructor:
public class MyService implements MyServiceInterface
{
  public MyService(@Value(${tapestry.production-mode}) boolean
productionMode, ...)
  {
if (productionMode) {

can someone explain me why app properties can not more easiliy requested?


Example of more easily requested way of doing that please. ;)

Do you really wanted an specific annotation just for injecting a single  
symbol?


You could also inject the SymbolSource service and get symbol values from  
it.


--
Thiago H. de Paula Figueiredo

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



Re: Test if production or test mode..

2012-07-22 Thread Lance Java
You can use @Inject, @Value and @Symbol in tapestry services. @Property can
only be used in pages and components, NOT services.

The following should work in a service:

@Inject @Symbol(tapestry.production-mode)
private boolean productionMode;

You could also do this:

@Inject @Value(${tapestry.production-mode})
private boolean productionMode;

I never use private field injection in my services (@Inject) as it makes it
difficult to test but the option is there if you want it.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Test-if-production-or-test-mode-tp5714658p5714674.html
Sent from the Tapestry - User 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



Test if production or test mode..

2012-07-21 Thread sommeralex
@Value(${tapestry.production-mode})
@Property
private boolean productionMode;

this way sounds much easier than the crpytic form in the constructor:

public class MyService implements MyServiceInterface
{
  public MyService(@Value(${tapestry.production-mode}) boolean
productionMode, ...)
  {
if (productionMode) {

can someone explain me why app properties can not more easiliy requested?



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Test-if-production-or-test-mode-tp5714658.html
Sent from the Tapestry - User 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



Re: Test if production or test mode..

2012-07-21 Thread Howard Lewis Ship
There's very little in Tapestry that could not be readily built in
Tapestry; it's not that what you are doing is impossible, it's just
that there hasn't been a sufficient need to streamline access to this
configuration symbol.

On Sat, Jul 21, 2012 at 8:47 AM, sommeralex alexander.som...@gmail.com wrote:
 @Value(${tapestry.production-mode})
 @Property
 private boolean productionMode;

 this way sounds much easier than the crpytic form in the constructor:

 public class MyService implements MyServiceInterface
 {
   public MyService(@Value(${tapestry.production-mode}) boolean
 productionMode, ...)
   {
 if (productionMode) {

 can someone explain me why app properties can not more easiliy requested?



 --
 View this message in context: 
 http://tapestry.1045711.n5.nabble.com/Test-if-production-or-test-mode-tp5714658.html
 Sent from the Tapestry - User 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




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

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