javax.swing.text.html
Class ImageView.ImageLabelView

java.lang.Object
  extended byjavax.swing.text.View
      extended byjavax.swing.text.GlyphView
          extended byjavax.swing.text.LabelView
              extended byjavax.swing.text.html.InlineView
                  extended byjavax.swing.text.html.ImageView.ImageLabelView
All Implemented Interfaces:
Cloneable, SwingConstants, TabableView
Enclosing class:
ImageView

private class ImageView.ImageLabelView
extends InlineView

ImageLabelView is used if the image can't be loaded, and the attribute specified an alt attribute. It overriden a handle of methods as the text is hardcoded and does not come from the document.


Nested Class Summary
 
Nested classes inherited from class javax.swing.text.GlyphView
GlyphView.GlyphPainter
 
Field Summary
private  Color fg
           
private  Segment segment
           
 
Fields inherited from class javax.swing.text.html.InlineView
 
Fields inherited from class javax.swing.text.LabelView
 
Fields inherited from class javax.swing.text.GlyphView
 
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
(package private) ImageView.ImageLabelView(Element e, String text)
           
 
Method Summary
 View breakView(int axis, int p0, float pos, float len)
          Breaks this view on the given axis at the given length.
 int getEndOffset()
          Fetches the portion of the model that this view is responsible for.
 Color getForeground()
          Fetches the foreground color to use to render the glyphs.
 int getStartOffset()
          Fetches the portion of the model that this view is responsible for.
 Segment getText(int p0, int p1)
          Fetch a reference to the text that occupies the given range.
 void paint(Graphics g, Shape a)
          Renders a portion of a text style run.
 void reset(String text)
           
 
Methods inherited from class javax.swing.text.html.InlineView
changedUpdate, getAttributes, getBreakWeight, getLongestWordSpan, getStyleSheet, setPropertiesFromAttributes
 
Methods inherited from class javax.swing.text.LabelView
getBackground, getFont, getFontMetrics, isStrikeThrough, isSubscript, isSuperscript, isUnderline, setStrikeThrough, setSubscript, setSuperscript, setUnderline
 
Methods inherited from class javax.swing.text.GlyphView
checkPainter, clone, createFragment, getAlignment, getGlyphPainter, getNextVisualPositionFrom, getPartialSpan, getPreferredSpan, getTabbedSpan, getTabExpander, insertUpdate, modelToView, removeUpdate, setGlyphPainter, viewToModel
 
Methods inherited from class javax.swing.text.View
append, forwardUpdate, forwardUpdateToView, getChildAllocation, getContainer, getDocument, getElement, getGraphics, getMaximumSpan, getMinimumSpan, getParent, getResizeWeight, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, replace, setParent, setSize, updateChildren, updateLayout, viewToModel
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.text.TabableView
getPartialSpan, getTabbedSpan
 

Field Detail

segment

private Segment segment

fg

private Color fg
Constructor Detail

ImageView.ImageLabelView

ImageView.ImageLabelView(Element e,
                         String text)
Method Detail

reset

public void reset(String text)

paint

public void paint(Graphics g,
                  Shape a)
Description copied from class: GlyphView
Renders a portion of a text style run.

Overrides:
paint in class GlyphView
Parameters:
g - the rendering surface to use
a - the allocated region to render into

getText

public Segment getText(int p0,
                       int p1)
Description copied from class: GlyphView
Fetch a reference to the text that occupies the given range. This is normally used by the GlyphPainter to determine what characters it should render glyphs for.

Overrides:
getText in class GlyphView
Parameters:
p0 - the starting document offset >= 0
p1 - the ending document offset >= p0
Returns:
the Segment containing the text

getStartOffset

public int getStartOffset()
Description copied from class: GlyphView
Fetches the portion of the model that this view is responsible for.

Overrides:
getStartOffset in class GlyphView
Returns:
the starting offset into the model
See Also:
View.getStartOffset()

getEndOffset

public int getEndOffset()
Description copied from class: GlyphView
Fetches the portion of the model that this view is responsible for.

Overrides:
getEndOffset in class GlyphView
Returns:
the ending offset into the model
See Also:
View.getEndOffset()

breakView

public View breakView(int axis,
                      int p0,
                      float pos,
                      float len)
Description copied from class: GlyphView
Breaks this view on the given axis at the given length. This is implemented to attempt to break on a whitespace location, and returns a fragment with the whitespace at the end. If a whitespace location can't be found, the nearest character is used.

Overrides:
breakView in class GlyphView
Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
p0 - the location in the model where the fragment should start it's representation >= 0.
pos - the position along the axis that the broken view would occupy >= 0. This may be useful for things like tab calculations.
len - specifies the distance along the axis where a potential break is desired >= 0.
Returns:
the fragment of the view that represents the given span, if the view can be broken. If the view doesn't support breaking behavior, the view itself is returned.
See Also:
View.breakView(int, int, float, float)

getForeground

public Color getForeground()
Description copied from class: LabelView
Fetches the foreground color to use to render the glyphs. This is implemented to return a cached foreground color, which defaults to null.

Overrides:
getForeground in class LabelView
Returns:
the cached foreground color