Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.workplace.wcm.api
Interface RichTextComponent

All Superinterfaces:
  ContentComponent, WCMApiObject

    public interface RichTextComponent

extends ContentComponent

Represents a Rich Text component.

A `RichTextComponent` is a `ContentComponent` and cannot be stored as a separate entity in the repository.

A `RichTextComponent` can contain formatted rich text.

note: since `v6.0.0`, a `RichTextComponent` is referred to as an `"Rich Text Element"`in the Authoring UI.``

See Also:
  `ContentComponent`

Method Summary
`DocumentType<? extends RichTextComponent>` | `getDocumentType()` Returns the `DocumentType` of the `ContentComponent`.
`java.lang.String` | `getRichText()` Returns the rich text contained in this component as a `String` representation of the HTML.
`void` | `setRichText(java.lang.String richText)` Sets value for this rich text component replacing any existing markup.
`void` | `setRichText(java.lang.String richText, EmbeddedImageMap images)` Deprecated. This method is deprecated from version 6.0. Use `setRichText(String)` instead.

Methods inherited from interface com.ibm.workplace.wcm.api.ContentComponent
`getContainer, getName`

Method Detail

### getDocumentType

    DocumentType<? extends RichTextComponent> getDocumentType()

  Description copied from interface: `ContentComponent`
  Returns the `DocumentType` of the `ContentComponent`.

  Specified by:
    `getDocumentType` in interface `ContentComponent`
  Returns:
    the type
  See Also:
    `ContentComponent.getDocumentType()`

### getRichText

    java.lang.String getRichText()

  Returns the rich text contained in this component as a `String` representation of the HTML.

  Returns:
    the rich text

### setRichText

    void setRichText(java.lang.String richText)
                     throws OperationFailedException

  Sets value for this rich text component replacing any existing markup.

  Images stored on the file system of the WebSphere Portal server can be embedded in the `RichTextComponent`. Embedded images are referenced in the HTML passed to `setRichText(String)` using a standard HTML img tag, the value of the src attribute of the img tag must be the absolute path to the image on the WebSphere Portal server's file system.

  Example code:

  >       // Set HTML with embedded image
  >       String embeddedImage = "<img src='/home/ibm/ibm.jpg' />";
  >       rtComponent.setRichText(embeddedImage);

  Parameters:
    `richText` - the rich text (HTML)
  Throws:
    `OperationFailedException` - if the rich text could not be set
    `java.lang.NullPointerException` - if the argument to this method is `null`

### setRichText

    void setRichText(java.lang.String richText,
                     EmbeddedImageMap images)
                     throws OperationFailedException

  Deprecated. This method is deprecated from version 6.0. Use `setRichText(String)` instead.

  Sets the rich text in the component from a `String` of HTML and embedded images. The URL from the `src` attribute of the `img` tag must have a corresponding entry in an `EmbeddedImageMap` object that you add via the `addImage` method.

  A WCM resource is created for the image when you save the workspace The `src` attribute in the `img` tag will be replaced by a WCM resource's url. If the same URL appears in the HTML more than once, the same WCM resource will be used.

  Note. This method replaces any existing HTML in this component. It does not append to existing HTML. Existing images will be removed, new images will be added.

  Example code:

  >       File file = new File("C:/example/image.jpg");
  >       EmbeddedImageMap embeddedImage = new EmbeddedImageMap();
  >       embeddedImage.addImage("c:/example/image.jpg", file);

  >       // Set HTML
  >       rteComponent.setRichText(rteText, embeddedImage);

  Parameters:
    `richText` - the rich text (HTML)
    `images` - a map of URLs to images
  Throws:
    `OperationFailedException` - if the string argument is `null` or the HTML could not be set

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD