|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.text.View
com.inet.html.views.BoxView
com.inet.html.views.ContentView
com.inet.html.views.VariableSpaceView
public class VariableSpaceView
This is very special type of view. It represents one(of more, if this is within a pre) spaces within a flow-text. It may have a weight depending on the spaces it represents. This view will draw all backgrounds an borders of the elements between it's root an leaf. That way it can be part of all lineboxes at one specified location. If a paint type is set it can be used for the left or right edge of a line box. In that case it has a fixed width, which consists of the border and padding of the line box. This view will take part in the normal inline layout process an can flow like any other content block.
Field Summary |
---|
Fields inherited from class com.inet.html.views.ContentView |
---|
CJK_TYPE_CHARACTER, CJK_TYPE_NONE, CJK_TYPE_PUNCTUATION |
Fields inherited from class com.inet.html.views.BoxView |
---|
BASELINE, STATUS_REQ_LAYOUT, STATUS_REQ_PRELAYOUT, STATUS_UPTODATE |
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 | |
---|---|
VariableSpaceView(javax.swing.text.Element leaf)
Constructs a space with variable width, which uses ALL styles from the leaf to the root element. |
|
VariableSpaceView(javax.swing.text.Element leaf,
boolean isBreakChar)
Constructs a space with variable width, which uses ALL styles from the leaf to the root element. |
|
VariableSpaceView(javax.swing.text.Element elem,
boolean isBreakChar,
ViewPainter painter)
Creates the object, and sets the paint controller |
|
VariableSpaceView(javax.swing.text.Element leaf,
int paintMode)
Constructs a space with variable width, which uses ALL styles from the leaf to the root element. |
|
VariableSpaceView(javax.swing.text.Element elem,
int paintMode,
ViewPainter painter)
Creates the object, and sets the paint controller |
|
VariableSpaceView(javax.swing.text.Element elem,
int paintMode,
ViewPainter painter,
ContentPainter contentPainter)
Creates the object, and sets the paint controller |
|
VariableSpaceView(javax.swing.text.Element elem,
ViewPainter painter)
Creates the object, and sets the paint controller |
Method Summary | |
---|---|
int |
getContentHeight()
This is the layouted height in pixel. |
int |
getContentWidth()
This is the layouted width in pixel. |
float |
getMinimumSpan(int axis)
|
int |
getOuterHeight()
Returns the outer height of this box which is content+padding+border. |
int |
getOuterWidth()
Returns the outer width of this box which is content+padding+border. |
float |
getPreferredSpan(int axis)
|
boolean |
isBreak()
Returns true if this View refers to a BR element |
boolean |
isBreakable()
Returns true, if this view may be used to break an inline layout |
boolean |
isFixed()
|
boolean |
isTab()
Returns true if this represents a tab stop |
java.awt.Shape |
modelToView(int pos,
java.awt.Shape a,
javax.swing.text.Position.Bias b)
|
void |
paint(java.awt.Graphics g,
java.awt.Shape allocation)
|
java.awt.Rectangle |
performLayout(boolean hard)
This is the final layout method. It has to perform a layout of this view and call the layout of all children. Every change to the size of any view in the document will at least call the performLayout method! |
void |
performPreLayout()
Causes this view to layout all fixed values and to calculate it's minimum and preferred width. |
void |
setBreakable(boolean isBreakable)
Returns true, if this is a white space, which can be wrapped |
void |
setFixed(boolean isFixed)
Sets this view to fixed or layout-defined width |
void |
setHeight(int height)
Explicitly sets the height of this space. |
void |
setIsBreakChar()
Marks this view as a break character in PRE context. |
void |
setPaintMode(int paintMode)
Sets the paint mode of this view. |
void |
setParent(javax.swing.text.View parent)
|
void |
setPre(boolean isPre)
Sets the White-Space=PRE property on this view (not on the underlying content!) |
void |
setSize(float newWidth,
float newHeight)
BLOCKED FOR CONTENT This method changes the OUTER box size, which is the box around the border of this box. The content size will be set to a size which fits into this box. |
void |
setStartAndEndOffset(int start,
int end)
Set a new start and end position |
void |
setTab(boolean isTab)
Sets the tab stop property of this view |
void |
setWidth(int width)
Explicitly sets the width of this space. |
java.lang.String |
toString()
|
int |
viewToModel(float x,
float y,
java.awt.Shape a,
javax.swing.text.Position.Bias[] biasReturn)
|
Methods inherited from class com.inet.html.views.ContentView |
---|
createFragment, getBottomInset, getCJKType, getContentPainter, getFont, getLeftInset, getMargins, getRightInset, getTextLength, getTopInset, insertUpdate, isBlock, paramString, performLayoutVAlign, performLayoutWidth, setCJKType, setIsNativeLTR, setSizeContent |
Methods inherited from class javax.swing.text.View |
---|
append, breakView, changedUpdate, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getGraphics, getMaximumSpan, getNextVisualPositionFrom, getParent, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, insert, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, removeUpdate, replace, viewToModel |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public VariableSpaceView(javax.swing.text.Element leaf)
leaf
- The leaf within the content tree, which matches this space areapublic VariableSpaceView(javax.swing.text.Element leaf, boolean isBreakChar)
leaf
- The leaf within the content tree, which matches this space areaisBreakChar
- set this to true to indicate that the content of this element is a \n, relevant for PREpublic VariableSpaceView(javax.swing.text.Element leaf, int paintMode)
leaf
- The leaf within the content tree, which matches this space areapaintMode
- Sets the paint mode for this view(uses BoxPainter
constants). If the
mode is not centered this view draws the edge of the leafs line box.public VariableSpaceView(javax.swing.text.Element elem, ViewPainter painter)
elem
- the element this view ill display, must not be nullpainter
- the paint controller to use, may be null if there is nonepublic VariableSpaceView(javax.swing.text.Element elem, boolean isBreakChar, ViewPainter painter)
elem
- the element this view ill display, must not be nullisBreakChar
- set to true, if the white space of this view is a line break in text/plainpainter
- the paint controller to use, may be null if there is nonepublic VariableSpaceView(javax.swing.text.Element elem, int paintMode, ViewPainter painter)
elem
- the element this view ill display, must not be nullpaintMode
- the BoxPainter.PAINT_MODE constant to use on paint operations of this viewpainter
- the paint controller to use, may be null if there is noneIBoxPainter.PAINT_MODE_NORMAL
,
IBoxPainter.PAINT_MODE_LEFTEDGE
,
IBoxPainter.PAINT_MODE_CENTER
,
IBoxPainter.PAINT_MODE_RIGHTEDGE
public VariableSpaceView(javax.swing.text.Element elem, int paintMode, ViewPainter painter, ContentPainter contentPainter)
elem
- the element this view ill display, must not be nullpaintMode
- the BoxPainter.PAINT_MODE constant to use on paint operations of this viewpainter
- the paint controller to use, may be null if there is nonecontentPainter
- the content painter to useIBoxPainter.PAINT_MODE_NORMAL
,
IBoxPainter.PAINT_MODE_LEFTEDGE
,
IBoxPainter.PAINT_MODE_CENTER
,
IBoxPainter.PAINT_MODE_RIGHTEDGE
Method Detail |
---|
public void setParent(javax.swing.text.View parent)
setParent
in class ContentView
public void setPaintMode(int paintMode)
paintMode
- a BoxPainter
constantpublic float getPreferredSpan(int axis)
getPreferredSpan
in class ContentView
public float getMinimumSpan(int axis)
getMinimumSpan
in class ContentView
public java.awt.Rectangle performLayout(boolean hard)
performLayout
in class ContentView
hard
- If set to true, the status of the children will be ignored and all views will be layouted. This
should be done on view-size changes. If set to false the status of the children will be respected and
up-to-date views will not be layouted again.
public void setWidth(int width)
width
- The width in pixel.public void setHeight(int height)
height
- The height in pixel.public int getOuterHeight()
getOuterHeight
in class BoxView
public int getOuterWidth()
getOuterWidth
in class BoxView
public boolean isFixed()
public void setFixed(boolean isFixed)
isFixed
- true set a fixed widthpublic void setSize(float newWidth, float newHeight)
setSize
in class ContentView
newWidth
- the new width in pxnewHeight
- the new height in pxpublic void setStartAndEndOffset(int start, int end)
setStartAndEndOffset
in class BoxView
start
- the new start positionend
- must be larger as startpublic int getContentWidth()
getContentWidth
in class BoxView
public int getContentHeight()
getContentHeight
in class BoxView
public void performPreLayout()
performPreLayout
in class BoxView
public java.lang.String toString()
toString
in class ContentView
public java.awt.Shape modelToView(int pos, java.awt.Shape a, javax.swing.text.Position.Bias b) throws javax.swing.text.BadLocationException
modelToView
in class ContentView
javax.swing.text.BadLocationException
public int viewToModel(float x, float y, java.awt.Shape a, javax.swing.text.Position.Bias[] biasReturn)
viewToModel
in class ContentView
public void paint(java.awt.Graphics g, java.awt.Shape allocation)
paint
in class ContentView
public void setPre(boolean isPre)
isPre
- true, if this is a PRE-Viewpublic boolean isBreak()
isBreak
in class BoxView
public void setIsBreakChar()
public boolean isBreakable()
isBreakable
in class ContentView
public void setBreakable(boolean isBreakable)
setBreakable
in class ContentView
isBreakable
- Returns true, if this is a white space, which can be wrappedpublic boolean isTab()
public void setTab(boolean isTab)
isTab
- true, if this represents a tab stop
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |