org.vishia.gral.base

## Class GralPos

- java.lang.Object
- - org.vishia.gral.base.GralPos

- All Implemented Interfaces:
    java.lang.Cloneable

      public class GralPos
      extends java.lang.Object
      implements java.lang.Cloneable

  This class describes a position in a gral panel.
  Concept of positioning:
  The position are never given as pixel positions. They are user-oriented positions. The calculation of pixel units are done from the implementing graphic layer depending on the graphic device properties and the requested size appearance. The same graphic elements can be presented in several sizes on the display.
  A normal text with a font in the standard proper read-able size is presented by 2 units of the Gral-position in vertical direction (line) and approximately 1 unit per character in horizontal direction. Of course the horizontal character size depends on the font properties. A text can be presented in a smaller or larger font. The text height depends on the height given in the position of the text. A very small font is presented by 1 vertical gral-unit. Such a text can be used as short title for text input fields (prompt) or adequate.
  A button is able to proper present with 3 or 2 vertical gral units. A small check box may be presented with 1 x 1 gral unit.
  A gral unit should be have the same distance in vertical as in horizontal direction. It depends on the graphical implementation. One gral unit may have approximately 6 to 30 pixel, depending on the requested size of appearance in comparison with the given display pixel size. Any graphic can be shown in several sizes of appearance, given with a start parameter of the application (see `org.vishia.gral.area9.GuiCallingArgs#sSize`) respectively the parameter size of `GralGridProperties.GralGridProperties(char size)`.
  Fine positions:
  Either the positions are given with 2 integer values as 'fundamental positions'. That are the position described above. Or they can be given with a float value or a second int named 'fractional part'. From the float value only the first digit after point is used, a fractional part can be given with a value from 0 to 9.
  The fine position divides one gral position into 5 or into 6 fine positions. The odd numbers divide into 6 positions. In this kind a gral position is able to divide by 2, 3 and 6:
  - 1: 1/6 = 0.1333
  - 3: 1/3 = 0.3333
  - 5: 1/2 = 0.5
  - 7: 2/3 = 0.6667
  - 9: 5/6 = 0.8667
  The even numbers divide into 5 positions:
  - 2: 1/5 = 0.2
  - 4: 2/5 = 0.4
  - 6: 3/5 = 0.6
  - 8: 4/5 = 0.8
  The fine positioning enables a fine positioning of widgets in respect to the fundamental positions.
  Positions as user arguments:
  Positions may be given with absolute values of grid units regarded to the actual panel or in related to the last or parent position. In that cases the constant values are added to the number, see the following list. The position is given in form 'from..to' for the line and column or in form 'from' and 'size'. The size may be given positive or negative. A positive size is counted from top or left to bottom or right. It means that the 'from' position is top or left. But a negative size is counted from right or bottom and the 'from' position is the right or bottom column and line.
  Position writing style in a gral script:
  The appearance of a graphic can be given with a script using `GralCfgZbnf`. The writing style of positions in the script regards a stinting short style to give positions, because a hand written script should not cause a lot of calculations for positions by the writer. It should be simple. The syntax of a position in the gral script is given in the variable `syntaxZbnf`. The method `setPosition(CharSequence, GralPos)` uses that syntax.
  - @myPanel, 5..7, 8..18: This is a full given absolute position. The element should be placed from line 5 to line 7 and from column 8 to 18. The vertical position 7 is the bottom line, the column 18 is the right column exclusive. The horizontal size is 10, the vertical size is 2.
  - @myPanel, 5..7, 8..-1: This is a full given absolute position. The end column is given with a negative value. It means that the end column is related to the right border of the panel.
  - @myPanel, 5+2, 8+10: This is a full given position using the size. The element should be placed from line 5 to line 7 and from column 8 to 18. The range is given as size.
  - @7-2, 18-10: The panel isn't given, so the panel of the last position, in the script in order of text, is used. The positions are exactly the same, from 5 to 7 and from 10 to 18. But because the size is given as negative value, the position value is the bottom line and the right column. A user may place elements with a common bottom line. The this form can be used.
  - @7-2, 10+18++1: This is the same position too. The '++' operator after size means, that the next element is positioning right side after the current in distance of 1 unit (distance feature TODO).
  - @-3,+4: The position isn't given yet. It means, the position of the last element is used. Because the size is negative, the bottom position of the last element is used. Because the last position is designated with '++' for column, the column value of position is the right value and the current element is placed right hand from the last one. This is an example of a button right from a text. The button is some times greater (3 units) in relation to the text (2 units), but they have the same button line.
  - @,+5: Here the line isn't specified. It is taken from the last position: bottom line 7 and height 3. The column isn't given, it is taken form the last: Because the column position is cumulated, it is the 22 yet.
  - If no position is given, the position is the next position. In this example @7-3,27+5.
  - @,&2+10: The ampersand determines a relative position related to the last one. In this example the new column is 24 to 34. There is 2 units space.
  - @ $2-2,$+20: The dollar determines a relative position related to the last absolute given position. In this example it is line 7 and column 10. The new position is calculated with that values to line 9. The column 10 is the same column related to the last given absolute. This kind of specification allows determining some positions in lines and columns, whereby the absolute position is given only one time. (feature TODO)
  - @ %50-2,%10..%90: The positions are calculated from the size of the panel in percent. (feature TODO)
  Ranges and Designation of position parameter:
  - Positive number in range 0...about 100..200 up to 1000: Grid Unit from left or top.
  - Negative number in range 0, -1...about -200..-200 up to 1000: Gral Unit from right or bottom. 0 for lineEnd or columnEnd means the right or bottom.
  - `same` or `refer` added with a number in range of -1000..1000: This given position refers to the parent position with the given distance. same and refer is equate, the difference is in semantic only. Use `same` without distance, use `refer` +/- distance. If `same` or `refer` is used for the line or column, and the second position is given with '`size` - size' then the bottom or right value of the parent is referred.
  - `size` + number applied at lineEnd or columnEnd: The size is given instead from..to. Because the size value is positive, the line and column value is left or top.
  - `size` - number applied at lineEnd or columnEnd: The size is given negative. The absolute value is the size. Because the size is negative it is measured from right to left respectively bottom to top. It means the given line and column is the right or the bottom line. If the position is given using `same` or `refer`, the related end position is used.
  - `next` and `nextBlock`
  - as width or height or as percent value from the panel size.
  Fine positions are given always from left or top of the fundamental positions. For example a value -1.3 means, the widget is placed 1 unit from right, and then 1/3 inside this unit. This is 2/3 unit from right. A value for example -0.3 is not admissible, because -0 is not defined.
  The position values in this class:
  Though the position parameters may be given as size, with bottom line etc the position values are stored as absolute positions anyway. That are the elements `x`, and `y` with its values in `GralPos.Coordinate`. The x and y is the lesser value, left and top, and the xEnd and yEnd is the greater value, right or bottom. This form of storing is better to calculate the pixel position while building the graphic and it is better to calculate related position too.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `GralPos.Coordinate` Class holds values for either x or y.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static int` | `kBitParamDesignator_x` Position and mask of bits to designate kind of parameter.
    `private static int` | `kBitParamDesignator_y` Position and mask of bits to designate kind of parameter.
    `private static int` | `kSpecialType` Bit masks for the special types `next`, `nextBlock`, `useNatSize`.
    `private static int` | `kTypAdd_` Bits in an integer position value for the type.
    `private static int` | `mBitRel` Mask bits to designate related position, related end position and size.
    `private static int` | `mBitRelEnd` Mask bits to designate related position, related end position and size.
    `private static int` | `mBitSize` Mask bits to designate related position, related end position and size.
    `private static int` | `mBitSizeNeg` Mask bits to designate related position, related end position and size.
    `private static int` | `mParamDesignator` Position and mask of bits to designate kind of parameter.
    `private static int` | `mSpecialType` Bit masks for the special types `next`, `nextBlock`, `useNatSize`.
    `private static int` | `mType_` Bits in an integer position value for the type.
    `private static int` | `mValueNegative` Bits in an integer position value for range and size.
    `private static int` | `mValueRange_` Bits in an integer position value for range and size.
    `static int` | `next` Use the next value for the coordinate in relation to the last one for the given direction but the same value for the other coordinate.
    `static int` | `nextBlock` Use the next value for the coordinate in relation to the last one.
    `GralPanelContent` | `panel` Relation of x and y left and top to any separation line. 0 - relation to left and top border.
    `static int` | `ratio` This bit at all coordinates means, that the value is given as ratio from the size.
    `static int` | `refer` This adding value applied at any coordinate parameter of any setPosition- method means, that the value is referred to the position of the previous or given position.
    `static int` | `same` This value applied at any coordinate parameter of any setPosition- method means, that the value is the same as the previous or given position.
    `static int` | `samesize` Use the same size.
    `static int` | `size` This adding value at xEnd or yEnd or the float presentations of the calling argument of any setPosition- method means, that the value is the size, not the position.
    `static java.lang.String` | `syntaxZbnf` Syntax of a position.
    `static int` | `useNatSize` This value at xEnd or yEnd means, that the native size of a widget should be used.
    `static int` | `version` Version, history and license.
    `GralPos.Coordinate` | `x` The values for x and y positions.
    `private static int` | `XXXmCheckRatio_` Mask to check ratio.
    `private static int` | `XXXmNatSize_` Mask for value of natural size.
    `GralPos.Coordinate` | `y` The values for x and y positions.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `GralPos()` A GralPos should never create as instance from the application.
    `protected` | `GralPos(GralPos src)` A GralPos should never create as instance from the application.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private static void` | `appendPos(java.lang.StringBuilder b, int p, int pFrac)`
    `GralRectangle` | `calcWidgetPosAndSize(GralGridProperties propertiesGui, int widthParentPixel, int heightParentPixel, int widthWidgetNat, int heightWidgetNat)` Calculates the position and size of a widget from this given Pos.
    `GralPos` | `clone()`
    `private void` | `frac(float v, int[] pos, int ix)`
    `float` | `height()`
    `java.lang.String` | `posString()`
    `private void` | `scanPosition(StringPartScan spPos, GralPos.Coordinate co)` Scans one coordinate.
    `void` | `set(GralPos pos)` Sets all values of this with the values of pos (copy values)
    `void` | `setFinePosition(int line, int yPosFrac, int ye, int yef, int column, int xPosFrac, int xe, int xef, int origin, char direction, int border, int borderFrac, GralPos parent)` Sets the position for the next widget to add in the container.
    `GralPos` | `setNextPos(java.lang.String posString)`
    `void` | `setNextPosition()` Sets the position to the next adequate the `#pos.dirNext`.
    `void` | `setPosition(java.lang.CharSequence sPos, GralPos posParent)` Sets the position with the given string representation.
    `void` | `setPosition(float line, float column)`
    `void` | `setPosition(GralPanelContent panel, float line, float lineEndOrSize, float column, float columnEndOrSize, int origin, char direction, float border)` Sets the position to the given panel as container.
    `void` | `setPosition(GralPos framePos, float line, float lineEndOrSize, float column, float columnEndOrSize, int origin, char direction)`
    `void` | `setPosition(GralPos framePos, float line, float lineEndOrSize, float column, float columnEndOrSize, int origin, char direction, float border)` Sets the position
    `void` | `setPositionSize(int line, int column, int height, int width, char direction, GralPos posFrame)`
    `void` | `setSize(float height, float width, GralPos frame)`
    `void` | `setSize(int height, int ySizeFrac, int width, int xSizeFrac)`
    `(package private) void` | `stop()`
    `static void` | `testScanSize()`
    `boolean` | `toResize()` Returns true if this position is from right or bottom, so that a resize of the panel needs new positions for this widget.
    `java.lang.String` | `toString()` Use especially for debug.
    `float` | `width()`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### version

          public static final int version

      Version, history and license.
      - 2013-05-24 Hartmut bugfix fine position can be greater 20 if positions are add and sizes are add too.
      - 2011-10-01 Hartmut corr: Calculation of next position or refer + value if the size was negative and sameSize is selected. Then the new input value should calculate from the bottom or left value because the size is negative furthermore.
      - 2011-10-01 Hartmut bugfix: if(qf >= 10)... instead >10
      - 2011-09-23 Hartmut chg: The methods `setPosition(GralPos, float, float, float, float, int, char)` etc are moved from the GralGridMngBase to this. It are methods of this class functionally. The GralGridMngBase wrappes it because that methods should be able to call there.
      - 2011-08-31 Hartmut new: constants `same` etc. as adding values for setPosition-methods. It prevents the necessity of a lot of special set methods. The parameter for positions may be relative, referred etc. to the previous position or to a frame.
      - 2011-08-31 Hartmut new: method `toString()` to see values of instance in debug
      - 2011-08-14 Hartmut new: creation of this class. Beforehand this values are stored inside the GralGridMngBase as main position. But a position in this kind is necessary in other contexts too, and the position values should be pooled in one class.
      - 2011-06-00 Hartmut created
      Copyright/Copyleft:
      For this source the LGPL Lesser General Public License, published by the Free Software Foundation is valid. It means:
      1. You can use this source without any restriction for any desired purpose.
      2. You can redistribute copies of this source to everybody.
      3. Every user of this source, also the user of redistribute copies with or without payment, must accept this license for further using.
      4. But the LPGL is not appropriate for a whole software product, if this source is only a part of them. It means, the user must publish this part of source, but doesn't need to publish the whole source of the own product.
      5. You can study and modify (improve) this source for own using or for redistribution, but you have to license the modified sources likewise under this LGPL Lesser General Public License. You mustn't delete this Copyright/Copyleft inscription in this source file.
      If you intent to use this source without publishing its usage, you can get a second license subscribing a special contract with the author.
      See Also:
        Constant Field Values

    - #### refer

          public static final int refer

      This adding value applied at any coordinate parameter of any setPosition- method means, that the value is referred to the position of the previous or given position. The referred value may be given as positive or negative number. Adding this constant a value in range 0x7000...0x8000 to 0x8fff results for positions -4096...4095 (usual -100..100) Hint: If only the fractional part is changed, the non-fractional part should be given as refer.
      See Also:
        Constant Field Values

    - #### same

          public static final int same

      This value applied at any coordinate parameter of any setPosition- method means, that the value is the same as the previous or given position. Hint: The constant is equal to `refer`. This constant regards the semantic.
      See Also:
        Constant Field Values

    - #### next

          public static final int next

      Use the next value for the coordinate in relation to the last one for the given direction but the same value for the other coordinate. It is the typical value for both coordinates if a quasi-float layout is desired. This value can be applied to x, xEnd, y, yEnd or to the float given arguments of any setPosition- method. It uses xEnd for x and yEnd for y with the adequate fractional parts. The new value for xEnd or yEnd is calculated using the size if this value is applied to them.
      See Also:
        Constant Field Values

    - #### nextBlock

          public static final int nextBlock

      Use the next value for the coordinate in relation to the last one. This value can be applied to x, xEnd, y, yEnd or to the float given arguments of any setPosition- method. It uses xEnd for x and yEnd for y with the adequate fractional parts. The new value for xEnd or yEnd is calculated using the size if this value is applied to them.
      See Also:
        Constant Field Values

    - #### useNatSize

          public static final int useNatSize

      This value at xEnd or yEnd means, that the native size of a widget should be used. It is especially to draw images with its native size. This is a bit mask. The nature size is stored in the bits 12..0, that is maximal 8191 pixel
      See Also:
        Constant Field Values

    - #### ratio

          public static final int ratio

      This bit at all coordinates means, that the value is given as ratio from the size. The bit `useNatSize` have to be 0. The ratio is stored as a value from 0 to 999 in the bits 9..0. The other bits should be 0.
      See Also:
        Constant Field Values

    - #### size

          public static final int size

      This adding value at xEnd or yEnd or the float presentations of the calling argument of any setPosition- method means, that the value is the size, not the position. A size can be positive or negative. A negative size determines, that the origin point for further elements or inner elements is on bottom line or right line of the current widget.
      See Also:
        Constant Field Values

    - #### samesize

          public static final int samesize

      Use the same size.
      See Also:
        Constant Field Values

    - #### mValueRange_

          private static final int mValueRange_

      Bits in an integer position value for range and size. of relative position values for size, percent and refer. The mask for the value is 0x1fff. The range of any value is from 0x0 to 0x0fff for positive values and from 0x1fff downto 0x1000 for negative values. The value == 0 is designated with 0x0 after mask.
      See Also:
        Constant Field Values

    - #### mValueNegative

          private static final int mValueNegative

      Bits in an integer position value for range and size. of relative position values for size, percent and refer. The mask for the value is 0x1fff. The range of any value is from 0x0 to 0x0fff for positive values and from 0x1fff downto 0x1000 for negative values. The value == 0 is designated with 0x0 after mask.
      See Also:
        Constant Field Values

    - #### mType_

          private static final int mType_

      Bits in an integer position value for the type. If the type should be tested, the mTypwAdd_ should be added before masking. That is because the negative values for a specific type are disposed type - value
      See Also:
        Constant Field Values

    - #### kTypAdd_

          private static final int kTypAdd_

      Bits in an integer position value for the type. If the type should be tested, the mTypwAdd_ should be added before masking. That is because the negative values for a specific type are disposed type - value
      See Also:
        Constant Field Values

    - #### mSpecialType

          private static final int mSpecialType

      Bit masks for the special types `next`, `nextBlock`, `useNatSize`.
      See Also:
        Constant Field Values

    - #### kSpecialType

          private static final int kSpecialType

      Bit masks for the special types `next`, `nextBlock`, `useNatSize`.
      See Also:
        Constant Field Values

    - #### XXXmCheckRatio_

          private static final int XXXmCheckRatio_

      Mask to check ratio. This bits should be mask and the ratio value should compare with them.
      See Also:
        Constant Field Values

    - #### XXXmNatSize_

          private static final int XXXmNatSize_

      Mask for value of natural size. The maximum size is 16383 pixel.
      See Also:
        Constant Field Values

    - #### mBitRel

          private static final int mBitRel

      Mask bits to designate related position, related end position and size.
      See Also:
        Constant Field Values

    - #### mBitSize

          private static final int mBitSize

      Mask bits to designate related position, related end position and size.
      See Also:
        Constant Field Values

    - #### mBitRelEnd

          private static final int mBitRelEnd

      Mask bits to designate related position, related end position and size.
      See Also:
        Constant Field Values

    - #### mBitSizeNeg

          private static final int mBitSizeNeg

      Mask bits to designate related position, related end position and size.
      See Also:
        Constant Field Values

    - #### kBitParamDesignator_x

          private static final int kBitParamDesignator_x

      Position and mask of bits to designate kind of parameter. See `#parameterDesignation`
      See Also:
        Constant Field Values

    - #### kBitParamDesignator_y

          private static final int kBitParamDesignator_y

      Position and mask of bits to designate kind of parameter. See `#parameterDesignation`
      See Also:
        Constant Field Values

    - #### mParamDesignator

          private static final int mParamDesignator

      Position and mask of bits to designate kind of parameter. See `#parameterDesignation`
      See Also:
        Constant Field Values

    - #### syntaxZbnf

          public static final java.lang.String syntaxZbnf

      Syntax of a position. It is

            position::= @ [<$?panel> ,]
                 [ &+] [<#?yPos>[\\.<#?yPosFrac>]]
               [ [+] <#-?ySizeDown>[\\.<#?ySizeFrac>]| +*  |]
             [ , [ &+] [<#?xPos>[\\.<#?xPosFrac>]]
               [ [+] <#-?xWidth>[\\.<#?xSizeFrac>]| +*  |] [  ++]
             ].

      The semantic identifier match to the elements in `GralCfgPosition`.

    - #### x

          public final GralPos.Coordinate x

      The values for x and y positions. Note: should be private! Don't use in application furthermore.

    - #### y

          public final GralPos.Coordinate y

      The values for x and y positions. Note: should be private! Don't use in application furthermore.

    - #### panel

          public GralPanelContent panel

      Relation of x and y left and top to any separation line. 0 - relation to left and top border.

  - ### Constructor Detail

    - #### GralPos

          protected GralPos()

      A GralPos should never create as instance from the application. It is created only from the GralMng which accesses package private. It is copied inside the GralMng for any widget. The position can be changed after them with `setPosition(float, float)` etc.

    - #### GralPos

          protected GralPos(GralPos src)

      A GralPos should never create as instance from the application. It is created only from the GralMng which accesses package private. It is copied inside the GralMng for any widget. The position can be changed after them with `setPosition(float, float)` etc.
      Parameters:
        `src` - the src position to copy all values.

  - ### Method Detail

    - #### set

          public void set(GralPos pos)

      Sets all values of this with the values of pos (copy values)
      Parameters:
        `pos` - The src pos

    - #### setPosition

          public void setPosition(float line,
                                  float column)

    - #### setPositionSize

          public void setPositionSize(int line,
                                      int column,
                                      int height,
                                      int width,
                                      char direction,
                                      GralPos posFrame)

    - #### setPosition

          public void setPosition(java.lang.CharSequence sPos,
                                  GralPos posParent)
                           throws java.text.ParseException

      Sets the position with the given string representation.
      Parameters:
        `sPos` - The syntax of the string see description of this class, starting with "@panel, ..." etc. for example "@windowA, 3..5, 16+20" for absolute line 3 and 4 (exclusive 5) and from absolute column 16, size-x=20. The position can be given without panel designation or relative, then the posParent argument is necessary.
        `posParent` - necessary to build the absolute position from relative given sPos, maybe null if not necessary.
      Throws:
        `java.text.ParseException` - on errors of sPos or missing posParent if necessary.

    - #### scanPosition

          private void scanPosition(StringPartScan spPos,
                                    GralPos.Coordinate co)
                             throws java.text.ParseException

      Scans one coordinate.

           [[+|-]<#?p1>[.<#p2Frac>] [..|]] <#?p2>[.<#p2Frac>]

      If only the right number is given, p1 is `refer`
      Parameters:
        `spPos` -
        `co` -
      Throws:
        `java.text.ParseException`

    - #### setPosition

          public void setPosition(GralPanelContent panel,
                                  float line,
                                  float lineEndOrSize,
                                  float column,
                                  float columnEndOrSize,
                                  int origin,
                                  char direction,
                                  float border)

      Sets the position to the given panel as container.
      Parameters:
        `panel` - The panel which is used as container. Its current `GralWidget.pos()` is used for relative positions
        `line` - The line. If the parameter lineEndOrSize is designated with `size` with a negative value, it is the bottom line for the position. If it is designated with `same` without offset and the lineEndOrSize is designated with `size` with a negative value, the framePos `GralPos#y.p2` is used. If it is designated with `same` but with any offset, the `y` is used as refer position, it is the top line position. Elsewhere it is the top position.
        `lineEndOrSize` - Maybe designated with `size` or `samesize`
        `column` -
        `columnEndOrSize` -
        `origin` -
        `direction` -

    - #### setPosition

          public void setPosition(GralPos framePos,
                                  float line,
                                  float lineEndOrSize,
                                  float column,
                                  float columnEndOrSize,
                                  int origin,
                                  char direction,
                                  float border)

      Sets the position
      Parameters:
        `framePos` - The frame or last pos for relative positions.
        `line` - The line. If the parameter lineEndOrSize is designated with `size` with a negative value, it is the bottom line for the position. If it is designated with `same` without offset and the lineEndOrSize is designated with `size` with a negative value, the framePos `GralPos#y.p2` is used. If it is designated with `same` but with any offset, the `y` is used as refer position, it is the top line position. Elsewhere it is the top position.
        `lineEndOrSize` - Maybe designated with `size` or `samesize`
        `column` -
        `columnEndOrSize` -
        `origin` -
        `direction` -

    - #### toResize

          public boolean toResize()

      Returns true if this position is from right or bottom, so that a resize of the panel needs new positions for this widget.

    - #### frac

          private void frac(float v,
                            int[] pos,
                            int ix)

    - #### setPosition

          public void setPosition(GralPos framePos,
                                  float line,
                                  float lineEndOrSize,
                                  float column,
                                  float columnEndOrSize,
                                  int origin,
                                  char direction)

    - #### setFinePosition

          public void setFinePosition(int line,
                                      int yPosFrac,
                                      int ye,
                                      int yef,
                                      int column,
                                      int xPosFrac,
                                      int xe,
                                      int xef,
                                      int origin,
                                      char direction,
                                      int border,
                                      int borderFrac,
                                      GralPos parent)

      Sets the position for the next widget to add in the container. Implementation note: This is the core function to calculate positions. It is called from all other ones.
      Parameters:
        `line` - y-Position in y-Units, count from top of the box. It is the bottom line of the widget. If <0, then it counts from bottom of the parent.
        `column` - x-Position in x-Units, count from left of the box. If <0, then the previous position is valid still. It < 0 then line = 0 is not a proper value. To show a text in the first line, use line=2.
        `heigth:` - The height of the line. If <0, then the param line is the bottom line of the widget, and (line-height) is the top line. If 0 then the last value of height is not changed.
        `length:` - The number of columns. If <0, then the param column is the right column, and column-length is the left column. If 0 then the last value of length is not changed.
        `direction:` - direction for a next widget, use 'r', 'l', 'u', 'd' for right, left, up, down
        `parent` -

    - #### setSize

          public void setSize(int height,
                              int ySizeFrac,
                              int width,
                              int xSizeFrac)

    - #### setSize

          public void setSize(float height,
                              float width,
                              GralPos frame)

    - #### setNextPosition

          public void setNextPosition()

      Sets the position to the next adequate the `#pos.dirNext`.

    - #### height

          public float height()

    - #### width

          public float width()

    - #### clone

          public GralPos clone()

      Overrides:
        `clone` in class `java.lang.Object`

    - #### setNextPos

          public GralPos setNextPos(java.lang.String posString)
                             throws java.text.ParseException

      Throws:
        `java.text.ParseException`

    - #### calcWidgetPosAndSize

          public GralRectangle calcWidgetPosAndSize(GralGridProperties propertiesGui,
                                                    int widthParentPixel,
                                                    int heightParentPixel,
                                                    int widthWidgetNat,
                                                    int heightWidgetNat)

      Calculates the position and size of a widget from this given Pos.
      Parameters:
        `propertiesGui` - The properties for presentation.
        `widthParentPixel` - width of the container. This value will be used if the position is given from right with negative numbers.
        `heightParentPixel` - height of the container. This value will be used if the position is given from bottom with negative numbers.
        `widthWidgetNat` - natural width of the component which will be positioning. This value is used only if the pos parameter contains `useNatSize` for the xe-value
        `heightWidgetNat` - natural height of the component which will be positioning. This value is used only if the pos parameter contains `useNatSize` for the ye-value
      Returns:
        A rectangle for setBounds.

    - #### appendPos

          private static void appendPos(java.lang.StringBuilder b,
                                        int p,
                                        int pFrac)

    - #### posString

          public java.lang.String posString()

    - #### toString

          public java.lang.String toString()

      Use especially for debug.
      Overrides:
        `toString` in class `java.lang.Object`
      See Also:
        `Object.toString()`

    - #### stop

          void stop()

    - #### testScanSize

          public static void testScanSize()