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

java.lang.Object
  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 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 31743 2010-10-13 01:20:32Z mflorea $

Field Summary
protected static java.lang.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
 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)
          
 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.
 java.lang.String getStepTitle()
          
protected abstract  WikiPageReference getTargetPageReference()
           
protected  void getUploadURL(com.google.gwt.user.client.rpc.AsyncCallback<java.lang.String> cb)
          Requests the upload URL from the server.
 java.util.EnumSet<NavigationListener.NavigationDirection> getValidDirections()
          
 WikiServiceAsync getWikiService()
           
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 setFileHelpLabel(java.lang.String fileHelpLabelText)
          Sets the help label for the file input.
 
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(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 java.lang.String getFileLabel()
Returns:
the label of the file input

getFileHelpLabel

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

setFileHelpLabel

public void setFileHelpLabel(java.lang.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<java.lang.String> cb)
Requests the upload URL from the server.

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

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.

getTargetPageReference

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

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.


getWikiService

public WikiServiceAsync getWikiService()
Returns:
the service used to retrieve information about the uploaded files


Copyright © 2004-2010 XWiki. All Rights Reserved.