Class InformationDesc
- java.lang.Object
-
- net.adoptopenjdk.icedteaweb.jnlp.element.information.InformationDesc
-
public class InformationDesc extends java.lang.ObjectThe information element contains information intended to be consumed by the JNLP Client to integrate the application into the desktop, provide user feedback, etc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classInformationDesc.ExtensionAndMimeType
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringarchSpecifies the architecure for which the information element should be considered.static java.lang.StringARCH_ATTRIBUTEprivate java.util.Map<java.lang.String,java.util.List<java.lang.Object>>infothe data as list of key,value pairsstatic java.lang.StringINFORMATION_ELEMENTstatic java.lang.StringLOCALE_ATTRIBUTEprivate java.util.Locale[]localesThe locales for which the information element should be used.static java.lang.StringOFFLINE_ALLOWED_ELEMENTprivate java.lang.StringosSpecifies the operating system for which the information element should be considered.static java.lang.StringOS_ATTRIBUTEbooleanstrictstatic java.lang.StringTITLE_ELEMENTstatic java.lang.StringVENDOR_ELEMENT
-
Constructor Summary
Constructors Constructor Description InformationDesc(java.util.Locale[] locales)Create an information element object.InformationDesc(java.util.Locale[] locales, boolean strict)Create an information element object.InformationDesc(java.util.Locale[] locales, java.lang.String os, java.lang.String arch)Create an information element object.InformationDesc(java.util.Locale[] locales, java.lang.String os, java.lang.String arch, boolean strict)Create an information element object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddItem(java.lang.String key, java.lang.Object value)Add an information item (description, icon, etc) under a specified key name.java.lang.StringgetArch()AssociationDesc[]getAssociations()java.lang.StringgetDescription()A short statement about the application.java.lang.StringgetDescription(DescriptionKind kind)java.lang.StringgetDescriptionStrict(DescriptionKind kind)java.net.URLgetHomepage()java.net.URLgetIconLocation(IconKind kind, int dimension)java.net.URLgetIconLocation(IconKind kind, int width, int height)Returns the URL of the icon with the given type and a size closest to the requested width and height.IconDesc[]getIcons(IconKind kind)Returns the icons specified by the JNLP file.private java.lang.ObjectgetItem(java.lang.String key)java.util.Map<java.lang.String,java.util.List<java.lang.Object>>getItems()java.util.List<java.lang.Object>getItems(java.lang.String key)java.util.Locale[]getLocales()java.lang.StringgetOs()RelatedContentDesc[]getRelatedContents()ShortcutDescgetShortcut()java.lang.StringgetTitle()java.lang.StringgetVendor()booleanisOfflineAllowed()booleanisSharingAllowed()private longsquareDistance(int width, int height, IconDesc icon)
-
-
-
Field Detail
-
INFORMATION_ELEMENT
public static final java.lang.String INFORMATION_ELEMENT
- See Also:
- Constant Field Values
-
OS_ATTRIBUTE
public static final java.lang.String OS_ATTRIBUTE
- See Also:
- Constant Field Values
-
ARCH_ATTRIBUTE
public static final java.lang.String ARCH_ATTRIBUTE
- See Also:
- Constant Field Values
-
LOCALE_ATTRIBUTE
public static final java.lang.String LOCALE_ATTRIBUTE
- See Also:
- Constant Field Values
-
TITLE_ELEMENT
public static final java.lang.String TITLE_ELEMENT
- See Also:
- Constant Field Values
-
VENDOR_ELEMENT
public static final java.lang.String VENDOR_ELEMENT
- See Also:
- Constant Field Values
-
OFFLINE_ALLOWED_ELEMENT
public static final java.lang.String OFFLINE_ALLOWED_ELEMENT
- See Also:
- Constant Field Values
-
locales
private final java.util.Locale[] locales
The locales for which the information element should be used.
-
os
private final java.lang.String os
Specifies the operating system for which the information element should be considered. If the value is a prefix of the os.name system property, then the information element can be used. If the attribute is not specified, it matches all operating systems.
-
arch
private final java.lang.String arch
Specifies the architecure for which the information element should be considered. If the value is a prefix of the os.arch system property, then the information element can be used. If the attribute is not specified, it matches all architecures.
-
info
private final java.util.Map<java.lang.String,java.util.List<java.lang.Object>> info
the data as list of key,value pairs
-
strict
public final boolean strict
-
-
Constructor Detail
-
InformationDesc
InformationDesc(java.util.Locale[] locales)
Create an information element object.- Parameters:
locales- the locales for which the information element should be used
-
InformationDesc
public InformationDesc(java.util.Locale[] locales, boolean strict)Create an information element object.- Parameters:
locales- the locales for which the information element should be usedstrict- whether parser was strict
-
InformationDesc
public InformationDesc(java.util.Locale[] locales, java.lang.String os, java.lang.String arch)Create an information element object.- Parameters:
locales- the locales for which the information element should be usedos- the operating system for which the information element should be consideredarch- the architecure for which the information element should be considered
-
InformationDesc
public InformationDesc(java.util.Locale[] locales, java.lang.String os, java.lang.String arch, boolean strict)Create an information element object.- Parameters:
locales- the locales for which the information element should be usedos- the operating system for which the information element should be consideredarch- the architecure for which the information element should be consideredstrict- whether parser was strict
-
-
Method Detail
-
getTitle
public java.lang.String getTitle()
- Returns:
- the application's title.
-
getVendor
public java.lang.String getVendor()
- Returns:
- the application's vendor.
-
getHomepage
public java.net.URL getHomepage()
- Returns:
- the application's homepage.
-
getDescription
public java.lang.String getDescription()
A short statement about the application. Longer descriptions should be put on a separate web page and referred to using the homepage element.- Returns:
- the default description for the application.
-
getDescription
public java.lang.String getDescription(DescriptionKind kind)
- Parameters:
kind- one ofDescriptionKind- Returns:
- the application's description of the specified type.
-
getDescriptionStrict
public java.lang.String getDescriptionStrict(DescriptionKind kind)
- Parameters:
kind- one ofDescriptionKind- Returns:
- the application's description of the specified type.
-
getIcons
public IconDesc[] getIcons(IconKind kind)
Returns the icons specified by the JNLP file.- Parameters:
kind- one ofIconKind- Returns:
- an array of zero of more IconDescs of the specified icon type
-
getIconLocation
public java.net.URL getIconLocation(IconKind kind, int dimension)
-
getIconLocation
public java.net.URL getIconLocation(IconKind kind, int width, int height)
Returns the URL of the icon with the given type and a size closest to the requested width and height. This method will only return an icon smaller than the specified width and height if there exists no bigger icons.- Parameters:
kind- the kind of icon to getwidth- desired width of iconheight- desired height of icon- Returns:
- the closest icon by size or null if no icons declared
-
squareDistance
private long squareDistance(int width, int height, IconDesc icon)
-
getLocales
public java.util.Locale[] getLocales()
- Returns:
- the locales for the information.
-
getOs
public java.lang.String getOs()
- Returns:
- the operating system for which the information element should be considered
-
getArch
public java.lang.String getArch()
- Returns:
- the architecure for which the information element should be considered
-
isOfflineAllowed
public boolean isOfflineAllowed()
- Returns:
- whether offline execution allowed.
-
isSharingAllowed
public boolean isSharingAllowed()
- Returns:
- whether the resources specified in the JNLP file may be shared by more than one instance in the same JVM (JNLP extension). This is an extension to the JNLP spec and will always return false for standard JNLP files.
-
getAssociations
public AssociationDesc[] getAssociations()
- Returns:
- the associations specified in the JNLP file
-
getShortcut
public ShortcutDesc getShortcut()
- Returns:
- the shortcut specified by this JNLP file
-
getRelatedContents
public RelatedContentDesc[] getRelatedContents()
- Returns:
- the related-contents specified by this JNLP file
-
getItem
private java.lang.Object getItem(java.lang.String key)
- Parameters:
key- key to find item- Returns:
- the last item matching the specified key.
-
getItems
public java.util.List<java.lang.Object> getItems(java.lang.String key)
- Parameters:
key- key to find item- Returns:
- all items matching the specified key.
-
addItem
public void addItem(java.lang.String key, java.lang.Object value)Add an information item (description, icon, etc) under a specified key name.- Parameters:
key- key to place value tovalue- value to be placed to key
-
getItems
public java.util.Map<java.lang.String,java.util.List<java.lang.Object>> getItems()
-
-