Package org.javlo.template
Class Template
- java.lang.Object
-
- org.javlo.template.Template
-
- All Implemented Interfaces:
Comparable<Template>
- Direct Known Subclasses:
DefaultTemplate
public class Template extends Object implements Comparable<Template>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Template.TemplateBean
static class
Template.TemplateDateComparator
-
Field Summary
Fields Modifier and Type Field Description static String
__NO_CONTEXT
protected StaticConfig
config
static String
CONFIG_FILE
static String
DEFAULT_TEMPLATE_NAME
static String
EDIT_TEMPLATE_CODE
static String
FORCE_TEMPLATE_PARAM_NAME
static String
GZ_FILE_EXT
protected static Logger
logger
create a static logger.static String
PLUGIN_FOLDER
static String
PREVIEW_EDIT_CODE
static org.javlo.template.Template.TemplateComparator
TEMPLATE_COMPARATOR
-
Constructor Summary
Constructors Constructor Description Template()
-
Method Summary
-
-
-
Field Detail
-
PREVIEW_EDIT_CODE
public static final String PREVIEW_EDIT_CODE
- See Also:
- Constant Field Values
-
FORCE_TEMPLATE_PARAM_NAME
public static final String FORCE_TEMPLATE_PARAM_NAME
- See Also:
- Constant Field Values
-
__NO_CONTEXT
public static final String __NO_CONTEXT
- See Also:
- Constant Field Values
-
TEMPLATE_COMPARATOR
public static final org.javlo.template.Template.TemplateComparator TEMPLATE_COMPARATOR
-
logger
protected static Logger logger
create a static logger.
-
CONFIG_FILE
public static final String CONFIG_FILE
- See Also:
- Constant Field Values
-
EDIT_TEMPLATE_CODE
public static final String EDIT_TEMPLATE_CODE
- See Also:
- Constant Field Values
-
PLUGIN_FOLDER
public static final String PLUGIN_FOLDER
- See Also:
- Constant Field Values
-
GZ_FILE_EXT
public static final String GZ_FILE_EXT
- See Also:
- Constant Field Values
-
DEFAULT_TEMPLATE_NAME
public static final String DEFAULT_TEMPLATE_NAME
- See Also:
- Constant Field Values
-
config
protected StaticConfig config
-
-
Method Detail
-
getApplicationInstance
public static Template getApplicationInstance(javax.servlet.ServletContext application, ContentContext ctx, String templateDir) throws Exception
- Throws:
Exception
-
getInstance
public static Template getInstance(StaticConfig config, ContentContext ctx, String templateDir) throws Exception
- Throws:
Exception
-
getMailingInstance
public static Template getMailingInstance(StaticConfig config, ContentContext ctx, String templateDir) throws Exception
- Throws:
Exception
-
checkRenderer
public List<GenericMessage> checkRenderer(GlobalContext globalContext, I18nAccess i18nAccess) throws IOException, XMLManipulationHelper.BadXMLException
check the structure of the template.- Returns:
- the error message, null if no error.
- Throws:
IOException
XMLManipulationHelper.BadXMLException
-
clearRenderer
public void clearRenderer(ContentContext ctx)
-
reloadConfig
public void reloadConfig(ContentContext ctx)
-
delete
public void delete()
-
disabledAlternativeTemplate
public void disabledAlternativeTemplate(ContentContext ctx)
-
enabledAlternativeTemplate
public void enabledAlternativeTemplate(ContentContext ctx)
-
exist
public boolean exist()
-
getAjaxAreas
public String getAjaxAreas()
-
isAdminArea
public boolean isAdminArea(String area)
-
deleteArea
public void deleteArea(String area)
-
getNewAreaName
protected String getNewAreaName()
-
addArea
public void addArea(String rowName)
-
addRow
public void addRow()
-
getAreasForceDisplay
public List<String> getAreasForceDisplay()
this area is display if specialrendere is defined- Returns:
-
getAuthors
public String getAuthors()
-
getComponentFile
protected List<File> getComponentFile(GlobalContext globalContext) throws IOException
- Throws:
IOException
-
createMainComponentSass
protected void createMainComponentSass(GlobalContext globalContext) throws IOException
- Throws:
IOException
-
getCSSByFolder
public Map<String,List<String>> getCSSByFolder(String filter) throws IOException
- Throws:
IOException
-
getHtmlByFolder
public Map<String,List<String>> getHtmlByFolder(String filter) throws IOException
- Throws:
IOException
-
getCSSByFolder
protected Map<String,List<String>> getCSSByFolder() throws IOException
- Throws:
IOException
-
getCSS
protected List<String> getCSS() throws IOException
- Throws:
IOException
-
getWysiwygCss
public String getWysiwygCss()
return the css for wysiwyg layout
-
getConfigComponentFile
public Properties getConfigComponentFile(GlobalContext globalContext, String type) throws IOException
- Throws:
IOException
-
getCreationDate
public Date getCreationDate()
-
getDepth
public int getDepth()
-
getDominantColor
public String getDominantColor()
-
getEscapeMenuId
public String getEscapeMenuId()
-
getDynamicComponentsProperties
public final List<Properties> getDynamicComponentsProperties(GlobalContext globalContext) throws IOException
- Throws:
IOException
-
getFinalTemplate
public Template getFinalTemplate(ContentContext ctx) throws Exception
template can be change in some context, call this method for obtain the final Template to be use for rendering.- Parameters:
ctx
-- Returns:
- final template for rendering.
- Throws:
ConfigurationException
IOException
Exception
-
getFolder
public String getFolder(GlobalContext globalContext)
-
getFontReference
public Properties getFontReference(GlobalContext globalContext) throws IOException
- Throws:
IOException
-
getHomeRenderer
public String getHomeRenderer(GlobalContext globalContext)
-
getVersion
public String getVersion()
-
getBootstrapVersion
public Integer getBootstrapVersion()
-
isColumnable
public boolean isColumnable()
-
getColumnableRowTag
public String getColumnableRowTag()
-
getColumnableRowTagIn
public String getColumnableRowTagIn()
-
getColumnableColTagIn
public String getColumnableColTagIn()
-
getColumnableStyleTagIn
public String getColumnableStyleTagIn()
-
getColumnableClassTagIn
public String getColumnableClassTagIn()
-
getColumnableColTag
public String getColumnableColTag()
-
getColumnableRowStyle
public String getColumnableRowStyle()
-
getColumnableRowClass
public String getColumnableRowClass()
-
getColumnableColStyleDefault
public String getColumnableColStyleDefault()
-
getColumnableColStyle
public String getColumnableColStyle(int size)
-
getColumnableColClass
public String getColumnableColClass(int size, int totalSize, int leftSize, String inStyle)
-
getColumnableColClassDefault
public String getColumnableColClassDefault()
-
getHomeRendererFullName
public String getHomeRendererFullName(GlobalContext globalContext)
-
getHostDetected
public List<String> getHostDetected(ContentContext ctx) throws FileNotFoundException, IOException
detect host used in links (index.html)- Returns:
- a list of host
- Throws:
IOException
FileNotFoundException
-
getRelativeLoginFile
protected String getRelativeLoginFile(ContentContext ctx)
-
getLoginFile
public String getLoginFile(ContentContext ctx)
-
getUserMailHtml
public String getUserMailHtml(GlobalContext globalContext) throws IOException
mail for send to user with : ${logo} : url to logo ${site} : global site title ${title} : title of the email ${text} : main text of the email ${action.link} : action button url ${action.text} : action button text ${email} : contact email ${root} : root url #cccccc : special color #555555 : title color #333333 : text color- Parameters:
globalContext
-- Returns:
- Throws:
IOException
-
getAdminMailHtml
public String getAdminMailHtml(GlobalContext globalContext) throws IOException
- Throws:
IOException
-
getHTMLHomeFile
public String getHTMLHomeFile()
-
get404File
public String get404File()
-
getI18nProperties
public Map getI18nProperties(GlobalContext globalContext, Locale locale, int mode) throws IOException
- Throws:
IOException
-
getAllList
public Map<String,List<IListItem>> getAllList(GlobalContext globalContext, Locale locale) throws IOException
- Throws:
IOException
-
getId
public String getId()
-
getImageConfigFile
public File getImageConfigFile()
-
getImageConfig
public ConfigurationProperties getImageConfig()
-
getImageConfigFileName
public String getImageConfigFileName()
-
getImageFiltersRAW
public String getImageFiltersRAW()
-
getNoImage
public String getNoImage()
-
getNoImageUrl
public String getNoImageUrl(ContentContext ctx, String filter) throws Exception
- Throws:
Exception
-
getDefaultImageFilter
public String getDefaultImageFilter()
-
getPageTypesRAW
public String getPageTypesRAW()
-
getSpecialAreaRenderer
public String getSpecialAreaRenderer()
-
setImageFiltersRAW
public void setImageFiltersRAW(String imageFilterRAW)
-
getLastSelectedClass
public String getLastSelectedClass()
-
getLicenceFile
public String getLicenceFile()
-
getLocalWorkMailingTemplateFolder
public String getLocalWorkMailingTemplateFolder()
-
getLocalWorkTemplateFolder
public String getLocalWorkTemplateFolder()
-
getMacroFile
public final File getMacroFile(GlobalContext globalContext, String fileName) throws IOException
- Throws:
IOException
-
getMacroProperties
public Properties getMacroProperties(GlobalContext globalContext, String macroKey) throws IOException
- Throws:
IOException
-
getMail
public Mail getMail(ContentContext ctx, String mailName, String lg) throws IOException
- Throws:
IOException
-
getMailJsp
public File getMailJsp(ContentContext ctx, String mailName) throws Exception
- Throws:
Exception
-
getName
public String getName()
-
getOwner
public String getOwner()
-
getParent
public Template getParent()
-
getParentName
public String getParentName()
-
setParentName
public void setParentName(String parent)
-
getMessageContainerId
public String getMessageContainerId()
-
getMessageTemplate
public String getMessageTemplate(ContentContext ctx)
-
getRenderer
public String getRenderer(ContentContext ctx) throws Exception
- Throws:
Exception
-
getRenderer
public String getRenderer(ContentContext ctx, String file) throws Exception
- Throws:
Exception
-
getRSSRendererFile
protected String getRSSRendererFile()
-
getRSSRendererFullName
public String getRSSRendererFullName(ContentContext ctx) throws ServiceException
- Throws:
ServiceException
-
isDefaultRenderer
protected boolean isDefaultRenderer()
-
getRenderers
public List<String> getRenderers()
return all renderer defined in the template.- Returns:
-
getStructures
public List<String> getStructures()
return all renderer defined in the template.- Returns:
-
getRendererFullName
public String getRendererFullName(ContentContext ctx) throws ServiceException
- Throws:
ServiceException
-
getResources
public Collection<File> getResources(ContentContext ctx)
get resources define in the template.- Returns:
-
getRssCSS
public String getRssCSS()
-
getSearchFormID
public String getSearchFormID()
-
getSearchRenderer
public String getSearchRenderer(ContentContext ctx) throws Exception
- Throws:
Exception
-
getSelectedClass
public String getSelectedClass()
-
getSource
public String getSource()
-
getEditTemplateMode
public String getEditTemplateMode()
mode of the edit template, can be used in template renderer for include special css or js. preview css is : edit_preview_[mode].css- Returns:
-
getSourceFolder
public File getSourceFolder()
-
getSourceFolderName
public String getSourceFolderName()
-
getFolder
public File getFolder()
-
getSpecialRendererTemplate
public String getSpecialRendererTemplate()
-
getTemplateData
public TemplateData getTemplateData()
-
getTemplateRealPath
public String getTemplateRealPath()
-
getWorkTemplateRealPath
public String getWorkTemplateRealPath(GlobalContext globalContext)
-
isDeleted
public boolean isDeleted()
-
getUnSelectedClass
public String getUnSelectedClass()
-
getVisualFile
public String getVisualFile()
-
getVisualAbsoluteFile
public File getVisualAbsoluteFile()
-
getVisualPDFile
public String getVisualPDFile()
-
getWorkMailingTemplateFolder
public String getWorkMailingTemplateFolder()
-
getWorkTemplateFolder
public String getWorkTemplateFolder()
-
rebuildTemplate
public int rebuildTemplate(ContentContext ctx, boolean css)
-
rebuildTemplateCss
protected int rebuildTemplateCss(ContentContext ctx, File folder)
-
importTemplateInWebapp
public void importTemplateInWebapp(StaticConfig config, ContentContext ctx) throws IOException
- Throws:
IOException
-
importTemplateInWebapp
public void importTemplateInWebapp(StaticConfig config, ContentContext ctx, boolean clear) throws IOException
- Throws:
IOException
-
importTemplateInWebapp
protected void importTemplateInWebapp(StaticConfig config, ContentContext ctx, GlobalContext globalContext, File templateTarget, Map<String,String> childrenData, boolean compressResource, boolean parent, Boolean importComponents, boolean clear) throws IOException
- Throws:
IOException
-
isAlternativeTemplate
public boolean isAlternativeTemplate(ContentContext ctx)
-
isHTML
public boolean isHTML()
-
isLinkEmail
public boolean isLinkEmail(String lg)
-
isMailing
public boolean isMailing()
-
isShortkeyToEdit
public boolean isShortkeyToEdit()
-
isOnePage
public boolean isOnePage()
-
isForStatic
public boolean isForStatic()
-
isNavigationArea
public boolean isNavigationArea(String area)
-
isNosecureArea
public boolean isNosecureArea(String area)
-
isParent
protected boolean isParent()
-
isChildOf
public boolean isChildOf(String templateId)
-
isPDFFile
public boolean isPDFFile()
-
isReady
public boolean isReady()
-
isRenderer
public boolean isRenderer(GlobalContext globalContext)
-
isSubjectLocked
public boolean isSubjectLocked()
-
getSenders
public List<javax.mail.internet.InternetAddress> getSenders()
-
isTemplateInWebapp
public boolean isTemplateInWebapp(ContentContext ctx) throws IOException
- Throws:
IOException
-
isValid
public boolean isValid()
-
reload
public void reload()
-
setAuthors
public void setAuthors(String name)
-
setCreationDate
public void setCreationDate(Date date)
-
setDepth
public void setDepth(int depth)
-
setDominantColor
public void setDominantColor(String color)
-
setOwner
public void setOwner(String owner)
-
setReady
public void setReady(boolean ready)
-
setSource
public void setSource(String name)
-
setValid
public void setValid(boolean inValid)
-
visibleForRoles
public boolean visibleForRoles(Collection<String> inRoles)
-
getBuildId
public String getBuildId()
return a code of build. This code change if some element will modifified.- Returns:
-
compareTo
public int compareTo(Template template)
- Specified by:
compareTo
in interfaceComparable<Template>
-
setHTMLIDS
public void setHTMLIDS(Collection<String> ids)
-
getRAWPlugins
protected String getRAWPlugins()
-
getDeployId
public String getDeployId()
-
isPDFRenderer
public boolean isPDFRenderer()
return true if this template contains a renderer for PDF.- Returns:
- true if PDF renderer defined.
-
isCompressResources
public boolean isCompressResources()
return true if resources can be compressed by CMS (css, js).- Returns:
- true by default or the value of "resources.compress" property.
-
getRSSImageURL
public String getRSSImageURL()
-
isRealContentFromAnyArea
public boolean isRealContentFromAnyArea()
true if all area can be signifiant for read content, false if only main area is signifiant.- Returns:
-
getPDFHeigth
public int getPDFHeigth()
-
getQRCodeSize
public int getQRCodeSize()
-
loadTemplatePart
protected void loadTemplatePart(TemplatePart part, String prefix)
-
saveTemplatePart
protected void saveTemplatePart(TemplatePart part, String prefix)
-
getStyle
public TemplateStyle getStyle()
-
storeStyle
public void storeStyle(TemplateStyle style)
-
resetRows
public void resetRows()
-
getArea
public static Area getArea(Collection<Row> rows, String name)
-
deleteRow
public void deleteRow(String name)
-
storeRows
public void storeRows(Collection<Row> rows)
-
isEditable
public boolean isEditable()
-
isImportParentComponents
public boolean isImportParentComponents()
-
getMailingTemplate
public String getMailingTemplate()
-
isBootstrap
public boolean isBootstrap()
-
isRemoveEmptyArea
public boolean isRemoveEmptyArea()
if area empty remove from html (default true)- Returns:
-
getCookiesMessageName
public String getCookiesMessageName()
-
getCookiesTypeName
public String getCookiesTypeName()
-
getCookiesMessagePath
public String getCookiesMessagePath()
-
getMimeTypeImage
public String getMimeTypeImage(GlobalContext globalContext, String fileExtension)
-
isLanguageLinkKeepGetParams
public boolean isLanguageLinkKeepGetParams()
-
isEndAreaTag
public boolean isEndAreaTag()
-
isColorPalette
public boolean isColorPalette()
-
getColorList
public List<ExtendedColor> getColorList()
-
getColorsMap
public Map<Integer,ExtendedColor> getColorsMap()
-
getWebFonts
public List<String> getWebFonts(GlobalContext globalContext)
-
getDefaultArea
public String getDefaultArea()
-
isFake
public boolean isFake()
-
main
public static void main(String[] args) throws IOException
- Throws:
IOException
-
-