BrightSide Workbench Full Report + Source Code
TreeDirectory.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 package org.turro.wd.tree;
19 
20 import org.turro.wd.files.Directory;
21 import org.apache.pivot.wtk.content.TreeBranch;
22 
27 public class TreeDirectory extends TreeBranch {
28 
29  private Directory directory;
30 
32  return directory;
33  }
34 
35  public void setDirectory(Directory directory) {
36  this.directory = directory;
37  setText(directory.getName() +
38  String.format(" ( %d file(s)", new Object[] { directory.getnFiles() }) +
39  (directory.getnCommits() != 0 ? String.format(" %d commit(s)", new Object[] { directory.getnCommits() }) : "") +
40  (directory.getnUpdates() != 0 ? String.format(" %d update(s)", new Object[] { directory.getnUpdates() }) : "") +
41  " )"
42  );
43  if(directory.getnCommits() > 0 && directory.getnUpdates() > 0) {
44  setIcon("org/turro/resource/folder_sync.png");
45  } else if(directory.getnCommits() > 0) {
46  setIcon("org/turro/resource/folder_commit.png");
47  } else if(directory.getnUpdates() > 0) {
48  setIcon("org/turro/resource/folder_update.png");
49  } else {
50  setIcon("org/turro/resource/folder.png");
51  }
52  }
53 
54 }
void setDirectory(Directory directory)