public class UIComponents extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
REQUIRED_STYLE_NAME
HTML Style class for required input components
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addComponentError(UIComponent component,
String errorMessage)
Adds error message to the component.
|
static void |
afterCreate(UIComponent component)
Deprecated.
moved to UIComponentFactoryImpl. Do not call - UIComponentFactoryImpl.afterCreate will be called automatically after the UI component is constructed.
|
static List<UIComponent> |
appendChildren2(UIComponent parent,
Variant.ListVariant<RecordHolder> children)
Populates given parent with child components based on definitions from the given list.
|
static boolean |
areVisible(Set<UIComponent> components) |
static boolean |
fillInSelectItems(com.vaadin.ui.AbstractSelect select,
UIComponentData componentData)
Updates list of items for the given select based on value of the field
UIFieldNames.OPTIONS |
static boolean |
fillInSelectItems(UIComponent component)
Updates list of items for the given select based on value of the field
UIFieldNames.OPTIONS |
static void |
fireAndProcess(UIEvent event)
Fires given event and triggers event processing.
|
static void |
fireAndProcess(UIEvent event,
boolean handleErrorInScreen)
Fires given event and triggers event processing.
|
static List<Variant<RecordHolder>> |
getChildren(Variant.RecordVariant def)
Lists child component definitions from given component definition.
|
static List<UIComponent> |
getChildrenAsUIComponent(com.vaadin.ui.Component c)
Deprecated.
Do not use - not compatible with the new
UIComponent.getWidget() system. All layout components must instead track their children manually. |
static void |
initAndRefreshChildren(List<? extends UIComponent> components,
boolean isFirstLoad)
Initializes all the given components recursively, by firing new
Events.INIT_EVENT_TYPE event for each component, and marks the
components to be refreshed once the init events are processed. |
static void |
initChildren(List<? extends UIComponent> components,
boolean isFirstLoad)
Initializes all the given components recursively, by firing new
Events.INIT_EVENT_TYPE event for each component. |
static boolean |
isShown(UIComponent component)
Checks if the component is displayed on the screen by iterating through
all parents and checking their visibility.
|
static boolean |
isUIComponent(com.vaadin.ui.Component component,
LspsScreen screen) |
static Set<UIComponent> |
refreshRecursively(Collection<? extends UIComponent> components,
Set<UIComponent> refreshedComponents)
Refreshes recursively all of given components and returns
set of all refreshed components.
|
static void |
register(Collection<? extends UIComponent> components)
Registers all the given components recursively.
|
static void |
setComponentRequired(UIComponent component,
boolean required)
Adds required style class (
REQUIRED_STYLE_NAME) and also calls
Vaadin Component.setReadOnly(boolean). |
static String |
toString(Collection<?> components,
int max)
Nice toString for collection of components.
|
static String |
toString(UIComponent component)
Provides standardized "log" format of a component description, in form of
[class UIOutputText] (Enter your name:) #_ayu9283r4jasdasdi7234. |
static void |
unregister(Collection<? extends UIComponent> components)
Unregisters all the given components recursively.
|
static Object |
unwrap(Serializable wrapper)
Unwraps an engine value from its serializable representation.
|
static Serializable |
wrap(Object value,
LspsContextHolder contextHolder)
Makes sure that the passed engine value is serializable.
|
public static final String REQUIRED_STYLE_NAME
public static boolean fillInSelectItems(UIComponent component)
UIFieldNames.OPTIONScomponent - the UI component. Its UIComponent.getWidget() must return AbstractSelect.IllegalArgumentException - if the provided component doesn't implement UIComponent
interfacepublic static boolean fillInSelectItems(com.vaadin.ui.AbstractSelect select,
UIComponentData componentData)
UIFieldNames.OPTIONSselect - the Vaadin AbstractSelect component which will get its items filled incomponentData - fill item according to the UIFieldNames.OPTIONS property.IllegalArgumentException - if the provided component doesn't implement UIComponent
interfacepublic static void setComponentRequired(UIComponent component, boolean required)
REQUIRED_STYLE_NAME) and also calls
Vaadin Component.setReadOnly(boolean).component - required - @Deprecated public static void afterCreate(UIComponent component)
UIComponentFactoryImpl.
DO NOT call this method at the end of its
constructor - otherwise, extending classes will be passed half-initialized here.
If the component implements Field, it's switched to buffered mode
so that conversion/validation of the field value is properly integrated
with the LSPS UI lifecycle.component - public static void register(Collection<? extends UIComponent> components)
components - list of components, not null, may be empty.public static void unregister(Collection<? extends UIComponent> components)
components - list of components, not null, may be empty.public static Set<UIComponent> refreshRecursively(Collection<? extends UIComponent> components, Set<UIComponent> refreshedComponents)
UIComponent.refresh() and ClientConnector.markAsDirty().
Note that all components should be in the same depth in the UI component
tree.components - refresh these components and their descendants (except components already present in the refreshedComponents set).
All components must be initialized or initialization must be started.refreshedComponents - components which have already been refreshed. These components and their descendants will not be refreshed again.
Gradually filled with components from components as they are refreshed.refreshedComponents parameter.IllegalArgumentException - if UIComponentData.isInitializationStarted() returns false for any of the component.public static void initAndRefreshChildren(List<? extends UIComponent> components, boolean isFirstLoad)
Events.INIT_EVENT_TYPE event for each component, and marks the
components to be refreshed once the init events are processed.components - a list of children that should be
initiatedisFirstLoad - value of field UIFieldNames.IS_FIRST_LOAD
of the created init eventpublic static void initChildren(List<? extends UIComponent> components, boolean isFirstLoad)
Events.INIT_EVENT_TYPE event for each component.components - a list of child components that should be
initiatedisFirstLoad - value of field UIFieldNames.IS_FIRST_LOAD
of the created init eventpublic static boolean areVisible(Set<UIComponent> components)
components - components, not null, may be empty.public static boolean isShown(UIComponent component)
component - public static List<UIComponent> appendChildren2(UIComponent parent, Variant.ListVariant<RecordHolder> children)
parent - parent to populate, not null. Must implement the ComponentContainer interface.children - list of child definitions, must not be null. Nothing is done if the variant is absent.IllegalArgumentException - if parent is not instance of AbstractComponentContainerpublic static Serializable wrap(Object value, LspsContextHolder contextHolder)
Variant
while basic values don't need to be wrapped.value - contextHolder - public static Object unwrap(Serializable wrapper)
wrapper - @Deprecated public static List<UIComponent> getChildrenAsUIComponent(com.vaadin.ui.Component c)
UIComponent.getWidget() system. All layout components must instead track their children manually.UIComponentContainer.getChildUIComponents() even
if given components implements the interface.c - the component, not null.ComponentContainer interface.ClassCastException - if some child does not implement the UIComponent interface.public static List<Variant<RecordHolder>> getChildren(Variant.RecordVariant def)
def - the component definition, not null, must be present. The record type must extend ui::Componentpublic static void fireAndProcess(UIEvent event)
LspsFormConnector.handleError(Throwable) is invoked.
The exception is not propagated from this method.event - the event, not null.public static void fireAndProcess(UIEvent event, boolean handleErrorInScreen)
event - the event, not null.handleErrorInScreen - if true and the event processing fails,
the component is marked as errorneous and the LspsFormConnector.handleError(Throwable) is invoked;
the exception is not propagated from this method. If false, the exception is propagated outside of this method.public static void addComponentError(UIComponent component, String errorMessage)
component - the component, not null.errorMessage - the error message, not null, html-formatted. The message must be localized properly beforehand.public static String toString(UIComponent component)
[class UIOutputText] (Enter your name:) #_ayu9283r4jasdasdi7234.component - the component, not null.public static String toString(Collection<?> components, int max)
max components in collection are converted to string
and added to result. The amount of remaining components is added to the end.components - max - public static boolean isUIComponent(com.vaadin.ui.Component component,
LspsScreen screen)
component - screen - Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.