equal
deleted
inserted
replaced
5488 !UIPainter::TreeView methodsFor:'adding & removing'! |
5488 !UIPainter::TreeView methodsFor:'adding & removing'! |
5489 |
5489 |
5490 addProperty:aProperty |
5490 addProperty:aProperty |
5491 "adds a new item" |
5491 "adds a new item" |
5492 |
5492 |
5493 |parent| |
5493 ^ self addProperty:aProperty beforeIndex:nil. |
|
5494 ! |
|
5495 |
|
5496 addProperty:aProperty beforeIndex:anIndex |
|
5497 "adds a new item" |
|
5498 |
|
5499 |parent treeItem index| |
5494 |
5500 |
5495 parent := self detectItemCorespondingToView:(aProperty view superView). |
5501 parent := self detectItemCorespondingToView:(aProperty view superView). |
5496 |
5502 parent isNil ifTrue:[^ nil ]. |
5497 parent notNil ifTrue:[ |
5503 |
5498 model add:(TreeItem new contents:aProperty) below:parent |
5504 treeItem := TreeItem new contents:aProperty. |
5499 ] |
5505 index := parent numberOfChildren + 1. |
|
5506 |
|
5507 (anIndex notNil and:[anIndex > 0]) ifTrue:[ |
|
5508 index := anIndex min:index. |
|
5509 ]. |
|
5510 model add:treeItem beforeIndex:index below:parent. |
|
5511 ^ treeItem |
5500 ! |
5512 ! |
5501 |
5513 |
5502 removeAll |
5514 removeAll |
5503 "removes all items other than canvas" |
5515 "removes all items other than canvas" |
5504 |
5516 |