GridConstraints (final @NotNull Element element) { final GridConstraints constraints = new GridConstraints(); // grid related attributes constraints.setVSizePolicy(LwXmlReader.getRequiredInt(element, ATTRIBUTE_VSIZE_POLICY)); constraints.setHSizePolicy(LwXmlReader.getRequiredInt(element, ATTRIBUTE_HSIZE_POLICY)); constraints.setAnchor(LwXmlReader.getRequiredInt(element, ATTRIBUTE_ANCHOR)); constraints.setFill(LwXmlReader.getRequiredInt(element, ATTRIBUTE_FILL)); // minimum size final Element minSizeElement = element.getChild(ELEMENT_MINIMUM_SIZE); if (minSizeElement != null) { constraints.myMinimumSize.width = LwXmlReader.getRequiredInt(minSizeElement, ATTRIBUTE_WIDTH); constraints.myMinimumSize.height = LwXmlReader.getRequiredInt(minSizeElement, ATTRIBUTE_HEIGHT); } // preferred size final Element prefSizeElement = element.getChild(ELEMENT_PREFERRED_SIZE); if (prefSizeElement != null) { constraints.myPreferredSize.width = LwXmlReader.getRequiredInt(prefSizeElement, ATTRIBUTE_WIDTH); constraints.myPreferredSize.height = LwXmlReader.getRequiredInt(prefSizeElement, ATTRIBUTE_HEIGHT); } // maximum size final Element maxSizeElement = element.getChild(ELEMENT_MAXIMUM_SIZE); if (maxSizeElement != null) { constraints.myMaximumSize.width = LwXmlReader.getRequiredInt(maxSizeElement, ATTRIBUTE_WIDTH); constraints.myMaximumSize.height = LwXmlReader.getRequiredInt(maxSizeElement, ATTRIBUTE_HEIGHT); } return constraints; }