Class WFieldLayout

    • Constructor Detail

      • WFieldLayout

        public WFieldLayout()
        Creates a WFieldLayout with the default layout type of LAYOUT_FLAT.
      • WFieldLayout

        public WFieldLayout​(String layout)
        Creates a WFieldLayout with the given layout type.
        Parameters:
        layout - one of LAYOUT_FLAT or LAYOUT_STACKED.
    • Method Detail

      • setHeading

        @Deprecated
        public void setHeading​(String heading)
        Deprecated.
        use setTitle(String) instead
        Set the heading for the field layout.
        Parameters:
        heading - the text for the heading
      • setTitle

        public void setTitle​(String title)
        Set the title for the field layout.
        Parameters:
        title - the text for the title
      • getTitle

        public String getTitle()
        Get the title for this field layout.
        Returns:
        the title
      • getLayoutType

        public String getLayoutType()
        Get the type of layout for this field layout.
        Returns:
        the layout type
      • getLabelWidth

        public int getLabelWidth()
        Returns:
        Returns the labelWidth.
      • setLabelWidth

        public void setLabelWidth​(int labelWidth)
        Sets the label width.
        Parameters:
        labelWidth - the percentage width, or <= 0 to use the default field width.
      • setMargin

        public void setMargin​(Margin margin)
        Set the margin for the component, or null for no margin.
        Specified by:
        setMargin in interface Marginable
        Parameters:
        margin - the margin for the component
      • getMargin

        public Margin getMargin()
        Get the margin for the component, or null if not set.
        Specified by:
        getMargin in interface Marginable
        Returns:
        the margin for the component, or null if not set
      • isOrdered

        public boolean isOrdered()
        Returns:
        true if ordered layout
      • setOrdered

        public void setOrdered​(boolean ordered)
        Flag a layout to be an ordered list. Used with setOrderedOffset(int).
        Parameters:
        ordered - true if ordered layout
      • getOrderedOffset

        public int getOrderedOffset()
        Allows layouts to have its ordered numbering start from an offset. Used with setOrdered(boolean).
        Returns:
        the ordered start offset.
      • setOrderedOffset

        public void setOrderedOffset​(int orderedOffset)
        Set the starting offset for an ordered layout. Used with setOrdered(boolean).
        Parameters:
        orderedOffset - the ordered start offset. Must be 1 or greater.
      • addField

        public WField addField​(String label,
                               WComponent field)
        Add a field using the label and components passed in.
        Parameters:
        label - the label to use for the field
        field - the component to use for the field
        Returns:
        the field which was added to the layout.
      • addField

        public WField addField​(WLabel label,
                               WComponent field)
        Add a field using the label and components passed in.
        Parameters:
        label - the label to use for the field
        field - the component to use for the field
        Returns:
        the field which was added to the layout.
      • addField

        public WField addField​(WButton button)
        Add a field consisting of a WButton with a null label.
        Parameters:
        button - the WButton to add to the layout.
        Returns:
        the field added to the layout.
      • remove

        public void remove​(WComponent child)
      • toString

        public String toString()
        Description copied from class: AbstractWComponent
        Creates a String representation of this component; usually for debugging purposes.
        Overrides:
        toString in class AbstractWComponent
        Returns:
        a String representation of this component, for debugging purposes.
      • getComponentModel

        protected WFieldLayout.FieldLayoutModel getComponentModel()
        Returns the effective component model for this component. Subclass may override this method to narrow the return type to their specific model type.
        Overrides:
        getComponentModel in class AbstractWComponent
        Returns:
        the effective component model
      • getOrCreateComponentModel

        protected WFieldLayout.FieldLayoutModel getOrCreateComponentModel()
        Retrieves the model for this component so that it can be modified. If this method is called during request processing, and a session specific model does not yet exist, then a new model is created. Subclasses may override this method to narrow the return type to their specific model type.
        Overrides:
        getOrCreateComponentModel in class AbstractWComponent
        Returns:
        the model for this component