com.xpn.xwiki.wysiwyg.client.widget.wizard.util
Class AbstractFileUploadWizardStep

java.lang.Object
  extended by com.xpn.xwiki.wysiwyg.client.widget.wizard.util.AbstractFileUploadWizardStep
All Implemented Interfaces:
WizardStep
Direct Known Subclasses:
AttachmentUploadWizardStep, ImageUploadWizardStep, ImportOfficeFileWizardStep

public abstract class AbstractFileUploadWizardStep
extends java.lang.Object
implements WizardStep

Wizard step to handle the upload of a file to a wiki page: display the file input and upload on finish.

Version:
$Id: AbstractFileUploadWizardStep.java 25062 2009-11-14 12:26:11Z mflorea $

Field Summary
protected static java.lang.String FIELD_ERROR_STYLE
          The style of the fields under error.
 
Constructor Summary
AbstractFileUploadWizardStep()
          Default constructor.
 
Method Summary
 com.google.gwt.user.client.ui.Widget display()
          
protected  void displayError(java.lang.String errorMessage)
          Displays the error message and markers for this dialog.
protected  java.lang.String extractFileName()
           
 java.lang.String getDirectionName(NavigationListener.NavigationDirection direction)
          
protected abstract  java.lang.String getFileHelpLabel()
           
protected  java.lang.String getFileLabel()
           
protected  com.google.gwt.user.client.ui.FileUpload getFileUploadInput()
           
protected  java.lang.String getFileUploadInputName()
           
protected  com.google.gwt.user.client.ui.Panel getMainPanel()
          Method for retrieving the main UI (panel) by sub-classes so that they can customize it.
protected abstract  java.lang.String getPage()
           
protected abstract  java.lang.String getSpace()
           
 java.lang.String getStepTitle()
          
protected  java.lang.String getUploadURL()
          Builds the form upload URL for this form, to be called before form submission.
 java.util.EnumSet<NavigationListener.NavigationDirection> getValidDirections()
          
protected abstract  java.lang.String getWiki()
           
protected  void hideError()
          Hides the error message and markers for this dialog.
 void init(java.lang.Object data, com.google.gwt.user.client.rpc.AsyncCallback<?> cb)
          
protected abstract  void onAttachmentUploaded(Attachment attach, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Boolean> async)
          Notifies the successful completion of a file upload, to be overridden by subclasses to provide specific behavior.
 void onCancel()
          
 void onSubmit(com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Boolean> async)
          
protected  void onSubmitComplete(com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent event, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Boolean> async)
          Handles the submit completion in asynchronous mode, to pass the result of processing the result in the received callback.
 void setWikiService(WikiServiceAsync wikiService)
          Inject the wiki service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xwiki.gwt.user.client.ui.wizard.WizardStep
getNextStep, getResult
 

Field Detail

FIELD_ERROR_STYLE

protected static final java.lang.String FIELD_ERROR_STYLE
The style of the fields under error.

See Also:
Constant Field Values
Constructor Detail

AbstractFileUploadWizardStep

public AbstractFileUploadWizardStep()
Default constructor.

Method Detail

getFileLabel

protected java.lang.String getFileLabel()
Returns:
the label of the file input

getFileHelpLabel

protected abstract java.lang.String getFileHelpLabel()
Returns:
the help label for the file input

getUploadURL

protected java.lang.String getUploadURL()
Builds the form upload URL for this form, to be called before form submission.

Returns:
the url to set as the action of the file upload form

getFileUploadInputName

protected java.lang.String getFileUploadInputName()
Returns:
the name attribute of the fileUploadInput, to be returned by subclasses implementing getUploadURL() to set the file upload form data.

init

public void init(java.lang.Object data,
                 com.google.gwt.user.client.rpc.AsyncCallback<?> cb)

Specified by:
init in interface WizardStep

display

public com.google.gwt.user.client.ui.Widget display()

Specified by:
display in interface WizardStep

getDirectionName

public java.lang.String getDirectionName(NavigationListener.NavigationDirection direction)

Specified by:
getDirectionName in interface WizardStep

getStepTitle

public java.lang.String getStepTitle()

Specified by:
getStepTitle in interface WizardStep

getValidDirections

public java.util.EnumSet<NavigationListener.NavigationDirection> getValidDirections()

Specified by:
getValidDirections in interface WizardStep

onCancel

public void onCancel()

Specified by:
onCancel in interface WizardStep
See Also:
WizardStep.onCancel()

onSubmit

public void onSubmit(com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Boolean> async)

Specified by:
onSubmit in interface WizardStep
See Also:
WizardStep.onSubmit(AsyncCallback)

onSubmitComplete

protected void onSubmitComplete(com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent event,
                                com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Boolean> async)
Handles the submit completion in asynchronous mode, to pass the result of processing the result in the received callback.

Parameters:
event - the original FormPanel.SubmitCompleteEvent
async - the callback used to send back the response of form event processing
See Also:
#onSubmit}

onAttachmentUploaded

protected abstract void onAttachmentUploaded(Attachment attach,
                                             com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Boolean> async)
Notifies the successful completion of a file upload, to be overridden by subclasses to provide specific behavior.

Parameters:
attach - the successfully uploaded attachment
async - the call-back used to indicate the completion of this method. It's required that the sub-classes invoke async.onSuccess(true); method once they are done with processing the attachment. Without this method being invoked, the submission of this wizard step will not complete.

getWiki

protected abstract java.lang.String getWiki()
Returns:
the wiki of the document to upload this file to, or null if the default wiki should be used.

getSpace

protected abstract java.lang.String getSpace()
Returns:
the space of the document to upload this file to, or null if the default space should be used.

getPage

protected abstract java.lang.String getPage()
Returns:
the document to upload this file to, or null if the default document should be used.

extractFileName

protected java.lang.String extractFileName()
Returns:
the filename set in the file upload field.

getMainPanel

protected com.google.gwt.user.client.ui.Panel getMainPanel()
Method for retrieving the main UI (panel) by sub-classes so that they can customize it.

Returns:
the main ui panel.

getFileUploadInput

protected com.google.gwt.user.client.ui.FileUpload getFileUploadInput()
Returns:
the fileUploadInput

displayError

protected void displayError(java.lang.String errorMessage)
Displays the error message and markers for this dialog.

Parameters:
errorMessage - the error message to display.

hideError

protected void hideError()
Hides the error message and markers for this dialog.


setWikiService

public void setWikiService(WikiServiceAsync wikiService)
Inject the wiki service.

Parameters:
wikiService - the service used to access the uploaded attachments


Copyright © 2004-2010 XWiki. All Rights Reserved.