|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.text.View oracle.javatools.editor.BasicView
A BasicView
is an implementation of the
View
interface, for rendering the
BasicDocumentElement
used by the
BasicDocument
.
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 | |
BasicView(javax.swing.text.Element elem)
Create a new BasicView based on the given Element. |
Method Summary | |
void |
changedUpdate(javax.swing.event.DocumentEvent e,
java.awt.Shape a,
javax.swing.text.ViewFactory f)
Gives notification from the document that attributes were changed in a location that this view is responsible for. |
int |
getBreakWeight(int axis,
float pos,
float len)
Determines how attractive a break opportunity in this view is. |
float |
getMaximumSpan(int axis)
Determines the maximum span for this view along an axis. |
float |
getMinimumSpan(int axis)
Determine the minimum span for this view along the given axis. |
float |
getPreferredSpan(int axis)
Calculate the span of this view based on the size of the underlying document (number of lines, widest line.) |
void |
insertUpdate(javax.swing.event.DocumentEvent e,
java.awt.Shape a,
javax.swing.text.ViewFactory f)
Gives notification that something was inserted into the document in a location that this view is responsible for. |
java.awt.Shape |
modelToView(int startOffset,
javax.swing.text.Position.Bias startBias,
int endOffset,
javax.swing.text.Position.Bias endBias,
java.awt.Shape viewShape)
Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it. |
java.awt.Shape |
modelToView(int offset,
java.awt.Shape viewShape,
javax.swing.text.Position.Bias bias)
Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it. |
void |
paint(java.awt.Graphics graphics,
java.awt.Shape viewShape)
Renders using the given rendering surface and area on that surface. |
protected int |
paintLine(java.awt.Graphics graphics,
TextBuffer textBuffer,
java.awt.Rectangle viewRect,
java.awt.Rectangle clipRect,
int line,
StyledFragmentsList styledList,
int styledIndex,
HighlightedFragmentsList highlightedList)
Paints the specified line of the view with the given styles and highlights. |
protected void |
paintRightMargin(java.awt.Graphics graphics,
java.awt.Rectangle viewRect,
java.awt.Rectangle clipRect)
Paints the right margin line - this will check the current properties to see whether, where, and what color to paint the right margin. |
protected int |
paintSegment(java.awt.Graphics graphics,
TextBuffer textBuffer,
java.awt.Rectangle viewRect,
java.awt.Rectangle clipRect,
BaseStyle textStyle,
HighlightStyle highlightStyle,
int startOffset,
int endOffset,
int x,
int y)
Paints a small segment text indicated by the start and end offsets. |
protected void |
paintUnderlines(java.awt.Graphics graphics,
java.awt.Rectangle viewRect,
java.awt.Rectangle clipRect,
TextBuffer textBuffer,
StyledFragmentsList styledList,
int startLine,
int endLine)
Paints the underlines in the editor view. |
void |
propertyChange(java.beans.PropertyChangeEvent event)
This method gets called when a bound property is changed. |
void |
removeUpdate(javax.swing.event.DocumentEvent e,
java.awt.Shape a,
javax.swing.text.ViewFactory f)
Gives notification from the document that attributes were removed in a location that this view is responsible for. |
protected void |
updateDamage(javax.swing.event.DocumentEvent changes,
java.awt.Shape viewShape,
javax.swing.text.ViewFactory factory)
Figures out what part of the view needs to be repainted based on the given change. |
int |
viewToModel(float fx,
float fy,
java.awt.Shape viewShape,
javax.swing.text.Position.Bias[] biasReturn)
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, createFragment, forwardUpdate, forwardUpdateToView, getAlignment, getAttributes, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, isVisible, modelToView, preferenceChanged, 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 |
Constructor Detail |
public BasicView(javax.swing.text.Element elem)
Method Detail |
public void paint(java.awt.Graphics graphics, java.awt.Shape viewShape)
graphics
- the rendering surface to useviewShape
- the allocated region to render intoView.paint(java.awt.Graphics, java.awt.Shape)
protected void paintUnderlines(java.awt.Graphics graphics, java.awt.Rectangle viewRect, java.awt.Rectangle clipRect, TextBuffer textBuffer, StyledFragmentsList styledList, int startLine, int endLine)
graphics
- the graphics contextviewRect
- the rectangle of the view area (for insets/margins)clipRect
- the rectangle of the clipped area that should be paintedtextBuffer
- the text bufferstyledList
- the styled fragments liststartLine
- the starting line (inclusive)endLine
- the ending line (exclusive)protected void paintRightMargin(java.awt.Graphics graphics, java.awt.Rectangle viewRect, java.awt.Rectangle clipRect)
graphics
- the graphics contextviewRect
- the rectangle of the view area (for insets/margins)clipRect
- the rectangle of the clipped area that should be paintedprotected int paintLine(java.awt.Graphics graphics, TextBuffer textBuffer, java.awt.Rectangle viewRect, java.awt.Rectangle clipRect, int line, StyledFragmentsList styledList, int styledIndex, HighlightedFragmentsList highlightedList)
graphics
- the graphics contexttextBuffer
- the data we are paintingviewRect
- the rectangle of the view area (for insets/margins)clipRect
- the rectangle of the clipped area that should be paintedline
- the line to paintstyledList
- the list of Styled FragmentsstyledIndex
- the styled fragment to start fromhighlightedList
- the list of Highlighted Fragments
protected int paintSegment(java.awt.Graphics graphics, TextBuffer textBuffer, java.awt.Rectangle viewRect, java.awt.Rectangle clipRect, BaseStyle textStyle, HighlightStyle highlightStyle, int startOffset, int endOffset, int x, int y)
graphics
- the graphics contexttextBuffer
- the text buffer with our dataviewRect
- the rectangle of the main view (for editor insets)clipRect
- the rectangle of the clipped area that should be paintedtextStyle
- the text style to paint this segment withhighlightStyle
- the overriding highlight style to paint withstartOffset
- the starting offset of this segment of textendOffset
- the ending offset of this segment of textx
- the x position to start painting the text aty
- the y position to paint the text at
public java.awt.Shape modelToView(int offset, java.awt.Shape viewShape, javax.swing.text.Position.Bias bias) throws javax.swing.text.BadLocationException
offset
- the position to convert >= 0viewShape
- the allocated region to render intobias
- the bias toward the previous character or the next
character represented by the offset, in case the
position is a boundary of two views.
javax.swing.text.BadLocationException
- if the given position does
not represent a valid location in the associated document
java.lang.IllegalArgumentException
- for an invalid bias argumentView.viewToModel(float, float, java.awt.Shape)
public java.awt.Shape modelToView(int startOffset, javax.swing.text.Position.Bias startBias, int endOffset, javax.swing.text.Position.Bias endBias, java.awt.Shape viewShape) throws javax.swing.text.BadLocationException
startOffset
- the starting offset of the region to modelstartBias
- the bias of the starting offsetendOffset
- the ending offset of the region to modelendBias
- the bias of the ending offsetviewShape
- the allocated region to render into
javax.swing.text.BadLocationException
- if the given position does not
represent a valid location in the associated document
java.lang.IllegalArgumentException
- for an invalid bias argumentView.viewToModel(float, float, java.awt.Shape)
public int viewToModel(float fx, float fy, java.awt.Shape viewShape, javax.swing.text.Position.Bias[] biasReturn)
fx
- the X coordinate >= 0fy
- the Y coordinate >= 0viewShape
- the allocated region to render intobiasReturn
- the bias for the offset
protected void updateDamage(javax.swing.event.DocumentEvent changes, java.awt.Shape viewShape, javax.swing.text.ViewFactory factory)
public void insertUpdate(javax.swing.event.DocumentEvent e, java.awt.Shape a, javax.swing.text.ViewFactory f)
e
- the change information from the associated documenta
- the current allocation of the viewf
- the factory to use to rebuild if the view has childrenView.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
public void removeUpdate(javax.swing.event.DocumentEvent e, java.awt.Shape a, javax.swing.text.ViewFactory f)
e
- the change information from the associated documenta
- the current allocation of the viewf
- the factory to use to rebuild if the view has childrenView.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
public void changedUpdate(javax.swing.event.DocumentEvent e, java.awt.Shape a, javax.swing.text.ViewFactory f)
e
- the change information from the associated documenta
- the current allocation of the viewf
- the factory to use to rebuild if the view has childrenView.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
public float getPreferredSpan(int axis)
axis
- the axis to calculate
public float getMinimumSpan(int axis)
axis
- may be either View.X_AXIS or View.Y_AXISpublic float getMaximumSpan(int axis)
axis
- may be either View.X_AXIS or View.Y_AXISpublic int getBreakWeight(int axis, float pos, float len)
axis
- may be either View.X_AXIS or View.Y_AXISpos
- the potential location of the start of the
broken view >= 0. This may be useful for calculating tab
positions.len
- specifies the relative length from pos
where a potential break is desired >= 0.
public void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
event
- A PropertyChangeEvent object describing the event source
and the property that has changed.
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.