Package com.iizix.run.common
Class CodeModifier
java.lang.Object
com.iizix.run.common.CodeModifier
Class to help with JS code modification in order to match the app settings.
- Author:
- Christopher Mindus
- Field SummaryFieldsModifier and TypeFieldDescription- static final String[]The Dojo supported locales used for "extraLocales".The hash set with Dojo locales.
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescription- createSource_Build_JSON- (RuntimeBuilderSettings settings, File appDir, boolean isVerbose) Creates the "build.json" file.- getClassPath- (Class<?> clazz) Gets the classpath from a class.- static String- getDojoLanguageCode- (String languageCode) Gets the locale that matches the Dojo locale if possible.Gets a file from the resources.- getLanguageStringsMap- (RuntimeBuilderSettings settings) Gets the English language strings required in "msg.js" for internal build or "msg-customized.js" for customized iiziRun's.- getZipFile- (String name) Gets a ZIP file from the resources.- static List<com.iizix.run.common.CodeModifier.Texts>- loadTextFile- (File dir) Loads the localized text entries from the files.- protected URLResolves the resources/dojo.zip from the URL.- List<com.iizix.run.common.CodeModifier.Texts>- writeTextFile- (File dir, RuntimeBuilderSettings settings) Writes all the text's used in the app, for all text tables into an UTF-8 encoded file that is read later on by the pre-build processor to Android, iOS or Android.
- Field Details- DOJO_LOCALESThe Dojo supported locales used for "extraLocales".
- dojoLocalesThe hash set with Dojo locales.
 
- Constructor Details- CodeModifierConstructor with the settings.- Throws:
- IOException- If the resources directory cannot be found.
 
 
- Method Details- getDojoLanguageCodeGets the locale that matches the Dojo locale if possible.- Parameters:
- languageCode- The language code.
- Returns:
- The Dojo language code, or null for none.
 
- resolveResolves the resources/dojo.zip from the URL.- Parameters:
- url- to the file "dojo.zip" in resources directory.
- Returns:
- The resolved URL.
- Throws:
- IOException- For I/O errors.
 
- getClassPathGets the classpath from a class.- Parameters:
- clazz- The class to check.
- Returns:
- The File for the classpath.
- Throws:
- IOException- For I/O errors.
 
- getFileGets a file from the resources.- Parameters:
- name- The name of the file.
- Returns:
- The File.
- Throws:
- IOException- For I/O errors.
 
- getZipFileGets a ZIP file from the resources.- Parameters:
- name- The name of the ZIP file.
- Returns:
- The ZipFile.
- Throws:
- IOException- For I/O errors.
 
- getLanguageStringsMappublic Map<String,- String> getLanguageStringsMap- (RuntimeBuilderSettings settings) throws FileNotFoundException, IOException Gets the English language strings required in "msg.js" for internal build or "msg-customized.js" for customized iiziRun's.- Parameters:
- settings- The settings, null if normal customized iiziRun's.
- Returns:
- A new map of the strings, key is the text ID and the value is the text.
- Throws:
- IOException- For file errors.
- FileNotFoundException
 
- writeTextFilepublic List<com.iizix.run.common.CodeModifier.Texts> writeTextFile- (File dir, RuntimeBuilderSettings settings) throws IOException Writes all the text's used in the app, for all text tables into an UTF-8 encoded file that is read later on by the pre-build processor to Android, iOS or Android.- Parameters:
- dir- The root directory where "config.xml" is located.
- settings- The settings.
- Throws:
- IOException- For file errors.
 
- loadTextFilepublic static List<com.iizix.run.common.CodeModifier.Texts> loadTextFile- (File dir) throws IOException Loads the localized text entries from the files.- Parameters:
- dir- The app's root directory where "config.xml" is located.
- Throws:
- IOException- For file errors.
 
- createSource_Build_JSONpublic String createSource_Build_JSON- (RuntimeBuilderSettings settings, File appDir, boolean isVerbose) Creates the "build.json" file.- Parameters:
- settings- The settings.
- appDir- The root of the Cordova app dir.
- Returns:
- null for success, otherwise an error message that has been logged already.