|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.izforge.izpack.installer.ResourceManager
public class ResourceManager
With this ResourceManager you are able to get resources from the jar file.
All resources are loaded language dependent as it's done in java.util.ResourceBundle. To set a language dependent resource just append '_' and the locale to the end of the Resourcenamecreate
by the installer
and later, the instance is retrieved using getInstance
.
Field Summary | |
---|---|
private AutomatedInstallData |
installData
Contains the given InstallData |
private static ResourceManager |
instance
The instance of this class. |
private java.lang.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 java.lang.String |
resourceBasePath
The base path where to find the resources |
Constructor Summary | |
---|---|
protected |
ResourceManager(AutomatedInstallData data)
Constructor. |
Method Summary | |
---|---|
static ResourceManager |
create(AutomatedInstallData data)
Create the resource manager. |
javax.swing.ImageIcon |
getImageIconResource(java.lang.String resource)
Returns a laguage dependent ImageIcon for the given Resource |
java.io.InputStream |
getInputStream(java.lang.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 java.lang.String |
getLanguageResourceString(java.lang.String resource)
This method is used to get the language dependent path of the given resource. |
java.lang.String |
getLocale()
Returns the locale for the resourcefiles. |
java.lang.String |
getTextResource(java.lang.String resource)
Returns a text resource from the jar file. |
java.lang.String |
getTextResource(java.lang.String resource,
java.lang.String encoding)
Returns a text resource from the jar file. |
java.net.URL |
getURL(java.lang.String resource)
Returns a URL refers to the given Resource |
void |
setLocale(java.lang.String locale)
Sets the locale for the resourcefiles. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String locale
protected final java.lang.String resourceBasePath
private AutomatedInstallData installData
private static ResourceManager instance
Constructor Detail |
---|
protected ResourceManager(AutomatedInstallData data)
data
- - the current installDataMethod Detail |
---|
public static ResourceManager create(AutomatedInstallData data)
AutomatedInstallData.localeISO3
data
- the installation information
public static ResourceManager getInstance()
private java.lang.String getLanguageResourceString(java.lang.String resource) throws ResourceNotFoundException
resource
- Resource to load language dependen
ResourceNotFoundException
- If the resource is not foundpublic java.io.InputStream getInputStream(java.lang.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 load
ResourceNotFoundException
- Description of the Exception
ResourceNotFoundException
- thrown if there is no resource foundpublic java.net.URL getURL(java.lang.String resource) throws ResourceNotFoundException
resource
- the resource to load
ResourceNotFoundException
- Description of the Exception
ResourceNotFoundException
- thrown if there is no resource foundpublic java.lang.String getTextResource(java.lang.String resource, java.lang.String encoding) throws ResourceNotFoundException, java.io.IOException
resource
- - a text resource to loadencoding
- - the encoding, which should be used to read the resource
ResourceNotFoundException
- if the resource can not be found
java.io.IOException
- if the resource can not be loadedpublic java.lang.String getTextResource(java.lang.String resource) throws ResourceNotFoundException, java.io.IOException
resource
- - a text resource to load
ResourceNotFoundException
- if the resource can not be found
java.io.IOException
- if the resource can not be loadedpublic javax.swing.ImageIcon getImageIconResource(java.lang.String resource) throws ResourceNotFoundException, java.io.IOException
resource
- resrouce of the Icon
ResourceNotFoundException
- thrown when the resource can not be found
java.io.IOException
- if the resource can not be loadedpublic void setLocale(java.lang.String locale)
locale
- of the resourcefilepublic java.lang.String getLocale()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |