public class State extends Object
| Constructor and Description |
|---|
State(javax.servlet.http.HttpServletRequest r,
State s) |
State(javax.servlet.ServletRequest r)
Use this constructor, if you want to explicitely create a new State object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
end()
At the end of the request (or subcomponent), this method must be called, to indicate that
this state is no longer in use.
|
void |
endBlock()
After rendering (a certain renderer of) a block, the state must be informed about that.
|
void |
endProcess() |
protected String |
generateId(int c) |
Block |
getBlock()
The currently rendered block, or
null if not rendering. |
protected String |
getBlockRequestKey() |
int |
getDepth()
With recursive includes of blocks, it may occur that the state is only for components inside
a certain other component's block.
|
Parameters |
getFrameworkParameters()
Returns the parameters which were used to initialize rendering of the current block.
|
String |
getId()
Returns the id of the current block, which uniquely identifies it on the current page (or
http request).
|
Processor |
getProcessor() |
Renderer |
getRenderer() |
protected Renderer |
getRenderer(Renderer r)
Determines what should be rendered now.
|
javax.servlet.ServletRequest |
getRequest() |
static State |
getState(javax.servlet.ServletRequest request)
Returns the framework 'State' object for the given request.
|
String |
getUpcomingId()
If rendering not yet started, this returns the id of a component which would begin now.
|
WindowState |
getWindowState()
The current window state of rendering.
|
boolean |
isLeading()
If the state is leading, then the currently rendered block is not a 'block in a block'.
|
boolean |
isRendering()
Whether something is rendered right now.
|
protected void |
localizeContext()
Sets up a LocalizationContext attributes based on
Component.getBundle()and puts in on
the request. |
protected boolean |
needsProcess() |
void |
process(Processor proc)
Puts this state in 'process' mode
|
void |
render(Renderer rend)
Puts this state in 'render' mode.
|
void |
setAction(String a) |
void |
setBlock(Map<String,Object> map,
Block toBlock) |
protected void |
setType(Renderer.Type t) |
Renderer |
startBlock(Parameters frameworkParameters,
Renderer renderer) |
String |
toString() |
public static final String KEY
public State(javax.servlet.ServletRequest r)
state = getState(req);
if (state.isRendering()) {
state = new State(req);
}
But this is only used by code which want to initiate a new component itself. Normally getState(ServletRequest) should suffice.public State(javax.servlet.http.HttpServletRequest r,
State s)
public static State getState(javax.servlet.ServletRequest request)
null.public WindowState getWindowState()
public int getDepth()
public boolean isLeading()
public javax.servlet.ServletRequest getRequest()
public void end()
public void endBlock()
public void endProcess()
public boolean isRendering()
public Parameters getFrameworkParameters()
null if currently this state is not 'rendering'.public Block getBlock()
null if not rendering.protected void localizeContext()
Component.getBundle()and puts in on
the request. This is recognized by fmt:message-tag, which in a JspRenderer can therefore be
used without fmt:bundle or fmt:setbundle.protected void setType(Renderer.Type t)
public void setAction(String a)
protected boolean needsProcess()
public Renderer startBlock(Parameters frameworkParameters, Renderer renderer)
frameworkParameters - The parameters that are required by the frameworkrenderer - Proposed renderer (State may decide to render another one, and return that)IllegalStateException - When renderers which should occur 'later' were already rendered,
or when the belonging request was already 'ended'.protected String getBlockRequestKey()
public void render(Renderer rend)
public void process(Processor proc)
IllegalStateException - If the renderer for block block was already rendered.
or when the belonging request was already 'ended'.public Renderer getRenderer()
public Processor getProcessor()
public String getId()
protected String generateId(int c)
public String getUpcomingId()
MMBase 1.9-SNAPSHOT - ${javadoctimestamp}