| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | BasicHTML.
The subclass of HTMLDocument that is used as the model. |
| pack-priv static class | BasicHTML.
The views produced for the ComponentUI implementations aren't going to be edited and don't need full html support. |
| pack-priv static class | BasicHTML.
BasicHTMLViewFactory extends HTMLFactory to force images to be loaded synchronously. |
| pack-priv static class | BasicHTML.
Root text view that acts as an HTML renderer. |
| Modifier and Type | Field and Description |
|---|---|
| private static BasicHTML. | basicHTMLFactory
The source of the html renderers |
| private static ViewFactory | basicHTMLViewFactory
Creates the Views that visually represent the model. |
| public static final String | documentBaseKey
Key stored as a client property to indicate the base that relative references are resolved against. |
| private static final String | htmlDisable
If this client property of a JComponent is set to Boolean.TRUE the component's 'text' property is never treated as HTML. |
| public static final String | propertyKey
Key to use for the html renderer when stored as a client property of a JComponent. |
| private static final String | styleChanges
Overrides to the default stylesheet. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static View | Returns: an HTML renderera component c, String an HTML string html)Create an html renderer for the given component and string of html. |
| pack-priv static int | getBaseline(JComponent c, int y, int ascent, int w, int h)
Gets the baseline for the specified component. |
| pack-priv static int | |
| private static int | |
| pack-priv static BasicHTML. | |
| public static int | Returns: baseline or a value < 0 indicating there is no reasonable baselinethe View to get the baseline for view, int the width to get the baseline for w, int the height to get the baseline for h)Returns the baseline for the html renderer. |
| private static boolean | |
| public static boolean | Returns: true if the given string should trigger the
html rendering logic in a non-text componenta text s)Check the given string to see if it should trigger the html rendering logic in a non-text component that supports html rendering. |
| public static void | updateRenderer(JComponent
a component c, String a text text)Stash the HTML render for the given text into the client properties of the given JComponent. |
| basicHTMLFactory | back to summary |
|---|---|
| private static BasicHTML. The source of the html renderers | |
| basicHTMLViewFactory | back to summary |
|---|---|
| private static ViewFactory basicHTMLViewFactory Creates the Views that visually represent the model. | |
| documentBaseKey | back to summary |
|---|---|
| public static final String documentBaseKey Key stored as a client property to indicate the base that relative references are resolved against. For example, lets say you keep your images in the directory resources relative to the code path, you would use the following the set the base:
jComponent.putClientProperty(documentBaseKey,
xxx.class.getResource("resources/"));
| |
| htmlDisable | back to summary |
|---|---|
| private static final String htmlDisable If this client property of a JComponent is set to Boolean.TRUE the component's 'text' property is never treated as HTML. | |
| propertyKey | back to summary |
|---|---|
| public static final String propertyKey Key to use for the html renderer when stored as a client property of a JComponent. | |
| styleChanges | back to summary |
|---|---|
| private static final String styleChanges Overrides to the default stylesheet. Should consider just creating a completely fresh stylesheet. | |
| BasicHTML | back to summary |
|---|---|
| public BasicHTML() Constructs a | |
| createHTMLView | back to summary |
|---|---|
| public static View createHTMLView(JComponent c, String html) Create an html renderer for the given component and string of html.
| |
| getBaseline | back to summary |
|---|---|
| pack-priv static int getBaseline(JComponent c, int y, int ascent, int w, int h) Gets the baseline for the specified component. This digs out
the View client property, and if non-null the baseline is calculated
from it. Otherwise the baseline is the value | |
| getBaseline | back to summary |
|---|---|
| pack-priv static int getBaseline(View view, int w, int h) Gets the baseline for the specified View. | |
| getBaseline | back to summary |
|---|---|
| private static int getBaseline(View view, Shape bounds) | |
| getFactory | back to summary |
|---|---|
| pack-priv static BasicHTML. | |
| getHTMLBaseline | back to summary |
|---|---|
| public static int getHTMLBaseline(View view, int w, int h) Returns the baseline for the html renderer.
| |
| hasParagraph | back to summary |
|---|---|
| private static boolean hasParagraph(View view) | |
| isHTMLString | back to summary |
|---|---|
| public static boolean isHTMLString(String s) Check the given string to see if it should trigger the html rendering logic in a non-text component that supports html rendering.
| |
| updateRenderer | back to summary |
|---|---|
| public static void updateRenderer(JComponent c, String text) Stash the HTML render for the given text into the client properties of the given JComponent. If the given text is NOT HTML the property will be cleared of any renderer. This method is useful for ComponentUI implementations that are static (i.e. shared) and get their state entirely from the JComponent.
| |
| Access | Constructor and Description |
|---|---|
| pack-priv | BasicDocument(StyleSheet s, Font defaultFont, Color foreground)
The host, that is where we are rendering. |
| Modifier and Type | Method and Description |
|---|---|
| private void |
| BasicDocument | back to summary |
|---|---|
| pack-priv BasicDocument(StyleSheet s, Font defaultFont, Color foreground) The host, that is where we are rendering. | |
| setFontAndColor | back to summary |
|---|---|
| private void setFontAndColor(Font font, Color fg) Sets the default font and default color. These are set by adding a rule for the body that specifies the font and color. This allows the html to override these should it wish to have a custom font or color. | |
| Modifier and Type | Field and Description |
|---|---|
| private static StyleSheet | defaultStyles
Shared base style for all documents created by us use.
|
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Document | createDefaultDocument(Font defaultFont, Color foreground)
Sets the async policy to flush everything in one chunk, and to not display unknown tags. |
| public StyleSheet | getStyleSheet()
Overrides javax. Overridden to return our own slimmed down style sheet. |
| public ViewFactory | getViewFactory()
Overrides javax. Returns the ViewFactory that is used to make sure the Views don't load in the background. |
| defaultStyles | back to summary |
|---|---|
| private static StyleSheet defaultStyles Hides javax. Shared base style for all documents created by us use. | |
| BasicEditorKit | back to summary |
|---|---|
| pack-priv BasicEditorKit() | |
| createDefaultDocument | back to summary |
|---|---|
| public Document createDefaultDocument(Font defaultFont, Color foreground) Sets the async policy to flush everything in one chunk, and to not display unknown tags. | |
| getStyleSheet | back to summary |
|---|---|
| public StyleSheet getStyleSheet() Overrides javax. Overridden to return our own slimmed down style sheet. | |
| getViewFactory | back to summary |
|---|---|
| public ViewFactory getViewFactory() Overrides javax. Returns the ViewFactory that is used to make sure the Views don't load in the background. | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| public View | create(Element elem)
Overrides javax. Implements javax. Creates a view from an element. |
| private static void |
| useOV | back to summary |
|---|---|
| private static Boolean useOV | |
| BasicHTMLViewFactory | back to summary |
|---|---|
| pack-priv BasicHTMLViewFactory() | |
| clearAllowHTMLObject | back to summary |
|---|---|
| private static void clearAllowHTMLObject() | |
| create | back to summary |
|---|---|
| public View create(Element elem) Overrides javax. Implements javax. Doc from javax. Creates a view from an element. | |
| setAllowHTMLObject | back to summary |
|---|---|
| private static void setAllowHTMLObject() | |
| Modifier and Type | Field and Description |
|---|---|
| private ViewFactory | |
| private JComponent | |
| private View | |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public float | Returns: the desired alignment, where 0.0 indicates the origin and 1.0 the full span away from the originmay be either X_AXIS or Y_AXIS axis)Overrides javax. Determines the desired alignment for this view along an axis. |
| public AttributeSet | getAttributes()
Overrides javax. Fetches the attributes to use when rendering. |
| public Container | Returns: the containerOverrides javax. Fetches the container hosting the view. |
| public Document | Returns: the modelOverrides javax. Returns the document model underlying the view. |
| public Element | Returns: the viewOverrides javax. Gets the element that this view is mapped to. |
| public int | Returns: the ending offsetOverrides javax. Returns the ending offset into the model for this view. |
| public float | 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.may be either X_AXIS or Y_AXIS axis)Overrides javax. Determines the maximum span for this view along an axis. |
| public float | 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.may be either X_AXIS or Y_AXIS axis)Overrides javax. Determines the minimum span for this view along an axis. |
| public float | 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.may be either X_AXIS or Y_AXIS axis)Implements abstract javax. Determines the preferred span for this view along an axis. |
| public int | Returns: the starting offsetOverrides javax. Returns the starting offset into the model for this view. |
| public View | Returns: the viewthe number of the view to get n)Overrides javax. Gets the n-th view in this container. |
| public int | Returns: the number of viewsOverrides javax. Returns the number of views in this view. |
| public ViewFactory | Returns: the factoryOverrides javax. Fetches the factory to be used for building the various view fragments that make up the view that represents the model. |
| public Shape | Returns: the bounding box of the given positionthe position to convert pos, Shape the allocated region to render into a, Position.Implements abstract javax. Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it. |
| public Shape | Returns: the bounding box of the given position is returnedthe position to convert >= 0 p0, Position.the bias toward the previous character or the
next character represented by p0, in case the
position is a boundary of two views. b0,the position to convert >= 0 p1, Position.the bias toward the previous character or the
next character represented by p1, in case the
position is a boundary of two views. b1,the allocated region to render into a)Overrides javax. Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it. |
| public void | paint(Graphics
the graphics context g, Shape the region to render into allocation)Implements abstract javax. Renders the view. |
| public void | preferenceChanged(View
the child view child, boolean true if the width preference has changed width, boolean true if the height preference has changed height)Overrides javax. Specifies that a preference has changed. |
| public void | setParent(View
the parent view parent)Overrides javax. Sets the view parent. |
| public void | setSize(float
the width width, float the height height)Overrides javax. Sets the view size. |
| public int | Returns: the location within the model that best represents the given point in the viewx coordinate of the view location to convert x, float y coordinate of the view location to convert y, Shape the allocated region to render into a, Position.Implements abstract javax. Provides a mapping from the view coordinate space to the logical coordinate space of the model. |
| factory | back to summary |
|---|---|
| private ViewFactory factory | |
| host | back to summary |
|---|---|
| private JComponent host | |
| view | back to summary |
|---|---|
| private View view | |
| width | back to summary |
|---|---|
| private int width | |
| Renderer | back to summary |
|---|---|
| pack-priv Renderer(JComponent c, ViewFactory f, View v) | |
| getAlignment | back to summary |
|---|---|
| public float getAlignment(int axis) Overrides javax. Determines the desired alignment for this view along an axis.
| |
| getAttributes | back to summary |
|---|---|
| public AttributeSet getAttributes() Overrides javax. Fetches the attributes to use when rendering. At the root level there are no attributes. If an attribute is resolved up the view hierarchy this is the end of the line. | |
| getContainer | back to summary |
|---|---|
| public Container getContainer() Overrides javax. Fetches the container hosting the view. This is useful for things like scheduling a repaint, finding out the host components font, etc. The default implementation of this is to forward the query to the parent view.
| |
| getDocument | back to summary |
|---|---|
| public Document getDocument() Overrides javax. Returns the document model underlying the view.
| |
| getElement | back to summary |
|---|---|
| public Element getElement() Overrides javax. Gets the element that this view is mapped to.
| |
| getEndOffset | back to summary |
|---|---|
| public int getEndOffset() Overrides javax. Returns the ending offset into the model for this view.
| |
| getMaximumSpan | back to summary |
|---|---|
| public float getMaximumSpan(int axis) Overrides javax. Determines the maximum span for this view along an axis.
| |
| getMinimumSpan | back to summary |
|---|---|
| public float getMinimumSpan(int axis) Overrides javax. Determines the minimum span for this view along an axis.
| |
| getPreferredSpan | back to summary |
|---|---|
| public float getPreferredSpan(int axis) Implements abstract javax. Determines the preferred span for this view along an axis.
| |
| getStartOffset | back to summary |
|---|---|
| public int getStartOffset() Overrides javax. Returns the starting offset into the model for this view.
| |
| getView | back to summary |
|---|---|
| public View getView(int n) Overrides javax. Gets the n-th view in this container.
| |
| getViewCount | back to summary |
|---|---|
| public int getViewCount() Overrides javax. Returns the number of views in this view. Since this view simply wraps the root of the view hierarchy it has exactly one child.
| |
| getViewFactory | back to summary |
|---|---|
| public ViewFactory getViewFactory() Overrides javax. Fetches the factory to be used for building the various view fragments that make up the view that represents the model. This is what determines how the model will be represented. This is implemented to fetch the factory provided by the associated EditorKit.
| |
| modelToView | back to summary |
|---|---|
| public Shape modelToView(int pos, Shape a, Position. Implements abstract javax. Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.
| |
| modelToView | back to summary |
|---|---|
| public Shape modelToView(int p0, Position. Overrides javax. Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.
| |
| paint | back to summary |
|---|---|
| public void paint(Graphics g, Shape allocation) Implements abstract javax. Renders the view. | |
| preferenceChanged | back to summary |
|---|---|
| public void preferenceChanged(View child, boolean width, boolean height) Overrides javax. Specifies that a preference has changed. Child views can call this on the parent to indicate that the preference has changed. The root view routes this to invalidate on the hosting component. This can be called on a different thread from the event dispatching thread and is basically unsafe to propagate into the component. To make this safe, the operation is transferred over to the event dispatching thread for completion. It is a design goal that all view methods be safe to call without concern for concurrency, and this behavior helps make that true.
| |
| setParent | back to summary |
|---|---|
| public void setParent(View parent) Overrides javax. Sets the view parent.
| |
| setSize | back to summary |
|---|---|
| public void setSize(float width, float height) Overrides javax. Sets the view size.
| |
| viewToModel | back to summary |
|---|---|
| public int viewToModel(float x, float y, Shape a, Position. Implements abstract javax. Provides a mapping from the view coordinate space to the logical coordinate space of the model.
| |