Class FontManagerImpl
- java.lang.Object
-
- com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
-
- com.inductiveautomation.perspective.gateway.assets.AbstractAssetManager<PerspectiveFont,byte[]>
-
- com.inductiveautomation.perspective.gateway.assets.fonts.FontManagerImpl
-
- All Implemented Interfaces:
FontManager
public class FontManagerImpl extends AbstractAssetManager<PerspectiveFont,byte[]> implements FontManager
-
-
Field Summary
-
Fields inherited from class com.inductiveautomation.perspective.gateway.assets.AbstractAssetManager
assetPath
-
-
Constructor Summary
Constructors Constructor Description FontManagerImpl(PerspectiveContext perspectiveContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<PerspectiveFont>
generateKey(java.nio.file.Path path)
Generate a cache key for the givenPath
java.util.Optional<java.io.InputStream>
getFont(java.lang.String fontName, java.lang.String fontStyle, PerspectiveFontType fontType)
Returns a stream of the raw font's bytes identified by the given name, style, and typejava.util.List<PerspectiveFont>
getFonts()
Returns a copy of the list of all of the managed fontsprotected java.util.Optional<byte[]>
parseValue(java.nio.file.Path path)
Parse the cache value for the givenPath
-
Methods inherited from class com.inductiveautomation.perspective.gateway.assets.AbstractAssetManager
copyInputStreamToPath, copyInputStreamToPath, getCache, getCachedValue, onCacheChanged, onShutdown, onStartup, setup
-
Methods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
isRunning, shutdown, startup
-
-
-
-
Constructor Detail
-
FontManagerImpl
public FontManagerImpl(@Nonnull PerspectiveContext perspectiveContext)
-
-
Method Detail
-
getFonts
@Nonnull public java.util.List<PerspectiveFont> getFonts()
Description copied from interface:FontManager
Returns a copy of the list of all of the managed fonts- Specified by:
getFonts
in interfaceFontManager
- Returns:
- A
List
of all managedfonts
-
getFont
@Nonnull public java.util.Optional<java.io.InputStream> getFont(java.lang.String fontName, java.lang.String fontStyle, PerspectiveFontType fontType)
Description copied from interface:FontManager
Returns a stream of the raw font's bytes identified by the given name, style, and type- Specified by:
getFont
in interfaceFontManager
- Parameters:
fontName
- The name of the font to fetchfontStyle
- The style of the font to fetchfontType
- Thetype
of the font to fetch- Returns:
- An
Optional
containing theInputStream
of raw bytes for the font with the given name, style, and type or an empty Optional of no such font is managed with the given name, style, and type
-
generateKey
@Nonnull public java.util.Optional<PerspectiveFont> generateKey(@Nonnull java.nio.file.Path path)
Description copied from class:AbstractAssetManager
Generate a cache key for the givenPath
- Specified by:
generateKey
in classAbstractAssetManager<PerspectiveFont,byte[]>
- Parameters:
path
- ThePath
for which we want to generate a cache key- Returns:
- An
Optional
containing the cache key or an empty Optional if the cache key could not be generated
-
parseValue
@Nonnull protected java.util.Optional<byte[]> parseValue(@Nonnull java.nio.file.Path path)
Description copied from class:AbstractAssetManager
Parse the cache value for the givenPath
- Specified by:
parseValue
in classAbstractAssetManager<PerspectiveFont,byte[]>
- Parameters:
path
- ThePath
for which we want to generate a cache value- Returns:
- An
Optional
containing the cache value or an empty Optional if the cache value could not be generated
-
-