Latest Tapestry 5 Screencast

2007-02-28 Thread Howard Lewis Ship

I've put up a new Tapestry 5 screencast:

http://tapestry.apache.org/tapestry5/screencast_5.html

This one shows off the new Grid component.

--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Role based security

2007-02-28 Thread Jonathan Barker

Sam,

I finally read the full text of your message. :-)

There is huge overlap between your requirements and mine.

My application also had the issue that role-based security was not
sufficient. I used a custom imlementation of the Acegi AclProvider to
control (on a per-entity basis) how much could be seen or if links were
generated to access certain records.  This could be used in addition to, or
in place of, the role-based access.

I didn't need to filter result sets as was your case.

I would be very interested in seeing what you have put together. Apart from
the authorization issues, I have yet to see a nice performant Hibernate
table model.

This thread has prompted me to start cleaning up my code and packaging it
into a library. With the carmenconsulting page-level security option on one
end, role and instance-based acl security with my work, and your work
including hibernate-level collection filters there could be a great set of
options for securing tapestry apps.

Jonathan


On 2/27/07, Sam Gendler <[EMAIL PROTECTED]> wrote:


It is simple enough to build a component based on the @If component
which will conditionally check some authorization requirement.  That's
what we have for handling role based auth in a template, including
some sophisticated else handling which lets the template cascade
through a number of options.  We don't explicitly list roles anywhere
in the templates.  We have a delegate that maps permissions from roles
to objects.  Our @IfAuth component just checks whether the current
user has a particular permission (read, write, and deny basically).

We've actually got permissions assigned on a per-property basis on
many objects, so we also have wrapper components which wrap the normal
form components with the IfAuth conditional so that our templates
aren't full of difficult-to-read conditional blocks.  The entire chain
of possible permissions are represented in a single component, so if
they have write permission, they will see a text box, read permission
will show a label, deny will show a blank space, etc.  We actually
went a step further and built a single component which renders any
number of form components based on the type of the value being
assigned.  Booleans get checkboxes, lists get palettes, strings get
text fields, numbers get text fields + number translator, etc.  Each
also takes care of rendering correctly according to the permission
available to the current user for the field in question.  It is
similar to bean form, but pre-dates it by quite a bit.

We do have an IfRole component for the few places where we have to
check whether a user is a particular role, such as when deciding
whether to render a particular menu item.

All of this could plug into Acegi or any kind of authorization
mechanism you might care to roll into your app.  So long as you can
define some kind of AuthorizationDelegate that you can provide to the
tags for doing the auth and returning a permission, it is pretty easy
to implement and/or modify the auth mechanism.

We also have record based security which is implemented entirely via
hibernate filters and AOP interception which ensures that none of the
service methods can be executed without having the appropriate
hibernate filters enabled.  This was necessary in order to handle
things like tables with paging.  The acegi mechanisms don't appear to
provide a way to ensure that db queries only return the rows for which
the current user is authorized, so offset/limit queries don't work
correctly when acegi removes items after the query has run.  This
breaks the paging in the tables.  So we use hibernate filters to
ensure that any query that runs only ever returns the results
appropriate for the current user.

I'm intending to write a paper about this mechanism that folks can
see, as it turned out to be incredibly flexible and very efficient.
It's got unix filesystem style permissions (owner, group, world -
although it is actually a little more sophisticated than that) and
multiple permissions that can be applied to each (read, write,
reassign).  It also provides hierarchical auth, so you have the same
permissions (or better) as any user below you in the hierarchy -
allowing managers to have the same access as their direct reports,
without explicitly assigning them to each record owned by a direct
report. This is vital if any user might ever be moved within the
organization. It also allows temporary owner reassignment without
removing the original owner assignment.  This allows employees to be
assigned to cover for others during vacations and such without forcing
the system to explicitly remember who used to be assigned where and
then reassigning at the end of the period.

The whole thing is completely transparent outside of the service
layer.  The DAO layer knows absolutely nothing about the authorization
filters and neither does the ui layer (except, of course, where we've
exposed fields you can edit to modify assignments and such).  Even our
service

Re: Role based security

2007-02-28 Thread Patrick Moore

hi sam... sounds pretty interesting... I especially like the sounds of
something that slips in the cracks without imposing expectations of
knowledge on developers.

I will be looking at the hibernate filters now in  a whole new light..


-Pat


Re: T5 validation

2007-02-28 Thread Howard Lewis Ship

@Component
private Form _form;


This defines the type of the component with an id of "form" as being
an instance of the Form component. Further, you can access the form to
record errors into it.

On 2/28/07, Terry <[EMAIL PROTECTED]> wrote:


Following the beaneditform pattern, I have a page that submits a form with
field validation using the included annotations. Now I would like to perform
second stage validation on the data returned (checking for uniqueness
against a database, etc) and to use the same error reporting mechanism to
feed back field level errors to the user.

If my page is a POJO and my form data is a POJO that is wired up by magic,
how do I get access to the Form object from within the page to invoke
recordError?

Thanks,

Terry
--
View this message in context: 
http://www.nabble.com/T5-validation-tf3323698.html#a9240017
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



T5 validation

2007-02-28 Thread Terry

Following the beaneditform pattern, I have a page that submits a form with
field validation using the included annotations. Now I would like to perform
second stage validation on the data returned (checking for uniqueness
against a database, etc) and to use the same error reporting mechanism to
feed back field level errors to the user.

If my page is a POJO and my form data is a POJO that is wired up by magic,
how do I get access to the Form object from within the page to invoke
recordError?

Thanks,

Terry
-- 
View this message in context: 
http://www.nabble.com/T5-validation-tf3323698.html#a9240017
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Role based security

2007-02-28 Thread Jonathan Barker
Borut,

Sorry.  I don't have this in a library yet - the applications I've been
working on lately have rather flat security requirements so I haven't
extracted this out into a library.

Here's a little snippet out of the menu section of my Border component for
sample usage:


Month Calendar



Agent Console




New Estimate




I could have cleaned this up by getting rid of a few  tags and
specifying the "element" property for the @Authorize component. (Remember,
it really does behave like an "If" - you can even use the Else with it.)

The hard part I found was the Spring side of my plumbing - I jumped into the
deep end implementing org.acegisecurity.userdetails.UserDetailsService.  I
also have a rather hacked-up way of doing my authentication borrowing from
EWDT.

If you can start out getting things working as described in the Wiki, and
then incorporate my stuff that's what I would suggest.

Basically, once you have a SecurityContextHolder containing your
SecurityContext, things get much easier.


Jonathan


> -Original Message-
> From: Borut Bolčina [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 28, 2007 3:43 AM
> To: Tapestry users
> Subject: Re: Role based security
> 
> Hello Jonathan,
> 
> I found
> http://mail-archives.apache.org/mod_mbox/tapestry-
> users/200606.mbox/[EMAIL PROTECTED]
> 
> I will have to study the code, as my T4 mileage is short. You don't happen
> to have a component library set up with some examples would you?
> 
> Thanks,
> Borut
> 
> 
> 2007/2/27, Jonathan Barker <[EMAIL PROTECTED]>:
> >
> > Mark,
> >
> > Do a Google search using the search string:
> >
> > site:http://mail-archives.apache.org/mod_mbox "Jonathan Barker"
> >
> > I posted some information and code in June 2006 about creating
> @Authorize
> > and @AclAuthorize based on the code for the tapestry @If component, and
> > the
> > Authorize and AclAuthorize JSP taglibs.
> >
> > I've had this in production since last May and it's been working
> > beautifully.
> >
> > Jonathan
> >
> >
> >


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 IoC - inject service in data class ?

2007-02-28 Thread Peter Beshai

Pardon my inexperience, but I'm having a little difficulty getting my head
wrapped around all of these IOC concepts. I've read through much of the
documentation on the tapestry website, but I'm still having a hard time
understanding it all.

So I should create a data factory service to handle the creation of my data
objects, and presumably include a buildDataFactory method in my AppModule
with an @InjectService("ListService") as one of the parameters. How do I go
from there to having it as something I can use in my data class? Would I
pass the service into the data class have it store a copy there (doesn't
sound like a good idea) or should I restructure my data class to not need
the service (it's possible in this case)?

Also, what is the benefit to having more modules than AppModule?
And re: updating the MANIFEST.MF, is this in regards to the external jar
where my ListService is in?

Thanks and sorry for the abundance of questions!
--
Peter Beshai

Pure Mathematics/Computer Science Student
University of Waterloo

On 2/27/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:


The pattern of use is:

You create a factory service for your data object.  The data object's
dependencies are injected into the factory.

You ask the factory for the object, it instantiates the data object
with the dependencies.

buildDefaultRegistry() builds  a new registry, not what you want.

Be aware that the dependencies will be runtime-generated proxy objects
that are not serializable.

You can have additional modules, not just AppModule ... there's doc in
the tapestry-ioc section to discuss how to update MANIFEST.MF with the
necessary data.

On 2/27/07, Peter Beshai <[EMAIL PROTECTED]> wrote:
> I would like to use one of my services I have defined in AppModule in
one of
> my data classes. Is this frowned upon?
>
> If not, how do I go about doing it?
>
> Currently my AppModule has:
> public static IListService buildListService( ... ) {  ... return
> listService; } // listService is an instantation of an implementation of
> IListService
>
> and I tried in my data class to add the following:
>
> private Registry registry = IOCUtilities.buildDefaultRegistry();
> private IListService _listService = registry.getService(
IListService.class);
>
> but it didn't work
>
> I also tried
>
> private Registry registry = IOCUtilities.buildDefaultRegistry();
> private IListService _listService = registry.getService("
> my.package.ListService",IListService.class);
>
> which gave me java.lang.RuntimeException: Module 'com.beshai.list.jdo'
does
> not exist. Please ensure that the JAR file for the module is on the
> classpath. (the package and class is in a different JAR file, but it is
a
> maven dependency)
>
> Thanks
> --
> Peter Beshai
>
> Pure Mathematics/Computer Science Student
> University of Waterloo
>


--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: PatternValidator example

2007-02-28 Thread Shing Hing Man
There is an example on PatternValidator at the end 
of Chapter 3 of Kent Tong's excellent book
Enjoying Web Development with Tapestry.
The first 4 chapters are free.
You can download it from 
http://www.agileskills2.org/EWDT/

Shing

--- Andy <[EMAIL PROTECTED]> wrote:

> 
> Hello,
> 
> I try to use the PatternValidator but cannot find an
> example. (I read 
> two archived threads on this list, but these only
> covered how to define 
> ta PatternValidator in a page spec)
> 
> I am looking for something like this:
> 
>jwcid="[EMAIL PROTECTED]"
>   value="ognl:someObject.XYZ"
>   validators="validators:required"/>
> 
> 
> Except that I want to use the PatternValidator...
> 
> 
> Can anybody pleasy copy and paste?
> 
> 
> Andy
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


Home page :
  http://uk.geocities.com/matmsh/index.html





___ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at 
the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: PatternValidator example

2007-02-28 Thread Dennis Sinelnikov

Hi Andy,

Example, using T4:

In .page:




in .html:


hth,
Dennis

Andy wrote:


Hello,

I try to use the PatternValidator but cannot find an example. (I read 
two archived threads on this list, but these only covered how to define 
ta PatternValidator in a page spec)


I am looking for something like this:




Except that I want to use the PatternValidator...


Can anybody pleasy copy and paste?


Andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Request for T4.1 AJAX documentation enhancement

2007-02-28 Thread Shing Hing Man
There is an example on @EventListener at the
following.

http://lombok.demon.co.uk/tapestry41Demo/app

Shing




--- Thiago H de Paula Figueiredo
<[EMAIL PROTECTED]> wrote:

> I tried to follow the AJAX example at  
>
http://tapestry.apache.org/tapestry4.1/ajax/eventlistener.html
> but i  
> haven't suceeded to have my listeners called. That
> page is very short in  
> details in how to get things working. It would be
> wonderful if there was  
> some complete, downloadable example of some simple
> AJAX funcionality like  
> updating one combobox when the user chooses some
> option in another  
> combobox (for example, a state/city chooser: when
> the state is chosen, the  
> city chooser is updated with the corresponding
> cities).
> 
> Thanks in advance.
> 
> -- 
> 
> hasta la vista!!!
> 
> |8) |8p |8) |8p |8) |8p |8) |8p |8) |8p |8) |8p |8)
> |8p |8) |8p |8) |8p
> 
> thiago h. de paula figueiredo
> mestre em ciência da computação pelo dcc/ufmg
> ate' porque bobagem pouca e' bobagem . . .
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


Home page :
  http://uk.geocities.com/matmsh/index.html



___ 
What kind of emailer are you? Find out today - get a free analysis of your 
email personality. Take the quiz at the Yahoo! Mail Championship. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Request for T4.1 AJAX documentation enhancement

2007-02-28 Thread Thiago H de Paula Figueiredo
I tried to follow the AJAX example at  
http://tapestry.apache.org/tapestry4.1/ajax/eventlistener.html but i  
haven't suceeded to have my listeners called. That page is very short in  
details in how to get things working. It would be wonderful if there was  
some complete, downloadable example of some simple AJAX funcionality like  
updating one combobox when the user chooses some option in another  
combobox (for example, a state/city chooser: when the state is chosen, the  
city chooser is updated with the corresponding cities).


Thanks in advance.

--

hasta la vista!!!

|8) |8p |8) |8p |8) |8p |8) |8p |8) |8p |8) |8p |8) |8p |8) |8p |8) |8p

thiago h. de paula figueiredo
mestre em ciência da computação pelo dcc/ufmg
ate' porque bobagem pouca e' bobagem . . .

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Untetermined count of form elements

2007-02-28 Thread Howard Lewis Ship

Why wouldn't  work (where
textproperty is an edittable property of each option object from
optionList?

When the form submits, the Loop will bet involved and will iterate the
elements in the list again, keeping the option property upto date
before each textfield pulls a value from the request.  There's a lot
of room for Tapestry to do this wrong, so you'll probably want to look
at some of the more advanced parameters of Loop.

On 2/28/07, Dennis Kempin <[EMAIL PROTECTED]> wrote:

Hello,

i am trying to process an dynamic amount of options, which are fetched from
an list, just like this:







Well every textfield needs a value to write the result, but when i have an
undetermined amount of textfields, i cannot hardcode the value component
properties.

It would be nice if values could be written to a List, Map or an array.
Is something like this possible with the existing components?
Or do i have to write a new component on myself?

thanks and regards
Dennis



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



T4: AJAX request from a page with a dojo editor causes exception

2007-02-28 Thread Kristian Marinkovic

hi all,

when i try to send data via "tapestry.bind" to my Tapestry page from
a page with a dojo editor (editor2) i get following javascript exception:

[exception]
DEBUG: [Exception... "Component returned failure code: 0x80004005
(NS_ERROR_FAILURE) [nsIXMLHttpRequest.open]" nsresult: "0x80004005
(NS_ERROR_FAILURE)" location: "JS frame ::
http://localhost:8080/gp/js/dojo.js.uncompressed.js :: anonymous :: line
10642" data: no] when calling onKeyPress$joinpoint$method on [Widget
dojo:editor2, dojo_Editor2_0] with arguments [object Object]
FATAL exception raised: Component returned failure code: 0x80004005
(NS_ERROR_FAILURE) [nsIXMLHttpRequest.open]
[/exception]

i set up a maven project where i can reproduce this anytime but i
dont know what is causing this exception. When i view the raw html
template in FF (... the not generated html ) everything works fine.

i hope someone can give me a hint. is it related to the keyhandlers of
the editor? why does it matter if do a ajax call?

please help

my code looks like this:

editor.js
var editor = null;

function startEdit(e) {
   editor = dojo.widget.createWidget("Editor2", {
 toolbarTemplatePath:null
  }, dojo.byId("edit"));

   var k = dojo.event.browser.keys;
   // listen to key events
   editor.addKeyHandler(k.KEY_ESCAPE,null,listenESC);
   editor.addKeyHandler(k.KEY_ENTER ,null,listenENTER);
}

function initEditor() {
   dojo.event.connect(dojo.byId("edit"), "ondblclick", "startEdit");
}

function listenESC() {}

function listenENTER() {
   ...
   asyncListenerDoSave(data);
   ...
}

asyncCaller component:
dojo.require("dojo.dom");
dojo.require("dojo.dnd.*");
dojo.require("dojo.event.*");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.Editor2");
dojo.require("tapestry.event");


function asyncListenerDoSave(data) {
   tapestry.bind("/gp/app?component=async&page=Editor&service=direct",
data, false);
}

g,
kris




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



PatternValidator example

2007-02-28 Thread Andy


Hello,

I try to use the PatternValidator but cannot find an example. (I read 
two archived threads on this list, but these only covered how to define 
ta PatternValidator in a page spec)


I am looking for something like this:




Except that I want to use the PatternValidator...


Can anybody pleasy copy and paste?


Andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Untetermined count of form elements

2007-02-28 Thread Dennis Kempin
Hello,

i am trying to process an dynamic amount of options, which are fetched from
an list, just like this:







Well every textfield needs a value to write the result, but when i have an
undetermined amount of textfields, i cannot hardcode the value component
properties. 

It would be nice if values could be written to a List, Map or an array.
Is something like this possible with the existing components? 
Or do i have to write a new component on myself?

thanks and regards
Dennis



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Role based security

2007-02-28 Thread Borut Bolčina

Hello Sam,

this must be the most elaborate reply I have ever seen on a mailing list.
You really should write a chapter for Kent's book or write your own and make
some $ out of all that knowledge. In the mean time, I have to know Acegi and
Tapestry more, to even ask further questions.

Thanks,
Borut


2007/2/27, Sam Gendler <[EMAIL PROTECTED]>:


It is simple enough to build a component based on the @If component
which will conditionally check some authorization requirement.  That's
what we have for handling role based auth in a template, including
some sophisticated else handling which lets the template cascade
through a number of options.  We don't explicitly list roles anywhere
in the templates.  We have a delegate that maps permissions from roles
to objects.  Our @IfAuth component just checks whether the current
user has a particular permission (read, write, and deny basically).

We've actually got permissions assigned on a per-property basis on
many objects, so we also have wrapper components which wrap the normal
form components with the IfAuth conditional so that our templates
aren't full of difficult-to-read conditional blocks.  The entire chain
of possible permissions are represented in a single component, so if
they have write permission, they will see a text box, read permission
will show a label, deny will show a blank space, etc.  We actually
went a step further and built a single component which renders any
number of form components based on the type of the value being
assigned.  Booleans get checkboxes, lists get palettes, strings get
text fields, numbers get text fields + number translator, etc.  Each
also takes care of rendering correctly according to the permission
available to the current user for the field in question.  It is
similar to bean form, but pre-dates it by quite a bit.

We do have an IfRole component for the few places where we have to
check whether a user is a particular role, such as when deciding
whether to render a particular menu item.

All of this could plug into Acegi or any kind of authorization
mechanism you might care to roll into your app.  So long as you can
define some kind of AuthorizationDelegate that you can provide to the
tags for doing the auth and returning a permission, it is pretty easy
to implement and/or modify the auth mechanism.

We also have record based security which is implemented entirely via
hibernate filters and AOP interception which ensures that none of the
service methods can be executed without having the appropriate
hibernate filters enabled.  This was necessary in order to handle
things like tables with paging.  The acegi mechanisms don't appear to
provide a way to ensure that db queries only return the rows for which
the current user is authorized, so offset/limit queries don't work
correctly when acegi removes items after the query has run.  This
breaks the paging in the tables.  So we use hibernate filters to
ensure that any query that runs only ever returns the results
appropriate for the current user.

I'm intending to write a paper about this mechanism that folks can
see, as it turned out to be incredibly flexible and very efficient.
It's got unix filesystem style permissions (owner, group, world -
although it is actually a little more sophisticated than that) and
multiple permissions that can be applied to each (read, write,
reassign).  It also provides hierarchical auth, so you have the same
permissions (or better) as any user below you in the hierarchy -
allowing managers to have the same access as their direct reports,
without explicitly assigning them to each record owned by a direct
report. This is vital if any user might ever be moved within the
organization. It also allows temporary owner reassignment without
removing the original owner assignment.  This allows employees to be
assigned to cover for others during vacations and such without forcing
the system to explicitly remember who used to be assigned where and
then reassigning at the end of the period.

The whole thing is completely transparent outside of the service
layer.  The DAO layer knows absolutely nothing about the authorization
filters and neither does the ui layer (except, of course, where we've
exposed fields you can edit to modify assignments and such).  Even our
service layer was almost entirely unchanged, since all filters and
other auth checks are applied in an AOP interceptor. Basically, we
modified the hibernate mapping docs to add the filters, added
interceptors on the service methods in our spring config, and modified
the schema to add the necessary new tables (no changes were necessary
to the entity tables themelves, but new relations were added).

It took a fair amount of research to get the design right, but actual
implementation was surprisingly easy, especially considering that we
had never explicltly implemented a hibernate filter or an AOP
interceptor prior to implementing the row level auth mechanism.  Once
we got the db config dialed in, it on

Re: Page initialization

2007-02-28 Thread Andrea Chiumenti

Ok, thank you,
I'll test what you said, maybe my brain was a bit messed up with the edit
table I've implemented.

p.s. The JFlyEditTable for Tap 4.1.x are nearly ready maybe next week they
will be submitted, I think you'll appreciate it.

ciao,
kiuma

On 2/28/07, Sam Gendler <[EMAIL PROTECTED]> wrote:


pageBeginRender is called during both rewind and render.  I don't know
what test you did to make you think it only gets called during rewind.

public void pageBeginRender(PageEvent event) {
if (!event.getRequestCycle().isRewinding()) {
// put render cycle init code here
}
}

I've got code similar to this all over my codebase and I know that it
works exactly as expected.  In fact, my actual pageBeginRender
implementation in my base page implementation looks like the
following:

@InitialValue("ognl:false")
public abstract boolean isOnceInitialized();
public abstract void setOnceInitialized(boolean val);

public final void pageBeginRender(PageEvent event) {
initPage(event);
if (!isOnceInitialized()) {
initOnlyOnce(event);
setOnceInitialized(true);
}
if (getRequestCycle().isRewinding()) {
initForRewind(event);
} else {
initForRender(event);
}
}

// gets called before both rewind and render cycles
public void initPage(PageEvent event) {
}

// guaranteed to be called only once, whether there is a rewind
// cycle or not
public void initOnlyOnce(PageEvent event) {
}

// gets called before rewind cycle
public void initForRewind(PageEvent event) {
}

// gets called before render cycle
public void initForRender(PageEvent event) {
}


On 2/27/07, Andrea Chiumenti <[EMAIL PROTECTED]> wrote:
> Thank you, but I've seen from code that beginPageRender is called only
> during rewind
> so I added a property to the page and did the following:
>
> /**
>  * Reset the grid content if the page is accessed without form
> submission
>  * (refresh or new access), then performs normal renderPage
operations.
>  */
> public void renderPage(ResponseBuilder builder, IRequestCycle cycle)
{
> if (!getFormRewound().booleanValue()) {
> setEditItemCollection(new ArrayList());
> }
> setFormRewound(Boolean.FALSE);
> super.renderPage(builder, cycle);
> }
>
> /**
>  * Called by the framework during rewind. It informs the page the it
>  * has been rewinded when the renderPage method will be called
>  */
> public void beginPageRender() {
> setFormRewound(Boolean.TRUE);
> }
>
> Is there any better way to do this ?
>
> ciao,
> kiuma
>
> On 2/27/07, Sam Gendler <[EMAIL PROTECTED]> wrote:
> >
> > pageBeginRender (implement PageBeginRenderListener interface).  This
> > will be called before rendering both the rewind and render cycle, but
> > you can just put a conditional on cycle.isRewinding() in order to
> > ensure you only re-init the variable during the render cycle.
> >
> > --sam
> >
> >
> > On 2/26/07, Andrea Chiumenti <[EMAIL PROTECTED]> wrote:
> > > What I need is that when I access or refresh the page a parameter
bound
> > to
> > > session must be reset
> > >
> > > On 2/26/07, Andrea Chiumenti <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Hi!,
> > > > where do I have to put page initialization code in tapestry 4.1.1?
> > > > I need that the init method is called only when I render the page,
but
> > not
> > > > when I call a form submit.
> > > >
> > > > Thx,
> > > > kiuma
> > > >
> > >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Role based security

2007-02-28 Thread Borut Bolčina

Hello Jonathan,

I found
http://mail-archives.apache.org/mod_mbox/tapestry-users/200606.mbox/[EMAIL 
PROTECTED]

I will have to study the code, as my T4 mileage is short. You don't happen
to have a component library set up with some examples would you?

Thanks,
Borut


2007/2/27, Jonathan Barker <[EMAIL PROTECTED]>:


Mark,

Do a Google search using the search string:

site:http://mail-archives.apache.org/mod_mbox "Jonathan Barker"

I posted some information and code in June 2006 about creating @Authorize
and @AclAuthorize based on the code for the tapestry @If component, and
the
Authorize and AclAuthorize JSP taglibs.

I've had this in production since last May and it's been working
beautifully.

Jonathan