public class ResourceManager extends Object
create
by the installer
and later, the instance is retrieved using getInstance
.Modifier and Type | Field and Description |
---|---|
private AutomatedInstallData |
installData
Contains the given InstallData
|
private static ResourceManager |
instance
The instance of this class.
|
private String |
locale
Contains the current language of the installer The locale is taken from
InstallData#installData#getAttribute("langpack") If there is no language set, the language is
english.
|
protected String |
resourceBasePath
The base path where to find the resources
|
Modifier | Constructor and Description |
---|---|
protected |
ResourceManager(AutomatedInstallData data)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static ResourceManager |
create(AutomatedInstallData data)
Create the resource manager.
|
ImageIcon |
getImageIconResource(String resource)
Returns a laguage dependent ImageIcon for the given Resource
|
InputStream |
getInputStream(String resource)
Returns an InputStream contains the given Resource The Resource is loaded language dependen
by the informations from
this.locale If there is no Resource for the current
language found, the default Resource is given. |
static ResourceManager |
getInstance()
Return the resource manager.
|
private String |
getLanguageResourceString(String resource)
This method is used to get the language dependent path of the given resource.
|
String |
getLocale()
Returns the locale for the resourcefiles.
|
String |
getTextResource(String resource)
Returns a text resource from the jar file.
|
URL |
getURL(String resource)
Returns a URL refers to the given Resource
|
void |
setLocale(String locale)
Sets the locale for the resourcefiles.
|
private String locale
protected final String resourceBasePath
private AutomatedInstallData installData
private static ResourceManager instance
protected ResourceManager(AutomatedInstallData data)
data
- - the current installDatapublic static ResourceManager create(AutomatedInstallData data)
AutomatedInstallData.localeISO3
data
- the installation informationpublic static ResourceManager getInstance()
private String getLanguageResourceString(String resource) throws ResourceNotFoundException
resource
- Resource to load language dependenResourceNotFoundException
- If the resource is not foundpublic InputStream getInputStream(String resource) throws ResourceNotFoundException
this.locale
If there is no Resource for the current
language found, the default Resource is given.resource
- The resource to loadResourceNotFoundException
- Description of the ExceptionResourceManager.ResourceNotFoundException
- thrown if there is no resource foundpublic URL getURL(String resource) throws ResourceNotFoundException
resource
- the resource to loadResourceNotFoundException
- Description of the ExceptionResourceManager.ResourceNotFoundException
- thrown if there is no resource foundpublic String getTextResource(String resource) throws ResourceNotFoundException, IOException
resource
- - a text resource to loadResourceNotFoundException
- if the resource can not be foundIOException
- if the resource can not be loadedpublic ImageIcon getImageIconResource(String resource) throws ResourceNotFoundException, IOException
resource
- resrouce of the IconResourceNotFoundException
- thrown when the resource can not be foundIOException
- if the resource can not be loadedpublic void setLocale(String locale)
locale
- of the resourcefileWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses