Oxygen XML Editor 14.2 Author API

ro.sync.ecss.extensions.api.content
Interface ClipboardFragmentInformation


@API(type=NOT_EXTENDABLE,
     src=PUBLIC)
public interface ClipboardFragmentInformation

Provides information about a fragment in the clipboard. The fragment received in the callback can either be directly processed or a new fragment can be set instead. An easy way to modify the fragment XML content is like this:

  public void process(ClipboardFragmentInformation fragmentInformation) {
   AuthorDocumentFragment frag = fragmentInformation.getFragment();
   try {
     String xmlContent = authorAccess.getDocumentController().serializeFragmentToXML(frag);
     //Modify the XML content here.....
     
     //Re-create a new fragment from the XML
     AuthorDocumentFragment newFragment = authorAccess.getDocumentController().createNewDocumentFragmentInContext(xmlContent, authorAccess.getEditorAccess().getCaretOffset());
     
     fragmentInformation.setFragment(newFragment);
   } catch (BadLocationException e) {
     e.printStackTrace();
   } catch (AuthorOperationException e) {
     e.printStackTrace();
   }
 }

Since:
12.2

Method Summary
 java.lang.String getClipboardObjectID()
          Get an unique ID of this object taken from the clipboard.
 AuthorDocumentFragment getFragment()
          Get the fragment which will be pasted/dropped.
 java.lang.String getFragmentOriginalLocation()
          Get the URL of the file from which the fragment was copied.
 int getPurposeID()
          Get the purpose for which this fragment is used.
 void setFragment(AuthorDocumentFragment newFragment)
          Set a new fragment replacing the original one which will be pasted/dropped.
 

Method Detail

getPurposeID

int getPurposeID()
Get the purpose for which this fragment is used. One of the constants:

Returns:
The purpose for which this fragment is used.

getClipboardObjectID

java.lang.String getClipboardObjectID()
Get an unique ID of this object taken from the clipboard. For example if multiple pastes are made with same content, the same object ID is returned.

Returns:
An unique ID of this object taken from the clipboard.

getFragmentOriginalLocation

java.lang.String getFragmentOriginalLocation()
Get the URL of the file from which the fragment was copied.

Returns:
The URL of the file from which the fragment was copied.

getFragment

AuthorDocumentFragment getFragment()
Get the fragment which will be pasted/dropped.

Returns:
The fragment which will be pasted/dropped.

setFragment

void setFragment(AuthorDocumentFragment newFragment)
Set a new fragment replacing the original one which will be pasted/dropped.

Parameters:
newFragment - The fragment which will be pasted/dropped.
Since:
13

Oxygen XML Editor 14.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2013. All rights reserved.