OSDN Git Service

add delete
[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 { NOTEBOOK, NOTEBOOK_TAG, NONE};
12
13         private Status status = Status.CLOSE;
14         private Category category = Category.NONE;
15         private String notebookGuid = null;
16         
17         public DirNode(String name, LabelIconView view){
18                 super(name, view);
19                 
20                 children = new ArrayList<Long>();
21         }
22
23         public DirNode(String name, LabelIconView view, String childrenStr, int stCode){
24                 super(name, view);
25                 
26                 children = new ArrayList<Long>();
27
28                 List<String> l = CommonUtil.split(childrenStr, NodeDao.DELM);
29                 for (String s : l){
30                         children.add(Long.parseLong(s));
31                 }
32                 status = Node.getStatus(stCode);
33         }
34
35         public Category getCategory() {
36                 return category;
37         }
38
39         public void setCategory(Category category) {
40                 this.category = category;
41         }
42
43         public String getNotebookGuid() {
44                 return notebookGuid;
45         }
46
47         public void setNotebookGuid(String notebookGuid) {
48                 this.notebookGuid = notebookGuid;
49         }
50
51         @Override
52         public int getType(){
53                 return 1;
54         }
55         
56         @Override
57         public int getIconId(){
58                 return R.drawable.test2;
59         }
60
61         @Override
62         public Status getStatus(){
63                 return status;
64         }
65         
66         @Override
67         public void setStatus(Status status){
68                 this.status = status;
69         }
70
71         @Override
72         public void toggleStatus(){
73                 if (status == Status.NONE){
74                         return;
75                 }
76                 status = (status == Status.CLOSE)? Status.OPEN : Status.CLOSE;
77         }
78         
79         @Override
80         public int getStatusIconId() {
81                 if (status == Status.CLOSE){
82                         return R.drawable.close;
83                 }
84                 else {
85                         return R.drawable.open;                 
86                 }
87         }
88 }