Oxygen XML Editor 12.2 Author API

ro.sync.ecss.extensions.api
Class AuthorExternalObjectInsertionHandler

java.lang.Object
  extended by ro.sync.ecss.extensions.api.AuthorExternalObjectInsertionHandler
All Implemented Interfaces:
ExternalObjectInsertionSources
Direct Known Subclasses:
DITAExternalObjectInsertionHandler, DITAMapExternalObjectInsertionHandler, Docbook4ExternalObjectInsertionHandler, Docbook5ExternalObjectInsertionHandler, TEIP4ExternalObjectInsertionHandler, TEIP5ExternalObjectInsertionHandler, XHTMLExternalObjectInsertionHandler

public abstract class AuthorExternalObjectInsertionHandler
extends java.lang.Object
implements ExternalObjectInsertionSources

This class is notified when URLs are dropped or pasted to an Author Editor page.

*********************************
EXPERIMENTAL - Subject to change
*********************************

Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.

Since:
12

Field Summary
static java.lang.String TEST_STYLESHEET_CONTENT
          Test stylesheet content.
 
Fields inherited from interface ro.sync.ecss.extensions.api.ExternalObjectInsertionSources
DND_DB_TREE, DND_DITA_MAPS_MANAGER, DND_EXTERNAL, DND_IMAGE_PREVIEW, DND_PROJECT_TREE, PASTE
 
Constructor Summary
AuthorExternalObjectInsertionHandler()
           
 
Method Summary
 boolean acceptSource(AuthorAccess authorAccess, int source)
          Confirm that the source of URLs is interesting to this handler.
 boolean acceptURLs(AuthorAccess authorAccess, java.util.List<java.net.URL> urls, int source)
          Confirm that the list of URLs is interesting to this handler.
protected  boolean checkImportedXHTMLContentIsPreservedEntirely()
          Overwrite this method if you want to check the text data is preserved on paste after applying the conversion XSL stylesheet.
protected static boolean containOnlyImages(AuthorAccess authorAccess, java.util.List<java.net.URL> urlList)
          Verify if the provided URLs are only images.
protected  javax.xml.transform.stream.StreamSource createImporterStylesheetSource(AuthorAccess authorAccess)
          Create the InputSource for the XSLT stylesheet which will do the importing (transforming from the XHTML content to content valid in the current framework).
protected  java.net.URL getBaseURLAtCaretPosition(AuthorAccess authorAccess)
          Get the base URL for the node located at caret position.
protected  java.lang.String getImporterStylesheetFileName(AuthorAccess authorAccess)
          Get the file name of the importer stylesheet.
 void insertURLs(AuthorAccess authorAccess, java.util.List<java.net.URL> urls, int source)
          A list of URLs need to be inserted at the caret position, probably as links.
 void insertXHTMLFragment(AuthorAccess authorAccess, java.io.Reader xhtmlContentReader)
          Insert an XHTML fragment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEST_STYLESHEET_CONTENT

public static final java.lang.String TEST_STYLESHEET_CONTENT
Test stylesheet content.

See Also:
Constant Field Values
Constructor Detail

AuthorExternalObjectInsertionHandler

public AuthorExternalObjectInsertionHandler()
Method Detail

insertURLs

public void insertURLs(AuthorAccess authorAccess,
                       java.util.List<java.net.URL> urls,
                       int source)
                throws AuthorOperationException
A list of URLs need to be inserted at the caret position, probably as links.
The source of the insertion can be a paste event or a drag and drop event.
This call back is received if acceptURLs(AuthorAccess, List, int) returned true for the same source and urls list.
You can use it to link to those specific files/URLs.

Parameters:
authorAccess - The author access
urls - The list of URLs.
source - The source of the URLs, one of the AuthorExternalObjectInsertionHandler constants.
Throws:
AuthorOperationException

acceptURLs

public boolean acceptURLs(AuthorAccess authorAccess,
                          java.util.List<java.net.URL> urls,
                          int source)
Confirm that the list of URLs is interesting to this handler.
The source of the insertion can be a paste event or a drag and drop event. If the source is of drag and drop type and it is accepted, the caret will be moved to the drop position.
By default accepts the URLs from external sources if the URLs are only images and all URLs from paste events and drops from the Oxygen Project and DITA Maps Manager.

Parameters:
authorAccess - The author access.
urls - The list of URLs.
source - The source of the URLs, one of the AuthorExternalObjectInsertionHandler constants.
Returns:
true if the provided URLs are interesting.

acceptSource

public boolean acceptSource(AuthorAccess authorAccess,
                            int source)
Confirm that the source of URLs is interesting to this handler.
The source of the insertion can be a paste event or a drag and drop event. If the source is of drag and drop type and it is accepted, the caret will be moved to the drag position.
By default accepts paste sources and drags from the Oxygen Project and DITA Maps Manager.

Parameters:
authorAccess - The author access.
source - The source of the URLs, one of the AuthorExternalObjectInsertionHandler constants (that represents a paste or a drag and drop event)
Returns:
true if the insert URLs are interesting.

containOnlyImages

protected static boolean containOnlyImages(AuthorAccess authorAccess,
                                           java.util.List<java.net.URL> urlList)
Verify if the provided URLs are only images.

Parameters:
urlList - The list of URLs
Returns:
true if the URLs are only images.

insertXHTMLFragment

public void insertXHTMLFragment(AuthorAccess authorAccess,
                                java.io.Reader xhtmlContentReader)
                         throws AuthorOperationException
Insert an XHTML fragment

Parameters:
authorAccess - The author access
xhtmlContentReader - The XTHML content reader
Throws:
AuthorOperationException
Since:
12.1

*********************************
EXPERIMENTAL - Subject to change
********************************

Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.


createImporterStylesheetSource

protected javax.xml.transform.stream.StreamSource createImporterStylesheetSource(AuthorAccess authorAccess)
Create the InputSource for the XSLT stylesheet which will do the importing (transforming from the XHTML content to content valid in the current framework).

Returns:
the stylesheet which will import from XHTML to this framework. By default imports only the string content.
Since:
12.1

*********************************
EXPERIMENTAL - Subject to change
********************************

Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.


getImporterStylesheetFileName

protected java.lang.String getImporterStylesheetFileName(AuthorAccess authorAccess)
Get the file name of the importer stylesheet. It will be resolved in the context of the current class loader.

Returns:
the file name of the importer stylesheet. It will be resolved in the context of the current class loader.
Since:
12.1

*********************************
EXPERIMENTAL - Subject to change
********************************

Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.


getBaseURLAtCaretPosition

protected java.net.URL getBaseURLAtCaretPosition(AuthorAccess authorAccess)
Get the base URL for the node located at caret position. Usually this is the URL of the opened editor but it can vary if nodes have xml:base defined on them.

Parameters:
authorAccess - The author access
Returns:
the base URL for the node located at caret position.

checkImportedXHTMLContentIsPreservedEntirely

protected boolean checkImportedXHTMLContentIsPreservedEntirely()
Overwrite this method if you want to check the text data is preserved on paste after applying the conversion XSL stylesheet. If the data is not preserved the content will be copied without any styling and a warning will appear in the console.

Returns:
false by default.

Oxygen XML Editor 12.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2010.