Re: How to get container inside self written component

2015-02-19 Thread Lance Java
> Its working now as long my form components not rendered in loops or grids

Hmm... I'd call that broken ;)


Re: How to get container inside self written component

2015-02-17 Thread Thiago H de Paula Figueiredo
On Tue, 17 Feb 2015 17:01:15 -0200, Erich Gormann   
wrote:



Hi all,


Hi!

thanks for your precious hints. For this time @InjectContainer is  
sufficient for my needs.
Its all about self written input field components, which render behavior  
is controlled by user permissions determining if a user is permitted to  
read/write fields by generic/reflective checks of his permissions for  
certain entities and their fields.


I suggest you to move the permission checks to services and use them in  
the components. Also think about the possibility of creating mixins for  
that, which are a great tool to change a component or page behavior  
without changing their sources. You'd have better code in the end.


Also check tapestry-security...

--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: How to get container inside self written component

2015-02-17 Thread Erich Gormann

Hi all,

thanks for your precious hints. For this time @InjectContainer is 
sufficient for my needs.
Its all about self written input field components, which render behavior 
is controlled by user permissions determining if a user is permitted to 
read/write fields by generic/reflective checks of his permissions for 
certain entities and their fields.


Its working now as long my form components not rendered in loops or 
grids :-)


Greetings, Erich



Am 16.02.2015 21:49, schrieb Chris Mylonas:

@InjectContainer is the way to go.

Have a 10 minute read on the OSI 7 Layer model for data communications 
as a reference point if you need one.


e.g. Each layer knows the layer above and below it, like parent and 
child.


It's a proven mechanism of keeping things "encapsulated" and if you 
have custom @Service tapestry artifacts you can still do the object 
oriented things.


If you have dozens of components it'll be a little bit of a refactor, 
but __totally__ worth it compared to alternate approaches.


Mylo's 2cents :)

Cheers
Chris


On Tue, 17 Feb 2015 07:43:18 +1100, Erich Gormann 
 wrote:



OK,
I'm not experienced in the InjectContainer annotation, but it seems 
that one have to write it on each embedded component?

I have to figure out.
The original intention was that the component's container must not be 
mentioned anywhere, even not in an annotation.




Von Samsung Mobile gesendet

 Ursprüngliche Nachricht 
Von: Thiago H de Paula Figueiredo 
Datum:13.02.2015  21:03  (GMT+01:00)
An: Tapestry users 
Betreff: Re: How to get container inside self written component

On Fri, 13 Feb 2015 17:26:25 -0200, Erich Gormann 
wrote:



Hi Thiago,


Hi!

I see what you mean, but I did not want to manipulate the 
containercomponent, but only wanted to look up if a certain (self 
written)annotation is present on it and then let the embedded 
component to docertain things.


According to my opinion that would be a nice way to get 
informationabout the container component without knowing it in the 
embeddedcomponent and without make the unnecessary work for other 
developers towrite one more parameter besides all other ones.


I can not see why an additional parameter is the recommended way here.


Now that you've given the whole picture, specially the annotation 
part,now it makes sense to use @InjectContainer. But remember 
thatannotation-level classes are *not* live-reloaded, so, once you 
put orremove the annotation, this check won't work. It can be made to 
workindirectly, implementing and contributing a 
ComponentClassTransformWorker
that calls setMeta("someKeyYou'llCreate", "true") in the 
component'sComponentModel when it has the annotation. To query that 
in the innerocmponent, you can @Inject ComponentResources and use 
thegetContainer().getComponentModel().getMeta(String key).








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



Re: AW: Re: How to get container inside self written component

2015-02-17 Thread Thiago H de Paula Figueiredo
On Mon, 16 Feb 2015 18:43:18 -0200, Erich Gormann   
wrote:



OK,
I'm not experienced in the InjectContainer annotation, but it seems that  
one have to write it on each embedded component?


Yes.


I have to figure out.
The original intention was that the component's container must not be  
mentioned anywhere, even not in an annotation.


So you cannot use @InjectContainer. And I agree with your original  
intention of less coupling. You're doing more work avoiding a parameter  
than passing it.


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: AW: Re: How to get container inside self written component

2015-02-16 Thread Chris Mylonas

@InjectContainer is the way to go.

Have a 10 minute read on the OSI 7 Layer model for data communications as  
a reference point if you need one.


e.g. Each layer knows the layer above and below it, like parent and child.

It's a proven mechanism of keeping things "encapsulated" and if you have  
custom @Service tapestry artifacts you can still do the object oriented  
things.


If you have dozens of components it'll be a little bit of a refactor, but  
__totally__ worth it compared to alternate approaches.


Mylo's 2cents :)

Cheers
Chris


On Tue, 17 Feb 2015 07:43:18 +1100, Erich Gormann   
wrote:



OK,
I'm not experienced in the InjectContainer annotation, but it seems that  
one have to write it on each embedded component?

I have to figure out.
The original intention was that the component's container must not be  
mentioned anywhere, even not in an annotation.




Von Samsung Mobile gesendet

 Ursprüngliche Nachricht 
Von: Thiago H de Paula Figueiredo 
Datum:13.02.2015  21:03  (GMT+01:00)
An: Tapestry users 
Betreff: Re: How to get container inside self written component

On Fri, 13 Feb 2015 17:26:25 -0200, Erich Gormann  
wrote:



Hi Thiago,


Hi!

I see what you mean, but I did not want to manipulate the container 
component, but only wanted to look up if a certain (self written) 
annotation is present on it and then let the embedded component to do 
certain things.


According to my opinion that would be a nice way to get information 
about the container component without knowing it in the embedded 
component and without make the unnecessary work for other developers to 
write one more parameter besides all other ones.


I can not see why an additional parameter is the recommended way here.


Now that you've given the whole picture, specially the annotation part, 
now it makes sense to use @InjectContainer. But remember that 
annotation-level classes are *not* live-reloaded, so, once you put or 
remove the annotation, this check won't work. It can be made to work 
indirectly, implementing and contributing a ComponentClassTransformWorker
that calls setMeta("someKeyYou'llCreate", "true") in the component's 
ComponentModel when it has the annotation. To query that in the inner 
ocmponent, you can @Inject ComponentResources and use the 
getContainer().getComponentModel().getMeta(String key).





--
Using Opera's mail client: http://www.opera.com/mail/

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



AW: Re: How to get container inside self written component

2015-02-16 Thread Erich Gormann
OK,
I'm not experienced in the InjectContainer annotation, but it seems that one 
have to write it on each embedded component?
I have to figure out.
The original intention was that the component's container must not be mentioned 
anywhere, even not in an annotation.



Von Samsung Mobile gesendet

 Ursprüngliche Nachricht 
Von: Thiago H de Paula Figueiredo  
Datum:13.02.2015  21:03  (GMT+01:00) 
An: Tapestry users  
Betreff: Re: How to get container inside self written component 

On Fri, 13 Feb 2015 17:26:25 -0200, Erich Gormann   
wrote:

> Hi Thiago,

Hi!

> I see what you mean, but I did not want to manipulate the container  
> component, but only wanted to look up if a certain (self written)  
> annotation is present on it and then let the embedded component to do  
> certain things.
>
> According to my opinion that would be a nice way to get information  
> about the container component without knowing it in the embedded  
> component and without make the unnecessary work for other developers to  
> write one more parameter besides all other ones.
>
> I can not see why an additional parameter is the recommended way here.

Now that you've given the whole picture, specially the annotation part,  
now it makes sense to use @InjectContainer. But remember that  
annotation-level classes are *not* live-reloaded, so, once you put or  
remove the annotation, this check won't work. It can be made to work  
indirectly, implementing and contributing a ComponentClassTransformWorker
that calls setMeta("someKeyYou'llCreate", "true") in the component's  
ComponentModel when it has the annotation. To query that in the inner  
ocmponent, you can @Inject ComponentResources and use the  
getContainer().getComponentModel().getMeta(String key).

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: How to get container inside self written component

2015-02-13 Thread Thiago H de Paula Figueiredo
On Fri, 13 Feb 2015 17:26:25 -0200, Erich Gormann   
wrote:



Hi Thiago,


Hi!

I see what you mean, but I did not want to manipulate the container  
component, but only wanted to look up if a certain (self written)  
annotation is present on it and then let the embedded component to do  
certain things.


According to my opinion that would be a nice way to get information  
about the container component without knowing it in the embedded  
component and without make the unnecessary work for other developers to  
write one more parameter besides all other ones.


I can not see why an additional parameter is the recommended way here.


Now that you've given the whole picture, specially the annotation part,  
now it makes sense to use @InjectContainer. But remember that  
annotation-level classes are *not* live-reloaded, so, once you put or  
remove the annotation, this check won't work. It can be made to work  
indirectly, implementing and contributing a ComponentClassTransformWorker  
that calls setMeta("someKeyYou'llCreate", "true") in the component's  
ComponentModel when it has the annotation. To query that in the inner  
ocmponent, you can @Inject ComponentResources and use the  
getContainer().getComponentModel().getMeta(String key).


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: How to get container inside self written component

2015-02-13 Thread Thiago H de Paula Figueiredo
One last comment: you mentioned self-written component. For Tapestry,  
there's absolutely no distinction at all at the components provided  
out-of-the-box and the components you write. All components, regardless of  
origin, are treated and work the same.


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: How to get container inside self written component

2015-02-13 Thread Erich Gormann

Hi Thiago,

I see what you mean, but I did not want to manipulate the container 
component, but only wanted to look up if a certain (self written) 
annotation is present on it and then let the embedded component to do 
certain things.


According to my opinion that would be a nice way to get information 
about the container component without knowing it in the embedded 
component and without make the unnecessary work for other developers to 
write one more parameter besides all other ones.


I can not see why an additional parameter is the recommended way here.

Greetings, Eric

Am 13.02.2015 20:11, schrieb Thiago H de Paula Figueiredo:
On Fri, 13 Feb 2015 17:01:06 -0200, Erich Gormann 
 wrote:



Hello Daniel,

I wanted to avoid an additional parameter, because there are already 
some parameters and if there would another way to manage it, this 
would be better.


You're much better off with another parameter then accessing the 
parent component directly.





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



Re: How to get container inside self written component

2015-02-13 Thread Thiago H de Paula Figueiredo
On Fri, 13 Feb 2015 17:01:06 -0200, Erich Gormann   
wrote:



Hello Daniel,

I wanted to avoid an additional parameter, because there are already  
some parameters and if there would another way to manage it, this would  
be better.


You're much better off with another parameter then accessing the parent  
component directly.


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: How to get container inside self written component

2015-02-13 Thread Erich Gormann

Hello Daniel,

I wanted to avoid an additional parameter, because there are already 
some parameters and if there would another way to manage it, this would 
be better.

I'll try the service you proposed, thanks for your answer!

Greetings, Eric


Am 13.02.2015 19:44, schrieb Poggenpohl, Daniel:

Hello,
why don't you try @InjectContainer? Or give the necessary information via 
parameters to the inner component?

Regards,
Daniel Poggenpohl

Von: Erich Gormann [e.gorm...@gormann.de]
Gesendet: Freitag, 13. Februar 2015 18:51
An: Tapestry users
Betreff: How to get container inside self written component

Hi all,

seems to be a simple task, but I did not manage it right now.
I'm working with a self written component. Inside the code of this
component I want to retrieve information about the outer component
(container), my component is currently used in.

I tried the service ComponentSource, but I'm only was able to get the
root component via getActivePage(). Thats not want I want. I need
information about the direct container of my component, because it's
required to do some reflection tasks on it.

Do you have some hints for me? Thanks a lot in advance.

Greetings, Eric


-
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