Gets the highest level parent of this container.

@param container
Container to get parent for.
@return Highest level parent (or this container if it has no parent).
166074
public static EntityContainer getRootContainer(final EntityContainer container) {
	Objects.requireNonNull(container);

	if (container instanceof Entity) {
	    final EntityContainer parent = ((Entity) container).getContainer();
	    if (parent != null) {
		return getRootContainer(parent);
	    }
	}
	return container;
    }
1037578
@Override
    public Dimension maximumLayoutSize(Container parent) {
        return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
    }
73901
private ExoContainer getContainer() throws ResourceException
   {
      ExoContainer container = ExoContainerContext.getCurrentContainer();
      if (container instanceof RootContainer)
      {
         String portalContainerName =
            portalContainer == null ? PortalContainer.DEFAULT_PORTAL_CONTAINER_NAME : portalContainer;
         container = RootContainer.getInstance().getPortalContainer(portalContainerName);
         if (container == null)
         {
            throw new ResourceException("The eXo container is null, because the current container is a RootContainer "
               + "and there is no PortalContainer with the name '" + portalContainerName + "'.");
         }
      }
      else if (container == null)
      {
         throw new ResourceException("The eXo container is null, because the current container is null.");
      }
      return container;
   }
1232468
@SuppressWarnings("unchecked")
    @Override
    public Layer moveUp()
    {
        final Node<?> parent = getParent();

        if (null != parent)
        {
            final IContainer<?, Layer> container = (IContainer<?, Layer>) parent.asContainer();

            if (null != container)
            {
                container.moveUp(this);
            }
        }
        return this;
    }
1262339
public function getContainer()
    {
        if (property_exists(__CLASS__, 'container')) {
            return $this->container;
        } else {
            return parent::getContainer();
        }

        throw new RuntimeException(sprintf('The service container must be accessible from class %s to use this trait', __CLASS__));
    }
198766
@Override
	public void layoutContainer(Container parent) {
		synchronized (parent.getTreeLock()) {
			Insets insets=parent.getInsets();
			int ncomponents=parent.getComponentCount();
			if(ncomponents==0) return;

			int nrows=rows;
			int ncols=columns;
			if(nrows>0) {
				ncols=((ncomponents/2)+nrows-1)/nrows;
			} else {
				nrows=((ncomponents/2)+ncols-1)/ncols;
			}

			// Determine the desired widths for the labels
			int[] labelWidths=new int[ncols];
			int pos=0;
		Loop1:
			for(int y=0;y<nrows;y++) {
				for(int x=0;x<ncols;x++) {
					if(pos>=ncomponents) break Loop1;
					Component component=parent.getComponent(pos);
					pos+=2;
					Dimension d=component.getPreferredSize();
					if(d.width>labelWidths[x]) labelWidths[x]=d.width;
				}
			}
			Dimension parentSize=parent.getSize();
			int width=parentSize.width-(insets.left+insets.right);
			int height=parentSize.height-(insets.top+insets.bottom);
			int lasty=0;
			pos=0;
		Loop:
			for(int y=0;y<nrows;y++) {
				int yend=0;
				int cellHeight=0;
				if (stretchComponents) {
					yend=((y+1)*(height+vgap))/nrows-vgap;
					cellHeight=yend-lasty;
				}
				int lastx=0;
				for(int x=0;x<ncols;x++) {
					if(pos>=ncomponents) break Loop;
					int xend=((x+1)*(width+hgap))/ncols-hgap;
					int cellWidth=xend-lastx;
					// Split this width into two areas, left for label and right for component
					int availableWidth=labelWidths[x];
					if(availableWidth>cellWidth) availableWidth=cellWidth;
					// Reshape the label to fit
					Component label=parent.getComponent(pos++);
					Dimension labelD=label.getPreferredSize();
					Component component=parent.getComponent(pos++);
					Dimension componentD=component.getPreferredSize();
					if (!stretchComponents) {
						cellHeight = Math.max(labelD.height, componentD.height);
						if((lasty+cellHeight)>yend) yend=lasty+cellHeight;
						// yend = lasty+cellHeight;
					}

					//int actualWidth=labelD.width;
					//if(actualWidth>availableWidth) actualWidth=availableWidth;
					label.setBounds(
						lastx+insets.left,
						lasty+insets.top,
						availableWidth,
						cellHeight
					);
					// Split out the right area
					if(pos>ncomponents) break Loop;
					availableWidth=cellWidth-cgap-labelWidths[x];
					if(availableWidth<0) availableWidth=0;
					// Reshape the component
					int actualWidth=componentD.width;
					if(actualWidth>availableWidth) actualWidth=availableWidth;
					component.setBounds(
						lastx+labelWidths[x]+cgap+insets.left,
						lasty+insets.top,
						actualWidth,
						cellHeight /*Klay--8/22/01*/
					);
					// Get ready for next iteration
					lastx=xend+hgap;
				}
				lasty=yend+vgap;
			}
		}
	}
25187
public Tree<T> findPreOrderNext(){
        if( hasChildren() ){
            return getFirstChild();
        }
        if( hasNext() ){
            return getNext();
        }
        Tree<T> parent = getParent();
        while( parent != null ){
            if( parent.hasNext() ){
                return parent.getNext();
            }
            parent = parent.getParent();
        }
        return null;
    }
818051
public function get(Container $container)
    {
        if ($this->singleton) {
            if ($this->instance === null) {
                $f = $this->factory;
                $this->instance = $f($container);
            }
            return $this->instance;
        } else {
            $f = $this->factory;
            return $f($container);
        }
    }
552944
@Override
    public Node getParentNode(String parentNodeId)
    {
        NodeLink link = new NodeLink(parentNodeId, getNodeId());

        if (this.parents == null)
        {
            return null;
        }
        else
        {
            return this.parents.get(link);
        }
    }
889658
public String getContainerClientId(FacesContext context) {
        if (this.isPrependId()) {
            return super.getContainerClientId(context);
        } else {
            UIComponent parent = this.getParent();
            while (parent != null) {
                if (parent instanceof NamingContainer) {
                    return parent.getContainerClientId(context);
                }
                parent = parent.getParent();
            }
        }
        return null;
    }
626801
protected EObject getContainerInRule(EObject root, EObject content) {
		EObject container = content;
		do {
			final EClassifier classifier = getGeneratedTypeFor(container);
			if (classifier != null) {
				return container;
			}
			container = container.eContainer();
		} while (container != root);
		final EClassifier classifier = getGeneratedTypeFor(root);
		if (classifier != null) {
			return root;
		}
		return null;
	}
299441
protected ComponentContainer createContainer(@Nullable ComponentContainer parent) {
    if (parent == null) {
      return new ComponentContainer();
    }
    return parent.createChild();
  }
603709
public static Scriptable getTopLevelScope(Scriptable obj)
    {
        for (;;) {
            Scriptable parent = obj.getParentScope();
            if (parent == null) {
                return obj;
            }
            obj = parent;
        }
    }
1288840
public Map<String, CmsContainerBean> getParentContainers() {

        if (m_parentContainers == null) {
            initPageData();
        }
        return Collections.unmodifiableMap(m_parentContainers);
    }
790584
public static function getInstance(Container $container = null)
    {
        if (null === self::$instance) {
            self::$instance = new Core($container);
        }
        return self::$instance;
    }
127651
public function topParent()
    {
        $topParent = $this->parent();

        if (!$topParent) {
            return null;
        }

        while (true) {
            $theParent = $topParent->parent();
            if ($theParent !== null && $theParent->parent() !== null) {
                $topParent = $theParent;
            } else {
                break;
            }
        }

        return $topParent;
    }
370437
public TrieNode getParent() {
    if (0 == index) return null;
    if (null == parent && -1 == depth) {
      synchronized (this) {
        if (null == parent) {
          parent = newNode(trie.parentIndex[index]);
          assert (parent.index < index);
        }
      }
    }
    return parent;
  }