|
||||||||||
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.text.html.HRuleView
A view implementation to display an html horizontal rule.
Field Summary | |
private int |
alignment
|
private AttributeSet |
attr
View Attributes. |
private float |
bottomMargin
|
private float |
leftMargin
|
private String |
noshade
|
private float |
rightMargin
|
private int |
size
|
private static int |
SPACE_ABOVE
|
private static int |
SPACE_BELOW
|
private float |
topMargin
|
private CSS.LengthValue |
widthValue
|
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 | |
HRuleView(Element elem)
Creates a new view that represents an <hr> element. |
Method Summary | |
View |
breakView(int axis,
int offset,
float pos,
float len)
Tries to break this view on the given axis. |
void |
changedUpdate(DocumentEvent changes,
Shape a,
ViewFactory f)
Gives notification from the document that attributes were changed in a location that this view is responsible for. |
AttributeSet |
getAttributes()
Fetches the attributes to use when rendering. |
int |
getBreakWeight(int axis,
float pos,
float len)
Determines how attractive a break opportunity in this view is. |
private float |
getLength(CSS.Attribute key,
AttributeSet a)
|
float |
getPreferredSpan(int axis)
Calculates the desired shape of the rule... this is basically the preferred size of the border. |
int |
getResizeWeight(int axis)
Gets the resize weight for the axis. |
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 a)
Paints the view. |
protected void |
setPropertiesFromAttributes()
Update any cached values that come from attributes. |
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, createFragment, forwardUpdate, forwardUpdateToView, getAlignment, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getNextVisualPositionFrom, getParent, getStartOffset, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, insertUpdate, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, removeUpdate, replace, setParent, setSize, updateChildren, updateLayout, viewToModel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private float topMargin
private float bottomMargin
private float leftMargin
private float rightMargin
private int alignment
private String noshade
private int size
private CSS.LengthValue widthValue
private static final int SPACE_ABOVE
private static final int SPACE_BELOW
private AttributeSet attr
Constructor Detail |
public HRuleView(Element elem)
elem
- the element to create a view forMethod Detail |
protected void setPropertiesFromAttributes()
private float getLength(CSS.Attribute key, AttributeSet a)
public void paint(Graphics g, Shape a)
paint
in class View
g
- the graphics contexta
- the allocation region for the viewView.paint(java.awt.Graphics, java.awt.Shape)
public float getPreferredSpan(int axis)
getPreferredSpan
in class View
axis
- may be either X_AXIS or Y_AXIS
View.getPreferredSpan(int)
public int getResizeWeight(int axis)
getResizeWeight
in class View
axis
- may be either X_AXIS or Y_AXIS
public int getBreakWeight(int axis, float pos, float len)
getBreakWeight
in class View
axis
- may be either View.X_AXIS or View.Y_AXISpos
- the potential location of the start of the
broken view (greater than or equal to zero).
This may be useful for calculating tab
positions.len
- specifies the relative length from pos
where a potential break is desired. The value must be greater
than or equal to zero.
LabelView
,
ParagraphView
,
View.BadBreakWeight
,
View.GoodBreakWeight
,
View.ExcellentBreakWeight
,
View.ForcedBreakWeight
public View breakView(int axis, int offset, float pos, float len)
View
This is implemented to return the view itself, which represents the default behavior on not being breakable. If the view does support breaking, the starting offset of the view returned should be the given offset, and the end offset should be less than or equal to the end offset of the view being broken.
breakView
in class View
axis
- may be either View.X_AXIS
or
View.Y_AXIS
offset
- the location in the document model
that a broken fragment would occupy >= 0. This
would be the starting offset of the fragment
returnedpos
- the position along the axis that the
broken view would occupy >= 0. This may be useful for
things like tab calculationslen
- specifies the distance along the axis
where a potential break is desired >= 0
ParagraphView
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 given position does not
represent a valid location in the associated documentView.modelToView(int, 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
- the X coordinatey
- the Y coordinatea
- the allocated region to render into
View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])
public AttributeSet getAttributes()
getAttributes
in class View
public void changedUpdate(DocumentEvent changes, Shape a, ViewFactory f)
View
changedUpdate
in class View
changes
- 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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |