public class JIPipeResourceManager extends Object
Constructor and Description |
---|
JIPipeResourceManager(Class<?> resourceClass,
String basePath)
Creates a new resource manager with the following settings:
icons 16x16 path: [basePath]/icons
icons 32x32 path: [basePath]/icons-32
dark icons 16x16 path: [basePath]/dark/icons
dark icons 32x32 path: [basePath]/dark/icons-32
templates path: [basePath]/templates
schemas path: [basePath]/schemas
|
JIPipeResourceManager(Class<?> resourceClass,
String basePath,
String icons16BasePath,
String darkIcons16BasePath,
String icons32BasePath,
String darkIcons32BasePath,
String icons64BasePath,
String darkIcons64BasePath,
String icons128BasePath,
String darkIcons128BasePath,
String templateBasePath,
String schemaBasePath)
Creates a new instance
|
Modifier and Type | Method and Description |
---|---|
void |
exportResourceToFile(String internalResourcePath,
Path outputFile)
Saves a resource as file
|
static String |
formatBasePath(String path)
Applies the appropriate formatting for a base path
|
String |
getBasePath() |
String |
getDarkIcons128BasePath() |
String |
getDarkIcons16BasePath() |
String |
getDarkIcons32BasePath() |
String |
getDarkIcons64BasePath() |
ImageIcon |
getIcon128FromResources(String iconName)
Returns an icon from JIPipe resources
|
URL |
getIcon128URLFromResources(String iconName)
Returns the URL of a 128x128 icon.
|
URL |
getIcon16URLFromResources(String iconName)
Returns the URL of a 16x16 icon.
|
ImageIcon |
getIcon32FromResources(String iconName)
Returns an icon from JIPipe resources
|
URL |
getIcon32URLFromResources(String iconName)
Returns the URL of a 32x32 icon.
|
ImageIcon |
getIcon64FromResources(String iconName)
Returns an icon from JIPipe resources
|
URL |
getIcon64URLFromResources(String iconName)
Returns the URL of a 64x64 icon.
|
ImageIcon |
getIconFromResources(String iconName)
Returns an icon from JIPipe resources
|
String |
getIcons128BasePath() |
String |
getIcons16BasePath() |
String |
getIcons32BasePath() |
String |
getIcons64BasePath() |
URL |
getIconURLFromResources(String iconName)
Returns the URL of a 16x16 icon.
|
InputStream |
getResourceAsStream(String internalResourcePath)
Gets a plugin-internal resource as stream
|
Class<?> |
getResourceClass() |
URL |
getResourceURL(String internalResourcePath)
Gets a plugin-internal resource as URL
|
String |
getSchemaBasePath() |
String |
getTemplateBasePath() |
String |
relativeToAbsoluteResourcePath(String internalResourcePath)
Converts a relative resource path to an absolute resource path
|
public JIPipeResourceManager(Class<?> resourceClass, String basePath, String icons16BasePath, String darkIcons16BasePath, String icons32BasePath, String darkIcons32BasePath, String icons64BasePath, String darkIcons64BasePath, String icons128BasePath, String darkIcons128BasePath, String templateBasePath, String schemaBasePath)
resourceClass
- the class that acts as the base for accessing the resources. Should be in the same package as the extensionbasePath
- absolute resource path to the resource root e.g. /org/hkijena/jipipe/extensions/myextension (must be consistent with the resource directory)icons16BasePath
- resource path to the 16x16 iconsdarkIcons16BasePath
- resource path to the dark 16x16 icons (icons themselves are optional; the non-dark versions are automatically utilized if no dark version is available)icons32BasePath
- resource path to the 32x32 iconsdarkIcons32BasePath
- resource path to the dark 32x32 icons (icons themselves are optional; the non-dark versions are automatically utilized if no dark version is available)icons64BasePath
- resource path to the 64x64 iconsdarkIcons64BasePath
- resource path to the dark 64x64 icons (icons themselves are optional; the non-dark versions are automatically utilized if no dark version is available)icons128BasePath
- resource path to the 128x128 iconsdarkIcons128BasePath
- resource path to the dark 128x128 icons (icons themselves are optional; the non-dark versions are automatically utilized if no dark version is available)templateBasePath
- resource path to the template directoryschemaBasePath
- resource path to the schema directorypublic JIPipeResourceManager(Class<?> resourceClass, String basePath)
resourceClass
- the class that acts as the base for accessing the resources. Should be in the same package as the extensionbasePath
- absolute resource path to the resource root e.g. /org/hkijena/jipipe/extensions/myextension (must be consistent with the resource directory)public static String formatBasePath(String path)
path
- the base pathpublic Class<?> getResourceClass()
public URL getIconURLFromResources(String iconName)
iconName
- the icon namepublic URL getIcon16URLFromResources(String iconName)
iconName
- the icon namepublic URL getIcon32URLFromResources(String iconName)
iconName
- the icon namepublic URL getIcon64URLFromResources(String iconName)
iconName
- the icon namepublic URL getIcon128URLFromResources(String iconName)
iconName
- the icon namepublic ImageIcon getIconFromResources(String iconName)
iconName
- relative to the icons/ plugin resourcepublic ImageIcon getIcon32FromResources(String iconName)
iconName
- relative to the icons/ plugin resourcepublic ImageIcon getIcon64FromResources(String iconName)
iconName
- relative to the icons/ plugin resourcepublic ImageIcon getIcon128FromResources(String iconName)
iconName
- relative to the icons/ plugin resourcepublic String getBasePath()
public String getIcons16BasePath()
public String getIcons32BasePath()
public String getDarkIcons16BasePath()
public String getDarkIcons32BasePath()
public String getTemplateBasePath()
public String getSchemaBasePath()
public String getIcons64BasePath()
public String getDarkIcons64BasePath()
public String getIcons128BasePath()
public String getDarkIcons128BasePath()
public String relativeToAbsoluteResourcePath(String internalResourcePath)
internalResourcePath
- the internal pathpublic URL getResourceURL(String internalResourcePath)
internalResourcePath
- internal path relative to the resource base pathpublic InputStream getResourceAsStream(String internalResourcePath)
internalResourcePath
- internal path relative to the resource base pathCopyright © 2020–2025 Leibniz Institute for Natural Product Research and Infection Biology - Hans Knöll Institute (HKI). All rights reserved.