Top Description Inners Fields Constructors Methods
com.sun.jfx.incubator.scene.control.richtext

public Class HtmlStyledOutput

extends Object
implements StyledOutput
Class Inheritance
All Implemented Interfaces
jfx.incubator.scene.control.richtext.model.StyledOutput, java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.IOException, .Writer, java.util.Base64, .HashMap, javafx.scene.Node, javafx.scene.image.WritableImage, javafx.scene.layout.Region, javafx.scene.paint.Color, com.sun.jfx.incubator.scene.control.richtext.util.RichUtils, jfx.incubator.scene.control.richtext.StyleResolver, jfx.incubator.scene.control.richtext.model.StyleAttribute, .StyleAttributeMap, .StyledOutput, .StyledSegment

A StyledOutput which generates HTML output.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static record
private static class

Field Summary

Modifier and TypeField and Description
private final boolean
private final StyleResolver
private static final StyleAttribute<HtmlStyledOutput.Key>
private final HashMap<HtmlStyledOutput.Key, HtmlStyledOutput.Val>
private final Writer

Constructor Summary

AccessConstructor and Description
public
HtmlStyledOutput(StyleResolver resolver, Writer wr, boolean inlineStyles)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

public void
private static String
private static HtmlStyledOutput.Key

Returns:

the new key or null if this attribute must be skipped.
createKey
(StyleAttributeMap attrs, StyleAttribute<T> a, Object v)

Special handing is required since STRIKE_THROUGH and UNDERLINE are mapped to the same text-decoration CSS property.

private static String
encode(String text)

private static String
private String
public StyledOutput
public void
private static int
private static char
nibbleChar(int x)

public void
private void
private void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

inlineStylesback to summary
private final boolean inlineStyles
resolverback to summary
private final StyleResolver resolver
SS_AND_UNDERLINEback to summary
private static final StyleAttribute<HtmlStyledOutput.Key> SS_AND_UNDERLINE
stylesback to summary
private final HashMap<HtmlStyledOutput.Key, HtmlStyledOutput.Val> styles
wrback to summary
private final Writer wr

Constructor Detail

HtmlStyledOutputback to summary
public HtmlStyledOutput(StyleResolver resolver, Writer wr, boolean inlineStyles)

Method Detail

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
consumeback to summary
public void consume(StyledSegment seg) throws IOException

Implements jfx.incubator.scene.control.richtext.model.StyledOutput.consume.

Doc from jfx.incubator.scene.control.richtext.model.StyledOutput.consume.

Consumes the next styled segment.

Annotations
@Override
Exceptions
IOException:
when an I/O error occurs
createCssback to summary
private static String createCss(StyleAttribute<T> a, Object v)
createKeyback to summary
private static HtmlStyledOutput.Key createKey(StyleAttributeMap attrs, StyleAttribute<T> a, Object v)

Special handing is required since STRIKE_THROUGH and UNDERLINE are mapped to the same text-decoration CSS property.

Returns:HtmlStyledOutput.Key

the new key or null if this attribute must be skipped.

encodeback to summary
private static String encode(String text)
encodeFontFamilyback to summary
private static String encodeFontFamily(String name)
extractStylesback to summary
private String extractStyles(StyleAttributeMap attrs)
firstPassBuilderback to summary
public StyledOutput firstPassBuilder()
flushback to summary
public void flush() throws IOException

Implements jfx.incubator.scene.control.richtext.model.StyledOutput.flush.

Doc from jfx.incubator.scene.control.richtext.model.StyledOutput.flush.

Flushes this output stream.

Annotations
@Override
Exceptions
IOException:
when an I/O error occurs
indexOfSpecialCharback to summary
private static int indexOfSpecialChar(String text)
nibbleCharback to summary
private static char nibbleChar(int x)
writeEpilogueback to summary
public void writeEpilogue() throws IOException
writeInlineNodeback to summary
private void writeInlineNode(Node n) throws IOException
writeParagraphback to summary
private void writeParagraph(Region n) throws IOException
writePrologueback to summary
public void writePrologue() throws IOException
com.sun.jfx.incubator.scene.control.richtext back to summary

private final Record HtmlStyledOutput.Key

extends Record
Class Inheritance
Record Components
attr:StyleAttribute<T> 
value:Object 

Field Summary

Modifier and TypeField and Description
private final StyleAttribute<T>
attr

Record Component accessed by attr().

private final Object
value

Record Component accessed by value().

Constructor Summary

AccessConstructor and Description
private
Key(StyleAttribute<T> attr, Object value)

Method Summary

Modifier and TypeMethod and Description
public StyleAttribute<T>
attr()

Record Component getter of attr.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public Object
value()

Record Component getter of value.

Field Detail

attrback to summary
private final StyleAttribute<T> attr

Record Component accessed by attr().

valueback to summary
private final Object value

Record Component accessed by value().

Constructor Detail

Keyback to summary
private Key(StyleAttribute<T> attr, Object value)

Method Detail

attrback to summary
public StyleAttribute<T> attr()

Record Component getter of attr.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

valueback to summary
public Object value()

Record Component getter of value.

com.sun.jfx.incubator.scene.control.richtext back to summary

private Class HtmlStyledOutput.Val

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.jfx.incubator.scene.control.richtext.HtmlStyledOutput.Val

Field Summary

Modifier and TypeField and Description
public final String
public final String

Constructor Summary

AccessConstructor and Description
public
Val(String name, String css)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cssback to summary
public final String css
nameback to summary
public final String name

Constructor Detail

Valback to summary
public Val(String name, String css)