JGraph X 1.4.1.0


com.mxgraph.io.vdx
Class mxVdxTextParser

java.lang.Object
  extended by com.mxgraph.io.vdx.mxVdxTextParser

public class mxVdxTextParser
extends Object

This class allows get the text contained in a shape formated with tags html.
The properties referenced in the Text element are processed by this class.


Constructor Summary
mxVdxTextParser(mxVdxShape shape, mxMasterShape masterShape, mxStyleSheet styleSheet)
          Creates a new instance of mxVdxTextParser.
 
Method Summary
 String getBulletValue(String index)
          Returns the value of the Bullet element of the shape.
This element may to be founded in the shape, master shape, stylesheet or default stylesheet.
 int getCase(String index)
          Returns the value of the case property.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 String getCharDirection(String index)
          Returns the direction of the text.
 String getCharSpace(String index)
          Returns the space between characters.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 String getHorzAlign(String index)
          Return the value of the horizontal align.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 String getHtmlTextContent()
          Returns the text contained in the shape formated with tags html.
 String getIndFirst(String index)
          Returns the indent of the first line in a paragraph.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 String getIndLeft(String index)
          Returns the indent to left in a paragraph.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 String getIndRight(String index)
          Returns the indent to right in a paragraph.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 int getPos(String index)
          Returns the Position of the text(If is superscript, subscript or normal text).
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 String getSpcAfter(String index)
          Returns the space after a paragraph.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 String getSpcBefore(String index)
          Returns the space before a paragraph.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 String getSpcLine(String index)
          Returns the space between lines in a paragraph.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 String getTextCharFormated(String text)
          Returns the text formated according the properties in the last Char element referenced.
 String getTextDirection(String index)
          Returns the direction of the text.
 String getTextFont(String index)
          Returns the actual font defined by the Char element referenced in cp.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 String getTextParagraphFormated(String para)
          Returns the paragraph formated according the properties in the last Para element referenced.
 String insertAttributes(String text, HashMap<String,Object> attr)
          Inserts the style attributes contained in attr into the text.
The text must be surrounded by tags html.
 boolean isBold(String index)
          Checks if the style property of the Char element of index = 'index' indicates bold.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 boolean isItalic(String index)
          Checks if the style property of the Char element of index = 'index' indicates italic.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 boolean isSmallCaps(String index)
          Checks if the style property of the Char element of index = 'index' indicates small caps.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 boolean isStrikeThru(String index)
          Checks if the strikethru property of the Char element of index = 'index' indicates true.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 boolean isUnderline(String index)
          Checks if the style property of the Char element of index = 'index' indicates underline.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.
 String textToList(String text, String pp)
          Transform plain text into a html list if the Para element referenced by pp indicates it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

mxVdxTextParser

public mxVdxTextParser(mxVdxShape shape,
                       mxMasterShape masterShape,
                       mxStyleSheet styleSheet)
Creates a new instance of mxVdxTextParser.

Parameters:
shape - Shape that contains the text.
masterShape - Master Shape of the shape.
styleSheet - Stylesheet with the Text Style.
Method Detail

getHtmlTextContent

public String getHtmlTextContent()
Returns the text contained in the shape formated with tags html.

Returns:
Text content in html.

textToList

public String textToList(String text,
                         String pp)
Transform plain text into a html list if the Para element referenced by pp indicates it.

Parameters:
text - Text to be transformed.
pp - Reference to a Para element.
Returns:
Text like a html list.

getBulletValue

public String getBulletValue(String index)
Returns the value of the Bullet element of the shape.
This element may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Para element that contains the Bullet element.
Returns:
String value of the Bullet element.

getTextParagraphFormated

public String getTextParagraphFormated(String para)
Returns the paragraph formated according the properties in the last Para element referenced.

Parameters:
para - Paragraph to be formated
Returns:
Formated paragraph.

getTextDirection

public String getTextDirection(String index)
Returns the direction of the text. It may be right to left or left to right.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Para element that contains the Flags element.
Returns:
The direction of the text.

getSpcLine

public String getSpcLine(String index)
Returns the space between lines in a paragraph.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Para element that contains the SpLine element.
Returns:
The space between lines n pixels.

getSpcBefore

public String getSpcBefore(String index)
Returns the space before a paragraph.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Para element that contains the SpBefore element.
Returns:
The space before the paragraph in pixels.

getSpcAfter

public String getSpcAfter(String index)
Returns the space after a paragraph.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Para element that contains the SpAfter element.
Returns:
The space after the paragraph in pixels.

getIndLeft

public String getIndLeft(String index)
Returns the indent to left in a paragraph.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Para element that contains the IndLeft element.
Returns:
The indent to left in a paragraph in pixels.

getIndRight

public String getIndRight(String index)
Returns the indent to right in a paragraph.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Para element that contains the IndRight element.
Returns:
The indent to right in a paragraph in pixels.

getIndFirst

public String getIndFirst(String index)
Returns the indent of the first line in a paragraph.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Para element that contains the IndFirst element.
Returns:
The indent of the first line in a paragraph in pixels.

getHorzAlign

public String getHorzAlign(String index)
Return the value of the horizontal align.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Para element that contains the HorzAlign element.
Returns:
The value of the horizontal align in a paragraph.

insertAttributes

public String insertAttributes(String text,
                               HashMap<String,Object> attr)
Inserts the style attributes contained in attr into the text.
The text must be surrounded by tags html.

Parameters:
text - Text where the attributes must be inserted.
attr - Map with the attributes.
Returns:
Text with the attributes applied like style.

getTextCharFormated

public String getTextCharFormated(String text)
Returns the text formated according the properties in the last Char element referenced.

Parameters:
text - Text to be formated
Returns:
Formated text.

getCharSpace

public String getCharSpace(String index)
Returns the space between characters.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Char element that contains the LetterSpace element.
Returns:
String representation of the space between characters in pixels.

getCharDirection

public String getCharDirection(String index)
Returns the direction of the text. It may be right to left or left to right.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Char element that contains the RTLText element.
Returns:
Direction of the text.

getCase

public int getCase(String index)
Returns the value of the case property.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Char element that contains the Case element.
Returns:
Value of the case property.

getPos

public int getPos(String index)
Returns the Position of the text(If is superscript, subscript or normal text).
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Char element that contains the Pos element.
Returns:
Value of the Pos element.

isBold

public boolean isBold(String index)
Checks if the style property of the Char element of index = 'index' indicates bold.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Char element that contains the Style element.
Returns:
Returns true if the style property of the Char element of index = 'index' indicates bold.

isItalic

public boolean isItalic(String index)
Checks if the style property of the Char element of index = 'index' indicates italic.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Char element that contains the Style element.
Returns:
Returns true if the style property of the Char element of index = 'index' indicates italic.

isUnderline

public boolean isUnderline(String index)
Checks if the style property of the Char element of index = 'index' indicates underline.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Char element that contains the Style element.
Returns:
Returns true if the style property of the Char element of index = 'index' indicates underline.

isSmallCaps

public boolean isSmallCaps(String index)
Checks if the style property of the Char element of index = 'index' indicates small caps.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Char element that contains the Style element.
Returns:
Returns true if the style property of the Char element of index = 'index' indicates small caps.

isStrikeThru

public boolean isStrikeThru(String index)
Checks if the strikethru property of the Char element of index = 'index' indicates true.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Char element that contains the StrikeThru element.
Returns:
Returns true if the strikethru property of the Char element of index = 'index' indicates true.

getTextFont

public String getTextFont(String index)
Returns the actual font defined by the Char element referenced in cp.
This property may to be founded in the shape, master shape, stylesheet or default stylesheet.

Parameters:
index - Index of the Char element that contains the Font element.
Returns:
Returns the name of the font.

JGraph X 1.4.1.0


Copyright (c) 2010 Gaudenz Alder. All rights reserved.