Package io.jmix.ui.component
Class CompositeComponent<T extends Component>
java.lang.Object
io.jmix.ui.component.CompositeComponent<T>
- All Implemented Interfaces:
- AttachNotifier,- Component,- Component.BelongToFrame,- HasDebugId,- HasHtmlSanitizer
- Direct Known Subclasses:
- AbstractSingleFilterComponent,- DashboardImpl,- DynamicAttributesPanel,- FilterImpl,- GroupFilterImpl,- NotificationsIndicatorImpl,- UserIndicatorImpl
public class CompositeComponent<T extends Component>
extends Object
implements Component, Component.BelongToFrame, AttachNotifier, HasDebugId, HasHtmlSanitizer
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classAn Event that is fired right before the composite component instance is returned byUiComponentsbean.Nested classes/interfaces inherited from interface io.jmix.ui.component.ComponentComponent.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected Frameprotected Stringprotected Stringprotected TFields inherited from interface io.jmix.ui.component.ComponentAUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddAttachListener(Consumer<AttachEvent> listener) Registers a new attached listener.protected SubscriptionRegisters a newCompositeComponent.CreateEventlistener.addDetachListener(Consumer<DetachEvent> listener) Registers a new detached listener.voidaddStyleName(String styleName) Adds one or more style names to this component.protected voidvoidattached()Notifies all listeners that component has been attached.voiddetached()Notifies all listeners that component has been detached.protected voidprotected voidReturns the root component that represents the component tree of the composite component.protected TReturns the root component that represents the component tree of the composite component.protected EventHubgetFrame()protected StringfloatGet component height inComponent.getHeightSizeUnit()Gets the height property units.getId()Component ID as defined inidattributeprotected <C> CReturns an inner component belonging to the whole components tree below this composition.protected <C> Optional<C>Returns an inner component belonging to the whole components tree below this composition.protected StringStyles implementation is client-type-specific.protected List<org.springframework.context.ApplicationListener>floatgetWidth()Get component width inComponent.getWidthSizeUnit()Gets the width property units.protected booleanhasSubscriptions(Class<?> eventClass) booleanbooleanIs the component enabled?
 Note that this method only returns the status of the component and does not take parents into account.booleanbooleanbooleanIs the component responsive?booleanIs the component visible?
 A component is visible only if all its parents are also visible.booleanprotected <E> voidvoidremoveStyleName(String styleName) Removes one or more style names from component.voidsetAlignment(Component.Alignment alignment) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) protected voidsetComposition(T composition) Sets the root component that represents the component hierarchy of the composite component.voidsetDebugId(String id) INTERNAL.voidsetEnabled(boolean enabled) Sets the component enabled state.voidvoidSet component height inComponent.getHeightSizeUnit()voidsetHtmlSanitizerEnabled(boolean htmlSanitizerEnabled) Sets whether html sanitizer is enabled or not.voidSet component IDvoidINTERNAL.
 ComponentContainer.add(Component)is normally used for adding components to a parent and the used method will call this method implicitly.voidsetResponsive(boolean responsive) Sets component to be responsive by width and height.voidsetStyleName(String styleName) Sets one or more style names of the component, replacing any previous styles.protected voidsetUiEventListeners(List<org.springframework.context.ApplicationListener> uiEventListeners) voidsetVisible(boolean visible) Sets visibility value for the component.voidSet component width inComponent.getWidthSizeUnit()}protected <E> booleanunsubscribe(Class<E> eventType, Consumer<E> listener) <X> XGet client specific component instance.<X> XunwrapComposition(Class<X> internalCompositionClass) Get the outmost external container of client specific component instance.<X> XunwrapCompositionOrNull(Class<X> internalCompositionClass) Get the outmost external container of client specific component instance.<X> XunwrapOrNull(Class<X> internalComponentClass) Get client specific component instance.protected voidupdateComponentIds(T composition) protected voidupdateIdIfNeeded(Component component) <X> voidwithUnwrapped(Class<X> internalComponentClass, Consumer<X> action) Performs the givenactionwith underlying component if it can be casted to the giveninternalComponentClass.<X> voidwithUnwrappedComposition(Class<X> internalCompositionClass, Consumer<X> action) Get the outmost external container of client specific component instance and performs the givenaction.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.jmix.ui.component.ComponentsetHeightAuto, setHeightFull, setSizeAuto, setSizeFull, setWidthAuto, setWidthFull
- 
Field Details- 
id
- 
root
- 
frame
- 
prefixId
- 
applicationContextprotected org.springframework.context.ApplicationContext applicationContext
 
- 
- 
Constructor Details- 
CompositeComponentpublic CompositeComponent()
 
- 
- 
Method Details- 
setApplicationContext@Autowired public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) 
- 
getEventHub
- 
publish
- 
hasSubscriptions
- 
unsubscribe
- 
getCompositionReturns the root component that represents the component tree of the composite component.- Returns:
- the root component that represents the component tree of the composite component
 
- 
getCompositionOrNullReturns the root component that represents the component tree of the composite component.- Returns:
- the root component that represents the component tree of the composite component
 or nullif not yet initialized
- See Also:
 
- 
getInnerComponentReturns an inner component belonging to the whole components tree below this composition.- Parameters:
- id- the id of a component
- Returns:
- found component
- Throws:
- IllegalArgumentException- if no component is found with given id
- IllegalStateException- if the root component can't contain inner components
- See Also:
 
- 
getInnerComponentOptionalReturns an inner component belonging to the whole components tree below this composition.- Parameters:
- id- the id of a component
- Returns:
- found component or nullif no component is found
- Throws:
- IllegalStateException- if the root component can't contain inner components
- See Also:
 
- 
setCompositionSets the root component that represents the component hierarchy of the composite component.- Parameters:
- composition- a component to set as the root
- Throws:
- IllegalStateException- if the root component is already set
 
- 
updateComponentIds
- 
updateIdIfNeeded
- 
getFullId
- 
getPrefixId
- 
getIdDescription copied from interface:ComponentComponent ID as defined inidattribute
- 
setIdDescription copied from interface:ComponentSet component ID
- 
assignDebugIdprotected void assignDebugId()
- 
getDebugId- Specified by:
- getDebugIdin interface- HasDebugId
 
- 
setDebugIdDescription copied from interface:HasDebugIdINTERNAL. Managed by debug Id system.- Specified by:
- setDebugIdin interface- HasDebugId
 
- 
getParent
- 
setParentDescription copied from interface:ComponentINTERNAL.
 ComponentContainer.add(Component)is normally used for adding components to a parent and the used method will call this method implicitly.
- 
isAttachedpublic boolean isAttached()- Specified by:
- isAttachedin interface- AttachNotifier
- Returns:
- whether a component is attached to a window
 
- 
attachedpublic void attached()Description copied from interface:AttachNotifierNotifies all listeners that component has been attached.- Specified by:
- attachedin interface- AttachNotifier
 
- 
detachedpublic void detached()Description copied from interface:AttachNotifierNotifies all listeners that component has been detached.- Specified by:
- detachedin interface- AttachNotifier
 
- 
addAttachListenerDescription copied from interface:AttachNotifierRegisters a new attached listener.- Specified by:
- addAttachListenerin interface- AttachNotifier
- Parameters:
- listener- a listener to add
- Returns:
- a registration object for removing an event listener added to a source
 
- 
addDetachListenerDescription copied from interface:AttachNotifierRegisters a new detached listener.- Specified by:
- addDetachListenerin interface- AttachNotifier
- Parameters:
- listener- a listener to add
- Returns:
- a registration object for removing an event listener added to a source
 
- 
isEnabledpublic boolean isEnabled()Description copied from interface:ComponentIs the component enabled?
 Note that this method only returns the status of the component and does not take parents into account. Even though this method returns true the component can be disabled to the user if a parent is disabled.
- 
setEnabledpublic void setEnabled(boolean enabled) Description copied from interface:ComponentSets the component enabled state.
 The user can not interact with disabled components, which are shown with a style that indicates the status. Components are enabled by default.- Specified by:
- setEnabledin interface- Component
- Parameters:
- enabled- enabled flag
 
- 
isResponsivepublic boolean isResponsive()Description copied from interface:ComponentIs the component responsive?- Specified by:
- isResponsivein interface- Component
- Returns:
- true if the component applies conditional CSS rules for width / height sizes.
 
- 
setResponsivepublic void setResponsive(boolean responsive) Description copied from interface:ComponentSets component to be responsive by width and height.
 If responsive flag is true then you can use conditional CSS rules that respond to size changes in the browser. You can set specific rules using "width-range" or "height-range" properties in CSS files.- Specified by:
- setResponsivein interface- Component
- Parameters:
- responsive- responsive flag
 
- 
isVisiblepublic boolean isVisible()Description copied from interface:ComponentIs the component visible?
 A component is visible only if all its parents are also visible. This is not checked by this method though, so even if this method returns true, the component can be hidden from the user because a parent is set to invisible.
- 
setVisiblepublic void setVisible(boolean visible) Description copied from interface:ComponentSets visibility value for the component.
 Visible components are drawn in the user interface, while invisible ones are not. The effect is not a cosmetic CSS change - no information about an invisible component will be sent to the client. The effect is thus the same as removing the component from its parent.- Specified by:
- setVisiblein interface- Component
- Parameters:
- visible- visible flag
 
- 
isVisibleRecursivepublic boolean isVisibleRecursive()- Specified by:
- isVisibleRecursivein interface- Component
- Returns:
- true if the component and all its parent components are visible
 
- 
isEnabledRecursivepublic boolean isEnabledRecursive()- Specified by:
- isEnabledRecursivein interface- Component
- Returns:
- true if the component and all its parent components are enabled
 
- 
getHeightpublic float getHeight()Description copied from interface:ComponentGet component height inComponent.getHeightSizeUnit()
- 
getHeightSizeUnitDescription copied from interface:ComponentGets the height property units.- Specified by:
- getHeightSizeUnitin interface- Component
- Returns:
- units used in height property.
 
- 
setHeightDescription copied from interface:ComponentSet component height inComponent.getHeightSizeUnit()
- 
getWidthpublic float getWidth()Description copied from interface:ComponentGet component width inComponent.getWidthSizeUnit()
- 
getWidthSizeUnitDescription copied from interface:ComponentGets the width property units.- Specified by:
- getWidthSizeUnitin interface- Component
- Returns:
- units used in the width property.
 
- 
setWidthDescription copied from interface:ComponentSet component width inComponent.getWidthSizeUnit()}
- 
getAlignment- Specified by:
- getAlignmentin interface- Component
 
- 
setAlignment- Specified by:
- setAlignmentin interface- Component
 
- 
getStyleNameDescription copied from interface:ComponentStyles implementation is client-type-specific.- Specified by:
- getStyleNamein interface- Component
- Returns:
- current style name.
 
- 
setStyleNameDescription copied from interface:ComponentSets one or more style names of the component, replacing any previous styles. Multiple styles can be specified as a space-separated list of style names. Styles implementation is client-type-specific.- Specified by:
- setStyleNamein interface- Component
- Parameters:
- styleName- one or more style names separated by space.
 
- 
addStyleNameDescription copied from interface:ComponentAdds one or more style names to this component. Multiple styles can be specified as a space-separated list of style names.- Specified by:
- addStyleNamein interface- Component
- Parameters:
- styleName- one or more style names separated by space.
 
- 
removeStyleNameDescription copied from interface:ComponentRemoves one or more style names from component. Multiple styles can be specified as a space-separated list of style names.- Specified by:
- removeStyleNamein interface- Component
- Parameters:
- styleName- one or more style names separated by space.
 
- 
unwrapDescription copied from interface:ComponentGet client specific component instance. Can be used in client module to simplify invocation of underlying API.
 Example:com.vaadin.ui.TextField vTextField = textField.unwrap(com.vaadin.ui.TextField.class); 
- 
unwrapOrNullDescription copied from interface:ComponentGet client specific component instance. Can be used in client module to simplify invocation of underlying API.
 Returnsnullif underlying component cannot be casted to the giveninternalComponentClass. Example:com.vaadin.ui.TextField vTextField = textField.unwrapOrNull(com.vaadin.ui.TextField.class); - Specified by:
- unwrapOrNullin interface- Component
- Type Parameters:
- X- type of internal class
- Parameters:
- internalComponentClass- class of underlying component implementation based on Vaadin or Swing
- Returns:
- internal client specific component or null if it cannot be casted to given class
 
- 
withUnwrappedDescription copied from interface:ComponentPerforms the givenactionwith underlying component if it can be casted to the giveninternalComponentClass. Example:textField.withUnwrapped(com.vaadin.ui.TextField.class, vTextField -> { // do something });- Specified by:
- withUnwrappedin interface- Component
- Type Parameters:
- X- type of internal class
- Parameters:
- internalComponentClass- class of underlying component implementation based on Vaadin or Swing
- action- action to perform if underlying component can be casted to given class
 
- 
unwrapCompositionDescription copied from interface:ComponentGet the outmost external container of client specific component instance. Can be used in client module to simplify invocation of underlying API.
 Example:com.vaadin.ui.Layout vLayout = table.unwrapComposition(com.vaadin.ui.Layout.class); - Specified by:
- unwrapCompositionin interface- Component
- Type Parameters:
- X- type of internal class
- Parameters:
- internalCompositionClass- class of underlying composition implementation based on Vaadin or Swing
- Returns:
- internal client specific component
 
- 
unwrapCompositionOrNullDescription copied from interface:ComponentGet the outmost external container of client specific component instance. Can be used in client module to simplify invocation of underlying API.
 Returns null if composition cannot be casted to giveninternalCompositionClass. Example:com.vaadin.ui.Layout vLayout = table.unwrapCompositionOrNull(com.vaadin.ui.Layout.class); - Specified by:
- unwrapCompositionOrNullin interface- Component
- Type Parameters:
- X- type of internal class
- Parameters:
- internalCompositionClass- class of underlying composition implementation based on Vaadin or Swing
- Returns:
- internal client specific component or null if cannot be casted to given class
 
- 
withUnwrappedCompositionDescription copied from interface:ComponentGet the outmost external container of client specific component instance and performs the givenaction.
 Can be used in client module to simplify invocation of underlying API.
 Example:table.withUnwrappedComposition(com.vaadin.ui.Layout.class, vLayout -> { // do something });- Specified by:
- withUnwrappedCompositionin interface- Component
- Type Parameters:
- X- type of internal class
- Parameters:
- internalCompositionClass- class of underlying composition implementation based on Vaadin or Swing
- action- to perform if underlying composition can be casted to given class
 
- 
getFrame- Specified by:
- getFramein interface- Component.BelongToFrame
 
- 
setFrame- Specified by:
- setFramein interface- Component.BelongToFrame
 
- 
isHtmlSanitizerEnabledpublic boolean isHtmlSanitizerEnabled()- Specified by:
- isHtmlSanitizerEnabledin interface- HasHtmlSanitizer
- Returns:
- html sanitizer is enabled
 
- 
setHtmlSanitizerEnabledpublic void setHtmlSanitizerEnabled(boolean htmlSanitizerEnabled) Description copied from interface:HasHtmlSanitizerSets whether html sanitizer is enabled or not.- Specified by:
- setHtmlSanitizerEnabledin interface- HasHtmlSanitizer
- Parameters:
- htmlSanitizerEnabled- specifies whether html sanitizer is enabled
 
- 
addCreateListenerRegisters a newCompositeComponent.CreateEventlistener.- Parameters:
- listener- a listener to add
- Returns:
- a registration object for removing an event listener added to a source
 
- 
getUiEventListeners
- 
setUiEventListenersprotected void setUiEventListeners(List<org.springframework.context.ApplicationListener> uiEventListeners) 
- 
enableEventListenersprotected void enableEventListeners()
- 
disableEventListenersprotected void disableEventListeners()
 
-