FileDocCategorySizeDatePackage
NoFramesView.javaAPI DocJava SE 6 API4346Tue Jun 10 00:27:00 BST 2008javax.swing.text.html

NoFramesView

public class NoFramesView extends BlockView
This is the view associated with the html tag NOFRAMES. This view has been written to ignore the contents of the NOFRAMES tag. The contents of the tag will only be visible when the JTextComponent the view is contained in is editable.
author
Sunita Mani
version
1.10 11/17/05

Fields Summary
boolean
visible
Constructors Summary
public NoFramesView(Element elem, int axis)
Creates a new view that represents an html box. This can be used for a number of elements. By default this view is not visible.

param
elem the element to create a view for
param
axis either View.X_AXIS or View.Y_AXIS

	super(elem, axis);
	visible = false;
    
Methods Summary
public floatgetMaximumSpan(int axis)
Determines the maximum span for this view along an axis. Returns 0 if the view is not visible, otherwise it calls the superclass method ot get the maximum span.

param
axis may be either View.X_AXIS or View.Y_AXIS
return
the maximum span the view can be rendered into
see
text.ParagraphView#getMaximumSpan

	if (!visible) {
	    return 0;
	}
	return super.getMaximumSpan(axis);
    
public floatgetMinimumSpan(int axis)
Determines the minimum span for this view along an axis. Returns 0 if the view is not visible, otherwise it calls the superclass method to get the minimum span.

param
axis may be either View.X_AXIS or View.Y_AXIS
return
the minimum span the view can be rendered into
see
text.ParagraphView#getMinimumSpan

	if (!visible) {
	    return 0;
	}
	return super.getMinimumSpan(axis);
    
public floatgetPreferredSpan(int axis)
Determines the preferred span for this view. Returns 0 if the view is not visible, otherwise it calls the superclass method to get the preferred span. axis.

param
axis may be either View.X_AXIS or View.Y_AXIS
return
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
see
text.ParagraphView#getPreferredSpan

       	if (!visible) {
	    return 0;
	}
	return super.getPreferredSpan(axis);
    
public booleanisVisible()
Returns a true/false value that represents whether the view is visible or not.

	return visible;
    
protected voidlayout(int width, int height)
Do nothing if the view is not visible, otherwise invoke the superclass to perform layout.

	if (!isVisible()) {
	    return;
	}
	super.layout(width, height);   
    
public voidpaint(java.awt.Graphics g, java.awt.Shape allocation)
If this view is not visible, then it returns. Otherwise it invokes the superclass.

param
g the rendering surface to use
param
allocation the allocated region to render into
see
#isVisible
see
text.ParagraphView#paint

	Container host = getContainer();
	if (host != null &&
	    visible != ((JTextComponent)host).isEditable()) {
	    visible = ((JTextComponent)host).isEditable();
	}

	if (!isVisible()) {
	    return;
	}
	super.paint(g, allocation);
    
public voidsetParent(javax.swing.text.View p)
Determines if the JTextComponent that the view is contained in is editable. If so, then this view and all its child views are visible. Once this has been determined, the superclass is invoked to continue processing.

param
p the parent View.
see
BlockView#setParent

	if (p != null) {
	    Container host = p.getContainer();
	    if (host != null) {
		visible = ((JTextComponent)host).isEditable();
	    }
	}
	super.setParent(p);