Class HighlightPainterInfo
java.lang.Object
ro.sync.ecss.extensions.api.highlights.HighlightPainterInfo
Information needed by the painter.
-
Constructor Summary
ConstructorsConstructorDescriptionHighlightPainterInfo(Graphics g, int currentBoxHeight, Point origin, int relativeX, int textYPadding, int length, int startOffset, int endOffset, int baseLine, int fontAscent, int fontSize, Point parentLineBoxOrigin, int parentLineBoxWidth, int parentLineBoxHeight, int viewEndOffset) Renders the highlight. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the base line relative to top, relative to the box.intCurrent run of text/image height.intReturns the end offset in content.intReturns the font ascent.intReturns the font size.Returns the graphics used for paint.intReturns the length of highlight, in pixels.Returns the origin of box, relative to the upper corner of the editor.intintintReturns the relative X from where highlight should start.intReturns the start offset in content.intReturns the relative Y position from box Y used to paint the text inside the box.intbooleanCheck if we have a highlight over form controlsbooleanbooleanReturns true if the highlight is done over a text view.voidsetHighlightOverFormControls(boolean isHighlightOverFormControl) Set highlight over form controls.voidsetHighlightOverImage(boolean isHighlightOverImage) trueif the highlight is over an imagevoidsetHighlightOverText(boolean isHighlightOverText) It is set by the author layout, so that the painter knows the painted box is a text box.voidsetLength(int length) Set a new value for the length of the highlight, in pixels.
-
Constructor Details
-
HighlightPainterInfo
public HighlightPainterInfo(Graphics g, int currentBoxHeight, Point origin, int relativeX, int textYPadding, int length, int startOffset, int endOffset, int baseLine, int fontAscent, int fontSize, Point parentLineBoxOrigin, int parentLineBoxWidth, int parentLineBoxHeight, int viewEndOffset) Renders the highlight.- Parameters:
g- The graphicscurrentBoxHeight- The current box height.origin- Origin (upper left corner of the box in absolute coordinates)relativeX- The x relative to the origin where the highlight must start.textYPadding- The relative Y position from box Y used to paint the box.length- The length of the highlight, in pixels.startOffset- Start offset of highlightendOffset- End offset of highlightbaseLine- The base line relative to the box startfontAscent- The font ascentfontSize- The font sizeparentLineBoxWidth- The width of the parent line box. Can be -1.parentLineBoxHeight- The height of the parent line box. Can be -1.parentLineBoxOrigin- The origin of the parent line box. Can be null.viewEndOffset- The end offset of the current view over which the highight is being painted.
-
-
Method Details
-
setHighlightOverText
public void setHighlightOverText(boolean isHighlightOverText) It is set by the author layout, so that the painter knows the painted box is a text box.- Parameters:
isHighlightOverText- The isHighlightOverText to set.
-
getGraphics
Returns the graphics used for paint.- Returns:
- Returns the graphics used for paint.
-
getCurrentBoxHeight
public int getCurrentBoxHeight()Current run of text/image height. Usually the highlight should expand as high as the containing box.- Returns:
- Current run of text/image height. Usually the highlight should expand as high as the containing box.
-
getOrigin
Returns the origin of box, relative to the upper corner of the editor.- Returns:
- Returns the origin of box, relative to the upper corner of the editor.
-
getRelativeX
public int getRelativeX()Returns the relative X from where highlight should start.- Returns:
- Returns the relative X from where highlight should start.
-
getTextYPadding
public int getTextYPadding()Returns the relative Y position from box Y used to paint the text inside the box.- Returns:
- The relative Y position from box Y used to paint the text inside the box.
-
getLength
public int getLength()Returns the length of highlight, in pixels.- Returns:
- Returns the length of highlight, in pixels.
-
setLength
public void setLength(int length) Set a new value for the length of the highlight, in pixels.- Parameters:
length- the new value.
-
getStartOffset
public int getStartOffset()Returns the start offset in content.- Returns:
- Returns the start offset in content.
-
getEndOffset
public int getEndOffset()Returns the end offset in content.- Returns:
- Returns the end offset in content.
-
getBaseLine
public int getBaseLine()Returns the base line relative to top, relative to the box.- Returns:
- Returns the base line relative to top, relative to the box.
-
getFontAscent
public int getFontAscent()Returns the font ascent.- Returns:
- Returns the font ascent.
-
getFontSize
public int getFontSize()Returns the font size.- Returns:
- Returns the font size.
-
isHighlightOverText
public boolean isHighlightOverText()Returns true if the highlight is done over a text view.- Returns:
- Returns true if the highlight is done over a text view.
-
getParentLineBoxHight
public int getParentLineBoxHight()- Returns:
- Returns the height of parent line box. Can be -1.
-
getParentLineBoxWidth
public int getParentLineBoxWidth()- Returns:
- Returns the width of parent line box. Can be -1.
-
getParentLineBoxOrigin
- Returns:
- Returns the origin(absolute) of the parent line box. Can be null.
-
setHighlightOverImage
public void setHighlightOverImage(boolean isHighlightOverImage) trueif the highlight is over an image- Parameters:
isHighlightOverImage-trueif the highlight is over an image
-
isHighlightOverImage
public boolean isHighlightOverImage()- Returns:
- Returns
trueif the highlight is over an image
-
setHighlightOverFormControls
public void setHighlightOverFormControls(boolean isHighlightOverFormControl) Set highlight over form controls.- Parameters:
isHighlightOverFormControl-trueif we have a highlight over form controls.
-
isHighlightOverFormControl
public boolean isHighlightOverFormControl()Check if we have a highlight over form controls- Returns:
- Returns
trueif we have a highlight over form controls.
-
getViewEndOffset
public int getViewEndOffset()- Returns:
- The end offset of the current view over which the highight is being painted.
-