Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Extends MaskGroup.

Description

The PosterGrid node is a simple grid class that can be used to display two-dimensional grids of posters. In addition to the poster, each item in the grid can include up to two lines of captions.

The number of columns in the PosterGrid is fixed and the number of rows varies. The items in the grid fill each row from left to right, then top to bottom. For example, if the grid data contains 8 items and the number of columns is set to 3, then items 1, 2 and 3 will be in the first row. Items 4, 5 and 6 will be in the second row. The third row will contain items 7 and 8 in the leftmost two columns and blank space in the right column.

The grid data can be organized into sections that are represented in the grid by drawing horizontal divider lines in the grid between the sections.

The layout of rows and columns in the grid is very flexible. Possible layouts include:

  • a simple layout with all posters in the grid having the same size
  • a layout with the posters in some rows having varying heights and/or the posters in some columns having varying widths
  • a layout with varying width rows and columns and items that occupy one or more rows and columns

Grid Layouts

The PosterGrid class supports very flexible layouts. The philosophy is that simple layouts are easy to produce and complicated layouts are possible.

 There are three general categories of layouts.

  1. Simple layouts with all grid items and spacings between items equal.

    To specify a simple layout, set the basePosterSize field to the width and height of each of the images in the grid and set the itemSpacing field to spacing between posters. For example, if basePosterSize is [300,100] and itemSpacing is [4, 8], then the posters will be 300 pixels wide and 100 pixels tall. There will be 4 pixels between the columns of the grid and 8 pixels between rows of the grid.

  2. All the items are aligned in rows and columns, but the rows and columns (or the spacing between them) varies.

    To specify this type of layout, use the columnWidths, columnSpacings, rowHeights and rowSpacings fields. Each of these fields takes an array of values, specifying the values for each row width, column height or spacing between rows and columns. If there are more rows or columns in the grid than specified in the arrays for these fields., the corresponding simple layout field values are used for the missing values (e.g. basePosterSize[0] for missing columnWidth, etc.)

    For example, suppose a grid is designed with 4 columns where each item was 80 pixels wide and had 4 pixels space between them. The grid data includes 10 rows, where the first 4 rows have items that are 120 pixel tall and the remaining 6 rows have items are 80 pixels tall. All the rows should have 6 pixels of space between them. To specify this layout, you'd set up the fields like this:
     

    basePosterSize[ 80, 80 ]
    itemSpacings[ 4, 6 ]
    rowHeights[ 120, 120, 120, 120, 80, 80, 80, 80, 80, 80 ]
     


    One final note. Since the final 6 values in the rowHeights array equal basePosterSize[1]
    , you can omit them, so in this case setting the rowHeights field to [ 120, 120, 120, 120 ]  would have the same result.

  3. There are clear alignments in the row/column layout, but some items can span more than one one row or column (plus the space in between).

    To specify this type of layout, set up the fields as in case 1 or 2 to define the sizes of the rows/columns. If any of the grid items will occupy more than one row or column, then the metadata for each grid item must contain extra metadata specifying the starting row, starting column, numbers of rows and number of columns that the item occupies. In addition, the fixedLayout field must be set to true. 

    For example, if a grid item is supposed to span columns 2 and 3 and rows 3 through 6, then in addition to the URL for the poster, the metadata for that item would include (X = 2, Y = 3, W = 2, H = 4). W is set to 2 because the item is 2 columns wide. Similarly H is set to 4 because the item is 4 columns tall.

    The total pixel width of the item would be the (width of column 2) + (spacing between columns 2 & 3) + (width of column 3). Similarly, the height of the item would be the sum of the heights of columns 3, 4, 5 and 6, plus the spacings between columns 3 & 4, 4 & 5 and 5 & 6.

    The X and Y indices start from 0 (i.e. the first columns is X = 0).

Fields

FieldTypeDefaultUse
contentContentNodenoneSpecifies the content for the list. See Data Bindings section below for more details.
If the data contains section markers, section dividers will be drawn between each section. These section dividers may contain an icon and/or a string. 
itemSelectedint0(read only) When a list item is selected, itemSelected is set to the index of the selected item.
itemFocusedint0(read only) When a list item gains the key focus, itemFocused is set to the index of the focused item.
itemUnfocusedint0(read only) When a list item loses the key focus, itemFocused is set to the index of the unfocused item.
jumpToItemint0(write-only) When set to a valid item index, this causes the list to immediately update so that the specified index moves into the focus position.
animateToItemint0(write-only) When set to a valid item index, this causes the list to quickly scroll so that the specified index moves into the focus position.
basePosterSizeVector2D[0, 0]Specifies the width and height of the posters in the grid.
itemSpacingVector2D[0, 0]A vector specifying the horizontal spacing between columns and the vertical spacing between rows in the grid.
numColumnsinteger0Specifies the number of columns in the grid
numRowsinteger0Specifies the number of visible rows in the grid. Note that the actual number of rows may be more or less than the number of visible columns depending on the number of items in the grid's content.
drawFocusFeedbackOnTopbooleanfalseSpecifies whether the focus indicator bitmap is drawn below or on top of the list items
drawFocusFeedbackbooleantrueSpecifies whether or not the focus indicator bitmap is displayed
focusBitmapUriBitmaptheme:LabelListFocusBitmapSpecifies the bitmap file used for the focus indicator when the list has focus. In most cases, this should be a 9-patch image that specifies both expandable regions as well as margins.
focusFootprintBitmapUristringtheme:LabelListFocusFootprintBitmapSpecifies the bitmap file used for the focus indicator when the list does not have focus. In most cases, this should be a 9-patch image that specifies both expandable regions as well as margins.
imageWellBitmapUristring""Specifies the bitmap file to use to suggest where images would appear for empty grids and empty sections of grids
wrapDividerBitmapUristringtheme:ListDividerBitmapSpecifies the bitmap file to use as a visual separator between the last and first list items when the list wraps. In most case, this should be a 9-patch image that specifies both expandable regions.
wrapDividerHeightfloattheme:LabelListDividerHeight

Specifies the height of the divider. The wrapDividerBitmap will be scaled to this height.

The width of the wrap divider is set to the width of the list items (i.e. itemSize[0]) 

rowHeightsarray of floats[ ]

When specified, the rowHeights field specifies the heights of the poster for each row of the grid. This allows the height of each row of the grid to vary from row to row.

The rowHeights values override the height specified in element 1 of the basePosterSize field. If the rowHeights array contains fewer elements than the number of rows needed to display all the items in the grid, element 1 of the basePosterSize field is used as the height of the excess rows.

columnWidthsarray of floats[ ]

When specified, the columnWidths field specifies the widths of the poster for each column of the grid. This allows the width of each column of the grid to vary from column to column.

The columnWidths values override the width specified in element 0 of the basePosterSize field. If the columnWidths array contains fewer elements than the number of columns specified by the numColumns field, element 0 of the basePosterSize field is used as the width of the excess columns.

rowSpacingsarray of floats[ ]

When specified, the rowSpacings field specifies the spacing after each row of the grid. This allows the spacing between rows to vary from row to row.

The rowSpacings values override the vertical spacing specified in element 1 of the itemSpacing field. If the rowSpacings array contains fewer elements than the number of rows needed to display all the items in the grid, element 1 of the itemSpacing field is used as the spacing after the excess rows.

columnSpacingsarray of floats[ ]

When specified, the columnSpacings field specifies the spacing after each column of the grid. This allows the spacing between columns to vary from column to column.

The columnSpacings values override the horizontal spacing specified in element 0 of the itemSpacing field. If the columnSpacings array contains fewer elements than the number of columns specified by the numColumns field, element 0 of the itemSpacing field is used as the spacing after the excess columns.

fixedLayoutboolfalse

When fixedLayout is false, the PosterGrid assigns each item in the data model to sequential cells in the grid (or the section if the data model includes section information). When fixedLayout is false, the data models using the X, Y, W and H ContentMetaData attributes to specify which cells of the grid each item should occupy, where X is the column number, Y is the row number, W is the number of columns the item occupies and H is the number of rows the item occupies.

Fixed layout should only be set to true for cases where one or more items in the grid should span multiple rows or columns.

loadingBitmapUristring""Specifies a bitmap file to display while a grid item's poster is loading.
loadingBitmapOpacityfloat1.0Specifies an opacity value used to render the loading bitmap
failedBitmapUristring""Specifies a bitmap file to display when a grid item's poster fails to load
failedBitmapOpacityfloat1.0Specifies an opacity value used to render the failed bitmap
caption1FontFonttheme:GridCaption1FontSpecifies the font for the grid item's first caption
caption1ColorColortheme:GridCaption1ColorSpecifies the color for the grid item's first caption
caption1NumLinesint0Specifies the number of lines to render for the grid item's first caption
caption2FontFonttheme:GridCaption2FontSpecifies the font for the grid item's second caption
caption2ColorColortheme:GridCaption2ColorSpecifies the color for the grid item's second caption
caption2NumLinesint0Specifies the number of lines to render for the grid item's second caption
captionBackgroundBitmapUristring

theme:GridCaptionOverlayBitmap if captionVertAlignment is "top", "center" or "bottom" (i.e. if the caption is drawn on top of the poster)

theme:GridCaptionBackgroundBitmap if captionVertAlignment is "above" or "below" (i.e. if the caption is drawn above or below the poster)

Specifies a bitmap file to render as a background for the grid item's captions
captionHorizAlignmentstring"center"

Specifies the horizontal positioning of the grid item's captions. Possible values are:

"left" - left justify the caption relative to the grid item's poster
"center" - center justify the caption relative to the grid item's poster
"right" - right justify the caption relative to the grid item's poster

captionVertAlignmentstring"below"

Specifies the horizontal positioning of the grid item's captions. Possible values are:

"above" - position the caption so the bottom of the caption lies just above the grid item's poster
"top" - align the top of the caption with the top edge of the grid item's poster
"center" - align the vertical center of the caption with the vertical center of the of the grid item's poster
"bottom" - align the bottom of the caption with the bottom edge of the grid item's poster
"below" - position the caption so the top of the caption lies just below the grid item's poster 

captionLineSpacingflaottheme:GridCaptionLineSpacingSpecifies the spacing in pixels between lines of the caption
showBackgroundForEmptyCaptionsbooleantrueIf a caption background is specified, this field specifies whether or not to display the caption background when the caption text is empty
enableCaptionScrollingbooleantrueSpecifies whether or not to scroll single line captions when it is necessary to ellipsize the caption because it is wider the column containing the grid item
sectionDividerBitmapUristringtheme:ListLabeledDividerBitmap

Specifies the bitmap file to use as visual separator between sections of the grid. The section dividers can include an icon and a label in addition to the section divider bitmap.

Note that for sections that do not contain an icon or a title, the wrapDividerBitmapUri is used for the section dividers instead.

sectionDividerFontFonttheme:ListPanelLabelFontSpecifies the font for section divider labels
sectionDividerTextColorColortheme:ListLabelDividerTextColorSpecifies the text color for section divider labels
sectionDividerSpacingfloattheme:ListLabeledDividerSpacingSpecifies the spacing between the items appearing in the section divider (e.g. the spacing between the section divider icon, the section divider label, and the section divider bitmap). Note the section divider does not always include an icon and/or a title.
sectionDividerHeightfloattheme:ListLabeledDividerHeight

Specifies the height of the section dividers.

The width of the section dividers is determined by the width of the list items (e.g. itemSize[0]) and the sectionDividerOffset field.

sectionDividerMinWidthfloattheme:ListLabeledDividerMinWidthSpecifies the minimum width of the section divider bitmap. The section divider label will be ellipsized if necessary in order to ensure that the section divider bitmap meets the minimum width.
sectionDividerOffsetfloat0.0fNumber of pixels to offset the left edge of the section divider relative to the left edge of the list items.
useAtlasbooleantrue

This enables a performance optimization for the PosterGrid node when most of the posters has the same size.

useAtlas defaults to true, since in most cases, all of the posters in the grid have the same size as determined by basePosterSize. For grids that have more complicated layouts that include several items that do use the basePosterSize, or for grids where there are only a few large posters (< 5) displayed at the same time, its best for this field to be set to false.

Theme Attributes

Need to fill out this table

Data Bindings

Need to add a table of the data bindings here (including section info)

  • No labels