/*
If onAfterRendering of a field is processed the Form (layout) might need to change it.
430177
function _fieldOnAfterRendering(oEvent){

		// call function of parent (if assigned)
		var oParent = this.oElement.getParent();
		if (oParent && oParent.contentOnAfterRendering) {
			oParent.contentOnAfterRendering( this.oElement, oEvent.srcControl);
		}

	}
968551
function (evt) {
            this._move(evt.src);
            this._initialDrag = null;
            this._initialSavedX = null;
            if (this._oldValue[0] !== this.value[0] || this._oldValue[1] !== this.value[1]) {
                if (this._cfg.onchange) {
                    this._context.evalCallback(this._cfg.onchange);
                }
            }
        }
1183098
function() {
        if (this.textarea.element.form) {
          var hiddenField = document.createElement("input");
          hiddenField.type   = "hidden";
          hiddenField.name   = "_wysihtml5_mode";
          hiddenField.value  = 1;
          dom.insert(hiddenField).after(this.textarea.element);
        }
    }
1054823
protected function _prepareRendering()
    {
        $this->view->addDefaultViewParam('_template', $this);

        $structure = $this->getPageStructure();
        if (empty($structure)) {
            $this->setPageStructure(self::$default_page_structure);
        }
    }
842703
private void processFields() throws CoreException {

        final Class<?> currentClass = this.getClass();

        // Parse view properties
        for (final Field f : currentClass.getDeclaredFields()) {

            // Only Node and Animation properties are eligible
            if (Node.class.isAssignableFrom(f.getType()) || Animation.class.isAssignableFrom(f.getType())) {

                // If a property was private, it must set to accessible = false after processing action
                boolean needToHide = false;
                // For private properties, set them accessible temporary
                if (!f.isAccessible()) {
                    f.setAccessible(true);
                    needToHide = true;
                }

                // Process all existing annotation for the current field
                processAnnotations(f);

                // Reset the property visibility
                if (needToHide && f.isAccessible()) {
                    f.setAccessible(false);
                }
            }
        }
    }
90268
function handleLayout(layoutObj) {
      view.currentLayout = layoutObj.layout;
      self.handle('onLayout', view);
      delete view.currentLayout;
    }
653357
protected void postLayoutChild(final int dataIndex) {
        if (!mContainer.isDynamic()) {
            boolean visibleInLayout = !mViewPort.isClippingEnabled() || inViewPort(dataIndex);
            ViewPortVisibility visibility = visibleInLayout ?
                    ViewPortVisibility.FULLY_VISIBLE : ViewPortVisibility.INVISIBLE;
            Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "onLayout: child with dataId [%d] viewportVisibility = %s",
                    dataIndex, visibility);

            Widget childWidget = mContainer.get(dataIndex);
            if (childWidget != null) {
                childWidget.setViewPortVisibility(visibility);
            }
        }
    }
971522
function(view) {
    if (view.options.layoutApplied) {
      return view;
    }

    // handle pre-layout middleware
    this.handle('preLayout', view);

    var opts = {};
    lazy.extend(opts, this.options);
    lazy.extend(opts, view.options);
    lazy.extend(opts, view.context());

    // get the layout stack
    var stack = {};
    var alias = this.viewTypes.layout;
    var len = alias.length, i = 0;

    while (len--) {
      var views = this.views[alias[i++]];
      for (var key in views) {
        var val = views[key];
        if (views.hasOwnProperty(key) && typeof val !== 'function' && val.path) {
          stack[key] = val;
        }
      }
    }

    // get the name of the first layout
    var name = view.layout;
    var str = view.content;
    var self = this;

    if (!name) return view;

    // Handle each layout before it's applied to a view
    function handleLayout(layoutObj) {
      view.currentLayout = layoutObj.layout;
      self.handle('onLayout', view);
      delete view.currentLayout;
    }

    // actually apply the layout
    var res = lazy.layouts(str, name, stack, opts, handleLayout);

    view.option('layoutStack', res.history);
    view.option('layoutApplied', true);
    view.content = res.result;

    // handle post-layout middleware
    this.handle('postLayout', view);
    return view;
  }
383597
protected void valueChanged()
	{
		String newValue = fViewer.getDocument().get();
		if (!newValue.equals(fOldValue))
		{
			fOldValue = newValue;

		}
		refreshValidState();
	}
491794
public function onRemoveFromParentRenderable()
    {
        try {
            $rootForm = $this->getRootForm();
            $rootForm->unregisterRenderable($this);
        } catch (FormDefinitionConsistencyException $exception) {
        }
        $this->parentRenderable = null;
    }
449996
private void removeExistingTable(VerticalLayout layout) {

        List<Component> tobeRemoved = new ArrayList<Component>();
        Iterator<Component> it = layout.iterator();
        while (it.hasNext()) {
            Component comp = it.next();
            if ((comp instanceof FixedHeightPanel) | (comp instanceof TextField) | (comp instanceof VerticalLayout)) {
                tobeRemoved.add(comp);
            }
        }
        for (Component c : tobeRemoved) {
            layout.removeComponent(c);
        }
    }
789012
function() {
		var me = this;

		if (core_plugins.notify(me, 'beforeLayout') === false) {
			return;
		}

		core_layouts.update(this, this.width, this.height);

		/**
		 * Provided for backward compatibility, use `afterLayout` instead.
		 * @method IPlugin#afterScaleUpdate
		 * @deprecated since version 2.5.0
		 * @todo remove at version 3
		 * @private
		 */
		core_plugins.notify(me, 'afterScaleUpdate');
		core_plugins.notify(me, 'afterLayout');
	}
53223
protected function beforeRenderFormType()
    {
        $controller = $this->_controller();

        $controller->set('formEnableDirtyCheck', $this->_getFormEnableDirtyCheck());
        $controller->set('formSubmitButtonText', $this->_getFormSubmitButtonText());
        $controller->set('formSubmitExtraButtons', $this->_getFormSubmitExtraButtons());
        $controller->set('formSubmitExtraLeftButtons', $this->_getFormSubmitExtraLeftButtons());
        $controller->set('formUrl', $this->_getFormUrl());
    }
522648
void initializeFormRenderer(Form form) {
    getChildren().clear();
    preferencesFormRenderer = new PreferencesFxFormRenderer(form);
    getChildren().add(preferencesFormRenderer);
  }
1094746
function(){

    if (this.isClosed){
      // a previously closed layout means we need to 
      // completely re-initialize the regions
      this._initializeRegions();
    }
    if (this._firstRender) {
      // if this is the first render, don't do anything to
      // reset the regions
      this._firstRender = false;
    } else if (!this.isClosed){
      // If this is not the first render call, then we need to 
      // re-initializing the `el` for each region
      this._reInitializeRegions();
    }

    var args = Array.prototype.slice.apply(arguments);
    var result = Marionette.ItemView.prototype.render.apply(this, args);

    return result;
  }
1276758
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    if (isInEditMode())
      super.onLayout(changed, left, top, right, bottom);
    else if (isDragViewAtTop()) {
      dragView.layout(left, top, right, transformer.getOriginalHeight());
      secondView.layout(left, transformer.getOriginalHeight(), right, bottom);
      ViewHelper.setY(dragView, top);
      ViewHelper.setY(secondView, transformer.getOriginalHeight());
    } else {
      secondView.layout(left, transformer.getOriginalHeight(), right, bottom);
    }
  }
71070
void afterHtmlUpdate() {

        if (m_overlayTimer != null) {
            m_overlayTimer.cancel();
            m_overlayTimer = null;
        }
        m_runningUpdate = false;
        List<Element> elements = CmsEntityBackend.getInstance().getAttributeElements(
            m_parentEntity,
            m_attributeHandler.getAttributeName(),
            m_formParent.getElement());
        if (m_popupClosed) {
            // the form popup has already been closed, reinitialize the editing widgets for updated HTML
            CmsInlineEditOverlay.updateCurrentOverlayPosition();
            if (m_requireShowPopup) {
                if (elements.size() > m_attributeIndex) {
                    m_referenceElement = elements.get(m_attributeIndex);
                }
                showEditPopup(null);
                m_hasChanges = true;
            } else {
                CmsInlineEditOverlay.getRootOverlay().clearButtonPanel();
                m_htmlUpdateHandler.reinitWidgets(m_formParent);
            }

        } else {
            if (m_referenceElement != null) {
                CmsInlineEditOverlay.removeLastOverlay();
            }
            if (elements.size() > m_attributeIndex) {
                m_referenceElement = elements.get(m_attributeIndex);
                CmsInlineEditOverlay.addOverlayForElement(m_referenceElement);
            } else {
                m_referenceElement = m_formParent.getElement();
                CmsInlineEditOverlay.addOverlayForElement(m_referenceElement);
            }
        }
        // schedule to update the ovelay position
        m_overlayTimer = new Timer() {

            /** Timer run counter. */
            private int m_timerRuns;

            /**
             * @see com.google.gwt.user.client.Timer#run()
             */
            @Override
            public void run() {

                CmsInlineEditOverlay.updateCurrentOverlayPosition();
                if (m_timerRuns > 3) {
                    cancel();
                }
                m_timerRuns++;
            }
        };
        m_overlayTimer.scheduleRepeating(100);
    }