ObjectView (Java 2 Platform SE 5.0) (original) (raw)


javax.swing.text.html

Class ObjectView

java.lang.Object extended by javax.swing.text.View extended by javax.swing.text.ComponentView extended by javax.swing.text.html.ObjectView

All Implemented Interfaces:

SwingConstants


public class ObjectView

extends ComponentView

Component decorator that implements the view interface for elements.

This view will try to load the class specified by theclassid 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 callingClass.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 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>

Field Summary
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.
Methods inherited from class javax.swing.text.ComponentView
getAlignment, getComponent, getMaximumSpan, getMinimumSpan, getPreferredSpan, [modelToView](../../../../javax/swing/text/ComponentView.html#modelToView%28int, java.awt.Shape, javax.swing.text.Position.Bias%29), [paint](../../../../javax/swing/text/ComponentView.html#paint%28java.awt.Graphics, java.awt.Shape%29), setParent, [viewToModel](../../../../javax/swing/text/ComponentView.html#viewToModel%28float, float, java.awt.Shape, javax.swing.text.Position.Bias[]%29)
Methods inherited from class javax.swing.text.View
append, [breakView](../../../../javax/swing/text/View.html#breakView%28int, int, float, float%29), [changedUpdate](../../../../javax/swing/text/View.html#changedUpdate%28javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory%29), [createFragment](../../../../javax/swing/text/View.html#createFragment%28int, int%29), [forwardUpdate](../../../../javax/swing/text/View.html#forwardUpdate%28javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory%29), [forwardUpdateToView](../../../../javax/swing/text/View.html#forwardUpdateToView%28javax.swing.text.View, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory%29), getAttributes, [getBreakWeight](../../../../javax/swing/text/View.html#getBreakWeight%28int, float, float%29), [getChildAllocation](../../../../javax/swing/text/View.html#getChildAllocation%28int, java.awt.Shape%29), getContainer, getDocument, getElement, getEndOffset, getGraphics, [getNextVisualPositionFrom](../../../../javax/swing/text/View.html#getNextVisualPositionFrom%28int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]%29), getParent, getResizeWeight, getStartOffset, [getToolTipText](../../../../javax/swing/text/View.html#getToolTipText%28float, float, java.awt.Shape%29), getView, getViewCount, getViewFactory, [getViewIndex](../../../../javax/swing/text/View.html#getViewIndex%28float, float, java.awt.Shape%29), [getViewIndex](../../../../javax/swing/text/View.html#getViewIndex%28int, javax.swing.text.Position.Bias%29), [insert](../../../../javax/swing/text/View.html#insert%28int, javax.swing.text.View%29), [insertUpdate](../../../../javax/swing/text/View.html#insertUpdate%28javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory%29), isVisible, [modelToView](../../../../javax/swing/text/View.html#modelToView%28int, javax.swing.text.Position.Bias, int, javax.swing.text.Position.Bias, java.awt.Shape%29), [modelToView](../../../../javax/swing/text/View.html#modelToView%28int, java.awt.Shape%29), [preferenceChanged](../../../../javax/swing/text/View.html#preferenceChanged%28javax.swing.text.View, boolean, boolean%29), remove, removeAll, [removeUpdate](../../../../javax/swing/text/View.html#removeUpdate%28javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory%29), [replace](../../../../javax/swing/text/View.html#replace%28int, int, javax.swing.text.View[]%29), [setSize](../../../../javax/swing/text/View.html#setSize%28float, float%29), [updateChildren](../../../../javax/swing/text/View.html#updateChildren%28javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, javax.swing.text.ViewFactory%29), [updateLayout](../../../../javax/swing/text/View.html#updateLayout%28javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape%29), [viewToModel](../../../../javax/swing/text/View.html#viewToModel%28float, float, java.awt.Shape%29)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, [wait](../../../../java/lang/Object.html#wait%28long, int%29)
Constructor Detail

ObjectView

public ObjectView(Element elem)

Creates a new ObjectView object.

Parameters:

elem - the element to decorate

Method Detail

createComponent

protected Component createComponent()

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

Overrides:

[createComponent](../../../../javax/swing/text/ComponentView.html#createComponent%28%29) in class [ComponentView](../../../../javax/swing/text/ComponentView.html "class in javax.swing.text")



Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.