code: private Grid getGridLayout(int count) {
  
          Grid grid = new Grid();
          int x, y, z, modolo = 0;
          x = count % 3;
          y = count % 5;
          z = count % 7;
          if ((z <= y) && (z <= x)) {
              modolo = 7;
          } else if ((y <= z) && (y <= x)) {
              modolo = 5;
          } else if ((x <= z) && (x <= y)) {
              modolo = 3;
          }
  
          if (count < modolo) {
              grid = new Grid(count, 1);
          } else if ((count % modolo) == 0) {
              grid = new Grid(count / modolo, modolo);
          } else {
              grid = new Grid((count / modolo) + 1, modolo);
          }
          return grid;
      }
docs: Helper function to generate the grid layout.<p>
  @param count
  
  @return the new grid