com.inet.html
Class InetHtmlConfiguration

java.lang.Object
  extended by com.inet.html.InetHtmlConfiguration
All Implemented Interfaces:
java.lang.Cloneable

public class InetHtmlConfiguration
extends java.lang.Object
implements java.lang.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.


Constructor Summary
InetHtmlConfiguration(boolean inlineBoxCompatible, boolean allowInternalImages, boolean transformEmptyBlocks, boolean doAlwaysBreak, boolean shouldBeEditable, HTML.Tag defaultBlock)
          Creates an configuration
 
Method Summary
static InetHtmlConfiguration getBrowserConfig()
          Returns a Browser config - most restrictive
 HTML.Tag getDefaultBlock()
          Returns the name of the default paragraph block name
static InetHtmlConfiguration getHtmlEditorConfig()
          Returns a config for HTML editing.
static InetHtmlConfiguration getMailEditorConfig()
          Returns a mail editor config.
 boolean isAllowInternalImages()
          Returns whether image paste is allowed
 boolean isDoAlwaysBreak()
          HTML predicts that the last soft-break in a block has to be ignored, if no content follows.
 boolean isInlineBoxCompatible()
          This flag influences the way, setCharacterAttributes works.
 boolean isShouldBeEditable()
          Returns whether the editor should be set to editable by default
 boolean isTransformEmptyBlocks()
          This flag sets the block handling to wysiwyg.
 void setAllowInternalImages(boolean allowInternalImages)
          Sets whether image paste is allowed
 void setDefaultBlock(HTML.Tag defaultBlock)
          Sets the name of the default paragraph block name
 void setDoAlwaysBreak(boolean doAlwaysBreak)
          Sets the always break mode
 void setInlineBoxCompatible(boolean inlineBoxCompatible)
          Sets the inline box compatible mode
 void setShouldBeEditable(boolean shouldBeEditable)
          Set whether the editor should be set to editable by default
 void setTransformEmptyBlocks(boolean transformEmptyBlocks)
          Sets the empty blocks transformation mode
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InetHtmlConfiguration

public InetHtmlConfiguration(boolean inlineBoxCompatible,
                             boolean allowInternalImages,
                             boolean transformEmptyBlocks,
                             boolean doAlwaysBreak,
                             boolean shouldBeEditable,
                             HTML.Tag defaultBlock)
Creates an configuration

Parameters:
inlineBoxCompatible - set to true, if setCharacterAttributes should not split inline structures
allowInternalImages - set to true, to allow pasted images with no external source
transformEmptyBlocks - set to true, to fill empty blocks to make them visible
doAlwaysBreak - set to true, to cause any BR to create a new line
shouldBeEditable - set to true, to set editors to editable by default
defaultBlock - the default paragraph tag name
Method Detail

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

getBrowserConfig

public static InetHtmlConfiguration getBrowserConfig()
Returns a Browser config - most restrictive

Returns:
a Browser config

getHtmlEditorConfig

public static InetHtmlConfiguration 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

getMailEditorConfig

public static InetHtmlConfiguration 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

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.

setInlineBoxCompatible

public void setInlineBoxCompatible(boolean inlineBoxCompatible)
Sets the inline box compatible mode

Parameters:
inlineBoxCompatible - true to activate
See Also:
isInlineBoxCompatible()

isAllowInternalImages

public boolean isAllowInternalImages()
Returns whether image paste is allowed

Returns:
true, if image paste is allowed

setAllowInternalImages

public void setAllowInternalImages(boolean allowInternalImages)
Sets whether image paste is allowed

Parameters:
allowInternalImages - true to allowe, false to disable

getDefaultBlock

public HTML.Tag getDefaultBlock()
Returns the name of the default paragraph block name

Returns:
the name of the default paragraph block name

setDefaultBlock

public void setDefaultBlock(HTML.Tag defaultBlock)
Sets the name of the default paragraph block name

Parameters:
defaultBlock - the tag to set

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

setTransformEmptyBlocks

public void setTransformEmptyBlocks(boolean transformEmptyBlocks)
Sets the empty blocks transformation mode

Parameters:
transformEmptyBlocks - set to true to enable
See Also:
isTransformEmptyBlocks()

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

setDoAlwaysBreak

public void setDoAlwaysBreak(boolean doAlwaysBreak)
Sets the always break mode

Parameters:
doAlwaysBreak - set to true to active
See Also:
isDoAlwaysBreak()

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

setShouldBeEditable

public void setShouldBeEditable(boolean shouldBeEditable)
Set whether the editor should be set to editable by default

Parameters:
shouldBeEditable - true, if editable by default