Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javax.swing.plaf.basic
Class BasicHTML.HTMLRootView  view BasicHTML.HTMLRootView download BasicHTML.HTMLRootView.java

java.lang.Object
  extended byjavax.swing.text.View
      extended byjavax.swing.plaf.basic.BasicHTML.HTMLRootView
All Implemented Interfaces:
javax.swing.SwingConstants
Enclosing class:
BasicHTML

private static class BasicHTML.HTMLRootView
extends javax.swing.text.View

This class serves as the root view for HTML rendering components. Its purpose and implementation is similar to the BasicTextUI.RootView class, only that is implements some stuff differently due to the nature of not beeing inside a JTextComponent.


Field Summary
private  javax.swing.JComponent component
          The component on which to render the view.
private  javax.swing.text.Document document
          The document to use.
private  javax.swing.text.EditorKit editorKit
          The EditorKit.
private  javax.swing.text.View view
          The real root view.
 
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
BasicHTML.HTMLRootView(javax.swing.JComponent c, javax.swing.text.View view, javax.swing.text.EditorKit kit, javax.swing.text.Document doc)
          Creates a new RootView.
 
Method Summary
 void changedUpdate(javax.swing.event.DocumentEvent ev, java.awt.Shape shape, javax.swing.text.ViewFactory vf)
          Notification about text changes.
 java.awt.Container getContainer()
          Returns the Container that contains this view.
 javax.swing.text.Document getDocument()
           
 int getEndOffset()
           
 int getNextVisualPositionFrom(int pos, javax.swing.text.Position.Bias b, java.awt.Shape a, int d, javax.swing.text.Position.Bias[] biasRet)
          Returns the document position that is (visually) nearest to the given document position pos in the given direction d.
 float getPreferredSpan(int axis)
          Returns the preferred span along the specified axis.
 int getStartOffset()
           
 javax.swing.text.View getView(int index)
          Returns the real root view, regardless of the index.
 int getViewCount()
          Returns 1 since the RootView always contains one child, that is the real root of the View hierarchy.
 javax.swing.text.ViewFactory getViewFactory()
          Returns the ViewFactory for this RootView.
 void insertUpdate(javax.swing.event.DocumentEvent ev, java.awt.Shape shape, javax.swing.text.ViewFactory vf)
          Notification about text insertions.
 java.awt.Shape modelToView(int position, java.awt.Shape a, javax.swing.text.Position.Bias bias)
          Maps a position in the document into the coordinate space of the View.
 void paint(java.awt.Graphics g, java.awt.Shape s)
          Paints the view.
 void preferenceChanged(javax.swing.text.View v, boolean width, boolean height)
          Indicates that the preferences of one of the child view has changed.
 void removeUpdate(javax.swing.event.DocumentEvent ev, java.awt.Shape shape, javax.swing.text.ViewFactory vf)
          Notification about text removals.
 void setView(javax.swing.text.View v)
          Sets the real root view.
 int viewToModel(float x, float y, java.awt.Shape a, javax.swing.text.Position.Bias[] b)
          Maps coordinates from the View's space into a position in the document model.
 
Methods inherited from class javax.swing.text.View
append, breakView, createFragment, dump, forwardUpdate, forwardUpdateToView, getAlignment, getAttributes, getBreakWeight, getChildAllocation, getElement, getGraphics, getMaximumSpan, getMinimumSpan, getParent, getResizeWeight, getToolTipText, getViewIndex, getViewIndex, insert, isVisible, modelToView, modelToView, remove, removeAll, replace, setParent, setSize, updateChildren, updateLayout, viewToModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

view

private javax.swing.text.View view
The real root view.


component

private javax.swing.JComponent component
The component on which to render the view.


editorKit

private javax.swing.text.EditorKit editorKit
The EditorKit.


document

private javax.swing.text.Document document
The document to use.

Constructor Detail

BasicHTML.HTMLRootView

public BasicHTML.HTMLRootView(javax.swing.JComponent c,
                              javax.swing.text.View view,
                              javax.swing.text.EditorKit kit,
                              javax.swing.text.Document doc)
Creates a new RootView.

Method Detail

getViewFactory

public javax.swing.text.ViewFactory getViewFactory()
Returns the ViewFactory for this RootView. If the current EditorKit provides a ViewFactory, this is used. Otherwise the TextUI itself is returned as a ViewFactory.


preferenceChanged

public void preferenceChanged(javax.swing.text.View v,
                              boolean width,
                              boolean height)
Indicates that the preferences of one of the child view has changed. This calls revalidate on the text component.


setView

public void setView(javax.swing.text.View v)
Sets the real root view.


getView

public javax.swing.text.View getView(int index)
Returns the real root view, regardless of the index.


getViewCount

public int getViewCount()
Returns 1 since the RootView always contains one child, that is the real root of the View hierarchy.


getContainer

public java.awt.Container getContainer()
Returns the Container that contains this view. This normally will be the text component that is managed by this TextUI.


getPreferredSpan

public float getPreferredSpan(int axis)
Returns the preferred span along the specified axis. This is delegated to the real root view.


paint

public void paint(java.awt.Graphics g,
                  java.awt.Shape s)
Paints the view. This is delegated to the real root view.


modelToView

public java.awt.Shape modelToView(int position,
                                  java.awt.Shape a,
                                  javax.swing.text.Position.Bias bias)
                           throws javax.swing.text.BadLocationException
Maps a position in the document into the coordinate space of the View. The output rectangle usually reflects the font height but has a width of zero. This is delegated to the real root view.


viewToModel

public int viewToModel(float x,
                       float y,
                       java.awt.Shape a,
                       javax.swing.text.Position.Bias[] b)
Maps coordinates from the View's space into a position in the document model.


insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent ev,
                         java.awt.Shape shape,
                         javax.swing.text.ViewFactory vf)
Notification about text insertions. These are forwarded to the real root view.


removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent ev,
                         java.awt.Shape shape,
                         javax.swing.text.ViewFactory vf)
Notification about text removals. These are forwarded to the real root view.


changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent ev,
                          java.awt.Shape shape,
                          javax.swing.text.ViewFactory vf)
Notification about text changes. These are forwarded to the real root view.


getNextVisualPositionFrom

public int getNextVisualPositionFrom(int pos,
                                     javax.swing.text.Position.Bias b,
                                     java.awt.Shape a,
                                     int d,
                                     javax.swing.text.Position.Bias[] biasRet)
                              throws javax.swing.text.BadLocationException
Returns the document position that is (visually) nearest to the given document position pos in the given direction d.


getStartOffset

public int getStartOffset()

getEndOffset

public int getEndOffset()

getDocument

public javax.swing.text.Document getDocument()