Apply the current layout, and resolve the name of the next layout to apply.
760362
function resolveLayout(file, layout, options, regex, name) {
  if (typeOf(layout.contents) !== 'buffer') {
    throw new Error('expected layout.contents to be a buffer');
  }

  // reset lastIndex, since regex is cached
  regex.lastIndex = 0;

  const layoutString = toString(layout, options);
  if (!regex.test(layoutString)) {
    throw new Error(`cannot find tag "${regex.source}" in layout "${name}"`);
  }

  const fileString = toString(file, options);
  let str;

  if (options.preserveWhitespace === true) {
    const re = new RegExp('(?:^(\\s+))?' + regex.source, 'gm');
    let lines;

    str = layoutString.replace(re, function(m, whitespace) {
      if (whitespace) {
        lines = lines || fileString.split('\n'); // only split once, JIT
        return lines.map(line => whitespace + line).join('\n');
      }
      return fileString;
    });

  } else {
    str = Buffer.from(layoutString.replace(regex, () => fileString));
  }

  file.contents = Buffer.from(str);
  return getLayoutName(layout, options);
}
1151882
public function apply()
    {
        if ($this->config->hasKey(self::REGISTER)) {
            $registerConfig = $this->config->getSubConfig(self::REGISTER);
            $this->register($registerConfig->getArrayCopy());
        }

        if ($this->config->hasKey(self::UNREGISTER)) {
            $unregisterConfig = $this->config->getSubConfig(self::UNREGISTER);
            $this->unregister($unregisterConfig->getArrayCopy());
        }

        if ($this->config->hasKey(self::DEFAULTLAYOUT)) {
            $this->setDefault($this->config->getKey(self::DEFAULTLAYOUT));
        }
    }
794803
def do_layout(self, *args):
        """"""
        if self.size == [1, 1]:
            return
        for i in range(0, len(self.decks)):
            self.layout_deck(i)
42642
def apply_style(*style_names)
      if style_names
        selected.each do |selected_view|
          style_names.each do |style_name|
            apply_style_to_view selected_view, style_name
          end
        end
      end
      self
    end
1041293
function () {
        var self = this;

        self.parent()._lastRect = null;

        DomUtils.css(self.getEl(), { width: '', height: '' });

        self._layoutRect = self._lastRepaintRect = self._lastLayoutRect = null;
        self.initLayoutRect();
      }
937167
protected function setLayout()
    {
        $layout = $this->request->getAttribute(self::LAYOUT, $this->default_layout);
        if ($layout) {
            $this->view->setLayout($layout);
        }
    }
1318562
def init_layout(self):
        
        super(AndroidListView, self).init_layout()
        d = self.declaration
        w = self.widget

        # Prepare adapter
        adapter = self.adapter = BridgedRecyclerAdapter(w)

        # I'm sure this will make someone upset haha
        adapter.setRecyleListener(adapter.getId())
        adapter.onRecycleView.connect(self.on_recycle_view)
        #adapter.onVisibleCountChanged.connect(self.on_visible_count_changed)
        #adapter.onScrollStateChanged.connect(self.on_scroll_state_changed)
        self.set_items(d.items)
        w.setAdapter(adapter)
        #self.set_selected(d.selected)
        self.refresh_views()
233047
private void reInitLayoutElements() {

        m_panel.clear();
        for (CmsCheckBox cb : m_checkBoxes) {
            m_panel.add(setStyle(m_onlyLabels ? new Label(cb.getText()) : cb));
        }
    }
114611
private void adaptAreaPadding() {
        if (areas != null) {
            boolean paddingTopApplied = false;
            Area previousArea = null;
            View previousView = null;
            int scrollViewPaddingTop = 0;
            int scrollViewMarginBottom = 0;
            Iterator<Map.Entry<Area, View>> iterator = areas.entrySet().iterator();

            while (iterator.hasNext()) {
                Map.Entry<Area, View> entry = iterator.next();
                Area area = entry.getKey();
                View view = entry.getValue();

                applyDialogPaddingLeft(area, view);
                applyDialogPaddingRight(area, view);

                if (!paddingTopApplied) {
                    paddingTopApplied = applyDialogPaddingTop(area, view);
                }

                if (!iterator.hasNext()) {
                    applyDialogPaddingBottom(area, view);
                }

                if (previousArea != null) {
                    if (area == Area.BUTTON_BAR) {
                        applyDialogPaddingBottom(previousArea, previousView);
                    }

                    Pair<Integer, Integer> pair = addViewSpacing(previousArea, previousView, area);
                    scrollViewPaddingTop += pair.first != null ? pair.first : 0;
                    scrollViewMarginBottom += pair.second != null ? pair.second : 0;
                }

                previousArea = area;
                previousView = view;
            }

            if (scrollView != null) {
                LinearLayout.LayoutParams layoutParams =
                        (LayoutParams) scrollView.getLayoutParams();
                layoutParams.bottomMargin = scrollViewMarginBottom;
                scrollView.setPadding(scrollView.getPaddingLeft(),
                        scrollView.getPaddingTop() + scrollViewPaddingTop,
                        scrollView.getPaddingRight(), scrollView.getPaddingBottom());
            }
        }
    }
644715
private void applyParser()
	{
		this.snapshot.clear();
		Map<String, String> originals = new HashMap<String, String>(this.resolvers.size());
		for ( Entry<String, VariableValue> resolver : this.resolvers.entrySet() )
		{
			originals.put(resolver.getKey(), resolver.getValue().getOriginal());
		}
		putAll(originals);
	}
615821
def _add_annots(self, layout, annots):
        
        if annots:
            for annot in resolve1(annots):
                annot = resolve1(annot)
                if annot.get('Rect') is not None:
                    annot['bbox'] = annot.pop('Rect')  # Rename key
                    annot = self._set_hwxy_attrs(annot)
                try:
                    annot['URI'] = resolve1(annot['A'])['URI']
                except KeyError:
                    pass
                for k, v in six.iteritems(annot):
                    if not isinstance(v, six.string_types):
                        annot[k] = obj_to_string(v)
                elem = parser.makeelement('Annot', annot)
                layout.add(elem)
        return layout
315942
protected function setupLayout()
    {
        if (is_null($this->template)) {
            abort(500, 'The layout is not set');
        }

        $this->viewExistsOrFail(
            $this->template,
            "The layout [$this->template] not found"
        );

        $this->layout = view($this->template);
    }
817901
@SuppressLint("WrongCall")
    protected boolean layout() {
        boolean relaidout = false;
        Log.v(Log.SUBSYSTEM.LAYOUT, TAG, "layout(%s): changed: %b, requested: %b", getName(),
                isChanged(), mLayoutRequested);

        if (isChanged() || mLayoutRequested) {
            Log.v(Log.SUBSYSTEM.LAYOUT, TAG, "layout(%s): calling onLayout", getName());
            relaidout = onLayout();
        }

        mLayoutRequested = false;
        mChanged = false;
        return relaidout;
    }
332254
def get_layout(self, name):
        '''
        
        '''
        layout_chain = []

        # Retrieve initial layout file
        try:
            json_data = self.json_files[self.layout_names[name]]
        except KeyError:
            log.error('Could not find layout: %s', name)
            log.error('Layouts path: %s', self.layout_path)
            raise
        layout_chain.append(Layout(name, json_data))

        # Recursively locate parent layout files
        parent = layout_chain[-1].parent()
        while parent is not None:
            # Find the parent
            parent_path = None
            for path in self.json_file_paths:
                if os.path.normcase(os.path.normpath(parent)) in os.path.normcase(path):
                    parent_path = path

            # Make sure a path was found
            if parent_path is None:
                raise UnknownLayoutPathException('Could not find: {}'.format(parent_path))

            # Build layout for parent
            json_data = self.json_files[parent_path]
            layout_chain.append(Layout(parent_path, json_data))

            # Check parent of parent
            parent = layout_chain[-1].parent()

        # Squash layout files
        layout = self.squash_layouts(layout_chain)
        return layout
1052633
public function apply()
    {
        if ($this->canApply()) {
            $nodeName = $this->generateUniqueNodeName($this->getParentNode());
            $node = $this->getSubject()->copyInto($this->getParentNode(), $nodeName);
            $this->finish($node);
        }
    }
1313995
public void setLayout(java.lang.String layout) {
        getStateHelper().put(PropertyKeys.layout, layout);
    }
241200
void setWorkbenchLayout(Layout layout) {
		validateNotNull(layout, "layout");

		if (this.layout == layout) {
			return;
		}

		requestTabIndex = getCurrentRequestTabIndex();

		Layout previousLayout = this.layout;
		this.layout = layout;

		componentMaximiser.unmaximiseComponent();
		removeAll();

		List<AbstractPanel> visiblePanels;
		switch (layout) {
		case FULL:
			visiblePanels = getTabbedStatus().getVisiblePanels();
			getTabbedStatus().hideAllTabs();
			visiblePanels.addAll(getTabbedWork().getVisiblePanels());
			getTabbedWork().hideAllTabs();
			visiblePanels.addAll(getTabbedSelect().getVisiblePanels());
			getTabbedSelect().hideAllTabs();
			getTabbedFull().setVisiblePanels(visiblePanels);
			updateFullLayout();
			this.add(getFullLayoutPanel());
			break;
		case EXPAND_SELECT:
		case EXPAND_STATUS:
		default:
			this.add(layout == Layout.EXPAND_STATUS ? createStatusPanelsSplit() : createSelectPanelsSplit());

			if (previousLayout == Layout.FULL) {
				visiblePanels = getTabbedFull().getVisiblePanels();
				getTabbedFull().hideAllTabs();
				getTabbedStatus().setVisiblePanels(visiblePanels);
				getTabbedWork().setVisiblePanels(visiblePanels);
				getTabbedSelect().setVisiblePanels(visiblePanels);

				setResponsePanelPosition(responsePanelPosition);
			}
			break;
		}

		this.validate();
		this.repaint();
	}