Having your UI components maintain their sanity when the browser window or their container is resized without any effort from the coder is bliss. GXT provides AnchorLayout
which enables contained components to anchor relatively to a container's dimensions, maintaining the anchor rules even when the container is resized.
The components rendered with AnchorLayout
are sized with an anchor-spec which is a string of two values used for horizontal and vertical anchoring respectively. The values which can be expressed as percentages or offsets or even both, determine how a component is anchored to its container. A value of 100% 50% would render a component the complete width of its container and half its height, if only one value is provided in the anchor-spec it is assumed to be the width while the height will default to auto.
Similarly, an anchor-spec of -30 -120 would render the component using the complete width of its container minus 30 pixels and the...