summaryrefslogtreecommitdiff
path: root/javax/swing/text
diff options
context:
space:
mode:
Diffstat (limited to 'javax/swing/text')
-rw-r--r--javax/swing/text/html/HTMLEditorKit.java2
-rw-r--r--javax/swing/text/html/HTMLWriter.java38
-rw-r--r--javax/swing/text/html/ImageView.java3
-rw-r--r--javax/swing/text/html/MinimalHTMLWriter.java17
-rw-r--r--javax/swing/text/html/MultiAttributeSet.java8
-rw-r--r--javax/swing/text/html/MultiStyle.java4
-rw-r--r--javax/swing/text/html/ObjectView.java2
-rw-r--r--javax/swing/text/html/StyleSheet.java31
-rw-r--r--javax/swing/text/html/TableView.java1
9 files changed, 52 insertions, 54 deletions
diff --git a/javax/swing/text/html/HTMLEditorKit.java b/javax/swing/text/html/HTMLEditorKit.java
index cc61889d7..45381d60e 100644
--- a/javax/swing/text/html/HTMLEditorKit.java
+++ b/javax/swing/text/html/HTMLEditorKit.java
@@ -1454,7 +1454,7 @@ public class HTMLEditorKit
try
{
styleSheet = new StyleSheet();
- Class c = HTMLEditorKit.class;
+ Class<?> c = HTMLEditorKit.class;
InputStream in = c.getResourceAsStream(DEFAULT_CSS);
InputStreamReader r = new InputStreamReader(in);
styleSheet.loadRules(r, null);
diff --git a/javax/swing/text/html/HTMLWriter.java b/javax/swing/text/html/HTMLWriter.java
index 6cc23df9a..6a5e6ed58 100644
--- a/javax/swing/text/html/HTMLWriter.java
+++ b/javax/swing/text/html/HTMLWriter.java
@@ -79,9 +79,9 @@ public class HTMLWriter
private HTMLDocument htmlDoc = null;
/**
- * Used to keep track of which embeded has been written out.
+ * Used to keep track of which embedded has been written out.
*/
- private HashSet openEmbededTagHashSet = null;
+ private HashSet<HTML.Tag> openEmbeddedTagHashSet = null;
private String new_line_str = "" + NEWLINE;
@@ -95,7 +95,7 @@ public class HTMLWriter
private int doc_len = -1;
private int doc_offset_remaining = -1;
private int doc_len_remaining = -1;
- private HashSet htmlFragmentParentHashSet = null;
+ private HashSet<Element> htmlFragmentParentHashSet = null;
private Element startElem = null;
private Element endElem = null;
private boolean fg_pass_start_elem = false;
@@ -112,7 +112,7 @@ public class HTMLWriter
super(writer, doc);
outWriter = writer;
htmlDoc = doc;
- openEmbededTagHashSet = new HashSet();
+ openEmbeddedTagHashSet = new HashSet<HTML.Tag>();
} // public HTMLWriter(Writer writer, HTMLDocument doc)
/**
@@ -129,13 +129,13 @@ public class HTMLWriter
super(writer, doc, pos, len);
outWriter = writer;
htmlDoc = doc;
- openEmbededTagHashSet = new HashSet();
+ openEmbeddedTagHashSet = new HashSet<HTML.Tag>();
doc_pos = pos;
doc_offset_remaining = pos;
doc_len = len;
doc_len_remaining = len;
- htmlFragmentParentHashSet = new HashSet();
+ htmlFragmentParentHashSet = new HashSet<Element>();
} // public HTMLWriter(Writer writer, HTMLDocument doc, int pos, int len)
/**
@@ -197,7 +197,8 @@ public class HTMLWriter
} // else
// NOTE: close out remaining open embeded tags.
- Object[] tag_arr = openEmbededTagHashSet.toArray();
+ HTML.Tag[] tag_arr =
+ openEmbeddedTagHashSet.toArray(new HTML.Tag[openEmbeddedTagHashSet.size()]);
for (int i = 0; i < tag_arr.length; i++)
{
@@ -219,8 +220,8 @@ public class HTMLWriter
protected void writeAttributes(AttributeSet attrSet)
throws IOException
{
- Enumeration attrNameEnum = attrSet.getAttributeNames();
-
+ Enumeration<?> attrNameEnum = attrSet.getAttributeNames();
+
while (attrNameEnum.hasMoreElements())
{
Object key = attrNameEnum.nextElement();
@@ -502,7 +503,7 @@ public class HTMLWriter
protected void writeEmbeddedTags(AttributeSet attrSet)
throws IOException
{
- Enumeration attrNameEnum = attrSet.getAttributeNames();
+ Enumeration<?> attrNameEnum = attrSet.getAttributeNames();
while (attrNameEnum.hasMoreElements())
{
@@ -511,12 +512,12 @@ public class HTMLWriter
if (key instanceof HTML.Tag)
{
- if (!openEmbededTagHashSet.contains(key))
+ if (!openEmbeddedTagHashSet.contains(key))
{
writeRaw("<" + key);
writeAttributes((AttributeSet) value);
writeRaw(">");
- openEmbededTagHashSet.add(key);
+ openEmbeddedTagHashSet.add((HTML.Tag) key);
} // if(!openEmbededTagHashSet.contains(key))
} // if(key instanceof HTML.Tag)
} // while(attrNameEnum.hasMoreElements())
@@ -535,16 +536,17 @@ public class HTMLWriter
protected void closeOutUnwantedEmbeddedTags(AttributeSet attrSet)
throws IOException
{
- Object[] tag_arr = openEmbededTagHashSet.toArray();
+ HTML.Tag[] tag_arr =
+ openEmbeddedTagHashSet.toArray(new HTML.Tag[openEmbeddedTagHashSet.size()]);
for (int i = 0; i < tag_arr.length; i++)
{
- HTML.Tag key = (HTML.Tag) tag_arr[i];
+ HTML.Tag key = tag_arr[i];
if (!attrSet.isDefined(key))
{
writeRaw("</" + key.toString() + ">");
- openEmbededTagHashSet.remove(key);
+ openEmbeddedTagHashSet.remove(key);
} // if(!attrSet.isDefined(key))
} // for(int i = 0; i < tag_arr.length; i++)
@@ -645,7 +647,7 @@ public class HTMLWriter
if (matchNameAttribute(attrSet, HTML.Tag.TITLE))
{
boolean fg_is_end_tag = false;
- Enumeration attrNameEnum = attrSet.getAttributeNames();
+ Enumeration<?> attrNameEnum = attrSet.getAttributeNames();
while (attrNameEnum.hasMoreElements())
{
@@ -860,7 +862,7 @@ public class HTMLWriter
if (matchNameAttribute(attrSet, HTML.Tag.TITLE))
{
boolean fg_is_end_tag = false;
- Enumeration attrNameEnum = attrSet.getAttributeNames();
+ Enumeration<?> attrNameEnum = attrSet.getAttributeNames();
while (attrNameEnum.hasMoreElements())
{
@@ -996,7 +998,7 @@ public class HTMLWriter
private void writeAllAttributes(AttributeSet attrSet)
throws IOException
{
- Enumeration attrNameEnum = attrSet.getAttributeNames();
+ Enumeration<?> attrNameEnum = attrSet.getAttributeNames();
while (attrNameEnum.hasMoreElements())
{
diff --git a/javax/swing/text/html/ImageView.java b/javax/swing/text/html/ImageView.java
index bf906e450..bb6af4f45 100644
--- a/javax/swing/text/html/ImageView.java
+++ b/javax/swing/text/html/ImageView.java
@@ -323,8 +323,6 @@ public class ImageView extends View
*/
public float getPreferredSpan(int axis)
{
- AttributeSet attrs = getAttributes();
-
Image image = getImage();
if (axis == View.X_AXIS)
@@ -522,7 +520,6 @@ public class ImageView extends View
Image newIm = getImage();
if (newIm != null)
{
- AttributeSet atts = getAttributes();
// Fetch width.
Length l = spans[X_AXIS];
if (l != null)
diff --git a/javax/swing/text/html/MinimalHTMLWriter.java b/javax/swing/text/html/MinimalHTMLWriter.java
index acb2c04ac..9f5f019fa 100644
--- a/javax/swing/text/html/MinimalHTMLWriter.java
+++ b/javax/swing/text/html/MinimalHTMLWriter.java
@@ -48,8 +48,9 @@ import javax.swing.text.Style;
import javax.swing.text.StyledDocument;
import java.io.Writer;
import java.io.IOException;
+import java.util.ArrayDeque;
+import java.util.Deque;
import java.util.Enumeration;
-import java.util.Stack;
import java.awt.Color;
/**
@@ -61,7 +62,7 @@ import java.awt.Color;
public class MinimalHTMLWriter extends AbstractWriter
{
private StyledDocument doc;
- private Stack tagStack;
+ private Deque<String> tagStack;
private boolean inFontTag = false;
/**
@@ -73,7 +74,7 @@ public class MinimalHTMLWriter extends AbstractWriter
{
super(w, doc);
this.doc = doc;
- tagStack = new Stack();
+ tagStack = new ArrayDeque<String>();
}
/**
@@ -87,7 +88,7 @@ public class MinimalHTMLWriter extends AbstractWriter
{
super(w, doc, pos, len);
this.doc = doc;
- tagStack = new Stack();
+ tagStack = new ArrayDeque<String>();
}
/**
@@ -315,7 +316,7 @@ public class MinimalHTMLWriter extends AbstractWriter
{
if(doc instanceof DefaultStyledDocument)
{
- Enumeration styles = ((DefaultStyledDocument)doc).getStyleNames();
+ Enumeration<?> styles = ((DefaultStyledDocument)doc).getStyleNames();
while(styles.hasMoreElements())
writeStyle(doc.getStyle((String)styles.nextElement()));
}
@@ -332,7 +333,7 @@ public class MinimalHTMLWriter extends AbstractWriter
*/
protected void writeAttributes(AttributeSet attr) throws IOException
{
- Enumeration attribs = attr.getAttributeNames();
+ Enumeration<?> attribs = attr.getAttributeNames();
while(attribs.hasMoreElements())
{
Object attribName = attribs.nextElement();
@@ -422,8 +423,8 @@ public class MinimalHTMLWriter extends AbstractWriter
*/
private void endOpenTags() throws IOException
{
- while(!tagStack.empty())
- write((String)tagStack.pop());
+ while(tagStack.size() > 0)
+ write(tagStack.pop());
if( inFontTag() )
{
diff --git a/javax/swing/text/html/MultiAttributeSet.java b/javax/swing/text/html/MultiAttributeSet.java
index 0f1145084..296144460 100644
--- a/javax/swing/text/html/MultiAttributeSet.java
+++ b/javax/swing/text/html/MultiAttributeSet.java
@@ -57,7 +57,7 @@ class MultiAttributeSet
* The Enumeration for the multiplexed names.
*/
private class MultiNameEnumeration
- implements Enumeration
+ implements Enumeration<Object>
{
/**
* The index of the current AttributeSet.
@@ -67,7 +67,7 @@ class MultiAttributeSet
/**
* The names Enumeration of the current AttributeSet.
*/
- private Enumeration current;
+ private Enumeration<?> current;
/**
* Creates a new instance.
@@ -147,7 +147,7 @@ class MultiAttributeSet
public boolean containsAttributes(AttributeSet attributes)
{
boolean ret = true;
- Enumeration e = attributes.getAttributeNames();
+ Enumeration<?> e = attributes.getAttributeNames();
while (ret && e.hasMoreElements())
{
Object key = e.nextElement();
@@ -186,7 +186,7 @@ class MultiAttributeSet
return n;
}
- public Enumeration getAttributeNames()
+ public Enumeration<?> getAttributeNames()
{
return new MultiNameEnumeration();
}
diff --git a/javax/swing/text/html/MultiStyle.java b/javax/swing/text/html/MultiStyle.java
index 3937bff75..2f43a19c2 100644
--- a/javax/swing/text/html/MultiStyle.java
+++ b/javax/swing/text/html/MultiStyle.java
@@ -51,7 +51,7 @@ import javax.swing.text.Style;
*
* @author Roman Kennke (kennke@aicas.com)
*/
-public class MultiStyle
+class MultiStyle
extends MultiAttributeSet
implements Style
{
@@ -118,7 +118,7 @@ public class MultiStyle
attributes.removeAttribute(name);
}
- public void removeAttributes(Enumeration names)
+ public void removeAttributes(Enumeration<?> names)
{
attributes.removeAttribute(names);
}
diff --git a/javax/swing/text/html/ObjectView.java b/javax/swing/text/html/ObjectView.java
index d6a77c06a..9d900441b 100644
--- a/javax/swing/text/html/ObjectView.java
+++ b/javax/swing/text/html/ObjectView.java
@@ -88,7 +88,7 @@ public class ObjectView extends ComponentView
String classId = (String) atts.getAttribute("classid");
try
{
- Class objectClass = Class.forName(classId);
+ Class<?> objectClass = Class.forName(classId);
Object instance = objectClass.newInstance();
comp = (Component) instance;
}
diff --git a/javax/swing/text/html/StyleSheet.java b/javax/swing/text/html/StyleSheet.java
index 08578c80f..c4ddddb73 100644
--- a/javax/swing/text/html/StyleSheet.java
+++ b/javax/swing/text/html/StyleSheet.java
@@ -369,7 +369,7 @@ public class StyleSheet extends StyleContext
*
* @return the resolved style
*/
- private Style getResolvedStyle(String selector, List path, HTML.Tag tag)
+ private Style getResolvedStyle(String selector, List<Element> path, HTML.Tag tag)
{
Style style = resolvedStyles.get(selector);
if (style == null)
@@ -380,7 +380,7 @@ public class StyleSheet extends StyleContext
/**
* Resolves a style. This creates arrays that hold the tag names,
* class and id attributes and delegates the work to
- * {@link #resolveStyle(String, String[], Map[])}.
+ * {@link #resolveStyle(String, String[], List<Map<String,String>>)}.
*
* @param selector the selector
* @param path the Element path
@@ -388,14 +388,15 @@ public class StyleSheet extends StyleContext
*
* @return the resolved style
*/
- private Style resolveStyle(String selector, List path, HTML.Tag tag)
+ private Style resolveStyle(String selector, List<Element> path, HTML.Tag tag)
{
int count = path.size();
String[] tags = new String[count];
- Map[] attributes = new Map[count];
+ List<Map<String,String>> attributes =
+ new ArrayList<Map<String,String>>(count);
for (int i = 0; i < count; i++)
{
- Element el = (Element) path.get(i);
+ Element el = path.get(i);
AttributeSet atts = el.getAttributes();
if (i == 0 && el.isLeaf())
{
@@ -413,12 +414,11 @@ public class StyleSheet extends StyleContext
tags[i] = t.toString();
else
tags[i] = null;
- attributes[i] = attributeSetToMap(atts);
+ attributes.set(i, attributeSetToMap(atts));
}
else
{
tags[i] = null;
- attributes[i] = null;
}
}
tags[0] = tag.toString();
@@ -434,7 +434,8 @@ public class StyleSheet extends StyleContext
*
* @return the resolved style
*/
- private Style resolveStyle(String selector, String[] tags, Map[] attributes)
+ private Style resolveStyle(String selector, String[] tags,
+ List<Map<String,String>> attributes)
{
// FIXME: This style resolver is not correct. But it works good enough for
// the default.css.
@@ -462,10 +463,8 @@ public class StyleSheet extends StyleContext
// Sort selectors.
Collections.sort(styles);
- Style[] styleArray = new Style[styles.size()];
- styleArray = (Style[]) styles.toArray(styleArray);
- Style resolved = new MultiStyle(selector,
- (Style[]) styles.toArray(styleArray));
+ Style[] styleArray = styles.toArray(new Style[styles.size()]);
+ Style resolved = new MultiStyle(selector, styleArray);
resolvedStyles.put(selector, resolved);
return resolved;
}
@@ -481,9 +480,9 @@ public class StyleSheet extends StyleContext
public Style getRule(String selector)
{
CSSStyle best = null;
- for (Iterator i = css.iterator(); i.hasNext();)
+ for (Iterator<CSSStyle> i = css.iterator(); i.hasNext();)
{
- CSSStyle style = (CSSStyle) i.next();
+ CSSStyle style = i.next();
if (style.compareTo(best) < 0)
best = style;
}
@@ -584,7 +583,7 @@ public class StyleSheet extends StyleContext
public void addStyleSheet(StyleSheet ss)
{
if (linked == null)
- linked = new ArrayList();
+ linked = new ArrayList<StyleSheet>();
linked.add(ss);
}
@@ -1441,7 +1440,7 @@ public class StyleSheet extends StyleContext
*
* @return the converted map
*/
- private Map attributeSetToMap(AttributeSet atts)
+ private Map<String,String> attributeSetToMap(AttributeSet atts)
{
HashMap<String,String> map = new HashMap<String,String>();
Enumeration<?> keys = atts.getAttributeNames();
diff --git a/javax/swing/text/html/TableView.java b/javax/swing/text/html/TableView.java
index f87d7b35f..912240c28 100644
--- a/javax/swing/text/html/TableView.java
+++ b/javax/swing/text/html/TableView.java
@@ -181,7 +181,6 @@ class TableView
int spans[])
{
updateGrid();
- int numCols = offsets.length;
int realColumn = 0;
int colCount = getViewCount();
for (int i = 0; i < numColumns;)