Class FormImpl

All Implemented Interfaces:
AttachNotifier, ChildEditableController, Component, Component.BelongToFrame, Component.Editable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper, ComponentContainer, HasValueSourceProvider, EditableChangeNotifier, Form, HasComponents, HasContextHelp, HasDebugId, HasHtmlCaption, HasHtmlDescription, HasHtmlSanitizer, SupportsCaptionPosition, UiPermissionAware

public class FormImpl extends AbstractComponent<JmixFormLayout> implements Form, UiPermissionAware
  • Field Details

  • Constructor Details

    • FormImpl

      public FormImpl()
  • Method Details

    • createComponent

      protected JmixFormLayout createComponent()
    • setDebugId

      public void setDebugId(@Nullable String id)
      Description copied from interface: HasDebugId
      INTERNAL. Managed by debug Id system.
      Specified by:
      setDebugId in interface HasDebugId
      Overrides:
      setDebugId in class AbstractComponent<JmixFormLayout>
    • isEditable

      public boolean isEditable()
      Specified by:
      isEditable in interface Component.Editable
    • setEditable

      public void setEditable(boolean editable)
      Specified by:
      setEditable in interface Component.Editable
    • addEditableChangeListener

      public Subscription addEditableChangeListener(Consumer<EditableChangeNotifier.EditableChangeEvent> listener)
      Description copied from interface: EditableChangeNotifier
      Adds a listener that is invoked when the editable property changes.
      Specified by:
      addEditableChangeListener in interface EditableChangeNotifier
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener
    • add

      public void add(Component childComponent)
      Description copied from interface: Form
      Adds a component to the first column.
      Specified by:
      add in interface ComponentContainer
      Specified by:
      add in interface Form
      Parameters:
      childComponent - a component to add
    • add

      public void add(Component childComponent, int column)
      Description copied from interface: Form
      Adds a component to the column with the given index.
      Specified by:
      add in interface Form
      Parameters:
      childComponent - a component to add
      column - a columns index
    • add

      public void add(Component childComponent, int column, int colSpan, int rowSpan)
      Description copied from interface: Form
      Adds a component to a column with the given index with the given span.
      Specified by:
      add in interface Form
      Parameters:
      childComponent - a component to add
      column - a columns index
      colSpan - a number of columns a component should span
      rowSpan - a number of rows a component should span
    • add

      public void add(Component childComponent, int column, int row)
      Description copied from interface: Form
      Adds a component to a column with the given index to the given position.
      Specified by:
      add in interface Form
      Parameters:
      childComponent - a component to add
      column - a columns index
      row - a row index
    • add

      public void add(Component childComponent, int column, int row, int colSpan, int rowSpan)
      Description copied from interface: Form
      Adds a component to a column with the given index to the given position with the given span.
      Specified by:
      add in interface Form
      Parameters:
      childComponent - a component to add
      column - a columns index
      row - a row index
      colSpan - a number of columns a component should span
      rowSpan - a number of rows a component should span
    • checkExistingOverlaps

      protected void checkExistingOverlaps(int startColumn, int startRow, int colSpan, int rowSpan)
    • addComponentInternal

      protected void addComponentInternal(Component childComponent, int column, int row, int colSpan, int rowSpan)
    • calculateInsertIndex

      protected int calculateInsertIndex(int column, int row, List<ComponentPosition> componentPositions)
    • managedComponentAssigned

      protected void managedComponentAssigned(Component childComponent)
    • applyDefaults

      protected void applyDefaults(Component childComponent)
    • assignTypicalAttributes

      protected void assignTypicalAttributes(Component component)
    • assignDebugId

      protected void assignDebugId(@Nullable com.vaadin.ui.Component composition, String id)
    • detectRowsCount

      protected int detectRowsCount(int column)
      Parameters:
      column - a column index
      Returns:
      rows count for the given column index
    • detectStartRowIndex

      protected int detectStartRowIndex(int column)
      Parameters:
      column - a column index
      Returns:
      start row index for the given column index
    • detectRowsCount

      protected int detectRowsCount(int column, boolean isCheckAreas)
    • findComponentArea

      @Nullable protected ComponentArea findComponentArea(List<ComponentArea> componentAreas, ComponentPosition position)
    • detectRowsCount

      protected int detectRowsCount()
      Returns:
      max rows count among all columns
    • reattachColumnFields

      protected void reattachColumnFields()
    • calculateComponentAreas

      protected List<ComponentArea> calculateComponentAreas()
    • fillSpanMatrix

      protected void fillSpanMatrix(boolean[][] spanMatrix, int col, int row, int colspan, int rowspan)
    • remove

      public void remove(Component childComponent)
      Description copied from interface: ComponentContainer
      Removes a component from this container.
      Specified by:
      remove in interface ComponentContainer
      Parameters:
      childComponent - a component to remove
    • findComponentPosition

      @Nullable protected ComponentPosition findComponentPosition(List<ComponentPosition> components, Component component)
    • removeAll

      public void removeAll()
      Description copied from interface: ComponentContainer
      Removes all components from this container.
      Specified by:
      removeAll in interface ComponentContainer
    • getOwnComponent

      @Nullable public Component getOwnComponent(String id)
      Description copied from interface: HasComponents
      Gets component directly owned by this container.
      Specified by:
      getOwnComponent in interface HasComponents
      Returns:
      component or null if not found
    • getComponent

      @Nullable public Component getComponent(String id)
      Description copied from interface: HasComponents
      Gets a component belonging to the whole components tree below this container.
      Specified by:
      getComponent in interface HasComponents
      Returns:
      component or null if not found
    • getOwnComponents

      public Collection<Component> getOwnComponents()
      Description copied from interface: HasComponents
      Gets all components directly owned by this container.
      Specified by:
      getOwnComponents in interface HasComponents
      Returns:
      all components directly owned by this container
    • getOwnComponentsStream

      public Stream<Component> getOwnComponentsStream()
      Description copied from interface: HasComponents
      Gets stream of all components directly owned by this container.
      Specified by:
      getOwnComponentsStream in interface HasComponents
      Returns:
      stream of all components directly owned by this container
    • getComponents

      public Collection<Component> getComponents()
      Description copied from interface: HasComponents
      Gets all components belonging to the whole components tree below this container.
      Specified by:
      getComponents in interface HasComponents
      Returns:
      all components belonging to the whole components tree below this container
    • getComponents

      public Collection<Component> getComponents(int column)
      Specified by:
      getComponents in interface Form
      Parameters:
      column - a column index
      Returns:
      a collection of components directly owned by a column with a given index
    • getComponent

      public Component getComponent(int column, int row)
      Specified by:
      getComponent in interface Form
      Parameters:
      column - a columns index
      row - a row index
      Returns:
      a component placed in a column with a given index in a given position
    • getCaptionPosition

      public SupportsCaptionPosition.CaptionPosition getCaptionPosition()
      Specified by:
      getCaptionPosition in interface Form
      Specified by:
      getCaptionPosition in interface SupportsCaptionPosition
      Returns:
      caption position of form child components
    • setCaptionPosition

      public void setCaptionPosition(SupportsCaptionPosition.CaptionPosition captionAlignment)
      Description copied from interface: Form
      Sets caption position of form child components.
      Specified by:
      setCaptionPosition in interface Form
      Specified by:
      setCaptionPosition in interface SupportsCaptionPosition
      Parameters:
      captionAlignment - component caption position
    • getChildrenCaptionWidth

      public int getChildrenCaptionWidth()
      Specified by:
      getChildrenCaptionWidth in interface Form
      Returns:
      columns fixed caption width
    • setChildrenCaptionWidth

      public void setChildrenCaptionWidth(int width)
      Description copied from interface: Form
      Sets fixed captions width for all columns. Set -1 to use auto size.
      Specified by:
      setChildrenCaptionWidth in interface Form
      Parameters:
      width - fixed caption width
    • getChildrenCaptionWidth

      public int getChildrenCaptionWidth(int column)
      Description copied from interface: Form
      Returns fixed caption width for column with a given index.
      Specified by:
      getChildrenCaptionWidth in interface Form
      Parameters:
      column - a column index
      Returns:
      fixed caption width for column with a given index
    • setChildrenCaptionWidth

      public void setChildrenCaptionWidth(int column, int width)
      Description copied from interface: Form
      Set fixed captions width for column with a given index. Set -1 to use auto size.
      Specified by:
      setChildrenCaptionWidth in interface Form
      Parameters:
      column - a column index
      width - fixed caption width for column with a given index
    • getChildrenCaptionAlignment

      public Form.CaptionAlignment getChildrenCaptionAlignment()
      Specified by:
      getChildrenCaptionAlignment in interface Form
      Returns:
      alignment of child component captions
    • setChildrenCaptionAlignment

      public void setChildrenCaptionAlignment(Form.CaptionAlignment alignment)
      Description copied from interface: Form
      Sets alignment of child component captions in all columns.

      Applicable only when captions position is SupportsCaptionPosition.CaptionPosition.LEFT.

      Specified by:
      setChildrenCaptionAlignment in interface Form
      Parameters:
      alignment - captions alignment
    • getChildrenCaptionAlignment

      public Form.CaptionAlignment getChildrenCaptionAlignment(int column)
      Description copied from interface: Form
      Returns alignment of child component captions for a column with the given index.
      Specified by:
      getChildrenCaptionAlignment in interface Form
      Parameters:
      column - a column index to get caption
      Returns:
      alignment of child component captions for a column with the given index
    • setChildrenCaptionAlignment

      public void setChildrenCaptionAlignment(int column, Form.CaptionAlignment alignment)
      Description copied from interface: Form
      Sets alignment of child component captions for a column with the given index.
      Specified by:
      setChildrenCaptionAlignment in interface Form
      Parameters:
      column - a column index to set caption
      alignment - alignment of child component captions for a column with the given index
    • getColumns

      public int getColumns()
      Specified by:
      getColumns in interface Form
      Returns:
      number of columns in the Form
    • setColumns

      public void setColumns(int columns)
      Description copied from interface: Form
      Sets the number of columns in the Form. The column count can not be reduced if there are any components that would be outside of the shrunk Form.
      Specified by:
      setColumns in interface Form
      Parameters:
      columns - the new number of columns in the Form
    • setColumnFlex

      public void setColumnFlex(int column, float flex)
      Description copied from interface: Form
      Sets flex layout ratio for column with a given index.
      Specified by:
      setColumnFlex in interface Form
      Parameters:
      column - a column index
      flex - the flex ration for the column
    • getColumnFlex

      public float getColumnFlex(int column)
      Description copied from interface: Form
      Returns the flex layout ratio for column with a given index.
      Specified by:
      getColumnFlex in interface Form
      Parameters:
      column - a column index
      Returns:
      flex layout ratio for column with a given index
    • getValueSourceProvider

      @Nullable public ValueSourceProvider getValueSourceProvider()
      Specified by:
      getValueSourceProvider in interface HasValueSourceProvider
    • setValueSourceProvider

      public void setValueSourceProvider(@Nullable ValueSourceProvider provider)
      Specified by:
      setValueSourceProvider in interface HasValueSourceProvider
    • applyPermission

      public void applyPermission(UiPermissionDescriptor permissionDescriptor)
      Description copied from interface: UiPermissionAware
      Change state of subcomponent according to the permissionValue.
      Specified by:
      applyPermission in interface UiPermissionAware
      Parameters:
      permissionDescriptor - descriptor which contains id of subcomponent and UI permission value which will be applied to this subcomponent or ids of subcomponent and its action and UI permission value which will be applied to subcomponent's action
    • attached

      public void attached()
      Description copied from interface: AttachNotifier
      Notifies all listeners that component has been attached.
      Specified by:
      attached in interface AttachNotifier
      Overrides:
      attached in class AbstractComponent<JmixFormLayout>
    • detached

      public void detached()
      Description copied from interface: AttachNotifier
      Notifies all listeners that component has been detached.
      Specified by:
      detached in interface AttachNotifier
      Overrides:
      detached in class AbstractComponent<JmixFormLayout>