Make a grid builder.

@return Grid
346527
protected function grid()
    {
        return Administrator::grid(function (Grid $grid) {
            $grid->id('ID')->sortable();
            $grid->username(trans('admin.username'));
            $grid->name(trans('admin.name'));
            $grid->roles(trans('admin.roles'))->pluck('name')->label();
            $grid->created_at(trans('admin.created_at'));
            $grid->updated_at(trans('admin.updated_at'));

            $grid->actions(function (Grid\Displayers\Actions $actions) {
                if ($actions->getKey() == 1) {
                    $actions->disableDelete();
                }
            });

            $grid->tools(function (Grid\Tools $tools) {
                $tools->batch(function (Grid\Tools\BatchActions $actions) {
                    $actions->disableDelete();
                });
            });
        });
    }
492426
public function createGridLayout($itemsInGrid, $numberOfCols)
    {
        $position = 1;
        $columns = new ArrayList();
        $result = new ArrayList();
        foreach ($itemsInGrid as $key => $item) {
            $columns->push($item);
            if (($position) >= $numberOfCols) {
                $position = 1;
                $row = new ArrayList();
                $row->Columns = $columns;
                $result->push($row);
                $columns = new ArrayList();
            } else {
                $position = $position + 1;
            }
        }
        if ($columns->Count() > 0) {
            $row = new ArrayList();
            $row->Columns = $columns;
            $result->push($row);
        }
        return $result;
    }
1163008
def build_grid(self):
        

        # add required transformers
        build_grid.transformer(self)

        # add branches of sectors retail/industrial and agricultural
        build_grid.build_ret_ind_agr_branches(self.grid_district)

        # add branches of sector residential
        build_grid.build_residential_branches(self.grid_district)
1307974
protected function buildContainer()
    {
        $container = new ContainerBuilder(new ParameterBag($this->getContainerParameters()));
        $container->setResourceTracking(true);
        $container->set('kernel', $this);
        $container->set('application', $this->application);

        // Load the build file
        $this->getContainerLoader($container)->load($this->getBuildFile(), self::TYPE_BUILD_FILE);

        // Load the properties file
        $file = $this->getPropertiesFile();
        if ($file) {
            $this->getContainerLoader($container)->load($file, self::TYPE_PROPERTIES_FILE);
        }

        return $container;
    }
1219644
protected function createComponentRolesList(): DataGrid
	{
		$grid = $this->dataGridFactory->create();

		$grid->setDataSource($this->orm->aclRoles->findRoles($this->viewSuperadmin));

		$grid->addColumnText('title', 'cms.permissions.role')
			->setEditableInputType('text')
			->setEditableCallback([$this, 'setRoleTitle']);

		$grid->addColumnText('name', 'cms.permissions.name')
			->setEditableInputType('text')
			->setEditableCallback([$this, 'setRoleName']);

		$grid->addColumnText('parent', 'cms.permissions.parent')
			->setRenderer(function (AclRole $role) {
				if (!empty($role->parent)) {
					return $role->parent->title;
				}
				return null;
			})
			->setEditableInputTypeSelect([0 => $this->translate('form.none')] + $this->orm->aclRoles->fetchPairs($this->viewSuperadmin))
			->setEditableCallback([$this, 'setRoleParent']);

		$grid->addAction('edit', null, 'editRolePermissions')
			->setIcon('pencil')
			->setTitle('default.edit');

		$grid->addAction('delete', null, 'deleteRole!')
			->setIcon('trash')
			->setTitle('default.delete')
			->setClass('btn btn-xs btn-danger ajax')
			->setConfirm(function (AclRole $role) {
				return $this->translate('cms.permissions.confirmDeleteRole', 1, ['name' => $role->title]);
			});

		$add = $grid->addInlineAdd()
			->setPositionTop()
			->setTitle('cms.permissions.addRole');
		$add->onControlAdd[] = [$this, 'roleForm'];
		$add->onSubmit[] = [$this, 'addRole'];

		$grid->addGroupAction('default.delete')->onSelect[] = [$this, 'deleteRoles'];

		return $grid;
	}
352464
protected function buildColumnDispatch()
    {
        $this->columnDispatch = array();

        foreach ($this->getComponents() as $item) {
            if ($item instanceof GridField_ColumnProvider) {
                $columns = $item->getColumnsHandled($this);

                foreach ($columns as $column) {
                    $this->columnDispatch[$column][] = $item;
                }
            }
        }
    }
1200524
public function build()
    {
        if ($this->use_panel == true) {

            // Bootstrap panel template
            $this->inner .= '<div class="panel panel-' . $this->panel_type . '">';

            if (isset($this->heading_text)) {
                $this->inner .= '{heading}';
            }

            $this->inner .= '<div class="panel-body">';

            if (isset($this->description)) {
                $this->inner .= '{description}';
            }

            if ($this->row) {
                $this->inner .= '<div class="row">';
            }

            $this->inner .= '{content}</div>';

            if ($this->row) {
                $this->inner .= '</div>';
            }

            if (isset($this->footer)) {
                $this->inner .= '{footer}';
            }

            $this->inner .= '</div>';
        }
        else {

            if ($this->row) {
                $this->inner .= '<div class="row';
            }

            if (isset($this->heading_text)) {
                $this->inner .= '{heading}';
            }

            if (isset($this->description)) {
                $this->inner .= '{description}';
            }

            $this->inner .= '{content}';

            if (isset($this->footer)) {
                $this->inner .= '{footer}';
            }

            if ($this->row) {
                $this->inner .= '</div>';
            }
        }

        // Create possible heading
        if (isset($this->heading_text)) {

            // Heading: plain or withe BS title?
            $heading = '<h' . $this->heading_size . ($this->use_panel == true ? ' class="panel-title"' : '') . '>' . $this->heading_text . '</h' . $this->heading_size . '>';

            // Replace heading in BS panel template...
            $this->inner = str_replace('{heading}', $this->use_panel == true ? '<div class="panel-heading">' . $heading . '</div>' : $heading, $this->inner);
        }

        // Is there a description do create?
        if (isset($this->description)) {

            // The description with small
            $description = '<p class="small">' . $this->description . '</p>';

            // Into the panel template...
            $this->inner = str_replace('{description}', $description, $this->inner);
        }

        // Add the content
        $this->inner = str_replace('{content}', $this->content, $this->inner);

        if (isset($this->footer)) {
            $footer = '<span class="help-block">' . $this->description . '</span>';
            $this->inner = str_replace('{footer}', $this->use_panel == true ? '<div class="panel-footer">' . $footer . '</div>' : $footer, $this->inner);
        }

        return parent::build();
    }
896090
public function build()
    {
        $mapping = $this->mapping;
        if ($this->joinColumns) {
            $mapping['joinColumns'] = $this->joinColumns;
        }
        $cm = $this->builder->getClassMetadata();
        if ($this->type == ClassMetadata::MANY_TO_ONE) {
            $cm->mapManyToOne($mapping);
        } else if ($this->type == ClassMetadata::ONE_TO_ONE) {
            $cm->mapOneToOne($mapping);
        } else {
            throw new \InvalidArgumentException("Type should be a ToOne Association here");
        }
        return $this->builder;
    }
786354
public function build()
    {
        $class = $this->getClassForType($this->type);
        $validator = new $class;
        $validator->setSpecification($this->specification);

        return $validator;
    }
540670
public function createContainer() : Container
    {
        $containerBuilder = new ContainerBuilder();

        foreach ($this->modules as $module) {
            $this->loadModule($containerBuilder, $module);
        }

        if (!empty($this->config)) {
            $containerBuilder->addDefinitions($this->config);
        }

        $this->configureContainerBuilder($containerBuilder);

        return $containerBuilder->build();
    }
503040
public function build()
    {
        if ($this->getContext()) {
            $context = $this->getContext();
        } else {
            $context = new Object2ArrayContext();
        }

        $this->prepareContext($context);

        return new Object2Array($context);
    }
399378
public function build()
    {
        $input = new BucketInput($this->namespace, $this->filters);
        $spec  = new Specification($input, $this->phases, $this->timeout);

        return new BucketMapReduce($spec);
    }
1251516
def make_grid(rect, cells={}, num_rows=0, num_cols=0, padding=None,
        inner_padding=None, outer_padding=None, row_heights={}, col_widths={}, 
        default_row_height='expand', default_col_width='expand'):
    
    grid = Grid(
            bounding_rect=rect,
            min_cell_rects=cells,
            num_rows=num_rows,
            num_cols=num_cols,
            padding=padding,
            inner_padding=inner_padding,
            outer_padding=outer_padding,
            row_heights=row_heights,
            col_widths=col_widths,
            default_row_height=default_row_height,
            default_col_width=default_col_width,
    )
    return grid.make_cells()
640969
public function setGrid(GridInterface $grid = null)
    {
        $this->grid = $grid;

        if($grid === null) {
            $this->setItemType(null);
            $this->setItemTypeId(null);
            $this->setItemTypeClass(null);
        }

        return $this;
    }
1050670
public function build()
    {
        foreach ($this->child as $element) {
            $element->build();
            $this->node->appendChild($element->getNode());
        }

        return $this;
    }
883400
public function build()
    {
        if ($this->constraints->count() == 1) {
            return $this->constraints->first();
        }

        return new Group($this->constraints);
    }
34697
public function build(): GetComputedStyleForNodeRequest
	{
		$instance = new GetComputedStyleForNodeRequest();
		if ($this->nodeId === null) {
			throw new BuilderException('Property [nodeId] is required.');
		}
		$instance->nodeId = $this->nodeId;
		return $instance;
	}