java.lang.Object
org.eclipse.nebula.widgets.nattable.extension.nebula.richtext.RegexMarkupValue
All Implemented Interfaces:
MarkupProcessor

public class RegexMarkupValue extends Object implements MarkupProcessor
MarkupProcessor implementation that is able to process regular expression values to identify content that should be surrounded by a markup. The regular expression needs to contain one group so the replacement can be done by using a placeholder.
Since:
1.1
  • Constructor Details

    • RegexMarkupValue

      public RegexMarkupValue(String value, String markupPrefix, String markupSuffix)
      Parameters:
      value - The regular expression that specifies the value that should be surrounded by a markup.
      markupPrefix - The String that should be added as prefix.
      markupSuffix - The String that should be added as suffix.
  • Method Details

    • applyMarkup

      public String applyMarkup(String input)
      Description copied from interface: MarkupProcessor
      Takes an input and applies the HTML markup.
      Specified by:
      applyMarkup in interface MarkupProcessor
      Parameters:
      input - The input that should be processed for markup.
      Returns:
      The input with additional markups.
    • removeMarkup

      public String removeMarkup(String input)
      Description copied from interface: MarkupProcessor
      Takes an input and removes possible markups that where applied by this MarkupProcessor
      Specified by:
      removeMarkup in interface MarkupProcessor
      Parameters:
      input - The input from which the markup should be removed.
      Returns:
      The input value without markups.
    • setRegexValue

      public void setRegexValue(String value)
      Set the regular expression that specifies the value that should be surrounded by a markup.
      Parameters:
      value - The regular expression that specifies the value that should be surrounded by a markup.
    • getOriginalRegexValue

      protected String getOriginalRegexValue()
      Returns the regular expression that specifies the value that should be surrounded by a markup. Subclasses can override this method to provide a dynamic markup value, e.g. for highlighting values inserted into a text field.
      Returns:
      The regular expression that specifies the value that should be surrounded by a markup.
    • getMarkupRegexValue

      protected String getMarkupRegexValue()
      Returns the regular expression that specifies the value that should be surrounded by a markup, with the applied markup.
      Returns:
      The original regex value with applied markup.
    • isCaseInsensitive

      public boolean isCaseInsensitive()
      Return whether the Pattern.CASE_INSENSITIVE flag is applied to enable case insensitive matching.

      Note: Case-insensitive matching can also be enabled via the embedded flag expression (?i) if the flag in this RegexMarkupValue is disabled.

      Returns:
      true if case insensitive matching is enabled, false if matching is case sensitive.
      Since:
      1.2
    • setCaseInsensitive

      public void setCaseInsensitive(boolean caseInsensitive)
      Configure whether the Pattern.CASE_INSENSITIVE flag should be applied to enable case insensitive matching.

      Note: Case-insensitive matching can also be enabled via the embedded flag expression (?i) if the flag in this RegexMarkupValue is disabled.

      Parameters:
      caseInsensitive - true if case insensitive matching should be enabled, false if matching should be case sensitive.
      Since:
      1.2
    • isUnicodeCase

      public boolean isUnicodeCase()
      Return whether the Pattern.UNICODE_CASE flag is applied to enable Unicode aware case folding. Only works if case insensitive matching is enabled.

      Note: Unicode-aware case folding can also be enabled via the embedded flag expression (?u) if the flag in this RegexMarkupValue is disabled.

      Returns:
      true if Unicode aware case folding is enabled, false if case-insensitive matching assumes that only characters in the US-ASCII charset are being matched.
      Since:
      1.2
    • setUnicodeCase

      public void setUnicodeCase(boolean unicodeCase)
      Configure whether the Pattern.UNICODE_CASE flag should be applied to enable Unicode aware case folding. Only works if case insensitive matching is enabled.

      Note: Unicode-aware case folding can also be enabled via the embedded flag expression (?u) if the flag in this RegexMarkupValue is disabled.

      Parameters:
      unicodeCase - true if Unicode aware case folding should be enabled, false if case-insensitive matching should only match characters in the US-ASCII charset.
      Since:
      1.2