OSDN Git Service

050963719b4dd82e1b32b07056544bd2f5b8ff12
[everfolder/source.git] / source / workspace / EverFolder / src / com / yuji / ef / dao / DirNode.java
1 package com.yuji.ef.dao;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import com.yuji.ef.LabelIconView;
7 import com.yuji.ef.R;
8 import com.yuji.ef.common.CommonUtil;
9
10 public class DirNode extends Node {
11         public enum Category {
12                 NOTEBOOK, NOTEBOOK_TAG, NONE
13         };
14
15         private Status status = Status.CLOSE;
16         private Category category = Category.NONE;
17
18         // private String notebookGuid = null;
19
20         public DirNode(String name, LabelIconView view) {
21                 super(name, view);
22
23                 children = new ArrayList<Long>();
24         }
25
26         public DirNode(String name, LabelIconView view, String childrenStr,
27                         int stCode) {
28                 super(name, view);
29
30                 children = new ArrayList<Long>();
31
32                 List<String> l = CommonUtil.split(childrenStr, NodeDao.DELM);
33                 for (String s : l) {
34                         children.add(Long.parseLong(s));
35                 }
36                 status = Node.getStatus(stCode);
37         }
38
39         public Category getCategory() {
40                 return category;
41         }
42
43         public void setCategory(Category category) {
44                 this.category = category;
45         }
46
47         // public String getNotebookGuid() {
48         // return notebookGuid;
49         // }
50         //
51         // public void setNotebookGuid(String notebookGuid) {
52         // this.notebookGuid = notebookGuid;
53         // }
54
55         @Override
56         public int getType() {
57                 return 1;
58         }
59
60         @Override
61         public int getIconId() {
62                 return CommonUtil.isNull(this.getGuid()) ? R.drawable.test2
63                                 : R.drawable.test3;
64         }
65
66         @Override
67         public Status getStatus() {
68                 return status;
69         }
70
71         @Override
72         public void setStatus(Status status) {
73                 this.status = status;
74         }
75
76         @Override
77         public void toggleStatus() {
78                 if (status == Status.NONE) {
79                         return;
80                 }
81                 status = (status == Status.CLOSE) ? Status.OPEN : Status.CLOSE;
82         }
83
84         @Override
85         public int getStatusIconId() {
86                 if (status == Status.CLOSE) {
87                         return R.drawable.close;
88                 } else {
89                         return R.drawable.open;
90                 }
91         }
92 }