|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.text.View javax.swing.plaf.basic.BasicHTML.Renderer
Root text view that acts as an HTML renderer.
Field Summary | |
private ViewFactory |
factory
|
private JComponent |
host
|
private View |
view
|
private int |
width
|
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) |
BasicHTML.Renderer(JComponent c,
ViewFactory f,
View v)
|
Method Summary | |
float |
getAlignment(int axis)
Determines the desired alignment for this view along an axis. |
AttributeSet |
getAttributes()
Fetches the attributes to use when rendering. |
Container |
getContainer()
Fetches the container hosting the view. |
Document |
getDocument()
Returns the document model underlying the view. |
Element |
getElement()
Gets the element that this view is mapped to. |
int |
getEndOffset()
Returns the ending offset into the model for this view. |
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. |
int |
getStartOffset()
Returns the starting offset into the model for this view. |
View |
getView(int n)
Gets the n-th view in this container. |
int |
getViewCount()
Returns the number of views in this view. |
ViewFactory |
getViewFactory()
Fetches the factory to be used for building the various view fragments that make up the view that represents the model. |
Shape |
modelToView(int p0,
Position.Bias b0,
int p1,
Position.Bias b1,
Shape a)
Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it. |
Shape |
modelToView(int pos,
Shape a,
Position.Bias b)
Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it. |
void |
paint(Graphics g,
Shape allocation)
Renders the view. |
void |
preferenceChanged(View child,
boolean width,
boolean height)
Specifies that a preference has changed. |
void |
setParent(View parent)
Sets the view parent. |
void |
setSize(float width,
float height)
Sets the view size. |
int |
viewToModel(float x,
float y,
Shape a,
Position.Bias[] bias)
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, getBreakWeight, getChildAllocation, getGraphics, getNextVisualPositionFrom, getParent, getResizeWeight, getToolTipText, getViewIndex, getViewIndex, insert, insertUpdate, isVisible, modelToView, remove, removeAll, removeUpdate, replace, updateChildren, updateLayout, viewToModel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private int width
private View view
private ViewFactory factory
private JComponent host
Constructor Detail |
BasicHTML.Renderer(JComponent c, ViewFactory f, View v)
Method Detail |
public AttributeSet getAttributes()
getAttributes
in class View
public float getPreferredSpan(int axis)
getPreferredSpan
in class View
axis
- may be either X_AXIS or Y_AXIS
View.getPreferredSpan(int)
public float getMinimumSpan(int axis)
getMinimumSpan
in class View
axis
- may be either X_AXIS or Y_AXIS
View.getPreferredSpan(int)
public float getMaximumSpan(int axis)
getMaximumSpan
in class View
axis
- may be either X_AXIS or Y_AXIS
View.getPreferredSpan(int)
public void preferenceChanged(View child, boolean width, boolean height)
This can be called on a different thread from the event dispatching thread and is basically unsafe to propagate into the component. To make this safe, the operation is transferred over to the event dispatching thread for completion. It is a design goal that all view methods be safe to call without concern for concurrency, and this behavior helps make that true.
preferenceChanged
in class View
child
- the child viewwidth
- true if the width preference has changedheight
- true if the height preference has changedJComponent.revalidate()
public float getAlignment(int axis)
getAlignment
in class View
axis
- may be either X_AXIS or Y_AXIS
public void paint(Graphics g, Shape allocation)
paint
in class View
g
- the graphics contextallocation
- the region to render intoView.paint(java.awt.Graphics, java.awt.Shape)
public void setParent(View parent)
setParent
in class View
parent
- the parent viewpublic int getViewCount()
getViewCount
in class View
getView(int)
public View getView(int n)
getView
in class View
n
- the number of the view to get
public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException
modelToView
in class View
pos
- the position to converta
- the allocated region to render intob
- 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
BadLocationException
- if the specified position does
not represent a valid location in the associated documentView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])
public Shape modelToView(int p0, Position.Bias b0, int p1, Position.Bias b1, Shape a) throws BadLocationException
modelToView
in class View
p0
- the position to convert >= 0b0
- the bias toward the previous character or the
next character represented by p0, in case the
position is a boundary of two views.p1
- the position to convert >= 0b1
- the bias toward the previous character or the
next character represented by p1, in case the
position is a boundary of two views.a
- the allocated region to render into
BadLocationException
- if the given position does
not represent a valid location in the associated document
IllegalArgumentException
- for an invalid bias argumentView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])
public int viewToModel(float x, float y, Shape a, Position.Bias[] bias)
viewToModel
in class View
x
- x coordinate of the view location to converty
- y coordinate of the view location to converta
- the allocated region to render into
public Document getDocument()
getDocument
in class View
View.getDocument()
public int getStartOffset()
getStartOffset
in class View
View.getStartOffset()
public int getEndOffset()
getEndOffset
in class View
View.getEndOffset()
public Element getElement()
getElement
in class View
View.getElement()
public void setSize(float width, float height)
setSize
in class View
width
- the widthheight
- the heightpublic Container getContainer()
getContainer
in class View
public ViewFactory getViewFactory()
getViewFactory
in class View
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |