// Job: Jay's Own Browser, a web browser written in Java by Jay Skeer // Copyright (C) 1996 Jay Skeer, Jay Prime Positive // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // import HotTexts; public class HtmlDocumentRegion { RegionStyle indention; HotTexts text; int style; public final int PREFORM= 0; public final int FILL= 1; public final int CENTER= 2; public final int ERROR= 3; public final int BLANK= 4; public final int RULE= 5; public final int EOF= 6; public final int NONE= 7; public String toString() { StringBuffer rv= new StringBuffer(); rv.append("region["); switch (style) { case PREFORM: rv.append("preform"); break; case FILL: rv.append("fill"); break; case CENTER: rv.append("center"); break; case ERROR: rv.append("error"); break; case BLANK: rv.append("blank"); break; case RULE: rv.append("rule"); break; case EOF: rv.append("eof"); break; case NONE: rv.append("none"); break; default: rv.append("unknown=="+Integer.toString(style)); break; } rv.append(" "); if (null == this.indention) { rv.append("NULL-indention"); } else { rv.append(indention.toString()); } rv.append(" "); if (null == this.text) { rv.append("NULL-HotTexts"); } else { rv.append(text.toString()); } rv.append("]"); return rv.toString(); } public HtmlDocumentRegion() { style= NONE; text= null; indention= null; } public HtmlDocumentRegion(int s, RegionStyle ind) { style= s; text= new HotTexts(); indention= ind; } public HtmlDocumentRegion(RegionStyle ind) { style= NONE; text= new HotTexts(); indention= ind; } public void add(HotText t) { text.add(t); } public void add(String t) { text.add(t); // with no hot text } public void setHotItem(String hot) { text.getLastElement().setHotItem(hot); } public void setHotName(String hot) { text.getLastElement().setHotName(hot); } public void setHotHref(String hot) { text.getLastElement().setHotHref(hot); } public HotTexts getHotTexts() { return text; } public String getFont() { return indention.getFont(); } public int getLeftMargin() { return indention.getLeftMargin(); } public int getFirstLeftMargin() { return indention.getFirstLeftMargin(); } public int getRightMargin() { return indention.getRightMargin(); } }