import java.util.*; //import Html; //import MixedText; /** * This type represents a FootnoteContents from an faq style chunk of * text. The contents of the FootnoteContents may contain links. * * @author http://bumble.sf.net * @See Footnote, FootnoteID, FootnoteReference. */ public class FootnoteContents extends Object { //-------------------------------------------- private static String NEWLINE = System.getProperty("line.separator"); //-------------------------------------------- /** the text of the footnote */ private MixedText text; //-------------------------------------------- public static String TERMINATOR = ""; //-------------------------------------------- public static String INDICATOR = "a:"; //-------------------------------------------- private boolean isGood; //-------------------------------------------- //-------------------------------------------- public FootnoteContents() { this.text = new MixedText(); } //-------------------------------------------- /** construct with some text */ public FootnoteContents(String sText) { this(); this.loadData(sText); } //-------------------------------------------- /** load data from text */ public void loadData(String sText) { this.isGood = this.isFootnoteContents(sText); if (!this.isGood) { return; } if (sText.trim().startsWith(FootnoteContents.INDICATOR)) { this.text = new MixedText( sText.trim().substring(FootnoteContents.INDICATOR.length())); } else { this.text = new MixedText(sText); } } //-------------------------------------------- public MixedText getContents() { return this.text; } //-------------------------------------------- public void setContents(String sContents) { this.text = new MixedText(sContents); } //-------------------------------------------- /** checks if this looks like a FootnoteContents, but an FootnoteContents * will be whatever is left over */ public static boolean isFootnoteContents(String sText) { /* if (sText.trim().length() == 0) { return false; } if (!sText.trim().startsWith(FootnoteContents.INDICATOR)) { return false; } if (!sText.trim().endsWith(FootnoteContents.TERMINATOR)) { return false; } */ return true; } //-------------------------------------------- public String toString() { StringBuffer sbReturn = new StringBuffer(""); sbReturn.append(FootnoteContents.INDICATOR); sbReturn.append(this.text.toString()); sbReturn.append(FootnoteContents.TERMINATOR); return sbReturn.toString(); } //-------------------------------------------- public String printReport() { StringBuffer sbReturn = new StringBuffer(""); sbReturn.append("FootnoteContents Indicator >"); sbReturn.append(FootnoteContents.INDICATOR); sbReturn.append(NEWLINE); sbReturn.append("FootnoteContents Terminator>"); sbReturn.append(FootnoteContents.TERMINATOR); sbReturn.append(NEWLINE); sbReturn.append("FootnoteContents contents >"); sbReturn.append(this.text.toString()); sbReturn.append(NEWLINE); return sbReturn.toString(); } //-------------------------------------------- public String printHtml() { StringBuffer sbReturn = new StringBuffer(""); sbReturn.append("