Why does AbstractComponentEventLink require a Zone?

2012-01-03 Thread Jochen Frey
Hi!

I am somewhat new to Tapestry (loving it).  

I am trying to piggy back updates/calls to JavaScript components on my page 
onto responses to EventLink or ActionLink requests.  Imagine a page with 
multiple charts on it, and on any click I want to be able to update any chart 
widget if the server side Java code so decides.  We do this by tagging on 
requests to Tapestry.init via JavascriptSupport.addInitializerCall() (... took 
us a bit to figure this out, but it's very elegant.  Haven't been able to find 
a tutorial or guid, though :-( )

This all works really well when using EventLinks or ActionLinks that have a 
'zone="someZone"' attribute.  However, in our case I am not trying to update a 
Zone, or any visible DOM node on the browser.  I am simply calling functions 
that I registered with Tapestry.init.  But unless I am mistaken, it seems that 
having a t:zone is the only way to cause the initializer calls to be executed 
... 

My question is this:  Is there a way to do this without creating a t:zone (that 
I ultimately don't care for)? Am I barking up the wrong tree in the first place?

Thanks so much!!!
Jochen
---
  joc...@jochenfrey.com
  +1.415.366.0450
  @jochen_frey


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



Re: mixins Confirm is invalid

2012-01-03 Thread Taha Hafeez
This is what works for me in jquery

(function($) {

$.extend(Tapestry.Initializer, {
confirm: function(params) {
$("#" + params.element).bind(params.event, function(event) {

if (!confirm(params.message)) {
event.preventDefault();
}

});
}
});

})(jQuery);


On Wed, Jan 4, 2012 at 11:13 AM, dick_hu  wrote:
>
> Taha Hafeez wrote
>>
>> Try  event.preventDefault() instead of Event.stop(event)
>>
>> I think that will do
>>
>>
>>
>
> It failed also.
> thank you.
>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/mixins-Confirm-is-invalid-tp5118652p5118771.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
>



-- 
Regards

Taha Hafeez Siddiqi (tawus)
http://tawus.wordpress.com

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



Re: mixins Confirm is invalid

2012-01-03 Thread dick_hu

Taha Hafeez wrote
> 
> Try  event.preventDefault() instead of Event.stop(event)
> 
> I think that will do
> 
> 
> 

It failed also. 
thank you.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/mixins-Confirm-is-invalid-tp5118652p5118771.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: mixins Confirm is invalid

2012-01-03 Thread Taha Hafeez
Try  event.preventDefault() instead of Event.stop(event)

I think that will do


On Wed, Jan 4, 2012 at 10:16 AM, dick_hu  wrote:
> No, it means the confirm does not stop the event when I click the cancel
> button in the dialog.
> Taha Hafeez wrote
>>
>> Hi
>>
>> What do you mean when you say it is invalid ?
>>
>> Is there any error ?
>>
>>
>>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/mixins-Confirm-is-invalid-tp5118652p5118712.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
>



-- 
Regards

Taha Hafeez Siddiqi (tawus)
http://tawus.wordpress.com

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



Re: mixins Confirm is invalid

2012-01-03 Thread dick_hu
No, it means the confirm does not stop the event when I click the cancel
button in the dialog.
Taha Hafeez wrote
> 
> Hi
> 
> What do you mean when you say it is invalid ?
> 
> Is there any error ?
> 
> 
> 


--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/mixins-Confirm-is-invalid-tp5118652p5118712.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: mixins Confirm is invalid

2012-01-03 Thread Taha Hafeez
Hi

What do you mean when you say it is invalid ?

Is there any error ?


On Wed, Jan 4, 2012 at 9:20 AM, dick_hu  wrote:
> I add a mixins "Confirm" to a EventLink,When the eventlink request is xhr
> will return a zone,the mixins
> is invalid.
>
> the mixins's  java is
> @Import(library = "confirm.js")
> public class Confirm {
>
>        @InjectContainer
>        private ClientElement container;
>
>        @Inject
>        private JavaScriptSupport javaScriptSupport;
>
>        @Parameter(value = "confirm.message", defaultPrefix =
> BindingConstants.MESSAGE)
>        private String confirmMessage;
>
>        @Parameter(defaultPrefix = BindingConstants.LITERAL, value = "click")
>        private String clientEvent;
>
>        @org.apache.tapestry5.annotations.BeforeRenderTemplate
>        void addScript() {
>                JSONObject json = new JSONObject();
>                json.put("id", container.getClientId());
>                json.put("message", confirmMessage);
>                json.put("event", clientEvent);
>
>                javaScriptSupport.addScript("new ConfirmDialog(%s);", 
> json.toString());
>        }
> }
>
>
> js is
> ConfirmDialog = Class.create({initialize:function (spec) {
>        Event.observe($(spec.id), spec.event, function (event) {
>                var result = confirm(spec.message);
>                if (result == false) {
>                        alert(event);
>                        Event.stop(event);
>                        return false;
>                }
>        });
> }});
>
> Can anyone help me,is there another mixins like the "ConFirm" provide
>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/mixins-Confirm-is-invalid-tp5118652p5118652.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
>



-- 
Regards

Taha Hafeez Siddiqi (tawus)
http://tawus.wordpress.com

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



Re: Why Components in Loop are the only one instance? What should I do?

2012-01-03 Thread Josh Canfield
> Is there some other solutions? If sometimes I put my existing complex 
> Component into a Loop, It will not work.
There are many solutions. It all depends on where your complexity is.

It sounds like you need to work out a communication mechanism between
your component and it's container. Presumably you are passing your
parameters to your component via a property binding. What you probably
want to do then is have the containing page reset all of the
properties to the state they were in at whatever iteration rendered
your component.

You could do that by triggering an event from your component which
instructs the container to set all the bound parameters based on some
context from the originating event.

Have a look at:
http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/ComponentResourcesCommon.html#triggerEvent(java.lang.String,
java.lang.Object[], org.apache.tapestry5.ComponentEventCallback)

Josh

On Tue, Jan 3, 2012 at 7:16 PM, Bo Gao  wrote:
>>> I have changed all the values I want to persist to context values and it 
>>> works for me now.> Is this the only way to solve this problem?
>>
>> Probably not, but it seems like a fine solution.
>
> Is there some other solutions? If sometimes I put my existing complex 
> Component into a Loop, It will not work.
>
>
> On Jan 4, 2012, at 1:44 AM, Josh Canfield wrote:
>
>>> I have changed all the values I want to persist to context values and it 
>>> works for me now.> Is this the only way to solve this problem?
>>
>> Probably not, but it seems like a fine solution.
>> On Mon, Jan 2, 2012 at 6:04 PM, Elivoa  wrote:
>>> I have a zone in my component. And an event link to refresh the zone.
>>> So I need to use a persists value to store the zone's client id, and I 
>>> persist some value that will show inside the zone.
>>>
>>> I have changed all the values I want to persist to context values and it 
>>> works for me now.
>>> Is this the only way to solve this problem?
>>>
>>> Sent from my iPad
>>>
>>> On 2012-1-3, at 4:08, Josh Canfield  wrote:
>>>
 This is by design. Tapestry pages/ components have static structure so no
 matter how many times you g through the loop you only get one instance
 of the component.

 What specifically are you trying to do? Maybe someone can offer some design
 tips.

 Josh
 On Jan 2, 2012 12:17 AM, "Bo Gao"  wrote:

> I put a Component in a Loop, and when I call System.out.println(this); I
> found that there are only one instance of the component. If I have some
> persist value in this Components they can't work well.
>
> Why this happened? What should I do if I want to put a Complex Component
> with persist value into a Loop?
>
> Thanks
>
> --
> Bo Gao
> eli...@gmail.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
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>
> --
> Bo Gao
> eli...@gmail.com
>
>
>
>
>
>

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



mixins Confirm is invalid

2012-01-03 Thread dick_hu
I add a mixins "Confirm" to a EventLink,When the eventlink request is xhr
will return a zone,the mixins 
is invalid.

the mixins's  java is
@Import(library = "confirm.js")
public class Confirm {

@InjectContainer
private ClientElement container;

@Inject
private JavaScriptSupport javaScriptSupport;

@Parameter(value = "confirm.message", defaultPrefix =
BindingConstants.MESSAGE)
private String confirmMessage;

@Parameter(defaultPrefix = BindingConstants.LITERAL, value = "click")
private String clientEvent;

@org.apache.tapestry5.annotations.BeforeRenderTemplate
void addScript() {
JSONObject json = new JSONObject();
json.put("id", container.getClientId());
json.put("message", confirmMessage);
json.put("event", clientEvent);

javaScriptSupport.addScript("new ConfirmDialog(%s);", 
json.toString());
}
}


js is 
ConfirmDialog = Class.create({initialize:function (spec) {
Event.observe($(spec.id), spec.event, function (event) {
var result = confirm(spec.message);
if (result == false) {
alert(event);
Event.stop(event);
return false;
}
});
}});

Can anyone help me,is there another mixins like the "ConFirm" provide



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/mixins-Confirm-is-invalid-tp5118652p5118652.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: Why Components in Loop are the only one instance? What should I do?

2012-01-03 Thread Bo Gao
>> I have changed all the values I want to persist to context values and it 
>> works for me now.> Is this the only way to solve this problem?
> 
> Probably not, but it seems like a fine solution.

Is there some other solutions? If sometimes I put my existing complex Component 
into a Loop, It will not work.


On Jan 4, 2012, at 1:44 AM, Josh Canfield wrote:

>> I have changed all the values I want to persist to context values and it 
>> works for me now.> Is this the only way to solve this problem?
> 
> Probably not, but it seems like a fine solution.
> On Mon, Jan 2, 2012 at 6:04 PM, Elivoa  wrote:
>> I have a zone in my component. And an event link to refresh the zone.
>> So I need to use a persists value to store the zone's client id, and I 
>> persist some value that will show inside the zone.
>> 
>> I have changed all the values I want to persist to context values and it 
>> works for me now.
>> Is this the only way to solve this problem?
>> 
>> Sent from my iPad
>> 
>> On 2012-1-3, at 4:08, Josh Canfield  wrote:
>> 
>>> This is by design. Tapestry pages/ components have static structure so no
>>> matter how many times you g through the loop you only get one instance
>>> of the component.
>>> 
>>> What specifically are you trying to do? Maybe someone can offer some design
>>> tips.
>>> 
>>> Josh
>>> On Jan 2, 2012 12:17 AM, "Bo Gao"  wrote:
>>> 
 I put a Component in a Loop, and when I call System.out.println(this); I
 found that there are only one instance of the component. If I have some
 persist value in this Components they can't work well.
 
 Why this happened? What should I do if I want to put a Complex Component
 with persist value into a Loop?
 
 Thanks
 
 --
 Bo Gao
 eli...@gmail.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
>> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

--
Bo Gao
eli...@gmail.com








Re: jquery

2012-01-03 Thread François Facon
configuration.add(JQuerySymbolConstants.SUPPRESS_PROTOTYPE, "false");
Make your application use Prototype and the default tapestry.js with
jQuery in no-conflict mode but in this case $ is the shortcut for
Prototype.

That's why your code is not working.

in this "backward compatibility" mode you can use the alias $ for
jQuery inside a closure like

(function( $ ) {
$(document).ready(function(){
alert("ok");
 });
  }) ( jQuery );

more detail at
http://docs.jquery.com/Using_jQuery_with_Other_Libraries#Referencing_Magic_-_Shortcuts_for_jQuery

or define a alias for jQuery
see http://api.jquery.com/jQuery.noConflict/
that's what you have done with
configuration.add(JQuerySymbolConstants.JQUERY_ALIAS, "$j");

but you must write
$j(document).ready(function(){
$j("#showid").click(function(){
   $j("#pelement").show();
});
$j("#hideid").click(function(){
$j("#pelement").hide();
});
 });

for me closure is better,
that how our components are defined
see for example.
https://github.com/got5/tapestry5-jquery/blob/master/src/main/resources/org/got5/tapestry5/jquery/assets/components/palette/palette.js

If you want use a pure jquery stack and assign $ to jQuery
remove
configuration.add(JQuerySymbolConstants.JQUERY_ALIAS, "$j");
configuration.add(JQuerySymbolConstants.SUPPRESS_PROTOTYPE, "false");
from your AppModule
but in this case, you will have to use jquery/autocomplete instead of
autocomplete
and jquery/palette instead of palette



2012/1/3 csckid :
> I wrote this two lines in the Appmodule
>  configuration.add(JQuerySymbolConstants.JQUERY_ALIAS, "$j");
>  configuration.add(JQuerySymbolConstants.SUPPRESS_PROTOTYPE, "false");
>
> Now everything is working i.e. autocomplete mixin, jquery/tooltip, tapestry
> validation,
>  (function( $ ) {
>  $(document).ready(function(){
>  alert("ok");
>  });
>  }) ( jQuery );
>
> Only the simple jquery code isn't working
> $(document).ready(function(){
>        $("#showid").click(function(){
>                $("#pelement").show();
>        });
>        $("#hideid").click(function(){
>                $("#pelement").hide();
>        });
> });
> Error: $(document).ready is not a function
> Source File: http://localhost:8080/medical/about
> Line: 29
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/jquery-tp5113334p5117610.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: Difference between renderSupport.addScript and JSON addInit(function, JSON Object)

2012-01-03 Thread Thiago H. de Paula Figueiredo

On Wed, 28 Dec 2011 14:40:12 -0200, Javix  wrote:


In javascript, I just replaced arguments by jsonObject:

function load(jsonObject){
...
//acces to the variable in JSON
errorText.text(jsonObject.m2)
}

Why in case of JSON it DOES NOT WORK ?


From the addInit() JavaDoc, specifically the first parameter:

functionName  the name of the function (on the client-side  
Tapestry.Initializer object) to invoke.


addInit() just invokes functions that are part of the Tapestry.Initializer  
object. Try this instead:


Tapestry.Initializer.load = function(jsonObject){
 ...
 //acces to the variable in JSON
 errorText.text(jsonObject.m2)
}

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



Re: How to handle urls for a White Label site

2012-01-03 Thread Thiago H. de Paula Figueiredo
On Tue, 03 Jan 2012 13:00:42 -0200, captain_rhino  
 wrote:



Currently I have a very messy way of passing a context (the context
indicates which prtner site it is from) through so as the
PageRenderLinkTransformer can then use this context to dynamically create
the url displayed to the user?


I'd implement this in the LinkTransformer implementation. I couldn't check  
yours doing to Snipt not responding at the moment.


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



Re: Beaneditor bug null property error

2012-01-03 Thread Thiago H. de Paula Figueiredo

On Tue, 03 Jan 2012 16:33:59 -0200, felipexz  wrote:


Yes of course I agree. But when you have Annotated fields, it can be
instatiated in other classes, can't be ?


Remember: instantiate a class = using the Java "new" operator.


How I would know that it's not already been instatiated ? That's an
annotated field.


Check if it's null:

if (municipio == null) {
...
}

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



Re: Beaneditor bug null property error

2012-01-03 Thread Thiago H. de Paula Figueiredo

On Tue, 03 Jan 2012 16:02:50 -0200, felipexz  wrote:


Hi Sven.. I read it but the method on"Something" is a convention ?
Sorry but I'm new on Tapestry so I don't know.


Yes: http://tapestry.apache.org/component-events.html


I only found about the "onPrepare" in the wiki
http://wiki.apache.org/tapestry/Tapestry5HowToUseForms


The event names are specific to the components that trigger them. In this  
case, "prepare" is an event triggered by Form.


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



Re: Beaneditor bug null property error

2012-01-03 Thread felipexz
Yes of course I agree. But when you have Annotated fields, it can be
instatiated in other classes, can't be ?
How I would know that it's not already been instatiated ? That's an
annotated field.

I'm justing asking.. as I said I'm a newbie.

Best regards

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117630.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: jquery

2012-01-03 Thread csckid
I wrote this two lines in the Appmodule
 configuration.add(JQuerySymbolConstants.JQUERY_ALIAS, "$j"); 
 configuration.add(JQuerySymbolConstants.SUPPRESS_PROTOTYPE, "false");

Now everything is working i.e. autocomplete mixin, jquery/tooltip, tapestry
validation,
 (function( $ ) {
 $(document).ready(function(){
 alert("ok");
 });
 }) ( jQuery ); 

Only the simple jquery code isn't working
$(document).ready(function(){
$("#showid").click(function(){
$("#pelement").show();
});
$("#hideid").click(function(){
$("#pelement").hide();
});
});
Error: $(document).ready is not a function
Source File: http://localhost:8080/medical/about
Line: 29


--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/jquery-tp5113334p5117610.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: T5 progress bar in a grid

2012-01-03 Thread Lance Java
I have created a component to hide all the gubbins that I mentioned
earlier. All you need to do is create a more beautiful progress bar (my css
skills aren't great). I have created a simple page which adds 3
progressRunnableLinks on a page. Each fires a task that takes 10 seconds,
updating it's percentage complete as it goes.

1. Download the code from here
http://dl.dropbox.com/u/63354/tapestry-progress.zip
2. run "mvn jetty:run"
3. Go to http://localhost:8080/tapestry/progress

Cheers,
Lance.

Interesting bits of code:

AppModule.java
--

public ProgressRunnableManager buildProgressRunnableManager() {
return new ProgressRunnableManagerImpl(20);
}


Progress.tml
--




Progress.java (page class)


public class Progress {
public ProgressRunnable getProgressRunnable() {
return new AbstractProgressRunnable() {
public void run() {
for (int i = 1; i <= 10; ++i) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
setProgressPercentage(i * 10);
}
}
};
}
}

ProgressRunnableLink.java (component)
--
@Import (library="zonemanager.js")
public class ProgressRunnableLink {
@Inject
private ProgressRunnableManager manager;

@Inject
private AjaxResponseRenderer ajaxRenderer;

@Inject
private ComponentResources resources;

@Inject
private JavaScriptSupport jsSupport;

@Parameter
private Integer pollDelayMillis;

@Parameter(defaultPrefix="literal", required=true)
@Property
private String linkText;

@Parameter(defaultPrefix="literal", required=true)
@Property
private String zoneId;

@Parameter(allowNull=false)
private ProgressRunnable progressRunnable;

@Property
private Double progressPercentage;

@Property
private Exception exception;

@InjectComponent
private Zone progressZone;

@OnEvent("startRunnable")
Block startTask() {
String taskId = manager.submit(progressRunnable);
progressPercentage = 0D;
doPoll(taskId);
return progressZone.getBody();
}

@OnEvent("updateProgress")
Block updateProgress(String taskId) {
try {
progressPercentage = manager.getProgressPercentage(taskId);
if (progressPercentage < 100D) {
doPoll(taskId);
}
} catch (Exception e) {
exception = e;
}
return progressZone.getBody();
}

void doPoll(String taskId) {
Link link = resources.createEventLink("updateProgress", taskId);
final String url = link.toAbsoluteURI();
ajaxRenderer.addCallback(new JavaScriptCallback() {
public void run(JavaScriptSupport jsSupport) {
if (pollDelayMillis == null) {
jsSupport.addScript("Tapestry.activateZone('%s',
'%s');", zoneId, url);
} else {

jsSupport.addScript("setTimeout(\"Tapestry.activateZone('%s', '%s');\",
%s);", zoneId, url, pollDelayMillis);
}
}
});
}
}






On 3 January 2012 10:34, Lance Java  wrote:

> There are a couple of approaches to do this, since tapestry does not
> support ajax push (aka reverse ajax) out-of-the box, a simple solution
> would be to have the client poll the server for the current percentage
> complete.
>
> In order to display a progress bar to the client, you must do the actual
> work for the task on a separate thread to the Ajax request thread. It is
> probably best to have a singleton ExecutorService (using
> java.util.concurrent.Executors.newFixedThreadPool(threadCount) or similar)
>
> The Ajax request thread should:
> 1. Create a runnable and give it a unique taskId
> 2. Put the runnable in a serverside map keyed on taskId (map could be a
> singleton or perhaps stored in each user's session)
>
> 3. Call executorService.submit(myRunnable)
> 4. Use the AjaxResponseRenderer to fire the "updateProgressBar" event
> passing the taskId in the context
> 5. Return the progress bar zone's getBody() with a percentageComplete of 0
>
> Your runnable would be something like
>
> public class MyWorker implements Runnable {
>private int taskId;
>private ConcurrentMap workers;
>private AtomicInteger percentComplete = new AtomicInteger(0);
>public MyWorker(ConcurrentMap workers, String taskId) {
>   this.workers = workers;
>   this.taskId = taskId;
>}
>public int getPercentComplete() {
>   return percentComplete.get();
>}
>public void run() {
>   try {
>  doSomeWork();
>  percentComplete.set(10);
>  doSomeMoreWork();
>  percentComplete.set(50);
>  doEvenMoreWork();
>  percentComplete.set(100);
>   } final

Re: Beaneditor bug null property error

2012-01-03 Thread Sven Homburg
The prefered convention in java : instantiate an class before work with it.
the documentation advise you only, where it make sense to do this job ;-)

with regards
Sven Homburg
Founder of the Chenille Kit Project
http://chenillekit.codehaus.org




2012/1/3 felipexz :
> Hi Sven.. I read it but the method on"Something" is a convention ?
> Sorry but I'm new on Tapestry so I don't know.
>
> I only found about the "onPrepare" in the wiki
> http://wiki.apache.org/tapestry/Tapestry5HowToUseForms
>
> So I think if its a convention ok, right. But if not I think it should be in
> the documentation.
>
> Best regards
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117551.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: Beaneditor bug null property error

2012-01-03 Thread felipexz
Hi Sven.. I read it but the method on"Something" is a convention ?
Sorry but I'm new on Tapestry so I don't know.

I only found about the "onPrepare" in the wiki
http://wiki.apache.org/tapestry/Tapestry5HowToUseForms

So I think if its a convention ok, right. But if not I think it should be in
the documentation.

Best regards

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117551.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: Is it possible to initialize a custom SymbolProvider with another symbol?

2012-01-03 Thread Howard Lewis Ship
It is not possible.

However, you can initialize a symbol with another symbol's value:

configuration.add("my.new.symbol", "${some.other.symbol}")

Tapestry does a good job of detecting and reporting any unintentional
cycles you might create this way.

On Tue, Jan 3, 2012 at 7:59 AM, Borut Bolčina  wrote:
> Hi,
>
> I would still like an advice on the approach on how to initialize custom
> symbol provider with tapestry provided symbol. The code below ends in
> IllegalStateException
>
> Construction of service 'SymbolSource' has failed due to recursion: the
> service depends on itself in some way.
>
>
> The code from AppModule:
>
>    public RESTSymbolProvider buildRESTSymbolProvider(Logger logger,
> @Inject @Symbol(SymbolConstants.EXECUTION_MODE) String executionMode) {
>        return new RESTSymbolProvider(logger, executionMode);
>    }
>
>    public void contributeSymbolSource(OrderedConfiguration
> providers, Logger logger,
>            @InjectService("RESTSymbolProvider") SymbolProvider
> restSymbolProvider) {
>        providers.add("myAppConfiguration", restSymbolProvider);
>    }
>
> Thanks for any input,
> borut
>
> 2011/12/30 Borut Bolčina 
>
>> Hello,
>>
>> I am in a process of writting my own SymbolProvider (the configuration for
>> my app will come from REST service) and I am facing a dilemma. The
>> contribution looks like:
>>
>>     public void
>> contributeSymbolSource(OrderedConfiguration providers,
>> Logger logger) {
>>         providers.add("myAppConfiguration", new RESTSymbolProvider(logger,
>> "development"), "after:SystemProperties", "before:ApplicationDefaults");
>>     }
>>
>> You can see I hardcoded the string "development". I want to replace this
>> string with another symbol
>>
>> @Symbol(SymbolConstants.EXECUTION_MODE) String executionMode
>>
>> As I need this symbol in another method (sendEmailMessage) in the
>> AppModule I naively tried like this and failed:
>>
>> public class AppModule {
>>
>>     private String *executionMode*;
>>
>>     public AppModule(@Symbol(SymbolConstants.EXECUTION_MODE) String
>> executionMode) {
>>         this.executionMode = executionMode;
>>     }
>>
>>     @Startup
>>     public void sendEmailMessage(Logger logger) {
>>         if ("development".equals(*executionMode*)) {
>>             logger.info(MarkerFactory.getMarker("EDITORS"), "DEVELOPMENT
>> Starting najdi-web");
>>         } else {
>>             logger.info(MarkerFactory.getMarker("EDITORS"), "PRODUCTION
>> Starting najdi-web");
>>         }
>>     }
>>
>>     public void
>> contributeSymbolSource(OrderedConfiguration providers,
>> Logger logger) {
>>         providers.add("myAppConfiguration", new RESTSymbolProvider(logger,
>> *executionMode*), "after:SystemProperties", "before:ApplicationDefaults");
>>     }
>> ...
>> }
>>
>>
>> Fails with:
>>
>> [2011/12/30 14:59:04.537] ERROR [o.a.t.i.Registry:log]: Construction of
>> service 'SymbolSource' has failed due to recursion: the service depends on
>> itself in some way. Please check
>> org.apache.tapestry5.ioc.internal.services.SymbolSourceImpl(List) (at
>> SymbolSourceImpl.java:198) via
>> org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at
>> TapestryIOCModule.java:49) for references to another service that is itself
>> dependent on service 'SymbolSource'.
>> [2011/12/30 14:59:04.538] ERROR [o.a.t.i.Registry:log]: Operations trace:
>> [2011/12/30 14:59:04.539] ERROR [o.a.t.i.Registry:log]: [ 1] Realizing
>> service ServletApplicationInitializer
>> [2011/12/30 14:59:04.539] ERROR [o.a.t.i.Registry:log]: [ 2] Instantiating
>> service ServletApplicationInitializer implementation via
>> org.apache.tapestry5.services.TapestryModule.buildServletApplicationInitializer(Logger,
>> List, ApplicationInitializer) (at TapestryModule.java:1395)
>> [2011/12/30 14:59:04.540] ERROR [o.a.t.i.Registry:log]: [ 3] Constructing
>> module class org.apache.tapestry5.services.TapestryModule
>> [2011/12/30 14:59:04.540] ERROR [o.a.t.i.Registry:log]: [ 4] Determining
>> injection value for parameter #1
>> (org.apache.tapestry5.ioc.services.PipelineBuilder)
>> [2011/12/30 14:59:04.541] ERROR [o.a.t.i.Registry:log]: [ 5] Resolving
>> object of type org.apache.tapestry5.ioc.services.PipelineBuilder using
>> MasterObjectProvider
>> [2011/12/30 14:59:04.541] ERROR [o.a.t.i.Registry:log]: [ 6] Realizing
>> service ServiceOverride
>> [2011/12/30 14:59:04.542] ERROR [o.a.t.i.Registry:log]: [ 7] Instantiating
>> service ServiceOverride implementation via
>> org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl(Map) (at
>> ServiceOverrideImpl.java:31) via
>> org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at
>> TapestryIOCModule.java:49)
>> [2011/12/30 14:59:04.542] ERROR [o.a.t.i.Registry:log]: [ 8] Creating plan
>> to instantiate
>> org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl via public
>> org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl(java.util.Map)
>> [2011/12/30 14:59:04.543] E

Re: Beaneditor bug null property error

2012-01-03 Thread Sven Homburg
have a look at this page

http://tapestry.apache.org/forms-and-validation.html

""When rendering, the Form component emits two notifications: first,
"prepareForRender", then "prepare". These allow the Form's container
to setup any fields or properties that will be referenced in the form.
For example, this is a good place to create a temporary entity object
to be rendered, or to load an entity from a database to be edited.""

with regards
Sven Homburg
Founder of the Chenille Kit Project
http://chenillekit.codehaus.org




2012/1/3 felipexz :
> Hi, now its working but I think you should add this "hint" in the
> documentantion and at the Tutorial.
> I know we need to initialize the class but where was my problem.
>
> The working code is:
>
> public class CreateMunicipio
> {
>
>        @Property
>        @Persist
>        private Municipio municipio;
>
>        @Inject
>        private Session session;
>
>        void onPrepare() throws Exception {
>                municipio = new Municipio();
>        }
>
>        @CommitAfter
>        Object onSuccess()
>        {
>                session.merge(municipio);
>                return "";
>        }
>
> }
>
> Now it works. Could you add this onPrepare() in the Tutorial please ? Maybe
> more people can have the same question.
>
> Best regards
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117493.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: Why Components in Loop are the only one instance? What should I do?

2012-01-03 Thread Josh Canfield
> I have changed all the values I want to persist to context values and it 
> works for me now.> Is this the only way to solve this problem?

Probably not, but it seems like a fine solution.
On Mon, Jan 2, 2012 at 6:04 PM, Elivoa  wrote:
> I have a zone in my component. And an event link to refresh the zone.
> So I need to use a persists value to store the zone's client id, and I 
> persist some value that will show inside the zone.
>
> I have changed all the values I want to persist to context values and it 
> works for me now.
> Is this the only way to solve this problem?
>
> Sent from my iPad
>
> On 2012-1-3, at 4:08, Josh Canfield  wrote:
>
>> This is by design. Tapestry pages/ components have static structure so no
>> matter how many times you g through the loop you only get one instance
>> of the component.
>>
>> What specifically are you trying to do? Maybe someone can offer some design
>> tips.
>>
>> Josh
>> On Jan 2, 2012 12:17 AM, "Bo Gao"  wrote:
>>
>>> I put a Component in a Loop, and when I call System.out.println(this); I
>>> found that there are only one instance of the component. If I have some
>>> persist value in this Components they can't work well.
>>>
>>> Why this happened? What should I do if I want to put a Complex Component
>>> with persist value into a Loop?
>>>
>>> Thanks
>>>
>>> --
>>> Bo Gao
>>> eli...@gmail.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
>

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



Re: Beaneditor bug null property error

2012-01-03 Thread felipexz
Hi, now its working but I think you should add this "hint" in the
documentantion and at the Tutorial.
I know we need to initialize the class but where was my problem.

The working code is:

public class CreateMunicipio
{

@Property
@Persist
private Municipio municipio;

@Inject
private Session session;

void onPrepare() throws Exception {
municipio = new Municipio();
}

@CommitAfter
Object onSuccess()
{
session.merge(municipio);
return "";
}

}

Now it works. Could you add this onPrepare() in the Tutorial please ? Maybe
more people can have the same question.

Best regards

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117493.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: Beaneditor bug null property error

2012-01-03 Thread Lenny Primak
I Don't see you initializing the municipio variable anywhere in your code. You 
need something like setupRender and initialize it via new if it is null. 

 

On Jan 3, 2012, at 12:14 PM, felipexz  wrote:

> I'm using Tomcat 7 and java 1.7.. its a problem ?
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117434.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: Beaneditor bug null property error

2012-01-03 Thread felipexz
I'm using Tomcat 7 and java 1.7.. its a problem ?

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117434.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: Beaneditor bug null property error

2012-01-03 Thread felipexz
Hi, I think the problem is not about Persistence... the problem is municipio
is coming null. 
Anyway I tryed with session.merge.. anyway it says idMunicipio cannot be
null.

Best regards

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117425.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: Beaneditor bug null property error

2012-01-03 Thread Thiago H. de Paula Figueiredo

On Tue, 03 Jan 2012 14:50:03 -0200, felipexz  wrote:

I tryed.. after the beaneditor submit it should persist my object.. but  
it comes null.

And I get this error:

Caused by: org.hibernate.PersistentObjectException: detached entity  
passed to persist: com.icms.feam.entities.Municipio


Use Session.merge() instead. persist() can only be used for objects that  
don't exist in the database yet.


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



Re: Beaneditor bug null property error

2012-01-03 Thread felipexz
I tryed.. after the beaneditor submit it should persist my object.. but it
comes null.
And I get this error:

Caused by: org.hibernate.PersistentObjectException: detached entity passed
to persist: com.icms.feam.entities.Municipio


Best regards

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117350.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: Beaneditor bug null property error

2012-01-03 Thread Thiago H. de Paula Figueiredo

On Tue, 03 Jan 2012 14:38:14 -0200, felipexz  wrote:


Hi, thank you Thiago.. the code is this:

public class CreateMunicipio
{

@Property
private Municipio municipio;



When I try to run it.. my object municipio is null in  
CreateMunicipio.class

why ? I'm filling it in my beaneditor page.


If I got your problem right (you haven't said when municipio is null,  
render or for submission), it's null because Tapestry uses  
redirect-after-post and you don't persist the edited object in any way  
(@Persist in the municipio field or page activation context).


Try

@Property
@Persist
private Municipio municipio;

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



Re: Beaneditor bug null property error

2012-01-03 Thread felipexz
Hi, thank you Thiago.. the code is this:

public class CreateMunicipio
{

@Property
private Municipio municipio;

@Inject
private Session session;


@CommitAfter
Object onSuccess()
{
session.persist(municipio);
return "";
}


}

This is the CreateMunicipio.tml

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



This is my entity:


@Entity
public class Municipio {
//private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int idMunicipio;

private String bairro;

private String cep;

private String cnpj;

private String complemento;

private String email;

@Temporal( TemporalType.DATE)
private Date mandatoAte;

private String nomePref;

private String numero;

private String rua;

private String senha;


public int getIdMunicipio() {
return this.idMunicipio;
}

public void setIdMunicipio(int idMunicipio) {
this.idMunicipio = idMunicipio;
}

public String getBairro() {
return this.bairro;
}

public void setBairro(String bairro) {
this.bairro = bairro;
}

public String getCep() {
return this.cep;
}

public void setCep(String cep) {
this.cep = cep;
}

public String getCnpj() {
return this.cnpj;
}

public void setCnpj(String cnpj) {
this.cnpj = cnpj;
}

public String getComplemento() {
return this.complemento;
}

public void setComplemento(String complemento) {
this.complemento = complemento;
}

public String getEmail() {
return this.email;
}

public void setEmail(String email) {
this.email = email;
}

public Date getMandatoAte() {
return this.mandatoAte;
}

public void setMandatoAte(Date mandatoAte) {
this.mandatoAte = mandatoAte;
}

public String getNomePref() {
return this.nomePref;
}

public void setNomePref(String nomePref) {
this.nomePref = nomePref;
}

public String getNumero() {
return this.numero;
}

public void setNumero(String numero) {
this.numero = numero;
}

public String getRua() {
return this.rua;
}

public void setRua(String rua) {
this.rua = rua;
}

public String getSenha() {
return this.senha;
}

public void setSenha(String senha) {
this.senha = senha;
}

}

When I try to run it.. my object municipio is null in CreateMunicipio.class
why ? I'm filling it in my beaneditor page.

Best regards



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117326.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: Beaneditor bug null property error

2012-01-03 Thread Thiago H. de Paula Figueiredo

On Tue, 03 Jan 2012 14:19:00 -0200, felipexz  wrote:


I'm sorry but my questions are not cleary ?


Hi!

No, they weren't clear. Please post code and the full stack trace (if  
any). Without them, we can only guess what's happening. ;)


No, tapestry-hibernate doesn't support Hibernate 4 yet, but you can always  
provide your own code if tapestry-hibernate doesn't do what you want. :)


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



Re: Beaneditor bug null property error

2012-01-03 Thread felipexz
I'm sorry but my questions are not cleary ?

Best regards

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117279.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: Beaneditor bug null property error

2012-01-03 Thread Howard Lewis Ship
http://catb.org/esr/faqs/smart-questions.html

On Mon, Jan 2, 2012 at 12:11 PM, felipexz  wrote:
> Hi people, good evening. I'm trying to develop an application using
> Beaneditor like the Tapestry tutorial but when I try to persist is in my
> create java page my entity that I @Inject is comming null.
>
> I tryed at first with eclipselink and now with hibernate using Session I got
> same problem. Would it be a bug in the Beaneditor ? I didn't tryed in early
> versions.. Im in 5.3.1
>
> Tapestry 5.3 does support Hibernate 4.0 ?
>
> Thank you
> Best regards
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Beaneditor-bug-null-property-error-tp5115312p5115312.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



Beaneditor bug null property error

2012-01-03 Thread felipexz
Hi people, good evening. I'm trying to develop an application using
Beaneditor like the Tapestry tutorial but when I try to persist is in my
create java page my entity that I @Inject is comming null.

I tryed at first with eclipselink and now with hibernate using Session I got
same problem. Would it be a bug in the Beaneditor ? I didn't tryed in early
versions.. Im in 5.3.1

Tapestry 5.3 does support Hibernate 4.0 ?

Thank you
Best regards

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-bug-null-property-error-tp5115312p5115312.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: Is it possible to initialize a custom SymbolProvider with another symbol?

2012-01-03 Thread Borut Bolčina
Hi,

I would still like an advice on the approach on how to initialize custom
symbol provider with tapestry provided symbol. The code below ends in
IllegalStateException

Construction of service 'SymbolSource' has failed due to recursion: the
service depends on itself in some way.


The code from AppModule:

public RESTSymbolProvider buildRESTSymbolProvider(Logger logger,
@Inject @Symbol(SymbolConstants.EXECUTION_MODE) String executionMode) {
return new RESTSymbolProvider(logger, executionMode);
}

public void contributeSymbolSource(OrderedConfiguration
providers, Logger logger,
@InjectService("RESTSymbolProvider") SymbolProvider
restSymbolProvider) {
providers.add("myAppConfiguration", restSymbolProvider);
}

Thanks for any input,
borut

2011/12/30 Borut Bolčina 

> Hello,
>
> I am in a process of writting my own SymbolProvider (the configuration for
> my app will come from REST service) and I am facing a dilemma. The
> contribution looks like:
>
> public void
> contributeSymbolSource(OrderedConfiguration providers,
> Logger logger) {
> providers.add("myAppConfiguration", new RESTSymbolProvider(logger,
> "development"), "after:SystemProperties", "before:ApplicationDefaults");
> }
>
> You can see I hardcoded the string "development". I want to replace this
> string with another symbol
>
> @Symbol(SymbolConstants.EXECUTION_MODE) String executionMode
>
> As I need this symbol in another method (sendEmailMessage) in the
> AppModule I naively tried like this and failed:
>
> public class AppModule {
>
> private String *executionMode*;
>
> public AppModule(@Symbol(SymbolConstants.EXECUTION_MODE) String
> executionMode) {
> this.executionMode = executionMode;
> }
>
> @Startup
> public void sendEmailMessage(Logger logger) {
> if ("development".equals(*executionMode*)) {
> logger.info(MarkerFactory.getMarker("EDITORS"), "DEVELOPMENT
> Starting najdi-web");
> } else {
> logger.info(MarkerFactory.getMarker("EDITORS"), "PRODUCTION
> Starting najdi-web");
> }
> }
>
> public void
> contributeSymbolSource(OrderedConfiguration providers,
> Logger logger) {
> providers.add("myAppConfiguration", new RESTSymbolProvider(logger,
> *executionMode*), "after:SystemProperties", "before:ApplicationDefaults");
> }
> ...
> }
>
>
> Fails with:
>
> [2011/12/30 14:59:04.537] ERROR [o.a.t.i.Registry:log]: Construction of
> service 'SymbolSource' has failed due to recursion: the service depends on
> itself in some way. Please check
> org.apache.tapestry5.ioc.internal.services.SymbolSourceImpl(List) (at
> SymbolSourceImpl.java:198) via
> org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at
> TapestryIOCModule.java:49) for references to another service that is itself
> dependent on service 'SymbolSource'.
> [2011/12/30 14:59:04.538] ERROR [o.a.t.i.Registry:log]: Operations trace:
> [2011/12/30 14:59:04.539] ERROR [o.a.t.i.Registry:log]: [ 1] Realizing
> service ServletApplicationInitializer
> [2011/12/30 14:59:04.539] ERROR [o.a.t.i.Registry:log]: [ 2] Instantiating
> service ServletApplicationInitializer implementation via
> org.apache.tapestry5.services.TapestryModule.buildServletApplicationInitializer(Logger,
> List, ApplicationInitializer) (at TapestryModule.java:1395)
> [2011/12/30 14:59:04.540] ERROR [o.a.t.i.Registry:log]: [ 3] Constructing
> module class org.apache.tapestry5.services.TapestryModule
> [2011/12/30 14:59:04.540] ERROR [o.a.t.i.Registry:log]: [ 4] Determining
> injection value for parameter #1
> (org.apache.tapestry5.ioc.services.PipelineBuilder)
> [2011/12/30 14:59:04.541] ERROR [o.a.t.i.Registry:log]: [ 5] Resolving
> object of type org.apache.tapestry5.ioc.services.PipelineBuilder using
> MasterObjectProvider
> [2011/12/30 14:59:04.541] ERROR [o.a.t.i.Registry:log]: [ 6] Realizing
> service ServiceOverride
> [2011/12/30 14:59:04.542] ERROR [o.a.t.i.Registry:log]: [ 7] Instantiating
> service ServiceOverride implementation via
> org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl(Map) (at
> ServiceOverrideImpl.java:31) via
> org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at
> TapestryIOCModule.java:49)
> [2011/12/30 14:59:04.542] ERROR [o.a.t.i.Registry:log]: [ 8] Creating plan
> to instantiate
> org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl via public
> org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl(java.util.Map)
> [2011/12/30 14:59:04.543] ERROR [o.a.t.i.Registry:log]: [ 9] Determining
> injection value for parameter #1 (java.util.Map)
> [2011/12/30 14:59:04.544] ERROR [o.a.t.i.Registry:log]: [10] Collecting
> mapped configuration for service ServiceOverride
> [2011/12/30 14:59:04.544] ERROR [o.a.t.i.Registry:log]: [11] Invoking
> org.apache.tapestry5.services.TapestryModule.productionModeOverrides(MappedConfiguration,
> boolean) (at TapestryModule.java:2871)
> [2011/12/

Re: How to handle urls for a White Label site

2012-01-03 Thread captain_rhino
I got some basic rewriting of differrent partners working.  One for Lloyds
and one for Amex.

Simple requests such as 

http://localhost:8080/makeaclaim/lloyds/test
or
http://localhost:8080/makeaclaim/amex/test
got url rewrote to 
makeaclaim.partner.test

So good so far.


I have a Test class where the onSuccess method is looking to create a link.

Currently I have a very messy way of passing a context (the context
indicates which prtner site it is from) through so as the
PageRenderLinkTransformer can then use this context to dynamically create
the url displayed to the user?

Is there an wasier way to do this?  Any examples/comments would be much
appreciated?



http://snipt.org/tvpo9 PageRenderLinkTransformer 
http://snipt.org/tvpj8 Test.java 



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-handle-urls-for-a-White-Label-site-tp5091687p5117073.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



Object [object Object] has no method 'attachEvent'

2012-01-03 Thread gs_tapestry
I guess most people still in holiday mood :-). Happy new year to everyone !

Let me try this again.  Hopefully someone had experience with my issue.

Thanks in advance,

Simon

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/A-TAP5-586-alike-issue-tp5110620p5116997.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: jquery

2012-01-03 Thread Emmanuel DEMEY
Can you override the JQuerySymbolConstants.JQUERY_ALIAS constant in your
AppModule :
configuration.add(JQuerySymbolConstants.JQUERY_ALIAS, "$j");

in order to override the jQuery Alias.



2012/1/3 csckid 

> With this line
> configuration.add(JQuerySymbolConstants.SUPPRESS_PROTOTYPE, "false");
>
> This code works
>
> (function( $ ) {
> $(document).ready(function(){
> alert("ok");
> });
> }) ( jQuery );
>
> But the problem is jquery/tooltip mixin doesn't work now.
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/jquery-tp5113334p5116882.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
>
>


-- 
Emmanuel DEMEY
Ingénieur Etude et Développement
ATOS Worldline
+33 (0)6 47 47 42 02
demey.emman...@gmail.com
http://emmanueldemey.fr

Twitter : @gillespie59


Re: jquery

2012-01-03 Thread csckid
With this line
configuration.add(JQuerySymbolConstants.SUPPRESS_PROTOTYPE, "false");

This code works

(function( $ ) {
$(document).ready(function(){
alert("ok");
});
}) ( jQuery );

But the problem is jquery/tooltip mixin doesn't work now.

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/jquery-tp5113334p5116882.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: jquery

2012-01-03 Thread Emmanuel DEMEY
With SUPPRESS_PROTOTYPE to false, all your jQuery code should work !

Can you test this code :
(function( $ ) {
$(document).ready(function(){
alert("ok");
});
}) ( jQuery );

There is probably a conflict between the "$".


2012/1/2 csckid 

> I am using tapestry5-jquery version 2.6.1
>
> When I wrote this line
> *configuration.add(JQuerySymbolConstants.SUPPRESS_PROTOTYPE, "false");*
> Mixin is working but simple jquery isn't working. This is the error message
> for simple jquery method
> *$(document).ready is not a function*
>
>
> about.tml
>   xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";
>  xmlns:p="tapestry:parameter">
>
>
>
>
>
> If you click on me, I will disappear.
> show
> hide
>
> 
>
>
>
> When I omited this line
> *configuration.add(JQuerySymbolConstants.SUPPRESS_PROTOTYPE, "false");*
> mixin gives two error
> Error: uncaught exception: controls.js requires including script.aculo.us'
> effects.js library
>
> Error: $T is not defined
> Source File:
>
> http://localhost:8080/medical/assets/1.0-SNAPSHOT/core/corelib/mixins/autocomplete.js
> Line: 17
>
>
>
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/jquery-tp5113334p5114790.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
>
>


-- 
Emmanuel DEMEY
Ingénieur Etude et Développement
ATOS Worldline
+33 (0)6 47 47 42 02
demey.emman...@gmail.com
http://emmanueldemey.fr

Twitter : @gillespie59


Re: 5.3.1 upgrade error : class has been transformed and may not be directly instantiated.

2012-01-03 Thread Thiago H. de Paula Figueiredo
On Wed, 28 Dec 2011 15:24:20 -0200, Andrew Dahl   
wrote:


"Class us.venses.core.base.util.IndexedObject has been transformed and  
may not be directly instantiated."


I am getting this error on a class after upgrading to 5.3.1 from 5.2.6.  
The class is referenced from a component, but is not in any of the  
tapestry reserved spots.


Yes, it is in one of the Tapestry reserved spots: the package named 'base'.

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



Re: T5 progress bar in a grid

2012-01-03 Thread Lance Java
There are a couple of approaches to do this, since tapestry does not
support ajax push (aka reverse ajax) out-of-the box, a simple solution
would be to have the client poll the server for the current percentage
complete.

In order to display a progress bar to the client, you must do the actual
work for the task on a separate thread to the Ajax request thread. It is
probably best to have a singleton ExecutorService (using
java.util.concurrent.Executors.newFixedThreadPool(threadCount) or similar)

The Ajax request thread should:
1. Create a runnable and give it a unique taskId
2. Put the runnable in a serverside map keyed on taskId (map could be a
singleton or perhaps stored in each user's session)

3. Call executorService.submit(myRunnable)
4. Use the AjaxResponseRenderer to fire the "updateProgressBar" event
passing the taskId in the context
5. Return the progress bar zone's getBody() with a percentageComplete of 0

Your runnable would be something like

public class MyWorker implements Runnable {
   private int taskId;
   private ConcurrentMap workers;
   private AtomicInteger percentComplete = new AtomicInteger(0);
   public MyWorker(ConcurrentMap workers, String taskId) {
  this.workers = workers;
  this.taskId = taskId;
   }
   public int getPercentComplete() {
  return percentComplete.get();
   }
   public void run() {
  try {
 doSomeWork();
 percentComplete.set(10);
 doSomeMoreWork();
 percentComplete.set(50);
 doEvenMoreWork();
 percentComplete.set(100);
  } finally {
 workers.remove(taskId);
  }
   }
}


In your serverside event handler [onUpdateProgressBar(String taskId)]
lookup the runnable in the map and call getPercentComplete() then return
the updated progress zone's getBody(). If the percentageComplete() is less
than 100, use the AjaxResponseRenderer to fire the "updateProgressBar"
event again.

@see http://tawus.wordpress.com/2011/10/01/tapestry-5-3-new-features-part-2/for
AjaxResponseRenderer usage

Cheers,
Lance.

On Monday, 26 December 2011, angelochen  wrote:
> Hi,
>
> would like to have some ideas about how to implement following:
>
> I have a t:grid, every row has a link, when click, it will do a process
> which might take a while, once done, it will either disable the link or
> re-display the link depending on the result. I'd like that, when clicked,
> the link is replaced with a progress bar in place, until it is done. any
> hints? Thanks,
>
> Angelo
>
> --
> View this message in context:
http://tapestry.1045711.n5.nabble.com/T5-progress-bar-in-a-grid-tp5101565p5101565.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
>
>