Package io.jmix.ui.component.impl
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.component.Component
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
Nested classes/interfaces inherited from interface io.jmix.ui.component.EditableChangeNotifier
EditableChangeNotifier.EditableChangeEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.Form
Form.CaptionAlignment
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.SupportsCaptionPosition
SupportsCaptionPosition.CaptionPosition
-
Field Summary
Modifier and TypeFieldDescriptionprotected List<List<ComponentPosition>>
protected boolean
protected ValueSourceProvider
Fields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parent
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a component to the first column.void
Adds a component to the column with the given index.void
Adds a component to a column with the given index to the given position.void
Adds a component to a column with the given index with the given span.void
Adds a component to a column with the given index to the given position with the given span.protected void
addComponentInternal
(Component childComponent, int column, int row, int colSpan, int rowSpan) Adds a listener that is invoked when theeditable
property changes.protected void
applyDefaults
(Component childComponent) void
applyPermission
(UiPermissionDescriptor permissionDescriptor) Change state of subcomponent according to thepermissionValue
.protected void
assignDebugId
(com.vaadin.ui.Component composition, String id) protected void
assignTypicalAttributes
(Component component) void
attached()
Notifies all listeners that component has been attached.protected List<ComponentArea>
protected int
calculateInsertIndex
(int column, int row, List<ComponentPosition> componentPositions) protected void
checkExistingOverlaps
(int startColumn, int startRow, int colSpan, int rowSpan) protected JmixFormLayout
void
detached()
Notifies all listeners that component has been detached.protected int
protected int
detectRowsCount
(int column) protected int
detectRowsCount
(int column, boolean isCheckAreas) protected int
detectStartRowIndex
(int column) protected void
fillSpanMatrix
(boolean[][] spanMatrix, int col, int row, int colspan, int rowspan) protected ComponentArea
findComponentArea
(List<ComponentArea> componentAreas, ComponentPosition position) protected ComponentPosition
findComponentPosition
(List<ComponentPosition> components, Component component) getChildrenCaptionAlignment
(int column) Returns alignment of child component captions for a column with the given index.int
int
getChildrenCaptionWidth
(int column) Returns fixed caption width for column with a given index.float
getColumnFlex
(int column) Returns the flex layout ratio for column with a given index.int
getComponent
(int column, int row) getComponent
(String id) Gets a component belonging to the whole components tree below this container.Gets all components belonging to the whole components tree below this container.getComponents
(int column) Gets component directly owned by this container.Gets all components directly owned by this container.Gets stream of all components directly owned by this container.boolean
protected void
managedComponentAssigned
(Component childComponent) protected void
void
Removes a component from this container.void
Removes all components from this container.void
setCaptionPosition
(SupportsCaptionPosition.CaptionPosition captionAlignment) Sets caption position of form child components.void
setChildrenCaptionAlignment
(int column, Form.CaptionAlignment alignment) Sets alignment of child component captions for a column with the given index.void
setChildrenCaptionAlignment
(Form.CaptionAlignment alignment) Sets alignment of child component captions in all columns.void
setChildrenCaptionWidth
(int width) Sets fixed captions width for all columns.void
setChildrenCaptionWidth
(int column, int width) Set fixed captions width for column with a given index.void
setColumnFlex
(int column, float flex) Sets flex layout ratio for column with a given index.void
setColumns
(int columns) Sets the number of columns in the Form.void
setDebugId
(String id) INTERNAL.void
setEditable
(boolean editable) void
setValueSourceProvider
(ValueSourceProvider provider) Methods inherited from class io.jmix.ui.component.impl.AbstractComponent
addAttachListener, addDetachListener, addStyleName, assignDebugId, getAlignment, getCaption, getComponent, getComposition, getContextHelpIconClickHandler, getContextHelpText, getDebugId, getDescription, getEventHub, getFrame, getHeight, getHeightSizeUnit, getHtmlSanitizer, getIcon, getIconName, getIconResource, getId, getParent, getStyleName, getUiComponentProperties, getUiProperties, getWidth, getWidthSizeUnit, getXmlDescriptor, hasSubscriptions, hasValidationError, isAttached, isCaptionAsHtml, isContextHelpTextHtmlEnabled, isDescriptionAsHtml, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, onContextHelpIconClick, publish, removeStyleName, sanitize, setAlignment, setApplicationContext, setCaption, setCaptionAsHtml, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDescription, setDescriptionAsHtml, setEnabled, setFrame, setHeight, setHtmlSanitizerEnabled, setIcon, setIconFromSet, setId, setParent, setResponsive, setStyleName, setValidationError, setVisible, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jmix.ui.component.Component
addStyleName, getAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, removeStyleName, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
Methods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrame
Methods inherited from interface io.jmix.ui.component.Component.Editable
isEditableWithParent
Methods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaption
Methods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescription
Methods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSet
Methods inherited from interface io.jmix.ui.component.ComponentContainer
remove
Methods inherited from interface io.jmix.ui.component.HasComponents
focusFirstComponent, getComponentNN
Methods inherited from interface io.jmix.ui.component.HasContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
Methods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
-
Field Details
-
columnComponentMapping
-
valueSourceProvider
-
editable
protected boolean editable
-
-
Constructor Details
-
FormImpl
public FormImpl()
-
-
Method Details
-
createComponent
-
setDebugId
Description copied from interface:HasDebugId
INTERNAL. Managed by debug Id system.- Specified by:
setDebugId
in interfaceHasDebugId
- Overrides:
setDebugId
in classAbstractComponent<JmixFormLayout>
-
isEditable
public boolean isEditable()- Specified by:
isEditable
in interfaceComponent.Editable
-
setEditable
public void setEditable(boolean editable) - Specified by:
setEditable
in interfaceComponent.Editable
-
addEditableChangeListener
public Subscription addEditableChangeListener(Consumer<EditableChangeNotifier.EditableChangeEvent> listener) Description copied from interface:EditableChangeNotifier
Adds a listener that is invoked when theeditable
property changes.- Specified by:
addEditableChangeListener
in interfaceEditableChangeNotifier
- Parameters:
listener
- a listener to add- Returns:
- a registration object for removing an event listener
-
add
Description copied from interface:Form
Adds a component to the first column.- Specified by:
add
in interfaceComponentContainer
- Specified by:
add
in interfaceForm
- Parameters:
childComponent
- a component to add
-
add
Description copied from interface:Form
Adds a component to the column with the given index. -
add
Description copied from interface:Form
Adds a component to a column with the given index with the given span. -
add
Description copied from interface:Form
Adds a component to a column with the given index to the given position. -
add
Description copied from interface:Form
Adds a component to a column with the given index to the given position with the given 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
-
managedComponentAssigned
-
applyDefaults
-
assignTypicalAttributes
-
assignDebugId
-
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
-
fillSpanMatrix
protected void fillSpanMatrix(boolean[][] spanMatrix, int col, int row, int colspan, int rowspan) -
remove
Description copied from interface:ComponentContainer
Removes a component from this container.- Specified by:
remove
in interfaceComponentContainer
- 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 interfaceComponentContainer
-
getOwnComponent
Description copied from interface:HasComponents
Gets component directly owned by this container.- Specified by:
getOwnComponent
in interfaceHasComponents
- Returns:
- component or null if not found
-
getComponent
Description copied from interface:HasComponents
Gets a component belonging to the whole components tree below this container.- Specified by:
getComponent
in interfaceHasComponents
- Returns:
- component or null if not found
-
getOwnComponents
Description copied from interface:HasComponents
Gets all components directly owned by this container.- Specified by:
getOwnComponents
in interfaceHasComponents
- Returns:
- all components directly owned by this container
-
getOwnComponentsStream
Description copied from interface:HasComponents
Gets stream of all components directly owned by this container.- Specified by:
getOwnComponentsStream
in interfaceHasComponents
- Returns:
- stream of all components directly owned by this container
-
getComponents
Description copied from interface:HasComponents
Gets all components belonging to the whole components tree below this container.- Specified by:
getComponents
in interfaceHasComponents
- Returns:
- all components belonging to the whole components tree below this container
-
getComponents
- Specified by:
getComponents
in interfaceForm
- Parameters:
column
- a column index- Returns:
- a collection of components directly owned by a column with a given index
-
getComponent
- Specified by:
getComponent
in interfaceForm
- Parameters:
column
- a columns indexrow
- a row index- Returns:
- a component placed in a column with a given index in a given position
-
getCaptionPosition
- Specified by:
getCaptionPosition
in interfaceForm
- Specified by:
getCaptionPosition
in interfaceSupportsCaptionPosition
- Returns:
- caption position of form child components
-
setCaptionPosition
Description copied from interface:Form
Sets caption position of form child components.SupportsCaptionPosition.CaptionPosition.LEFT
- component captions will be placed in a separate column on the left side of the componentsSupportsCaptionPosition.CaptionPosition.TOP
- component captions will be placed above the components
- Specified by:
setCaptionPosition
in interfaceForm
- Specified by:
setCaptionPosition
in interfaceSupportsCaptionPosition
- Parameters:
captionAlignment
- component caption position
-
getChildrenCaptionWidth
public int getChildrenCaptionWidth()- Specified by:
getChildrenCaptionWidth
in interfaceForm
- 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 interfaceForm
- 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 interfaceForm
- 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 interfaceForm
- Parameters:
column
- a column indexwidth
- fixed caption width for column with a given index
-
getChildrenCaptionAlignment
- Specified by:
getChildrenCaptionAlignment
in interfaceForm
- Returns:
- alignment of child component captions
-
setChildrenCaptionAlignment
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 interfaceForm
- Parameters:
alignment
- captions alignment
-
getChildrenCaptionAlignment
Description copied from interface:Form
Returns alignment of child component captions for a column with the given index.- Specified by:
getChildrenCaptionAlignment
in interfaceForm
- Parameters:
column
- a column index to get caption- Returns:
- alignment of child component captions for a column with the given index
-
setChildrenCaptionAlignment
Description copied from interface:Form
Sets alignment of child component captions for a column with the given index.- Specified by:
setChildrenCaptionAlignment
in interfaceForm
- Parameters:
column
- a column index to set captionalignment
- alignment of child component captions for a column with the given index
-
getColumns
public int getColumns()- Specified by:
getColumns
in interfaceForm
- 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 interfaceForm
- 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 interfaceForm
- Parameters:
column
- a column indexflex
- 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 interfaceForm
- Parameters:
column
- a column index- Returns:
- flex layout ratio for column with a given index
-
getValueSourceProvider
- Specified by:
getValueSourceProvider
in interfaceHasValueSourceProvider
-
setValueSourceProvider
- Specified by:
setValueSourceProvider
in interfaceHasValueSourceProvider
-
applyPermission
Description copied from interface:UiPermissionAware
Change state of subcomponent according to thepermissionValue
.- Specified by:
applyPermission
in interfaceUiPermissionAware
- 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 interfaceAttachNotifier
- Overrides:
attached
in classAbstractComponent<JmixFormLayout>
-
detached
public void detached()Description copied from interface:AttachNotifier
Notifies all listeners that component has been detached.- Specified by:
detached
in interfaceAttachNotifier
- Overrides:
detached
in classAbstractComponent<JmixFormLayout>
-