Namespace: Consultingwerk.Util
Class 
FormatHelper Copy to Clipboard
Parent classes:
Inherits: Progress.Lang.Object

File:FormatHelper
Syntax:Static methods only, private constructor to disallow
instance creation
Author(s):Marko Rüterbories / Consultingwerk Ltd.
Created:Wed Jun 03 15:26:16 CEST 2009
Notes:OpenEdge Help - FORMAT option, format phrase
Infragistics Docu - http://help.infragistics.com/NetAdvantage/WinForms/2012.2/CLR4.0/html/Infragistics4.Win.UltraWinMaskedEdit.v12.2~Infragistics.Win.UltraWinMaskedEdit.UltraMaskedEdit~InputMask.html?page=Infragistics4.Win.UltraWinMaskedEdit.v12.2~Infragistics.Win.UltraWinMaskedEdit.UltraMaskedEdit~InputMask.html
Problematic Masks:
FormatHelper:ToInputMask("CHARACTER", "!(4)x(8)")
The ! sign means that the following four letters will be uppercased.
Infragistics does not support this functionality like Progress does.
Either the full Mask will be uppercased by adding the > sign at the
beginning or nothing will be upper or lowercased.
Infragistics only supports converting all following characters.
> Convert all the characters that follow to uppercase.
< Convert all the characters that follow to lowercase.
Uppercasing the InputMask if only ! are present in the Progress
Format Expression like "!(4)" is implemented.
FormatHelper:ToInputMask("INTEGER", "HH:MM:SS.SSS+HH:MM")
The Time Mask when passed as an INTEGER is not analysed so H, M and S
will be replaced by n but the Mask will not be validated in any way.
For Time input only a Mask like "HH:MM:SSSS" without a dot within the
seconds and maximum four second placeholders is valid. The Timezone is
not supported by Infragistics.
/* Mike Fechner, Consultingwerk Ltd. 13.09.2017
Preprocessor variables for SmartComponentLibrary, WinKit and SmartFramework
based on Consultingwerk/packages.i now



Top Method Summary
Options Name Purpose
- CHARACTER BuildDateMask (character) Returns an Infragistics Date Mask. Invoked by ToInputMask.
- CHARACTER BuildTimeMask (character) Returns an Infragistics Time Mask. Invoked by ToInputMask.
+ CHARACTER DefaultFormat (character) Determines the default format for the given ABL Data-type
+ DECIMAL FormatWidthChars (character, character) Returns the default width used for a fill-in with the given format
+ CHARACTER GetFormatFromInputMask (character, character) Returns a display Format to be used in the Grid build from the edit Mask returned from the ToInputMask method.
+ INTEGER GetFormatWidthPixels (character) Returns the width pixels for a given ABL format
+ INTEGER GetNumberOfDecimalDigits (character) Returns the number of decimal digits of the given format
+ CHARACTER IntegerFormatForMax (integer) Returns the required integer format for an upper limit, including leading zero's
+ LOGICAL IsValidFormatString (character, character) Verifies if the format string is a valid format for the given datatype
- CHARACTER ResolveRepeatingChars (character) Returns an interpreted InputMask. "x(4)" -> "xxxx" "!(4)x(8)" -> "!!!!xxxxxxxx"
- SplitDateAndTimeMasks (character, character, character) Returns the Date and the Time part of an ImputMask.
+ CHARACTER ToInputMask (character, character) Returns an Infragistics InputMask translated from a Progress Edit Mask.

Top Constructor Summary
Options Name Purpose
# FormatHelper () Protected default constructor.


Method Detail
Top

PRIVATE CHARACTER BuildDateMask (character)

Purpose: Returns an Infragistics Date Mask.
Invoked by ToInputMask.
Notes:

Parameters:
pcDateMask CHARACTER
The ABL DATE FORMAT string
Returns CHARACTER
The matching Infragistics InputMask for the date field
Top

PRIVATE CHARACTER BuildTimeMask (character)

Purpose: Returns an Infragistics Time Mask.
Invoked by ToInputMask.
Notes:

Parameters:
pcTimeMask CHARACTER
The ABL TIME FORMAT string
Returns CHARACTER
The matching Infragistics InputMask for the time field
Top

PUBLIC CHARACTER DefaultFormat (character)

Purpose: Determines the default format for the given ABL Data-type
Notes:

Parameters:
pcDataType CHARACTER
The ABL DataType
Returns CHARACTER
The Default Format
Top

PUBLIC DECIMAL FormatWidthChars (character, character)

Purpose: Returns the default width used for a fill-in with the given format
Notes:

Parameters:
pcFormat CHARACTER
The field format
pcDataType CHARACTER
The field datatpye
Returns DECIMAL
The width
Top

PUBLIC CHARACTER GetFormatFromInputMask (character, character)

Purpose: Returns a display Format to be used in the Grid build from the edit
Mask returned from the ToInputMask method.
Notes:

Parameters:
pcDataType CHARACTER
The Progress Data-Type that belongs to the FormatMask
pcIGInputMask CHARACTER
The Infragistics input mask as returned by the ToInputMask method
Returns CHARACTER
The Infragistics format string matching the Infragistics edit mask
Top

PUBLIC INTEGER GetFormatWidthPixels (character)

Purpose: Returns the width pixels for a given ABL format
Notes: Creates a fill-in on the fly and assigns the format. Return value
is dependent on the current font settings

Parameters:
pcFormat CHARACTER
The format to measure
Returns INTEGER
The width in pixels for the given format
Top

PUBLIC INTEGER GetNumberOfDecimalDigits (character)

Purpose: Returns the number of decimal digits of the given format
Notes: Based on the first period (.) in the format string, counting the
following 9's

Parameters:
pcFormat CHARACTER
The format string to return the number of decimal digits for
Returns INTEGER
The number of digits provided by the given format string
Top

PUBLIC CHARACTER IntegerFormatForMax (integer)

Purpose: Returns the required integer format for an upper limit, including
leading zero's
Notes: Useful for sequences of field names (EXTENT field resolution)

Parameters:
piMaxValue INTEGER
The maximum value that should be visualized using the FORMAT
Returns CHARACTER
The FORMAT that can visualize up to the given maximum value
Top

PUBLIC LOGICAL IsValidFormatString (character, character)

Purpose: Verifies if the format string is a valid format for the given datatype
Notes:

Parameters:
pcDataType CHARACTER
The data type
pcFormat CHARACTER
The format string to validate
Returns LOGICAL
Top

PRIVATE CHARACTER ResolveRepeatingChars (character)

Purpose: Returns an interpreted InputMask.
"x(4)" -> "xxxx"
"!(4)x(8)" -> "!!!!xxxxxxxx"
Notes:

Parameters:
cFormat CHARACTER
An ABL CHARCTER FORMAT using the repeat mask syntax, e.g. x(8)
Returns CHARACTER
The ABL CHARACTER FORMAT resolved by the repaiting characters
Top

PRIVATE SplitDateAndTimeMasks (character, character, character)

Purpose: Returns the Date and the Time part of an ImputMask.
Notes:

Parameters:
pcMask CHARACTER
The ABL FORMAT for a DATETIME or DATETIME-TZ value
pcDateMask CHARACTER
OUTPUT The Date part of the FORMAT
pcTimeMask CHARACTER
OUTPUT The Time part of the FORMAT
Top

PUBLIC CHARACTER ToInputMask (character, character)

Purpose: Returns an Infragistics InputMask translated from a Progress Edit
Mask.
Notes:

Parameters:
pcDataType CHARACTER
The Progerss Data-Type that belongs to the FORMAT mask
pcProgressEditMask CHARACTER
The Progress ABL FORMAT mask, e.g. X(8)
Returns CHARACTER
The Infragistics InputMask matching the ABL FORMAT mask


Constructor Detail
Top

PROTECTED FormatHelper ()

Purpose: Protected default constructor.
Notes: There's no need to create instances of the helper classes



©2006-2019 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       08.08.2019 23:57:10