Interface IPlatformVisualComputer
-
public interface IPlatformVisualComputer
Computes visual element properties dependent on the specific client platform.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
IPlatformVisualComputer.FormattedStringCalculationMaxResult
static class
IPlatformVisualComputer.FormattedStringCalculationMinResult
static class
IPlatformVisualComputer.FormattedStringInfo
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IPlatformVisualComputer.FormattedStringCalculationMaxResult
calcFormattedStringByMaxWidth(String text, int maxWidth, Font fnt, boolean noPrefix, TextBreakMode breakMode, FormVisualEntity formElement)
Calculates a formatted string by max width.IPlatformVisualComputer.FormattedStringCalculationMinResult
calcFormattedStringByMinRows(String text, int minRows, Font font, FormVisualEntity formElement)
Calculates formated string by min rows.void
dereferenceFont(Font font)
Dereference the given font.Font
getBaseFont()
Returns the base font.double
getCharHeight()
Returns the char height.double
getCharWidth()
Returns the char width.int
getCommonRatio()
Returns the common ratio.int
getDPI()
Returns DPI compensation.IPlatformVisualComputer.FormattedStringInfo
getFormattedStringInfo(String formattedString)
Returns information for the given formatted string.int
getHorSpacing(FormItemSpacing horSpacingVariant)
Returns horisontal spacing for the given variant.int
getIndent(HTMIndentType indentType)
Returns indent value for the given type.int
getLogicRowHeight(HTMRowType rowType, Font font)
Returns a hight of the logic row.int
getMobileDPI()
Returns mobile DPI compensation.int
getSpaceLength(int characterCount, Font font)
Returns the space length for the given font and amount of characters.int
getStandardHeight(HTMStandardHeightType heightType)
Returns standart height for the given type.int
getStandardWidth(HTMStandardWidthType widthType)
Returns standart width for the given type.Size
getStringSize(String text, Font font, PrefSpac ps)
Calculates the string size.IV8Style
getStyle()
Returns style.int
getSumRatio(boolean useScale, boolean useMobileScale, boolean useDPI)
Returns sum ratio.void
getV8LogFont(Font font, V8LogFont logFont, int dpi, IV8Style pStyle, int ratio, double angle, boolean alwaysHighQuality)
Assign new V8 logic font value for the given logic font.V8LogFont
getV8LogFont(Font font, MeasurerFontKind fontKind, boolean noScale)
Returns V8 logic font for the given font.V8PictureProps
getV8PictureProps(V8Picture picture, boolean useDPI, boolean useScale, boolean keepOriginalSize)
Returns properties for the given picture.int
getVerSpacing(FormItemSpacing verSpacingVariant)
Returns vertical spacing for the given variant.org.eclipse.swt.graphics.Rectangle
measureString(String text, V8LogFont logFont, PrefSpac ps, boolean alwaysUseFormattedString)
Calculates text size as rectangle.int
scale(double pixels, boolean addMobileScale, boolean dpiCompensation)
Calculates scale for the given pixels and dpi.void
scaleFont(Font font, MeasurerFontKind fontKind)
Scales the given font.int
scaleHeight(int height)
Returns scaled height.int
scaleWidth(int width)
Returns scaled width.void
setCommonRatio(int ratio)
Set the common ratio.
-
-
-
Method Detail
-
getStandardWidth
int getStandardWidth(HTMStandardWidthType widthType)
Returns standart width for the given type.- Parameters:
widthType
- the standard width type, cannot benull
- Returns:
- width
-
getStandardHeight
int getStandardHeight(HTMStandardHeightType heightType)
Returns standart height for the given type.- Parameters:
heightType
- the standard height type, cannot benull
- Returns:
- height
-
scaleWidth
int scaleWidth(int width)
Returns scaled width.- Parameters:
width
- the width- Returns:
- scaled width
-
scaleHeight
int scaleHeight(int height)
Returns scaled height.- Parameters:
width
- the width- Returns:
- scaled width
-
getHorSpacing
int getHorSpacing(FormItemSpacing horSpacingVariant)
Returns horisontal spacing for the given variant.- Parameters:
horSpacingVariant
- the horisontal spacing variant, cannot benull
- Returns:
- spacing
-
getVerSpacing
int getVerSpacing(FormItemSpacing verSpacingVariant)
Returns vertical spacing for the given variant.- Parameters:
verSpacingVariant
- the vertical spacing variant, cannot benull
- Returns:
- spacing
-
getSpaceLength
int getSpaceLength(int characterCount, Font font)
Returns the space length for the given font and amount of characters.- Parameters:
characterCount
- the abount of characters for calculationfont
- the font, cannot benull
- Returns:
- length
-
getLogicRowHeight
int getLogicRowHeight(HTMRowType rowType, Font font)
Returns a hight of the logic row.- Parameters:
rowType
- the row type, cannot benull
font
- the font, cannot benull
- Returns:
- height
-
scale
int scale(double pixels, boolean addMobileScale, boolean dpiCompensation)
Calculates scale for the given pixels and dpi.- Parameters:
pixels
- the sizeaddMobileScale
- true if it is mobile themedpiCompensation
- the dpi compensation- Returns:
- size
-
scaleFont
void scaleFont(Font font, MeasurerFontKind fontKind)
Scales the given font.- Parameters:
font
- the font is mutable, cannot benull
fontKind
- the font kind is immutable, cannot benull
-
getIndent
int getIndent(HTMIndentType indentType)
Returns indent value for the given type.- Parameters:
indentType
- the indent type, cannot benull
- Returns:
- indent value
-
getStringSize
Size getStringSize(String text, Font font, PrefSpac ps)
Calculates the string size.- Parameters:
text
- the string, cannot benull
font
- the font, cannot benull
ps
- the spacing preferences, cannot benull
- Returns:
- size, cannot be
null
-
getV8LogFont
V8LogFont getV8LogFont(Font font, MeasurerFontKind fontKind, boolean noScale)
Returns V8 logic font for the given font.- Parameters:
font
- the font, cannot benull
fontKind
- the font kind, cannot benull
noScale
- , use true if scale is required- Returns:
- font, cannot be
null
-
getV8LogFont
void getV8LogFont(Font font, V8LogFont logFont, int dpi, IV8Style pStyle, int ratio, double angle, boolean alwaysHighQuality)
Assign new V8 logic font value for the given logic font.- Parameters:
font
- the font, cannot benull
logFont
- is mutable logical font, cannot benull
dpi
- the dpi compensationpStyle
- the v8 style, cannot benull
ratio
- the ratioangle
- the anglealwaysHighQuality
- the hight quality flag
-
getDPI
int getDPI()
Returns DPI compensation.- Returns:
- DPI
-
getMobileDPI
int getMobileDPI()
Returns mobile DPI compensation.- Returns:
- mobile DPI
-
getCommonRatio
int getCommonRatio()
Returns the common ratio.- Returns:
- ratio
-
setCommonRatio
void setCommonRatio(int ratio)
Set the common ratio.- Parameters:
ratio
-
-
measureString
org.eclipse.swt.graphics.Rectangle measureString(String text, V8LogFont logFont, PrefSpac ps, boolean alwaysUseFormattedString)
Calculates text size as rectangle.- Parameters:
text
- , cannot benull
logFont
- , cannot benull
ps
- , cannot benull
alwaysUseFormattedString
- the flag for formatted string- Returns:
- rectangle, cannot be
null
-
calcFormattedStringByMinRows
IPlatformVisualComputer.FormattedStringCalculationMinResult calcFormattedStringByMinRows(String text, int minRows, Font font, FormVisualEntity formElement)
Calculates formated string by min rows.- Parameters:
text
- , cannot benull
minRows
- the min rows numberfont
- the font, cannot benull
formElement
- the form element, cannot benull
- Returns:
- calculation result, cannot be
null
-
dereferenceFont
void dereferenceFont(Font font)
Dereference the given font.- Parameters:
font
- , cannot benull
-
getV8PictureProps
V8PictureProps getV8PictureProps(V8Picture picture, boolean useDPI, boolean useScale, boolean keepOriginalSize)
Returns properties for the given picture.- Parameters:
picture
- the picture, can benull
useDPI
- whether DPI should be used or notuseScale
- whether scale should be used or notkeepOriginalSize
- the keep original size flag- Returns:
-
getSumRatio
int getSumRatio(boolean useScale, boolean useMobileScale, boolean useDPI)
Returns sum ratio.- Parameters:
useScale
- whether scale should be used or notuseMobileScale
- whether mobile scale should be used or notuseDPI
- whether DPI should be used or not- Returns:
- ratio
-
getStyle
IV8Style getStyle()
Returns style.- Returns:
- cannot be
null
-
getBaseFont
Font getBaseFont()
Returns the base font.- Returns:
- the base font, can be
null
-
getCharWidth
double getCharWidth()
Returns the char width.- Returns:
- the char width.
-
getCharHeight
double getCharHeight()
Returns the char height.- Returns:
- the char height.
-
calcFormattedStringByMaxWidth
IPlatformVisualComputer.FormattedStringCalculationMaxResult calcFormattedStringByMaxWidth(String text, int maxWidth, Font fnt, boolean noPrefix, TextBreakMode breakMode, FormVisualEntity formElement)
Calculates a formatted string by max width.- Parameters:
text
- the text, cannot benull
maxWidth
- the max widthfnt
- the font, cannot benull
noPrefix
- the prefix flagbreakMode
- the word break mode, cannot benull
formElement
- the form element, cannot benull
- Returns:
- formatted string calculation result, cannot be
null
-
getFormattedStringInfo
IPlatformVisualComputer.FormattedStringInfo getFormattedStringInfo(String formattedString)
Returns information for the given formatted string.- Parameters:
formattedString
- the formatted string, cannot benull
- Returns:
- formatted string information, cannot be
null
-
-