org.xwiki.gwt.wysiwyg.client
Class RichTextEditorController

java.lang.Object
  extended by org.xwiki.gwt.wysiwyg.client.RichTextEditorController
All Implemented Interfaces:
com.google.gwt.event.dom.client.KeyUpHandler, com.google.gwt.event.dom.client.LoadHandler, com.google.gwt.event.dom.client.MouseUpHandler, com.google.gwt.event.shared.EventHandler, CommandListener, Updatable
Direct Known Subclasses:
WysiwygEditor

public class RichTextEditorController
extends java.lang.Object
implements Updatable, com.google.gwt.event.dom.client.MouseUpHandler, com.google.gwt.event.dom.client.KeyUpHandler, CommandListener, com.google.gwt.event.dom.client.LoadHandler

A RichTextEditor controller.

Version:
$Id: RichTextEditorController.java 31679 2010-10-08 15:53:52Z mflorea $

Field Summary
static java.lang.String DEFAULT_PLUGINS
          The list of plugins this controller will attempt to load by default if the configuration doesn't specify which plugins to load.
static java.lang.String MENU_ROLE
          The string used to identify the menu bar extension point.
 
Constructor Summary
RichTextEditorController(RichTextEditor richTextEditor, Config config, PluginFactoryManager pfm, SyntaxValidator syntaxValidator)
          Creates a new editor.
 
Method Summary
 boolean canUpdate()
          
 void destroy()
          Destroys this editor, unregistering all the listeners and releasing the used memory.
protected  void extendRootUI()
          Loads the root user interface extensions.
protected  void fillMenu()
          Fills the menu of the editor.
 Config getConfigurationSource()
           
 RichTextEditor getRichTextEditor()
          Get the rich text editor.
protected  void initTextArea()
          Initializes the rich text area.
protected  void loadPlugins()
          Loads the plugins specified in the configuration.
protected  void maybeInitialize()
          Initialize the rich text editor if it wasn't already initialized.
 boolean onBeforeCommand(CommandManager sender, Command command, java.lang.String param)
          
 void onCommand(CommandManager sender, Command command, java.lang.String param)
          
 void onKeyUp(com.google.gwt.event.dom.client.KeyUpEvent event)
          
 void onLoad(com.google.gwt.event.dom.client.LoadEvent event)
          
 void onMouseUp(com.google.gwt.event.dom.client.MouseUpEvent event)
          
protected  void saveRegistration(com.google.gwt.event.shared.HandlerRegistration registration)
          Saves a handler registration in order for the handler to be automatically removed when the plug-in is destroyed.
 void update()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MENU_ROLE

public static final java.lang.String MENU_ROLE
The string used to identify the menu bar extension point.

See Also:
Constant Field Values

DEFAULT_PLUGINS

public static final java.lang.String DEFAULT_PLUGINS
The list of plugins this controller will attempt to load by default if the configuration doesn't specify which plugins to load.

See Also:
Constant Field Values
Constructor Detail

RichTextEditorController

public RichTextEditorController(RichTextEditor richTextEditor,
                                Config config,
                                PluginFactoryManager pfm,
                                SyntaxValidator syntaxValidator)
Creates a new editor.

Parameters:
richTextEditor - the rich text editor to manage
config - the configuration source
pfm - the plugin factory manager used to instantiate plugins
syntaxValidator - the object used to assert if a feature must be enabled or disabled in some context
Method Detail

onMouseUp

public void onMouseUp(com.google.gwt.event.dom.client.MouseUpEvent event)

Specified by:
onMouseUp in interface com.google.gwt.event.dom.client.MouseUpHandler
See Also:
MouseUpHandler.onMouseUp(MouseUpEvent)

onKeyUp

public void onKeyUp(com.google.gwt.event.dom.client.KeyUpEvent event)

Specified by:
onKeyUp in interface com.google.gwt.event.dom.client.KeyUpHandler
See Also:
KeyUpHandler.onKeyUp(KeyUpEvent)

onBeforeCommand

public boolean onBeforeCommand(CommandManager sender,
                               Command command,
                               java.lang.String param)

Specified by:
onBeforeCommand in interface CommandListener
See Also:
CommandListener.onBeforeCommand(CommandManager, Command, String)

onCommand

public void onCommand(CommandManager sender,
                      Command command,
                      java.lang.String param)

Specified by:
onCommand in interface CommandListener
See Also:
CommandListener.onCommand(CommandManager, Command, String)

onLoad

public void onLoad(com.google.gwt.event.dom.client.LoadEvent event)

Specified by:
onLoad in interface com.google.gwt.event.dom.client.LoadHandler
See Also:
LoadHandler.onLoad(LoadEvent)

maybeInitialize

protected void maybeInitialize()
Initialize the rich text editor if it wasn't already initialized.


loadPlugins

protected void loadPlugins()
Loads the plugins specified in the configuration.


extendRootUI

protected void extendRootUI()
Loads the root user interface extensions.


fillMenu

protected void fillMenu()
Fills the menu of the editor.


initTextArea

protected void initTextArea()
Initializes the rich text area.


update

public void update()

Specified by:
update in interface Updatable
See Also:
Updatable.update()

canUpdate

public boolean canUpdate()

Specified by:
canUpdate in interface Updatable
See Also:
Updatable.canUpdate()

getRichTextEditor

public RichTextEditor getRichTextEditor()
Get the rich text editor. Creates it if it does not exist.

Returns:
the rich text editor

getConfigurationSource

public Config getConfigurationSource()
Returns:
this editor's configuration source

saveRegistration

protected void saveRegistration(com.google.gwt.event.shared.HandlerRegistration registration)
Saves a handler registration in order for the handler to be automatically removed when the plug-in is destroyed.

Parameters:
registration - the handler registration to be saved

destroy

public void destroy()
Destroys this editor, unregistering all the listeners and releasing the used memory.



Copyright © 2004-2010 XWiki. All Rights Reserved.