Class CatLink

java.lang.Object
  |
  +--Link
        |
        +--CatLink
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable
Direct Known Subclasses:
CatIndex, CatLinkPhoons

public class CatLink
extends Link
implements java.lang.Cloneable

A CatLink object represents a category. This class contains the mechanisms necessary to create a web page for the category with links to its base category and to its subcategories or pictures.

Author:
John E. Darrow (c) 2000, 2001

Field Summary
protected  CatLink[] clones
          Clones of the original.
protected static java.util.Properties curCatDescr
          The translations of category descriptions for the current language.
protected static java.util.Properties curCatTitles
          The translations of category titles for the current language.
protected  java.util.Vector editorsPicks
          The collection of picLinks that are editor's picks within this category.
protected  PicLink firstInCat
          The picLink selected as the first in this category.
protected  java.lang.String fullCaption
          The full record of the category and its ancestors.
protected  java.util.Vector links
          The links within this CatLink (either PicLinks or CatLinks).
protected  CatLink original
          A reference only used by clones of the original.
protected  CatLink parent
          The category containing this category.
 int subcatColWidth
          The width of the table columns.
 
Fields inherited from class Link
caption, filename, htmlBaseName, keywords, lineend
 
Constructor Summary
CatLink()
           
 
Method Summary
protected  void addEditorsPick(PicLink picLink)
          Identifies this picture as one of the category's Editor's Picks.
protected  void addFirstInCat(PicLink picLink)
          Assigns the picture as this category's first picture.
 boolean allowsEdPickIconOnCatPage()
          Returns whether or not this CatLink page allows the Editor's Pick icon to be displayed for a subcat or subpic.
 boolean allowsGrandkidLinks()
          Returns whether this catLink displays only its subcategories or also the subcategories of those subcategories.
 boolean allowsRecAddIconOnPage()
          Returns whether or not this CatLink page allows the New icon to appear for links to subcats or subpics.
 boolean allowsTranslation()
          Returns whether this CatLink page should be translated.
protected  boolean changeFirstInCat(java.lang.String jpgFilename)
          Assigns the specified picture as the picture that started the category.
 java.lang.Object clone()
          Returns a clone of the CatLink.
protected static java.lang.String deleteCategory(java.lang.String fullCaption)
          Deletes a category.
protected  void flushKeywordsUpChain()
          Nullifies Link.keywords for this catLink and its ancestors, forcing keywords to be regenerated for same upon HTML creation.
 java.util.Vector formCellContents()
          Returns a collection of HTML expressions that can be inserted into an HTML table.
protected  java.lang.String getBlurb()
          Returns the descriptive statement for this category in the current language and returns null if there is none.
protected static CatLink getCatLink(java.lang.String fullCaption)
          Retrieves an existing CatLink or creates a new one.
protected static CatLink getCatLink(java.lang.String fullCaption, boolean hasPics)
          Retrieves an existing CatLink or creates a new one.
protected static java.util.Vector getCatLinksSubset()
          Returns a vector containing all CatLinks.
protected static java.util.Vector getCatLinksSubset(boolean hasPicsOnly)
          Returns a vector containing all CatLinks except for those starting with expressions found in PMDB.capRetrieverExclusionList.
protected  CatLink[] getClones()
          Returns clones of the original category where each has a portion of the pics found in the category.
protected  java.lang.String getCount()
          Returns an expression containing the number of links in this category.
static java.util.Vector getFullCaptions()
          Returns a vector containing the fullCaptions of all CatLinks.
static java.util.Vector getFullCaptions(boolean hasPicsOnly)
          Returns a vector containing the fullcaps of all CatLinks except for those starting with expressions found in PMDB.capRetrieverExclusionList.
protected static java.util.Vector getHasPicsCatLinksSubset()
          Returns a vector containing all CatLinks that have pictures.
protected static java.util.Vector getHasPicsFullCaptions()
          Returns a vector containing the fullCaptions of only those CatLinks that have pictures.
 java.lang.String getHref()
          Used by toHref(boolean, boolean) to build the linked-caption portion of the expression.
 java.lang.String getHtmlBaseName(PicLink picLink)
          Provides the appropriate href filename, depending on whether this is a clone or not.
protected  java.lang.String getIcons()
          Returns the HTML expression for displaying icons appropriate for this catLink.
protected  java.lang.String getKeywords()
          Establishes the keywords of a catLink and all catLinks beneath it, working from the bottom up via recursion.
protected  java.lang.String getLanguage(java.lang.String lang)
          Returns the name of the language as locals know it.
 java.lang.String getPageLinkHeading(int pageNum)
          Returns an appropriate heading for the page number and current language (for example, "Page 1").
 java.lang.String getPageLinkLinks(int cloneNum)
          Returns an appropriate heading for the page number and current language (for example, "Page 1").
 java.lang.String getTable()
          Returns an HTML table whose form depends on whether the category is a collection of pictures or subcategories.
 boolean hasEdPickPics()
          Returns whether this category has any Editor's Picks.
protected  boolean hasPics()
          Returns true if this category has pictures and false if it has subcategories.
 boolean hasRecAddPics()
          Returns true if the catLink has a recent addition among its pictures or its subcats' pictures.
 boolean isEditorsPickForCatPage(PicLink picLink)
          Returns whether the picLink is an editor's pick in this category.
 boolean isEditorsPickForPicPage(PicLink picLink)
          Returns whether the picLink is an editor's pick in this category.
 boolean isFirstInCat(PicLink picLink)
          Returns whether the picLink started this category.
 boolean isMulti()
          Returns true if this CatLink has more pictures than could fit on a single page.
protected  void removeEditorsPick(PicLink picLink)
          Removes this picture from the category's collection of Editor's Picks.
 java.lang.String toHref(boolean withCount, boolean withIcons)
          Builds and returns an HREF expression for this catLink, containing the basic HREF plus (optionally) the number of pictures in that category and icons for recent additions or editor's picks.
 java.lang.String toHref(PicLink picLink)
          Returns an href link to the catLink for use on the picLink page, showing icons appropriate for the picLink/catLink relationship, such as Editor's Pick.
protected  java.lang.String toHrefAncestors()
          Returns an HTML expression representing links to all ancestors of this category.
 void toHtml()
          Generates a web page for the catLink.
protected  void toHtml(int cloneNum)
          Generates the HTML for a selected clone of the catLink (a portion of the collection of pictures in the category).
 java.lang.String toString()
          Returns a String representation of the catLink.
protected  java.lang.String translateDescr(java.lang.String lookup)
          Retrieves the full translated expression for the English lookup phrase (or the English if no translation is found).
protected  java.lang.String translateFilename(java.lang.String filename)
          Returns the filename unique to the current language.
protected  java.lang.String translateHtmlBaseName(int pageNum)
          Returns the filename unique to the current language and specified page.
protected  java.lang.String translateTitle(java.lang.String lookup)
          Retrieves the full translated expression for the English lookup phrase (or the English if no translation is found).
 
Methods inherited from class Link
compareTo, getIconEditorsPick, getIconFirstInCat, getIconNew, toUniqueKeywords
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

subcatColWidth

public int subcatColWidth
The width of the table columns. Used by getTable().

links

protected java.util.Vector links
The links within this CatLink (either PicLinks or CatLinks).

original

protected CatLink original
A reference only used by clones of the original.

clones

protected CatLink[] clones
Clones of the original.

parent

protected CatLink parent
The category containing this category.

firstInCat

protected PicLink firstInCat
The picLink selected as the first in this category.

editorsPicks

protected java.util.Vector editorsPicks
The collection of picLinks that are editor's picks within this category.

fullCaption

protected java.lang.String fullCaption
The full record of the category and its ancestors. For example, Events:Holidays:Christmas

curCatTitles

protected static java.util.Properties curCatTitles
The translations of category titles for the current language.

curCatDescr

protected static java.util.Properties curCatDescr
The translations of category descriptions for the current language.
Constructor Detail

CatLink

public CatLink()
Method Detail

getFullCaptions

public static java.util.Vector getFullCaptions(boolean hasPicsOnly)
Returns a vector containing the fullcaps of all CatLinks except for those starting with expressions found in PMDB.capRetrieverExclusionList.

getFullCaptions

public static java.util.Vector getFullCaptions()
Returns a vector containing the fullCaptions of all CatLinks.

isMulti

public boolean isMulti()
Returns true if this CatLink has more pictures than could fit on a single page. See PMDB.maxPicsPerPage.

toHref

public java.lang.String toHref(PicLink picLink)
Returns an href link to the catLink for use on the picLink page, showing icons appropriate for the picLink/catLink relationship, such as Editor's Pick.

getHtmlBaseName

public java.lang.String getHtmlBaseName(PicLink picLink)
Provides the appropriate href filename, depending on whether this is a clone or not.

clone

public java.lang.Object clone()
Returns a clone of the CatLink.
Overrides:
clone in class java.lang.Object

toHtml

public void toHtml()
Generates a web page for the catLink.
Overrides:
toHtml in class Link

getTable

public java.lang.String getTable()
Returns an HTML table whose form depends on whether the category is a collection of pictures or subcategories.

formCellContents

public java.util.Vector formCellContents()
Returns a collection of HTML expressions that can be inserted into an HTML table. The kind of expression depends on whether it is about a picture or a subcategory.

getPageLinkHeading

public java.lang.String getPageLinkHeading(int pageNum)
Returns an appropriate heading for the page number and current language (for example, "Page 1").

getPageLinkLinks

public java.lang.String getPageLinkLinks(int cloneNum)
Returns an appropriate heading for the page number and current language (for example, "Page 1").

allowsGrandkidLinks

public boolean allowsGrandkidLinks()
Returns whether this catLink displays only its subcategories or also the subcategories of those subcategories.

allowsRecAddIconOnPage

public boolean allowsRecAddIconOnPage()
Returns whether or not this CatLink page allows the New icon to appear for links to subcats or subpics.

allowsEdPickIconOnCatPage

public boolean allowsEdPickIconOnCatPage()
Returns whether or not this CatLink page allows the Editor's Pick icon to be displayed for a subcat or subpic. Default behavior is that an Editor's Pick icon only appears on cat pages that have subpics.

allowsTranslation

public boolean allowsTranslation()
Returns whether this CatLink page should be translated. Intended to be overridden in subclasses.

toString

public java.lang.String toString()
Returns a String representation of the catLink.
Overrides:
toString in class java.lang.Object

getCatLink

protected static CatLink getCatLink(java.lang.String fullCaption)
Retrieves an existing CatLink or creates a new one.
Parameters:
fullCaption - The title of the category. If it is a subcategory, it is preceded by the parent category and a colon ("Parent:Child").

getCatLink

protected static CatLink getCatLink(java.lang.String fullCaption,
                                    boolean hasPics)
Retrieves an existing CatLink or creates a new one.
Parameters:
fullCaption - The title of the category. If it is a subcategory, it is preceded by the parent category and a colon ("Parent:Child").
hasPics - Whether this category has pictures or subcategories.

getCatLinksSubset

protected static java.util.Vector getCatLinksSubset(boolean hasPicsOnly)
Returns a vector containing all CatLinks except for those starting with expressions found in PMDB.capRetrieverExclusionList.

getCatLinksSubset

protected static java.util.Vector getCatLinksSubset()
Returns a vector containing all CatLinks.

getHasPicsCatLinksSubset

protected static java.util.Vector getHasPicsCatLinksSubset()
Returns a vector containing all CatLinks that have pictures.

getHasPicsFullCaptions

protected static java.util.Vector getHasPicsFullCaptions()
Returns a vector containing the fullCaptions of only those CatLinks that have pictures.

getClones

protected CatLink[] getClones()
Returns clones of the original category where each has a portion of the pics found in the category.

hasPics

protected boolean hasPics()
Returns true if this category has pictures and false if it has subcategories.

toHtml

protected void toHtml(int cloneNum)
Generates the HTML for a selected clone of the catLink (a portion of the collection of pictures in the category).

getBlurb

protected java.lang.String getBlurb()
Returns the descriptive statement for this category in the current language and returns null if there is none.

toHref

public java.lang.String toHref(boolean withCount,
                               boolean withIcons)
Builds and returns an HREF expression for this catLink, containing the basic HREF plus (optionally) the number of pictures in that category and icons for recent additions or editor's picks.

getHref

public java.lang.String getHref()
Used by toHref(boolean, boolean) to build the linked-caption portion of the expression. Intended to be overridden.

getCount

protected java.lang.String getCount()
Returns an expression containing the number of links in this category.

getIcons

protected java.lang.String getIcons()
Returns the HTML expression for displaying icons appropriate for this catLink. Used by toHref(boolean, boolean).

hasRecAddPics

public boolean hasRecAddPics()
Returns true if the catLink has a recent addition among its pictures or its subcats' pictures.

isEditorsPickForPicPage

public boolean isEditorsPickForPicPage(PicLink picLink)
Returns whether the picLink is an editor's pick in this category. For use by toHref(PicLink) for picLink page.

isEditorsPickForCatPage

public boolean isEditorsPickForCatPage(PicLink picLink)
Returns whether the picLink is an editor's pick in this category. For use by formCellContents() when getting hrefs for pictures.

isFirstInCat

public boolean isFirstInCat(PicLink picLink)
Returns whether the picLink started this category.

hasEdPickPics

public boolean hasEdPickPics()
Returns whether this category has any Editor's Picks. Default behavior is to return true if either it has pictures and at least one is an Editor's Pick or it has at least one subcategory with a picture that is an Editor's Pick.

flushKeywordsUpChain

protected void flushKeywordsUpChain()
Nullifies Link.keywords for this catLink and its ancestors, forcing keywords to be regenerated for same upon HTML creation. See getKeywords().

getKeywords

protected java.lang.String getKeywords()
Establishes the keywords of a catLink and all catLinks beneath it, working from the bottom up via recursion.

changeFirstInCat

protected boolean changeFirstInCat(java.lang.String jpgFilename)
Assigns the specified picture as the picture that started the category. Flags related picture and category pages for HTML update.

addFirstInCat

protected void addFirstInCat(PicLink picLink)
Assigns the picture as this category's first picture.

addEditorsPick

protected void addEditorsPick(PicLink picLink)
Identifies this picture as one of the category's Editor's Picks.

removeEditorsPick

protected void removeEditorsPick(PicLink picLink)
Removes this picture from the category's collection of Editor's Picks.

deleteCategory

protected static java.lang.String deleteCategory(java.lang.String fullCaption)
Deletes a category. Returns "" if successful and error messages if not. Flags appropriate web pages for update.

toHrefAncestors

protected java.lang.String toHrefAncestors()
Returns an HTML expression representing links to all ancestors of this category.

translateTitle

protected java.lang.String translateTitle(java.lang.String lookup)
Retrieves the full translated expression for the English lookup phrase (or the English if no translation is found). Uses the translation table for titles.

translateDescr

protected java.lang.String translateDescr(java.lang.String lookup)
Retrieves the full translated expression for the English lookup phrase (or the English if no translation is found). Uses the translation table for descriptions.

translateHtmlBaseName

protected java.lang.String translateHtmlBaseName(int pageNum)
Returns the filename unique to the current language and specified page.

getLanguage

protected java.lang.String getLanguage(java.lang.String lang)
Returns the name of the language as locals know it. For example, "es" results in "Español" and "en" results in "English".

translateFilename

protected java.lang.String translateFilename(java.lang.String filename)
Returns the filename unique to the current language.