Interface ResourceManagementService


  • public interface ResourceManagementService
    The Resource Management Service gives easy access to common resources for the application including texts, images, sounds and some configurations.
    Author:
    Damian Minkov, Adam Netocny
    • Method Detail

      • getColor

        int getColor​(String key)
        Returns the int representation of the color corresponding to the given key.
        Parameters:
        key - The key of the color in the colors properties file.
        Returns:
        the int representation of the color corresponding to the given key.
      • getColorString

        String getColorString​(String key)
        Returns the string representation of the color corresponding to the given key.
        Parameters:
        key - The key of the color in the colors properties file.
        Returns:
        the string representation of the color corresponding to the given key.
      • getImageInputStreamForPath

        InputStream getImageInputStreamForPath​(String path)
        Returns the InputStream of the image corresponding to the given path.
        Parameters:
        path - The path to the image file.
        Returns:
        the InputStream of the image corresponding to the given path.
      • getImageInputStream

        InputStream getImageInputStream​(String streamKey)
        Returns the InputStream of the image corresponding to the given key.
        Parameters:
        streamKey - The identifier of the image in the resource properties file.
        Returns:
        the InputStream of the image corresponding to the given key.
      • getImageURL

        URL getImageURL​(String urlKey)
        Returns the URL of the image corresponding to the given key.
        Parameters:
        urlKey - The identifier of the image in the resource properties file.
        Returns:
        the URL of the image corresponding to the given key
      • getImageURLForPath

        URL getImageURLForPath​(String path)
        Returns the URL of the image corresponding to the given path.
        Parameters:
        path - The path to the given image file.
        Returns:
        the URL of the image corresponding to the given path.
      • getImagePath

        String getImagePath​(String key)
        Returns the image path corresponding to the given key.
        Parameters:
        key - The identifier of the image in the resource properties file.
        Returns:
        the image path corresponding to the given key.
      • getAvailableLocales

        Iterator<Locale> getAvailableLocales()
        All the locales in the language pack.
        Returns:
        all the locales this Language pack contains.
      • getI18NString

        String getI18NString​(String key)
        Returns an internationalized string corresponding to the given key.
        Parameters:
        key - The identifier of the string in the resources properties file.
        Returns:
        An internationalized string corresponding to the given key.
      • getI18NString

        String getI18NString​(String key,
                             Locale locale)
        Returns an internationalized string corresponding to the given key.
        Parameters:
        key - The identifier of the string in the resources properties file.
        locale - The locale.
        Returns:
        An internationalized string corresponding to the given key and given locale.
      • getI18NString

        String getI18NString​(String key,
                             String[] params)
        Returns an internationalized string corresponding to the given key.
        Parameters:
        key - The identifier of the string in the resources properties file.
        params - An array of parameters to be replaced in the returned string.
        Returns:
        An internationalized string corresponding to the given key and given locale.
      • getI18NString

        String getI18NString​(String key,
                             String[] params,
                             Locale locale)
        Returns an internationalized string corresponding to the given key.
        Parameters:
        key - The identifier of the string in the resources properties file.
        params - An array of parameters to be replaced in the returned string.
        locale - The locale.
        Returns:
        An internationalized string corresponding to the given key.
      • getI18nMnemonic

        char getI18nMnemonic​(String key)
        Returns an internationalized string corresponding to the given key.
        Parameters:
        key - The identifier of the string in the resources properties file.
        Returns:
        An internationalized string corresponding to the given key.
      • getI18nMnemonic

        char getI18nMnemonic​(String key,
                             Locale l)
        Returns an internationalized string corresponding to the given key.
        Parameters:
        key - The key of the string.
        l - The locale.
        Returns:
        An internationalized string corresponding to the given key.
      • getSettingsURL

        URL getSettingsURL​(String urlKey)
        Returns an url for the setting corresponding to the given key. Used when the setting is an actual file.
        Parameters:
        urlKey - The key of the setting.
        Returns:
        Url to the corresponding resource.
      • getSettingsInputStream

        InputStream getSettingsInputStream​(String streamKey)
        Returns an InputStream for the setting corresponding to the given key. Used when the setting is an actual file.
        Parameters:
        streamKey - The key of the setting.
        Returns:
        InputStream to the corresponding resource.
      • getSettingsInputStream

        InputStream getSettingsInputStream​(String streamKey,
                                           Class<?> resourceClass)
        Returns a stream from a given identifier, obtained through the class loader of the given resourceClass.
        Parameters:
        streamKey - The identifier of the stream.
        resourceClass - the resource class through which the resource would be obtained
        Returns:
        The stream for the given identifier.
      • getSettingsString

        String getSettingsString​(String key)
        Returns the int value of the corresponding configuration key.
        Parameters:
        key - The identifier of the string in the resources properties file.
        Returns:
        the int value of the corresponding configuration key.
      • getSettingsInt

        int getSettingsInt​(String key)
        Returns the int value of the corresponding configuration key.
        Parameters:
        key - The identifier of the string in the resources properties file.
        Returns:
        the int value of the corresponding configuration key.
      • getSoundURL

        URL getSoundURL​(String urlKey)
        Returns an url for the sound resource corresponding to the given key.
        Parameters:
        urlKey - The key of the setting.
        Returns:
        Url to the corresponding resource.
      • getSoundURLForPath

        URL getSoundURLForPath​(String path)
        Returns an url for the sound resource corresponding to the given path.
        Parameters:
        path - The path to the sound resource.
        Returns:
        Url to the corresponding resource.
      • getSoundPath

        String getSoundPath​(String soundKey)
        Returns the path of the sound corresponding to the given property key.
        Parameters:
        soundKey - The key of the sound.
        Returns:
        the path of the sound corresponding to the given property key.
      • getImage

        ImageIcon getImage​(String imageID)
        Constructs an ImageIcon from the specified image ID and returns it.
        Parameters:
        imageID - The identifier of the image.
        Returns:
        An ImageIcon containing the image with the given identifier.
      • getImageInBytes

        byte[] getImageInBytes​(String imageID)
        Loads the image with the specified ID and returns a byte array containing it.
        Parameters:
        imageID - The identifier of the image.
        Returns:
        A byte array containing the image with the given identifier.
      • prepareSkinBundleFromZip

        File prepareSkinBundleFromZip​(File zipFile)
                               throws Exception
        Builds a new skin bundle from the zip file content.
        Parameters:
        zipFile - Zip file with skin information.
        Returns:
        File for the bundle.
        Throws:
        Exception - When something goes wrong.