org.xwiki.gwt.wysiwyg.client.plugin.image.ui
Class CurrentPageImageSelectorWizardStep

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.AbstractSelectorWizardStep<D>
              extended by org.xwiki.gwt.wysiwyg.client.widget.wizard.util.AbstractListSelectorWizardStep<EntityLink<C>,E>
                  extended by org.xwiki.gwt.wysiwyg.client.widget.wizard.util.AbstractEntityListSelectorWizardStep<ImageConfig,Attachment>
                      extended by org.xwiki.gwt.wysiwyg.client.plugin.image.ui.CurrentPageImageSelectorWizardStep
All Implemented Interfaces:
com.google.gwt.event.dom.client.DoubleClickHandler, com.google.gwt.event.dom.client.KeyUpHandler, com.google.gwt.event.logical.shared.SelectionHandler<ListItem<Attachment>>, com.google.gwt.event.shared.EventHandler, SourcesNavigationEvents, WizardStep

public class CurrentPageImageSelectorWizardStep
extends AbstractEntityListSelectorWizardStep<ImageConfig,Attachment>
implements com.google.gwt.event.logical.shared.SelectionHandler<ListItem<Attachment>>

Wizard step to select an image from the list of images attached to a page.

Version:
$Id$

Constructor Summary
CurrentPageImageSelectorWizardStep(WikiServiceAsync wikiService, boolean useLinkDestination)
          Creates a new image selector that displays the images attached to the link destination page.
 
Method Summary
protected  void fetchData(com.google.gwt.user.client.rpc.AsyncCallback<List<Attachment>> callback)
          Fetches the list of items to be displayed in this list from the server.
protected  ListItem<Attachment> fillList(List<Attachment> attachments, Attachment selectedAttachment)
          Fills the list with the given data and returns the item that matches the specified item.
protected  ListItem<Attachment> getListItem(Attachment image)
          
protected  ListItem<Attachment> getNewOptionListItem()
          
 String getNextStep()
          
protected  String getSelectErrorMessage()
          
protected  String getSelectHelpLabel()
          
 void onSelection(com.google.gwt.event.logical.shared.SelectionEvent<ListItem<Attachment>> event)
          
protected  void saveSelectedValue(com.google.gwt.user.client.rpc.AsyncCallback<Boolean> async)
          Saves the current selection in this panel in the data managed by this wizard step, if all validation goes well on the submit time.
 
Methods inherited from class org.xwiki.gwt.wysiwyg.client.widget.wizard.util.AbstractEntityListSelectorWizardStep
isSelectedByDefault
 
Methods inherited from class org.xwiki.gwt.wysiwyg.client.widget.wizard.util.AbstractListSelectorWizardStep
addNavigationListener, display, displayError, getErrorLabel, getList, getSelectedItem, hideError, init, onCancel, onDoubleClick, onKeyUp, onSubmit, refreshList, removeNavigationListener, setActive, setNewOptionOnTop
 
Methods inherited from class org.xwiki.gwt.wysiwyg.client.widget.wizard.util.AbstractSelectorWizardStep
getData, getResult, initializeSelection
 
Methods inherited from class org.xwiki.gwt.user.client.ui.wizard.AbstractInteractiveWizardStep
getStepTitle, isAutoSubmit, setStepTitle
 
Methods inherited from class org.xwiki.gwt.user.client.ui.wizard.AbstractNavigationAwareWizardStep
getDirectionName, getValidDirections, setDirectionName, setNextStep, setValidDirections
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurrentPageImageSelectorWizardStep

public CurrentPageImageSelectorWizardStep(WikiServiceAsync wikiService,
                                          boolean useLinkDestination)
Creates a new image selector that displays the images attached to the link destination page.

Parameters:
wikiService - the service used to retrieve the list of image attachments
useLinkDestination - true to consider that the link destination is the current page, false to consider that the link origin is the current page
Method Detail

getSelectHelpLabel

protected String getSelectHelpLabel()

Specified by:
getSelectHelpLabel in class AbstractListSelectorWizardStep<EntityLink<ImageConfig>,Attachment>
Returns:
the help label for this selector step.

getSelectErrorMessage

protected String getSelectErrorMessage()

Specified by:
getSelectErrorMessage in class AbstractListSelectorWizardStep<EntityLink<ImageConfig>,Attachment>
Returns:
the error message to be displayed in case of an error in selection

fetchData

protected void fetchData(com.google.gwt.user.client.rpc.AsyncCallback<List<Attachment>> callback)
Fetches the list of items to be displayed in this list from the server.

Specified by:
fetchData in class AbstractListSelectorWizardStep<EntityLink<ImageConfig>,Attachment>
Parameters:
callback - the callback to notify when the fetching is done.

fillList

protected ListItem<Attachment> fillList(List<Attachment> attachments,
                                        Attachment selectedAttachment)
Fills the list with the given data and returns the item that matches the specified item.

Overrides:
fillList in class AbstractListSelectorWizardStep<EntityLink<ImageConfig>,Attachment>
Parameters:
attachments - the list of data to fill the list
selectedAttachment - the data to be matched
Returns:
the list item that matches the given data

getNextStep

public String getNextStep()

Specified by:
getNextStep in interface WizardStep
Overrides:
getNextStep in class AbstractNavigationAwareWizardStep

getListItem

protected ListItem<Attachment> getListItem(Attachment image)

Specified by:
getListItem in class AbstractListSelectorWizardStep<EntityLink<ImageConfig>,Attachment>
Parameters:
image - the data to build a list item representation for.
Returns:
a list item for the passed data.

getNewOptionListItem

protected ListItem<Attachment> getNewOptionListItem()

Overrides:
getNewOptionListItem in class AbstractListSelectorWizardStep<EntityLink<ImageConfig>,Attachment>
Returns:
an list item representation for a new item to add in the managed list, or null if no such item should be appended to the list.

onSelection

public void onSelection(com.google.gwt.event.logical.shared.SelectionEvent<ListItem<Attachment>> event)

Specified by:
onSelection in interface com.google.gwt.event.logical.shared.SelectionHandler<ListItem<Attachment>>

saveSelectedValue

protected void saveSelectedValue(com.google.gwt.user.client.rpc.AsyncCallback<Boolean> async)
Saves the current selection in this panel in the data managed by this wizard step, if all validation goes well on the submit time.

Overrides:
saveSelectedValue in class AbstractEntityListSelectorWizardStep<ImageConfig,Attachment>
Parameters:
async - the object to be notified after the selected value is saved
See Also:
AbstractEntityListSelectorWizardStep.saveSelectedValue(AsyncCallback)


Copyright © 2004-2012 XWiki. All Rights Reserved.