Class PicLink

java.lang.Object
  |
  +--Link
        |
        +--PicLink
All Implemented Interfaces:
java.lang.Comparable

public class PicLink
extends Link

A PicLink object represents a picture. This class provides the mechanisms necessary to create a web page for the picture with links to the categories to which the picture belongs.

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

Field Summary
protected  java.util.Vector categoriesItIsIn
          The list of CatLinks to which this picture belongs.
protected  java.lang.String contributor
          The person(s) who contributed the photo.
protected static java.util.Properties curTitles
          The translation table for picture-related phrases.
protected  MyDate date
          The date the picture was added to the site.
protected  java.lang.String subjects
          The person(s) who participated in the photo.
 
Fields inherited from class Link
caption, filename, htmlBaseName, keywords, lineend
 
Constructor Summary
PicLink()
           
 
Method Summary
protected  void addToCategory(java.lang.String fullCaption, boolean flag)
          Adds the picture to the category specified by its full Caption (for example, "Countries:Spain").
protected  CatLink catLinkForContributor(java.lang.String contrib)
          Retrieves the CatLink for the given contributor.
protected  CatLink catLinkForSubject(java.lang.String subject)
          Retrieves the CatLink for the given subject.
protected  void changeCaption(java.lang.String newCaption)
          Assigns a new caption to the picture and flags affected web pages for update.
protected  void changeContributor(java.lang.String newContributor)
          Assigns a new contributor to the picture and flags affected web pages for update.
protected  boolean changeDate(java.lang.String newDate)
          Assigns a new date to the picture and flags affected web pages for update.
protected  void changeStory(java.lang.String newStory)
          Assigns a new story to the picture and flags affected web pages for update.
protected  void changeSubjects(java.lang.String newSubjects)
          Assigns a new subject or subjects to the picture and flags affected web pages for update.
protected  java.lang.String contributorToHtmlLink()
          Returns an HTML expression representing the names of the contributor as a link to his or her category web page.
protected  void dateToCatLink(boolean flag)
          Adds the picture to the Sorted by Date category.
protected static boolean deletePicture(java.lang.String jpgFilename)
          Deletes the specified picture from the database and flags appropriate web pages for update.
protected static java.lang.String fromTabsToPicLink(java.lang.String tabFormat)
          Converts a tab-separated format of picture information to a picLink and returns the jpg filename of the picture.
protected  java.lang.String getIcons(CatLink catLink)
          Returns icons appropriate for the PicLink, such as NEW.
protected  java.lang.String getKeywords()
          Determines and returns the keywords appropriate for this picture's web page.
protected  java.lang.String getLinksToCategories()
          Returns an HTML expression representing links to the category web pages that this picture is in.
protected  int getPoints()
          Returns the number of points awarded to this picture.
protected  boolean isAFirstInCat()
          Reports whether this picLink was the first to appear in any category.
protected  boolean isAnEditorsPick()
          Reports whether this picLink is an Editor's Pick in any category.
protected  boolean isRecentAddition()
          Reports whether the picture is a recent addition.
protected static java.lang.String myDateToString(MyDate date)
          Converts MyDate object to yyyy/mm/dd format.
protected static boolean newPic(java.lang.String jpgFilename, boolean flag)
          Attempts to create a new picture in the database, returning false if the name is already being used.
protected  boolean removeFromCategory(java.lang.String fullCaption)
          Removes the picture from the specified category (for example, "Countries:Spain") and flags appropriate web pages for update.
protected static MyDate stringToMyDate(java.lang.String dateStr)
          Converts yyyy/mm/dd string to MyDate object.
protected  java.lang.String subjectsToHtmlLinks()
          Returns an HTML expression representing the names of the subjects as links to their category web pages.
protected  java.util.Vector subjectsToNames()
          Extracts individual names from single subject string, returning as separate String in a vector.
protected  java.lang.String toFullPicHtml()
          Returns an html expression for the image itself.
protected  java.lang.String toHrefThumbPic()
          Returns an HTML expression representing a linked thumbnail image.
 void toHtml()
          Generates a web page for the picture.
protected  java.lang.String toPiclistFormat()
          Returns a String representation of the picLink in the format seen in piclist.txt.
 java.lang.String toString()
          Returns a String representation of the picLink.
static java.lang.String translateContributor(java.lang.String contrib, java.lang.String subjects)
          Translates the contributor name, if needed (for example, if the contributor is "same", returns the name of the subject).
static java.lang.String translateSubject(java.lang.String subject)
          Translates the subject name, if needed (for example, if the subject is "me", returns "John").
 
Methods inherited from class Link
compareTo, getIconEditorsPick, getIconFirstInCat, getIconNew, toUniqueKeywords
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

date

protected MyDate date
The date the picture was added to the site.

contributor

protected java.lang.String contributor
The person(s) who contributed the photo.

subjects

protected java.lang.String subjects
The person(s) who participated in the photo.

curTitles

protected static java.util.Properties curTitles
The translation table for picture-related phrases.

categoriesItIsIn

protected java.util.Vector categoriesItIsIn
The list of CatLinks to which this picture belongs.
Constructor Detail

PicLink

public PicLink()
Method Detail

fromTabsToPicLink

protected static java.lang.String fromTabsToPicLink(java.lang.String tabFormat)
Converts a tab-separated format of picture information to a picLink and returns the jpg filename of the picture.

stringToMyDate

protected static MyDate stringToMyDate(java.lang.String dateStr)
Converts yyyy/mm/dd string to MyDate object.

myDateToString

protected static java.lang.String myDateToString(MyDate date)
Converts MyDate object to yyyy/mm/dd format.

getKeywords

protected java.lang.String getKeywords()
Determines and returns the keywords appropriate for this picture's web page.

toFullPicHtml

protected java.lang.String toFullPicHtml()
Returns an html expression for the image itself.

dateToCatLink

protected void dateToCatLink(boolean flag)
Adds the picture to the Sorted by Date category.

getIcons

protected java.lang.String getIcons(CatLink catLink)
Returns icons appropriate for the PicLink, such as NEW.

subjectsToNames

protected java.util.Vector subjectsToNames()
Extracts individual names from single subject string, returning as separate String in a vector.

isRecentAddition

protected boolean isRecentAddition()
Reports whether the picture is a recent addition.

getLinksToCategories

protected java.lang.String getLinksToCategories()
Returns an HTML expression representing links to the category web pages that this picture is in.

toHrefThumbPic

protected java.lang.String toHrefThumbPic()
Returns an HTML expression representing a linked thumbnail image. The link is to a web page containing the full sized image.

toHtml

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

toString

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

translateSubject

public static java.lang.String translateSubject(java.lang.String subject)
Translates the subject name, if needed (for example, if the subject is "me", returns "John").

translateContributor

public static java.lang.String translateContributor(java.lang.String contrib,
                                                    java.lang.String subjects)
Translates the contributor name, if needed (for example, if the contributor is "same", returns the name of the subject).

toPiclistFormat

protected java.lang.String toPiclistFormat()
Returns a String representation of the picLink in the format seen in piclist.txt.

changeDate

protected boolean changeDate(java.lang.String newDate)
Assigns a new date to the picture and flags affected web pages for update.

changeCaption

protected void changeCaption(java.lang.String newCaption)
Assigns a new caption to the picture and flags affected web pages for update.

changeSubjects

protected void changeSubjects(java.lang.String newSubjects)
Assigns a new subject or subjects to the picture and flags affected web pages for update.

isAnEditorsPick

protected boolean isAnEditorsPick()
Reports whether this picLink is an Editor's Pick in any category.

isAFirstInCat

protected boolean isAFirstInCat()
Reports whether this picLink was the first to appear in any category.

changeContributor

protected void changeContributor(java.lang.String newContributor)
Assigns a new contributor to the picture and flags affected web pages for update.

changeStory

protected void changeStory(java.lang.String newStory)
Assigns a new story to the picture and flags affected web pages for update.

addToCategory

protected void addToCategory(java.lang.String fullCaption,
                             boolean flag)
Adds the picture to the category specified by its full Caption (for example, "Countries:Spain").

removeFromCategory

protected boolean removeFromCategory(java.lang.String fullCaption)
Removes the picture from the specified category (for example, "Countries:Spain") and flags appropriate web pages for update.

deletePicture

protected static boolean deletePicture(java.lang.String jpgFilename)
Deletes the specified picture from the database and flags appropriate web pages for update.

newPic

protected static boolean newPic(java.lang.String jpgFilename,
                                boolean flag)
Attempts to create a new picture in the database, returning false if the name is already being used.

getPoints

protected int getPoints()
Returns the number of points awarded to this picture.

catLinkForSubject

protected CatLink catLinkForSubject(java.lang.String subject)
Retrieves the CatLink for the given subject. Used by subjectsToHtmlLinks().

catLinkForContributor

protected CatLink catLinkForContributor(java.lang.String contrib)
Retrieves the CatLink for the given contributor. Used by contributorToHtmlLink().

subjectsToHtmlLinks

protected java.lang.String subjectsToHtmlLinks()
Returns an HTML expression representing the names of the subjects as links to their category web pages.

contributorToHtmlLink

protected java.lang.String contributorToHtmlLink()
Returns an HTML expression representing the names of the contributor as a link to his or her category web page.