@Override public Alignment getComponentAlignment(Component childComponent) { ChildComponentData childComponentData = getState(false).childData .get(childComponent); if (childComponentData == null) { throw new IllegalArgumentException( "The given component is not a child of this layout"); } else { return new Alignment(childComponentData.alignment); } }
@Override public Alignment getComponentAlignment(Component childComponent) { ChildComponentData childData = getState().childData.get(childComponent); if (childData == null) { throw new IllegalArgumentException( "The given component is not a child of this layout"); } return new Alignment(childData.alignmentBitmask); }
/** * Read the alignment from the given child component attributes. * * @since 7.6.4 * @param attr * the child component attributes * @return the component alignment */ public static Alignment readAlignment(Attributes attr) { int bitMask = 0; if (attr.hasKey(":middle")) { bitMask += AlignmentInfo.Bits.ALIGNMENT_VERTICAL_CENTER; } else if (attr.hasKey(":bottom")) { bitMask += AlignmentInfo.Bits.ALIGNMENT_BOTTOM; } else { bitMask += AlignmentInfo.Bits.ALIGNMENT_TOP; } if (attr.hasKey(":center")) { bitMask += AlignmentInfo.Bits.ALIGNMENT_HORIZONTAL_CENTER; } else if (attr.hasKey(":right")) { bitMask += AlignmentInfo.Bits.ALIGNMENT_RIGHT; } else { bitMask += AlignmentInfo.Bits.ALIGNMENT_LEFT; } return new Alignment(bitMask); }