📄 jahiatemplatespackage.java
字号:
//// ____.// __/\ ______| |__/\. _______// __ .____| | \ | +----+ \// _______| /--| | | - \ _ | : - \_________// \\______: :---| : : | : | \________>// |__\---\_____________:______: :____|____:_____\// /_____|//// . . . i n j a h i a w e t r u s t . . .//////// JahiaTemplatesPackage//// NK 16.01.2001////package org.jahia.data.templates;import java.io.*;import java.util.*;/** * Holds Informations about a templates package * * @author Khue ng * @version 1.0 */public class JahiaTemplatesPackage { /** the file or directory name from which data are loaded **/ private String m_FileName; /** the full path to the source file or directory **/ private String m_FilePath; /** the package type **/ private int m_Type ; // 1=jar,2=directory /** jar package **/ private static final int JAR = 1; /** directory **/ private static final int DIR = 2; /** Name of the package **/ private String m_Name; /** The Folder Name where to extract package contents **/ private String m_RootFolder; /** The name of the jar file containing classes used by this package **/ private String m_ClassesFile; /** The Package Provider Name **/ private String m_Provider; /** The Package thumbnail image file Name entry **/ private String m_Thumbnail; /** The Templates descs list * * @associates JahiaTemplateDef*/ private Vector m_TemplatesList = new Vector(); /** An optional id ( can be set and used as identifier ) **/ private int m_ID; /** * the description file */ public static final String DESCR_FILE = "templates_descr.txt"; /** * Constructor * */ public JahiaTemplatesPackage ( String name, String rootFolder, String classesFile, String providerName, String thumbnail ) { m_Name = name; m_RootFolder = rootFolder; m_ClassesFile = classesFile; m_Provider = providerName; m_Thumbnail = thumbnail; } /** * Return the id * * @return (int) the id */ public int getID(){ return m_ID; } /** * Set the id * @param (int) the id */ public void setID(int id){ m_ID = id; } /** * Return the template name * * @return (String) the name of the template */ public String getName(){ return m_Name; } /** * Set the name * @param (String) the name of the template */ protected void setName(String name){ m_Name = name; } /** * Return the Root Folder * * @return (String) the Root Folder of the templates */ public String getRootFolder(){ return m_RootFolder; } /** * Set the Root Folder * * @param (String) the Root Folder of the templates */ protected void setRootFolder(String folder){ m_RootFolder = folder; } /** * Return the Classes File name * * @return (String) the Classes File name */ public String getClassesFile(){ return m_ClassesFile; } /** * Set the Classes file * * @param (String) the Classes file name */ protected void setClassesFile(String classesFile){ m_ClassesFile = classesFile; } /** * Return true if the classesFile is not null and length>0 * * @return (boolean) true if m_ClassesFile != null && length>0 */ public boolean hasClasses(){ return (m_ClassesFile != null && m_ClassesFile.length()>0); } /** * Return the provider name * * @return (String) the name of the Provider */ public String getProvider(){ return m_Provider; } /** * Set the Provider * @param (String) the name of the Provider */ protected void setProvider(String provider){ m_Provider = provider; } /** * Return the thumbnail file name * * @return (String) the thumbnail file name */ public String getThumbnail(){ return m_Thumbnail; } /** * Set the thumbnail file name * @param (String) the file name */ public void setThumbnail(String val){ m_Thumbnail = val; } /** * Return the home page template. * * @return (JahiaTemplateDef) , the Home page template or null if no defined home page template */ public JahiaTemplateDef getHomePageTemplate(){ int size = m_TemplatesList.size(); JahiaTemplateDef template = null; for ( int i=0 ; i<size ; i++ ){ template = (JahiaTemplateDef)m_TemplatesList.get(i); if ( template.isHomePage() ){ return template; } } return null; } /** * Set the Templates Descrition List * * @params (Vector) templatesList, the list of templates definitions */ protected void setTemplates(Vector templatesList){ m_TemplatesList = templatesList; } /** * Get the Templates Descrition List * * @return (Vector) the Vector of templates definitions list */ public Vector getTemplates(){ return m_TemplatesList; } /** * Add a Template Definition in the Templates list * * @param (JahiaTemplate) tempDef */ public void addTemplateDef(JahiaTemplateDef tempDef ){ m_TemplatesList.add(tempDef); } /** * get the source filename * */ public String getFileName(){ return this.m_FileName; } /** * set the source filename * */ protected void setFileName(String name){ this.m_FileName = name; if ( name.endsWith(".jar") ){ m_Type = JAR; } else { m_Type = DIR; } } /** * get the file path * */ public String getFilePath(){ return this.m_FilePath; } /** * set the file path * */ public void setFilePath(String path){ this.m_FilePath = path; File f = new File(path); this.setFileName(f.getName()); } /** * if the source is a file * */ public boolean isFile(){ return (m_Type == JAR); } /** * if the source is a directory * */ public boolean isDirectory(){ return ( m_Type == DIR ); } } // end JahiaTemplatesPackage
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -