org.xwiki.gwt.wysiwyg.client.gadget
Class GadgetWizardApi

java.lang.Object
  extended by org.xwiki.gwt.wysiwyg.client.gadget.GadgetWizardApi
All Implemented Interfaces:
WizardListener

public class GadgetWizardApi
extends Object
implements WizardListener

The Gadget Wizard, along with its javascript API, allowing to create macros insert and edit wizards, to be used as gadget wizards. The javascript API allows this wizard to be used from javascript outside the WYSiWYG (e.g. the dashboard).

Since:
3.0M3
Version:
$Id: c95d2b80fb055114ef98b73c7e8b85e8dbb91ffb $

Constructor Summary
GadgetWizardApi()
          Creates a new gadget wizard.
 
Method Summary
 void destroy()
          Destroy this wizard.
 void edit(String macroCall, String title)
          Starts the edit wizard, to edit the specified macro call.
 void insert()
          Starts the insert wizard, which will guide the user into choosing a macro and defining its parameters.
 void onCancel(Wizard sender)
          
protected  void onEditDone(String macroCall, String gadgetTitle)
          Handles the call of the js callback when the edit is done.
 void onFinish(Wizard sender, Object result)
          
protected  void onInsertDone(String macroCall, String gadgetTitle)
          Handles the call of the js callback when the insert is done.
static void publish()
          Publishes the JavaScript API that can be used to create and control GadgetWizardApis.
 void setEditCallback(JavaScriptObject editHandler)
          Sets the native js edit callback to be called when the edit wizard is done.
 void setInsertCallback(JavaScriptObject insertHandler)
          Sets the native js insert callback to be called when the insert wizard is done.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GadgetWizardApi

public GadgetWizardApi()
Creates a new gadget wizard.

Method Detail

insert

public void insert()
Starts the insert wizard, which will guide the user into choosing a macro and defining its parameters.


setInsertCallback

public void setInsertCallback(JavaScriptObject insertHandler)
Sets the native js insert callback to be called when the insert wizard is done.

Parameters:
insertHandler - the native js callback to call when the insert wizard is finished successfully.

onInsertDone

protected void onInsertDone(String macroCall,
                            String gadgetTitle)
Handles the call of the js callback when the insert is done.

Parameters:
macroCall - the macro call used as a content of this gadget
gadgetTitle - the title of the gadget

edit

public void edit(String macroCall,
                 String title)
Starts the edit wizard, to edit the specified macro call.

Parameters:
macroCall - the macro call to edit, passed as a html comment from the annotated syntax.
title - the title of the gadget to edit

setEditCallback

public void setEditCallback(JavaScriptObject editHandler)
Sets the native js edit callback to be called when the edit wizard is done.

Parameters:
editHandler - the native js callback to call when the edit wizard is finished successfully.

onEditDone

protected void onEditDone(String macroCall,
                          String gadgetTitle)
Handles the call of the js callback when the edit is done.

Parameters:
macroCall - the new macro call used as a content of the edited gadget
gadgetTitle - the title of the gadget

onCancel

public void onCancel(Wizard sender)

Specified by:
onCancel in interface WizardListener
See Also:
WizardListener.onCancel(Wizard)

onFinish

public void onFinish(Wizard sender,
                     Object result)

Specified by:
onFinish in interface WizardListener
See Also:
WizardListener.onFinish(Wizard, Object)

destroy

public void destroy()
Destroy this wizard.


publish

public static void publish()
Publishes the JavaScript API that can be used to create and control GadgetWizardApis.



Copyright © 2004-2012 XWiki. All Rights Reserved.