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 ); } }
@Override protected Entry getRootChild( Entry root ){ return ((SplitDockPerspective.Root)root).getChild(); }
/** * Makes sure that <code>placeholder</code> is not found anywhere * @param placeholder the element to remove * @param exception the entry that should not be modified */ private void clearPlaceholder( Path placeholder, Entry exception ){ clearPlaceholder( getRoot().getChild(), placeholder, exception ); }
/** * Searches and returns the leaf that shows <code>child</code>. * @param child some child of this station * @return the leaf showing <code>child</code> or <code>null</code> if not found */ public Leaf getLeaf( PerspectiveDockable child ){ return find( getRoot().getChild(), child ); }
/** * Searches and returns the leaf that shows <code>child</code>. * @param child some child of this station * @return the leaf showing <code>child</code> or <code>null</code> if not found */ public Leaf getLeaf( PerspectiveDockable child ){ return find( getRoot().getChild(), child ); }
@Override protected Entry getRootChild( Entry root ){ return ((SplitDockPerspective.Root)root).getChild(); }
/** * Reads the contents of the {@link #getRoot() root} and resets the {@link #grid() grid} to reflect that * root. This method is called once during construction of this perspective, it can later be called * to reset the perspective. */ public void gridPrepare(){ gridChanges = false; gridClear(); handle( delegate().getRoot().getChild(), 0, 0, 100, 100 ); }
/** * Reads the contents of the {@link #getRoot() root} and resets the {@link #grid() grid} to reflect that * root. This method is called once during construction of this perspective, it can later be called * to reset the perspective. */ public void gridPrepare(){ gridChanges = false; gridClear(); handle( delegate().getRoot().getChild(), 0, 0, 100, 100 ); }
/** * Makes sure that <code>placeholder</code> is not found anywhere * @param placeholder the element to remove * @param exception the entry that should not be modified */ private void clearPlaceholder( Path placeholder, Entry exception ){ clearPlaceholder( getRoot().getChild(), placeholder, exception ); }