• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Disable displaying contents of WOComponent
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disable displaying contents of WOComponent


  • Subject: Re: Disable displaying contents of WOComponent
  • From: Freddie Tilley <email@hidden>
  • Date: Thu, 26 Jun 2008 16:38:22 +0200

I'm currently testing with this code, but the problem is once the elements have been removed, they
do not return until I restart the webobjects app.


There must be some easier way of doing this

Freddie Tilley


Hello, I'm trying to build a permission system that will disable the contents of the entire component.
I guess normally I should override appendToResponse and disable the writing of the component contents
there. But the problem is if I have a wrapper in the component I still want to show the wrapper contents


so the wrapper will show everything apart from the <wo:WOComponentContent />

The way I do it now is override the components template() method and disable the elements that
should not be visible. My question is, is this the correct way of doing it, and if so, are
there any hidden problems with doing it this way. The template override code is this:


public WOElement template() {
WOElement tmpl = super.template();

if (!canViewComponent())
{
NSMutableArray<WOElement> children = ((WODynamicGroup)tmpl).childrenElements();
NSMutableArray<WOElement> removeElements = new NSMutableArray<WOElement>();

for (WOElement el : children) {
if (el instanceof WOComponentReference) {
WODynamicGroup dg = (WODynamicGroup) ((WOComponentReference)el)._contentElement;
NSArray<WOElement> childrenElements = dg.childrenElements();


					if (childrenElements != null) {
						/* this element is the wrapper, only disable the
						 * content elements
						 */
						((WOComponentReference)el)._contentElement = null;
					} else {
						removeElements.add(el);
					}
				} else {
					removeElements.add(el);
				}
			}

			children.removeObjectsInArray(removeElements);
		}

		return tmpl;
	}

Freddie Tilley
_______________________________________________
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



_______________________________________________ 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

_______________________________________________ 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
  • Follow-Ups:
    • Re: Disable displaying contents of WOComponent
      • From: Lachlan Deck <email@hidden>
References: 
 >Disable displaying contents of WOComponent (From: Freddie Tilley <email@hidden>)
 >Re: Disable displaying contents of WOComponent (From: Thomas <email@hidden>)
 >Re: Disable displaying contents of WOComponent (From: Freddie Tilley <email@hidden>)

  • Prev by Date: Re: Problems deploying app on Leopard server
  • Next by Date: Re: [Annoucement] New WOLips Java Client / Direct To Java Client Tutorial
  • Previous by thread: Re: Disable displaying contents of WOComponent
  • Next by thread: Re: Disable displaying contents of WOComponent
  • Index(es):
    • Date
    • Thread