public class CustomUIWithContextScreen extends AbstractScreen
Constructor and Description |
---|
CustomUIWithContextScreen(LspsAppConnector appConnector,
LspsFormConnector formConnector,
LspsContextHolder contextHolder)
Creates new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addComponentToRefresh(UIComponent component)
Schedules a component to be refreshed during next call to
LspsScreen.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.
|
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
LspsScreen.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 . |
getAllComponents, getComponentsForDefinition
public CustomUIWithContextScreen(LspsAppConnector appConnector, LspsFormConnector formConnector, LspsContextHolder contextHolder)
appConnector
- formConnector
- contextHolder
- public com.vaadin.ui.Component render()
LspsScreen
LspsScreen.resume()
method is called after this method.
This method must be called exactly once.public void addUploadedBinaryData(long binaryDataId)
binaryDataId
- public void resume()
LspsScreen
LspsScreen.render()
method has already been calledpublic void cleanup()
LspsScreen
public void registerValueToRetain(Handle handle)
LspsScreen
LspsScreen.getValuesToRetain()
.handle
- a handle to the model object, not null.public void unregisterValueToRetain(Handle handle)
LspsScreen
LspsScreen.getValuesToRetain()
.handle
- a handle to the model object, not null.public Set<ValueHolder> getValuesToRetain()
LspsScreen
public void fireBrowserWindowResizeEvent(Dimension dimension)
LspsScreen
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).public ContextWrapper getScreenContext()
LspsScreen
public LspsContextHolder getContextHolder()
LspsScreen
public UIComponent createUIComponent(UIComponent parent, RecordHolder componentDefinition, UIComponentScope scope)
LspsScreen
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 usedpublic boolean triggerEventProcessing(UIEvent triggeringEvent)
LspsScreen
triggeringEvent
- the event that triggered this round of processing; can be null if there is no such event.LspsScreen.markComponentAsInvalid(com.whitestein.lsps.vaadin.ui.components.UIComponent)
.public void markComponentAsInvalid(UIComponent component)
LspsScreen
LspsScreen.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.public void markComponentAsValid(UIComponent component)
LspsScreen
component
- the component, not null.public void registerUIComponent(UIComponent component)
LspsScreen
component
- not null. The component parent must already be registered.public void unregisterUIComponent(UIComponent component)
LspsScreen
component
- not null. The component parent must already be registered.public void addComponentToRefresh(UIComponent component)
LspsScreen
LspsScreen.triggerEventProcessing(com.whitestein.lsps.vaadin.ui.events.UIEvent)
.component
- the component, not null. The component must be initialized.public void updateContextFor(UIComponentData componentData)
LspsScreen
componentData
. See UIComponentScope.updateContext()
.componentData
- a component data, may not be null
public UIComponentScope getRootScope()
LspsScreen
public boolean isInvalid(UIComponent component)
LspsScreen
LspsScreen.markComponentAsInvalid(com.whitestein.lsps.vaadin.ui.components.UIComponent)
.component
- the component, not null.LspsScreen.markComponentAsValid(com.whitestein.lsps.vaadin.ui.components.UIComponent)
.public UIComponent getTopmostComponent()
LspsScreen
public void fireApplicationEvent(UIApplicationEvent appEvent)
LspsScreen
LspsScreen.triggerEventProcessing(com.whitestein.lsps.vaadin.ui.events.UIEvent)
is called.appEvent
- the event, not null.Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.