Package com.inet.html
Class InetHtmlConfiguration
java.lang.Object
com.inet.html.InetHtmlConfiguration
- All Implemented Interfaces:
Cloneable
This class defines the settings used by the document and the view/editor of a document. It influences
the rendering as well as the parse/write of the document.
The main purpose is, to toggle between settings which support wysiwyg editing and settings which do a HTML4 conform rendering of the document.
For example: A BR-Tag in HTML causes a line wrap only, if there is content after the BR. But when editing, one would expect that there whill always be a new line after inserting a soft-break.
The main purpose is, to toggle between settings which support wysiwyg editing and settings which do a HTML4 conform rendering of the document.
For example: A BR-Tag in HTML causes a line wrap only, if there is content after the BR. But when editing, one would expect that there whill always be a new line after inserting a soft-break.
-
Constructor Summary
ConstructorsConstructorDescriptionInetHtmlConfiguration(boolean inlineBoxCompatible, boolean allowInternalImages, boolean transformEmptyBlocks, boolean doAlwaysBreak, boolean shouldBeEditable, HTML.Tag defaultBlock) Creates an configuration with preset properties -
Method Summary
Modifier and TypeMethodDescriptionprotected Objectclone()static InetHtmlConfigurationReturns a Browser config - most restrictiveReturns the name of the default paragraph block namestatic InetHtmlConfigurationReturns a config for HTML editing.static InetHtmlConfigurationReturns a mail editor config.booleanReturns whether image paste is allowedbooleanHTML predicts that the last soft-break in a block has to be ignored, if no content follows.booleanThis flag influences the way, setCharacterAttributes works.booleanReturns whether the editor should be set to editable by defaultbooleanThis flag sets the block handling to wysiwyg.voidsetAllowInternalImages(boolean allowInternalImages) Sets whether image paste is allowedvoidsetDefaultBlock(HTML.Tag defaultBlock) Sets the name of the default paragraph block namevoidsetDoAlwaysBreak(boolean doAlwaysBreak) Sets the always break mode.
HTML predicts that the last soft-break in a block has to be ignored, if no content follows.voidsetInlineBoxCompatible(boolean inlineBoxCompatible) This flag influences the way, setCharacterAttributes works.voidsetShouldBeEditable(boolean shouldBeEditable) Set whether the editor should be set to editable by defaultvoidsetTransformEmptyBlocks(boolean transformEmptyBlocks) Sets the empty blocks transformation modetoString()
-
Constructor Details
-
InetHtmlConfiguration
public InetHtmlConfiguration(boolean inlineBoxCompatible, boolean allowInternalImages, boolean transformEmptyBlocks, boolean doAlwaysBreak, boolean shouldBeEditable, HTML.Tag defaultBlock) Creates an configuration with preset properties- Parameters:
inlineBoxCompatible- set to true, if setCharacterAttributes should not split inline structuresallowInternalImages- set to true, to allow pasted images with no external sourcetransformEmptyBlocks- set to true, to fill empty blocks to make them visibledoAlwaysBreak- set to true, to cause any BR to create a new lineshouldBeEditable- set to true, to set editors to editable by defaultdefaultBlock- the default paragraph tag name- Since:
- 1.05
-
-
Method Details
-
toString
-
getBrowserConfig
Returns a Browser config - most restrictive- Returns:
- a Browser config
- Since:
- 1.05
-
getHtmlEditorConfig
Returns a config for HTML editing. This config should be used when editing web-pages. It is not designed for text editing!- Returns:
- a HTML editing config
- Since:
- 1.05
-
getMailEditorConfig
Returns a mail editor config. This should be used when editing large HTML texts- Returns:
- a mail editor config. This should be used when editing large HTML texts
- Since:
- 1.05
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
isInlineBoxCompatible
public boolean isInlineBoxCompatible()This flag influences the way, setCharacterAttributes works.
If set to true, inline-Elements will never be splitted. The reason is simple: if we reuse an inline box to set character attributes and this box has borders set, the borders will appear at the split position! Normal Mails don't have this type of formatting, but some websites may have.- Returns:
- If false, inline boxes may be splitted and reused. This will reduce the number of spans.
- Since:
- 1.05
-
setInlineBoxCompatible
public void setInlineBoxCompatible(boolean inlineBoxCompatible) This flag influences the way, setCharacterAttributes works.
If set to true, inline-Elements will never be splitted. The reason is simple: if we reuse an inline box to set character attributes and this box has borders set, the borders will appear at the split position! Normal Mails don't have this type of formatting, but some websites may have.- Parameters:
inlineBoxCompatible- true to activate- Since:
- 1.05
- See Also:
-
isAllowInternalImages
public boolean isAllowInternalImages()Returns whether image paste is allowed- Returns:
- true, if image paste is allowed
- Since:
- 1.05
-
setAllowInternalImages
public void setAllowInternalImages(boolean allowInternalImages) Sets whether image paste is allowed- Parameters:
allowInternalImages- true to allowe, false to disable- Since:
- 1.05
-
getDefaultBlock
Returns the name of the default paragraph block name- Returns:
- the name of the default paragraph block name
- Since:
- 1.05
-
setDefaultBlock
Sets the name of the default paragraph block name- Parameters:
defaultBlock- the tag to set- Since:
- 1.05
-
isTransformEmptyBlocks
public boolean isTransformEmptyBlocks()This flag sets the block handling to wysiwyg. In a HTML an empty block would be collapsed but when editing one would expect to have the possibility to insert content into every block, even the empty ones. Thats why in wysiwyg-mode every empty Block will get a until content is inserted.- Returns:
- true, if empty block will be transformed
- Since:
- 1.05
-
setTransformEmptyBlocks
public void setTransformEmptyBlocks(boolean transformEmptyBlocks) Sets the empty blocks transformation mode- Parameters:
transformEmptyBlocks- set to true to enable- Since:
- 1.05
- See Also:
-
isDoAlwaysBreak
public boolean isDoAlwaysBreak()HTML predicts that the last soft-break in a block has to be ignored, if no content follows. That's ok for websites, but unexpected when editing. If this flag is set to true, every BR will cause a new line no matter the context.- Returns:
- true, if any BR will create a new line
- Since:
- 1.05
-
setDoAlwaysBreak
public void setDoAlwaysBreak(boolean doAlwaysBreak) Sets the always break mode.
HTML predicts that the last soft-break in a block has to be ignored, if no content follows. That's ok for websites, but unexpected when editing. If this flag is set to true, every BR will cause a new line no matter the context.- Parameters:
doAlwaysBreak- set to true to active- Since:
- 1.05
- See Also:
-
isShouldBeEditable
public boolean isShouldBeEditable()Returns whether the editor should be set to editable by default- Returns:
- true, if the editor should be set to editable by default
- Since:
- 1.05
-
setShouldBeEditable
public void setShouldBeEditable(boolean shouldBeEditable) Set whether the editor should be set to editable by default- Parameters:
shouldBeEditable- true, if editable by default- Since:
- 1.05
-