APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing.text.html

public Class ObjectView

extends ComponentView
Class Inheritance
Imports
java.awt.*, javax.swing.*, javax.swing.text.*, java.beans.*, java.lang.reflect.*, sun.reflect.misc.MethodUtil

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 document's ClassLoader is null, Class.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 type java.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:

     <object classid="javax.swing.JLabel">
     <param name="text" value="sample text">
     </object>
Author
Timothy Prinzing

Field Summary

Modifier and TypeField and Description
private boolean

Constructor Summary

AccessConstructor and Description
public
ObjectView(Element
the element to decorate
elem
)

Creates a new ObjectView object.

pack-priv
ObjectView(Element elem, boolean createComp)

Method Summary

Modifier and TypeMethod and Description
protected Component
pack-priv Component
getUnloadableRepresentation()

Fetch a component that can be used to represent the object if it can't be created.

private void
setParameters(Component comp, AttributeSet attr)

Initialize this component according the KEY/VALUEs passed in via the <param> elements in the corresponding <object> element.

Inherited from javax.swing.text.ComponentView:
getAlignmentgetComponentgetMaximumSpangetMinimumSpangetPreferredSpanmodelToViewpaintsetParentviewToModel

Field Detail

createCompback to summary
private boolean createComp

Constructor Detail

ObjectViewback to summary
public ObjectView(Element elem)

Creates a new ObjectView object.

Parameters
elem:Element

the element to decorate

ObjectViewback to summary
pack-priv ObjectView(Element elem, boolean createComp)

Method Detail

createComponentback to summary
protected Component createComponent()

Overrides javax.swing.text.ComponentView.createComponent.

Create the component. The classid is used as a specification of the classname, which we try to load.

Annotations
@SuppressWarnings:deprecation
getUnloadableRepresentationback to summary
pack-priv Component getUnloadableRepresentation()

Fetch a component that can be used to represent the object if it can't be created.

setParametersback to summary
private void setParameters(Component comp, AttributeSet attr)

Initialize this component according the KEY/VALUEs passed in via the <param> elements in the corresponding <object> element.