|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.krad.theme.postprocessor.ThemeFilesProcessor org.kuali.rice.krad.theme.postprocessor.ThemeJsFilesProcessor
public class ThemeJsFilesProcessor
Theme files processor for JavaScript files
Merge contents are checked for a trailing semi-colon, and altered if not found to contain one. For minification, the Google Closure compiler is used: Google Closure
ThemeFilesProcessor
,
Compiler
Field Summary |
---|
Fields inherited from class org.kuali.rice.krad.theme.postprocessor.ThemeFilesProcessor |
---|
PLUGIN_FILES_KEY, projectVersion, SUBDIR_FILES_KEY, themeDirectory, themeName, themePluginDirsMap, themeProperties, workingDir |
Constructor Summary | |
---|---|
ThemeJsFilesProcessor(String themeName,
File themeDirectory,
Properties themeProperties,
Map<String,File> themePluginDirsMap,
File workingDir,
String projectVersion)
|
Method Summary | |
---|---|
protected void |
addAdditionalFiles(List<File> themeFiles)
Adds JS files from the krad scripts directory to the theme file list |
protected String |
getExcludesConfigKey()
Key for the property within the theme's properties file that can be configured to exlcude files of the type being processed |
protected String |
getFileListingConfigKey()
Key for the property that will be written to the theme derived properties to list the included files for the file type |
protected String |
getFileTypeDirectoryName()
Name of the directory relative to the theme directory which contains files for the type |
protected String |
getFileTypeExtension()
Extension (ex. |
protected Set<String> |
ignoredAnnotations()
Build a Set of annotations for the compiler to ignore in jsdoc blocks |
protected void |
minify(File mergedFile,
File minifiedFile)
Minifies the JS contents from the given merged file into the minified file |
protected String |
processMergeFileContents(String fileContents,
File fileToMerge,
File mergedFile)
Checks the given file contents to determine if the last character is a semicolon, if not the contents are appended with a semicolon to prevent problems when other content is appended |
protected List<String> |
retrieveKradScriptLoadOrder()
Builds a list of KRAD script file names that indicates the order they should be loaded in |
protected List<File> |
sortThemeFiles(List<File> pluginFiles,
List<File> subDirFiles)
Sorts the list of JS files from the plugin and sub directories |
Methods inherited from class org.kuali.rice.krad.theme.postprocessor.ThemeFilesProcessor |
---|
addMissingPluginDirs, collectThemeFiles, createMergedFile, getFileExcludes, getFileIncludes, getFileTypeSubDirectory, getPropertyValueAsPluginDirs, getThemePropertyValue, mergeFiles, process |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ThemeJsFilesProcessor(String themeName, File themeDirectory, Properties themeProperties, Map<String,File> themePluginDirsMap, File workingDir, String projectVersion)
Method Detail |
---|
protected String getFileTypeExtension()
ThemeFilesProcessor
getFileTypeExtension
in class ThemeFilesProcessor
ThemeFilesProcessor.getFileTypeExtension()
protected String getExcludesConfigKey()
ThemeFilesProcessor
getExcludesConfigKey
in class ThemeFilesProcessor
ThemeFilesProcessor.getExcludesConfigKey()
protected String getFileTypeDirectoryName()
ThemeFilesProcessor
getFileTypeDirectoryName
in class ThemeFilesProcessor
ThemeFilesProcessor.getFileTypeDirectoryName()
protected String getFileListingConfigKey()
ThemeFilesProcessor
getFileListingConfigKey
in class ThemeFilesProcessor
ThemeFilesProcessor.getFileListingConfigKey()
protected void addAdditionalFiles(List<File> themeFiles)
addAdditionalFiles
in class ThemeFilesProcessor
themeFiles
- list of additional files to included for the themeThemeFilesProcessor#addAdditionalFiles(java.util.List)
protected List<File> sortThemeFiles(List<File> pluginFiles, List<File> subDirFiles)
The sorting algorithm is as follows:
jsLoadFirst
pluginJsLoadOrder
, followed by all remaining plugin filesretrieveKradScriptLoadOrder()
themeJsLoadOrder
, then any remaining theme filesjsLoadLast
. Note any files that
match here will be excluded from any of the previous steps
sortThemeFiles
in class ThemeFilesProcessor
pluginFiles
- list of files that will be included and come from a plugin directorysubDirFiles
- list of files that will be included and come from the theme subdirectory
ThemeFilesProcessor#sortThemeFiles(java.util.List, java.util.List)
,
retrieveKradScriptLoadOrder()
protected List<String> retrieveKradScriptLoadOrder() throws IOException
Populates a properties object from the file ThemeBuilderConstants.KRAD_SCRIPT_LOAD_PROPERTIES_FILE
located in the KRAD script directory. Then pulls the value for the property org.kuali.rice.krad.theme.util.ThemeBuilderConstants#LOAD_ORDER_PROPERTY_KEY
to get the configured file load order.
The KRAD scripts directory is then listed to get the remaining files names which are added at the end
of the file list
IOException
protected String processMergeFileContents(String fileContents, File fileToMerge, File mergedFile) throws IOException
processMergeFileContents
in class ThemeFilesProcessor
fileContents
- contents of the file that will be addedfileToMerge
- file the contents were pulled frommergedFile
- file receiving the merged contents
IOException
ThemeFilesProcessor.processMergeFileContents(java.lang.String, java.io.File, java.io.File)
protected void minify(File mergedFile, File minifiedFile) throws IOException
Minification is performed using the Google Closure compiler, using com.google.javascript.jscomp.CompilationLevel#SIMPLE_OPTIMIZATIONS and EcmaScript5 language level
minify
in class ThemeFilesProcessor
mergedFile
- file containing the merged contentsminifiedFile
- file created to receive the minified contents
IOException
ThemeFilesProcessor.minify(java.io.File, java.io.File)
,
Compiler
protected Set<String> ignoredAnnotations()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |