javax.swing.text.html
Class EditableView

java.lang.Object
  extended byjavax.swing.text.View
      extended byjavax.swing.text.ComponentView
          extended byjavax.swing.text.html.EditableView
All Implemented Interfaces:
SwingConstants
Direct Known Subclasses:
HiddenTagView

class EditableView
extends ComponentView

EditableView sets the view it contains to be visible only when the JTextComponent the view is contained in is editable. The min/pref/max size is 0 when not visible.

Author:
Scott Violet

Nested Class Summary
 
Nested classes inherited from class javax.swing.text.ComponentView
 
Field Summary
private  boolean isVisible
          Set to true if the component is visible.
 
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
(package private) EditableView(Element e)
           
 
Method Summary
 float getMaximumSpan(int axis)
          Determines the maximum span for this view along an axis.
 float getMinimumSpan(int axis)
          Determines the minimum span for this view along an axis.
 float getPreferredSpan(int axis)
          Determines the preferred span for this view along an axis.
 boolean isVisible()
          Returns a boolean that indicates whether the view is visible or not.
 void paint(Graphics g, Shape allocation)
          The real paint behavior occurs naturally from the association that the component has with its parent container (the same container hosting this view).
 void setParent(View parent)
          Sets the parent for a child view.
 
Methods inherited from class javax.swing.text.ComponentView
createComponent, getAlignment, getComponent, modelToView, 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, 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
 

Field Detail

isVisible

private boolean isVisible
Set to true if the component is visible. This is based off the editability of the container.

Constructor Detail

EditableView

EditableView(Element e)
Method Detail

getMinimumSpan

public float getMinimumSpan(int axis)
Description copied from class: ComponentView
Determines the minimum span for this view along an axis. This is implemented to return the value returned by Component.getMinimumSize along the axis of interest.

Overrides:
getMinimumSpan in class ComponentView
Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
Returns:
the span the view would like to be rendered into >= 0. 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.

getPreferredSpan

public float getPreferredSpan(int axis)
Description copied from class: ComponentView
Determines the preferred span for this view along an axis. This is implemented to return the value returned by Component.getPreferredSize along the axis of interest.

Overrides:
getPreferredSpan in class ComponentView
Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
Returns:
the span the view would like to be rendered into >= 0. 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.

getMaximumSpan

public float getMaximumSpan(int axis)
Description copied from class: ComponentView
Determines the maximum span for this view along an axis. This is implemented to return the value returned by Component.getMaximumSize along the axis of interest.

Overrides:
getMaximumSpan in class ComponentView
Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
Returns:
the span the view would like to be rendered into >= 0. 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.

paint

public void paint(Graphics g,
                  Shape allocation)
Description copied from class: ComponentView
The real paint behavior occurs naturally from the association that the component has with its parent container (the same container hosting this view). This is implemented to do nothing.

Overrides:
paint in class ComponentView
Parameters:
g - the graphics context
allocation - the shape
See Also:
View.paint(java.awt.Graphics, java.awt.Shape)

setParent

public void setParent(View parent)
Description copied from class: ComponentView
Sets the parent for a child view. The parent calls this on the child to tell it who its parent is, giving the view access to things like the hosting Container. The superclass behavior is executed, followed by a call to createComponent if the parent view parameter is non-null and a component has not yet been created. The embedded components parent is then set to the value returned by getContainer. If the parent view parameter is null, this view is being cleaned up, thus the component is removed from its parent.

The changing of the component hierarchy will touch the component lock, which is the one thing that is not safe from the View hierarchy. Therefore, this functionality is executed immediately if on the event thread, or is queued on the event queue if called from another thread (notification of change from an asynchronous update).

Overrides:
setParent in class ComponentView
Parameters:
parent - the parent

isVisible

public boolean isVisible()
Description copied from class: View
Returns a boolean that indicates whether the view is visible or not. By default all views are visible.

Overrides:
isVisible in class View
Returns:
true if the Component is visible.