com.xpn.xwiki.wysiwyg.client.plugin.image.ui
Class CurrentPageImageSelectorWizardStep

java.lang.Object
  extended by com.xpn.xwiki.wysiwyg.client.widget.wizard.util.AbstractSelectorWizardStep<D>
      extended by com.xpn.xwiki.wysiwyg.client.widget.wizard.util.AbstractListSelectorWizardStep<ImageConfig,Attachment>
          extended by com.xpn.xwiki.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 AbstractListSelectorWizardStep<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: CurrentPageImageSelectorWizardStep.java 25780 2009-12-14 09:41:47Z mflorea $

Constructor Summary
CurrentPageImageSelectorWizardStep(ResourceName currentPage)
          Builds a selector from the images of the specified current page.
CurrentPageImageSelectorWizardStep(ResourceName currentPage, ResourceName editedResource)
          Builds a selector from the images of the specified current page to edit the specified resource.
 
Method Summary
protected  void fetchData(com.google.gwt.user.client.rpc.AsyncCallback<java.util.List<Attachment>> callback)
          Fetches the list of items to be displayed in this list from the server.
protected  void fillList(java.util.List<Attachment> itemsList)
          Fills the preview list with image preview widgets.
protected  ListItem<Attachment> getListItem(Attachment image)
          
protected  ListItem<Attachment> getNewOptionListItem()
          
 java.lang.String getNextStep()
          
protected  java.lang.String getSelectErrorMessage()
          
protected  java.lang.String getSelectHelpLabel()
          
protected  java.lang.String getSelection()
          
 java.lang.String getStepTitle()
          
protected  boolean matchesSelection(Attachment item, java.lang.String selection)
          Compares the current item with the passed string representation of the wizard step's selection.
 void onSelection(com.google.gwt.event.logical.shared.SelectionEvent<ListItem<Attachment>> event)
          
protected  void saveSelectedValue()
          Saves the current selection in this panel in the data managed by this wizard step, if all validation goes well on the sumbit time.
 void setCurrentPage(ResourceName currentPage)
          Updates the current page for which this wizard step provides selection interface.
 void setWikiService(WikiServiceAsync wikiService)
          Injects the wiki service.
 
Methods inherited from class com.xpn.xwiki.wysiwyg.client.widget.wizard.util.AbstractListSelectorWizardStep
addNavigationListener, display, displayError, getErrorLabel, getList, getMainPanel, getSelectedItem, hideError, init, onCancel, onDoubleClick, onKeyUp, onSubmit, refreshList, removeNavigationListener, setActive, setNewOptionOnTop
 
Methods inherited from class com.xpn.xwiki.wysiwyg.client.widget.wizard.util.AbstractSelectorWizardStep
getData, getDirectionName, getResult, getValidDirections, initializeSelection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurrentPageImageSelectorWizardStep

public CurrentPageImageSelectorWizardStep(ResourceName currentPage,
                                          ResourceName editedResource)
Builds a selector from the images of the specified current page to edit the specified resource.

Parameters:
currentPage - the page to currently show images for
editedResource - the currently edited resource (currentPage for which editing is done)

CurrentPageImageSelectorWizardStep

public CurrentPageImageSelectorWizardStep(ResourceName currentPage)
Builds a selector from the images of the specified current page.

Parameters:
currentPage - the currently edited page
Method Detail

getSelectHelpLabel

protected java.lang.String getSelectHelpLabel()

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

getSelectErrorMessage

protected java.lang.String getSelectErrorMessage()

Specified by:
getSelectErrorMessage in class AbstractListSelectorWizardStep<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<java.util.List<Attachment>> callback)
Fetches the list of items to be displayed in this list from the server.

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

fillList

protected void fillList(java.util.List<Attachment> itemsList)
Fills the preview list with image preview widgets.

Overrides:
fillList in class AbstractListSelectorWizardStep<ImageConfig,Attachment>
Parameters:
itemsList - the list of items to select from

getNextStep

public java.lang.String getNextStep()

Specified by:
getNextStep in interface WizardStep

getStepTitle

public java.lang.String getStepTitle()

Specified by:
getStepTitle in interface WizardStep

saveSelectedValue

protected void saveSelectedValue()
Saves the current selection in this panel in the data managed by this wizard step, if all validation goes well on the sumbit time.

Specified by:
saveSelectedValue in class AbstractListSelectorWizardStep<ImageConfig,Attachment>
See Also:
AbstractListSelectorWizardStep.onSubmit(AsyncCallback)

getListItem

protected ListItem<Attachment> getListItem(Attachment image)

Specified by:
getListItem in class AbstractListSelectorWizardStep<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<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.

getSelection

protected java.lang.String getSelection()

Overrides:
getSelection in class AbstractListSelectorWizardStep<ImageConfig,Attachment>
Returns:
the selection of this wizard step, as a string representation of the value selected in the list or from the other settings of the current wizard step. To be used in conjunction with #matchesSelection(AbstractSelectorWizardStep, String) to handle selection preserving upon update in this step's list.
See Also:
#matchesSelection(AbstractSelectorWizardStep, String)

matchesSelection

protected boolean matchesSelection(Attachment item,
                                   java.lang.String selection)
Compares the current item with the passed string representation of the wizard step's selection.

Overrides:
matchesSelection in class AbstractListSelectorWizardStep<ImageConfig,Attachment>
Parameters:
item - the item to compare with the selection
selection - the unique representation of the step's selection
Returns:
true if the item matches the selection, false otherwise.
See Also:
AbstractListSelectorWizardStep.getSelection()

setCurrentPage

public void setCurrentPage(ResourceName currentPage)
Updates the current page for which this wizard step provides selection interface. However, it will not update the displayed images, this will have to be done manually through AbstractListSelectorWizardStep.refreshList(AsyncCallback).

Parameters:
currentPage - the currentPage to set

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

setWikiService

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

Parameters:
wikiService - the service used to retrieve the list of image attachments


Copyright © 2004-2010 XWiki. All Rights Reserved.