|
Generated by JDiff |
||||||||
PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES |
This file contains all the changes in documentation in the packagejavax.swing.text.html
as colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.
A view implementation to display a block (as a box) with CSS specifications. @author Timothy Prinzing @version 1.Class BlockView, void setParent(View)17 0425 02/2202/9900
SetsEstablishes the parentofviewthefor this view. This isreimplementedguaranteed toprovide thebesuperclass behavior as well as callingcalled before any other methods if theloadChildren method if thisparent viewdoes not alreadyishave childrenfunctioning properly.The
children should not be loaded inThis is implemented to forward to theconstructor becausesuperclassthe act of settingas well as call theparent may cause them tosetPropertiesFromAttributestrymethod tosearch upset thehierarchyparagraph(topropertiesgetfrom thehostingcssContainer for example)attributes.If this view has children (theTheviewcall isbeingmademoved from one place inat this time to ensure theview hierarchyability toanother) theresolveloadChildrenupwardmethod will not be calledthrough the parents view attributes. @param parent the new parentofor null if the viewnull ifis beingnoneremoved from a parent it was previously added to
Defines a set of CSS attributes as a typesafe enumeration. ThehtmlHTML View implementations usecssCSS attributes to determine how they will render. This also defines methods to map between CSS/HTML/StyleConstants. Any shorthand properties such as font are mapped to the intrinsic properties.The following describes the CSS properties that are suppored by the rendering engine:
The following are modeled but currently not rendered.
- font-family
- font-style
- font-size (supports relative units)
- font-weight
- font
- color
- background-color (with the exception of transparent)
- background-image
- background-repeat
- background-position
- background
- background-repeat
- text-decoration (with the exception of blink and overline)
- vertical-align (only sup and super)
- text-align (justify is treated as center)
- margin-top
- margin-right
- margin-bottom
- margin-left
- margin
- padding-top
- padding-right
- padding-bottom
- padding-left
- border-style (only supports inset outset and none)
- list-style-type
- list-style-position
- font-variant
- background-attachment (background always treated as scroll)
- word-spacing
- letter-spacing
- text-indent
- text-transform
- line-height
- border-top-width (this is used to indicate if a border should be used)
- border-right-width
- border-bottom-width
- border-left-width
- border-width
- border-top
- border-right
- border-bottom
- border-left
- border
- width
- height
- float
- clear
- display
- white-space
- list-style
Note: for the time being we do not fully support relative units unless noted so that p { margin-top: 10% } will be treated as if no margin-top was specified.
@author Timothy Prinzing @author Scott Violet @version 1.13 0430 02/2202/9900 @see StyleSheet
Definitions to be used as a key on AttributeSet's that might holdClass CSS.Attribute, String toString()cssCSS attributes. Since this is a closed set (i.e. defined exactly by the specification) it is final and cannot be extended.
The string representation of the attribute. This should exactly match the string specified in thecssCSS specification.
Translate a string to a CSS.Attribute object. This will return null if there is no attribute by the given name. @param name the name of thecssCSS attribute to fetch the typesafe enumeration for. @returns the CSS.Attribute object or null if the string doesn't represent a valid attribute key.
Component decorator that implements the view interface for form elements <input> <textarea> and <select>. The model for the component is stored as an attribute of the the element (using StyleConstants.ModelAttribute) and is used to build the component of the view. The type of the model is assumed to of the type that would be set byClass FormView, void imageSubmit(String)HTMLDocument.HTMLReader.FormAction
. If there are multiple views mapped over the document they will share the embedded component models.The
components produced get their opaque property set to false. Thefollowing table shows what components get built by this view.@author Timothy Prinzing @author Sunita Mani @version 1.
Element Type Component built input type button JButton input type checkbox JCheckBox input type image JButton input type password JPasswordField input type radio JRadioButton input type reset JButton input type submit JButton input type text JTextField select size > 1 or multiple attribute defined JList in a JScrollPane select size unspecified or 1 JComboBox textarea JTextArea in a JScrollPane 6 1114 02/1902/9800
This method is called to submit a form in response to a click on an imageClass FormView, String SUBMIT.i.e-- an <INPUT> form element of type "image". @param the mouse click coordinates.
If a value attribute is not specified for a FORM input element of type "submit"or "reset"thenthesethis defaultstringsstringareis used. @deprecated As of 1.3 value now comes from UIManager property FormView.submitButtonText
Constants used in the HTMLDocument. These are basically tag and attribute definitions. @author Timothy Prinzing @author Sunita Mani @version 1.26 0431 02/2202/9900
A document that modelshtmlHTML. The purpose of this model is to support both browsing and editing. As a result the structure described by anhtmlHTML document is not exactly replicated by default. The element structure that is modeled by default is built by the classHTMLDocument.HTMLReader
which implements theHTMLEditorKit.ParserCallback
protocol that the parser expects. To change the structure one can subclass HTMLReader and reimplement the methodgetReader
to return the new reader implementation. The documentation for HTMLReader should be consulted for the details of the default structure created. The intent is that the document be non-lossy (although reproducing thehtmlHTML format may result in a different format).The document models only
htmlHTML and makes no attempt to store view attributes in it. The elements are identified by theStyleContext.NameAttribute
attribute which should always have a value of typeHTML.Tag
that identifies the kind of element. Some of the elementsare(such as comments) are synthesized. The HTMLFactory uses this attribute to determine what kind of view to build.This document supports incremental loading. The
TokenThreshold
property controls how much of the parse is buffered before trying to update the element structure of the document. This property is set by the EditorKit so that subclasses can disable it.The
Base
property determines the URL against which relativeURL'sURLs are resolvedagainst. By default this will be theDocument.StreamDescriptionProperty
if the value of the property is a URL. If a <baseBASE> tag is encountered the base will become the URL specified by that tag. Because the base URL is a property it can of course be set directly.The default content storage mechanism for this document is a gap buffer (GapContent). Alternatives can be supplied by using the constructor that takes a Content implementation. @author Timothy Prinzing @author Scott Violet @author Sunita Mani @version 1.
115 04133 02/2202/9900
An element that represents aClass HTMLDocument.BlockElement, constructor HTMLDocument.BlockElement(HTMLDocument, Element, AttributeSet)structualstructural block ofhtmlHTML.
Constructs a composite element that initially contains no children. @param parentThethe parent element @param a the attributes for the element
AnhtmlHTML reader to load anhtmlHTML document with anhtmlHTML element structure. This is a set of callbacks from the parser implemented to create a set of elements tagged with attributes. The parse builds up tokens (ElementSpec) that describe the element subtree desired and burst it into the document under the protection of a write lock using the insert method on the document outer class.The reader can be configured by registering actions (of type
HTMLDocument.HTMLReader.TagAction
) that describe how to handle the action. The idea behind the actions provided is that the most natural text editing operations can be provided if the element structure boils down to paragraphs with runs of some kind of style in them. Some things are more naturally specified structurally so arbitrary structure should be allowed above the paragraphs but will need to be edited with structural actions. Theimplecationimplication of this is that some of thehtmlHTML elements specified in the stream being parsed will be collapsed into attributes and in some cases paragraphs will be synthesized. WhenhtmlHTML elements have been converted to attributes the attribute key will be of type HTML.Tag and the value will be of type AttributeSet so that no information is lost. This enables many of the existing actions to work so that the user can type input hit the return key backspace delete etc and have a reasonable result. Selections can be created and attributes applied or removed etc. With this in mind the work done by the reader can be categorized into the following kinds of tasks:
- Block
- Build the structure like it's specified in the stream. This produces elements that contain other elements.
- Paragraph
- Like block except that it's expected that the element will be used with a paragraph view so a paragraph element won't need to be synthesized.
- Character
- Contribute the element as an attribute that will start and stop at arbitrary text locations. This will ultimately be mixed into a run of text with all of the currently flattened
htmlHTML character elements.- Special
- Produce an embedded graphical element.
- Form
- Produce an element that is like the embedded graphical element except that it also has a component model associated with it.
- Hidden
- Create an element that is hidden from view when the document is being viewed read-only and visible when the document is being edited. This is useful to keep the model from losing information and used to store things like comments and unrecognized tags.
Currently <APPLET> <PARAM> <MAP> <AREA> <LINK> <SCRIPT> and <STYLE> are unsupported.
The assignment of the actions described is shown in the following table for the tags defined in
HTML.Tag
.
HTML.Tag.A
CharacterAction HTML.Tag.ADDRESS
CharacterAction HTML.Tag.APPLET
HiddenAction HTML.Tag.AREA
AreaAction HTML.Tag.B
CharacterAction HTML.Tag.BASE
BaseAction HTML.Tag.BASEFONT
CharacterAction HTML.Tag.BIG
CharacterAction HTML.Tag.BLOCKQUOTE
BlockAction HTML.Tag.BODY
BlockAction HTML.Tag.BR
SpecialAction HTML.Tag.CAPTION
BlockAction HTML.Tag.CENTER
BlockAction HTML.Tag.CITE
CharacterAction HTML.Tag.CODE
CharacterAction HTML.Tag.DD
BlockAction HTML.Tag.DFN
CharacterAction HTML.Tag.DIR
BlockAction HTML.Tag.DIV
BlockAction HTML.Tag.DL
BlockAction HTML.Tag.DT
ParagraphAction HTML.Tag.EM
CharacterAction HTML.Tag.FONT
CharacterAction HTML.Tag.FORM
CharacterAction HTML.Tag.FRAME
SpecialAction HTML.Tag.FRAMESET
BlockAction HTML.Tag.H1
ParagraphAction HTML.Tag.H2
ParagraphAction HTML.Tag.H3
ParagraphAction HTML.Tag.H4
ParagraphAction HTML.Tag.H5
ParagraphAction HTML.Tag.H6
ParagraphAction HTML.Tag.HEAD
HeadAction HTML.Tag.HR
SpecialAction HTML.Tag.HTML
BlockAction HTML.Tag.I
CharacterAction HTML.Tag.IMG
SpecialAction HTML.Tag.INPUT
FormAction HTML.Tag.ISINDEX
IsndexAction HTML.Tag.KBD
CharacterAction HTML.Tag.LI
BlockAction HTML.Tag.LINK
LinkAction HTML.Tag.MAP
MapAction HTML.Tag.MENU
BlockAction HTML.Tag.META
MetaAction HTML.Tag.NOFRAMES
BlockAction HTML.Tag.OBJECT
SpecialAction HTML.Tag.OL
BlockAction HTML.Tag.OPTION
FormAction HTML.Tag.P
ParagraphAction HTML.Tag.PARAM
HiddenAction HTML.Tag.PRE
PreAction HTML.Tag.SAMP
CharacterAction HTML.Tag.SCRIPT
HiddenAction HTML.Tag.SELECT
FormAction HTML.Tag.SMALL
CharacterAction HTML.Tag.STRIKE
CharacterAction HTML.Tag.S
CharacterAction HTML.Tag.STRONG
CharacterAction HTML.Tag.STYLE
StyleAction HTML.Tag.SUB
CharacterAction HTML.Tag.SUP
CharacterAction HTML.Tag.TABLE
BlockAction HTML.Tag.TD
BlockAction HTML.Tag.TEXTAREA
FormAction HTML.Tag.TH
BlockAction HTML.Tag.TITLE
TitleAction HTML.Tag.TR
BlockAction HTML.Tag.TT
CharacterAction HTML.Tag.U
CharacterAction HTML.Tag.UL
BlockAction HTML.Tag.VAR
CharacterAction
Action to support forms by building all of the elements used to represent form controls. This will process the <inputINPUT> <textareaTEXTAREA> <selectSELECT> and <optionOPTION> tags. The element created by this action is expected to have the attributeStyleConstants.ModelAttribute
set to the model that holds the state for the form control. This enables multiple views and allows document to be iterated over picking up the data of the form. The following are the model assignments for the various type of form elements.
Element Type Model Type input type button DefaultButtonModel input type checkbox JToggleButton.ToggleButtonModel input type image DefaultButtonModel input type password PlainDocument input type radio JToggleButton.ToggleButtonModel input type reset DefaultButtonModel input type submit DefaultButtonModel input type text or type is null. PlainDocument select OptionComboBoxModel or an OptionListBoxModel with an item type of Option textarea TextAreaDocument
This is anAn action to be performed in response to parsing a tag. This allows customization of how each tag is handled and avoids a large switch statement.
Class HTMLDocument.HTMLReader, void addContent(char[], int, int, boolean)AddAdds some text with the current character attributes. @param embedded the attributes of an embedded object.
Class HTMLDocument.HTMLReader, void addSpecialElement(Tag, MutableAttributeSet)AddAdds some text with the current character attributes. @param embedded the attributes of an embedded object.
Class HTMLDocument.HTMLReader, void blockClose(Tag)AddAdds content that is basically specified entirely in the attribute set.
Class HTMLDocument.HTMLReader, void blockOpen(Tag, MutableAttributeSet)AddAdds an instruction to the parse buffer to close out a block element of the given type.
Class HTMLDocument.HTMLReader, void flush()AddAdds an instruction to the parse buffer to create a block element with the given attributes.
Class HTMLDocument.HTMLReader, void popCharacterStyle()ThisTheis thelast method called on the reader. It allows any pending changes to be flushed into the document. Since this is currently loading synchronously the entire set of changes are pushed in at this point.
Class HTMLDocument.HTMLReader, void preContent(char[])PopPops a previously pushed character style off the stack to return to a previous style.
Class HTMLDocument.HTMLReader, void pushCharacterStyle()AddAdds the given content that was encountered in a PRE element. This synthesizes lines to hold the runs of text and makes calls to addContent to actually add the text.
Class HTMLDocument.HTMLReader, void registerTag(Tag, TagAction)PushPushes the current character style on a stack in preparation for forming a new nested character style.
Class HTMLDocument.HTMLReader, void textAreaContent(char[])RegisterRegisters a handler for the given tag. By default all of the well-known tags will have been registered. This can be used to change the handling of a particular tag or to add support for custom tags.
AddAdds the given content to the textarea document. This method gets called when we are in a textarea context. Therefore all text that is seen belongs to the text area and is hence added to the TextAreaDocument associated with the text area.
An iterator to iterate over a particular type of tag. The iterator is not thread safe. If reliable access to the document is not already ensured by the context under which the iterator is being usedit'sits use should be performed under the protection of Document.render.
An element that represents a chunk of text that has a set ofClass HTMLDocument.RunElement, constructor HTMLDocument.RunElement(HTMLDocument, Element, AttributeSet, int, int)htmlHTML character level attributes assigned to it.
Constructs an element that represents content within the document (has no children). @param parentThethe parent element @param aThethe element attributes @param offs0Thethe start offset=(must be at least 0) @param offs1Thethe end offset=(must be at least offs0)
Constructs anClass HTMLDocument, constructor HTMLDocument(Content, StyleSheet)htmlHTML document.
Constructs anClass HTMLDocument, constructor HTMLDocument(StyleSheet)htmlHTML document with the given content storage implementation and the given style/attribute storage mechanism. @param c the container for the content @param styles the styles
Constructs anClass HTMLDocument, Element createLeafElement(Element, AttributeSet, int, int)htmlHTML document with the default content storage implementation and the given style/attribute storage mechanism. @param styles the styles
Creates a document leaf element that directly represents text (doesn't have any children). This is implemented to return an element of typeClass HTMLDocument, URL getBase()HTMLDocument.RunElement
. @param parent the parent element @param a the attributes for the element @param p0 the beginning of the range=(must be at least 0) @param p1 the end of the range=(must be at least p0) @return the new element
Class HTMLDocument, Iterator getIterator(Tag)GetGets the location to resolve relativeurl'sURLs against. By default this will be thedocumentsdocument'surlURL if the document was loaded from aurlURL. If a base tag is found and can be parsed it will be used as the base location.
Class HTMLDocument, ParserCallback getReader(int)FetchFetches an iterator for the following kind ofhtmlHTML tag. This can be used for things like iterating over the set of anchors contained iterating over the input elements etc.
Class HTMLDocument, ParserCallback getReader(int, int, int, Tag)FetchFetches the reader for the parser to use to load the document withhtmlHTML. This is implemented to return an instance of HTMLDocument.HTMLReader. Subclasses can reimplement this method to change how the document get structured if desired (e.g. to handle custom tags structurally represent character style elements etc.).
Class HTMLDocument, StyleSheet getStyleSheet()FetchFetches the reader for the parser to use to load the document withhtmlHTML. This is implemented to return an instance of HTMLDocument.HTMLReader. Subclasses can reimplement this method to change how the document get structured if desired (e.g. to handle custom tags structurally represent character style elements etc.). @param popDepth the number of ElementSpec.EndTagTypeEndTagTypes to generate before inserting.@param pushDepth the number of ElementSpec.StartTagTypeStartTagTypes with a direction of ElementSpec.JoinNextDirection that should be generated before inserting but after the end tags have been generated.@param insertTag the first tag to start inserting into document.
Class HTMLDocument, int getTokenThreshold()FetchFetches the StyleSheet with the document-specific display rules (CSS) that were specified in thehtmlHTML document itself.
Class HTMLDocument, void insert(int, ElementSpec[])GetGets the number of tokens to buffer before trying to update the documents element structure. By default this will beInteger.MAX_VALUE
.
Inserts new elements in bulk. This is how elements get created in the document. The parsing determines what structure is needed and creates the specification as a set of tokens that describe the edit while leaving the document free of a write-lock. This method can then be called in bursts by the reader to acquire a write-lock for a shorter duration (i.e. while the document is actually being altered). @param offset the starting offset @param data the element data @exception BadLocationExceptionClass HTMLDocument, void processHTMLFrameHyperlinkEvent(HTMLFrameHyperlinkEvent)for an invalid starting offset @see StyledDocument#insert @exception BadLocationExceptionif the given position does not represent a valid location in the associated document.
Class HTMLDocument, void setBase(URL)ThisProcessesmethod is responsible for processing HyperlinkEvent'sHyperlinkEvents that are generated by documents in an HTML frame. The HyperlinkEvent type as the parameter suggests is HTMLFrameHyperlinkEvent. In addition to the typical information contained in a HyperlinkEvent this event contains the element that corresponds to the frame in which the click happened (i.e.the source element) and the target name. The target name has 4 possible values:1)_self
If target is _self the action is to change the value of the HTML.Attribute.SRC attribute and fires a ChangedUpdate event. If the target is _parent then it deletes the parent element which is a <FRAMESET> element and inserts a new <FRAME> element and sets its HTML.Attribute.SRC attribute to have a value equal to the destination2)- _parent
3)- _top
4)- a named frame
urlURL and fireana RemovedUpdate and InsertUpdate. If the target is _top this method does nothing. In the implementation of the view for a frame namely the FrameView the processing of _top is handled. Given that _top implies replacing the entire document it made sense to handle this outside of the document that it will replace. If the target is a named frame then the element hierarchy is searched for an element with a name equal to the target its HTML.Attribute.SRC attribute is updated and a ChangedUpdate event is fired. @paramHTMLFrameHyperLinkEvente the event
Class HTMLDocument, void setParagraphAttributes(int, int, AttributeSet, boolean)SetSets the location to resolve relativeurl'sURLs against. By default this will be thedocumentsdocument'surlURL if the document was loaded from aurlURL. If a base tag is found and can be parsed it will be used as the base location.This also sets the base of the StyleSheet to be
u
as well as the receiver.
Sets attributes for a paragraph.Class HTMLDocument, void setTokenThreshold(int)This method is thread safe although most Swing methods are not. Please see Threads and Swing for more information. @param offset the offset into the paragraph
=(must be at least 0) @param length the number of characters affected=(must be at least 0) @param s the attributes @param replace whether to replace existing attributes or merge them
SetSets the number of tokens to buffer before trying to update the documents element structure.
The Swing JEditorPane text component supports different kinds of content via a plug-in mechanism called an EditorKit. Because HTML is a very popular format of content some support is provided by default. The default support is provided by this class which supports HTML version 3.2 (with some extensions) and is migrating toward version 4.0. The <applet> tag is not supported but some support is provided for the <object> tag.There are several goals of the HTML EditorKit provided that have an effect upon the way that
htmlHTML is modeled. These have influenced its design in a substantial way.@author Timothy Prinzing @version 1.
- Support editing
- It might seem fairly obvious that a plug-in for JEditorPane should provide editing support but that fact has several design considerations. There are a substantial number of
htmlHTML documents that don't properly conform to anhtmlHTML specification. These must be normalized somewhat into a correct form if one is to edit them. Additionally users don't like to be presented with an excessive amount of structure editing so using traditional text editing gestures is preferred over using thehtmlHTML structure exactly as defined in thehtmlHTML document.The modeling of
htmlHTML is provided by the classHTMLDocument
.It'sIts documention describes the details of how thehtmlHTML is modeled. The editing support leverages heavily off of the text package.
- Extendable/Scalable
- To maximize the usefulness of this kit a great deal of effort has gone into making it extendable. These are some of the features.
- The parser is replacable. The default parser is the Hot Java parser which is DTD based. A different DTD can be used or an entirely different parser can be used. To change the parser reimplement the getParser method. The default parser is dynamically loaded when first asked for so the class files will never be loaded if an alternative parser is used. The default parser is in a seperate package called parser below this package.
- The parser drives the ParserCallback which is provided by HTMLDocument. To change the callback subclass HTMLDocument and reimplement the createDefaultDocument method to return document that produces a different reader. The reader controls how the document is structured. Although the Document provides HTML support by default there is nothing preventing support of non-
htmlHTML tags that result in alternative element structures.- The default view of the models are provided as a hierarchy of View implementations so one can easily customize how a particular element is displayed or add capabilities for new kinds of elements by providing new View implementations. The default set of views are provided by the
HTMLFactory
class. This can be easily changed by subclassing or replacing the HTMLFactory and reimplementing the getViewFactory method to return the alternative factory.- The View implementations work primarily off of CSS attributes which are kept in the views. This makes it possible to have multiple views mapped over the same model that appear substantially different. This can be especially useful for printing. For most
htmlHTML attributes thehtmlHTML attributes are converted tocssCSS attributes for display. This helps make the View implementations more general purpose
- Asynchronous Loading
- Larger documents involve a lot of parsing and take some time to load. By default this kit produces documents that will be loaded asynchronously if loaded using
JEditorPane.setPage
. This is controlled by a property on the document. The method createDefaultDocument can be overriden to change this. The batching of work is done by theHTMLDocument.HTMLReader
class. The actual work is done by theDefaultStyledDocument
andAbstractDocument
classes in the text package.
- Customization from current LAF
- HTML provides a well known set of features without exactly specifying the display characteristics. Swing has a theme mechanism for its look-and-feel implementations. It is desirable for the look-and-feel to feed display characteristics into the HTML views. An user with poor vision for example would want high contrast and larger than typical fonts.
The support for this is provided by the
StyleSheet
class. The presentation of the HTML can be heavily influenced by the setting of the StyleSheet property on the EditorKit.
- Not lossy
- An EditorKit has the ability to be read and save documents. It is generally the most pleasing to users if there is no loss of data between the two operation. The policy of the HTMLEditorKit will be to store things not recognized or not necessarily visible so they can be subsequently written out. The model of the
htmlHTML document should therefore contain all information discovered while reading the document. This is constrained in some ways by the need to support editing (i.e. incorrect documents sometimes must be normalized). The guiding principle is that information shouldn't be lost but some might be synthesized to produce a more correct model or it might be rearranged.81 0999 01/2721/0001
A factory to build views forhtmlHTML. The following table describes what this factory will build by default.
Tag View created HTML.Tag.CONTENT InlineView HTML.Tag.IMPLIED javax.swing.text.html.ParagraphView HTML.Tag.P javax.swing.text.html.ParagraphView HTML.Tag.H1 javax.swing.text.html.ParagraphView HTML.Tag.H2 javax.swing.text.html.ParagraphView HTML.Tag.H3 javax.swing.text.html.ParagraphView HTML.Tag.H4 javax.swing.text.html.ParagraphView HTML.Tag.H5 javax.swing.text.html.ParagraphView HTML.Tag.H6 javax.swing.text.html.ParagraphView HTML.Tag.DT javax.swing.text.html.ParagraphView HTML.Tag.MENU ListView HTML.Tag.DIR ListView HTML.Tag.UL ListView HTML.Tag.OL ListView HTML.Tag.LI BlockView HTML.Tag.DL BlockView HTML.Tag.DD BlockView HTML.Tag.BODY BlockView HTML.Tag.HTML BlockView HTML.Tag.CENTER BlockView HTML.Tag.DIV BlockView HTML.Tag.BLOCKQUOTE BlockView HTML.Tag.PRE BlockView HTML.Tag.BLOCKQUOTE BlockView HTML.Tag.PRE BlockView HTML.Tag.IMG ImageView HTML.Tag.HR HRuleView HTML.Tag.BR BRView HTML.Tag.TABLE javax.swing.text.html.TableView HTML.Tag.INPUT FormView HTML.Tag.SELECT FormView HTML.Tag.TEXTAREA FormView HTML.Tag.OBJECT ObjectView HTML.Tag.FRAMESET FrameSetView HTML.Tag.FRAME FrameView
InsertHTMLTextAction can be used to insert an arbitrary string of HTML into an existing HTML document. At least two HTML.Tags need to be supplied. The first Tag parentTag identifies the parent in the document to add the elements to. The second tag addTag identifies the first tag that should be added to the document as seen in the HTML string. One important thing to remember is that the parser is going to generate all the appropriate tags even if they aren't in the HTML string passed in.Class HTMLEditorKit.InsertHTMLTextAction, void actionPerformed(ActionEvent)For example lets say you wanted to create an action to insert a table into the body. The parentTag would be HTML.Tag.BODY addTag would be HTML.Tag.TABLE and the string could be something like <table><tr><td></td></tr></table>.
There is also an option to supply an alternate parentTag and addTag. These will be checked for if there is no parentTag at offset.
Inserts theClass HTMLEditorKit.InsertHTMLTextAction, void insertAtBoundry(JEditorPane, HTMLDocument, int, Element, String, Tag, Tag)htmlHTML into the document. @parameae the event
This is invoked when inserting at aboundryboundary. It determines the number of pops and then the number of pushes that need to be performed and then invokes insertHTML. @deprecated As of Java 2 platform v1.3 use insertAtBoundary
The result of parsing drives these callback methods. The open and close actions should be balanced. Theflush
method will be the last method called to give the receiver a chance to flush any pending data into the document.Refer to DocumentParser the default parser used for further information on the contents of the AttributeSets the positions and other info. @see javax.swing.text.html.parser.DocumentParser
Fetch the parser to use for readingClass HTMLEditorKit, StyleSheet getStyleSheet()htmlHTML streams. This can be reimplemented to provide a different parser. The default implementation is loaded dynamically to avoid the overhead of loading the default parser if it's not used. The default parser is the HotJava parser using anhtmlHTML 3.2dtdDTD.
Get the set of styles currently being used to render theClass HTMLEditorKit, void insertHTML(HTMLDocument, int, String, int, int, Tag)htmlHTML elements. By default the resource specified by DEFAULT_CSS gets loaded and is shared by all HTMLEditorKit instances.
Inserts HTML into an existing document. @param docClass HTMLEditorKit, void read(Reader, Document, int)Documentthe document to insert into.@param offset the offset to insert HTML at @param popDepth the number of ElementSpec.EndTagTypeEndTagTypes to generate before inserting.@param pushDepth the number of ElementSpec.StartTagTypeStartTagTypes with a direction of ElementSpec.JoinNextDirection that should be generated before inserting but after the end tags have been generated.@param insertTag the first tag to start inserting into document.@exception RuntimeException (will eventually be a BadLocationException) if pos is invalid.
Inserts content from the given stream. IfClass HTMLEditorKit, void setStyleSheet(StyleSheet)doc
is an instance of HTMLDocument this will readhtmlHTML 3.2 text. InsertinghtmlHTML into a non-empty document must be inside the body Element if you do not insert into the body an exception will be thrown. When inserting into a non-empty document all tags outside of the body (head title) will be dropped. @param inThethe stream to read from @param docThethe destination for the insertion.@param posThethe location in the document to place the content.@exception IOException on any I/O error @exception BadLocationException if pos represents an invalid location within the document.@exception RuntimeException (will eventually be a BadLocationException) if pos is invalid.
Set the set of styles to be used to render the variousClass HTMLEditorKit, void write(Writer, Document, int, int)htmlHTML elements. These styles are specified in terms ofcssCSS specifications. Each document produced by the kit will have a copy of the sheet which it can add the document specific styles to. By default the StyleSheet specified is shared by all HTMLEditorKit instances. This should be reimplemented to provide a finer granularity if desired.
Write content from a document to the given stream in a format appropriate for this kind of content handler. @param outThethe stream to write to @param docThethe source for the write.@param posThethe location in the document to fetch the content.@param lenThethe amount to write out.@exception IOException on any I/O error @exception BadLocationException if pos represents an invalid location within the document.
HTMLFrameHyperlinkEvent is used to notify interested parties that link was activated in a frame. @author Sunita Mani @version 1.2 084 02/2602/9800
This is a writer for HTMLDocuments. @author Sunita Mani @version 1.Class HTMLWriter, constructor HTMLWriter(Writer, HTMLDocument)23 0426 02/2202/9900
Creates a new HTMLWriter. @param w a Writer @param doc an HTMLDocumentClass HTMLWriter, constructor HTMLWriter(Writer, HTMLDocument, int, int)
Creates a new HTMLWriter. @param w a Writer @param doc an HTMLDocument @param posClass HTMLWriter, void closeOutUnwantedEmbeddedTags(AttributeSet)Thethe document locationin thefromdocumentwhich to fetch the content.@param lenThethe amount to write out.
Class HTMLWriter, void comment(Element)ThisSearchesmethod searchesthe attribute set and for each tag that is stored in the tag vector. If the tag isnt found then the tag is removed from the vector and a corresponding end tag is written out. @exception IOException on any I/O error
Writes out comments. @param elem anClass HTMLWriter, void emptyTag(Element)element.Element @exception IOException on any I/O error @exception BadLocationException if pos represents an invalid location within the document.
Writes out all empty elementsClass HTMLWriter, void endTag(Element)i.e(all tags that have no corresponding end tag). @param elem an Element.@exception IOException on any I/O error @exception BadLocationException if pos represents an invalid location within the document.
Writes out an end tag for the element. @param elem an ElementClass HTMLWriter, void incrIndent().@exception IOException on any I/O error
Increments the indent level. If indenting would causeClass HTMLWriter, void indent()getIndentSpace()
*getIndentLevel()
to be > thangetLineLength()
this will not cause an indent.
Does indentation. The number of spaces written out is indent level times the space to map mapping. If the current line is empty this will not make it so that the current line is still considered empty. @exception IOException on any I/O errorClass HTMLWriter, boolean isBlockTag(AttributeSet)
Determines if the HTML.Tag associated with the element is a block tag. @param attr an AttributeSetClass HTMLWriter, boolean matchNameAttribute(AttributeSet, Tag).@return true if tag is block tag false otherwise.
Class HTMLWriter, void selectContent(AttributeSet)ThisReturnsmethod returntrue if the StyleConstants.NameAttribute is equal to the tag that is passed in as a parameter.
Writes out the content of the SELECT form element. @param attr the AttributeSetClass HTMLWriter, void startTag(Element)associcatedassociated with the form element.@exception IOException on any I/O error
Writes out a start tag for the element. Ignores all synthesized elements. @param elem an ElementClass HTMLWriter, boolean synthesizedElement(Element).@exception IOException on any I/O error
Class HTMLWriter, void text(Element)ThisReturnsmethod returnstrue if the element is a synthesized element. Currently we are only testing for the p-implied tag.
Writes out text. If a range is specified when the constructor is invoked then only the appropriate range of text is written out. @param elem an ElementClass HTMLWriter, void textAreaContent(AttributeSet).@exception IOException on any I/O error @exception BadLocationException if pos represents an invalid location within the document.
Writes out text that is contained in a TEXTAREA form element. @param attr an AttributeSet @exception IOException on any I/O error @exception BadLocationException if pos represents an invalid location within the document.Class HTMLWriter, void write()
Class HTMLWriter, void writeAttributes(AttributeSet)ThisIteratesis method that iteratesover thetheElement tree and controls the writing out of all the tags and its attributes. @exception IOException on any I/O error @exception BadLocationException if pos represents an invalid location within the document.
Writes out the attribute set. Ignores all attributes with a key of type HTML.Tag attributes with a key of type StyleConstants and attributes with a key of type HTML.Attribute.ENDTAG. @param attr an AttributeSetClass HTMLWriter, void writeEmbeddedTags(AttributeSet).@exception IOException on any I/O error
Class HTMLWriter, void writeOption(Option)ThisSearchesmethod searchesfor embedded tags in the AttributeSet and writes them out. It also stores these tags in a vector so that when appropriate the corresponding end tags can be written out. @exception IOException on any I/O error
Writes out the content of the Option form element. @param option an Option.@exception IOException on any I/O error
Displays the inline element styles based upon css attributes. @author Timothy Prinzing @version 1.Class InlineView, int getBreakWeight(int, float, float)12 0919 02/2502/9800
Determines how attractive a break opportunity in this view is. This can be used for determining which view is the most attractive to callbreakView
on in the process of formatting. A view that represents text that has whitespace in it might be more attractive than a view that has no whitespace for example. The higher the weight the more attractive the break. A value equal to or lower thanshould not be considered for a break. A value greater than or equal to
View.BadBreakWeightshould be broken.
View.ForcedBreakWeightThis is implemented to
forward toprovide thesuperclassdefaultfor thebehaviorY_AXIS.ofAlongreturningtheBadBreakWeight
X_AXISunless thefollowing values may belength is greater thanreturned.the lengthView.ExcellentBreakWeightofifthethere is whitespace proceedingview in which case thedesiredentirebreakviewlocation.representsView.BadBreakWeighttheiffragment.the desired break location results in a break location of the startingUnless a view has been written to support breaking behavior it isoffset.notView.GoodBreakWeightattractiveiftothe other conditionstry and breakdon'ttheoccurview. AnThis willexamplenormally result in the behavior ofof a view that does support breakingonisaLabelView
.whitespace location if one can be found otherwise breaking betweenAn example of a view that uses break weight ischaractersParagraphView
. @param axis may be either View.X_AXIS or View.Y_AXIS @param pos the potential location of the start of the broken view >= 0. This may be useful for calculating tab positions. @param len specifies the relative length from pos where a potential break is desired >= 0. @return the weight which should be a value betweenView.ForcedBreakWeight andView.BadBreakWeight. @see LabelView @see ParagraphView @see javax.swing.text.View#BadBreakWeight @see javax.swing.text.View#GoodBreakWeight @see javax.swing.text.View#ExcellentBreakWeight @see javax.swing.text.View#ForcedBreakWeight
A view implementation to display an html list @author Timothy Prinzing @version 1.23 0425 02/2202/9900
MinimalHTMLWriter is a fallback writer used by the HTMLEditorKit to write out HTML for a document that is a not produced by the EditorKit. The format for the document is:Class MinimalHTMLWriter, constructor MinimalHTMLWriter(Writer, StyledDocument)<html> <head> <style> < -- list of named styles p.normal { font-family: SansSerif; margin-height: 0; font-size: 14 } --> </style> </head> <body> <p style=normal>@author Sunita Mani @version 1.boldBold italic and underline attributes of the run are emitted ashtmlHTML tags. The remaining attributes are emitted as part of the style attribute of a <span> tag. The syntax is similar to inline styles. </p> </body> </html>8110402/2202/9900
Creates a new MinimalHTMLWriter. @paramClass MinimalHTMLWriter, constructor MinimalHTMLWriter(Writer, StyledDocument, int, int)aw Writer @paramandoc StyledDocument
Creates a new MinimalHTMLWriter. @paramClass MinimalHTMLWriter, void endFontTag()aw Writer @paramandoc StyledDocument @param pos The location in the document to fetch the content. @param len The amount to write out.
This is no longer used instead <span> will be written out.Class MinimalHTMLWriter, boolean inFontTag()Writes out an end tag for the <font> tag. @exception IOException on any I/O error
Returns true if we are currently in a <font> tag.Class MinimalHTMLWriter, void startFontTag(String)
This is no longer used instead <span> will be written out.Class MinimalHTMLWriter, void text(Element)Writes out a start tag for the <font> tag.
GivenBecausethatfont tags cannot be nestedif we are already in a font tagthisitmethod closes outtheany enclosing font tag before writing out a new start tag. @exception IOException on any I/O error
Class MinimalHTMLWriter, void write()ThisWritesmethod is responsible for writingout textout. @exception IOException on any I/O error
Class MinimalHTMLWriter, void writeAttributes(AttributeSet)This methodGenerates HTMLis responsible for generating htmloutput from a StyledDocument. @exception IOException on any I/O error @exception BadLocationException if pos represents an invalid location within the document.
Class MinimalHTMLWriter, void writeBody()ThisWritesmethod writesout all the attributesthat arefor the following types: StyleConstants.ParagraphConstants StyleConstants.CharacterConstants StyleConstants.FontConstants StyleConstants.ColorConstants. The attribute name and value are separated by a colonAnd.eachEach pair isseparatdseparated by a semicolon. @exception IOException on any I/O error
Class MinimalHTMLWriter, void writeComponent(Element)This method iteratesIterates over the elements in the document and processes elements based on whether they are branch elements or leaf elements.ItThis method specially handles leaf elements that are text. @exception IOException on any I/O error
Responsible for handling Component Elements; deliberately unimplemented. How this method is implemented is a matter of policy.Class MinimalHTMLWriter, void writeContent(Element, boolean)Hence left unimplemented.
Class MinimalHTMLWriter, void writeEndParagraph()ThisWritesmethod handles writing out text. It invokes methods that are responsible for writingoutitsthe attribute set ina manner that is htmlan HTML-compliant manner. @exception IOException on any I/O error @exception BadLocationException if pos represents an invalid location within the document.
Class MinimalHTMLWriter, void writeEndTag(String)ThisEmitsmethod handles emitingan end tag for a <p> tag.PriorBeforetowriting out the tagitthis method ensures that all other tags that have been opened are appropriately closed off. @exception IOException on any I/O error
Class MinimalHTMLWriter, void writeHTMLTags(AttributeSet)ThisWritesmethod writesoutaan end tagapproriratelyappropriately indented.It alsoAlso decrements the indent level. @exception IOException on any I/O error
Class MinimalHTMLWriter, void writeHeader()ThisGeneratesmethod is responsible for generatingbolditalics<b> italic <i> and <u> tags for the text based on its attribute settings. @exception IOException on any I/O error
Class MinimalHTMLWriter, void writeImage(Element)ThisWritesmethod writesout the <head> and <style> tags.It Thenand then invokes writeStyles() to write out all the named styles as the content of the <style> tag. The content is surrounded by validhtmlHTML comment markers to ensure that the document is viewable in applications/browsers that do not support the tag. @exception IOException on any I/O error
Responsible for handling Icon ElementsClass MinimalHTMLWriter, void writeLeaf(Element). This method;is deliberatlydeliberately unimplemented. How to implementit is morethis method is an issue of policy--.forFor example ifone wasyou'reto generategenerating an <img> tagthe question does arise abouthowone wouldshould you represent the src attributei.e(the location of the image.) In certain cases it could be aurlURL in others it could be read from a stream. @paramanelem elementfoof type StyleConstants.IconElementName
Responsible for writing out other nonClass MinimalHTMLWriter, void writeNonHTMLAttributes(AttributeSet)-text leaf elements. @exception IOException on any I/O error
Class MinimalHTMLWriter, void writeStartParagraph(Element)ThisWritesmethod is responsible for writingout the remaining character-level attributes (i eattributes other than bolditalicsitalic andunderlieunderline) in anhtmlHTML-compliant way. Given that attributeslikesuch as font family and font sizeetc..have no direct mapping tohtmlHTML tags a <span> tag is generated and its style attribute is set to contain the list of remaining attributes just like inline styles. @exception IOException on any I/O error
Class MinimalHTMLWriter, void writeStartTag(String)ThisEmitsmethod emitsthe start tag for a paragraph. If the paragraph has a named style associated with it thenitthis method also generates a class attribute for the <p> tag andset'ssets its value to be the name of the style. @exception IOException on any I/O error
Class MinimalHTMLWriter, void writeStyles()ThisWritesmethod writesout a start tagapproriratelyappropriately indented.It alsoAlso increments the indent level. @exception IOException on any I/O error
ThisWritesmethod writesout all the named styles as the content of the <style> tag. @exception IOException on any I/O error
Component decorator that implements the view interface for <object> elements.This view will try to load the class specified by the
classid
attribute. If possible the Classloader used to load the associated Document is used. This would typically be the same as the ClassLoader used to load the EditorKit. If the documents ClassLoader is nullClass.forName
is used.If the class can successfully be loaded an attempt will be made to create an instance of it by calling
Class.newInstance
. An attempt will be made to narrow the instance to typejava.awt.Component
to display the object.This view can also manage a set of parameters with limitations. The parameters to the <object> element are expected to be present on the associated elements attribute set as simple strings. Each bean property will be queried as a key on the AttributeSet with the expectation that a non-null value (of type String) will be present if there was a parameter specification for the property. Reflection is used to set the parameter. Currently this is limited to a very simple single parameter of type String.
A simple example html invocation is:
@author Timothy Prinzing @version 1.
5 097 02/2102/9800
Value for the ListModel used to represent <option> elements. This is the object installed as items of the DefaultComboBoxModel used to represent the <select> element. @author Timothy Prinzing @version 1.5 117 02/1902/9800
Displays the a paragraph and uses css attributes for its configuration. @author Timothy Prinzing @version 1.Class ParagraphView, void changedUpdate(DocumentEvent, Shape, ViewFactory)17 0421 02/2202/9900
Gives notification from the document that attributes were changed in a location that this view is responsible for.Class ParagraphView, float getMaximumSpan(int)This causes the set of view attributes to be recomputed.@paramechanges the change information from the associated document @param a the current allocation of the view @param f the factory to use to rebuild if the view has children @see View#changedUpdate
Determines the maximum span for this view along an axis. Returns 0 if the view is not visible otherwise it calls the superclass method ot get the maximum span. @param axis may be either View.X_AXIS or View.Y_AXIS @returns the maximum span the view can be rendered into. @see javax.swing.text.ParagraphView#getMaximumSpanClass ParagraphView, float getMinimumSpan(int)
Determines the minimum span for this view along an axis. Returns 0 if the view is not visible otherwise it calls the superclass method to get the minimum span. @param axis may be either View.X_AXIS or View.Y_AXIS @returns the minimum span the view can be rendered into. @see javax.swing.text.ParagraphView#getMinimumSpanClass ParagraphView, float getPreferredSpan(int)
Determines the preferred span for this view. Returns 0 if the view is not visible otherwise it calls the superclass method to get the preferred span. axis. @param axis may be either View.X_AXIS or View.Y_AXIS @returns the span the view would like to be rendered into. Typically the view is told to render into the span that is returned although there is no guarantee. The parent may choose to resize or break the view. @see javax.swing.text.ParagraphView#getPreferredSpan
Support for defining the visual characteristics ofhtmlHTML views being rendered. The StyleSheet is used to translate thehtmlHTML model into visual characteristics. This enables views to be customized by a look-and-feel multiple views over the same model can be rendered differently etc. This can be thought of as a CSS rule repository. The key for CSS attributes is an object of type CSS.Attribute. The type of the value is up to the StyleSheet implementation but thetoString
method is required to return a string representation of CSS value.The primary entry point for HTML View implementations to get their attributes is the getViewAttributes method. This should be implemented to establish the desired policy used to associate attributes with the view. Each HTMLEditorKit (i.e. and therefore each associated JEditorPane) can have its own StyleSheet but by default one sheet will be shared by all of the HTMLEditorKit instances. HTMLDocument instance can also have a StyleSheet which holds the document-specific CSS specifications.
In order for Views to store less state and therefore be more lightweight the StyleSheet can act as a factory for painters that handle some of the rendering tasks. This allows implementations to determine what they want to cache and have the sharing potentially at the level that a selector is common to multiple views. Since the StyleSheet may be used by views over multiple documents and typically the
htmlHTML attributes don't effect the selector being used the potential for sharing is significant.The rules are stored as named styles and other information is stored to translate the context of an element to a rule quickly. The following code fragment will display the named styles and therefore the CSS rules contained.
import java.util.*; import javax.swing.text.*; import javax.swing.text.html.*; public class ShowStyles { public static void main(String[] args) { HTMLEditorKit kit = new HTMLEditorKit(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); StyleSheet styles = doc.getStyleSheet(); Enumeration rules = styles.getStyleNames(); while (rules.hasMoreElements()) { String name = (String) rules.nextElement(); Style rule = styles.getStyle(name); System.out.println(rule.toString()); } System.exit(0); } }The semantics for when a CSS style should overide visual attributes defined by an element are not well defined. For example the html
<body bgcolor=red>
makes the body have a red background. But if the html file also contains the CSS rulebody { background: blue }
it becomes less clear as to what color the background of the body should be. The current implemention gives visual attributes defined in the element the highest precedence that is they are always checked before any styles. Therefore in the previous example the background would have a red color as the body element defines the background color to be red.As already mentioned this supports CSS. We don't support the full CSS spec. Refer to the javadoc of the CSS class to see what properties we support. The two major CSS parsing related concepts we do not currently support are pseudo selectors such as
A:link { color: red }
and theimportant
modifier.Note: This implementation is currently incomplete. It can be replaced with alternative implementations that are complete. Future versions of this class will provide better CSS support. @author Timothy Prinzing @author Sunita Mani @author Sara Swanson @author Jill Nakata @version 1.
53 0463 02/2202/9900
Class to carry out some of the duties ofClass StyleSheet.BoxPainter, float getInset(int, View)cssCSS formatting. Implementations of this class enable views to present thecssCSS formatting while not knowing anything about how thecssCSS values are being cached.As a delegate of Views this object is responsible for the insets of a View and making sure the background is maintained according to the
cssCSS attributes.
Class StyleSheet.BoxPainter, void paint(Graphics, float, float, float, float, View)FetchsFetches the inset needed on a given side to account for the margin border and padding. @param side The size of the box to fetch the inset for. This can be View.TOP View.LEFT View.BOTTOM or View.RIGHT. @param v the view making the request. This is used to get the AttributeSet and may be used to resolve percentage arguments. @exception IllegalArgumentException for an invalid direction
Paints thecssCSS box according to the attributes given. This should paint the border padding and background. @param g the rendering surface. @param x the x coordinate of the allocated area to render into. @param y the y coordinate of the allocated area to render into. @param w the width of the allocated area to render into. @param h the height of the allocated area to render into. @param v the view making the request. This is used to get the AttributeSet and may be used to resolve percentage arguments.
Class StyleSheet.ListPainter, void paint(Graphics, float, float, float, float, View, int)classClass to carry out some of the duties ofcssCSS list formatting. Implementations of this class enable views to present thecssCSS formatting while not knowing anything about how thecssCSS values are being cached.
Paints thecssCSS list decoration according to the attributes given. @param g the rendering surface. @param x the x coordinate of the list item allocation @param y the y coordinate of the list item allocation @param w the width of the list item allocation @param h the height of the list item allocation @param s the allocated area to paint into. @param item which list item is being painted. This is a number=greater than or equal to 0.
Adds an attribute to the given set and returns the new representative set. This is reimplemented to convert StyleConstant attributes to CSS prior to forwarding to the superclass behavior. TheClass StyleSheet, void addRule(String)theStyleConstants attribute has no corresponding CSS entry the StyleConstants attribute is stored (but will likely be unused). @param old the old attribute set @param key the non-null attribute key @param value the attribute value @return the updated attribute set @see MutableAttributeSet#addAttribute
Class StyleSheet, MutableAttributeSet createLargeAttributeSet(AttributeSet)AddAdds a set of rules to the sheet. The rules are expected to be in valid CSS format. Typically this would be called as a result of parsing a <style> tag.
Class StyleSheet, SmallAttributeSet createSmallAttributeSet(AttributeSet)CreateCreates a large set of attributes that should trade off space for time. This set will not be shared. This is a hook for subclasses that want to alter the behavior of the larger attribute storage format (which is SimpleAttributeSet by default). This can be reimplemented to return a MutableAttributeSet that provides some sort of attribute conversion. @param a The set of attributes to be represented in the the larger form.
Class StyleSheet, BoxPainter getBoxPainter(AttributeSet)CreateCreates a compact set of attributes that might be shared. This is a hook for subclasses that want to alter the behavior of SmallAttributeSet. This can be reimplemented to return an AttributeSet that provides some sort of attribute conversion. @param a The set of attributes to be represented in the the compact form.
Class StyleSheet, AttributeSet getDeclaration(String)FetchFetches the box formatter to use for the given set ofcssCSS attributes.
Class StyleSheet, Font getFont(AttributeSet)TranslateTranslates a CSS declaration to an AttributeSet that represents the CSS declaration. Typically this would be called as a result of encountering an HTML style attribute.
Class StyleSheet, ListPainter getListPainter(AttributeSet)FetchFetches the font to use for the given set of attributes.
Class StyleSheet, float getPointSize(String)FetchFetches the list formatter to use for the given set ofcssCSS attributes.
Given a string such as "+2" "-2" or "2"Class StyleSheet, float getPointSize(int).returns a point size value.
Class StyleSheet, Style getRule(String)ReturnReturns the point size given a size index.
Class StyleSheet, Style getRule(Tag, Element)FetchFetches the rule that best matches the selector given in string form. Whereselector
is a space separated String of the element names. For exampleselector
might be 'html body tr td''The attributes of the returned Style will change as rules are added and removed. That is if you to ask for a rule with a selector "table p" and a new rule was added with a selector of "p" the returned Style would include the new attributes from the rule "p".
Class StyleSheet, AttributeSet getViewAttributes(View)FetchFetches the style to use to render the given type ofhtmlHTML tag. The element given is representing the tag and can be used to determine the nesting for situations where the attributes will differ if nesting inside of elements. @param t the type to translate to visual attributes. @param e the element representing the tag. The element can be used to determine the nesting for situations where the attributes will differ if nested inside of other elements. @returns the set ofcssCSS attributes to use to render the tag.
Class StyleSheet, void loadRules(Reader, URL)FetchFetches a set of attributes to use in the view for displaying. This is basically a set of attributes that can be used for View.getAttributes.
Class StyleSheet, Color stringToColor(String)LoadLoads a set of rules that have been specified in terms of CSS1 grammar. If there are collisions with existing rules the newly specified rule will win. @param in the stream to read thecssCSS grammar from.@param ref the referenceurlURL. This value represents the location of the stream and may be null. All relativeurlsURLs specified in the stream will be based upon this parameter.
Class StyleSheet, AttributeSet translateHTMLToCSS(AttributeSet)ConvertConverts a color string such as "RED" or "#NNNNNN" to a Color. Note: This will only convert the HTML3.2colorscolor strings or a string of length 7; otherwise it will return null.
ConvertConverts a set ofhtmlHTML attributes to an equivalent set ofcssCSS attributes. @param AttributeSet containing the HTML attributes. @param AttributeSet containing the corresponding CSS attributes. The AttributeSet will be empty if there are no mapping CSS attributes.