sferyx.administration.renderers
Class HRuleView

java.lang.Object
  extended by javax.swing.text.View
      extended by javax.swing.text.CompositeView
          extended by javax.swing.text.BoxView
              extended by javax.swing.text.html.BlockView
                  extended by sferyx.administration.renderers.CustomLayoutBoxView
                      extended by sferyx.administration.renderers.CustomBlockView
                          extended by sferyx.administration.renderers.HRuleView
All Implemented Interfaces:
javax.swing.SwingConstants, CSSLayoutViews

public class HRuleView
extends CustomBlockView

Improved HR view to comply with some CSS rendering specifications.


Field Summary
 
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(javax.swing.text.Element elem)
          Creates a new view that represents an <hr> element.
 
Method Summary
 javax.swing.text.View breakView(int axis, int offset, float pos, float len)
           
 int getBreakWeight(int axis, float pos, float len)
          Determines how attractive a break opportunity in this view is.
 float getPreferredSpan(int axis)
          Update any cached values that come from attributes.
 int getResizeWeight(int axis)
           
 java.awt.Shape modelToView(int pos, java.awt.Shape a, javax.swing.text.Position.Bias b)
          Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.
 void paint(java.awt.Graphics g, java.awt.Shape a)
           
 void setPropertiesFromAttributes()
           
 int viewToModel(float x, float y, java.awt.Shape a, javax.swing.text.Position.Bias[] bias)
          Provides a mapping from the view coordinate space to the logical coordinate space of the model.
 
Methods inherited from class sferyx.administration.renderers.CustomBlockView
changedUpdate, containsOnlyFloats, getMaximumSpan_, getMaximumSpan, getMinimumSpan_, getMinimumSpan, getPreferredSpan_, getTotalSpanV_, getTotalSpanV, insertUpdate, isVisible, layout, loadChildren, removeUpdate, updateLayout
 
Methods inherited from class sferyx.administration.renderers.CustomLayoutBoxView
adjustAllParagraphsLayout, adjustParagraphLayout, calculateMajorAxisRequirements, calculateMinorAxisRequirements, childAllocation, forwardUpdate, getAbsoluteX_, getAbsoluteX, getAbsoluteY_, getAbsoluteY, getAlignment, getAttributes, getBottomInset, getBottomMargin, getBottomPadding, getChildAllocation, getFloatingChildrenSpan, getHeightCSSValue_, getHeightCSSValue, getInsideAllocation, getLeftInset, getLeftMargin, getLeftPadding, getLeftRightBorderInset, getMaxWidthCSSValue, getMinWidthCSSValue, getMyIndex, getMyOffset, getNextVisualPositionFrom, getOffset, getRightInset, getRightMargin, getRightPadding, getSpan, getStyleSheet, getSuperPreferredSpan, getTopBottomBorderInset, getTopInset, getTopMargin, getTopPadding, getView, getViewAtPoint, getViewAtPointNormal, getWidth, getWidthCSSValue_, getWidthCSSValue, isAbsolutePositioning, isRelativePositioning, layoutChanged, layoutMajorAxis, layoutMinorAxis, layoutSuperMajorAxis, loadChildren_, paintThisViewOnly, replace_, setInsets, setParent, setSize
 
Methods inherited from class javax.swing.text.BoxView
baselineLayout, baselineRequirements, flipEastAndWestAtEnds, getAxis, getHeight, isAfter, isAllocationValid, isBefore, isLayoutValid, paintChild, preferenceChanged, replace, setAxis
 
Methods inherited from class javax.swing.text.CompositeView
getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getViewAtPosition, getViewCount, getViewIndex, getViewIndexAtPosition, modelToView, setParagraphInsets
 
Methods inherited from class javax.swing.text.View
append, createFragment, forwardUpdateToView, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, modelToView, remove, removeAll, updateChildren, viewToModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HRuleView

public HRuleView(javax.swing.text.Element elem)
Creates a new view that represents an <hr> element.

Parameters:
elem - the element to create a view for
Method Detail

getResizeWeight

public int getResizeWeight(int axis)
Overrides:
getResizeWeight in class CustomLayoutBoxView

getPreferredSpan

public float getPreferredSpan(int axis)
Update any cached values that come from attributes.

Overrides:
getPreferredSpan in class CustomBlockView

setPropertiesFromAttributes

public void setPropertiesFromAttributes()
Overrides:
setPropertiesFromAttributes in class CustomLayoutBoxView

paint

public void paint(java.awt.Graphics g,
                  java.awt.Shape a)
Overrides:
paint in class CustomBlockView

getBreakWeight

public int getBreakWeight(int axis,
                          float pos,
                          float len)
Determines how attractive a break opportunity in this view is. This is implemented to request a forced break.

Overrides:
getBreakWeight in class javax.swing.text.View
Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
pos - 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.
Returns:
the weight, which should be a value between ForcedBreakWeight and BadBreakWeight.

breakView

public javax.swing.text.View breakView(int axis,
                                       int offset,
                                       float pos,
                                       float len)
Overrides:
breakView in class javax.swing.text.View

modelToView

public java.awt.Shape modelToView(int pos,
                                  java.awt.Shape a,
                                  javax.swing.text.Position.Bias b)
                           throws javax.swing.text.BadLocationException
Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.

Overrides:
modelToView in class CustomLayoutBoxView
Parameters:
pos - the position to convert
a - the allocated region to render into
Returns:
the bounding box of the given position
Throws:
javax.swing.text.BadLocationException - if the given position does not represent a valid location in the associated document
See Also:
View.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias)

viewToModel

public int viewToModel(float x,
                       float y,
                       java.awt.Shape a,
                       javax.swing.text.Position.Bias[] bias)
Provides a mapping from the view coordinate space to the logical coordinate space of the model.

Overrides:
viewToModel in class CustomLayoutBoxView
Parameters:
x - the X coordinate
y - the Y coordinate
a - the allocated region to render into
Returns:
the location within the model that best represents the given point of view
See Also:
View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])