public class WrappedPlainView extends BoxView implements TabExpander
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXISBOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST| Constructor and Description |
|---|
WrappedPlainView(Element elem) |
WrappedPlainView(Element elem,
boolean wordWrap) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
calculateBreakPosition(int p0,
int p1)
Calculates the break position for the text between model positions
p0 and p1.
|
void |
changedUpdate(DocumentEvent e,
Shape a,
ViewFactory f)
Called when the portion of the Document that this View is responsible
for changes.
|
protected void |
drawLine(int p0,
int p1,
Graphics g,
int x,
int y)
Draws a line of text, suppressing white space at the end and expanding
tabs.
|
protected int |
drawSelectedText(Graphics g,
int x,
int y,
int p0,
int p1)
Renders the range of text as selected text.
|
protected int |
drawUnselectedText(Graphics g,
int x,
int y,
int p0,
int p1)
Renders the range of text as normal unhighlighted text.
|
protected Segment |
getLineBuffer()
Provides access to the Segment used for retrievals from the Document.
|
float |
getMaximumSpan(int axis)
Determines the maximum span along the given axis.
|
float |
getMinimumSpan(int axis)
Determines the minimum span along the given axis.
|
float |
getPreferredSpan(int axis)
Determines the preferred span along the given axis.
|
protected int |
getTabSize()
Returns the tab size for the Document based on
PlainDocument.tabSizeAttribute, defaulting to 8 if this property is
not defined
|
void |
insertUpdate(DocumentEvent e,
Shape a,
ViewFactory f)
Called when something was inserted.
|
protected void |
loadChildren(ViewFactory f)
Loads the children to initiate the view.
|
float |
nextTabStop(float x,
int tabStop)
Returns the next tab stop position after a given reference position.
|
void |
paint(Graphics g,
Shape a)
Renders the
Element that is associated with this
View. |
void |
removeUpdate(DocumentEvent e,
Shape a,
ViewFactory f)
Called when something is removed.
|
void |
setSize(float width,
float height)
Sets the size of the View.
|
baselineLayout, baselineRequirements, calculateMajorAxisRequirements, calculateMinorAxisRequirements, childAllocation, flipEastAndWestAtEnds, forwardUpdate, getAlignment, getAxis, getChildAllocation, getHeight, getOffset, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layout, layoutChanged, layoutMajorAxis, layoutMinorAxis, modelToView, paintChild, preferenceChanged, replace, setAxis, viewToModelgetBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, getViewIndexAtPosition, modelToView, setInsets, setParagraphInsets, setParentappend, breakView, createFragment, dump, forwardUpdateToView, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, isVisible, modelToView, remove, removeAll, updateChildren, updateLayout, viewToModelpublic WrappedPlainView(Element elem)
public WrappedPlainView(Element elem, boolean wordWrap)
protected final Segment getLineBuffer()
public float nextTabStop(float x, int tabStop)
tabStop argument.nextTabStop in interface TabExpanderx - the current x position in pixelstabStop - the position within the text stream that the tab occured atprotected int getTabSize()
protected void drawLine(int p0, int p1, Graphics g, int x, int y)
p0 - starting document position to usep1 - ending document position to useg - graphics contextx - starting x positiony - starting y positionprotected int drawSelectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException
g - the graphics contextx - the starting X coordinatey - the starting Y coordinatep0 - the starting model locationp1 - the ending model locationBadLocationException - if the given range is invalidprotected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException
g - the graphics contextx - the starting X coordinatey - the starting Y coordinatep0 - the starting model locationp1 - the end model locationBadLocationException - if the range given is invalidprotected void loadChildren(ViewFactory f)
loadChildren in class CompositeViewf - the view factory to use for creating new child viewsCompositeView.setParent(javax.swing.text.View)protected int calculateBreakPosition(int p0, int p1)
p0 - the start model positionp1 - the end model positionpublic float getPreferredSpan(int axis)
getPreferredSpan in class BoxViewaxis - the axisView.public float getMinimumSpan(int axis)
getMinimumSpan in class BoxViewaxis - the axispublic float getMaximumSpan(int axis)
getMaximumSpan in class BoxViewaxis - the axispublic void insertUpdate(DocumentEvent e, Shape a, ViewFactory f)
insertUpdate in class Viewe - the DocumentEvent that describes the changea - the shape of the viewf - the ViewFactory for creating child viewspublic void removeUpdate(DocumentEvent e, Shape a, ViewFactory f)
removeUpdate in class Viewe - the DocumentEvent that describes the changea - the shape of the viewf - the ViewFactory for creating child viewspublic void changedUpdate(DocumentEvent e, Shape a, ViewFactory f)
changedUpdate in class Viewe - the DocumentEvent that describes the changea - the shape of the viewf - the ViewFactory for creating child viewspublic void paint(Graphics g, Shape a)
Element that is associated with this
View. Caches the metrics and then calls
super.paint to paint all the child views.