Class JListUtils


  • public class JListUtils
    extends java.lang.Object
    • Field Detail

      • iconCache

        private static java.util.Map<java.io.File,​javax.swing.Icon> iconCache
      • textFilesCache

        private static java.util.Map<java.io.File,​java.lang.String> textFilesCache
      • stamps

        private static java.util.Map<java.io.File,​java.lang.Long> stamps
    • Constructor Detail

      • JListUtils

        public JListUtils()
    • Method Detail

      • processIconCache

        private static javax.swing.Icon processIconCache​(java.io.File f)
        This method looks to cache whether file F was already read as image. If not, file is loaded, put to cache and returned If so, it also check whether it was modified. If so, it is reloaded, replaced in cache and returned.
        Parameters:
        f -
        Returns:
      • updateIconCache

        private static javax.swing.Icon updateIconCache​(java.io.File f,
                                                        javax.swing.Icon i)
        This method load Icon from file. Once file is loaded, it is stored also to cache Also the time stamp of last modification is stored to cache to allow reloading when changed.
        Parameters:
        f - file to load, and to provide timestamp of last modification
        Returns:
        loaded icon or null
      • processTextFilesCache

        private static java.lang.String processTextFilesCache​(java.io.File f)
        This method looks to cache whether file F was already read as text file. If not, file is loaded, and its content is put to cache and returned as String If so, it also check whether it was modified. If so, it is reloaded, replaced in cache and returned.
        Parameters:
        f -
        Returns:
      • updateTextCache

        private static java.lang.String updateTextCache​(java.io.File f,
                                                        java.lang.String s)
        This method load Text from file. Once file is loaded, it is stored also to cache Also the time stamp of last modification is stored to cache to allow reloading when changed.
        Parameters:
        f - file to load, and to provide timestamp of last modification
        Returns:
        loaded Text, error message or null
      • createImageIcon

        private static javax.swing.ImageIcon createImageIcon​(java.io.File f,
                                                             java.lang.String description)
        Load BufferedImage form file, scale it and converts to icon.
        Parameters:
        f - file to be loaded
        description - description to be provided
        Returns:
        icon from file or null if something went wrong