Class GridManager

java.lang.Object
yearreview.app.grid.GridManager
All Implemented Interfaces:
Iterable<Widget>

public class GridManager extends Object implements Iterable<Widget>
Parses the configuration of the grid and creates the segments with according sizes.
Author:
ColdStone37
  • Field Details

    • xScale

      private final float xScale
      Horizontal scale used to position the nodes.
    • yScale

      private final float yScale
      Vertical scale used to position the nodes.
    • widgets

      private final List<Widget> widgets
      A List of all Widgets managed by this GridManager.
    • logger

      private static final Logger logger
  • Constructor Details

    • GridManager

      public GridManager(XmlNode gridConfig)
      Constructs a GridManager from a given configuration.
      Parameters:
      gridConfig - configuration of the grid
  • Method Details

    • transform

      private GridManager.WidgetPosition transform(int x, int y, int w, int h)
      Transforms widget coordinates from grid space to screen space.
      Parameters:
      x - x-position of the widget in grid space
      y - y-position of the widget in grid space
      w - width of the widget in grid space
      h - height of the widget in grid space
      Returns:
      new dimensions bundled in GridManager.WidgetPosition-object
    • iterator

      public Iterator<Widget> iterator()
      Gets an iterator for the widgets contained in the manager.
      Specified by:
      iterator in interface Iterable<Widget>
      Returns:
      iterator over all widgets