/** Parses a single unit value that may also be an alignment as parsed by {@link #parseAlignKeywords(String, boolean)}. * @param s The string to parse. Not <code>null</code>. May look something like <code>"10px"</code> or <code>"5dlu"</code>. * @param isHor If the value is for the horizontal dimension. * @param emptyReplacement A replacement if <code>s</code> is empty. May be <code>null</code>. * @return The parsed unit value. May be <code>null</code>. */ public static UnitValue parseUnitValueOrAlign(String s, boolean isHor, UnitValue emptyReplacement) { if (s.length() == 0) return emptyReplacement; UnitValue align = parseAlignKeywords(s, isHor); if (align != null) return align; return parseUnitValue(s, emptyReplacement, isHor); }
/** Specifies the indicated rows'/columns' columns default alignment <b>for its components</b>. It does not affect the positioning * or size of the columns/row itself. For columns it is the horizontal alignment (e.g. "left") and for rows it is the vertical * alignment (e.g. "top"). * <p> * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com. * @param side The default side to align the components. E.g. "top" or "left", or "before" or "after" or "bottom" or "right". * @param indexes The index(es) (0-based) of the columns/rows that should be affected by this constraint. * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>. */ public final AC align(String side, int... indexes) { UnitValue al = ConstraintParser.parseAlignKeywords(side, true); if (al == null) al = ConstraintParser.parseAlignKeywords(side, false); for (int i = indexes.length - 1; i >= 0; i--) { int ix = indexes[i]; makeSize(ix); cList.get(ix).setAlign(al); } return this; }
UnitValue alignX = parseAlignKeywords(part, true); if (alignX != null) { lc.setAlignX(alignX); UnitValue alignY = parseAlignKeywords(part, false); if (alignY != null) { lc.setAlignY(alignY);
UnitValue align = parseAlignKeywords(part, isCols); if (align != null) {
UnitValue horAlign = parseAlignKeywords(part, true); if (horAlign != null) { cc.getHorizontal().setAlign(horAlign); UnitValue verAlign = parseAlignKeywords(part, false); if (verAlign != null) { cc.getVertical().setAlign(verAlign);