org.xwiki.gwt.wysiwyg.client.widget.wizard.util
Class AbstractFileUploadWizardStep

java.lang.Object
  extended by org.xwiki.gwt.user.client.ui.wizard.AbstractNavigationAwareWizardStep
      extended by org.xwiki.gwt.user.client.ui.wizard.AbstractInteractiveWizardStep
          extended by org.xwiki.gwt.wysiwyg.client.widget.wizard.util.AbstractFileUploadWizardStep
All Implemented Interfaces:
WizardStep
Direct Known Subclasses:
ImportOfficeFileWizardStep, LinkUploadWizardStep

public abstract class AbstractFileUploadWizardStep
extends AbstractInteractiveWizardStep

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

Version:
$Id$

Field Summary
protected static String FIELD_ERROR_STYLE
          The style of the fields under error.
 
Constructor Summary
AbstractFileUploadWizardStep(WikiServiceAsync wikiService)
          Creates a new file upload wizard step that uses the given service to get information about the uploaded files.
 
Method Summary
protected  void displayError(String errorMessage)
          Displays the error message and markers for this dialog.
protected  String extractFileName()
           
 String getFileHelpLabel()
           
protected  String getFileLabel()
           
protected  com.google.gwt.user.client.ui.FileUpload getFileUploadInput()
           
protected  String getFileUploadInputName()
           
protected abstract  WikiPageReference getTargetPageReference()
           
protected  void getUploadURL(com.google.gwt.user.client.rpc.AsyncCallback<String> cb)
          Requests the upload URL from the server.
protected  void hideError()
          Hides the error message and markers for this dialog.
 void init(Object data, com.google.gwt.user.client.rpc.AsyncCallback<?> cb)
          
protected abstract  void onAttachmentUploaded(Attachment attach, com.google.gwt.user.client.rpc.AsyncCallback<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<Boolean> async)
          
protected  void onSubmitComplete(com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent event, com.google.gwt.user.client.rpc.AsyncCallback<Boolean> async)
          Handles the submit completion in asynchronous mode, to pass the result of processing the result in the received callback.
 void setFileHelpLabel(String fileHelpLabelText)
          Sets the help label for the file input.
 
Methods inherited from class org.xwiki.gwt.user.client.ui.wizard.AbstractInteractiveWizardStep
display, getStepTitle, isAutoSubmit, setStepTitle
 
Methods inherited from class org.xwiki.gwt.user.client.ui.wizard.AbstractNavigationAwareWizardStep
getDirectionName, getNextStep, getValidDirections, setDirectionName, setNextStep, setValidDirections
 
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
getResult
 

Field Detail

FIELD_ERROR_STYLE

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

See Also:
Constant Field Values
Constructor Detail

AbstractFileUploadWizardStep

public AbstractFileUploadWizardStep(WikiServiceAsync wikiService)
Creates a new file upload wizard step that uses the given service to get information about the uploaded files.

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

getFileLabel

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

getFileHelpLabel

public String getFileHelpLabel()
Returns:
the help label for the file input

setFileHelpLabel

public void setFileHelpLabel(String fileHelpLabelText)
Sets the help label for the file input.

Parameters:
fileHelpLabelText - the new help label text for the file input

getUploadURL

protected void getUploadURL(com.google.gwt.user.client.rpc.AsyncCallback<String> cb)
Requests the upload URL from the server.

Parameters:
cb - the object to be notified when the upload URL is received

getFileUploadInputName

protected 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(Object data,
                 com.google.gwt.user.client.rpc.AsyncCallback<?> cb)

See Also:
WizardStep.init(Object, AsyncCallback)

onCancel

public void onCancel()

See Also:
WizardStep.onCancel()

onSubmit

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

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<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<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.

getTargetPageReference

protected abstract WikiPageReference getTargetPageReference()
Returns:
a reference to the page where the attachment will be uploaded

extractFileName

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

getFileUploadInput

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

displayError

protected void displayError(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.



Copyright © 2004-2012 XWiki. All Rights Reserved.