src/share/classes/javax/swing/text/html/HTMLWriter.java
Print this page
@@ -252,11 +252,11 @@
protected void writeAttributes(AttributeSet attr) throws IOException {
// translate css attributes to html
convAttr.removeAttributes(convAttr);
convertToHTML32(attr, convAttr);
- Enumeration names = convAttr.getAttributeNames();
+ Enumeration<?> names = convAttr.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
if (name instanceof HTML.Tag ||
name instanceof StyleConstants ||
name == HTML.Attribute.ENDTAG) {
@@ -525,17 +525,19 @@
*/
protected void selectContent(AttributeSet attr) throws IOException {
Object model = attr.getAttribute(StyleConstants.ModelAttribute);
incrIndent();
if (model instanceof OptionListModel) {
+ @SuppressWarnings("unchecked")
OptionListModel<Option> listModel = (OptionListModel<Option>) model;
int size = listModel.getSize();
for (int i = 0; i < size; i++) {
Option option = listModel.getElementAt(i);
writeOption(option);
}
} else if (model instanceof OptionComboBoxModel) {
+ @SuppressWarnings("unchecked")
OptionComboBoxModel<Option> comboBoxModel = (OptionComboBoxModel<Option>) model;
int size = comboBoxModel.getSize();
for (int i = 0; i < size; i++) {
Option option = comboBoxModel.getElementAt(i);
writeOption(option);
@@ -655,11 +657,11 @@
void writeAdditionalComments() throws IOException {
Object comments = getDocument().getProperty
(HTMLDocument.AdditionalComments);
if (comments instanceof Vector) {
- Vector v = (Vector)comments;
+ Vector<?> v = (Vector)comments;
for (int counter = 0, maxCounter = v.size(); counter < maxCounter;
counter++) {
writeComment(v.elementAt(counter).toString());
}
}
@@ -705,11 +707,11 @@
protected void writeEmbeddedTags(AttributeSet attr) throws IOException {
// translate css attributes to html
attr = convertToHTML(attr, oConvAttr);
- Enumeration names = attr.getAttributeNames();
+ Enumeration<?> names = attr.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
if (name instanceof HTML.Tag) {
HTML.Tag tag = (HTML.Tag)name;
if (tag == HTML.Tag.FORM || tags.contains(tag)) {
@@ -846,11 +848,11 @@
/**
* Outputs the maps as elements. Maps are not stored as elements in
* the document, and as such this is used to output them.
*/
- void writeMaps(Enumeration maps) throws IOException {
+ void writeMaps(Enumeration<?> maps) throws IOException {
if (maps != null) {
while(maps.hasMoreElements()) {
Map map = (Map)maps.nextElement();
String name = map.getName();
@@ -894,11 +896,11 @@
* elements, but part of the document. For the time being styles are
* written out as a comment, inside a style tag.
*/
void writeStyles(StyleSheet sheet) throws IOException {
if (sheet != null) {
- Enumeration styles = sheet.getStyleNames();
+ Enumeration<?> styles = sheet.getStyleNames();
if (styles != null) {
boolean outputStyle = false;
while (styles.hasMoreElements()) {
String name = (String)styles.nextElement();
// Don't write out the default style.
@@ -920,11 +922,11 @@
* true if a style is written.
*/
boolean writeStyle(String name, Style style, boolean outputStyle)
throws IOException{
boolean didOutputStyle = false;
- Enumeration attributes = style.getAttributeNames();
+ Enumeration<?> attributes = style.getAttributeNames();
if (attributes != null) {
while (attributes.hasMoreElements()) {
Object attribute = attributes.nextElement();
if (attribute instanceof CSS.Attribute) {
String value = style.getAttribute(attribute).toString();
@@ -1030,11 +1032,11 @@
*/
private static void convertToHTML32(AttributeSet from, MutableAttributeSet to) {
if (from == null) {
return;
}
- Enumeration keys = from.getAttributeNames();
+ Enumeration<?> keys = from.getAttributeNames();
String value = "";
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (key instanceof CSS.Attribute) {
if ((key == CSS.Attribute.FONT_FAMILY) ||
@@ -1137,11 +1139,11 @@
* Copies the given AttributeSet to a new set, converting
* any CSS attributes found to arguments of an HTML style
* attribute.
*/
private static void convertToHTML40(AttributeSet from, MutableAttributeSet to) {
- Enumeration keys = from.getAttributeNames();
+ Enumeration<?> keys = from.getAttributeNames();
String value = "";
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (key instanceof CSS.Attribute) {
value = value + " " + key + "=" + from.getAttribute(key) + ";";