/** * Decodes a string description for the horizontal and vertical alignment * and sets this CellConstraints' alignment values. If the boolean is * <code>true</code> the horizontal alignment is the first token, * and the vertical alignment is the second token. if the boolean is * <code>false</code> the vertical alignment comes first. <p> * * Valid horizontal alignments are: left, middle, right, default, and fill. * Valid vertical alignments are: top, center, bottom, default, and fill. * The anchor's string representation abbreviates the alignment: * l, m, r, d, f, t, c, and b.<p> * * Anchor examples: * "m, c" is centered, "l, t" is northwest, "m, t" is north, "r, c" east. * "m, d" is horizontally centered and uses the row's default alignment. * "d, t" is on top of the cell and uses the column's default alignment.<p> * * @param encodedAlignments represents horizontal and vertical alignment * @throws IllegalArgumentException if an alignment orientation is invalid */ private void setAlignments(String encodedAlignments, boolean horizontalThenVertical) { StringTokenizer tokenizer = new StringTokenizer(encodedAlignments, " ,"); Alignment first = decodeAlignment(tokenizer.nextToken()); Alignment second = decodeAlignment(tokenizer.nextToken()); hAlign = horizontalThenVertical ? first : second; vAlign = horizontalThenVertical ? second : first; ensureValidOrientations(hAlign, vAlign); }
/** * Decodes a string description for the horizontal and vertical alignment * and set the alignment values. * <p> * Valid horizontal aligmnents are: left, middle, right, default, and fill. * Valid vertical alignments are: top, center, bottom, default, and fill. * The anchor's string representation abbreviates the alignment: l, m, r, d, * f, t, c, and b. * <p> * Anchor examples: "mc" is centered, "lt" is northwest, "mt" is north, "rc" * east. "md" is horizontally centered and uses the row's default alignment. * "dt" is on top of the cell and uses the column's default alignment. * <p> * * @param encodedAlignments * represents horizontal and vertical alignment * @throws IllegalArgumentException * if an alignment orientation is invalid */ private void setAlignments(String encodedAlignments) { StringTokenizer tokenizer = new StringTokenizer(encodedAlignments, " ,"); hAlign = decodeAlignment(tokenizer.nextToken()); vAlign = decodeAlignment(tokenizer.nextToken()); ensureValidOrientations(hAlign, vAlign); }
/** * Decodes a string description for the horizontal and vertical alignment * and sets this CellConstraints' alignment values. If the boolean is * {@code true} the horizontal alignment is the first token, * and the vertical alignment is the second token. if the boolean is * {@code false} the vertical alignment comes first. <p> * * Valid horizontal alignments are: left, center, right, default, and fill. * Valid vertical alignments are: top, center, bottom, default, and fill. * The anchor's string representation abbreviates the alignment: * l, c, r, d, f, t, and b.<p> * * Anchor examples: * "c, c" is centered, "l, t" is northwest, "c, t" is north, "r, c" east. * "c, d" is horizontally centered and uses the row's default alignment. * "d, t" is on top of the cell and uses the column's default alignment.<p> * * @param encodedAlignments represents horizontal and vertical alignment * @throws IllegalArgumentException if an alignment orientation is invalid */ private void setAlignments(String encodedAlignments, boolean horizontalThenVertical) { StringTokenizer tokenizer = new StringTokenizer(encodedAlignments, " ,"); Alignment first = decodeAlignment(tokenizer.nextToken()); Alignment second = decodeAlignment(tokenizer.nextToken()); hAlign = horizontalThenVertical ? first : second; vAlign = horizontalThenVertical ? second : first; ensureValidOrientations(hAlign, vAlign); }
hAlign = decodeAlignment(token); vAlign = decodeAlignment(tokenizer.nextToken()); ensureValidOrientations(hAlign, vAlign);
hAlign = decodeAlignment(token); vAlign = decodeAlignment(tokenizer.nextToken()); ensureValidOrientations(hAlign, vAlign);
hAlign = decodeAlignment(token); vAlign = decodeAlignment(tokenizer.nextToken()); ensureValidOrientations(hAlign, vAlign);