Class WRepeater.SubUIContext
- java.lang.Object
-
- com.github.bordertech.wcomponents.UIContextDelegate
-
- com.github.bordertech.wcomponents.WRepeater.SubUIContext
-
- All Implemented Interfaces:
UIContext,Serializable
- Enclosing class:
- WRepeater
public static class WRepeater.SubUIContext extends UIContextDelegate
The SubUIContext stores the state information for the repeated component hierarchy for a single row in the repeater.- Author:
- Martin Shevchenko
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SubUIContext(WRepeater repeater, int contextId)Creates a SubUIContext.SubUIContext(WRepeater repeater, int contextId, String rowRenderId)Creates a SubUIContext.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearRequestScratchMap()Doesn't do anything - the real UI Context will clear the scratch map.voidclearRequestScratchMap(WComponent component)Clears the scratch map for the given component.voidclearScratchMap()Doesn't do anything - the real UI Context will clear the scratch map.voidclearScratchMap(WComponent component)Clears the scratch map with phase scope for the given component.SetgetComponents()intgetContextId()WebModelgetModel(WebComponent component)Retrieves the component model for the given component.protected UIContextgetParentContext()MapgetRequestScratchMap(WComponent component)Retrieves the scratch map with request scope for the given component.ObjectgetRowId()Retrieves the row id for this SubUIContext.intgetRowIndex()Retrieves the row index for this SubUIContext.StringgetRowRenderId()MapgetScratchMap(WComponent component)Retrieves the scratch map with phase scope for the given component.voidinvokeLater(Runnable runnable)Adds a runnable to the list of runnables to be invoked later.protected booleanisInContext(WebComponent component)Indicates whether the given component is inside this context's repeatRoot.voidremoveModel(WebComponent component)Removes the component model for the given component.voidsetEnvironment(Environment environment)Throws an UnsupportedOperationException, as the environment can not be set on a SubUIContext.voidsetFocussed(WComponent component)Sets the component in this UIC which is to be the focus of the client browser cursor.voidsetModel(WebComponent component, WebModel model)Sets the component model for the given component.protected voidsetRowId(Object rowId)Sets the row bean, in the case that the repeater has rows added/removed/moved.protected voidsetRowIndex(int rowIndex)Sets the row index, in the case that the repeater has rows added/removed/moved.-
Methods inherited from class com.github.bordertech.wcomponents.UIContextDelegate
doInvokeLaters, getBacking, getCreationTime, getEnvironment, getFocussed, getFocussedId, getFwkAttribute, getFwkAttributeNames, getHeaders, getLocale, getPrimaryUIContext, getUI, invokeLater, isDummyEnvironment, isFocusRequired, removeFwkAttribute, setBacking, setFocusRequired, setFocussed, setFwkAttribute, setLocale, setUI
-
-
-
-
Constructor Detail
-
SubUIContext
public SubUIContext(WRepeater repeater, int contextId)
Creates a SubUIContext.- Parameters:
repeater- the repeater which this SubUIContext belongs to.contextId- the context unique id
-
-
Method Detail
-
invokeLater
public void invokeLater(Runnable runnable)
Adds a runnable to the list of runnables to be invoked later. The runnable will be invoked against this UIContext.- Specified by:
invokeLaterin interfaceUIContext- Overrides:
invokeLaterin classUIContextDelegate- Parameters:
runnable- the runnable to add
-
getRowId
public Object getRowId()
Retrieves the row id for this SubUIContext.- Returns:
- the row id
-
getParentContext
protected UIContext getParentContext()
- Returns:
- the parent UIContext.
-
setRowIndex
protected void setRowIndex(int rowIndex)
Sets the row index, in the case that the repeater has rows added/removed/moved.- Parameters:
rowIndex- the new row index for this sub context.
-
setRowId
protected void setRowId(Object rowId)
Sets the row bean, in the case that the repeater has rows added/removed/moved.- Parameters:
rowId- the row id for this sub context.
-
getRowIndex
public int getRowIndex()
Retrieves the row index for this SubUIContext.- Returns:
- the row index, or -1 if uninitialised.
-
getRowRenderId
public String getRowRenderId()
- Returns:
- the row render id to keep each row unique so that handle request processing is handled correctly.
-
getContextId
public int getContextId()
- Returns:
- the context unique id
-
getModel
public WebModel getModel(WebComponent component)
Retrieves the component model for the given component. If the component is not being repeated by the WRepeater, the parent context will be queried for the model.- Specified by:
getModelin interfaceUIContext- Overrides:
getModelin classUIContextDelegate- Parameters:
component- the component to retrieve the model for.- Returns:
- the component model for the given component.
-
setModel
public void setModel(WebComponent component, WebModel model)
Sets the component model for the given component. If the component is not being repeated by the WRepeater, the parent context will be given the model.- Specified by:
setModelin interfaceUIContext- Overrides:
setModelin classUIContextDelegate- Parameters:
component- the component to set the model for.model- the component model for the given component.
-
isInContext
protected boolean isInContext(WebComponent component)
Indicates whether the given component is inside this context's repeatRoot.- Parameters:
component- the component to check- Returns:
- true if the given component belongs in this context, false otherwise.
-
removeModel
public void removeModel(WebComponent component)
Removes the component model for the given component. If the component is not being repeated by the WRepeater, the parent context will be asked to remove the model.- Specified by:
removeModelin interfaceUIContext- Overrides:
removeModelin classUIContextDelegate- Parameters:
component- the component to remove the model for.
-
getComponents
public Set getComponents()
Description copied from class:UIContextDelegate- Specified by:
getComponentsin interfaceUIContext- Overrides:
getComponentsin classUIContextDelegate- Returns:
- the components which have models in this SubUIContext.
-
setEnvironment
public void setEnvironment(Environment environment)
Throws an UnsupportedOperationException, as the environment can not be set on a SubUIContext.- Specified by:
setEnvironmentin interfaceUIContext- Overrides:
setEnvironmentin classUIContextDelegate- Parameters:
environment- the environment to set.
-
getScratchMap
public Map getScratchMap(WComponent component)
Retrieves the scratch map with phase scope for the given component. The scratch map is stored under one further level of indirection; by this sub-ui context. This allows each row to have its own scratch map.- Specified by:
getScratchMapin interfaceUIContext- Overrides:
getScratchMapin classUIContextDelegate- Parameters:
component- the component to retrieve the scratch map for.- Returns:
- the scratch map for the given component.
-
clearScratchMap
public void clearScratchMap(WComponent component)
Clears the scratch map with phase scope for the given component.- Specified by:
clearScratchMapin interfaceUIContext- Overrides:
clearScratchMapin classUIContextDelegate- Parameters:
component- the component to clear the scratch map for.
-
clearScratchMap
public void clearScratchMap()
Doesn't do anything - the real UI Context will clear the scratch map.- Specified by:
clearScratchMapin interfaceUIContext- Overrides:
clearScratchMapin classUIContextDelegate
-
getRequestScratchMap
public Map getRequestScratchMap(WComponent component)
Retrieves the scratch map with request scope for the given component. The scratch map is stored under one further level of indirection; by this sub-ui context. This allows each row to have its own scratch map.- Specified by:
getRequestScratchMapin interfaceUIContext- Overrides:
getRequestScratchMapin classUIContextDelegate- Parameters:
component- the component to retrieve the scratch map for.- Returns:
- the scratch map for the given component.
-
clearRequestScratchMap
public void clearRequestScratchMap(WComponent component)
Clears the scratch map for the given component.- Specified by:
clearRequestScratchMapin interfaceUIContext- Overrides:
clearRequestScratchMapin classUIContextDelegate- Parameters:
component- the component to clear the scratch map for.
-
clearRequestScratchMap
public void clearRequestScratchMap()
Doesn't do anything - the real UI Context will clear the scratch map.- Specified by:
clearRequestScratchMapin interfaceUIContext- Overrides:
clearRequestScratchMapin classUIContextDelegate
-
setFocussed
public void setFocussed(WComponent component)
Sets the component in this UIC which is to be the focus of the client browser cursor. The id of the component is used to find the focussed element in the rendered html.- Specified by:
setFocussedin interfaceUIContext- Overrides:
setFocussedin classUIContextDelegate- Parameters:
component- the component that sould be the cursor focus in the rendered UI.
-
-