com.lightdev.app.shtm
Class InvisibleView

java.lang.Object
  extended by javax.swing.text.View
      extended by com.lightdev.app.shtm.InvisibleView
All Implemented Interfaces:
javax.swing.SwingConstants

public class InvisibleView
extends javax.swing.text.View

A view to hide HTML tags (e.g. comments)


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
InvisibleView(javax.swing.text.Element e)
          constructor
 
Method Summary
 float getMaximumSpan()
          Determines the maximum span for this view along an axis.
 float getMinimumSpan()
          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()
           
 java.awt.Shape modelToView(int pos, java.awt.Shape a, javax.swing.text.Position.Bias b)
          Provides a mapping, for a given character, from the document model coordinate space to the view coordinate space.
 void paint(java.awt.Graphics g, java.awt.Shape allocation)
          Renders using the given rendering surface and area on that surface.
 void setParent(javax.swing.text.View parent)
          Establishes the parent view for this view.
 int viewToModel(float x, float y, java.awt.Shape a, javax.swing.text.Position.Bias[] parm4)
          Provides a mapping from the view coordinate space to the logical coordinate space of the model.
 
Methods inherited from class javax.swing.text.View
append, breakView, changedUpdate, createFragment, forwardUpdate, forwardUpdateToView, getAlignment, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, 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
 

Constructor Detail

InvisibleView

public InvisibleView(javax.swing.text.Element e)
constructor

Method Detail

getPreferredSpan

public float getPreferredSpan(int axis)
Determines the preferred span for this view along an axis.

Specified by:
getPreferredSpan in class javax.swing.text.View
Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
Returns:
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 Also:
View.getPreferredSpan(int)

getMaximumSpan

public float getMaximumSpan()
Determines the maximum span for this view along an axis.

Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
Returns:
the maximum span the view can be rendered into
See Also:
View.getPreferredSpan(int)

getMinimumSpan

public float getMinimumSpan()
Determines the minimum span for this view along an axis.

Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
Returns:
the minimum span the view can be rendered into
See Also:
View.getPreferredSpan(int)

paint

public void paint(java.awt.Graphics g,
                  java.awt.Shape allocation)
Renders using the given rendering surface and area on that surface. The view may need to do layout and create child views to enable itself to render into the given allocation.

Specified by:
paint in class javax.swing.text.View
Parameters:
g - the rendering surface to use
allocation - the allocated region to render into
See Also:
View.paint(java.awt.Graphics, java.awt.Shape)

viewToModel

public int viewToModel(float x,
                       float y,
                       java.awt.Shape a,
                       javax.swing.text.Position.Bias[] parm4)
Provides a mapping from the view coordinate space to the logical coordinate space of the model. The biasReturn argument will be filled in to indicate that the point given is closer to the next character in the model or the previous character in the model.

Specified by:
viewToModel in class javax.swing.text.View
Parameters:
x - the X coordinate >= 0
y - the Y coordinate >= 0
a - the allocated region in which to render
Returns:
the location within the model that best represents the given point in the view >= 0. The biasReturn argument will be filled in to indicate that the point given is closer to the next character in the model or the previous character in the model.

modelToView

public java.awt.Shape modelToView(int pos,
                                  java.awt.Shape a,
                                  javax.swing.text.Position.Bias b)
                           throws javax.swing.text.BadLocationException
Provides a mapping, for a given character, from the document model coordinate space to the view coordinate space.

Specified by:
modelToView in class javax.swing.text.View
Parameters:
pos - the position of the desired character (>=0)
a - the area of the view, which encompasses the requested character
b - the bias toward the previous character or the next character represented by the offset, in case the position is a boundary of two views; b will have one of these values:
  • Position.Bias.Forward
  • Position.Bias.Backward
Returns:
the bounding box, in view coordinate space, of the character at the specified position
Throws:
javax.swing.text.BadLocationException - if the specified position does not represent a valid location in the associated document
java.lang.IllegalArgumentException - if b is not one of the legal Position.Bias values listed above
See Also:
View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])

setParent

public void setParent(javax.swing.text.View parent)
Establishes the parent view for this view. This is guaranteed to be called before any other methods if the parent view is functioning properly. This is also the last method called, since it is called to indicate the view has been removed from the hierarchy as well. When this method is called to set the parent to null, this method does the same for each of its children, propogating the notification that they have been disconnected from the view tree. If this is reimplemented, super.setParent() should be called.

Overrides:
setParent in class javax.swing.text.View
Parameters:
parent - the new parent, or null if the view is being removed from a parent

isVisible

public boolean isVisible()
Overrides:
isVisible in class javax.swing.text.View
Returns:
true if the Component is visible.