/** * * * This class provides code to make an HTML document for a TagCloud, complete with Cascading Style Sheets. * Call order:
    *
  1. makeHeader *
  2. makeWord *
  3. makeFooter *
*

* The second phase, makeWord calls can * generate many HTML-stylized strings for words. *

* @author Andrew Hsiao */ public class CSSMaker { public static final int NUM_CLASSES = 30; /** * Make the HTML header * @return String header containing CSS */ public String makeHeader() { StringBuffer header = new StringBuffer(); header.append("\n"); header.append("\n"); header.append("\n"); header.append("\t\n"); header.append("\tDuke Tag Cloud\n"); header.append("\n"); header.append("\n"); header.append("\n"); return header.toString(); } /** * Make the HTML footer * @return String footer */ public String makeFooter() { StringBuffer footer = new StringBuffer(); footer.append("\n"); footer.append(""); return footer.toString(); } /** * Make a CSS-styled word, surrounded by * @param word will be stylized * @param classNum determines how large a font-size is used in styling * the HTML for word * @return CSS-styled word */ public String makeHTML(String word, int classNum) { if (classNum < 0 || classNum >= NUM_CLASSES) throw new IllegalArgumentException(classNum +" is not a valid class number"); String htmlWord = "" + word + "\n"; return htmlWord; } /** * Get the total number of CSS classes available. * @return int number of CSS classes */ public int getCloudClassCount() { return NUM_CLASSES; } }