The line views do all of their rendering through the
drawLine method which in turn does all of
its rendering through the drawSelectedText
and drawUnselectedText methods. This
enables subclasses to easily specialize the rendering
without concern for the layout aspects.
View
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class | WrappedPlainView.
Simple view of a line that wraps if it doesn't fit within the horizontal space allocated. |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final boolean | |
| private final boolean | |
| pack-priv Segment | |
| pack-priv FontMetrics | |
| pack-priv int | |
| pack-priv int | |
| pack-priv Color | |
| pack-priv int | |
| pack-priv float | |
| pack-priv Color | |
| private final boolean | |
| pack-priv boolean | |
| pack-priv boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public | WrappedPlainView(Element
the element underlying the view elem, boolean should lines be wrapped on word boundaries? wordWrap)Creates a new WrappedPlainView. |
| Modifier and Type | Method and Description |
|---|---|
| protected int | Returns: the break positionthe starting document location p0, int the ending document location to use p1)This is called by the nested wrapped line views to determine the break location. |
| private float | |
| private float | |
| public void | changedUpdate(DocumentEvent
the change information from the associated document e, Shape the current allocation of the view a, ViewFactory the factory to use to rebuild if the view has children f)Overrides javax. Gives notification from the document that attributes were changed in a location that this view is responsible for. |
| protected void | drawLine(int
the starting document location to use >= 0 p0, int the ending document location to use >= p1 p1, Graphics the graphics context g, int the starting X position >= 0 x, int the starting Y position >= 0 y)
Deprecated
since 9. replaced by
drawLine(int, int, Graphics2D, float, float)
Renders a line of text, suppressing whitespace at the end and expanding any tabs. |
| protected void | drawLine(int
the starting document location to use >= 0 p0, int the ending document location to use >= p1 p1, Graphics2D the graphics context g, float the starting X position >= 0 x, float the starting Y position >= 0 y)Renders a line of text, suppressing whitespace at the end and expanding any tabs. |
| private void | |
| protected int | Returns: the location of the end of the range.the graphics context g, int the starting X coordinate >= 0 x, int the starting Y coordinate >= 0 y, int the beginning position in the model >= 0 p0, int the ending position in the model >= p0 p1)
Deprecated
since 9. replaced by
drawSelectedText(Graphics2D, float, float, int, int)
Renders the given range in the model as selected text. |
| protected float | Returns: the location of the end of the range.the graphics context g, float the starting X coordinate >= 0 x, float the starting Y coordinate >= 0 y, int the beginning position in the model >= 0 p0, int the ending position in the model >= p0 p1)Renders the given range in the model as selected text. |
| private float | |
| private float | |
| protected int | Returns: the X location of the end of the range >= 0the graphics context g, int the starting X coordinate >= 0 x, int the starting Y coordinate >= 0 y, int the beginning position in the model >= 0 p0, int the ending position in the model >= p0 p1)
Deprecated
since 9. replaced by
drawUnselectedText(Graphics2D, float, float, int, int)
Renders the given range in the model as normal unselected text. |
| protected float | Returns: the X location of the end of the range >= 0the graphics context g, float the starting X coordinate >= 0 x, float the starting Y coordinate >= 0 y, int the beginning position in the model >= 0 p0, int the ending position in the model >= p0 p1)Renders the given range in the model as normal unselected text. |
| private float | |
| protected final Segment | Returns: the bufferGives access to a buffer that can be used to fetch text from the associated document. |
| public float | 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.may be either View.X_AXIS or View.Y_AXIS axis)Overrides javax. Determines the maximum span for this view along an axis. |
| public float | 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.may be either View.X_AXIS or View.Y_AXIS axis)Overrides javax. Determines the minimum span for this view along an axis. |
| public float | 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.may be either View.X_AXIS or View.Y_AXIS axis)Overrides javax. Determines the preferred span for this view along an axis. |
| protected int | |
| public void | insertUpdate(DocumentEvent
the change information from the associated document e, Shape the current allocation of the view a, ViewFactory the factory to use to rebuild if the view has children f)Overrides javax. Gives notification that something was inserted into the document in a location that this view is responsible for. |
| protected void | loadChildren(ViewFactory
the view factory f)Overrides javax. Loads all of the children to initialize the view. |
| pack-priv final void | |
| public float | Returns: the tab stop, measured in points >= 0the current position >= 0 x, int the position within the text stream
that the tab occurred at >= 0. tabOffset)Implements javax. Returns the next tab stop position after a given reference position. |
| public void | paint(Graphics
the rendering surface to use g, Shape the allocated region to render into a)Overrides javax. Renders using the given rendering surface and area on that surface. |
| public void | removeUpdate(DocumentEvent
the change information from the associated document e, Shape the current allocation of the view a, ViewFactory the factory to use to rebuild if the view has children f)Overrides javax. Gives notification that something was removed from the document in a location that this view is responsible for. |
| public void | setSize(float
the width >= 0 width, float the height >= 0 height)Overrides javax. Sets the size of the view. |
| pack-priv void | |
| pack-priv final void |
| drawLineOverridden | back to summary |
|---|---|
| private final boolean drawLineOverridden | |
| drawSelectedTextOverridden | back to summary |
|---|---|
| private final boolean drawSelectedTextOverridden | |
| drawUnselectedTextOverridden | back to summary |
|---|---|
| private final boolean drawUnselectedTextOverridden | |
| lineBuffer | back to summary |
|---|---|
| pack-priv Segment lineBuffer | |
| metrics | back to summary |
|---|---|
| pack-priv FontMetrics metrics | |
| sel0 | back to summary |
|---|---|
| pack-priv int sel0 | |
| sel1 | back to summary |
|---|---|
| pack-priv int sel1 | |
| selected | back to summary |
|---|---|
| pack-priv Color selected | |
| tabBase | back to summary |
|---|---|
| pack-priv int tabBase | |
| tabSize | back to summary |
|---|---|
| pack-priv float tabSize | |
| unselected | back to summary |
|---|---|
| pack-priv Color unselected | |
| useFloatingPointAPI | back to summary |
|---|---|
| private final boolean useFloatingPointAPI | |
| widthChanging | back to summary |
|---|---|
| pack-priv boolean widthChanging | |
| wordWrap | back to summary |
|---|---|
| pack-priv boolean wordWrap | |
| WrappedPlainView | back to summary |
|---|---|
| public WrappedPlainView(Element elem) Creates a new WrappedPlainView. Lines will be wrapped on character boundaries.
| |
| WrappedPlainView | back to summary |
|---|---|
| public WrappedPlainView(Element elem, boolean wordWrap) Creates a new WrappedPlainView. Lines can be wrapped on either character or word boundaries depending upon the setting of the wordWrap parameter.
| |
| calculateBreakPosition | back to summary |
|---|---|
| protected int calculateBreakPosition(int p0, int p1) This is called by the nested wrapped line views to determine the break location. This can be reimplemented to alter the breaking behavior. It will either break at word or character boundaries depending upon the break argument given at construction.
| |
| callDrawSelectedText | back to summary |
|---|---|
| private float callDrawSelectedText(Graphics g, float x, float y, int p0, int p1) throws BadLocationException | |
| callDrawUnselectedText | back to summary |
|---|---|
| private float callDrawUnselectedText(Graphics g, float x, float y, int p0, int p1) throws BadLocationException | |
| changedUpdate | back to summary |
|---|---|
| public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f) Overrides javax. Gives notification from the document that attributes were changed in a location that this view is responsible for.
| |
| drawLine | back to summary |
|---|---|
| protected void drawLine(int p0, int p1, Graphics g, int x, int y)
Renders a line of text, suppressing whitespace at the end
and expanding any tabs. This is implemented to make calls
to the methods
| |
| drawLine | back to summary |
|---|---|
| protected void drawLine(int p0, int p1, Graphics2D g, float x, float y) Renders a line of text, suppressing whitespace at the end
and expanding any tabs. This is implemented to make calls
to the methods
| |
| drawLineImpl | back to summary |
|---|---|
| private void drawLineImpl(int p0, int p1, Graphics g, float x, float y, boolean useFPAPI) | |
| drawSelectedText | back to summary |
|---|---|
| protected int drawSelectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException
Renders the given range in the model as selected text. This is implemented to render the text in the color specified in the hosting component. It assumes the highlighter will render the selected background.
| |
| drawSelectedText | back to summary |
|---|---|
| protected float drawSelectedText(Graphics2D g, float x, float y, int p0, int p1) throws BadLocationException Renders the given range in the model as selected text. This is implemented to render the text in the color specified in the hosting component. It assumes the highlighter will render the selected background.
| |
| drawSelectedTextImpl | back to summary |
|---|---|
| private float drawSelectedTextImpl(Graphics g, float x, float y, int p0, int p1, boolean useFPAPI) throws BadLocationException | |
| drawText | back to summary |
|---|---|
| private float drawText(Element elem, int p0, int p1, Graphics g, float x, float y) throws BadLocationException | |
| drawUnselectedText | back to summary |
|---|---|
| protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException
Renders the given range in the model as normal unselected text.
| |
| drawUnselectedText | back to summary |
|---|---|
| protected float drawUnselectedText(Graphics2D g, float x, float y, int p0, int p1) throws BadLocationException Renders the given range in the model as normal unselected text.
| |
| drawUnselectedTextImpl | back to summary |
|---|---|
| private float drawUnselectedTextImpl(Graphics g, float x, float y, int p0, int p1, boolean useFPAPI) throws BadLocationException | |
| getLineBuffer | back to summary |
|---|---|
| protected final Segment getLineBuffer() Gives access to a buffer that can be used to fetch text from the associated document.
| |
| getMaximumSpan | back to summary |
|---|---|
| public float getMaximumSpan(int axis) Overrides javax. Determines the maximum span for this view along an axis. This is implemented to provide the superclass behavior after first making sure that the current font metrics are cached (for the nested lines which use the metrics to determine the height of the potentially wrapped lines).
| |
| getMinimumSpan | back to summary |
|---|---|
| public float getMinimumSpan(int axis) Overrides javax. Determines the minimum span for this view along an axis. This is implemented to provide the superclass behavior after first making sure that the current font metrics are cached (for the nested lines which use the metrics to determine the height of the potentially wrapped lines).
| |
| getPreferredSpan | back to summary |
|---|---|
| public float getPreferredSpan(int axis) Overrides javax. Determines the preferred span for this view along an axis. This is implemented to provide the superclass behavior after first making sure that the current font metrics are cached (for the nested lines which use the metrics to determine the height of the potentially wrapped lines).
| |
| getTabSize | back to summary |
|---|---|
| protected int getTabSize() Returns the tab size set for the document, defaulting to 8.
| |
| insertUpdate | back to summary |
|---|---|
| public void insertUpdate(DocumentEvent e, Shape a, ViewFactory f) Overrides javax. Gives notification that something was inserted into the document in a location that this view is responsible for. This is implemented to simply update the children.
| |
| loadChildren | back to summary |
|---|---|
| protected void loadChildren(ViewFactory f) Overrides javax. Loads all of the children to initialize the view.
This is called by the
| |
| loadText | back to summary |
|---|---|
| pack-priv final void loadText(Segment segment, int p0, int p1) Load the text buffer with the given range of text. This is used by the fragments broken off of this view as well as this view itself. | |
| nextTabStop | back to summary |
|---|---|
| public float nextTabStop(float x, int tabOffset) Implements javax. Returns the next tab stop position after a given reference position. This implementation does not support things like centering so it ignores the tabOffset argument.
| |
| paint | back to summary |
|---|---|
| public void paint(Graphics g, Shape a) Overrides javax. Renders using the given rendering surface and area on that surface. This is implemented to stash the selection positions, selection colors, and font metrics for the nested lines to use.
| |
| removeUpdate | back to summary |
|---|---|
| public void removeUpdate(DocumentEvent e, Shape a, ViewFactory f) Overrides javax. Gives notification that something was removed from the document in a location that this view is responsible for. This is implemented to simply update the children.
| |
| setSize | back to summary |
|---|---|
| public void setSize(float width, float height) Overrides javax. Sets the size of the view. This should cause layout of the view along the given axis, if it has any layout duties.
| |
| updateChildren | back to summary |
|---|---|
| pack-priv void updateChildren(DocumentEvent e, Shape a) Update the child views in response to a document event. | |
| updateMetrics | back to summary |
|---|---|
| pack-priv final void updateMetrics() | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv SoftReference | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv final int[] | Returns: the cache created, ot null if text breaks into one lineposition to start breaking from startPos)Creates line cache if text breaks into more than one physical line. |
| private int | findLine(int offset)
Binary search in the cache for line containing specified offset (which is relative to the beginning of the view). |
| private int | |
| pack-priv final int[] | |
| public float | 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.may be either X_AXIS or Y_AXIS axis)Implements abstract javax. Determines the preferred span for this view along an axis. |
| public void | insertUpdate(DocumentEvent e, Shape a, ViewFactory f)
Overrides javax. Gives notification that something was inserted into the document in a location that this view is responsible for. |
| public Shape | Returns: the bounding box of the given position is returnedthe position to convert pos, Shape the allocated region to render into a, Position.Implements abstract javax. Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it. |
| public void | paint(Graphics
the rendering surface to use g, Shape the allocated region to render into a)Implements abstract javax. Renders using the given rendering surface and area on that surface. |
| public void | removeUpdate(DocumentEvent e, Shape a, ViewFactory f)
Overrides javax. Gives notification that something was removed from the document in a location that this view is responsible for. |
| private void | |
| public int | Returns: the location within the model that best represents the given point in the viewthe X coordinate fx, float the Y coordinate fy, Shape the allocated region to render into a, Position.Implements abstract javax. Provides a mapping from the view coordinate space to the logical coordinate space of the model. |
| lineCache | back to summary |
|---|---|
| pack-priv SoftReference<int[]> lineCache | |
| lineCount | back to summary |
|---|---|
| pack-priv int lineCount | |
| WrappedLine | back to summary |
|---|---|
| pack-priv WrappedLine(Element elem) | |
| breakLines | back to summary |
|---|---|
| pack-priv final int[] breakLines(int startPos) Creates line cache if text breaks into more than one physical line.
| |
| findLine | back to summary |
|---|---|
| private int findLine(int offset) Binary search in the cache for line containing specified offset (which is relative to the beginning of the view). This method assumes that cache exists. | |
| findLine | back to summary |
|---|---|
| private int findLine(int[] array, int offset, int min, int max) | |
| getLineEnds | back to summary |
|---|---|
| pack-priv final int[] getLineEnds() Returns line cache. If the cache was GC'ed, recreates it. If there's no cache, returns null | |
| getPreferredSpan | back to summary |
|---|---|
| public float getPreferredSpan(int axis) Implements abstract javax. Determines the preferred span for this view along an axis.
| |
| insertUpdate | back to summary |
|---|---|
| public void insertUpdate(DocumentEvent e, Shape a, ViewFactory f) Overrides javax. Doc from javax. Gives notification that something was inserted into the document in a location that this view is responsible for. To reduce the burden to subclasses, this functionality is spread out into the following calls that subclasses can reimplement:
| |
| modelToView | back to summary |
|---|---|
| public Shape modelToView(int pos, Shape a, Position. Implements abstract javax. Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.
| |
| paint | back to summary |
|---|---|
| public void paint(Graphics g, Shape a) Implements abstract javax. 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.
| |
| removeUpdate | back to summary |
|---|---|
| public void removeUpdate(DocumentEvent e, Shape a, ViewFactory f) Overrides javax. Doc from javax. Gives notification that something was removed from the document in a location that this view is responsible for. To reduce the burden to subclasses, this functionality is spread out into the following calls that subclasses can reimplement:
| |
| update | back to summary |
|---|---|
| private void update(DocumentEvent ev, Shape a) | |
| viewToModel | back to summary |
|---|---|
| public int viewToModel(float fx, float fy, Shape a, Position. Implements abstract javax. Provides a mapping from the view coordinate space to the logical coordinate space of the model.
| |