net.sourceforge.spedit.ui
Class LabelView
java.lang.Object
|
+--javax.swing.text.View
|
+--javax.swing.text.GlyphView
|
+--net.sourceforge.spedit.ui.LabelView
- All Implemented Interfaces:
- Cloneable, Styleable, SwingConstants, TabableView
- public class LabelView
- extends GlyphView
- implements Styleable
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NORTH, NORTH_EAST, NORTH_WEST, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Constructor Summary |
LabelView(Element elem)
Constructs a new view wrapped on an element. |
Method Summary |
protected Shape |
adjustC2V(Shape shape)
Transforms the given shape that corresponds to the container view to
the destination view. |
protected Shape |
adjustV2C(Shape shape)
Transforms the given shape that corresponds to the container view to
the destination view. |
float |
getAlignment(int axis)
|
Color |
getBackground()
Fetch the background color to use to render the
glyphs. |
short |
getBottomInset()
|
Font |
getFont()
Fetch the font that the glyphs should be based
upon. |
Color |
getForeground()
Fetch the foreground color to use to render the
glyphs. |
short |
getLeftInset()
|
float |
getMaximumSpan(int axis)
|
float |
getMinimumSpan(int axis)
|
Styleable.StyleSheet |
getParentStyleSheet()
|
float |
getPreferredSpan(int axis)
|
short |
getRightInset()
|
Styleable.StyleSheet |
getStyleSheet()
|
short |
getTopInset()
|
boolean |
isStrikeThrough()
Determine if the glyphs should have a strikethrough
line. |
boolean |
isSubscript()
Determine if the glyphs should be rendered as superscript. |
boolean |
isSuperscript()
Determine if the glyphs should be rendered as subscript. |
boolean |
isUnderline()
Determine if the glyphs should be underlined. |
Shape |
modelToView(int p0,
Position.Bias b0,
int p1,
Position.Bias b1,
Shape a)
|
Shape |
modelToView(int pos,
Shape a)
|
Shape |
modelToView(int pos,
Shape a,
Position.Bias b)
|
void |
paint(Graphics g,
Shape bounds)
|
protected void |
paintTextUsingColor2(Graphics g,
Shape a,
Color c,
int p0,
int p1)
|
void |
setPropertiesFromAttributes()
|
void |
setSize(float width,
float height)
|
void |
setStyleSheet(Styleable.StyleSheet s)
|
int |
viewToModel(float x,
float y,
Shape a)
|
int |
viewToModel(float x,
float y,
Shape a,
Position.Bias[] biasReturn)
|
Methods inherited from class javax.swing.text.GlyphView |
breakView, changedUpdate, checkPainter, clone, createFragment, getBreakWeight, getEndOffset, getGlyphPainter, getNextVisualPositionFrom, getPartialSpan, getStartOffset, getTabbedSpan, getTabExpander, getText, insertUpdate, removeUpdate, setGlyphPainter |
Methods inherited from class javax.swing.text.View |
append, forwardUpdate, forwardUpdateToView, getAttributes, getChildAllocation, getContainer, getDocument, getElement, getGraphics, getParent, getResizeWeight, getView, getViewCount, getViewFactory, getViewIndex, insert, isVisible, preferenceChanged, remove, removeAll, replace, setParent, updateChildren, updateLayout |
styleSheet
protected Styleable.StyleSheet styleSheet
lines
protected Vector lines
startPos
protected Position startPos
endPos
protected Position endPos
focused
protected boolean focused
selected
protected boolean selected
LabelView
public LabelView(Element elem)
- Constructs a new view wrapped on an element.
- Parameters:
elem
- the element
paint
public void paint(Graphics g,
Shape bounds)
- Overrides:
paint
in class GlyphView
paintTextUsingColor2
protected void paintTextUsingColor2(Graphics g,
Shape a,
Color c,
int p0,
int p1)
adjustC2V
protected Shape adjustC2V(Shape shape)
- Transforms the given shape that corresponds to the container view to
the destination view.
adjustV2C
protected Shape adjustV2C(Shape shape)
- Transforms the given shape that corresponds to the container view to
the destination view.
viewToModel
public int viewToModel(float x,
float y,
Shape a)
- Overrides:
viewToModel
in class View
viewToModel
public int viewToModel(float x,
float y,
Shape a,
Position.Bias[] biasReturn)
- Overrides:
viewToModel
in class GlyphView
modelToView
public Shape modelToView(int p0,
Position.Bias b0,
int p1,
Position.Bias b1,
Shape a)
throws BadLocationException
- Overrides:
modelToView
in class View
modelToView
public Shape modelToView(int pos,
Shape a)
throws BadLocationException
- Overrides:
modelToView
in class View
modelToView
public Shape modelToView(int pos,
Shape a,
Position.Bias b)
throws BadLocationException
- Overrides:
modelToView
in class GlyphView
getBackground
public Color getBackground()
- Fetch the background color to use to render the
glyphs. If there is no background color, null should
be returned. This is implemented to return a cached
background color.
- Overrides:
getBackground
in class GlyphView
getForeground
public Color getForeground()
- Fetch the foreground color to use to render the
glyphs. If there is no foreground color, null should
be returned. This is implemented to return a cached
foreground color.
- Overrides:
getForeground
in class GlyphView
getFont
public Font getFont()
- Fetch the font that the glyphs should be based
upon. This is implemented to return a cached
font.
- Overrides:
getFont
in class GlyphView
isUnderline
public boolean isUnderline()
- Determine if the glyphs should be underlined. If true,
an underline should be drawn through the baseline.
- Overrides:
isUnderline
in class GlyphView
isStrikeThrough
public boolean isStrikeThrough()
- Determine if the glyphs should have a strikethrough
line. If true, a line should be drawn through the center
of the glyphs.
- Overrides:
isStrikeThrough
in class GlyphView
isSubscript
public boolean isSubscript()
- Determine if the glyphs should be rendered as superscript.
- Overrides:
isSubscript
in class GlyphView
isSuperscript
public boolean isSuperscript()
- Determine if the glyphs should be rendered as subscript.
- Overrides:
isSuperscript
in class GlyphView
getAlignment
public float getAlignment(int axis)
- Overrides:
getAlignment
in class GlyphView
getLeftInset
public short getLeftInset()
getTopInset
public short getTopInset()
getBottomInset
public short getBottomInset()
getRightInset
public short getRightInset()
setPropertiesFromAttributes
public void setPropertiesFromAttributes()
getMaximumSpan
public float getMaximumSpan(int axis)
- Overrides:
getMaximumSpan
in class View
getPreferredSpan
public float getPreferredSpan(int axis)
- Overrides:
getPreferredSpan
in class GlyphView
getMinimumSpan
public float getMinimumSpan(int axis)
- Overrides:
getMinimumSpan
in class View
setSize
public void setSize(float width,
float height)
- Overrides:
setSize
in class View
getStyleSheet
public Styleable.StyleSheet getStyleSheet()
- Specified by:
getStyleSheet
in interface Styleable
setStyleSheet
public void setStyleSheet(Styleable.StyleSheet s)
- Specified by:
setStyleSheet
in interface Styleable
getParentStyleSheet
public Styleable.StyleSheet getParentStyleSheet()
- Specified by:
getParentStyleSheet
in interface Styleable