Class Row

  • All Implemented Interfaces:
    AttachNotifier, DetachNotifier, HasComponents, HasElement, HasEnabled, HasOrderedComponents, HasSize, HasStyle, Serializable

    @Tag("vaadin-board-row")
    @NpmPackage(value="@vaadin/polymer-legacy-adapter",version="23.1.11") @NpmPackage(value="@vaadin/board",version="23.1.11") @NpmPackage(value="@vaadin/vaadin-board",version="23.1.11")
    @JsModule("@vaadin/polymer-legacy-adapter/style-modules.js") @JsModule("@vaadin/board/vaadin-board-row.js")
    public class Row
    extends Component
    implements HasStyle, HasSize, HasOrderedComponents
    Row class to define rows used in a Board instance.

    Each Row consists of four columns, and can contain up to four components taking one column each, or fewer components with multiple columns each as long as sum of columns stays less than or equal to four.

    One row might also contain a nested row as shown in the following example:

     Board board = new Board();
     Label lbl1 = createLabel("Label 1");
     Label lbl2 = createLabel("Label 2");
     Label lbl3 = createLabel("Label 3");
    
     Label inner1 = createLabel("Inner 1");
     Label inner3 = createLabel("Inner 3");
     Label inner4 = createLabel("Inner 4");
     Label inner2 = createLabel("Inner 2");
     Row innerRow = new Row(inner1, inner2, inner3, inner4);
     Row outerRow = board.add(lbl1, lbl2, lbl3, innerRow);
     
    See Also:
    Serialized Form
    • Constructor Detail

      • Row

        public Row​(Component... components)
        Creates an new row with the given components.
        Parameters:
        components - initial content of the row
    • Method Detail

      • add

        public void add​(Component... components)
        Adds the given component(s) to the row.

        All added components are set to use 1 column. Use setComponentSpan(Component, int) to make a component span multiple columns.

        Specified by:
        add in interface HasComponents
        Parameters:
        components - the components to add
      • add

        public void add​(Component component,
                        int cols)
        Adds the given component to the row using the given number of columns.
        Parameters:
        component - the component to add
        cols - the number of columns the component should use
      • addNestedRow

        public void addNestedRow​(Row row)
        Adds the given row as a nested row to the current row.
        Parameters:
        row - the row to add as a nested row
      • getComponentSpan

        public int getComponentSpan​(Component component)
        Gets the number of columns the given component spans.
        Parameters:
        component - the child component to get columns for
        Returns:
        the number of columns the component spans, by default 1.
      • setComponentSpan

        public void setComponentSpan​(Component component,
                                     int columns)
        Sets the number of columns the given component spans.
        Parameters:
        component - the child component to set columns for
        columns - the number of columns the component spans