3 final class PHUITabView
extends AphrontTagView
{
12 public function setKey($key) {
13 if ($this->keyLocked
) {
16 'Attempting to change the key of a tab with a locked key ("%s").',
24 public function hasKey() {
25 return ($this->key
!== null);
28 public function getKey() {
29 if (!$this->hasKey()) {
30 throw new PhutilInvalidStateException('setKey');
36 public function lockKey() {
37 if (!$this->hasKey()) {
38 throw new PhutilInvalidStateException('setKey');
41 $this->keyLocked
= true;
46 public function setName($name) {
51 public function getName() {
55 public function setIcon(PHUIIconView
$icon) {
60 public function getIcon() {
64 public function getContentID() {
65 if ($this->contentID
=== null) {
66 $this->contentID
= celerity_generate_unique_node_id();
69 return $this->contentID
;
72 public function setColor($color) {
73 $this->color
= $color;
77 public function getColor() {
81 public function newMenuItem() {
82 $item = id(new PHUIListItemView())
83 ->setName($this->getName())
84 ->setKey($this->getKey())
85 ->setType(PHUIListItemView
::TYPE_LINK
)
87 ->addSigil('phui-tab-view')
90 'tabKey' => $this->getKey(),
93 $icon = $this->getIcon();
95 $item->setIcon($icon->getIconName());
98 $color = $this->getColor();
99 if ($color !== null) {
100 $item->setStatusColor($color);