Class ComponentUtilsKt
-
- All Implemented Interfaces:
public final class ComponentUtilsKt
-
-
Field Summary
Fields Modifier and Type Field Description private static StringtextAlignprivate static Stringtooltipprivate final static DataProvider<?, ?>dataProviderprivate final static LocationcurrentViewLocationprivate final static BooleanhasChildrenprivate static Stringplaceholderprivate final static Stringlabelprivate static Stringlabelprivate static Stringcaptionprivate static Stringcaption
-
Method Summary
Modifier and Type Method Description StringgetTextAlign()voidsetTextAlign(String textAlign)StringgetTooltip()voidsetTooltip(String tooltip)final DataProvider<?, ?>getDataProvider()final LocationgetCurrentViewLocation()final BooleangetHasChildren()StringgetPlaceholder()voidsetPlaceholder(String placeholder)final StringgetLabel()StringgetLabel()voidsetLabel(String label)StringgetCaption()voidsetCaption(@Deprecated(message = "don't use") String caption)StringgetCaption()voidsetCaption(String caption)final static UnitfireEvent(Component $self, ComponentEvent<?> event)Fires given event on the component. final static <T extends ClickNotifier<?>> UnitserverClick(T $self, Boolean fromClient, Integer button, Integer clickCount, Boolean shiftKey, Boolean ctrlKey, Boolean altKey, Boolean metaKey)Adds com.vaadin.flow.component.button.Button.click functionality to all ClickNotifiers. final static DomListenerRegistrationaddContextMenuListener(Component $self, DomEventListener listener)Adds the right-click (context-menu) listener to the component. final static DomListenerRegistrationpreventDefault(DomListenerRegistration $self)Makes the client-side listener call Event.preventDefault() on the event. final static UnitremoveFromParent(Component $self)Removes the component from its parent. final static ComponentfindAncestor(Component $self, Function1<Component, Boolean> predicate)Finds component's parent, parent's parent (etc) which satisfies given predicate. final static ComponentfindAncestorOrSelf(Component $self, Function1<Component, Boolean> predicate)Finds component, component's parent, parent's parent (etc) which satisfies given predicate. final static BooleanisNestedIn(Component $self, Component potentialAncestor)Checks if this component is nested in potentialAncestor. final static BooleanisAttached(Component $self)Checks whether this component is currently attached to a UI. final static UnitinsertBefore(HasOrderedComponents $self, Component newComponent, Component existing)Inserts this component as a child, right before an existing one. final static UnitaddClassNames2(HasStyle $self, String classNames)Splits classNames by whitespaces to obtain individual class names, then calls HasStyle.addClassName on each class name. final static UnitaddClassNames2(HasStyle $self, String classNames)Splits classNames by whitespaces to obtain individual class names, then calls addClassNames2 on each class name. final static UnitremoveClassNames2(HasStyle $self, String classNames)Splits classNames by whitespaces to obtain individual class names, then calls HasStyle.removeClassName on each class name. final static UnitremoveClassNames2(HasStyle $self, String classNames)Splits classNames by whitespaces to obtain individual class names, then calls removeClassNames2 on each class name. final static UnitsetClassNames2(HasStyle $self, String classNames)Splits classNames by whitespaces to obtain individual class names, then clears the class names and calls addClassNames2 on each class name. final static UnitsetClassNames2(HasStyle $self, String classNames)Splits classNames by whitespaces to obtain individual class names, then clears the class names and calls addClassNames2 on each class name. -
-
Method Detail
-
getTextAlign
String getTextAlign()
-
setTextAlign
void setTextAlign(String textAlign)
-
getTooltip
String getTooltip()
-
setTooltip
void setTooltip(String tooltip)
-
getDataProvider
final DataProvider<?, ?> getDataProvider()
-
getCurrentViewLocation
final Location getCurrentViewLocation()
-
getHasChildren
final Boolean getHasChildren()
-
getPlaceholder
String getPlaceholder()
-
setPlaceholder
void setPlaceholder(String placeholder)
-
getCaption
String getCaption()
-
setCaption
void setCaption(@Deprecated(message = "don't use") String caption)
-
getCaption
String getCaption()
-
setCaption
void setCaption(String caption)
-
fireEvent
final static Unit fireEvent(Component $self, ComponentEvent<?> event)
Fires given event on the component.
-
serverClick
final static <T extends ClickNotifier<?>> Unit serverClick(T $self, Boolean fromClient, Integer button, Integer clickCount, Boolean shiftKey, Boolean ctrlKey, Boolean altKey, Boolean metaKey)
Adds com.vaadin.flow.component.button.Button.click functionality to all ClickNotifiers. This function directly calls all click listeners, thus it avoids the roundtrip to client and back. It even works with browserless testing.
- Parameters:
fromClient- see ComponentEvent.isFromClient, defaults to true.button- see ClickEvent.getButton, defaults to 0.clickCount- see ClickEvent.getClickCount, defaults to 1.
-
addContextMenuListener
final static DomListenerRegistration addContextMenuListener(Component $self, DomEventListener listener)
Adds the right-click (context-menu) listener to the component. Also causes the right-click browser menu not to be shown on this component (see preventDefault).
-
preventDefault
final static DomListenerRegistration preventDefault(DomListenerRegistration $self)
Makes the client-side listener call Event.preventDefault() on the event.
- Returns:
this
-
removeFromParent
final static Unit removeFromParent(Component $self)
Removes the component from its parent. Does nothing if the component is not attached to a parent.
-
findAncestor
final static Component findAncestor(Component $self, Function1<Component, Boolean> predicate)
Finds component's parent, parent's parent (etc) which satisfies given predicate. Returns null if there is no such parent.
-
findAncestorOrSelf
final static Component findAncestorOrSelf(Component $self, Function1<Component, Boolean> predicate)
Finds component, component's parent, parent's parent (etc) which satisfies given predicate. Returns null if no component on the ancestor-or-self axis satisfies.
-
isNestedIn
final static Boolean isNestedIn(Component $self, Component potentialAncestor)
Checks if this component is nested in potentialAncestor.
-
isAttached
final static Boolean isAttached(Component $self)
Checks whether this component is currently attached to a UI.
Returns true for attached components even if the UI itself is closed.
-
insertBefore
final static Unit insertBefore(HasOrderedComponents $self, Component newComponent, Component existing)
Inserts this component as a child, right before an existing one.
In case the specified component has already been added to another parent, it will be removed from there and added to this one.
-
addClassNames2
final static Unit addClassNames2(HasStyle $self, String classNames)
Splits classNames by whitespaces to obtain individual class names, then calls HasStyle.addClassName on each class name. Does nothing if the string is blank.
-
addClassNames2
final static Unit addClassNames2(HasStyle $self, String classNames)
Splits classNames by whitespaces to obtain individual class names, then calls addClassNames2 on each class name. Does nothing if the string is blank.
-
removeClassNames2
final static Unit removeClassNames2(HasStyle $self, String classNames)
Splits classNames by whitespaces to obtain individual class names, then calls HasStyle.removeClassName on each class name. Does nothing if the string is blank.
-
removeClassNames2
final static Unit removeClassNames2(HasStyle $self, String classNames)
Splits classNames by whitespaces to obtain individual class names, then calls removeClassNames2 on each class name. Does nothing if the string is blank.
-
setClassNames2
final static Unit setClassNames2(HasStyle $self, String classNames)
Splits classNames by whitespaces to obtain individual class names, then clears the class names and calls addClassNames2 on each class name. Does nothing if the string is blank.
-
setClassNames2
final static Unit setClassNames2(HasStyle $self, String classNames)
Splits classNames by whitespaces to obtain individual class names, then clears the class names and calls addClassNames2 on each class name. Does nothing if the string is blank.
-
-
-
-