1106 * stream. 1107 * 1108 * @param eol value of eol 1109 * 1110 * @since 1.3 1111 */ 1112 public void handleEndOfLineString(String eol) { 1113 } 1114 } 1115 1116 /** 1117 * A factory to build views for HTML. The following 1118 * table describes what this factory will build by 1119 * default. 1120 * 1121 * <table class="striped"> 1122 * <caption>Describes the tag and view created by this factory by default 1123 * </caption> 1124 * <thead> 1125 * <tr> 1126 * <th>Tag 1127 * <th>View created 1128 * </tr> 1129 * </thead> 1130 * <tbody> 1131 * <tr> 1132 * <td>HTML.Tag.CONTENT<td>InlineView 1133 * </tr><tr> 1134 * <td>HTML.Tag.IMPLIED<td>javax.swing.text.html.ParagraphView 1135 * </tr><tr> 1136 * <td>HTML.Tag.P<td>javax.swing.text.html.ParagraphView 1137 * </tr><tr> 1138 * <td>HTML.Tag.H1<td>javax.swing.text.html.ParagraphView 1139 * </tr><tr> 1140 * <td>HTML.Tag.H2<td>javax.swing.text.html.ParagraphView 1141 * </tr><tr> 1142 * <td>HTML.Tag.H3<td>javax.swing.text.html.ParagraphView 1143 * </tr><tr> 1144 * <td>HTML.Tag.H4<td>javax.swing.text.html.ParagraphView 1145 * </tr><tr> 1146 * <td>HTML.Tag.H5<td>javax.swing.text.html.ParagraphView 1147 * </tr><tr> 1148 * <td>HTML.Tag.H6<td>javax.swing.text.html.ParagraphView 1149 * </tr><tr> 1150 * <td>HTML.Tag.DT<td>javax.swing.text.html.ParagraphView 1151 * </tr><tr> 1152 * <td>HTML.Tag.MENU<td>ListView 1153 * </tr><tr> 1154 * <td>HTML.Tag.DIR<td>ListView 1155 * </tr><tr> 1156 * <td>HTML.Tag.UL<td>ListView 1157 * </tr><tr> 1158 * <td>HTML.Tag.OL<td>ListView 1159 * </tr><tr> 1160 * <td>HTML.Tag.LI<td>BlockView 1161 * </tr><tr> 1162 * <td>HTML.Tag.DL<td>BlockView 1163 * </tr><tr> 1164 * <td>HTML.Tag.DD<td>BlockView 1165 * </tr><tr> 1166 * <td>HTML.Tag.BODY<td>BlockView 1167 * </tr><tr> 1168 * <td>HTML.Tag.HTML<td>BlockView 1169 * </tr><tr> 1170 * <td>HTML.Tag.CENTER<td>BlockView 1171 * </tr><tr> 1172 * <td>HTML.Tag.DIV<td>BlockView 1173 * </tr><tr> 1174 * <td>HTML.Tag.BLOCKQUOTE<td>BlockView 1175 * </tr><tr> 1176 * <td>HTML.Tag.PRE<td>BlockView 1177 * </tr><tr> 1178 * <td>HTML.Tag.BLOCKQUOTE<td>BlockView 1179 * </tr><tr> 1180 * <td>HTML.Tag.PRE<td>BlockView 1181 * </tr><tr> 1182 * <td>HTML.Tag.IMG<td>ImageView 1183 * </tr><tr> 1184 * <td>HTML.Tag.HR<td>HRuleView 1185 * </tr><tr> 1186 * <td>HTML.Tag.BR<td>BRView 1187 * </tr><tr> 1188 * <td>HTML.Tag.TABLE<td>javax.swing.text.html.TableView 1189 * </tr><tr> 1190 * <td>HTML.Tag.INPUT<td>FormView 1191 * </tr><tr> 1192 * <td>HTML.Tag.SELECT<td>FormView 1193 * </tr><tr> 1194 * <td>HTML.Tag.TEXTAREA<td>FormView 1195 * </tr><tr> 1196 * <td>HTML.Tag.OBJECT<td>ObjectView 1197 * </tr><tr> 1198 * <td>HTML.Tag.FRAMESET<td>FrameSetView 1199 * </tr><tr> 1200 * <td>HTML.Tag.FRAME<td>FrameView 1201 * </tr> 1202 * </tbody> 1203 * </table> 1204 */ 1205 public static class HTMLFactory implements ViewFactory { 1206 1207 /** 1208 * Creates a view from an element. 1209 * 1210 * @param elem the element 1211 * @return the view 1212 */ 1213 public View create(Element elem) { 1214 AttributeSet attrs = elem.getAttributes(); 1215 Object elementName = 1216 attrs.getAttribute(AbstractDocument.ElementNameAttribute); 1217 Object o = (elementName != null) ? 1218 null : attrs.getAttribute(StyleConstants.NameAttribute); 1219 if (o instanceof HTML.Tag) { 1220 HTML.Tag kind = (HTML.Tag) o; 1221 if (kind == HTML.Tag.CONTENT) { | 1106 * stream. 1107 * 1108 * @param eol value of eol 1109 * 1110 * @since 1.3 1111 */ 1112 public void handleEndOfLineString(String eol) { 1113 } 1114 } 1115 1116 /** 1117 * A factory to build views for HTML. The following 1118 * table describes what this factory will build by 1119 * default. 1120 * 1121 * <table class="striped"> 1122 * <caption>Describes the tag and view created by this factory by default 1123 * </caption> 1124 * <thead> 1125 * <tr> 1126 * <th scope="col">Tag 1127 * <th scope="col">View created 1128 * </thead> 1129 * <tbody> 1130 * <tr> 1131 * <th scope="row">HTML.Tag.CONTENT 1132 * <td>InlineView 1133 * <tr> 1134 * <th scope="row">HTML.Tag.IMPLIED 1135 * <td>javax.swing.text.html.ParagraphView 1136 * <tr> 1137 * <th scope="row">HTML.Tag.P 1138 * <td>javax.swing.text.html.ParagraphView 1139 * <tr> 1140 * <th scope="row">HTML.Tag.H1 1141 * <td>javax.swing.text.html.ParagraphView 1142 * <tr> 1143 * <th scope="row">HTML.Tag.H2 1144 * <td>javax.swing.text.html.ParagraphView 1145 * <tr> 1146 * <th scope="row">HTML.Tag.H3 1147 * <td>javax.swing.text.html.ParagraphView 1148 * <tr> 1149 * <th scope="row">HTML.Tag.H4 1150 * <td>javax.swing.text.html.ParagraphView 1151 * <tr> 1152 * <th scope="row">HTML.Tag.H5 1153 * <td>javax.swing.text.html.ParagraphView 1154 * <tr> 1155 * <th scope="row">HTML.Tag.H6 1156 * <td>javax.swing.text.html.ParagraphView 1157 * <tr> 1158 * <th scope="row">HTML.Tag.DT 1159 * <td>javax.swing.text.html.ParagraphView 1160 * <tr> 1161 * <th scope="row">HTML.Tag.MENU 1162 * <td>ListView 1163 * <tr> 1164 * <th scope="row">HTML.Tag.DIR 1165 * <td>ListView 1166 * <tr> 1167 * <th scope="row">HTML.Tag.UL 1168 * <td>ListView 1169 * <tr> 1170 * <th scope="row">HTML.Tag.OL 1171 * <td>ListView 1172 * <tr> 1173 * <th scope="row">HTML.Tag.LI 1174 * <td>BlockView 1175 * <tr> 1176 * <th scope="row">HTML.Tag.DL 1177 * <td>BlockView 1178 * <tr> 1179 * <th scope="row">HTML.Tag.DD 1180 * <td>BlockView 1181 * <tr> 1182 * <th scope="row">HTML.Tag.BODY 1183 * <td>BlockView 1184 * <tr> 1185 * <th scope="row">HTML.Tag.HTML 1186 * <td>BlockView 1187 * <tr> 1188 * <th scope="row">HTML.Tag.CENTER 1189 * <td>BlockView 1190 * <tr> 1191 * <th scope="row">HTML.Tag.DIV 1192 * <td>BlockView 1193 * <tr> 1194 * <th scope="row">HTML.Tag.BLOCKQUOTE 1195 * <td>BlockView 1196 * <tr> 1197 * <th scope="row">HTML.Tag.PRE 1198 * <td>BlockView 1199 * <tr> 1200 * <th scope="row">HTML.Tag.BLOCKQUOTE 1201 * <td>BlockView 1202 * <tr> 1203 * <th scope="row">HTML.Tag.PRE 1204 * <td>BlockView 1205 * <tr> 1206 * <th scope="row">HTML.Tag.IMG 1207 * <td>ImageView 1208 * <tr> 1209 * <th scope="row">HTML.Tag.HR 1210 * <td>HRuleView 1211 * <tr> 1212 * <th scope="row">HTML.Tag.BR 1213 * <td>BRView 1214 * <tr> 1215 * <th scope="row">HTML.Tag.TABLE 1216 * <td>javax.swing.text.html.TableView 1217 * <tr> 1218 * <th scope="row">HTML.Tag.INPUT 1219 * <td>FormView 1220 * <tr> 1221 * <th scope="row">HTML.Tag.SELECT 1222 * <td>FormView 1223 * <tr> 1224 * <th scope="row">HTML.Tag.TEXTAREA 1225 * <td>FormView 1226 * <tr> 1227 * <th scope="row">HTML.Tag.OBJECT 1228 * <td>ObjectView 1229 * <tr> 1230 * <th scope="row">HTML.Tag.FRAMESET 1231 * <td>FrameSetView 1232 * <tr> 1233 * <th scope="row">HTML.Tag.FRAME 1234 * <td>FrameView 1235 * </tbody> 1236 * </table> 1237 */ 1238 public static class HTMLFactory implements ViewFactory { 1239 1240 /** 1241 * Creates a view from an element. 1242 * 1243 * @param elem the element 1244 * @return the view 1245 */ 1246 public View create(Element elem) { 1247 AttributeSet attrs = elem.getAttributes(); 1248 Object elementName = 1249 attrs.getAttribute(AbstractDocument.ElementNameAttribute); 1250 Object o = (elementName != null) ? 1251 null : attrs.getAttribute(StyleConstants.NameAttribute); 1252 if (o instanceof HTML.Tag) { 1253 HTML.Tag kind = (HTML.Tag) o; 1254 if (kind == HTML.Tag.CONTENT) { |