Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.server.projects.war.components
Class UploadForm

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.apache.wicket.markup.html.form.Form<Void>
                  extended by eu.esdihumboldt.hale.server.projects.war.components.UploadForm
All Implemented Interfaces:
Serializable, Iterable<org.apache.wicket.Component>, org.apache.wicket.event.IEventSink, org.apache.wicket.event.IEventSource, org.apache.wicket.IConverterLocator, org.apache.wicket.IGenericComponent<Void>, org.apache.wicket.IRequestListener, org.apache.wicket.markup.html.form.IFormSubmitListener, org.apache.wicket.markup.html.IHeaderContributor, org.apache.wicket.request.component.IRequestableComponent, org.apache.wicket.util.IHierarchical<org.apache.wicket.Component>, org.apache.wicket.util.io.IClusterable

public class UploadForm
extends org.apache.wicket.markup.html.form.Form<Void>

Upload form for new projects.

Author:
Simon Templer
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.wicket.markup.html.form.Form
org.apache.wicket.markup.html.form.Form.MethodMismatchResponse, org.apache.wicket.markup.html.form.Form.ValidationVisitor
 
Field Summary
 
Fields inherited from class org.apache.wicket.markup.html.form.Form
ENCTYPE_MULTIPART_FORM_DATA, METHOD_GET, METHOD_POST
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Fields inherited from interface org.apache.wicket.markup.html.form.IFormSubmitListener
INTERFACE
 
Constructor Summary
UploadForm(String id)
           
 
Method Summary
 void addAllowedContentType(String contentType)
          Add an allowed content type.
static String bytesToString(org.apache.wicket.util.lang.Bytes bytes, Locale locale)
          Convert Bytes to a string, produces a prettier output than Bytes.toString(Locale)
protected  boolean checkContentType(String contentType)
          Check if the given content type is allowed for upload
static void extract(File baseDir, InputStream in)
          Extract a ZIP archive.
protected  String getTypeErrorMessage(String type)
          Get the error message if the upload of the given type is not supported
protected  void onFileUploadException(org.apache.wicket.util.upload.FileUploadException e, Map<String,Object> model)
           
protected  void onSubmit()
           
protected  void onUploadSuccess()
          Called after a successful upload.
 void setCustomTypeErrorMessage(String customTypeErrorMessage)
           
 
Methods inherited from class org.apache.wicket.markup.html.form.Form
add, appendDefaultButtonField, beforeUpdateFormComponentModels, callOnError, clearInput, delegateSubmit, encodeUrlInHiddenFields, error, findForm, findSubmittingButton, getActionUrl, getDefaultButton, getFormValidators, getHiddenFieldId, getInputNamePrefix, getJsForInterfaceUrl, getMaxSize, getMethod, getModel, getModelObject, getRootForm, getRootFormRelativeId, getStatelessHint, getValidatorKeyPrefix, handleMultiPart, hasError, internalOnModelChanged, isMultiPart, isRootForm, isSubmitted, markFormComponentsInvalid, markFormComponentsValid, onBeforeRender, onComponentTag, onComponentTagBody, onDetach, onError, onFormSubmitted, onFormSubmitted, onMethodMismatch, onValidate, onValidateModelObjects, process, registerJavaScriptNamespaces, remove, renderHead, renderPlaceholderTag, setDefaultButton, setMaxSize, setModel, setModelObject, setMultiPart, setVersioned, updateFormComponentModels, validate, validateComponents, validateFormValidator, validateFormValidators, visitFormComponents, visitFormComponentsPostOrder, wantSubmitOnNestedFormSubmit, writeParamsAsHiddenFields
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebPage, getWebRequest, getWebResponse, getWebSession
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onConfigure, onEvent, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UploadForm

public UploadForm(String id)
See Also:
Form.Form(String)
Method Detail

addAllowedContentType

public void addAllowedContentType(String contentType)
Add an allowed content type. If none is added, any content type is allowed.

Parameters:
contentType - the content type to add

checkContentType

protected boolean checkContentType(String contentType)
Check if the given content type is allowed for upload

Parameters:
contentType - the content type
Returns:
if the upload shall be allowed

onSubmit

protected void onSubmit()
Overrides:
onSubmit in class org.apache.wicket.markup.html.form.Form<Void>
See Also:
Form.onSubmit()

onUploadSuccess

protected void onUploadSuccess()
Called after a successful upload.


getTypeErrorMessage

protected String getTypeErrorMessage(String type)
Get the error message if the upload of the given type is not supported

Parameters:
type - the content type
Returns:
the error message

onFileUploadException

protected void onFileUploadException(org.apache.wicket.util.upload.FileUploadException e,
                                     Map<String,Object> model)
Overrides:
onFileUploadException in class org.apache.wicket.markup.html.form.Form<Void>
See Also:
Form.onFileUploadException(FileUploadException, Map)

setCustomTypeErrorMessage

public void setCustomTypeErrorMessage(String customTypeErrorMessage)
Parameters:
customTypeErrorMessage - the customTypeErrorMessage to set

bytesToString

public static String bytesToString(org.apache.wicket.util.lang.Bytes bytes,
                                   Locale locale)
Convert Bytes to a string, produces a prettier output than Bytes.toString(Locale)

Parameters:
bytes - the bytes
locale - the locale
Returns:
the converted string

extract

public static void extract(File baseDir,
                           InputStream in)
                    throws IOException
Extract a ZIP archive.

Parameters:
baseDir - the base directory to extract to
in - the input stream of the ZIP archive, which is closed after extraction
Throws:
IOException - if an error occurs

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d