3 final class DifferentialFileTreeEngine
9 private $ownedChangesets;
11 public function setViewer($viewer) {
12 $this->viewer
= $viewer;
16 public function getViewer() {
20 public function getIsVisible() {
21 return (bool)$this->getSetting($this->getVisibleSettingKey());
24 public function setDisabled($disabled) {
25 $this->disabled
= $disabled;
29 public function getDisabled() {
30 return $this->disabled
;
33 public function setChangesets(array $changesets) {
34 $this->changesets
= $changesets;
38 public function getChangesets() {
39 return $this->changesets
;
42 public function newView($content) {
43 if ($this->getDisabled()) {
47 require_celerity_resource('diff-tree-view-css');
49 $width = $this->getWidth();
50 $is_visible = $this->getIsVisible();
52 $formation_view = new PHUIFormationView();
54 $flank_view = $formation_view->newFlankColumn()
55 ->setHeaderText(pht('Paths'))
56 ->setIsResizable(true)
58 ->setIsVisible($is_visible)
59 ->setIsDesktopOnly(true)
61 ->setMinimumWidth($this->getMinimumWidth())
62 ->setMaximumWidth($this->getMaximumWidth());
64 $viewer = $this->getViewer();
65 if ($viewer->isLoggedIn()) {
67 ->setExpanderTooltip(pht('Show Paths Panel'))
68 ->setVisibleSettingKey($this->getVisibleSettingKey())
69 ->setWidthSettingKey($this->getWidthSettingKey());
72 $head_view = id(new PHUIListView())
74 id(new PHUIListItemView())
76 ->setName(pht('Table of Contents'))
79 $flank_view->setHead($head_view);
81 $tail_view = id(new PHUIListView());
83 if ($viewer->isLoggedIn()) {
84 $tail_view->addMenuItem(
85 id(new PHUIListItemView())
86 ->setIcon('fa-comment-o')
87 ->setName(pht('Add Comment'))
94 id(new PHUIListItemView())
95 ->setIcon('fa-chevron-left')
96 ->setName(pht('Hide Panel'))
100 id(new PHUIListItemView())
101 ->setIcon('fa-keyboard-o')
102 ->setName(pht('Keyboard Reference'))
105 $flank_view->setTail($tail_view);
107 $main_column = $formation_view->newContentColumn()
108 ->appendChild($content);
110 return $formation_view;
113 private function getVisibleSettingKey() {
114 return PhabricatorFiletreeVisibleSetting
::SETTINGKEY
;
117 private function getWidthSettingKey() {
118 return PhabricatorFiletreeWidthSetting
::SETTINGKEY
;
121 private function getWidth() {
122 $width = (int)$this->getSetting($this->getWidthSettingKey());
125 $width = $this->getDefaultWidth();
128 $min = $this->getMinimumWidth();
133 $max = $this->getMaximumWidth();
141 private function getDefaultWidth() {
145 private function getMinimumWidth() {
149 private function getMaximumWidth() {
153 private function getSetting($key) {
154 $viewer = $this->getViewer();
155 return $viewer->getUserSetting($key);