/** Same functionality as {@link #setSpanY(int)} only this method returns <code>this</code> for chaining multiple calls. * <p> * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com. * @param cells The number of cells to span (i.e. merge). * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>. * @see #setSpanY(int) */ public final CC spanY(int cells) { setSpanY(cells); return this; }
/** Same functionality as <code>spanX(cellsX).spanY(cellsY)</code> which means this cell will span cells in both x and y. * This method returns <code>this</code> for chaining multiple calls. * <p> * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com. * Since 3.7.2 this takes an array/vararg whereas it previously only took two specific values, xSpan and ySpan. * @param cells spanX and spanY, when present, and in that order. * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>. * @see #setSpanY(int) * @see #setSpanX(int) * @see #spanY() * @see #spanX() * @since 3.7.2 Replaces span(int, int). */ public final CC span(int ... cells) { if (cells == null || cells.length == 0) { setSpanX(LayoutUtil.INF); setSpanY(1); } else if (cells.length == 1) { setSpanX(cells[0]); setSpanY(1); } else { setSpanX(cells[0]); setSpanY(cells[1]); } return this; }
/** Set the cell(s) that the component should occupy in the grid. Same functionality as {@link #setCellX(int col)} and * {@link #setCellY(int row)} together with {@link #setSpanX(int width)} and {@link #setSpanY(int height)}. This method * returns <code>this</code> for chaining multiple calls. * <p> * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com. * @param colRowWidthHeight cellX, cellY, spanX, spanY respectively. 1-4 arguments, not null. * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>. * @see #setCellX(int) * @see #setCellY(int) * @see #setSpanX(int) * @see #setSpanY(int) * @since 3.7.2. Replacing cell(int, int) and cell(int, int, int, int) */ public final CC cell(int ... colRowWidthHeight) { switch (colRowWidthHeight.length) { default: throw new IllegalArgumentException("Illegal argument count: " + colRowWidthHeight.length); case 4: setSpanY(colRowWidthHeight[3]); case 3: setSpanX(colRowWidthHeight[2]); case 2: setCellY(colRowWidthHeight[1]); case 1: setCellX(colRowWidthHeight[0]); } return this; }
cc.setSpanY(parseSpan(part.substring(ix).trim())); continue; String[] spans = toTrimmedTokens(part.substring(ix).trim(), ' '); cc.setSpanX(spans[0].length() > 0 ? Integer.parseInt(spans[0]) : LayoutUtil.INF); cc.setSpanY(spans.length > 1 ? Integer.parseInt(spans[1]) : 1); continue; cc.setSpanX(Integer.parseInt(grs[2])); if (grs.length > 3) cc.setSpanY(Integer.parseInt(grs[3])); continue;