Package totalcross.ui

Class ListContainer.Layout

  • Enclosing class:
    ListContainer

    public class ListContainer.Layout
    extends java.lang.Object
    A set of fields and default fields that will be used to define the layout of a ListContainer's Item.
    • Constructor Summary

      Constructors 
      Constructor Description
      Layout​(int itemCount, int itemsPerLine)
      Constructs a Layout component with the given columns and item count.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setup()
      After you set the properties, you must call this method to setup the internal coordinates.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • leftImageEnlargeIfSmaller

        public boolean leftImageEnlargeIfSmaller
        Specify what to do if the left or right controls are images. There are two situations that occurs when the image has a different height of the ListContainer's Item:
        1. The image is smaller than the ListContainer's Item height. It can be enlarged or vertically centered. If the flag is false (default), the image will be centered. Otherwise, a "smooth upscaled" image will be created, however the image will mostly have a bad appearance. This is the worst choice. The best choice is always to have a big image (for the biggest possible resolution of the device) that will always be scaled down.
        2. The image is bigger than the ListContainer's Item height. It will always be scaled down, using a "smooth scale" algorithm. This is the best choice.
        In general way, the image never defines the height of the Item; its the opposite: the number of Item lines is that defines the image height and size.
      • rightImageEnlargeIfSmaller

        public boolean rightImageEnlargeIfSmaller
        Specify what to do if the left or right controls are images. There are two situations that occurs when the image has a different height of the ListContainer's Item:
        1. The image is smaller than the ListContainer's Item height. It can be enlarged or vertically centered. If the flag is false (default), the image will be centered. Otherwise, a "smooth upscaled" image will be created, however the image will mostly have a bad appearance. This is the worst choice. The best choice is always to have a big image (for the biggest possible resolution of the device) that will always be scaled down.
        2. The image is bigger than the ListContainer's Item height. It will always be scaled down, using a "smooth scale" algorithm. This is the best choice.
        In general way, the image never defines the height of the Item; its the opposite: the number of Item lines is that defines the image height and size.
      • defaultLeftImage

        public Image defaultLeftImage
        If the left and/or right control is a fixed Image, set it here and it will be replicated on all lines.
      • defaultRightImage

        public Image defaultRightImage
        If the left and/or right control is a fixed Image, set it here and it will be replicated on all lines.
      • defaultLeftImageW

        protected int defaultLeftImageW
      • defaultLeftImageH

        protected int defaultLeftImageH
      • defaultRightImageW

        protected int defaultRightImageW
      • defaultRightImageH

        protected int defaultRightImageH
      • defaultLeftImage2

        public Image defaultLeftImage2
        If the left and/or right control is a fixed Image, set it here and it will be replicated on all lines. These images can be set only if the default image was set. The image size must be the same of the default one.
      • defaultRightImage2

        public Image defaultRightImage2
        If the left and/or right control is a fixed Image, set it here and it will be replicated on all lines. These images can be set only if the default image was set. The image size must be the same of the default one.
      • defaultItemColors

        public int[] defaultItemColors
        The default colors of all items. Defaults to BLACK.
      • boldItems

        public boolean[] boldItems
        The items that will have a bold font. Defaults to false (plain font)
      • relativeFontSizes

        public int[] relativeFontSizes
        The default relative font sizes. You can specify a delta compared to the font size of this ListContainer. For example, specifying -1 will make the item have a font 1 size less than the standard one.
      • positions

        public int[] positions
        The x position of the label, relative to the column's width. Can be AFTER (default for all items), CENTER (relative to container's width), CENTER_OF (relative to the space available after the last String added), RIGHT (adjustments are NOT allowed!), BEFORE. The number of lines of the Item is computed based on the column count. Note that this field cannot be changed after the first Item is created, since the internal computation of number of lines is done only once.
      • fontNames

        public java.lang.String[] fontNames
        The font names to be used when creating the fonts. If the member is null, it will use the parent's name.
      • controlGap

        public int controlGap
        The gap between the left/right controls and the text. This gap is a percentage based in the control font's height. So, if you pass 100 (default), it will be 100% of the font's height, 50 will be 50% of the height, 150 will be 1.5x the font height, and so on.
      • imageGap

        public int imageGap
        The gap between the image and the item's top/bottom. This is useful if your item has 3 lines but you want to decrase the image's height.
      • insets

        public Insets insets
        The gap between the Item and the borders can be set using this field. The values stored are not absolute pixels, but a percentage. Defaults to 0 (%) for all items.
      • lineGap

        public int lineGap
        The line spacing between two consecutive lines. Again, a percentage of the font's height is used. Defaults to 0.
        See Also:
        controlGap
      • centerVertically

        public boolean centerVertically
        Set to true to center the labels vertically if there are empty lines ("") before or after the items array. Only works if the items form a single column.
      • itemCount

        protected int itemCount
      • itemsPerLine

        protected int itemsPerLine
      • itemY

        protected int[] itemY
      • fonts

        protected Font[] fonts
      • itemH

        protected int itemH
    • Constructor Detail

      • Layout

        public Layout​(int itemCount,
                      int itemsPerLine)
        Constructs a Layout component with the given columns and item count.
    • Method Detail

      • setup

        public void setup()
        After you set the properties, you must call this method to setup the internal coordinates. If you create a Item before calling this method, a RuntimeException will be thrown.