Applies CoSE layout to the given SBGN PD model.

@param sbgn model where layout is performed and stored
@param doLayout whether to actually run the CoSE or just complete the SBGN model
11067
public void createLayout(final Sbgn sbgn, boolean doLayout)
    {
        viewToLayout = new HashMap();
        glyphToVNode = new HashMap();
        idToGLyph = new HashMap();
        idToCompartmentGlyphs = new HashMap();
        portIDToOwnerGlyph = new HashMap();
        layoutToView = new HashMap();
        idToArcs = new HashMap<String, Arc>();

        this.layout = new SbgnPDLayout();
        final LGraphManager graphMgr = layout.getGraphManager();
        graphMgr.addRoot();

        root = new VCompound(new Glyph());

        // Detect compartment glyphs and put them in a hashmap;
        // also set compartment glyphs of members of complexes.
        for (Glyph g: sbgn.getMap().getGlyph())
        {
            if(glyphClazzOneOf(g, GlyphClazz.COMPARTMENT)) {
                idToCompartmentGlyphs.put(g.getId(), g);
            }
            //Set compartmentRef to all children of a Complex node.
            Glyph compartment = (Glyph)g.getCompartmentRef();
            if(compartment != null && glyphClazzOneOf(g, GlyphClazz.COMPLEX)) {
                setCompartmentRefForComplexMembers(g, compartment, new HashSet<Glyph>());
            }
        }

        // Nest glyphs inside compartment glyphs according to their compartmentRef.
        // This list holds the glyphs that will be deleted after corresponding glyph
        // is added to child glyph of another glyph.
        if(!idToCompartmentGlyphs.isEmpty()) {
            List<Glyph> deletedList = new ArrayList<Glyph>();
            for (Glyph g : sbgn.getMap().getGlyph()) {
                Glyph containerCompartment = (Glyph) g.getCompartmentRef();
                if (containerCompartment != null) {
                    idToCompartmentGlyphs.get(containerCompartment.getId()).getGlyph().add(g);
                    deletedList.add(g);
                }
            }
            // Delete the duplicate glyphs, after they are moved to corresponding compartment glyph.
            for (Glyph g : deletedList) {
                sbgn.getMap().getGlyph().remove(g);
            }
        }

        // initialize the map for keeping ports and their owner glyphs
        // with entries like: <portID, ownerGlyph>
        initPortIdToGlyphMap(sbgn.getMap().getGlyph());

        //Remove ports from source and target field of ports
        //replace them with owner glyphs of these ports
        removePortsFromArcs(sbgn.getMap().getArc());

        // Assign logical operator and Process nodes to compartment
        assignProcessAndLogicOpNodesToCompartment(sbgn);

        // Create Vnodes for ChiLay layout component
        createVNodes(root, sbgn.getMap().getGlyph());

        for (VNode vNode: root.children) {
            createLNode(vNode, null);
        }

        // Create LEdges for ChiLay layout component
        createLEdges(sbgn.getMap().getArc());

        // Apply layout
        if(doLayout) {
            layout.runLayout();
        }

        graphMgr.updateBounds();

        // Here if any SbgnProcessNode node is returned from SBGNPD Layout
        // this means that we will have two additional port info. We should
        // add this information to libSbgn objects
        for (Object lNode : layout.getAllNodes()) {
            if (lNode instanceof SbgnProcessNode) {
                //Set geometry of corresponding node
                VNode vNode = layoutToView.get(((SbgnProcessNode) lNode).label);
                Bbox tempBbox = vNode.glyph.getBbox();
                tempBbox.setX((float) (((SbgnProcessNode) lNode).getLeft()));
                tempBbox.setY((float) (((SbgnProcessNode) lNode).getTop()));
                vNode.glyph.setBbox(tempBbox);

                //Created port objects in layout level
                SbgnPDNode inputLPort = ((SbgnProcessNode) lNode).getInputPort();
                SbgnPDNode outputLPort = ((SbgnProcessNode) lNode).getOutputPort();

                // New port objects
                Port inputPort = new Port();
                Port outputPort = new Port();

                // Set port attributes
                inputPort.setX((float) (inputLPort.getCenterX()));
                inputPort.setY((float) (inputLPort.getCenterY()));
                inputPort.setId(inputLPort.label);

                outputPort.setX((float) (outputLPort.getCenterX()));
                outputPort.setY((float) (outputLPort.getCenterY()));
                outputPort.setId((outputLPort.label));

                //Clear existing ports !
                vNode.glyph.getPort().clear();
                //Connect existing arcs to newly created ports
                //These ports are created by ChiLay and SBGNPD Layout
                connectArcToPort(inputLPort, inputPort);
                connectArcToPort(outputLPort, outputPort);

                //Add ports to the corresponding glyph
                vNode.glyph.getPort().add(inputPort);
                vNode.glyph.getPort().add(outputPort);
            }
        }

        // Update the bounds
        for (VNode vNode: root.children) {
            updateCompoundBounds(vNode.glyph, vNode.glyph.getGlyph());
        }

        // Clear inside of the compartmentGlyphs
        for (Glyph compGlyph: idToCompartmentGlyphs.values()) {
            //Again add the members of compartments
            for(Glyph memberGlyph: compGlyph.getGlyph() ) {
                sbgn.getMap().getGlyph().add(memberGlyph);
            }
            compGlyph.getGlyph().clear();
        }
    }
1109690
public void setSDef(String sDefPID) throws IOException {
        removeAll();
        if (sDefPID != null) {
            JPanel lp = m_loadedPanels.get(sDefPID);
            if (lp == null) {
                lp = makePanel(sDefPID);
                m_loadedPanels.put(sDefPID, lp);
            }
            add(lp, BorderLayout.CENTER);
        }
        if (m_containerToValidate != null) {
            m_containerToValidate.revalidate();
            m_containerToValidate.repaint(new Rectangle(m_containerToValidate
                    .getSize()));
        }
    }
90268
function handleLayout(layoutObj) {
      view.currentLayout = layoutObj.layout;
      self.handle('onLayout', view);
      delete view.currentLayout;
    }
754739
private void processNullLayouts(String className, String methodName) {
        if ("java/awt/Container".equals(className) && "setLayout".equals(methodName) && (stack.getStackDepth() > 0) && stack.getStackItem(0).isNull()) {
            bugReporter.reportBug(new BugInstance(this, BugType.S508C_NULL_LAYOUT.name(), NORMAL_PRIORITY).addClass(this).addMethod(this).addSourceLine(this));
        }
    }
206029
protected void setLayoutVersion(Properties props, StorageDirectory sd)
      throws IncorrectVersionException, InconsistentFSStateException {
    int lv = Integer.parseInt(getProperty(props, sd, LAYOUT_VERSION));
    if (lv < FSConstants.LAYOUT_VERSION) { // future version
      throw new IncorrectVersionException(lv, "storage directory "
          + sd.root.getAbsolutePath());
    }
    layoutVersion = lv;
  }
788948
@Override
  public String doLayout(ILoggingEvent event) {

    // Format message
    String msg = super.doLayout(event).trim();
    // prevent log forging
    msg = preventLogForging(msg);

    // Formatting of exception, remove line breaks
    IThrowableProxy throwableProxy = event.getThrowableProxy();
    if (throwableProxy != null) {
      StackTraceElementProxy[] s = throwableProxy.getStackTraceElementProxyArray();
      if (s != null && s.length > 0) {
        // Performance: Initialize StringBuilder with (number of StackTrace-Elements + 1)*50 (+1 for Message)
        StringBuilder sb = new StringBuilder(s.length * BUFFER_PER_LINE);
        sb.append(msg);

        int len = s.length;
        for (int i = 0; i < len; i++) {
          sb.append(LINE_SEP).append(s[i]);
        }
        msg = sb.toString();
      }
    }
    return msg + NEWLINE;
  }
600695
public void layoutChildren() {

        Set<Integer> copySet;
        synchronized (mMeasuredChildren) {
            Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "layoutChildren [%d] layout = %s",
                    mMeasuredChildren.size(), this);
            copySet = new HashSet<>(mMeasuredChildren);
        }
        for (int nextMeasured: copySet) {
            Widget child = mContainer.get(nextMeasured);
            if (child != null) {
                child.preventTransformChanged(true);
                layoutChild(nextMeasured);
                postLayoutChild(nextMeasured);
                child.preventTransformChanged(false);
            }

        }
    }
1110474
public void setPadding(float padding, Layout.Axis axis) {
        OrientedLayout layout = null;
        switch(axis) {
            case X:
                layout = mShiftLayout;
                break;
            case Y:
                layout = mShiftLayout;
                break;
            case Z:
                layout = mStackLayout;
                break;
        }
        if (layout != null) {
            if (!equal(layout.getDividerPadding(axis), padding)) {
                layout.setDividerPadding(padding, axis);

                if (layout.getOrientationAxis() == axis) {
                    requestLayout();
                }
            }
        }

    }
566923
public function validateLayoutCopyStruct(LayoutCopyStruct $layoutCopyStruct): void
    {
        $layoutName = is_string($layoutCopyStruct->name) ?
            trim($layoutCopyStruct->name) :
            $layoutCopyStruct->name;

        $this->validate(
            $layoutName,
            [
                new Constraints\NotBlank(),
                new Constraints\Type(['type' => 'string']),
            ],
            'name'
        );

        if ($layoutCopyStruct->description !== null) {
            $this->validate(
                $layoutCopyStruct->description,
                [
                    new Constraints\Type(['type' => 'string']),
                ],
                'description'
            );
        }
    }
1151683
protected void setLayoutToMiddleSegment(int segmentLength,
                                           int priority,
                                           boolean isPooled,
                                           boolean isExchange,
                                           int packetNumber,
                                           int conversationId,
                                           int requestNumber)
   {
      if (tc.isEntryEnabled()) SibTr.entry(this, tc, "setLayoutToMiddleSegment", new Object[]{""+segmentLength, ""+priority, ""+isPooled, ""+isExchange, ""+packetNumber, ""+conversationId, ""+requestNumber});
      setLayoutToConversation(segmentLength, priority, isPooled, isExchange, packetNumber, JFapChannelConstants.SEGMENT_SEGMENTED_FLOW_MIDDLE, conversationId, requestNumber, null, null);
      layout = JFapChannelConstants.XMIT_SEGMENT_MIDDLE;
      transmissionRemaining = segmentLength;
      if (tc.isEntryEnabled()) SibTr.exit(this, tc, "setLayoutToMiddleSegment");
   }
267322
function _setLayout(layout) {
  var leafCount = _data.leafCount,
      dimention;

  // If count is even dummy will be replaced by output, so output would no more be leaf
  if(_data.tree.get('children.length') % 2 === 0) {
    leafCount--;
  }
  dimention = layout.projector(leafCount, _data.maxDepth - 1);

  _layout = layout;

  _width = dimention.x *= _layout.hSpacing;
  _height = dimention.y *= _layout.vSpacing;

  dimention = _layout.projector(dimention.x, dimention.y); // Because tree is always top to bottom
  _treeLayout = d3.layout.tree().size([dimention.x, dimention.y]);

  _update();
}
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);
    }
  }
141497
public void setLayoutParameters() {
        final int keypadWidth = styledAttributes.getDimensionPixelOffset(R.styleable.PinLock_keypadWidth, 200);
        final int keypadHeight = styledAttributes.getDimensionPixelOffset(R.styleable.PinLock_keypadHeight, 230);
        final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(keypadWidth, keypadHeight);
        params.gravity = 17;
        setLayoutParams(params);
    }
597748
public void registerLayout(String path, String resource) throws Exception {
        Layout layout = LayoutParser.parseResource(resource);
        ElementUI parent = parentFromPath(path);
        
        if (parent != null) {
            layout.materialize(parent);
        }
    }
38475
public boolean saveToProperty(LayoutIdentifier layoutId) {
        setName(layoutId.name);

        try {
            LayoutUtil.saveLayout(layoutId, toString());
        } catch (Exception e) {
            log.error("Error saving application layout.", e);
            return false;
        }

        return true;
    }
169474
@Override
    public void applyDesign(Design design, int themeColor) {
        Context ctx = mInputField.getContext();

        int smallPadId = design.isMaterial() ? R.dimen.default_margin : R.dimen.default_margin_small;
        int largePadId = design.isMaterial() ? R.dimen.material_edittext_spacing : R.dimen.default_margin_small;

        int padLR = ctx.getResources().getDimensionPixelSize(largePadId);
        int padTB = ctx.getResources().getDimensionPixelSize(smallPadId);

        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.setMargins(padLR, padTB, padLR, padTB);
        mInputField.setLayoutParams(params);

        if(design.isLight())
            mInputField.setTextColor(mInputField.getResources().getColor(R.color.background_material_dark));
        else
            mInputField.setTextColor(mInputField.getResources().getColor(R.color.background_material_light));

        Drawable drawable;
        if(design.isMaterial()) {
            drawable = mInputField.getResources().getDrawable(R.drawable.edittext_mtrl_alpha);
        }else{
            drawable = mInputField.getBackground();
        }

        drawable.setColorFilter(themeColor, PorterDuff.Mode.SRC_ATOP);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
            mInputField.setBackground(drawable);
        else
            mInputField.setBackgroundDrawable(drawable);

    }
609290
public function deleteLayoutZones($layoutId, ?int $status = null): void
    {
        $query = $this->connection->createQueryBuilder();
        $query->delete('ngbm_zone')
            ->where(
                $query->expr()->eq('layout_id', ':layout_id')
            )
            ->setParameter('layout_id', $layoutId, Type::INTEGER);

        if ($status !== null) {
            $this->applyStatusCondition($query, $status);
        }

        $query->execute();
    }