if( getPlaceholderMap() == null && getPlaceholders().isEmpty() ){ delete();
if( getPlaceholderMap() == null && getPlaceholders().isEmpty() ){ delete();
public void replace( PerspectiveDockable oldDockable, PerspectiveDockable newDockable ){ Leaf leaf = getLeaf( oldDockable ); if( leaf == null ){ throw new IllegalArgumentException( "oldDockable not child of this station" ); } DockUtilities.ensureTreeValidity( this, newDockable ); PlaceholderMap map = leaf.getPlaceholderMap(); if( oldDockable.asStation() != null ){ map = oldDockable.asStation().getPlaceholders(); } Leaf copy = new Leaf( newDockable, leaf.getPlaceholders(), map, leaf.getNodeId() ); leaf.replace( copy ); Path placeholder = oldDockable.getPlaceholder(); if( placeholder != null ){ addPlaceholder( copy, placeholder ); } }
private Entry convert( SplitDockPerspective.Entry entry, Map<PerspectiveDockable, Integer> children ){ if( entry == null ){ return null; } if( entry.asNode() != null ){ SplitDockPerspective.Node node = entry.asNode(); Entry childA = convert( node.getChildA(), children ); Entry childB = convert( node.getChildB(), children ); if( childA == null ){ return childB; } if( childB == null ){ return childA; } return new SplitDockStationLayout.Node( node.getOrientation(), node.getDivider(), childA, childB, toArray( node.getPlaceholders() ), node.getPlaceholderMap(), node.getNodeId() ); } else if( entry.asLeaf() != null ){ SplitDockPerspective.Leaf leaf = entry.asLeaf(); Integer id = children.get( leaf.getDockable() ); return new SplitDockStationLayout.Leaf( id == null ? -1 : id.intValue(), toArray( leaf.getPlaceholders() ), leaf.getPlaceholderMap(), leaf.getNodeId() ); } else{ return convert( ((Root)entry).getChild(), children ); } }
public void replace( PerspectiveDockable oldDockable, PerspectiveDockable newDockable ){ Leaf leaf = getLeaf( oldDockable ); if( leaf == null ){ throw new IllegalArgumentException( "oldDockable not child of this station" ); } DockUtilities.ensureTreeValidity( this, newDockable ); PlaceholderMap map = leaf.getPlaceholderMap(); if( oldDockable.asStation() != null ){ map = oldDockable.asStation().getPlaceholders(); } Leaf copy = new Leaf( newDockable, leaf.getPlaceholders(), map, leaf.getNodeId() ); leaf.replace( copy ); Path placeholder = oldDockable.getPlaceholder(); if( placeholder != null ){ addPlaceholder( copy, placeholder ); } }