org.xwiki.gwt.wysiwyg.client.plugin.importer
Class PasteManager

java.lang.Object
  extended by org.xwiki.gwt.wysiwyg.client.plugin.importer.PasteManager
All Implemented Interfaces:
com.google.gwt.event.shared.EventHandler, CopyHandler, PasteHandler
Direct Known Subclasses:
IEPasteManager

public class PasteManager
extends Object
implements PasteHandler, CopyHandler

A PasteHandler that can filter the value that has been pasted in a RichTextArea.

Since:
5.0M2
Version:
$Id: 9fecccd2ccbd91f3d7ea57f544c5c8f498efd8e3 $

Constructor Summary
PasteManager()
           
 
Method Summary
protected  List<com.google.gwt.event.shared.HandlerRegistration> addHandlers()
          Adds all required event handlers and returns their registrations so that they can be unregistered at the end.
protected  void centerPasteContainer(Element pasteContainer)
          We added this method just to be able to override it for IE9 so that we can overcome a GWT bug.
protected  RichTextArea getTextArea()
           
 List<com.google.gwt.event.shared.HandlerRegistration> initialize(RichTextArea textArea, ImportServiceAsync importService)
          Configures this instance to catch the paste events from the given rich text area and to clean the paste content using the specified service.
 void onCopy(CopyEvent event)
           
 void onPaste(PasteEvent event)
           
protected  void selectPasteContainer(Element pasteContainer)
          Select the contents of the given paste container.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PasteManager

public PasteManager()
Method Detail

initialize

public List<com.google.gwt.event.shared.HandlerRegistration> initialize(RichTextArea textArea,
                                                                        ImportServiceAsync importService)
Configures this instance to catch the paste events from the given rich text area and to clean the paste content using the specified service.

Parameters:
textArea - the rich text area whose paste event are caught
importService - the component used to clean the paste content on the server side
Returns:
the list of event handler registrations

addHandlers

protected List<com.google.gwt.event.shared.HandlerRegistration> addHandlers()
Adds all required event handlers and returns their registrations so that they can be unregistered at the end.

Returns:
the list of event handler registrations

onPaste

public void onPaste(PasteEvent event)
Specified by:
onPaste in interface PasteHandler

selectPasteContainer

protected void selectPasteContainer(Element pasteContainer)
Select the contents of the given paste container.

Parameters:
pasteContainer - the paste container

centerPasteContainer

protected void centerPasteContainer(Element pasteContainer)
We added this method just to be able to override it for IE9 so that we can overcome a GWT bug.

Parameters:
pasteContainer - the paste container
See Also:
getAbsoluteTop/getScrollTop returns wrong values for IE9 when body has been scrolled, Document#getScrollTop() and Document#getScrollLeft() are broken for nested documents in IE9

onCopy

public void onCopy(CopyEvent event)
Specified by:
onCopy in interface CopyHandler

getTextArea

protected RichTextArea getTextArea()
Returns:
the rich text area whose paste events we catch


Copyright © 2004–2014 XWiki. All rights reserved.