Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/haxeui/haxeui-core
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Nov 29, 2023
2 parents 87a6f09 + 91ed8d7 commit fde79a2
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion haxe/ui/containers/TreeViewNode.hx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ class TreeViewNode extends VBox {
private class AddNode extends Behaviour {
public override function call(param:Any = null):Variant {
var node = new TreeViewNode();
node.parentNode = cast(_component, TreeViewNode);
node.data = param;
_component.addComponent(node);
return node;
Expand Down Expand Up @@ -382,6 +381,7 @@ private class TreeViewNodeBuilder extends CompositeBuilder {
}

if ((child is TreeViewNode)) {
cast(child, TreeViewNode).parentNode = _node;
if (_childContainer == null) {
_childContainer = new VBox();
if (_node.expanded == true) {
Expand All @@ -399,6 +399,31 @@ private class TreeViewNodeBuilder extends CompositeBuilder {

return null;
}

public override function addComponentAt(child:Component, index:Int) {
if (child == _renderer || child == _childContainer) {
return null;
}

if ((child is TreeViewNode)) {
cast(child, TreeViewNode).parentNode = _node;
if (_childContainer == null) {
_childContainer = new VBox();
if (_node.expanded == true) {
_childContainer.show();
} else {
_childContainer.hide();
}
_childContainer.addClass("treenode-child-container");
_childContainer.id = "treenode-child-container";
_node.addComponent(_childContainer);
}
changeToExpandableRenderer();
return _childContainer.addComponentAt(child,index);
}

return null;
}

public override function removeComponent(child:Component, dispose:Bool = true, invalidate:Bool = true) {
if ((child is TreeViewNode)) {
Expand Down

0 comments on commit fde79a2

Please sign in to comment.