Re: Disable displaying contents of WOComponent
Re: Disable displaying contents of WOComponent
- Subject: Re: Disable displaying contents of WOComponent
- From: Don Lindsay <email@hidden>
- Date: Thu, 26 Jun 2008 18:52:39 -0400
Hello;
I show and hide, as well as enable and disable components within my
applications. Using the conditional in #2 works flawlessly for
showing/hiding components the user should not have access to view.
As suggested, if you do not like seeing the conditionals in your code,
create your own component and wrap the WO... component you want in a
conditional, then expose a property to set the visibility of the
conditional.
Don
On Jun 26, 2008, at 5:40 PM, Lachlan Deck wrote:
On 27/06/2008, at 12:38 AM, Freddie Tilley wrote:
((WOComponentReference)el)._contentElement = null;
You're toying with private data. So you should expect strange
behaviour unless you reinstate the component behaviour via similar
custom code.
You've got a couple of options:
1)
public class AccessibleComponent extends ...
{
public void appendToResponse( WOResponse response, WOContext
context )
{
if ( canViewComponent() )
super.appendToResponse( response, context );
else
pageWithName
( ERXEmptyComponent.class.getName() ).appendToResponse( response,
context );
}
}
2) as Thomas suggested
YourComponent.html
<wo:WOConditional condition = "$canViewComponent">
...
</wo:WOConditional>
with regards,
--
Lachlan Deck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@mac.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden