• 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: Thomas <email@hidden>
  • Date: Thu, 26 Jun 2008 20:17:50 +1000

Why not just put a conditional inside the wrapper around the component content? No code is required.

Regards
Thomas

On 26/06/2008, at 7:49 PM, Freddie Tilley wrote:

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

  • Prev by Date: Disable displaying contents of WOComponent
  • Next by Date: Re: move from using EO_PK_TABLE to OpenBase plugin
  • Previous by thread: Disable displaying contents of WOComponent
  • Next by thread: Re: Disable displaying contents of WOComponent
  • Index(es):
    • Date
    • Thread