Class XHTMLFilter

All Implemented Interfaces:
IFilter, Translator

public class XHTMLFilter extends XMLFilter
Filter for XHTML files.
  • Constructor Details

    • XHTMLFilter

      public XHTMLFilter()
      Creates a new instance of XHTMLFilter
  • Method Details

    • loadPlugins

      public static void loadPlugins()
      Register plugin into OmegaT.
    • unloadPlugins

      public static void unloadPlugins()
    • getFileFormatName

      public String getFileFormatName()
      Human-readable name of the File Format this filter supports.
      Specified by:
      getFileFormatName in interface IFilter
      Specified by:
      getFileFormatName in class AbstractFilter
      Returns:
      File format name
    • getDefaultInstances

      public Instance[] getDefaultInstances()
      The default list of filter instances that this filter class has. One filter class may have different filter instances, different by source file mask, encoding of the source file etc.

      Note that the user may change the instances freely.

      Specified by:
      getDefaultInstances in interface IFilter
      Specified by:
      getDefaultInstances in class AbstractFilter
      Returns:
      Default filter instances
    • isSourceEncodingVariable

      public boolean isSourceEncodingVariable()
      Either the encoding can be read, or it is UTF-8.
      Specified by:
      isSourceEncodingVariable in interface IFilter
      Overrides:
      isSourceEncodingVariable in class XMLFilter
      Returns:
      false
    • isTargetEncodingVariable

      public boolean isTargetEncodingVariable()
      Yes, XHTML may be written out in a variety of encodings.
      Specified by:
      isTargetEncodingVariable in interface IFilter
      Overrides:
      isTargetEncodingVariable in class XMLFilter
      Returns:
      true
    • isFileSupported

      public boolean isFileSupported(File inFile, Map<String,String> config, FilterContext context)
      Checking whether it is a valid XHTML file.
      Specified by:
      isFileSupported in interface IFilter
      Overrides:
      isFileSupported in class AbstractFilter
      Parameters:
      inFile - Source file.
      config - filter's configuration options
      context - Filter context.
      Returns:
      Does the filter support the file.
    • translate

      public String translate(String entry, @Nullable List<ProtectedPart> protectedParts)
      Overrides superimplementation not to send translatable content on XHTML validity check, and don't translate items that match regular expression.
      Specified by:
      translate in interface Translator
      Overrides:
      translate in class XMLFilter
    • hasOptions

      public boolean hasOptions()
      Returns true to indicate that the XHTML filter has options.
      Specified by:
      hasOptions in interface IFilter
      Overrides:
      hasOptions in class AbstractFilter
      Returns:
      True, because the XHTML filter has options.
    • changeOptions

      public @Nullable Map<String,String> changeOptions(Window parent, Map<String,String> currentOptions)
      XHTML Filter shows a modal dialog to edit its own options.
      Parameters:
      currentOptions - Current options to edit.
      parent - parent window
      Returns:
      Updated filter options if user confirmed the changes, and current options otherwise.