Class WysiwygContent
- java.lang.Object
-
- org.silverpeas.core.contribution.model.WysiwygContent
-
- All Implemented Interfaces:
Serializable
,ContributionContent<String>
public class WysiwygContent extends Object implements ContributionContent<String>
A WYSIWYG content is a rich text (text with styles with graphics and images) that is produced by an editor in a form closely resembling its appearance when printed or displayed.Usually a WYSIWYG content doesn't require to be compiled or transpiled into another form dedicated to the rendering. The WYSIWYG content is enough by itself as it contains all the information to be displayed.
- Author:
- mmoquillon
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description WysiwygContent(LocalizedContribution contribution)
Constructs an empty WYSIWYG content for the specified contribution.WysiwygContent(LocalizedContribution contribution, String richText)
Constructs a new WYSIWYG content for the specified contribution with the given rich text.WysiwygContent(WysiwygContent content)
Constructs a copy of the specified other content.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description WysiwygContent
authoredBy(User author)
Sets a user as the current author of this content.void
delete()
Deletes this content.static void
deleteAllContents(Contribution contribution)
Deletes all the WYSIWYG contents of the specified contribution.boolean
equals(Object o)
User
getAuthor()
Gets the user that has authored this content.static WysiwygContent
getContent(LocalizedContribution contribution)
Gets the WYSIWYG content of the specified contribution.LocalizedContribution
getContribution()
Gets the localized contribution to which the content is related.String
getData()
The rich text of this content.int
hashCode()
boolean
isEmpty()
Does the content is empty?boolean
isModified()
Is this content was modified since its getting.void
save()
Saves this content.void
setData(String richTest)
Modifies the text of this content.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.contribution.model.ContributionContent
getRenderer
-
-
-
-
Constructor Detail
-
WysiwygContent
public WysiwygContent(LocalizedContribution contribution, String richText)
Constructs a new WYSIWYG content for the specified contribution with the given rich text.- Parameters:
contribution
- the contribution related by the content.richText
- the data of the content. If null then an empty text is set.
-
WysiwygContent
public WysiwygContent(LocalizedContribution contribution)
Constructs an empty WYSIWYG content for the specified contribution.- Parameters:
contribution
- the contribution related by the content.
-
WysiwygContent
public WysiwygContent(WysiwygContent content)
Constructs a copy of the specified other content.- Parameters:
content
- the WYSIWYG content to copy.
-
-
Method Detail
-
getContent
public static WysiwygContent getContent(LocalizedContribution contribution)
Gets the WYSIWYG content of the specified contribution.- Parameters:
contribution
- a localized contribution.- Returns:
- the WYSIWYG content of the contribution or null if no such content exists.
-
deleteAllContents
public static void deleteAllContents(Contribution contribution)
Deletes all the WYSIWYG contents of the specified contribution. If the given contribution is an I18n one (a multi-localized contribution) then all of its WYSIWYG contents, one per localization, will be deleted. In the case of a single one localized contribution, only this single WYSIWYG content will be deleted. If the contribution has no WYSIWYG contents, nothing is done.- Parameters:
contribution
- the contribution for which the WYSIWYG contents have to be deleted.
-
authoredBy
public WysiwygContent authoredBy(User author)
Sets a user as the current author of this content.- Parameters:
author
- the user to set.- Returns:
- itself.
-
getContribution
public LocalizedContribution getContribution()
Description copied from interface:ContributionContent
Gets the localized contribution to which the content is related. The language in which the contribution was authored is taken as the content language.- Specified by:
getContribution
in interfaceContributionContent<String>
- Returns:
- the contribution that owns this content.
-
getData
public String getData()
The rich text of this content.- Specified by:
getData
in interfaceContributionContent<String>
- Returns:
- the rich text as a non null string.
-
setData
public void setData(String richTest)
Modifies the text of this content. The content is effectively modified only if the specified text is different to the actual one; in such a case, the content is marked as modified and is then elective for the next storage update.- Parameters:
richTest
- the new text to set. If null then an empty text is set.
-
isEmpty
public boolean isEmpty()
Description copied from interface:ContributionContent
Does the content is empty?- Specified by:
isEmpty
in interfaceContributionContent<String>
- Returns:
- true if this content doesn't contain any data, false otherwise.
-
isModified
public boolean isModified()
Is this content was modified since its getting.- Returns:
- true if this content is modified, false otherwise.
-
getAuthor
public User getAuthor()
Gets the user that has authored this content. If no specific user was set as author then returns the user behind the current request if any.- Returns:
- the author of this content. He can be either the creator of this content or a modifier.
-
save
public void save()
Saves this content.
-
delete
public void delete()
Deletes this content.
-
-