|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hivemind.impl.BaseLocatable
org.apache.tapestry.AbstractComponent
org.apache.tapestry.form.AbstractFormComponent
public abstract class AbstractFormComponent
A base class for building components that correspond to HTML form elements. All such components
must be wrapped (directly or indirectly) by a Form
component.
Field Summary |
---|
Fields inherited from class org.apache.tapestry.AbstractComponent |
---|
_body, _bodyCount |
Constructor Summary | |
---|---|
AbstractFormComponent()
|
Method Summary | |
---|---|
protected void |
generateClientId()
|
protected boolean |
getCanTakeFocus()
Returns true if the corresponding field, on the client side, can accept user focus (i.e., implements the focus() method). |
abstract IForm |
getForm()
Returns the IForm which contains the component, or null if the
component is not contained by a form, or if the containing Form is not currently rendering. |
abstract String |
getIdParameter()
Should be connected to a parameter named "id" (annotations would be helpful here!). |
abstract String |
getName()
Returns the name of the component, which is automatically generated during renderring. |
protected boolean |
getRenderBodyOnRewind()
A small number of components should always render their body on rewind (even if the component is itself disabled) and should override this method to return true. |
boolean |
isRequired()
Returns false. |
String |
peekClientId()
Used internally to "peek" at what the next generated client id will be for this component when it renders. |
protected void |
renderComponent(IMarkupWriter writer,
IRequestCycle cycle)
Invoked by AbstractComponent.render(IMarkupWriter, IRequestCycle) to actually
render the component (with any parameter values already set). |
protected void |
renderDelegateAttributes(IMarkupWriter writer,
IRequestCycle cycle)
|
protected void |
renderDelegatePrefix(IMarkupWriter writer,
IRequestCycle cycle)
|
protected void |
renderDelegateSuffix(IMarkupWriter writer,
IRequestCycle cycle)
|
protected abstract void |
renderFormComponent(IMarkupWriter writer,
IRequestCycle cycle)
Invoked from renderComponent(IMarkupWriter, IRequestCycle)
to render the component. |
protected abstract void |
rewindFormComponent(IMarkupWriter writer,
IRequestCycle cycle)
Invoked from renderComponent(IMarkupWriter, IRequestCycle) to rewind the
component. |
abstract void |
setForm(IForm form)
|
protected void |
setName(IForm form)
|
abstract void |
setName(String name)
Invoked by FormBehavior.getElementId(IFormComponent) when a name is created for a form
component. |
Methods inherited from class org.apache.hivemind.impl.BaseLocatable |
---|
getLocation, setLocation |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.tapestry.form.IFormComponent |
---|
getClientId, getDisplayName, isDisabled |
Methods inherited from interface org.apache.tapestry.IComponent |
---|
addAsset, addBody, addComponent, enterActiveState, finishLoad, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainedComponent, getContainer, getEventInvoker, getExtendedId, getId, getIdPath, getListeners, getMessages, getNamespace, getPage, getSpecification, getSpecifiedId, getTemplateTagName, isRendering, renderBody, setBinding, setClientId, setContainedComponent, setContainer, setId, setNamespace, setPage, setTemplateTagName |
Methods inherited from interface org.apache.tapestry.IRender |
---|
render |
Methods inherited from interface org.apache.hivemind.LocationHolder |
---|
setLocation |
Methods inherited from interface org.apache.hivemind.Locatable |
---|
getLocation |
Constructor Detail |
---|
public AbstractFormComponent()
Method Detail |
---|
public abstract IForm getForm()
IFormComponent
IForm
which contains the component, or null if the
component is not contained by a form, or if the containing Form is not currently rendering.
getForm
in interface IFormComponent
public abstract void setForm(IForm form)
public abstract String getName()
IFormComponent
This value is set inside the component's render method and is not cleared. If the
component is inside a ForBean
, the value returned is
the most recent name generated for the component.
This property is made available to facilitate writing JavaScript that allows components (in the client web browser) to interact.
In practice, a Script
component works with the
Body
component to get the JavaScript code inserted and
referenced.
getName
in interface IFormComponent
public abstract void setName(String name)
IFormComponent
FormBehavior.getElementId(IFormComponent)
when a name is created for a form
component.
setName
in interface IFormComponent
FormBehavior.getElementId(IFormComponent)
protected boolean getCanTakeFocus()
Hidden
)
override this method to always return false.
public abstract String getIdParameter()
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
AbstractComponent.render(IMarkupWriter, IRequestCycle)
to actually
render the component (with any parameter values already set).
This implementation checks the rewinding state of the IForm
that contains the
component and forwards processing to either
renderFormComponent(IMarkupWriter, IRequestCycle)
or
rewindFormComponent(IMarkupWriter, IRequestCycle)
.
Those two are the methods that subclasses should implement.
renderComponent
in class AbstractComponent
AbstractComponent.renderComponent(org.apache.tapestry.IMarkupWriter,
org.apache.tapestry.IRequestCycle)
protected boolean getRenderBodyOnRewind()
rewindFormComponent(IMarkupWriter, IRequestCycle)
should leave this method returning
false. Remember that if the component is disabled
then
rewindFormComponent(IMarkupWriter, IRequestCycle)
won't be invoked.
protected void renderDelegatePrefix(IMarkupWriter writer, IRequestCycle cycle)
protected void renderDelegateAttributes(IMarkupWriter writer, IRequestCycle cycle)
protected void renderDelegateSuffix(IMarkupWriter writer, IRequestCycle cycle)
protected void setName(IForm form)
protected void generateClientId()
generateClientId
in class AbstractComponent
public String peekClientId()
IRequestCycle.peekUniqueId(String)
.
peekClientId
in interface IComponent
peekClientId
in class AbstractComponent
public boolean isRequired()
isRequired
in interface IFormComponent
protected abstract void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle)
renderComponent(IMarkupWriter, IRequestCycle)
to render the component.
writer
- cycle
- protected abstract void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle)
renderComponent(IMarkupWriter, IRequestCycle)
to rewind the
component. If the component is disabled
this will not be invoked.
writer
- cycle
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |