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.WrapperNested classes/interfaces inherited from interface io.jmix.ui.component.EditableChangeNotifier
EditableChangeNotifier.EditableChangeEventNested classes/interfaces inherited from interface io.jmix.ui.component.Form
Form.CaptionAlignmentNested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEventNested classes/interfaces inherited from interface io.jmix.ui.component.SupportsCaptionPosition
SupportsCaptionPosition.CaptionPosition -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<List<ComponentPosition>>protected booleanprotected ValueSourceProviderFields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parentFields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a component to the first column.voidAdds a component to the column with the given index.voidAdds a component to a column with the given index to the given position.voidAdds a component to a column with the given index with the given span.voidAdds a component to a column with the given index to the given position with the given span.protected voidaddComponentInternal(Component childComponent, int column, int row, int colSpan, int rowSpan) Adds a listener that is invoked when theeditableproperty changes.protected voidapplyDefaults(Component childComponent) voidapplyPermission(UiPermissionDescriptor permissionDescriptor) Change state of subcomponent according to thepermissionValue.protected voidassignDebugId(com.vaadin.ui.Component composition, String id) protected voidassignTypicalAttributes(Component component) voidattached()Notifies all listeners that component has been attached.protected List<ComponentArea>protected intcalculateInsertIndex(int column, int row, List<ComponentPosition> componentPositions) protected voidcheckExistingOverlaps(int startColumn, int startRow, int colSpan, int rowSpan) protected JmixFormLayoutvoiddetached()Notifies all listeners that component has been detached.protected intprotected intdetectRowsCount(int column) protected intdetectRowsCount(int column, boolean isCheckAreas) protected intdetectStartRowIndex(int column) protected voidfillSpanMatrix(boolean[][] spanMatrix, int col, int row, int colspan, int rowspan) protected ComponentAreafindComponentArea(List<ComponentArea> componentAreas, ComponentPosition position) protected ComponentPositionfindComponentPosition(List<ComponentPosition> components, Component component) getChildrenCaptionAlignment(int column) Returns alignment of child component captions for a column with the given index.intintgetChildrenCaptionWidth(int column) Returns fixed caption width for column with a given index.floatgetColumnFlex(int column) Returns the flex layout ratio for column with a given index.intgetComponent(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.booleanprotected voidmanagedComponentAssigned(Component childComponent) protected voidvoidRemoves a component from this container.voidRemoves all components from this container.voidsetCaptionPosition(SupportsCaptionPosition.CaptionPosition captionAlignment) Sets caption position of form child components.voidsetChildrenCaptionAlignment(int column, Form.CaptionAlignment alignment) Sets alignment of child component captions for a column with the given index.voidsetChildrenCaptionAlignment(Form.CaptionAlignment alignment) Sets alignment of child component captions in all columns.voidsetChildrenCaptionWidth(int width) Sets fixed captions width for all columns.voidsetChildrenCaptionWidth(int column, int width) Set fixed captions width for column with a given index.voidsetColumnFlex(int column, float flex) Sets flex layout ratio for column with a given index.voidsetColumns(int columns) Sets the number of columns in the Form.voidsetDebugId(String id) INTERNAL.voidsetEditable(boolean editable) voidsetValueSourceProvider(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, withUnwrappedCompositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, withUnwrappedCompositionMethods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrameMethods inherited from interface io.jmix.ui.component.Component.Editable
isEditableWithParentMethods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaptionMethods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescriptionMethods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSetMethods inherited from interface io.jmix.ui.component.ComponentContainer
removeMethods inherited from interface io.jmix.ui.component.HasComponents
focusFirstComponent, getComponentNNMethods inherited from interface io.jmix.ui.component.HasContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabledMethods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtmlMethods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtmlMethods 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:HasDebugIdINTERNAL. Managed by debug Id system.- Specified by:
setDebugIdin interfaceHasDebugId- Overrides:
setDebugIdin classAbstractComponent<JmixFormLayout>
-
isEditable
public boolean isEditable()- Specified by:
isEditablein interfaceComponent.Editable
-
setEditable
public void setEditable(boolean editable) - Specified by:
setEditablein interfaceComponent.Editable
-
addEditableChangeListener
public Subscription addEditableChangeListener(Consumer<EditableChangeNotifier.EditableChangeEvent> listener) Description copied from interface:EditableChangeNotifierAdds a listener that is invoked when theeditableproperty changes.- Specified by:
addEditableChangeListenerin interfaceEditableChangeNotifier- Parameters:
listener- a listener to add- Returns:
- a registration object for removing an event listener
-
add
Description copied from interface:FormAdds a component to the first column.- Specified by:
addin interfaceComponentContainer- Specified by:
addin interfaceForm- Parameters:
childComponent- a component to add
-
add
Description copied from interface:FormAdds a component to the column with the given index. -
add
Description copied from interface:FormAdds a component to a column with the given index with the given span. -
add
Description copied from interface:FormAdds a component to a column with the given index to the given position. -
add
Description copied from interface:FormAdds 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:ComponentContainerRemoves a component from this container.- Specified by:
removein 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:ComponentContainerRemoves all components from this container.- Specified by:
removeAllin interfaceComponentContainer
-
getOwnComponent
Description copied from interface:HasComponentsGets component directly owned by this container.- Specified by:
getOwnComponentin interfaceHasComponents- Returns:
- component or null if not found
-
getComponent
Description copied from interface:HasComponentsGets a component belonging to the whole components tree below this container.- Specified by:
getComponentin interfaceHasComponents- Returns:
- component or null if not found
-
getOwnComponents
Description copied from interface:HasComponentsGets all components directly owned by this container.- Specified by:
getOwnComponentsin interfaceHasComponents- Returns:
- all components directly owned by this container
-
getOwnComponentsStream
Description copied from interface:HasComponentsGets stream of all components directly owned by this container.- Specified by:
getOwnComponentsStreamin interfaceHasComponents- Returns:
- stream of all components directly owned by this container
-
getComponents
Description copied from interface:HasComponentsGets all components belonging to the whole components tree below this container.- Specified by:
getComponentsin interfaceHasComponents- Returns:
- all components belonging to the whole components tree below this container
-
getComponents
- Specified by:
getComponentsin interfaceForm- Parameters:
column- a column index- Returns:
- a collection of components directly owned by a column with a given index
-
getComponent
- Specified by:
getComponentin 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:
getCaptionPositionin interfaceForm- Specified by:
getCaptionPositionin interfaceSupportsCaptionPosition- Returns:
- caption position of form child components
-
setCaptionPosition
Description copied from interface:FormSets 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:
setCaptionPositionin interfaceForm- Specified by:
setCaptionPositionin interfaceSupportsCaptionPosition- Parameters:
captionAlignment- component caption position
-
getChildrenCaptionWidth
public int getChildrenCaptionWidth()- Specified by:
getChildrenCaptionWidthin interfaceForm- Returns:
- columns fixed caption width
-
setChildrenCaptionWidth
public void setChildrenCaptionWidth(int width) Description copied from interface:FormSets fixed captions width for all columns. Set -1 to use auto size.- Specified by:
setChildrenCaptionWidthin interfaceForm- Parameters:
width- fixed caption width
-
getChildrenCaptionWidth
public int getChildrenCaptionWidth(int column) Description copied from interface:FormReturns fixed caption width for column with a given index.- Specified by:
getChildrenCaptionWidthin 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:FormSet fixed captions width for column with a given index. Set -1 to use auto size.- Specified by:
setChildrenCaptionWidthin interfaceForm- Parameters:
column- a column indexwidth- fixed caption width for column with a given index
-
getChildrenCaptionAlignment
- Specified by:
getChildrenCaptionAlignmentin interfaceForm- Returns:
- alignment of child component captions
-
setChildrenCaptionAlignment
Description copied from interface:FormSets alignment of child component captions in all columns.Applicable only when captions position is
SupportsCaptionPosition.CaptionPosition.LEFT.- Specified by:
setChildrenCaptionAlignmentin interfaceForm- Parameters:
alignment- captions alignment
-
getChildrenCaptionAlignment
Description copied from interface:FormReturns alignment of child component captions for a column with the given index.- Specified by:
getChildrenCaptionAlignmentin 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:FormSets alignment of child component captions for a column with the given index.- Specified by:
setChildrenCaptionAlignmentin 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:
getColumnsin interfaceForm- Returns:
- number of columns in the Form
-
setColumns
public void setColumns(int columns) Description copied from interface:FormSets 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:
setColumnsin interfaceForm- Parameters:
columns- the new number of columns in the Form
-
setColumnFlex
public void setColumnFlex(int column, float flex) Description copied from interface:FormSets flex layout ratio for column with a given index.- Specified by:
setColumnFlexin interfaceForm- Parameters:
column- a column indexflex- the flex ration for the column
-
getColumnFlex
public float getColumnFlex(int column) Description copied from interface:FormReturns the flex layout ratio for column with a given index.- Specified by:
getColumnFlexin interfaceForm- Parameters:
column- a column index- Returns:
- flex layout ratio for column with a given index
-
getValueSourceProvider
- Specified by:
getValueSourceProviderin interfaceHasValueSourceProvider
-
setValueSourceProvider
- Specified by:
setValueSourceProviderin interfaceHasValueSourceProvider
-
applyPermission
Description copied from interface:UiPermissionAwareChange state of subcomponent according to thepermissionValue.- Specified by:
applyPermissionin 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:AttachNotifierNotifies all listeners that component has been attached.- Specified by:
attachedin interfaceAttachNotifier- Overrides:
attachedin classAbstractComponent<JmixFormLayout>
-
detached
public void detached()Description copied from interface:AttachNotifierNotifies all listeners that component has been detached.- Specified by:
detachedin interfaceAttachNotifier- Overrides:
detachedin classAbstractComponent<JmixFormLayout>
-