@@ -35,14 +35,14 @@ public abstract class Tree
35
35
36
36
[ NonSerialized ] private Stack < bool > indents = new Stack < bool > ( ) ;
37
37
38
- public bool IsInitialized { get { return nodes != null && nodes . Count > 0 && ! String . IsNullOrEmpty ( nodes [ 0 ] . Name ) ; } }
38
+ public bool IsInitialized { get { return nodes != null && nodes . Count > 0 && ! String . IsNullOrEmpty ( nodes [ 0 ] . Path ) ; } }
39
39
public bool RequiresRepaint { get ; private set ; }
40
40
41
41
public TreeNode SelectedNode
42
42
{
43
43
get
44
44
{
45
- if ( selectedNode != null && String . IsNullOrEmpty ( selectedNode . Name ) )
45
+ if ( selectedNode != null && String . IsNullOrEmpty ( selectedNode . Path ) )
46
46
selectedNode = null ;
47
47
return selectedNode ;
48
48
}
@@ -66,7 +66,7 @@ public void Load(IEnumerable<ITreeData> data, string title)
66
66
67
67
var titleNode = new TreeNode ( )
68
68
{
69
- Name = title ,
69
+ Path = title ,
70
70
Label = title ,
71
71
Level = - 1 + displayRootLevel ,
72
72
IsFolder = true ,
@@ -80,29 +80,30 @@ public void Load(IEnumerable<ITreeData> data, string title)
80
80
81
81
foreach ( var d in data )
82
82
{
83
- var fullName = d . Name ;
83
+ var path = d . Path ;
84
84
if ( PathIgnoreRoot != null )
85
85
{
86
- var indexOf = fullName . IndexOf ( PathIgnoreRoot ) ;
86
+ var indexOf = path . IndexOf ( PathIgnoreRoot ) ;
87
87
if ( indexOf != - 1 )
88
88
{
89
- fullName = fullName . Substring ( indexOf + PathIgnoreRoot . Length ) ;
89
+ path = path . Substring ( indexOf + PathIgnoreRoot . Length ) ;
90
90
}
91
91
}
92
92
93
- var parts = fullName . Split ( new [ ] { PathSeparator } , StringSplitOptions . None ) ;
93
+ var parts = path . Split ( new [ ] { PathSeparator } , StringSplitOptions . None ) ;
94
94
for ( int i = 0 ; i < parts . Length ; i ++ )
95
95
{
96
96
var label = parts [ i ] ;
97
97
var level = i + 1 ;
98
- var name = String . Join ( PathSeparator , parts , 0 , level ) ;
98
+ var nodePath = String . Join ( PathSeparator , parts , 0 , level ) ;
99
99
var isFolder = i < parts . Length - 1 ;
100
- var alreadyExists = folders . ContainsKey ( name ) ;
100
+ var alreadyExists = folders . ContainsKey ( nodePath ) ;
101
101
if ( ! alreadyExists )
102
102
{
103
103
var node = new TreeNode
104
104
{
105
- Name = name ,
105
+ FullPath = d . FullPath ,
106
+ Path = nodePath ,
106
107
IsActive = d . IsActive ,
107
108
Label = label ,
108
109
Level = i + displayRootLevel ,
@@ -132,7 +133,7 @@ public void Load(IEnumerable<ITreeData> data, string title)
132
133
nodes . Add ( node ) ;
133
134
if ( isFolder )
134
135
{
135
- if ( collapsedFolders . Contains ( name ) )
136
+ if ( collapsedFolders . Contains ( nodePath ) )
136
137
{
137
138
node . IsCollapsed = true ;
138
139
@@ -143,7 +144,7 @@ public void Load(IEnumerable<ITreeData> data, string title)
143
144
}
144
145
}
145
146
146
- folders . Add ( name , node ) ;
147
+ folders . Add ( nodePath , node ) ;
147
148
}
148
149
}
149
150
}
@@ -441,7 +442,8 @@ protected void LoadNodeIcons()
441
442
[ Serializable ]
442
443
public class TreeNode
443
444
{
444
- public string Name ;
445
+ public string FullPath ;
446
+ public string Path ;
445
447
public string Label ;
446
448
public int Level ;
447
449
public bool IsFolder ;
@@ -555,8 +557,8 @@ public TreeNodeRenderResult Render(Rect rect, float indentation, bool isSelected
555
557
556
558
public override string ToString ( )
557
559
{
558
- return String . Format ( "name :{0} label:{1} level:{2} isFolder:{3} isCollapsed:{4} isHidden:{5} isActive:{6}" ,
559
- Name , Label , Level , IsFolder , IsCollapsed , IsHidden , IsActive ) ;
560
+ return String . Format ( "path :{0} label:{1} level:{2} isFolder:{3} isCollapsed:{4} isHidden:{5} isActive:{6}" ,
561
+ Path , Label , Level , IsFolder , IsCollapsed , IsHidden , IsActive ) ;
560
562
}
561
563
}
562
564
0 commit comments