001 package org.util.html.objects; 002 003 004 import java.util.*; 005 import java.io.*; 006 import java.net.*; 007 import java.awt.*; 008 import java.awt.event.*; 009 import javax.swing.*; 010 import javax.swing.event.*; 011 012 import org.util.xml.parse.policy.*; 013 import org.util.xml.element.*; 014 015 public abstract class HTMLObject implements ParserPolicy { 016 017 private HTMLDocument root_; 018 private boolean is_layouted_; 019 private int next_x_, next_y_; 020 private int height_; 021 022 public HTMLObject(HTMLDocument root) { 023 root_ = root; 024 } 025 public HTMLDocument getRoot() { 026 return root_; 027 } 028 public void setLayouted(boolean is_layouted) { 029 is_layouted_ = is_layouted; 030 } 031 public boolean isLayouted() { 032 return is_layouted_; 033 } 034 035 public int getNextX() { 036 return next_x_; 037 } 038 public int getNextY() { 039 return next_y_; 040 } 041 public void setNextXY(int next_x, int next_y) { 042 next_x_ = next_x; 043 next_y_ = next_y; 044 } 045 046 public abstract JComponent getPanel(); 047 048 protected String[] forse_empty_tag_list_ = {"br","hr","meta","link","img","input","base","dd","dt","frame","p","pre","li","space"}; 049 050 public Element allowElement(Element element) { 051 return element; 052 } 053 public boolean checkEndTag() { 054 return true; 055 } 056 public boolean forceEmptyTag(String key) { 057 for(int i=0;i<forse_empty_tag_list_.length;i++) 058 if(forse_empty_tag_list_[i].equals(key.toLowerCase())) 059 return true; 060 return false; 061 } 062 public ParserPolicy getInnerPolicy(Element element) { 063 return this; 064 } 065 public String selectEncoding(java.lang.String last_tag_key) { 066 return "utf-8"; 067 } 068 public boolean throwExceptionIfDocumentHasError() { 069 return false; 070 } 071 public boolean finished() { 072 return false; 073 } 074 }