/*
Helps above method, runs through all components recursively.
326094
protected void setFontSizeHelper(float size, Component... comps) {
        for (Component comp : comps) {
            comp.setFont(comp.getFont().deriveFont(size));
            if (comp instanceof Container) {
                setFontSizeHelper(size, ((Container) comp).getComponents());
            }
        }
    }
879213
function (component) {
    var callbacks = this.callbacks;
    if (component.beforeStep) callbacks.beforeStep.push(component);
    if (component.step)       callbacks.step.push(component);
    if (component.afterStep)  callbacks.afterStep.push(component);
  }
1289125
public void run()
    {
        int iSFieldCount = this.getSFieldCount(); // Keep out of loop because of chance of free() during run()
        for (int iFieldSeq = 0; iFieldSeq < iSFieldCount; iFieldSeq++)
        {   // See if any of my children want to handle this command
            ScreenField sField = this.getSField(iFieldSeq);
            if (sField instanceof BasePanel)    // Run every basepanel
            {
                ((BasePanel)sField).run();
            }
        }
    }
665094
function(iterator, context) {
            if (context != null) iterator = _.bind(iterator, context);
            _.each(this.components, function(value, cid) {
                if (_.isArray(value)) {
                    _.each(value, iterator);
                } else {
                    iterator(value);
                }
            });
            return this;
        }
1221349
private void updateComponents(Collection<ComponentContext<?>> components, final CountingCompletionHandler<Void> complete) {
    for (final ComponentContext<?> component : components) {
      final CountingCompletionHandler<Void> counter = new CountingCompletionHandler<Void>(component.instances().size());
      counter.setHandler(new Handler<AsyncResult<Void>>() {
        @Override
        public void handle(AsyncResult<Void> result) {
          if (result.failed()) {
            complete.fail(result.cause());
          } else {
            complete.succeed();
          }
        }
      });
      updateInstances(component.instances(), counter);
    }
  }
967702
public function recursiveRender()
    {
        foreach ($this->elements as $view) {
            if (!$view instanceof self) {
                continue;
            }

            $this->template->appendHTML($view->region, $view->getHTML());

            if ($view->_js_actions) {
                $this->_js_actions = array_merge_recursive($this->_js_actions, $view->_js_actions);
            }
        }

        if (isset($this->content) && $this->content !== false) {
            $this->template->append('Content', $this->content);
        }
    }
744172
@Override
	public List<Component> findComponentChildren( String applicationName, String componentName ) {

		if( componentName == null )
			this.logger.fine( "Request: list root components in " + applicationName + "." );
		else
			this.logger.fine( "Request: find components that can be deployed under a " + componentName + " component in " + applicationName + "." );

		List<Component> result = new ArrayList<> ();
		Application app = this.manager.applicationMngr().findApplicationByName( applicationName );
		if( app != null ) {
			Component comp;
			if( componentName == null )
				result.addAll( app.getTemplate().getGraphs().getRootComponents());
			else if(( comp = ComponentHelpers.findComponent( app, componentName )) != null )
				result.addAll( ComponentHelpers.findAllChildren( comp ));
			else
				this.logger.fine( "No component called " + componentName + " was found in " + applicationName + "." );
		}

		return result;
	}
59374
function () {
        // Iterate children_resources
        _.each(this.children_resources, (resource, resourceName) => {
          // Iterate object json data
          _.each(this._json, (object, key) => {
            // If children_resource and object different, next
            if (resourceName !== key) {
              return
            }

            if (object instanceof Array) {
              /*
             * Iterate array object to extend from
             * target Conekta resource and overwrite attribute
             */
              const childrenObjects = []
              _.each(object, (elem) => {
                const resourceInstance = _.extend({}, Conekta[resource])
                childrenObjects.push(
                  _.extend(resourceInstance, {
                    _json: elem,
                    _id: elem.id
                  })
                )
              })

              /* overwrite property */
              this[key] = childrenObjects
            } else if (object) {
              /* overwrite property */
              this[key] = _.extend(Conekta[resource], {
                _json: object,
                _id: object.id
              })
            }
          })
        })
      }
352410
function processChildren( &$textElements,
                              &$children, $key, &$item, &$index, &$isFirstRun,
                              &$delimiterStructure, &$sequenceStructure, &$filterStructure,
                              $tpl, $rootNamespace, $name, $functionPlacement,
                              &$variableIterator, $noLastValue,
                              &$iteratorData )
    {
        if ( $variableIterator !== null )
        {
            unset( $last );
            if ( !$noLastValue and $iteratorData['iterator'] !== false )
            {
                $last =& $iteratorData['iterator'];
            }
            else
            {
                $last = false;
            }
            unset( $iteratorData['iterator'] );
            $iteratorData['iterator'] = new eZTemplateSectionIterator();
            $iteratorData['iterator']->setIteratorValues( $item, $key, $index, $index + 1, false, $last );
            unset( $last );

            $iteratorObject =& $iteratorData['iterator'];
            $tpl->setVariable( $variableIterator, $iteratorObject, $name );
        }
        else
        {
            $tpl->setVariable( "key", $key, $name );
            $tpl->setVariable( "item", $item, $name );
            $tpl->setVariable( "index", $index, $name );
            $tpl->setVariable( "number", $index + 1, $name );
        }
        if ( count( $filterStructure ) > 0 )
        {
            $filterCount = count( $filterStructure );
            $includeElement = true;
            for ( $i = 0; $i < $filterCount; ++$i )
            {
                $filterElement =& $filterStructure[$i];
                $filterParameters =& $filterElement[3];
                $filterName = $filterElement[2];
                $filterMatch = null;
                if ( isset( $filterParameters["match"] ) )
                {
                    $filterMatch = $tpl->elementValue( $filterParameters["match"], $rootNamespace, $name, $functionPlacement );
                    if ( $filterMatch )
                        $includeElement = $filterName == "section-exclude" ? false : true;
                }
                else
                    $tpl->missingParameter( "section:$filterName", "match" );
            }
            if ( !$includeElement )
                return false;
        }
        if ( $delimiterStructure !== null and !$isFirstRun )
        {
            $delimiterParameters = $delimiterStructure[3];
            $delimiterMatch = true;
            if ( isset( $delimiterParameters["modulo"] ) )
            {
                $delimiterModulo = $delimiterParameters["modulo"];
                $modulo = $tpl->elementValue( $delimiterModulo, $rootNamespace, $name, $functionPlacement );
                $modulo = trim( $modulo );
                if ( is_numeric( $modulo ) )
                    $delimiterMatch = ( $index % $modulo ) == 0;
            }
            if ( isset( $delimiterParameters["match"] ) )
            {
                $delimiterMatchParameter = $delimiterParameters["match"];
                $delimiterMatch = $tpl->elementValue( $delimiterMatchParameter, $rootNamespace, $name, $functionPlacement );
            }
            if ( $delimiterMatch )
            {
                $delimiterChildren =& $delimiterStructure[1];
                if ( is_array( $delimiterChildren ) )
                {
                    foreach ( array_keys( $delimiterChildren ) as $delimiterChildKey )
                    {
                        $delimiterChild =& $delimiterChildren[$delimiterChildKey];
                        $tpl->processNode( $delimiterChild, $textElements, $rootNamespace, $name );
                    }
                }
            }
        }
        $isFirstRun = false;
        if ( $sequenceStructure !== null and is_array( $sequenceStructure ) )
        {
            $sequenceValue = array_shift( $sequenceStructure );
            if ( $variableIterator !== null )
            {
                $iteratorData['iterator']->setSequence( $sequenceValue );
            }
            else
            {
                $tpl->setVariable( "sequence", $sequenceValue, $name );
            }
            $sequenceStructure[] = $sequenceValue;
        }
        foreach ( array_keys( $children ) as $childKey )
        {
            $child =& $children[$childKey];
            $tpl->processNode( $child, $textElements, $rootNamespace, $name );
        }
        ++$index;
        return true;
    }
429745
private void restoreDescendantComponentWithoutRestoreState(UIComponent parent, boolean iterateFacets,
                                                               boolean restoreChildFacets) {
        if (iterateFacets && parent.getFacetCount() > 0) {
            Iterator<UIComponent> childIterator = parent.getFacets().values().iterator();

            while (childIterator.hasNext()) {
                UIComponent component = childIterator.next();

                // reset the client id (see spec 3.1.6)
                component.setId(component.getId());
                if (!component.isTransient()) {
                    restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true);
                }
            }
        }

        if (parent.getChildCount() > 0) {
            for (int i = 0; i < parent.getChildCount(); i++) {
                UIComponent component = parent.getChildren().get(i);

                // reset the client id (see spec 3.1.6)
                component.setId(component.getId());
                if (!component.isTransient()) {
                    restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true);
                }
            }
        }
    }
571587
protected static void removeChildAndPrevious( JComponent root , JComponent target ) {
		int N = root.getComponentCount();

		for (int i = 0; i < N; i++) {
			if( root.getComponent(i) == target ) {
				root.remove(i);
				root.remove(i-1);
				return;
			}
		}
		throw new RuntimeException("Can't find component");
	}
823449
function()
    {
        if (this._savedChildren)
            return;

        this._savedSelfTime = this.selfTime;
        this._savedTotalTime = this.totalTime;
        this._savedNumberOfCalls = this.numberOfCalls;

        this._savedChildren = this.children.slice();
    }
246090
function(component, components) {
        var deps, depsName, depsConfig;
        if (Type.assert(Type.STRING, component.name)) {
            deps = this.getDependency(component.name);
            if (Type.isArray(deps)) {
                while (true) {
                    depsName = deps.shift();
                    if (!depsName) {
                        break;
                    }
                    if (!this.has(depsName)) {
                        if (!!components) {
                            depsConfig = this.find(depsName, components);
                            if (depsConfig) {
                                this.set(depsName, depsConfig);
                                break;
                            }
                        }
                        this.set(depsName, {});
                    }
                }
            }
        }
    }
1047959
public final void running () {
		Status previousStatus = status;
		status = Status.RUNNING;
		if (tree.listeners != null && tree.listeners.size > 0) tree.notifyStatusUpdated(this, previousStatus);
		if (control != null) control.childRunning(this, this);
	}
53235
@Override
  public void apply(TreeVisitor tp) {
    for (int i = 0, size = parseTrees.size(); i < size; i++) {
      tp.visitTree(parseTrees.get(i));
    }
    // or could do as Iterator but slower
    // Iterator iter = parseTrees.iterator();
    // while (iter.hasNext()) {
    //    tp.visitTree((Tree) iter.next());
    // }
  }
1110170
function (nodes, i, container, _parent, counter) {
	var node = nodes[i].clone();

	nodes[i].clear();

	return function (others) {
		var local_promises = [];
		if (node.children.length) {
			transclude(others, node.children);
		}

		node.children    = others;
		node.is_resolved = true;

		collect_components([node], container, local_promises, _parent, counter);

		return $q.all(local_promises).then(function () {
			nodes[i] = node;
		});
	};
}
39654
@Override
    public void manipulateChildElements(List<HierarchyWrapper> children) {
        if (!children.isEmpty()) {
            builder.append(baseIndent).append("children=").append("\n");
        }
    }