summaryrefslogtreecommitdiff
path: root/javax/swing/text/html/HTMLEditorKit.java
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2006-12-08 11:25:44 +0000
committerMark Wielaard <mark@klomp.org>2006-12-08 11:25:44 +0000
commitf3778f2f83882ed658901698e8d8723799df0d0d (patch)
tree6b6baf581151786b320eab1ab13c778c515a3210 /javax/swing/text/html/HTMLEditorKit.java
parent51043a0701953cd3469dabeec7757c0251b3f24d (diff)
downloadclasspath-f3778f2f83882ed658901698e8d8723799df0d0d.tar.gz
2006-12-05 Roman Kennke <kennke@aicas.com>
* javax/swing/text/html/ImageView.java (imageUpdate): Use spans field to determine if the CSS width/height are set. Call safePreferenceChanged to protect view structure from threading issues. (spans): Made package private. (ImageView): Initialize loadOnDemand with false. (loadImage): Call Toolkit.prepareImage() to make sure we have our Observer registered. (safePreferenceChanged): New helper method. Calls preferenceChanged in a thread safe environment. 2006-12-05 Roman Kennke <kennke@aicas.com> * NEWS: Add entry about improved HTML support. 2006-12-05 Roman Kennke <kennke@aicas.com> * javax/swing/text/html/ImageView.java (ImageView): Initialize spans array here. (setPropertiesFromAttributes): Moved init of spans array to constructor. 2006-12-05 Roman Kennke <kennke@aicas.com> * javax/swing/text/html/BlockView.java (painter): Made package visible. * javax/swing/text/html/StyleSheet.java (translateBorder): New helper method. (translateHTMLToCSS): Add mappings for border attributes. * javax/swing/text/html/TableView.java Made class subclass of BlockView to get CSS goodness. (CellView.rowSpan): New field. (CellView.setPropertiesFromAttributes): Fetch rowspan. (RowView.overlap): New field. (RowView.rowIndex): New field. (RowView.layoutMajorAxis): Skip overlapping cells. (RowView.layoutMinorAxis): Layout cells that span more than 1 row. (numColumns): New field. (tmpRect): New field. (TableView): Initialize tmpRect. (calculateColumnRequirements): Adjusted and fixed for multirows. (getAlignment): Overridden to center tables. (paint): Overridden to fix clipping. (getStyleSheet): Made protected. (layoutMajorAxis): Invalidate rows. (setPropertiesFromAttributes): Made protected and call super. (updateGrid): Update the overlapping information for multirows. 2006-12-05 Roman Kennke <kennke@aicas.com> * javax/swing/text/html/HTMLEditorKit.java (HTMLFactory.create): Removed debug output. * javax/swing/text/html/InlineView.java (getBreakWeight): Likewise. * javax/swing/text/html/StyleSheet.java (addRule): Likewise. (ListPainter.paint): Removed debug output. 2006-12-06 Roman Kennke <kennke@aicas.com> * javax/swing/text/html/BlockView.java (getAlignment): Align blocks horizontally by the superclass. * javax/swing/text/html/HTMLEditorKit.java (HTMLFactory.create): Replace equals comparison by == for efficiency. Add mapping for misplaced tr, td and th tags. Include object mapping. * javax/swing/text/html/TableView.java (RowView.replace): Invalidate grid early. (gridValid): Initialize with false. (create): Only create RowView and CellView for correctly placed tags. Avoid unnecessary casts. (getAlignment): Removed. (replace): Invalidate grid early. 2006-12-06 Roman Kennke <kennke@aicas.com> * javax/swing/text/html/TableView.java (RowView.layoutMajorAxis): Check column index for invalid value. (updateGrid): Check column index for invalid value. 2006-12-06 Roman Kennke <kennke@aicas.com> * javax/swing/JEditorPane.java (getStream): Buffer the stream for efficiency. (setPage): Don't scroll the view at this point. * javax/swing/plaf/basic/BasicTextUI.java (RootView.paint): Call RootView's setSize to get synchronization. (RootView.setSize): Synchronize to prevent race in layout code. * javax/swing/text/AbstractDocument.java (notifyListeners): New field. (fireChangedUpdate): Track notifyListener field. (fireRemoveUpdate): Track notifyListener field. (fireIndertUpdate): Track notifyListener field. (writeLock): Check notifyListener and throw IllegalStateException. * javax/swing/text/View.java (preferenceChanged): Create local var for better thread safety and more efficiency. 2006-12-06 Roman Kennke <kennke@aicas.com> * examples/gnu/classpath/examples/icons/back.png, * examples/gnu/classpath/examples/icons/reload.png: New icons for the HTML browser. * examples/gnu/classpath/examples/swing/HtmlDemo.java (history): New field. Manages the browsing history. (HtmlDemo): Initialize history. (createContent): Set location and add history. Add toolbar. (createToolBar): New helper method. (main): Make default size bigger. * examples/gnu/classpath/examples/swing/frame1.html, * examples/gnu/classpath/examples/swing/frame2.html, * examples/gnu/classpath/examples/swing/frame3.html, * examples/gnu/classpath/examples/swing/frame4.html, * examples/gnu/classpath/examples/swing/frames.html, * examples/gnu/classpath/examples/swing/tables.html: New example pages. * examples/gnu/classpath/examples/swing/welcome.html Add a couple of links and new test pages. 2006-12-06 Roman Kennke <kennke@aicas.com> * examples/gnu/classpath/examples/swing/Demo.java (getIcon): Made package private. * examples/gnu/classpath/examples/swing/HtmlDemo.java (hyperlinkUpdate): Convert URL to string. 2006-12-06 Roman Kennke <kennke@aicas.com> * javax/swing/text/DefaultCaret.java (appear): Adjust visibility here. (setDotImpl): Don't adjust visibility here. (moveDotImpl): Don't adjust visibility here. 2006-12-06 Roman Kennke <kennke@aicas.com> * javax/swing/text/html/FormView.java (SubmitThread.postData): Implemented. (SubmitThread.run): Pass data to postData(). (actionPerformed): Reset form when reset button is activated. (createComponent): Add support for select lists and comboboxes. Don't set value of text and password fields here, this is done now in HTMLDocument for consistency. (getElementFormData): Add support for fetching form data from select lists and comboboxes as well as textareas. (getSelectData): New helper method. Fetches form data from select boxes. (getTextAreaData): New helper method. Fetches form data from textareas. (resetForm): New helper method. Resets the entire form. * javax/swing/text/html/HTMLDocument.java (HTMLReader.FormAction.end): Handle SELECT and OPTION tags. (HTMLReader.FormAction.start): Handle SELECT and OPTION tags. (HTMLReader.FormAction.setModel): Initialize text and password values here. Also, use the resetable special models. Group radio buttons into ButtonGroup for exclusive selection. (HTMLReader.FormTagAction): New class. Handles FORM tags. (HTMLReader.buttonGroups): New field. (HTMLReader.numOptions): New field. (HTMLReader.option): New field. (HTMLReader.selectModel): New field. (HTMLReader.textAreaDocument): Make ResetablePlainDocument. (HTMLReader.handleText): Handle OPTION text. (HTMLReader.initTags): Map FORM tags to FormTagAction. (HTMLReader.textAreaContent): Set initial content. * javax/swing/text/html/Option.java (Option): Make copy of attribute set. Initialize selected state. (getValue): Fetch value from attribute set. * javax/swing/text/html/ResetableModel.java: New interface. * javax/swing/text/html/ResetablePlainDocument.java: New class. Supports resetting the state. * javax/swing/text/html/ResetableToggleButtonModel.java: Likewise. * javax/swing/text/html/SelectComboBoxModel.java: Likewise. * javax/swing/text/html/SelectListModel.java: Likewise. 2006-12-06 Roman Kennke <kennke@aicas.com> * examples/gnu/classpath/examples/swing/BrowserEditorKit.java: New class. * examples/gnu/classpath/examples/swing/HtmlDemo.java (LoadActionListener): Call setPage() helper method. (createContent): Register tweaked editor kit. For FormSubmitEvents call submitForm(), otherwise setPage(). (postData): Helper method for posting form data. (setPage): Helper method for navigating to a new URL. (submitForm): Helper method for submitting a form. * examples/gnu/classpath/examples/swing/forms.html: Added text/password fields and select boxes. * examples/gnu/classpath/examples/swing/welcome.html: Fixed typo. 2006-12-07 Mark Wielaard <mark@klomp.org> * java/net/URL.java (URL(URL,String,URLStreamHandler,boolean)): New private constructor. (URL(URL,String,URLStreamHandler)): Call new constructor. (URL(URL,String)): Likewise. (URL(String)): Likewise. 2006-12-07 Mark Wielaard <mark@klomp.org> * javax/swing/JEditorPane.java (createEditorKitForContentType): Always load from system class loader.
Diffstat (limited to 'javax/swing/text/html/HTMLEditorKit.java')
-rw-r--r--javax/swing/text/html/HTMLEditorKit.java60
1 files changed, 32 insertions, 28 deletions
diff --git a/javax/swing/text/html/HTMLEditorKit.java b/javax/swing/text/html/HTMLEditorKit.java
index 3b122bb36..0ede1c74e 100644
--- a/javax/swing/text/html/HTMLEditorKit.java
+++ b/javax/swing/text/html/HTMLEditorKit.java
@@ -792,52 +792,56 @@ public class HTMLEditorKit
{
HTML.Tag tag = (HTML.Tag) attr;
- if (tag.equals(HTML.Tag.IMPLIED) || tag.equals(HTML.Tag.P)
- || tag.equals(HTML.Tag.H1) || tag.equals(HTML.Tag.H2)
- || tag.equals(HTML.Tag.H3) || tag.equals(HTML.Tag.H4)
- || tag.equals(HTML.Tag.H5) || tag.equals(HTML.Tag.H6)
- || tag.equals(HTML.Tag.DT))
+ if (tag == HTML.Tag.IMPLIED || tag == HTML.Tag.P
+ || tag == HTML.Tag.H1 || tag == HTML.Tag.H2
+ || tag == HTML.Tag.H3 || tag == HTML.Tag.H4
+ || tag == HTML.Tag.H5 || tag == HTML.Tag.H6
+ || tag == HTML.Tag.DT)
view = new ParagraphView(element);
- else if (tag.equals(HTML.Tag.LI) || tag.equals(HTML.Tag.DL)
- || tag.equals(HTML.Tag.DD) || tag.equals(HTML.Tag.BODY)
- || tag.equals(HTML.Tag.HTML) || tag.equals(HTML.Tag.CENTER)
- || tag.equals(HTML.Tag.DIV)
- || tag.equals(HTML.Tag.BLOCKQUOTE)
- || tag.equals(HTML.Tag.PRE)
- || tag.equals(HTML.Tag.FORM))
+ else if (tag == HTML.Tag.LI || tag == HTML.Tag.DL
+ || tag == HTML.Tag.DD || tag == HTML.Tag.BODY
+ || tag == HTML.Tag.HTML || tag == HTML.Tag.CENTER
+ || tag == HTML.Tag.DIV
+ || tag == HTML.Tag.BLOCKQUOTE
+ || tag == HTML.Tag.PRE
+ || tag == HTML.Tag.FORM
+ // Misplaced TD and TH tags get mapped as vertical block.
+ // Note that correctly placed tags get mapped in TableView.
+ || tag == HTML.Tag.TD || tag == HTML.Tag.TH)
view = new BlockView(element, View.Y_AXIS);
- else if (tag.equals(HTML.Tag.IMG))
+ else if (tag == HTML.Tag.TR)
+ // Misplaced TR tags get mapped as horizontal blocks.
+ // Note that correctly placed tags get mapped in TableView.
+ view = new BlockView(element, View.X_AXIS);
+ else if (tag == HTML.Tag.IMG)
view = new ImageView(element);
- else if (tag.equals(HTML.Tag.CONTENT))
+ else if (tag == HTML.Tag.CONTENT)
view = new InlineView(element);
else if (tag == HTML.Tag.HEAD)
view = new NullView(element);
- else if (tag.equals(HTML.Tag.TABLE))
+ else if (tag == HTML.Tag.TABLE)
view = new javax.swing.text.html.TableView(element);
- else if (tag.equals(HTML.Tag.HR))
+ else if (tag == HTML.Tag.HR)
view = new HRuleView(element);
- else if (tag.equals(HTML.Tag.BR))
+ else if (tag == HTML.Tag.BR)
view = new BRView(element);
- else if (tag.equals(HTML.Tag.INPUT) || tag.equals(HTML.Tag.SELECT)
- || tag.equals(HTML.Tag.TEXTAREA))
+ else if (tag == HTML.Tag.INPUT || tag == HTML.Tag.SELECT
+ || tag == HTML.Tag.TEXTAREA)
view = new FormView(element);
- else if (tag.equals(HTML.Tag.MENU) || tag.equals(HTML.Tag.DIR)
- || tag.equals(HTML.Tag.UL) || tag.equals(HTML.Tag.OL))
+ else if (tag == HTML.Tag.MENU || tag == HTML.Tag.DIR
+ || tag == HTML.Tag.UL || tag == HTML.Tag.OL)
view = new ListView(element);
- else if (tag.equals(HTML.Tag.FRAMESET))
+ else if (tag == HTML.Tag.FRAMESET)
view = new FrameSetView(element);
- else if (tag.equals(HTML.Tag.FRAME))
+ else if (tag == HTML.Tag.FRAME)
view = new FrameView(element);
- // FIXME: Uncomment when the views have been implemented
- /*
- else if (tag.equals(HTML.Tag.OBJECT))
- view = new ObjectView(element); */
+ else if (tag == HTML.Tag.OBJECT)
+ view = new ObjectView(element);
}
if (view == null)
{
- System.err.println("missing tag->view mapping for: " + element);
view = new NullView(element);
}
return view;