org.xwiki.gwt.wysiwyg.client.plugin.link
Class LinkPlugin

java.lang.Object
  extended by org.xwiki.gwt.wysiwyg.client.plugin.internal.AbstractPlugin
      extended by org.xwiki.gwt.wysiwyg.client.plugin.link.LinkPlugin
All Implemented Interfaces:
WizardListener, Plugin

public class LinkPlugin
extends org.xwiki.gwt.wysiwyg.client.plugin.internal.AbstractPlugin
implements WizardListener

Rich text editor plug-in for inserting links, using a dialog to get link settings from the user. It installs a menu bar extension, with entries for all its actions.

Version:
$Id: LinkPlugin.java 28844 2010-05-12 13:22:39Z mflorea $

Constructor Summary
LinkPlugin(WikiServiceAsync wikiService)
          Creates a new link plugin that will use the specified wiki service.
 
Method Summary
 void destroy()
          Notifies the plug-in to release its resources before being unloaded from the WYSIWYG editor.
protected  void dispatchLinkWizard(LinkConfig linkConfig)
          Instantiates and runs the correct wizard for the passed link.
 void init(RichTextArea textArea, Config config)
          Initialize the plug-in.
 void onCancel(Wizard sender)
          
 void onFinish(Wizard sender, java.lang.Object result)
          
 void onLinkEdit()
          Handles the edit of a link: prepares and shows the link wizard.
 void onLinkInsert(LinkConfig.LinkType linkType)
          Handles the creation of a link of the specified type: prepares and shows the link wizard.
 void onUnlink()
          Executed when the unlink button is clicked.
 
Methods inherited from class org.xwiki.gwt.wysiwyg.client.plugin.internal.AbstractPlugin
getConfig, getTextArea, getUIExtensionList, getUIExtensions, saveRegistration, saveRegistrations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkPlugin

public LinkPlugin(WikiServiceAsync wikiService)
Creates a new link plugin that will use the specified wiki service.

Parameters:
wikiService - the service used to access the wiki
Method Detail

init

public void init(RichTextArea textArea,
                 Config config)
Initialize the plug-in. Plug-ins need to know the text area in order to provide only those feature that are supported.

Specified by:
init in interface Plugin
Overrides:
init in class org.xwiki.gwt.wysiwyg.client.plugin.internal.AbstractPlugin
Parameters:
textArea - the text area of the editor
config - the configuration object
See Also:
AbstractPlugin.init(RichTextArea, Config)

destroy

public void destroy()
Notifies the plug-in to release its resources before being unloaded from the WYSIWYG editor.

Specified by:
destroy in interface Plugin
Overrides:
destroy in class org.xwiki.gwt.wysiwyg.client.plugin.internal.AbstractPlugin
See Also:
AbstractPlugin.destroy()

onLinkInsert

public void onLinkInsert(LinkConfig.LinkType linkType)
Handles the creation of a link of the specified type: prepares and shows the link wizard.

Parameters:
linkType - the type of link to insert

onLinkEdit

public void onLinkEdit()
Handles the edit of a link: prepares and shows the link wizard.


dispatchLinkWizard

protected void dispatchLinkWizard(LinkConfig linkConfig)
Instantiates and runs the correct wizard for the passed link.

Parameters:
linkConfig - the link configuration object to be passed to the wizard

onUnlink

public void onUnlink()
Executed when the unlink button is clicked.


onFinish

public void onFinish(Wizard sender,
                     java.lang.Object result)

Handles wizard finish by creating the link HTML block from the LinkConfig setup through the wizard and executing the Command.CREATE_LINK with it.

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

onCancel

public void onCancel(Wizard sender)

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


Copyright © 2004-2010 XWiki. All Rights Reserved.