Oxygen XML Editor 14.2 Author API

ro.sync.ecss.extensions.api.highlights
Class ColorHighlightPainter

java.lang.Object
  extended by ro.sync.ecss.extensions.api.highlights.ColorHighlightPainter
All Implemented Interfaces:
HighlightPainter, TextForegroundHighlighterPainter

@API(type=EXTENDABLE,
     src=PUBLIC)
public class ColorHighlightPainter
extends java.lang.Object
implements TextForegroundHighlighterPainter

Painter that can be used to customize the way that a highlight is displayed by setting custom text decoration, text decoration stroke, background color or stroke color.


Nested Class Summary
static class ColorHighlightPainter.TextDecoration
          The decoration added to text.
 
Constructor Summary
ColorHighlightPainter()
          Default constructor.
ColorHighlightPainter(Color color, int height, int totalHeight)
          Constructor.
 
Method Summary
 Color getBgColor()
           
 Color getColor()
           
 Color getTextForegroundColor()
          Get the text foreground color.
 void paint(HighlightPainterInfo pi)
          Renders the highlight.
 void setBgColor(Color bgColor)
           
 void setBgColor(Color bgColor, boolean useLineBoxHeight)
           
 void setColor(Color c)
          Set the color used for decoration (strike out or underline)
 void setStrikeOut(boolean strikeOut)
          Deprecated. Use setTextDecoration(TextDecoration) instead.
 void setTextDecoration(ColorHighlightPainter.TextDecoration decoration)
          Set the text decoration.
 void setTextDecorationStroke(int stroke)
          Set the text decoration stroke.
 void setTextForegroundColor(Color foregroundColor)
          Set the text foreground color.
 boolean useBaseLineForUnderline()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorHighlightPainter

public ColorHighlightPainter()
Default constructor. The color is red.


ColorHighlightPainter

public ColorHighlightPainter(Color color,
                             int height,
                             int totalHeight)
Constructor.

Parameters:
color - The color to use for highlight.
height - The height of the highlight line. This may be smaller than the total height. If it is, the extra space will remain under the line.
totalHeight - The height of the highlight.
Method Detail

paint

public void paint(HighlightPainterInfo pi)
Description copied from interface: HighlightPainter
Renders the highlight.

Specified by:
paint in interface HighlightPainter
Parameters:
pi - Information used by highlight
See Also:
HighlightPainter.paint(ro.sync.ecss.extensions.api.highlights.HighlightPainterInfo)

setColor

public void setColor(Color c)
Set the color used for decoration (strike out or underline)

Parameters:
c - The decoration color.

setTextDecoration

public void setTextDecoration(ColorHighlightPainter.TextDecoration decoration)
Set the text decoration. If is set to ColorHighlightPainter.TextDecoration.NONE no line will be drawn.

Parameters:
decoration - The new text decoration.

setBgColor

public void setBgColor(Color bgColor)
Parameters:
bgColor - The background color to set.

setBgColor

public void setBgColor(Color bgColor,
                       boolean useLineBoxHeight)
Parameters:
bgColor - The background color to set.
useLineBoxHeight - true to use the parent line height for drawing the background color.

useBaseLineForUnderline

public boolean useBaseLineForUnderline()
Returns:
true if use the base line for underlining

setTextDecorationStroke

public void setTextDecorationStroke(int stroke)
Set the text decoration stroke.

Parameters:
stroke - The new Stroke type. Constants are defined in Graphics.

setStrikeOut

@Deprecated
public void setStrikeOut(boolean strikeOut)
Deprecated. Use setTextDecoration(TextDecoration) instead.

Parameters:
strikeOut - Set this highlight as strike out.

getBgColor

public Color getBgColor()
Returns:
Returns the background color.

getColor

public Color getColor()
Returns:
Returns the color used for decoration (strike out or underline)

setTextForegroundColor

public void setTextForegroundColor(Color foregroundColor)
Set the text foreground color.

Parameters:
foregroundColor - The foreground color to set.
Since:
13.2

getTextForegroundColor

public Color getTextForegroundColor()
Get the text foreground color.

Specified by:
getTextForegroundColor in interface TextForegroundHighlighterPainter
Returns:
the color for the text foreground. NULL for inhibiting this feature.
Since:
13.2
See Also:
TextForegroundHighlighterPainter.getTextForegroundColor()

Oxygen XML Editor 14.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2013. All rights reserved.