org.silverpeas.wysiwyg.control
Class WysiwygContentTransformer

java.lang.Object
  extended by org.silverpeas.wysiwyg.control.WysiwygContentTransformer

public class WysiwygContentTransformer
extends Object

This class provides method to transform wysiwyg content source into other wysiwyg formats.

Author:
Yohann Chastagnier

Method Summary
 WysiwygContentTransformer modifyImageUrlAccordingToHtmlSizeDirective()
          Transforms all URL of images to take into account theirs display size.
static WysiwygContentTransformer on(String wysiwygContent)
          An instance of WYSIWYG transformer on the given content.
 MailContentProcess.MailResult toMailContent()
          Transforms all referenced content links in order to be handled in mail sending.
 String transform()
          Default method in order to apply all the transformation directives and recover immediately the result as string.
<TYPED_RESULT>
TYPED_RESULT
transform(WysiwygContentTransformerProcess<TYPED_RESULT> process)
          Applies all the transformation directives and finally processing the given treatment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

on

public static WysiwygContentTransformer on(String wysiwygContent)
An instance of WYSIWYG transformer on the given content.

Parameters:
wysiwygContent - the wysiwyg content.
Returns:
an instance of the transformer.

modifyImageUrlAccordingToHtmlSizeDirective

public WysiwygContentTransformer modifyImageUrlAccordingToHtmlSizeDirective()
Transforms all URL of images to take into account theirs display size.

Returns:
the instance of the current WysiwygContentTransformer.

transform

public String transform()
Default method in order to apply all the transformation directives and recover immediately the result as string.

Returns:
the transformed wysiwyg content.

transform

public <TYPED_RESULT> TYPED_RESULT transform(WysiwygContentTransformerProcess<TYPED_RESULT> process)
                       throws Exception
Applies all the transformation directives and finally processing the given treatment.

Type Parameters:
TYPED_RESULT - the result type of the process.
Parameters:
process - the process to execute after all the directives.
Returns:
the result of the process execution.
Throws:
Exception

toMailContent

public MailContentProcess.MailResult toMailContent()
                                            throws Exception
Transforms all referenced content links in order to be handled in mail sending. A content can be for example an attachment.
The directive set by method modifyImageUrlAccordingToHtmlSizeDirective() is applied.

Returns:
the wysiwyg content transformed to be sent by mail.
Throws:
Exception


Copyright © 2016 Silverpeas. All Rights Reserved.