Class AbstractFlowLayout<T extends AbstractFlowConstraints>

  • Type Parameters:
    T - The type of layout constraints associated with each component.
    All Implemented Interfaces:
    com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, Layout<T>
    Direct Known Subclasses:
    FlowLayout, MenuLayout

    public abstract class AbstractFlowLayout<T extends AbstractFlowConstraints>
    extends AbstractLayout<T>
    A layout that flows information along an axis.
    Author:
    Garret Wilson
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ALIGNMENT_PROPERTY
      The bound property of the alignment.
      static java.lang.String FLOW_PROPERTY
      The bound property of the flow.
      static java.lang.String GAP_AFTER_PROPERTY
      The bound property of the gap after flowed components.
      static java.lang.String GAP_BEFORE_PROPERTY
      The bound property of the gap before flowed components.
      static java.lang.String GAP_BETWEEN_PROPERTY
      The bound property of the gap between flowed components.
      static java.lang.String WRAPPED_PROPERTY
      The bound property of whether wrapping occurs.
      • Fields inherited from class com.globalmentor.beans.BoundPropertyObject

        NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractFlowLayout​(Flow flow, boolean wrapped)
      Flow and wrap constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getAlignment()  
      Flow getFlow()  
      Extent getGapAfter()  
      Extent getGapBefore()  
      Extent getGapBetween()  
      boolean isWrapped()  
      void setAlignment​(double newAlignment)
      Sets the default alignment of components perpendicular to the flow axis.
      void setFlow​(Flow newFlow)
      Sets the logical axis (line or page) along which information is flowed.
      void setGap​(Extent newGap)
      Sets the gap before, between, and after flowed components.
      void setGapAfter​(Extent newGapAfter)
      Sets the gap after flowed components.
      void setGapBefore​(Extent newGapBefore)
      Sets the gap before flowed components.
      void setGapBetween​(Extent newGapBetween)
      Sets the gap between flowed components.
      void setWrapped​(boolean newWrapped)
      Sets whether flowed children are wrapped when the flow extent is reached.
      • Methods inherited from class com.globalmentor.beans.BoundPropertyObject

        addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.globalmentor.beans.PropertyBindable

        addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
    • Field Detail

      • ALIGNMENT_PROPERTY

        public static final java.lang.String ALIGNMENT_PROPERTY
        The bound property of the alignment.
      • FLOW_PROPERTY

        public static final java.lang.String FLOW_PROPERTY
        The bound property of the flow.
      • GAP_AFTER_PROPERTY

        public static final java.lang.String GAP_AFTER_PROPERTY
        The bound property of the gap after flowed components.
      • GAP_BEFORE_PROPERTY

        public static final java.lang.String GAP_BEFORE_PROPERTY
        The bound property of the gap before flowed components.
      • GAP_BETWEEN_PROPERTY

        public static final java.lang.String GAP_BETWEEN_PROPERTY
        The bound property of the gap between flowed components.
      • WRAPPED_PROPERTY

        public static final java.lang.String WRAPPED_PROPERTY
        The bound property of whether wrapping occurs.
    • Constructor Detail

      • AbstractFlowLayout

        public AbstractFlowLayout​(Flow flow,
                                  boolean wrapped)
        Flow and wrap constructor.
        Parameters:
        flow - The logical axis (line or page) along which information is flowed.
        wrapped - Whether flowed children should be wrapped when the flow extent is reached.
        Throws:
        java.lang.NullPointerException - if the flow axis is null.
    • Method Detail

      • getAlignment

        public double getAlignment()
        Returns:
        The default alignment of components perpendicular to the flow axis in terms relative to the beginning of the alignment axis.
      • setAlignment

        public void setAlignment​(double newAlignment)
        Sets the default alignment of components perpendicular to the flow axis. For example, in a left-to-right top-to-bottom orientation flowing along the Flow.LINE axis, alignments of 0.0, 0.5, and 1.0 would be equivalent to what are commonly known as left, center, and right alignments, respectively. In the same orientation flowing along the Flow.PAGE axis, alignments of 0.0, 0.5, and 1.0 would be equivalent to what are commonly known as top, middle, and bottom alignments, respectively. This method also acts as a convenience method by unconditionally updating the alignment of the flow constraints of any child components of this layout's owner. This is a bound property of type Double.
        Parameters:
        newAlignment - The alignment of components perpendicular to the flow axis in terms relative to the beginning of the alignment axis.
        See Also:
        ALIGNMENT_PROPERTY, AbstractFlowConstraints.setAlignment(double)
      • getFlow

        public Flow getFlow()
        Returns:
        The logical axis (line or page) along which information is flowed.
      • setFlow

        public void setFlow​(Flow newFlow)
        Sets the logical axis (line or page) along which information is flowed. This is a bound property.
        Parameters:
        newFlow - The logical axis along which information is flowed.
        Throws:
        java.lang.NullPointerException - if the given flow is null.
        See Also:
        FLOW_PROPERTY
      • getGapAfter

        public Extent getGapAfter()
        Returns:
        The gap after flowed components.
      • setGapAfter

        public void setGapAfter​(Extent newGapAfter)
        Sets the gap after flowed components. This is a bound property.
        Parameters:
        newGapAfter - The gap after flowed components.
        Throws:
        java.lang.NullPointerException - if the given gap is null.
        See Also:
        GAP_AFTER_PROPERTY
      • getGapBefore

        public Extent getGapBefore()
        Returns:
        The gap before flowed components.
      • setGapBefore

        public void setGapBefore​(Extent newGapBefore)
        Sets the gap before flowed components. This is a bound property.
        Parameters:
        newGapBefore - The gap before flowed components.
        Throws:
        java.lang.NullPointerException - if the given gap is null.
        See Also:
        GAP_BEFORE_PROPERTY
      • getGapBetween

        public Extent getGapBetween()
        Returns:
        The gap between flowed components.
      • setGapBetween

        public void setGapBetween​(Extent newGapBetween)
        Sets the gap between flowed components. This is a bound property.
        Parameters:
        newGapBetween - The gap between flowed components.
        Throws:
        java.lang.NullPointerException - if the given gap is null.
        See Also:
        GAP_BETWEEN_PROPERTY
      • setWrapped

        public void setWrapped​(boolean newWrapped)
        Sets whether flowed children are wrapped when the flow extent is reached. This is a bound property of type Boolean.
        Parameters:
        newWrapped - Whether flowed children should be wrapped when the flow extent is reached.
        See Also:
        WRAPPED_PROPERTY
      • setGap

        public void setGap​(Extent newGap)
        Sets the gap before, between, and after flowed components. This is a convenience method that sets each of the gaps to the same value. Each gap represents a bound property.
        Parameters:
        newGap - The gap before, between, and after flowed components.
        Throws:
        java.lang.NullPointerException - if the given gap is null.
        See Also:
        GAP_BEFORE_PROPERTY, GAP_BETWEEN_PROPERTY, GAP_AFTER_PROPERTY