private void checkCache() { if (dirty) { grid = null; } if (grid == null) { grid = new Grid(this, lc, rc, cc, ccMap, new ArrayList<>()); } debugRects.clear(); dirty = false; }
lGrid.layout(lBounds, getLayoutConstraints().getAlignX(), getLayoutConstraints().getAlignY(), debug); lGrid.paintDebug(); long newSize = lGrid.getHeight()[1] + (((long) lGrid.getWidth()[1]) << 32); if (lastSize != newSize) { lastSize = newSize;
CC rootCc = getCC(comp, ccMap); addLinkIDs(rootCc); setLinkedBounds(comp, rootCc, comp.getX(), comp.getY(), comp.getWidth(), comp.getHeight(), rootCc.isExternal()); i++; continue; // The "external" component should not be handled further. if (getPos(comp, rootCc) != null || rootCc.isExternal()) { setLinkedBounds(comp, rootCc, comp.getX(), comp.getY(), comp.getWidth(), comp.getHeight(), rootCc.isExternal()); i++; continue; addDockingCell(dockInsets, rootCc.getDockSide(), new CompWrap(comp, rootCc, hideMode, useVisualPadding)); i++; continue; wrap(cellXY, rootCc.getNewlineGapSize()); } else if (hitEndOfRow) { wrap(cellXY, null); int cy = rootCc.getCellY(); if ((cx < 0 || cy < 0) && isRowInGridMode && rootCc.getSkip() == 0) { // 3.7.2: If skip, don't find an empty cell first. while (!isCellFree(cellXY[1], cellXY[0], spannedRects)) { if (Math.abs(increase(cellXY, 1)) >= wrap) wrap(cellXY, null); ensureIndexSizes(cx, cy);
@Override public int getMinimumHeight(int wHint) { return grid.getHeight()[0]; }
@Override public int getPreferredWidth(int hHint) { return grid.getWidth()[1]; }
private void calcGridSizes(int refWidth, int refHeight) { // Note, in these calls the grid can be invalidated and specs set to null. Therefore use local versions. FlowSizeSpec colSpecs = calcRowsOrColsSizes(true, refWidth); FlowSizeSpec rowSpecs = calcRowsOrColsSizes(false, refHeight); colFlowSpecs = colSpecs; rowFlowSpecs = rowSpecs; width = getMinPrefMaxSumSize(true, colSpecs.sizes); height = getMinPrefMaxSumSize(false, rowSpecs.sizes); if (linkTargetIDs == null) { resetLinkValues(false, true); } else { // This call makes some components flicker on SWT. They get their bounds changed twice since // the change might affect the absolute size adjustment below. There's no way around this that // I know of. layout(new int[]{0, 0, refWidth, refHeight}, null, null, false); resetLinkValues(false, false); } adjustSizeForAbsolute(true); adjustSizeForAbsolute(false); }
public void layoutContainer(Canvas canvas, int[] bounds) { for (ComponentWrapper wrapper : children) { if (wrapper instanceof MigLayout) { MigLayout layout = (MigLayout) wrapper; layout.layoutContainer(canvas, bounds); } else if (wrapper instanceof MigComponent) { MigComponent migComponent = (MigComponent) wrapper; migComponent.calculatePreferredSize(canvas, canvas.size()); } } checkCache(); if (grid.layout(bounds, lc.getAlignX(), lc.getAlignY(), debug, true)) { grid = null; checkCache(); grid.layout(bounds, lc.getAlignX(), lc.getAlignY(), debug, false); } }
ixArr[ix++] = i; putSizesAndIndexes(container.getComponent(), rowColSizes, ixArr, isRows); groupSize = LayoutUtil.sum(rowColSizes, bIx2, Math.min((group.span << 1) - 1, rowColSizes.length - bIx2 - 1)); group.layout(primDC, curPos, groupSize, group.span);
@Override public void onDraw(Canvas canvas) { int[] bounds = {0, 0, canvas.size().x, canvas.size().y}; layoutContainer(canvas, bounds); for (ComponentWrapper wrapper : wrappers.values()) { UIWidget component = (UIWidget) wrapper.getComponent(); Rect2i region = Rect2i.createFromMinAndSize(wrapper.getX(), wrapper.getY(), wrapper.getWidth(), wrapper.getHeight()); canvas.drawWidget(component, region); } if (debug) { grid.paintDebug(); } for (Rect2i region : debugRects) { canvas.drawLine(region.minX(), region.minY(), region.maxX(), region.minY(), Color.WHITE); canvas.drawLine(region.maxX(), region.minY(), region.maxX(), region.maxY(), Color.WHITE); canvas.drawLine(region.maxX(), region.maxY(), region.minX(), region.maxY(), Color.WHITE); canvas.drawLine(region.minX(), region.maxY(), region.minX(), region.minY(), Color.WHITE); } }
@Override public int getMaximumHeight(int wHint) { return grid.getHeight()[2]; }
@Override public int getMaximumWidth(int hHint) { return grid.getWidth()[2]; }
@Override protected void layout(Composite parent, boolean flushCache) { if (flushCache) grid = null; checkCache(parent); Rectangle r = parent.getClientArea(); int[] b = new int[] {r.x, r.y, r.width, r.height}; final boolean layoutAgain = grid.layout(b, lc.getAlignX(), lc.getAlignY(), getDebug()); if (layoutAgain) { grid = null; checkCache(parent); grid.layout(b, lc.getAlignX(), lc.getAlignY(), getDebug()); } }
private Dimension getSizeImpl(Container parent, int sizeType) { checkCache(parent); Insets i = parent.getInsets(); int w = LayoutUtil.getSizeSafe(grid != null ? grid.getWidth() : null, sizeType) + i.left + i.right; int h = LayoutUtil.getSizeSafe(grid != null ? grid.getHeight() : null, sizeType) + i.top + i.bottom; return new Dimension(w, h); }
@Override public int getPreferredHeight(int wHint) { return grid.getHeight()[1]; }
@Override public int getMinimumWidth(int hHint) { return grid.getWidth()[0]; }
private Grid getGrid() { if (_grid == null) _grid = new Grid(new FXContainerWrapper(this), getLayoutConstraints(), getRowConstraints(), getColumnConstraints(), wrapperToCCMap, callbackList); return _grid; }
@Override protected Point computeSize(Composite parent, int wHint, int hHint, boolean flushCache) { checkCache(parent); int w = LayoutUtil.getSizeSafe(grid != null ? grid.getWidth() : null, LayoutUtil.PREF); int h = LayoutUtil.getSizeSafe(grid != null ? grid.getHeight() : null, LayoutUtil.PREF); return new Point(w, h); }
public final int[] getHeight() { return getHeight(lastRefWidth); }