public class TypeTemplateEntry extends java.lang.Object implements TypeConstants, java.lang.Comparable
Modifier and Type | Class and Description |
---|---|
static class |
TypeTemplateEntry.LabelComparator |
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
className |
protected java.util.Map<java.lang.String,java.lang.String> |
descriptionMap |
protected boolean |
isInternal |
protected boolean |
isPlugged |
protected java.util.Map<java.lang.String,java.lang.String> |
labelMap |
protected java.lang.String |
name |
protected java.lang.String |
path |
static java.lang.String |
REVISION |
protected java.lang.String |
usage |
static java.lang.String |
USAGE_DISPLAY_BOX |
static java.lang.String |
USAGE_DISPLAY_FULL |
static java.lang.String |
USAGE_DISPLAY_FULL_PDA |
static java.lang.String |
USAGE_DISPLAY_MODAL |
static java.lang.String |
USAGE_DISPLAY_QUERY |
static java.lang.String |
USAGE_DISPLAY_QUERY_PDA |
static java.lang.String |
USAGE_EDIT |
static java.lang.String |
USAGE_EDIT_FRONT |
static java.lang.String |
USAGE_EDIT_MODAL |
static java.lang.String |
USAGE_EDIT_POPUP |
protected org.jdom.Element |
xmlElt |
CHANGE_LEVEL_CLASS, CHANGE_LEVEL_JSP, CHANGE_LEVEL_NONE, DISPLAY_TPLT_TAG, EXTENSIONS_XML, FIELD_ELT, FIELD_NEW_MARK, FIELD_UPDATED_MARK, FIELDS_ELT, FILE_INDEX_LISTENER, LINK_INDEX_LISTENER, OLD_TYPES_DIR, PACKAGE_NAME, QUERY_TPLT_TAG, TAB_ELT, TABS_ELT, TEMPLATE_TAG, TEMPLATES_SUFFIX, TEMPLATES_TAG, TITLE_ELT, TYPE_ELT, TYPE_FORCE_UPDATE_MARK, TYPE_NEW_MARK, TYPE_UPDATED_MARK, TYPES_DIR, TYPES_XML
Constructor and Description |
---|
TypeTemplateEntry()
Default Constructor
|
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
checkIntegrity()
Check the integrity of the template fields
|
int |
compareTo(java.lang.Object obj) |
static void |
convertTemplate(org.jdom.Element elm,
boolean isPortlet)
Convert the given JDOM Element representing a template declaration
from JCMS 5.7.x to JCMS 6.0.x
|
static void |
convertTemplate(java.io.File tmplFile)
Convert the given File representing type's templates
from JCMS 5.7.x to JCMS 6.0.x
|
static TypeTemplateEntry |
decodeTemplate(java.lang.String className,
org.jdom.Element xmlElt,
java.lang.String folderPath)
Build a TypeTemplateEntry from the given JDom Element
|
static org.jdom.Element |
encodeTemplate(TypeTemplateEntry tte)
Build a JDom Element from the given TypeTemplateEntry
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getDescription(java.lang.String userLang)
Returns the description of the template for given user language
|
java.util.Map<java.lang.String,java.lang.String> |
getDescriptionMap()
Returns the map of descriptions.
|
java.lang.String |
getInternalName()
Returns the full name of the template that will be stored in the store.xml.
|
java.lang.String |
getLabel(java.lang.String userLang)
Returns the label of the template for given user language
|
java.util.Map<java.lang.String,java.lang.String> |
getLabelMap()
Returns the map of labels.
|
java.lang.String |
getName()
Returns the name of the template (== usage + "." + internalName).
|
java.lang.String |
getPath()
Returns the path (e.g.
|
java.lang.String |
getThumbnailPath()
Returns the path to the thumbnail of this template or s.gif if it could not be found.
|
java.lang.String |
getThumbnailPath(int width,
int height,
java.lang.String defaultImagePath)
Retrieve the path to the thumbnail of this template in the specified dimension.
|
java.lang.String |
getUsage()
Returns the usage of the template (e.g.
|
boolean |
isInternal()
Returns true if the template entry has been generated by JCMS without parsing an existing TypeElement.
|
boolean |
isPlugged()
Returns true if the template entry has been added by pluggin mechanism.
|
void |
reloadI18N()
Reload all I18N informations for this type template entry.
|
static TypeTemplateEntry |
resolveDefaultTemplateEntry(java.util.Set<TypeTemplateEntry> tmplSet,
java.lang.String defaultUsage,
java.lang.String defaultPath)
Returns a default TypeTemplateEntry in the given Set
otherwise return a dummy template with the defaultUsage.
|
void |
setDescription(java.lang.String userLang,
java.lang.String value)
Set the description for the given user language
|
void |
setDescriptionMap(java.util.Map<java.lang.String,java.lang.String> descriptionMap)
Set the descriptions for the given template.
|
void |
setInternalName(java.lang.String name)
Set the name of the template this name must be unique for
the type declaration.
|
void |
setLabel(java.lang.String userLang,
java.lang.String value)
Set the label for the given user language
|
void |
setLabelMap(java.util.Map<java.lang.String,java.lang.String> labelMap)
Set the labels for the given template.
|
void |
setPath(java.lang.String path)
Set the path of the template.
|
void |
setPlugged(boolean plugged)
Returns true if the template entry has been added by pluggin mechanism.
|
void |
setUsage(java.lang.String usage)
Set the usage of the template (e.g.
|
java.lang.String |
toString() |
public static final java.lang.String REVISION
public static final java.lang.String USAGE_DISPLAY_BOX
public static final java.lang.String USAGE_DISPLAY_FULL
public static final java.lang.String USAGE_DISPLAY_QUERY
public static final java.lang.String USAGE_DISPLAY_MODAL
public static final java.lang.String USAGE_DISPLAY_FULL_PDA
public static final java.lang.String USAGE_DISPLAY_QUERY_PDA
public static final java.lang.String USAGE_EDIT
public static final java.lang.String USAGE_EDIT_FRONT
public static final java.lang.String USAGE_EDIT_MODAL
public static final java.lang.String USAGE_EDIT_POPUP
protected java.lang.String className
protected org.jdom.Element xmlElt
protected java.lang.String name
protected java.lang.String usage
protected java.lang.String path
protected java.util.Map<java.lang.String,java.lang.String> labelMap
protected java.util.Map<java.lang.String,java.lang.String> descriptionMap
protected boolean isInternal
protected boolean isPlugged
public java.lang.String getName()
This name must be unique for the type declaration.
public java.lang.String getInternalName()
This is the name attribute value of the template's XML.
public void setInternalName(java.lang.String name)
name
- the name of the template, eg "carousel"public java.lang.String getPath()
public void setPath(java.lang.String path)
path
- the path of the JSP used by this template, relative to the webapp root, eg "types/PortletQueryForeach/doPortletQueryForeachCarousel.jsp"public java.lang.String getUsage()
public void setUsage(java.lang.String usage)
usage
- a template usage, e.g. "box"public java.lang.String getLabel(java.lang.String userLang)
userLang
- the user languagepublic void setLabel(java.lang.String userLang, java.lang.String value)
userLang
- the user languagevalue
- the labelpublic java.util.Map<java.lang.String,java.lang.String> getLabelMap()
public void setLabelMap(java.util.Map<java.lang.String,java.lang.String> labelMap)
labelMap
- the Map of labelpublic java.lang.String getDescription(java.lang.String userLang)
userLang
- the user languagepublic void setDescription(java.lang.String userLang, java.lang.String value)
userLang
- the user languagevalue
- the descriptionpublic java.util.Map<java.lang.String,java.lang.String> getDescriptionMap()
public void setDescriptionMap(java.util.Map<java.lang.String,java.lang.String> descriptionMap)
descriptionMap
- the map of descriptionpublic boolean isInternal()
public boolean isPlugged()
public void setPlugged(boolean plugged)
plugged
- set true if template was added through plugin, false othewisepublic java.lang.String getThumbnailPath()
public java.lang.String getThumbnailPath(int width, int height, java.lang.String defaultImagePath)
If the thumbnail could not be created (no preview available for this template), the defaultImagePath is returned instead.
Warning : This method create a thumbnail when it does not exists, this process can be a little time consumming, make sure you do not need immediate response time when using it.
width
- the width of the thumbnail to create/reuseheight
- the height of the thumbnail to create/reusedefaultImagePath
- the default image path used if the thumbnail could not be createdpublic java.lang.String[] checkIntegrity()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
public static TypeTemplateEntry resolveDefaultTemplateEntry(java.util.Set<TypeTemplateEntry> tmplSet, java.lang.String defaultUsage, java.lang.String defaultPath)
tmplSet
- a Set of TypeTemplateEntry (that may already refined on usage or null)defaultUsage
- the template usagedefaultPath
- null or override the path of the dummy ttepublic static void convertTemplate(java.io.File tmplFile) throws org.jdom.JDOMException, java.io.IOException
tmplFile
- the type's template file Type-template.xmlorg.jdom.JDOMException
- if XML of the specified file could not be parsedjava.io.IOException
- if specified file could not opened or new file could not be writtenpublic static void convertTemplate(org.jdom.Element elm, boolean isPortlet)
elm
- JDOM Element with qname "template"isPortlet
- indicate if the template being converted is a portlet,
when working with display template element, setting to true will use "box" usage, false will use "full" usagepublic static TypeTemplateEntry decodeTemplate(java.lang.String className, org.jdom.Element xmlElt, java.lang.String folderPath)
className
- the short classname of the Type for which this template is decoded (eg Article, TestType, PortletSearch)xmlElt
- a JDom ElementfolderPath
- path to the template filepublic static org.jdom.Element encodeTemplate(TypeTemplateEntry tte)
tte
- TypeTemplateEntrypublic void reloadI18N()
Copyright © 2001-2017 Jalios SA. All Rights Reserved.