Class ReferenceLayout

  • All Implemented Interfaces:
    com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, Layout<ReferenceConstraints>

    public class ReferenceLayout
    extends AbstractLayout<ReferenceConstraints>
    A layout for components bound to component references such as IDs.
    Author:
    Garret Wilson
    • Constructor Detail

      • ReferenceLayout

        public ReferenceLayout()
    • Method Detail

      • getReferenceIDComponentMap

        protected java.util.Map<java.lang.String,​Component> getReferenceIDComponentMap()
        Returns:
        The lazily-created map of components mapped to reference IDs.
      • getConstraintsClass

        public java.lang.Class<? extends ReferenceConstraints> getConstraintsClass()
        Returns:
        The class representing the type of constraints appropriate for this layout.
      • componentConstraintsChanged

        protected void componentConstraintsChanged​(Component component,
                                                   Constraints oldConstraints,
                                                   Constraints newConstraints)
        Indicates that the constraints for a component have changed. This method is also called when the component is first added to the layout. This version removes and installs property change listeners to and from the constraints objects as appropriate.

        This version adds or removes the component reference ID to the map.

        Overrides:
        componentConstraintsChanged in class AbstractLayout<ReferenceConstraints>
        Parameters:
        component - The component for which constraints have changed.
        oldConstraints - The old component constraints, or null if there were no constraints previously.
        newConstraints - The new component constraints, or null if the component now has no constraints.
      • createDefaultConstraints

        public ReferenceConstraints createDefaultConstraints()
        Description copied from interface: Layout
        Creates default constraints for the layout component.
        Returns:
        New default constraints for the layout component.
      • getComponentByID

        public Component getComponentByID​(java.lang.String id)
        Retrieves a component bound to a given ID.
        Parameters:
        id - The ID with which a component may be bound.
        Returns:
        A component with constraints specifying the given ID, or null if there is no component bound to the given ID.