Package com.inet.html

Class InetHtmlConfiguration

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

public class InetHtmlConfiguration extends Object implements 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 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 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
      Since:
      1.05
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getBrowserConfig

      public static InetHtmlConfiguration getBrowserConfig()
      Returns a Browser config - most restrictive
      Returns:
      a Browser config
      Since:
      1.05
    • 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
      Since:
      1.05
    • 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
      Since:
      1.05
    • clone

      protected Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      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

      public HTML.Tag getDefaultBlock()
      Returns the name of the default paragraph block name
      Returns:
      the name of the default paragraph block name
      Since:
      1.05
    • setDefaultBlock

      public void setDefaultBlock(HTML.Tag defaultBlock)
      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