javax.swing.text.html
public class BlockView extends BoxView
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
BOTTOM, 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 |
---|
BlockView(Element elem,
int axis)
Creates a new view that represents an html box.
|
Modifier and Type | Method and Description |
---|---|
protected SizeRequirements |
calculateMajorAxisRequirements(int axis,
SizeRequirements r)
Calculates the requirements along the major axis.
|
protected SizeRequirements |
calculateMinorAxisRequirements(int axis,
SizeRequirements r)
Calculates the requirements along the minor axis.
|
void |
changedUpdate(DocumentEvent ev,
Shape a,
ViewFactory f)
Gives notification from the document that attributes were
changed in a location that this view is responsible for.
|
float |
getAlignment(int axis)
Gets the alignment.
|
AttributeSet |
getAttributes()
Fetches the attributes to use when painting.
|
float |
getMaximumSpan(int axis)
Determines the maximum span along the axis.
|
float |
getMinimumSpan(int axis)
Determines the minimum span along the axis.
|
float |
getPreferredSpan(int axis)
Determines the preferred span along the axis.
|
int |
getResizeWeight(int axis)
Gets the resize weight.
|
protected StyleSheet |
getStyleSheet()
Gets the default style sheet.
|
protected void |
layoutMajorAxis(int targetSpan,
int axis,
int[] offsets,
int[] spans)
Overridden to perform additional CSS layout (absolute/relative
positioning).
|
protected void |
layoutMinorAxis(int targetSpan,
int axis,
int[] offsets,
int[] spans)
Lays out the box along the minor axis (the axis that is
perpendicular to the axis that it represents).
|
void |
paint(Graphics g,
Shape a)
Paints using the given graphics configuration and shape.
|
void |
replace(int offset,
int length,
View[] views)
Overridden to fetch additional CSS layout information.
|
void |
setParent(View parent)
Creates the parent view for this.
|
protected void |
setPropertiesFromAttributes()
Updates any cached values that come from attributes.
|
baselineLayout, baselineRequirements, childAllocation, flipEastAndWestAtEnds, forwardUpdate, getAxis, getChildAllocation, getHeight, getOffset, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layout, layoutChanged, modelToView, paintChild, preferenceChanged, setAxis, setSize, viewToModel
getBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, getViewIndexAtPosition, loadChildren, modelToView, setInsets, setParagraphInsets
append, breakView, createFragment, dump, forwardUpdateToView, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, insertUpdate, isVisible, modelToView, remove, removeAll, removeUpdate, updateChildren, updateLayout, viewToModel
public void setParent(View parent)
setParent
in class CompositeView
parent
- - the new parent, or null if the view
is being removed from a parent it was added to.protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r)
calculateMajorAxisRequirements
in class BoxView
axis
- - the axis to check the requirements for.r
- - the SizeRequirements. If null, one is created.protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)
calculateMinorAxisRequirements
in class BoxView
axis
- - the axis to check the requirements for.r
- - the SizeRequirements. If null, one is created.protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans)
layoutMinorAxis
in class BoxView
targetSpan
- - the total span given to the view, also
used to layout the children.axis
- - the minor axisoffsets
- - the offsets from the origin of the view for
all the child views. This is a return value and is filled in by this
function.spans
- - the span of each child view. This is a return value and is
filled in by this function.protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans)
layoutMajorAxis
in class BoxView
targetSpan
- the (inner) span of the BoxView
in which
to layout the childrenaxis
- the axis along which the layout is performedoffsets
- the array that holds the offsets of the children on exitspans
- the array that holds the spans of the children on exitpublic void paint(Graphics g, Shape a)
public AttributeSet getAttributes()
getAttributes
in class View
public int getResizeWeight(int axis) throws IllegalArgumentException
getResizeWeight
in class BoxView
axis
- - the axis to get the resize weight for.IllegalArgumentException
- - for an invalid axispublic float getAlignment(int axis)
getAlignment
in class BoxView
axis
- - the axis to get the alignment for.public void changedUpdate(DocumentEvent ev, Shape a, ViewFactory f)
changedUpdate
in class View
ev
- - the change informationa
- - the current shape of the viewf
- - the factory to use to rebuild if the view has children.public float getPreferredSpan(int axis) throws IllegalArgumentException
getPreferredSpan
in class BoxView
axis
- - the view to get the preferred span for.IllegalArgumentException
- - for an invalid axispublic float getMinimumSpan(int axis) throws IllegalArgumentException
getMinimumSpan
in class BoxView
axis
- - the axis to get the minimum span for.IllegalArgumentException
- - for an invalid axispublic float getMaximumSpan(int axis) throws IllegalArgumentException
getMaximumSpan
in class BoxView
axis
- - the axis to get the maximum span for.IllegalArgumentException
- - for an invalid axisprotected void setPropertiesFromAttributes()
protected StyleSheet getStyleSheet()