Package esmska.utils

Class MiscUtils


  • public class MiscUtils
    extends java.lang.Object
    Various helper methods.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MiscUtils.Direction  
    • Constructor Summary

      Constructors 
      Constructor Description
      MiscUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String escapeHtml​(java.lang.String input)
      Escape text using html entities.
      static boolean isCropped​(javax.swing.JComponent component)
      Tell whether some JComponent is cropped (not displayed fully).
      static boolean needsResize​(javax.swing.JComponent container, MiscUtils.Direction direction)
      Tell whether some container wants to be resized in a direction
      static java.lang.String removeAccents​(java.lang.String text)
      remove diacritical marks from text
      static java.lang.String stripHtml​(java.lang.String input)
      Strip html tags from text.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MiscUtils

        public MiscUtils()
    • Method Detail

      • escapeHtml

        public static java.lang.String escapeHtml​(java.lang.String input)
        Escape text using html entities. Fixes bug in OpenJDK where scaron entity is not replaced by 'š' and euro by '€'.
        See Also:
        StringEscapeUtils.escapeHtml(String)
      • stripHtml

        public static java.lang.String stripHtml​(java.lang.String input)
        Strip html tags from text.
        Parameters:
        input - input text
        Returns:
        text with all html tags removed. Entities encoded by html codes are unescaped back to standard characters.
      • isCropped

        public static boolean isCropped​(javax.swing.JComponent component)
        Tell whether some JComponent is cropped (not displayed fully).
        Parameters:
        component - component
        Returns:
        true if it is cropped, false otherwise
      • needsResize

        public static boolean needsResize​(javax.swing.JComponent container,
                                          MiscUtils.Direction direction)
        Tell whether some container wants to be resized in a direction
        Parameters:
        container - container
        direction - direction, BOTH when null
        Returns:
        true if the container wants to be resized, false otherwise
      • removeAccents

        public static java.lang.String removeAccents​(java.lang.String text)
        remove diacritical marks from text