|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.text.View javax.swing.text.ComponentView javax.swing.text.html.ObjectView
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 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:
Nested Class Summary |
Nested classes inherited from class javax.swing.text.ComponentView |
|
Field Summary |
Fields inherited from class javax.swing.text.ComponentView |
|
Fields inherited from class javax.swing.text.View |
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS |
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Constructor Summary | |
ObjectView(Element elem)
Creates a new ObjectView object. |
Method Summary | |
protected Component |
createComponent()
Create the component. |
private Class |
getClass(String classname)
Get a Class object to use for loading the classid. |
(package private) 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. |
Methods inherited from class javax.swing.text.ComponentView |
getAlignment, getComponent, getMaximumSpan, getMinimumSpan, getPreferredSpan, modelToView, paint, setParent, viewToModel |
Methods inherited from class javax.swing.text.View |
append, breakView, changedUpdate, createFragment, forwardUpdate, forwardUpdateToView, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, insertUpdate, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, removeUpdate, replace, setSize, updateChildren, updateLayout, viewToModel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ObjectView(Element elem)
elem
- the element to decorateMethod Detail |
protected Component createComponent()
createComponent
in class ComponentView
Component getUnloadableRepresentation()
private Class getClass(String classname) throws ClassNotFoundException
Class.forName
is used.
ClassNotFoundException
private void setParameters(Component comp, AttributeSet attr)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |