|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wicket.Component wicket.MarkupContainer wicket.markup.html.WebMarkupContainer wicket.markup.html.WebMarkupContainerWithAssociatedMarkup wicket.markup.html.panel.Panel wicket.extensions.ajax.markup.html.AjaxEditableLabel
public class AjaxEditableLabel
An implementation of ajaxified edit-in-place component using a
TextField
as it's editor.
There are several methods that can be overriden for customization.
onEdit(AjaxRequestTarget)
is called when the label is clicked
and the editor is to be displayed. The default implementation switches the
label for the editor and places the curret at the end of the text. onSubmit(AjaxRequestTarget)
is called when in edit mode, the
user submitted new content, that content validated well, and the model value
succesfully updated. This implementation also clears any
window.status
set. onError(AjaxRequestTarget)
is called when in edit mode, the
user submitted new content, but that content did not validate. Get the
current input by calling FormComponent.getInput()
on
getEditor()
, and the error message by calling:
String errorMessage = editor.getFeedbackMessage().getMessage();The default implementation of this method displays the error message in
window.status
, redisplays the editor, selects the editor's
content and sets the focus on it.
onCancel(AjaxRequestTarget)
is called when in edit mode, the
user choose not to submit the contents (he/she pressed espace). The default
implementation displays the label again without any further action.
Nested Class Summary | |
---|---|
protected class |
AjaxEditableLabel.EditorAjaxBehavior
|
protected class |
AjaxEditableLabel.LabelAjaxBehavior
|
Nested classes/interfaces inherited from class wicket.markup.html.WebMarkupContainerWithAssociatedMarkup |
---|
wicket.markup.html.WebMarkupContainerWithAssociatedMarkup.HeaderPartContainer |
Nested classes/interfaces inherited from class wicket.Component |
---|
wicket.Component.ComponentModelChange, wicket.Component.EnabledChange, wicket.Component.IVisitor, wicket.Component.VisibilityChange |
Field Summary |
---|
Fields inherited from class wicket.Component |
---|
ENABLE, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
AjaxEditableLabel(java.lang.String id)
Constructor |
|
AjaxEditableLabel(java.lang.String id,
wicket.model.IModel model)
Constructor |
Method Summary | |
---|---|
AjaxEditableLabel |
add(wicket.markup.html.form.validation.IValidator validator)
Adds a validator to this form component. |
protected java.lang.String |
defaultNullLabel()
Override this to display a different value when the model object is null. |
protected wicket.markup.html.form.FormComponent |
getEditor()
Gets the editor component. |
protected wicket.Component |
getLabel()
Gets the label component. |
protected void |
internalOnAttach()
|
protected wicket.markup.html.form.FormComponent |
newEditor(wicket.MarkupContainer parent,
java.lang.String componentId,
wicket.model.IModel model)
Create a new form component instance to serve as editor. |
protected wicket.Component |
newLabel(wicket.MarkupContainer parent,
java.lang.String componentId,
wicket.model.IModel model)
Create a new form component instance to serve as editor. |
protected void |
onCancel(wicket.ajax.AjaxRequestTarget target)
Invoked when the label is in edit mode, and received a cancel event. |
protected void |
onEdit(wicket.ajax.AjaxRequestTarget target)
Called when the label is clicked and the component is put in edit mode. |
protected void |
onError(wicket.ajax.AjaxRequestTarget target)
Invoked when the label is in edit mode, received a new input, but that input didn't validate |
protected void |
onSubmit(wicket.ajax.AjaxRequestTarget target)
Invoked when the editor was succesfully updated. |
AjaxEditableLabel |
setLabel(wicket.model.IModel labelModel)
The value will be made available to the validator property by means of ${label}. |
wicket.Component |
setModel(wicket.model.IModel model)
|
AjaxEditableLabel |
setRequired(boolean required)
Sets the required flag |
AjaxEditableLabel |
setType(java.lang.Class type)
Sets the type that will be used when updating the model for this component. |
Methods inherited from class wicket.markup.html.panel.Panel |
---|
onComponentTag, onComponentTagBody, renderHead |
Methods inherited from class wicket.markup.html.WebMarkupContainerWithAssociatedMarkup |
---|
newHeaderPartContainer, renderHeadFromAssociatedMarkupFile |
Methods inherited from class wicket.markup.html.WebMarkupContainer |
---|
getMarkupType, getWebPage |
Methods inherited from class wicket.MarkupContainer |
---|
add, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, internalAdd, internalAttach, internalDetach, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, size, toString, toString, visitChildren, visitChildren |
Methods inherited from class wicket.Component |
---|
add, addStateChange, checkComponentTag, checkComponentTagAttribute, continueToOriginalDestination, debug, detachBehaviors, detachModel, detachModels, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getApplicationPages, getApplicationSettings, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMetaData, getModel, getModelComparator, getModelObject, getModelObjectAsString, getOutputMarkupId, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnDetach, internalOnModelChanged, isActionAuthorized, isAncestorOf, isBehaviorAccepted, isEnableAllowed, isEnabled, isHeadRendered, isIgnoreAttributeModifier, isRenderAllowed, isVersioned, isVisible, isVisibleInHierarchy, modelChanged, modelChanging, newPage, newPage, onAfterRender, onAttach, onBeforeRender, onBeginRequest, onDetach, onEndRequest, onModelChanged, onModelChanging, onRender, redirectToInterceptPage, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderedBehaviors, replaceComponentTagBody, replaceWith, resetHeadRendered, sameRootModel, sameRootModel, setAuto, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMetaData, setModelObject, setOutputMarkupId, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AjaxEditableLabel(java.lang.String id)
id
- public AjaxEditableLabel(java.lang.String id, wicket.model.IModel model)
id
- model
- Method Detail |
---|
public final AjaxEditableLabel add(wicket.markup.html.form.validation.IValidator validator)
validator
- The validator
public final AjaxEditableLabel setLabel(wicket.model.IModel labelModel)
labelModel
-
public final wicket.Component setModel(wicket.model.IModel model)
setModel
in class wicket.MarkupContainer
MarkupContainer.setModel(wicket.model.IModel)
public final AjaxEditableLabel setRequired(boolean required)
required
-
public final AjaxEditableLabel setType(java.lang.Class type)
type
-
protected wicket.markup.html.form.FormComponent newEditor(wicket.MarkupContainer parent, java.lang.String componentId, wicket.model.IModel model)
parent
- The parent componentcomponentId
- Id that should be used by the componentmodel
- The model
protected wicket.Component newLabel(wicket.MarkupContainer parent, java.lang.String componentId, wicket.model.IModel model)
parent
- The parent componentcomponentId
- Id that should be used by the componentmodel
- The model
protected final wicket.markup.html.form.FormComponent getEditor()
protected final wicket.Component getLabel()
protected void internalOnAttach()
internalOnAttach
in class wicket.Component
Component.internalOnAttach()
protected void onCancel(wicket.ajax.AjaxRequestTarget target)
target
- the ajax request targetprotected void onEdit(wicket.ajax.AjaxRequestTarget target)
target
- Ajax targetprotected void onError(wicket.ajax.AjaxRequestTarget target)
target
- the ajax request targetprotected void onSubmit(wicket.ajax.AjaxRequestTarget target)
target
- The ajax request targetprotected java.lang.String defaultNullLabel()
...
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |