Class TagProcessingState
- java.lang.Object
-
- org.eclipse.nebula.widgets.richtext.painter.TagProcessingState
-
public class TagProcessingState extends java.lang.ObjectThis class is used to keep track of the style setting regarding opened tags. It is needed to support styling ranges over several lines or rendering, because tags can be opened for rendering on one line, while it is closed on another line.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTagProcessingState.TextAlignmentEnumeration to specify the text alignment in a paragraph.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Deque<org.eclipse.swt.graphics.Color>bgColorStackStack of previous set background colors.private java.util.Deque<org.eclipse.swt.graphics.Color>colorStackStack of previous set foreground colors.private LinePaintercurrentLineTheLinePainterof the current rendered line.private java.util.Deque<org.eclipse.swt.graphics.Font>fontStackStack of used fonts.private java.util.Iterator<LinePainter>lineIteratorTheIteratorused to iterate over the lines that are rendered.private java.util.Deque<java.lang.Integer>listMarginStackThe additional margin that is used on rendering a list.private java.util.Deque<java.lang.Integer>listNumberStackCurrent list item number.private intmarginLeftThe left margin in a paragraph.private java.util.Deque<java.lang.Boolean>orderedListStackFlag that indicates whether the current list is an ordered or unordered list.private intparagraphCountThe number of paragraphs that are found in a text.private org.eclipse.swt.graphics.PointpointerThe coordinates where the drawing operations should be performed from.private booleanrenderingFlag that indicates whether drawing operations should be performed or not.private org.eclipse.swt.graphics.PointstartingPointThe coordinates where the drawing operations should start from.private booleanstrikethroughActiveFlag that indicates whether strikethrough styling is active or not.private TagProcessingState.TextAlignmenttextAlignmentThe alignment of the current paragraph.private booleanunderlineActiveFlag that indicates whether underline styling is active or not.
-
Constructor Summary
Constructors Constructor Description TagProcessingState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivateNextLine()voidaddPreviousBgColor(org.eclipse.swt.graphics.Color prevBgColor)Add the givenColorto the stack of previous set background colors.voidaddPreviousColor(org.eclipse.swt.graphics.Color prevColor)Add the givenColorto the stack of previous set foreground colors.voidaddPreviousFont(org.eclipse.swt.graphics.Font font)Add the givenFontto the stack of previous set fonts.voidcalculateX(int areaWidth)org.eclipse.swt.graphics.FontMetricsgetCurrentBiggestFontMetrics()LinePaintergetCurrentLine()intgetCurrentLineHeight()java.lang.IntegergetCurrentListNumber()intgetListDepth()intgetListMargin()intgetMarginLeft()intgetParagraphCount()org.eclipse.swt.graphics.PointgetPointer()TagProcessingState.TextAlignmentgetTextAlignment()booleanhasPreviousBgColor()voidincreaseCurrentListNumber()voidincreaseParagraphCount()voidincreaseX(int x)voidincreaseY(int y)voidinitCurrentListNumber()booleanisOrderedList()booleanisRendering()booleanisStrikethroughActive()booleanisUnderlineActive()org.eclipse.swt.graphics.ColorpollPreviousBgColor()Removes and returns the last color from the previous background color stack.org.eclipse.swt.graphics.ColorpollPreviousColor()Removes and returns the last color from the previous foreground color stack.org.eclipse.swt.graphics.FontpollPreviousFont()Removes and returns the last font from the previous font stack.voidresetListConfiguration()voidresetX()Reset the x coordinate of the pointer to the value of the left margin.voidsetLineIterator(java.util.Iterator<LinePainter> lineIterator)voidsetListMargin(int listMargin)voidsetMarginLeft(int marginLeft)voidsetOrderedList(boolean orderedList)voidsetRendering(boolean render)voidsetStartingPoint(int startX, int startY)voidsetStrikethroughActive(boolean strikethroughActive)voidsetTextAlignment(TagProcessingState.TextAlignment textAlignment)voidsetUnderlineActive(boolean underlineActive)voidsetX(int x)voidsetY(int y)
-
-
-
Field Detail
-
startingPoint
private org.eclipse.swt.graphics.Point startingPoint
The coordinates where the drawing operations should start from.
-
pointer
private org.eclipse.swt.graphics.Point pointer
The coordinates where the drawing operations should be performed from.
-
marginLeft
private int marginLeft
The left margin in a paragraph.
-
textAlignment
private TagProcessingState.TextAlignment textAlignment
The alignment of the current paragraph.
-
colorStack
private java.util.Deque<org.eclipse.swt.graphics.Color> colorStack
Stack of previous set foreground colors. Usually not necessary as the CKEDITOR closes spans before opening new ones regarding colors, but since HTML supports nesting of spans to apply colors on the way, a stack is necessary to avoid exceptions then.
-
bgColorStack
private java.util.Deque<org.eclipse.swt.graphics.Color> bgColorStack
Stack of previous set background colors. Usually not necessary as the CKEDITOR closes spans before opening new ones regarding colors, but since HTML supports nesting of spans to apply colors on the way, a stack is necessary to avoid exceptions then.
-
underlineActive
private boolean underlineActive
Flag that indicates whether underline styling is active or not. Necessary because the underline tag can wrap several other font or styling tags.
-
strikethroughActive
private boolean strikethroughActive
Flag that indicates whether strikethrough styling is active or not. Necessary because the strikethrough tag can wrap several other font or styling tags.
-
fontStack
private java.util.Deque<org.eclipse.swt.graphics.Font> fontStack
Stack of used fonts. Necessary because font styling options can be nested (e.g. bold, size, type) and therefore need to be reset in the correct order on close.
-
orderedListStack
private java.util.Deque<java.lang.Boolean> orderedListStack
Flag that indicates whether the current list is an ordered or unordered list. Necessary for rendering the list item bullet.
-
listNumberStack
private java.util.Deque<java.lang.Integer> listNumberStack
Current list item number. Necessary for rendering an ordered list.
-
listMarginStack
private java.util.Deque<java.lang.Integer> listMarginStack
The additional margin that is used on rendering a list. Necessary to align the text part of lists.
-
currentLine
private LinePainter currentLine
TheLinePainterof the current rendered line.
-
lineIterator
private java.util.Iterator<LinePainter> lineIterator
TheIteratorused to iterate over the lines that are rendered.
-
rendering
private boolean rendering
Flag that indicates whether drawing operations should be performed or not. Necessary for embedded rendering to be able to calculate the dynamic dimensions without rendering directly.
-
paragraphCount
private int paragraphCount
The number of paragraphs that are found in a text. Needed to calculate the preferred height.
-
-
Method Detail
-
addPreviousColor
public void addPreviousColor(org.eclipse.swt.graphics.Color prevColor)
Add the givenColorto the stack of previous set foreground colors.- Parameters:
prevColor- TheColorto add to the previous foreground color stack.
-
pollPreviousColor
public org.eclipse.swt.graphics.Color pollPreviousColor()
Removes and returns the last color from the previous foreground color stack. (LIFO)- Returns:
- The last
Colorthat was added to the previous foreground color stack.
-
addPreviousBgColor
public void addPreviousBgColor(org.eclipse.swt.graphics.Color prevBgColor)
Add the givenColorto the stack of previous set background colors.- Parameters:
prevBgColor- TheColorto add to the previous background color stack.
-
pollPreviousBgColor
public org.eclipse.swt.graphics.Color pollPreviousBgColor()
Removes and returns the last color from the previous background color stack. (LIFO)- Returns:
- The last
Colorthat was added to the previous background color stack.
-
hasPreviousBgColor
public boolean hasPreviousBgColor()
- Returns:
trueif there is a previous background color registered on the stack,falseif not.
-
addPreviousFont
public void addPreviousFont(org.eclipse.swt.graphics.Font font)
Add the givenFontto the stack of previous set fonts.- Parameters:
font- TheFontto add to the previous font stack
-
pollPreviousFont
public org.eclipse.swt.graphics.Font pollPreviousFont()
Removes and returns the last font from the previous font stack. (LIFO)- Returns:
- The last
Fontthat was added to the previous font stack.
-
isUnderlineActive
public boolean isUnderlineActive()
- Returns:
trueif underline styling is active,falseif not.
-
setUnderlineActive
public void setUnderlineActive(boolean underlineActive)
- Parameters:
underlineActive-trueif underline styling should be active,falseif not.
-
isStrikethroughActive
public boolean isStrikethroughActive()
- Returns:
trueif strikethrough styling is active,falseif not.
-
setStrikethroughActive
public void setStrikethroughActive(boolean strikethroughActive)
- Parameters:
strikethroughActive-trueif strikethrough styling should be active,falseif not.
-
setStartingPoint
public void setStartingPoint(int startX, int startY)
-
getPointer
public org.eclipse.swt.graphics.Point getPointer()
-
increaseX
public void increaseX(int x)
-
increaseY
public void increaseY(int y)
-
setX
public void setX(int x)
-
setY
public void setY(int y)
-
resetX
public void resetX()
Reset the x coordinate of the pointer to the value of the left margin. This is used to start a new line.
-
calculateX
public void calculateX(int areaWidth)
-
getMarginLeft
public int getMarginLeft()
-
setMarginLeft
public void setMarginLeft(int marginLeft)
-
getTextAlignment
public TagProcessingState.TextAlignment getTextAlignment()
-
setTextAlignment
public void setTextAlignment(TagProcessingState.TextAlignment textAlignment)
-
getCurrentLine
public LinePainter getCurrentLine()
-
setLineIterator
public void setLineIterator(java.util.Iterator<LinePainter> lineIterator)
-
activateNextLine
public void activateNextLine()
-
getCurrentLineHeight
public int getCurrentLineHeight()
-
getCurrentBiggestFontMetrics
public org.eclipse.swt.graphics.FontMetrics getCurrentBiggestFontMetrics()
-
isRendering
public boolean isRendering()
-
setRendering
public void setRendering(boolean render)
-
isOrderedList
public boolean isOrderedList()
-
setOrderedList
public void setOrderedList(boolean orderedList)
-
getListMargin
public int getListMargin()
-
setListMargin
public void setListMargin(int listMargin)
-
getCurrentListNumber
public java.lang.Integer getCurrentListNumber()
-
initCurrentListNumber
public void initCurrentListNumber()
-
increaseCurrentListNumber
public void increaseCurrentListNumber()
-
getListDepth
public int getListDepth()
-
resetListConfiguration
public void resetListConfiguration()
-
getParagraphCount
public int getParagraphCount()
-
increaseParagraphCount
public void increaseParagraphCount()
-
-