|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.Component
org.apache.wicket.MarkupContainer
org.apache.wicket.markup.html.WebMarkupContainer
org.apache.wicket.markup.html.form.LabeledWebMarkupContainer
org.apache.wicket.markup.html.form.FormComponent<FileUpload>
org.apache.wicket.markup.html.form.upload.FileUploadField
public class FileUploadField
Form component that corresponds to a <input type="file">. When a FileInput
component is nested in a Form
, that has multipart ==
true, its model is updated with the FileUpload
for this component.
NOTEThe model of this component is reset with null
at the end of the
request because FileUpload
instances do not survive across requests since the input
streams they point to will be closed. Because of this, the FileUpload
instance should be
processed within the same request as the form containing it was submitted.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.wicket.markup.html.form.FormComponent |
---|
FormComponent.AbstractVisitor, FormComponent.IVisitor |
Nested classes/interfaces inherited from class org.apache.wicket.Component |
---|
Component.ComponentModelChange, Component.EnabledChange, Component.VisibilityChange |
Field Summary |
---|
Fields inherited from class org.apache.wicket.markup.html.form.FormComponent |
---|
FLAG_CONVERT_EMPTY_INPUT_STRING_TO_NULL, VALUE_SEPARATOR |
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_CONFIGURED, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
FileUploadField(String id)
|
|
FileUploadField(String id,
IModel<FileUpload> model)
|
Method Summary | |
---|---|
protected FileUpload |
convertValue(String[] value)
Subclasses should overwrite this if the conversion is not done through the type field and the IConverter . |
protected boolean |
forceCloseStreamsOnDetach()
The FileUploadField will close any input streams you have opened in its FileUpload by default. |
FileUpload |
getFileUpload()
|
String[] |
getInputAsArray()
Gets the request parameters for this component as strings. |
boolean |
isMultiPart()
|
protected void |
onComponentTag(ComponentTag tag)
Processes the component tag. |
protected void |
onDetach()
Clean up at the end of the request. |
FileUploadField |
setDefaultModel(IModel<?> model)
Sets the given model. |
protected boolean |
supportsPersistence()
FileInputs cannot be persisted; returns false. |
void |
updateModel()
Updates this components model from the request, it expects that the object is already converted through the convertInput() call that is called by the validate() method when a form is being processed. |
Methods inherited from class org.apache.wicket.markup.html.form.FormComponent |
---|
add, add, checkRequired, clearInput, convertInput, error, getConvertedInput, getDefaultLabel, getDefaultLabel, getForm, getInput, getInputName, getModel, getModelObject, getModelValue, getRawInput, getType, getValidatorKeyPrefix, getValidators, getValue, hasRawInput, inputAsInt, inputAsInt, inputAsIntArray, inputChanged, internalOnModelChanged, invalid, isInputNullable, isPersistent, isRequired, isValid, newValidatable, onDisabled, onInvalid, onValid, processChildren, processInput, setConvertedInput, setLabel, setModel, setModelObject, setModelValue, setModelValue, setPersistent, setRequired, setType, shouldTrimInput, trim, valid, validate, validateRequired, validateValidators, visitComponentsPostOrder, visitFormComponentsPostOrder |
Methods inherited from class org.apache.wicket.markup.html.form.LabeledWebMarkupContainer |
---|
getLabel, setLabelInternal |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getMarkupType, getWebPage, getWebRequest |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, autoAdd, contains, findMarkupStream, get, get, getAssociatedMarkupStream, getMarkupStream, hasAssociatedMarkup, internalAdd, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onAfterRenderChildren, onComponentTagBody, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, renderNext, replace, setMarkupStream, size, swap, toString, toString, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FileUploadField(String id)
Component.Component(String)
public FileUploadField(String id, IModel<FileUpload> model)
id
- See Componentmodel
- See ComponentMethod Detail |
---|
public FileUpload getFileUpload()
public void updateModel()
FormComponent
setModelObject(getConvertedInput());DO NOT CALL THIS METHOD DIRECTLY UNLESS YOU ARE SURE WHAT YOU ARE DOING. USUALLY UPDATING YOUR MODEL IS HANDLED BY THE FORM, NOT DIRECTLY BY YOU.
updateModel
in interface IFormModelUpdateListener
updateModel
in class FormComponent<FileUpload>
FormComponent.updateModel()
public FileUploadField setDefaultModel(IModel<?> model)
Component
WARNING: DO NOT OVERRIDE THIS METHOD UNLESS YOU HAVE A VERY GOOD REASON FOR IT. OVERRIDING THIS MIGHT OPEN UP SECURITY LEAKS AND BREAK BACK-BUTTON SUPPORT.
setDefaultModel
in class MarkupContainer
model
- The model
Component.setDefaultModel(org.apache.wicket.model.IModel)
public String[] getInputAsArray()
FormComponent
getInputAsArray
in class FormComponent<FileUpload>
FormComponent.getInputAsArray()
protected FileUpload convertValue(String[] value) throws ConversionException
FormComponent
IConverter
. WARNING: this method may be removed in future versions.
If conversion fails then a ConversionException should be thrown
convertValue
in class FormComponent<FileUpload>
value
- The value can be the getInput() or through a cookie
ConversionException
- If input can't be convertedFormComponent.convertValue(java.lang.String[])
public boolean isMultiPart()
isMultiPart
in class FormComponent<FileUpload>
FormComponent.isMultiPart()
protected void onComponentTag(ComponentTag tag)
FormComponent
onComponentTag
in class FormComponent<FileUpload>
tag
- Tag to modifyComponent.onComponentTag(org.apache.wicket.markup.ComponentTag)
protected boolean supportsPersistence()
supportsPersistence
in class FormComponent<FileUpload>
FormComponent.supportsPersistence()
protected void onDetach()
onDetach
in class FormComponent<FileUpload>
Component.onDetach()
protected boolean forceCloseStreamsOnDetach()
true
if stream should be closed at the end of request
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |