Changeset View
Changeset View
Standalone View
Standalone View
src/console/grid/ArcanistGridView.php
Show All 13 Lines | public function setColumns(array $columns) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getColumns() { | public function getColumns() { | ||||
return $this->columns; | return $this->columns; | ||||
} | } | ||||
public function newColumn($key) { | public function newColumn($key) { | ||||
$column = id(new ArcanistGridColumn()) | $column = (new ArcanistGridColumn()) | ||||
->setKey($key); | ->setKey($key); | ||||
$this->columns[$key] = $column; | $this->columns[$key] = $column; | ||||
return $column; | return $column; | ||||
} | } | ||||
public function newRow(array $cells) { | public function newRow(array $cells) { | ||||
assert_instances_of($cells, 'ArcanistGridCell'); | assert_instances_of($cells, 'ArcanistGridCell'); | ||||
$row = id(new ArcanistGridRow()) | $row = (new ArcanistGridRow()) | ||||
->setCells($cells); | ->setCells($cells); | ||||
$this->rows[] = $row; | $this->rows[] = $row; | ||||
return $row; | return $row; | ||||
} | } | ||||
public function drawGrid() { | public function drawGrid() { | ||||
▲ Show 20 Lines • Show All 240 Lines • ▼ Show 20 Lines | final class ArcanistGridView | ||||
private function truncateContentLineToWidth( | private function truncateContentLineToWidth( | ||||
$line, | $line, | ||||
$src_width, | $src_width, | ||||
$dst_width, | $dst_width, | ||||
$alignment) { | $alignment) { | ||||
$line = phutil_string_cast($line); | $line = phutil_string_cast($line); | ||||
return id(new PhutilUTF8StringTruncator()) | return (new PhutilUTF8StringTruncator()) | ||||
->setMaximumGlyphs($dst_width) | ->setMaximumGlyphs($dst_width) | ||||
->truncateString($line); | ->truncateString($line); | ||||
} | } | ||||
} | } |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0