|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.aduna.gee.publication.cover.Template
public class Template
This class is a representation of a template HTML file for ZPad. A template can contain generator-tags and boxes for content entries. These generator-tags are ZPad-specific strings that are replaced with their actual run-time value by the generator. The boxes are places where the generator can insert a content entry. These boxes appear as images in the template HTML file. The name of these images should be equal to the value of ENTRY_TAG (case-insensitive).
The generator tags that can be used are:
generator tag substituted by example value
__CHUNK[n]__ The [n]th chunk of the path (0-based), if it exists
__COLUMNLAYOUT__ __COLUMNLAYOUT__ 2 is substituted by ""
__DATESTRING__ the date March 13, 1998
__DAY__ the day of the month 13
__ENDREPEAT__ __ENDREPEAT__ is substituted by ""
__ENDHREPEAT__ __ENDHREPEAT__ is substituted by ""
__ENTRYID__ the (internal) entry ID 13
__FULLSECTION__ the full path name of the section cars/fast/Ferrari
__MAXPAGE__ the total number of pages in a section 3
__MONTH__ the month 3
__MONTHNAME__ the month March
__PAGE__ the number of the current page within a section 1
__PAGEOFMAX__ if __MAXPAGE__ > 1 then __PAGE__"/"__MAXPAGE__ else ""
__PAGESEQUENCE__ if __MAXPAGE__ > 1 then 1 2 3 .... __MAXPAGE__ else ""
__SECTION__ the name of the section Ferrari
__SECTIONNAME__ the name of the section, WITHOUT the space and the section toolbar Ferrari
__SECTIONPATH__ the full, clickable path name of the section cars/fast/Ferrari
__SECTIONPAGEURL__ the URL of the current page in this Section http://sydney.zpad.com/ __SECTIONURL__ the URL of this Section http://sydney.zpad.com/ __SERVER__ the server's name sydney.zpad.com
__STARTREPEAT__ __STARTREPEAT__ 2 10 is substituted by ""
__STARTHREPEAT__ __STARTHREPEAT__ 600 is substituted by ""
__SUBSECTIONS__ the handling of in-page navigation: shows subsections
__SUBSUBSECTIONS__ the handling of in-page navigation: shows subsections and their subsubsections
__ALTSECTIONS__
__TIME12__ the time (plus optionally end time) an entry in am/pm 9:30 pm - 10:30 pm
__TIME24__ the time (plus optionally end time) of an entry, 24 hour based 21:30 - 22:30
__TOPSECTIONS__ the handling of in-page navigation: shows toplevel sections (only if current section is top-section too!)
__USER__ the user's name Frank
__WEEKDAY__ the day of the week Friday
__WEEKNUMBER__ the week number (1 is the first full week, first day of week is sunday) 46
__WEEKNUMBER2__ the week number (1 is the week containing januari 1, first day of week is sunday) 47
__WEEKNUMBER3__ the week number (1 is the first full week, first day of week is monday) 46
__WEEKNUMBER4__ the week number (1 is the week containing januari 1, first day of week is monday) 47
__YEAR__ the year 1998
__ZPADID__ the user's ZPad ID http://sydney.zpad.com/
| Field Summary | |
|---|---|
protected Vector |
_actualBoxes
The boxes for entries in this template (as to be used). |
protected static int |
_ALTSECTIONS
|
protected int[] |
_boxCount
No of Boxes in pre (0), repeat (1), hrepeat (2) en post (3) |
protected InputHandler |
_coverInput
The input handler used to load the template HTML file. |
protected static String |
_embedFrame
The Frame that is use to wrap an Embedded page. |
protected String |
_html
The (adapted) HTML string. |
protected String |
_htmlHOpt
The optional horizontal HTML part string. |
protected Box |
_htmlHOptBox
The box in the horizontal HTML part string. |
protected int |
_htmlHOptMaxWidth
Max width of _htmlHOpt repeating. |
protected String |
_htmlOpt
The optional HTML part string. |
protected int |
_htmlOptMax
Max number of _htmlOpt repeating. |
protected int |
_htmlOptMin
Min number of _htmlOpt repeating. |
protected static int |
_MORE_MAX
|
protected static int |
_MORE_MORE
|
protected static int |
_MORE_NONE
|
protected int |
_numberOfColumns
The number of columns of the Template (__COLUMNLAYOUT__ N) |
protected InputHandler |
_shareInput
The input handler used to load default files. |
protected static int |
_SUBSECTIONS
|
protected static int |
_SUBSUBSECTIONS
|
protected static int |
_TOPSECTIONS
|
DateSpec |
dateSpec
The date specification of this template (only for DATE Template's). |
protected static String |
DATESPEC_KEY
The key used to store the datespec (only for DATE Template's) in the cover configuration file. |
static String |
defaultFrame
The FrameSet that is to be used for all HTML Template pages that have no FrameSet. |
static String |
ENTRY_TAG
The string indicating the place for an entry in a template. |
String |
filename
The name of the template HTML file (READ-ONLY). |
protected static String |
FILENAME_KEY
The key used for storing the filename for this template in the cover configuration file. |
String |
frame
The real HTML i.e. |
boolean |
frameIsLoaded
Flag indicating whether the frame is already loaded (READ-ONLY). |
String |
framename
The name of the Frame HTML file (READ-ONLY). |
protected static String |
FRAMENAME_KEY
The key used for storing the framename for this template in the cover configuration file. |
int |
imageHeight
|
int |
imageWidth
|
boolean |
isLoaded
Flag indicating whether the template is already loaded (READ-ONLY). |
String |
name
An identifying name for the template. |
protected static String |
NAME_KEY
The key used for storing the template's name in the cover configuration file. |
static String |
TEMPLATEPROPS_KEY
The key under which the template properties are stored. |
static String |
TRANSPARENT_IMAGE
The name of the file containing the transparent image. |
int |
type
The type of the template. |
protected static String |
TYPE_KEY
The key used for storing the template's type in the cover configuration file. |
| Constructor Summary | |
|---|---|
Template(InputHandler coverInput,
InputHandler shareInput)
Creates a new template. |
|
| Method Summary | |
|---|---|
protected String |
_calculateTemplate(Vector entries,
int entryToDo,
Vector selEntries,
Navigator navigator,
boolean editMode,
boolean forReal,
WProperties coverEntryStubs)
Calculate a Template. |
protected String |
_correctCutting(String s,
boolean start,
boolean end)
Correct the effect of cutting right in the middle of <....> This method removes the remainings of the tag just cut. |
protected int |
_countBoxes(String html)
|
protected String |
_generateEntryCode(Entry entry,
Box box,
Navigator navigator,
int border,
WProperties coverEntryStubs)
Generates the HTML code for an entry and appends it to a StringBuffer. |
protected void |
_generateExpiredImage(Entry entry,
String imgName,
int width,
int height,
int entryId,
boolean editMode,
StringBuffer buf)
Generates a expired-image tag with a link to the "expired" Javascript function and appends it to a StringBuffer. |
protected void |
_generateImage(String httpDir,
String file,
String name,
int width,
int height,
String altText,
StringBuffer buf)
Generates an image tag that can be included in an HTML page and appends it to a StringBuffer. |
protected void |
_generateLinkedImage(String href,
String onMouseOver,
String onMouseOut,
String target,
String httpDir,
String file,
String name,
int width,
int height,
String altText,
StringBuffer buf)
Generates an image tag with a link attached to it that can be included in an HTML page and appends it to a StringBuffer. |
protected void |
_generateProvideImage(String imgName,
int width,
int height,
int entryId,
StringBuffer buf)
Generates a provide-image tag with a link to the "export"- Javascript function and appends it to a StringBuffer. |
protected String |
_getClickablePath(String sectionName,
String host,
Navigator navigator,
boolean reallyClickable)
|
protected String |
_getInPageNavigation(Navigator navigator,
PathString sectionName,
int type,
int subtype,
int metaIndex)
|
protected Vector |
_getInPageStubValues(Navigator navigator,
String section,
PathString fullsection,
String moreString)
|
protected void |
_getMetaAlternatives(PathString sectionName,
Navigator navigator,
Vector children,
Vector fullchildren,
Vector extraInfo)
Calculate the meta steps for which alternative values should be found. |
protected Entry |
_getTransparentEntry(int width,
int height)
Return an entry for a transparent image. |
protected void |
_getValueAlternatives(PathString sectionName,
int metaIndex,
int maxChildren,
Navigator navigator,
Vector children,
Vector fullchildren,
String removeString)
Get alternative values for a meta in a path. |
protected void |
_initParseTemplate(String html)
Parses the boxes and the strings from an HTML document. |
protected String |
_parseTemplate(String html)
Parses the boxes and the strings from an HTML document. |
protected String |
_substituteGeneratorTags(String page,
String sectionName,
int pageNo,
int pageCount,
String sectionURL,
String sectionPageURL,
String userName,
String serverName,
int entryIdBase,
Vector origEntries,
boolean editMode,
int pl,
Navigator navigator,
WProperties coverEntryStubs)
Substitutes the generator tags (__DATESTRING__, __SECTION__, etc.) in a page by their actual values ("November 20, 1997", "Addresses", etc.). |
Object |
clone()
|
static Vector |
columnLayout(Vector objects,
int columns,
Object placeHolder)
Example 10 objects over 4 columns, the original indexes (0 based): 0 3 6 9 1 4 7 2 5 8 |
static Template |
create(InputHandler coverInput,
InputHandler shareInput,
WProperties props)
Create a template from a properties object containing the configuration for the new object. |
static String |
formalizeLink(String link)
Take care of a correct Link. |
String |
generateEntryToolbar(Entry entry,
boolean editMode,
int entryId,
int pl,
Navigator navigator,
Object sectionID,
WProperties coverEntryStubs)
Generates the HTML code for an entry with a toolbar and appends it to a StringBuffer. |
String |
generatePage(String sectionName,
int pageNo,
int pageCount,
Vector entryPages,
Navigator navigator,
boolean editMode)
Generate the HTML page that corresponds to all ingredients. |
Section |
generateSection(Vector entries,
String sectionName,
boolean editMode,
Navigator navigator)
Generates a section from the template. |
static String |
getExternalEntryLink(Entry entry,
int entryId,
String sub)
Get the correct link for an Entry that carries an EXTERNAL_ENTRY. |
static String |
getParamValue(String tag,
String param)
Gets the value of a parameter from an HTML tag. |
static boolean |
isInternalLink(String link,
Navigator navigator)
|
String |
linkActionOf(Navigator navigator,
Entry entry,
int entryId,
String sub)
Get the correct action when the entry's link is clicked. |
String |
locationOfImage(String imageName)
What is the location of a entry toolbar image ? |
static String |
purifyHTMLFile(String html)
Zpad should be as browser insensitive as possible. |
static String |
removeHTML(String html,
String tag,
boolean hasEnd,
boolean contents)
Removes unsupported HTML from an HTML file or fragment. |
void |
setFilename(String filename)
Sets a (new) filename for the template HTML file. |
void |
setFramename(String framename)
Sets a (new) Framename for the Frame HTML file. |
static void |
sortEntriesOnTime(Vector entries,
Navigator navigator)
|
static void |
substituteInEntry(Entry entry,
Navigator navigator,
WProperties coverEntryStubs)
Do "cover stubs" substitutions in the Entry itself. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static String defaultFrame
protected static String _embedFrame
public String framename
setFramename(java.lang.String)public String frame
public boolean frameIsLoaded
public static final String ENTRY_TAG
public static final String TRANSPARENT_IMAGE
public static final String TEMPLATEPROPS_KEY
protected Vector _actualBoxes
protected int[] _boxCount
protected String _html
protected String _htmlOpt
protected int _htmlOptMin
protected int _htmlOptMax
protected String _htmlHOpt
protected Box _htmlHOptBox
protected int _htmlHOptMaxWidth
public String name
protected InputHandler _coverInput
protected InputHandler _shareInput
public String filename
setFilename(java.lang.String)protected int _numberOfColumns
public int type
Generatorpublic DateSpec dateSpec
public int imageHeight
public int imageWidth
public boolean isLoaded
protected static final String NAME_KEY
protected static final String TYPE_KEY
protected static final String FILENAME_KEY
protected static final String FRAMENAME_KEY
protected static final String DATESPEC_KEY
protected static int _TOPSECTIONS
protected static int _SUBSECTIONS
protected static int _SUBSUBSECTIONS
protected static int _ALTSECTIONS
protected static int _MORE_NONE
protected static int _MORE_MORE
protected static int _MORE_MAX
| Constructor Detail |
|---|
public Template(InputHandler coverInput,
InputHandler shareInput)
coverInput - the input handler to use for loading the HTML file.| Method Detail |
|---|
public static Template create(InputHandler coverInput,
InputHandler shareInput,
WProperties props)
input - an input handler for the new template.props - the properties object containing the configuration.
public void setFramename(String framename)
filename - the name of the Frame HTML file.public void setFilename(String filename)
filename - the name of the template HTML file.protected void _initParseTemplate(String html)
html - a string containing an HTML document.protected String _parseTemplate(String html)
html - a string containing an HTML document.public Object clone()
clone in class Object
public Section generateSection(Vector entries,
String sectionName,
boolean editMode,
Navigator navigator)
entries - a Vector containing Entry's.sectionName - the name of the section to create.editMode - flag indicating whether the generated section should be in edit mode.navigator - the navigator to be used for all extra information.
protected String _calculateTemplate(Vector entries,
int entryToDo,
Vector selEntries,
Navigator navigator,
boolean editMode,
boolean forReal,
WProperties coverEntryStubs)
entries - the full set of Entries in the current Section.entryToDo - the index of the first Entry to use.selEntries - if not null, the Entries for the calculated Template will be returned in this Vector.editMode - if true, show an editMode pageforReal - if true, really calculate the resulting String (if false, selEntries is the interesting result).
public String generatePage(String sectionName,
int pageNo,
int pageCount,
Vector entryPages,
Navigator navigator,
boolean editMode)
protected String _generateEntryCode(Entry entry,
Box box,
Navigator navigator,
int border,
WProperties coverEntryStubs)
entry - the entry to generate the code for.box - the box to fill.navigator - the navigatorborder - the border width
public String generateEntryToolbar(Entry entry,
boolean editMode,
int entryId,
int pl,
Navigator navigator,
Object sectionID,
WProperties coverEntryStubs)
entry - the entry to generate the code for.editMode - flag indicating whether edit mode is active.entryId - an identifying integer for the entry.
protected void _generateLinkedImage(String href,
String onMouseOver,
String onMouseOut,
String target,
String httpDir,
String file,
String name,
int width,
int height,
String altText,
StringBuffer buf)
href - a URL for the link or null.onMouseOver - actions when the mouse moves over it (optional).onMouseOut - actions when the mouse moves out (optional).target - the target (e.g. _blank or _top) for the link (optional).httpDir - the URL of the directory the image is in (including the trailing slash).file - the name of the image file.name - an optional name for the image (optional).width - the width of the image.height - the height of the image.altText - a alternative message to display (optional).buf - the StringBuffer the image tag will be appended to.
protected void _generateImage(String httpDir,
String file,
String name,
int width,
int height,
String altText,
StringBuffer buf)
httpDir - the URL of the directory the image is in (including the trailing slash).file - the name of the image file.name - an optional name for the image (optional)width - the width of the image.height - the height of the image.altText - a alternative message to display (optional).buf - the StringBuffer the image tag will be appended to.
protected void _generateProvideImage(String imgName,
int width,
int height,
int entryId,
StringBuffer buf)
imgName - the filename of the export image.width - the width of the image in the generated tag.height - the height of the image in the generated tag.entryId - the entryId of the entry to export.buf - the StringBuffer to append the code to.
protected void _generateExpiredImage(Entry entry,
String imgName,
int width,
int height,
int entryId,
boolean editMode,
StringBuffer buf)
imgName - the filename of the export image.width - the width of the image in the generated tag.height - the height of the image in the generated tag.entryId - the entryId of the entry to export.editMode - true if ZPad in edit mode, false otherwisebuf - the StringBuffer to append the code to.
protected Entry _getTransparentEntry(int width,
int height)
width - the width of the entry.box - the height of the entry.
protected String _substituteGeneratorTags(String page,
String sectionName,
int pageNo,
int pageCount,
String sectionURL,
String sectionPageURL,
String userName,
String serverName,
int entryIdBase,
Vector origEntries,
boolean editMode,
int pl,
Navigator navigator,
WProperties coverEntryStubs)
page - a page containing meta tags.sectionName - the name of the section.pageNo - the number of the page.pageCount - the total number of pages.sectionURL - the URL of the full section.userName - the user's name.serverName - the server's name.
REMIND
public static String removeHTML(String html,
String tag,
boolean hasEnd,
boolean contents)
html - an HTML document.
public static String purifyHTMLFile(String html)
public static String getParamValue(String tag,
String param)
tag - an HTML tag (e.g. <IMG src="bla" width="100"
height="50">).param - the parameter to look for (e.g. width).
public String linkActionOf(Navigator navigator,
Entry entry,
int entryId,
String sub)
sub - the subkey identifier (used for e.g. clabel specific links)
NOTE: don't run EVERYTHING through the ZPad applet because of "Copy Link Location"!
It would work, but it's not user-friendly.
public static boolean isInternalLink(String link,
Navigator navigator)
public static String formalizeLink(String link)
link - a link or null
public static void substituteInEntry(Entry entry,
Navigator navigator,
WProperties coverEntryStubs)
protected int _countBoxes(String html)
public static String getExternalEntryLink(Entry entry,
int entryId,
String sub)
protected String _correctCutting(String s,
boolean start,
boolean end)
s - the string to be correctedstart - if true, correct the startend - if true, correct the end
protected String _getClickablePath(String sectionName,
String host,
Navigator navigator,
boolean reallyClickable)
protected String _getInPageNavigation(Navigator navigator,
PathString sectionName,
int type,
int subtype,
int metaIndex)
type - one of _TOPSECTIONS, _SUBSECTIONS, _SUBSUBSECTIONS
public static Vector columnLayout(Vector objects,
int columns,
Object placeHolder)
public static void sortEntriesOnTime(Vector entries,
Navigator navigator)
public String locationOfImage(String imageName)
protected Vector _getInPageStubValues(Navigator navigator,
String section,
PathString fullsection,
String moreString)
protected void _getMetaAlternatives(PathString sectionName,
Navigator navigator,
Vector children,
Vector fullchildren,
Vector extraInfo)
protected void _getValueAlternatives(PathString sectionName,
int metaIndex,
int maxChildren,
Navigator navigator,
Vector children,
Vector fullchildren,
String removeString)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||