public interface LspsScreen extends Serializable
Interface for rendering screens based on LSPS forms. A screen can be understood as a representation of a form which is placed in the Vaadin UI. It defines a contract between the Vaadin UI and the form in term of lifecycle methods:
In addition to that it provides services to form components rendered in the screen. The services allows the components to integrate with the event processing, garbage collection, component scopes, ...In terms of rendering the screen can be viewed as a sandbox. Components contained in the screen should not make any attempt to change the component tree or state of components outside the screen.
The relation between the screen and the rest of the application can be depicted as follows:
+---------------------------------------------------------+ | Browser Window | +---------------------------------------------------------+ | Application | | | | +-----------------------------------+ | | +--------+ | LspsScreen | | | | Menu | | | | | |........| | | | | |........| | | | | |........| | | | | |........| | | | | |........| | | | | |........| | | | | |........| | | | | |........| | | | | +--------+ | | | | | | | | +-----------------------------------+ | +---------------------------------------------------------+
LspsContextHolder
,
LspsFormConnector
,
LspsAppConnector
Modifier and Type | Method and Description |
---|---|
void |
addComponentToRefresh(UIComponent component)
Schedules a component to be refreshed during next call to
triggerEventProcessing(com.whitestein.lsps.vaadin.ui.events.UIEvent) . |
void |
addUploadedBinaryData(long binaryDataId)
Adds a temporary file to the list of files to be deleted once the screen is closed.
|
void |
cleanup()
Called after the screen content is removed from the Vaadin UI or submitted.
|
UIComponent |
createUIComponent(UIComponent parent,
RecordHolder componentDefinition,
UIComponentScope scope)
Creates a Vaadin component based on the provided component definition.
|
void |
fireApplicationEvent(UIApplicationEvent appEvent)
Schedules given application event to be fired on all registered components that have an application event listener.
|
void |
fireBrowserWindowResizeEvent(Dimension dimension)
A browser window resize has been detected.
|
Set<UIComponent> |
getAllComponents()
Returns all components contained in this screen.
|
Set<UIComponent> |
getComponentsForDefinition(RecordHolder componentDefinition,
UIComponent scopeComponent)
Returns all component instances for the given component definition,
visible from the scope of the given component.
|
LspsContextHolder |
getContextHolder()
Returns the the LSPS context which produced this screen.
|
UIComponentScope |
getRootScope()
Returns the root scope.
|
ContextWrapper |
getScreenContext()
Returns the "0:1" execution context for the screen.
|
UIComponent |
getTopmostComponent()
Returns the topmost component.
|
Set<ValueHolder> |
getValuesToRetain()
Returns the set of value holders that should not be garbage collected
even if they are not referenced from any variables in the model.
|
boolean |
isInvalid(UIComponent component)
Checks whether given component is marked as invalid, by calling
markComponentAsInvalid(com.whitestein.lsps.vaadin.ui.components.UIComponent) . |
void |
markComponentAsInvalid(UIComponent component)
Marks the component as invalid.
|
void |
markComponentAsValid(UIComponent component)
Marks the component as valid again.
|
void |
registerUIComponent(UIComponent component)
Register the given UI component and its children in this screen.
|
void |
registerValueToRetain(Handle handle)
Registers the value for the given handle as one to be kept during garbage collection.
|
com.vaadin.ui.Component |
render()
Called when the screen content should be added to the Vaadin UI.
|
void |
resume()
Called after the screen component has been added to Vaadin UI.
|
boolean |
triggerEventProcessing(UIEvent triggeringEvent)
Process all events in the queue - invokes standard LSPS ui lifecycle
|
void |
unregisterUIComponent(UIComponent component)
Unregister the given UI component and its children from this screen.
|
void |
unregisterValueToRetain(Handle handle)
Unregisters the value for the given handle as one to be kept during garbage collection.
|
void |
updateContextFor(UIComponentData componentData)
Updates context dependent variables for the given
componentData . |
com.vaadin.ui.Component render()
resume()
method is called after this method.
This method must be called exactly once.IllegalStateException
- if the screen is already rendered or it has been cleaned up (cleanup()
).void resume()
render()
method has already been calledIllegalStateException
- if render()
was not yet called on this instance.void cleanup()
void registerValueToRetain(Handle handle)
getValuesToRetain()
.handle
- a handle to the model object, not null.void unregisterValueToRetain(Handle handle)
getValuesToRetain()
.handle
- a handle to the model object, not null.Set<ValueHolder> getValuesToRetain()
Set<UIComponent> getAllComponents()
getRootScope().getRegisteredComponents()
UIComponentScope getRootScope()
void fireBrowserWindowResizeEvent(Dimension dimension)
internal_windowresize
, having payload
of type hu::Dimension which
holds new window dimension. The event originator component is set to ROOT.
Warning: browsers on Android return value in DPs instead of pixels. From Android documentation:
Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen.
The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Example: a screen width of 720 on a 320 DPI screen will be reported as 360 DPs.
Therefore, to render special page for small devices, compare screen width to the value of 400. If equal or smaller, provide small screen version.dimension
- the new dimension, in pixels (on desktop OS) or DPs (on Android phones).ContextWrapper getScreenContext()
LspsContextHolder getContextHolder()
UIComponent createUIComponent(UIComponent parent, RecordHolder componentDefinition, UIComponentScope scope)
UIComponentFactory.createComponent(LspsScreen, com.whitestein.lsps.vaadin.ui.components.UIComponent, com.whitestein.lsps.lang.exec.RecordHolder, com.whitestein.lsps.vaadin.ui.UIComponentScope)
.parent
- parent of the component in the LSPS component hierarchycomponentDefinition
- definition of the component to createscope
- component scope; if null, same scope as parent will be usedboolean triggerEventProcessing(UIEvent triggeringEvent)
triggeringEvent
- the event that triggered this round of processing; can be null if there is no such event.markComponentAsInvalid(com.whitestein.lsps.vaadin.ui.components.UIComponent)
.void markComponentAsInvalid(UIComponent component)
triggerEventProcessing(com.whitestein.lsps.vaadin.ui.events.UIEvent)
to return false for events which
processes given component.
Note that this will not cause the component to show an error icon.component
- the component, not null.void markComponentAsValid(UIComponent component)
component
- the component, not null.boolean isInvalid(UIComponent component)
markComponentAsInvalid(com.whitestein.lsps.vaadin.ui.components.UIComponent)
.component
- the component, not null.markComponentAsValid(com.whitestein.lsps.vaadin.ui.components.UIComponent)
.void registerUIComponent(UIComponent component)
component
- not null. The component parent must already be registered.void unregisterUIComponent(UIComponent component)
component
- not null. The component parent must already be registered.void addComponentToRefresh(UIComponent component)
triggerEventProcessing(com.whitestein.lsps.vaadin.ui.events.UIEvent)
.component
- the component, not null. The component must be initialized.IllegalArgumentException
- if the component is not initialized.void updateContextFor(UIComponentData componentData)
componentData
. See UIComponentScope.updateContext()
.componentData
- a component data, may not be null
UIComponent getTopmostComponent()
IllegalStateException
- if the screen is not yet rendered or has been closed.void fireApplicationEvent(UIApplicationEvent appEvent)
triggerEventProcessing(com.whitestein.lsps.vaadin.ui.events.UIEvent)
is called.appEvent
- the event, not null.Set<UIComponent> getComponentsForDefinition(RecordHolder componentDefinition, UIComponent scopeComponent)
componentDefinition
- the definition, not null.scopeComponent
- find the components in this scope only. Not null.UIComponent
associated with the given component definition. Never null, never contains nulls.void addUploadedBinaryData(long binaryDataId)
binaryDataId
- Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.