Class MutableResource
java.lang.Object
com.codename1.ui.util.Resources
com.codename1.ui.util.MutableResource
- Direct Known Subclasses:
MutableResouce
Mutable variant of Resources intended for non-designer environments.
This class provides a minimal API for programmatically editing resource files inside Codename One core code where JavaSE/Swing designer classes are not available.
Supported resource categories
IMAGEDATAL10NTHEME(in-memory editing only; save serialization is intentionally limited)
Explicitly unsupported categories
The following are intentionally rejected with UnsupportedOperationException
when read or written:
- Timeline
- Indexed images
- SVG
- GUI Builder UI resources
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsResource(String name) Returns the data resource from the filebyte[]booleanstatic MutableResourceopen(InputStream resource) Opens a mutable resource from an input stream.voidsave(OutputStream out) protected voidsaveL10N(DataOutputStream output, Hashtable l10n) voidvoidvoidsetIndexedImage(String name, Image image) voidvoidvoidvoidsetThemeProperty(String themeName, String key, Object value) voidsetTimeline(String name, Timeline timeline) voidprotected voidwriteImage(DataOutputStream output, Image image) Methods inherited from class Resources
getDataResourceNames, getFont, getFontResourceNames, getGlobalResources, getImage, getImageResourceNames, getL10N, getL10NResourceNames, getMajorVersion, getMetaData, getMinorVersion, getResourceNames, getSystemResource, getTheme, getThemeResourceNames, getUIResourceNames, isAnimation, isData, isEnableMediaQueries, isFailOnMissingTruetype, isFont, isImage, isL10N, isTheme, isUI, l10NLocaleSet, listL10NLocales, open, open, open, openLayered, openLayered, override, setEnableMediaQueries, setFailOnMissingTruetype, setGlobalResources, setPassword, setRuntimeMultiImageEnabled
-
Constructor Details
-
MutableResource
public MutableResource()Creates an empty mutable resource container.
-
-
Method Details
-
open
Opens a mutable resource from an input stream.- Parameters:
resource- source stream.- Returns:
- loaded mutable resource.
- Throws:
IOException- if parsing fails.
-
setImage
-
setData
-
setTheme
-
setThemeProperty
-
setL10N
-
getDataByteArray
-
containsResource
-
isModified
public boolean isModified() -
setUi
-
setTimeline
-
setIndexedImage
-
setSVG
-
clear
public void clear() -
save
- Throws:
IOException
-
writeImage
- Throws:
IOException
-
saveL10N
- Throws:
IOException
-
getData
Description copied from class:ResourcesReturns the data resource from the file
Parameters
id: name of the data resource
Returns
newly created input stream that allows reading the data of the resource
-