/** * 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 ); }
@Override protected void dropTree( SplitDockPerspective station, SplitDockTree<PerspectiveDockable> tree ){ station.read( (PerspectiveSplitDockTree)tree, null ); }
public SplitDockPerspective layoutPerspective( SplitDockStationLayout layout, Map<Integer, PerspectiveDockable> children ){ SplitDockPerspective result = new SplitDockPerspective(); layoutPerspective( result, layout, children ); return result; }
public SplitDockStationLayout getPerspectiveLayout( SplitDockPerspective element, Map<PerspectiveDockable, Integer> children ){ if( children == null ){ return createLayout( null, -1, element.hasFullscreenAction() ); } Entry root = convert( element.getRoot(), children ); PerspectiveDockable fullscreenDockable = element.getFullscreen(); Integer fullscreen = null; if( fullscreenDockable != null ) fullscreen = children.get( fullscreenDockable ); if( fullscreen == null ) return createLayout( element, root, -1, element.hasFullscreenAction() ); else return createLayout( element, root, fullscreen, element.hasFullscreenAction() ); }
/** * Sets the child of this root. * @param child the child, can be <code>null</code> */ public void setChild( Entry child ){ if( child != null ){ if( child.asLeaf() == null && child.asNode() == null ){ throw new IllegalArgumentException( "child must either be a leaf or a node" ); } } if( this.child != null ){ this.child.setParent( null ); fireRemoved( this, this.child ); } this.child = child; if( this.child != null ){ this.child.setParent( this ); fireAdded( this, this.child ); } } }
dockable = combine( dockables, tree.getSelected( key ) ); return new Leaf( dockable, toSet( tree.getPlaceholders( key ) ), tree.getPlaceholderMap( key ), key.getNodeId() ); Entry childA = convert( tree.getLeft( key )); Entry childB = convert( tree.getRight( key )); Orientation orientation; if( tree.isHorizontal( key )){ return new Node( orientation, tree.getDivider( key ), childA, childB, toSet( tree.getPlaceholders( key ) ), tree.getPlaceholderMap( key ), key.getNodeId() );
@Override protected Entry getRoot( SplitDockPerspective station ){ return station.getRoot(); }
public void layoutPerspective( SplitDockPerspective perspective, SplitDockStationLayout layout, Map<Integer,PerspectiveDockable> children ){ if( children != null ){ PerspectiveSplitDockTree tree = new PerspectiveSplitDockTree(); PerspectiveSplitDockTree.Key root = null; if( layout.getRoot() != null ){ root = handleEntry( layout.getRoot(), tree, children ); } if( root != null ){ tree.root( root ); } perspective.read( tree, children.get( layout.getFullscreen() ) ); } perspective.setHasFullscreenAction( layout.hasFullscreenAction() ); }
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 ); } }
SplitDockPerspective split = new SplitDockPerspective(); split.setHasFullscreenAction( ((SplitDockStation)element).hasFullScreenAction() ); result = split;
private void clearPlaceholder( Entry parent, Path placeholder, Entry exception ){ if( parent != null && parent != exception ){ if( parent.getPlaceholderMap() != null ){ parent.getPlaceholderMap().removeAll( placeholder, true ); } parent.getPlaceholders().remove( placeholder ); } if( parent.asNode() != null ){ clearPlaceholder( parent.asNode().getChildA(), placeholder, exception ); clearPlaceholder( parent.asNode().getChildB(), placeholder, exception ); } }
/** * Reads the contents of <code>tree</code> and replaces any content of this perspective * @param tree the tree that represents this perspective * @param fullscreen the one child that is currently in fullscreen-mode, can be <code>null</code> */ public void read( PerspectiveSplitDockTree tree, PerspectiveDockable fullscreen ){ root.setChild( convert( tree.getRoot() ) ); if( fullscreen != null && !children.contains( fullscreen )){ throw new IllegalArgumentException( "fullscreen is not a child of this station" ); } this.fullscreen = fullscreen; }
private Leaf find( Entry start, PerspectiveDockable child ){ if( start == null ){ return null; } if( start.asLeaf() != null ){ if( start.asLeaf().getDockable() == child ){ return start.asLeaf(); } return null; } Leaf result = find( start.asNode().getChildA(), child ); if( result == null ){ result = find( start.asNode().getChildB(), child ); } return result; }
Path placeholder = dockable.getPlaceholder(); if( placeholder != null ){ perspective.addPlaceholder( this, placeholder ); for( PlaceholderMap.Key key : placeholders.getPlaceholders() ){ for( Path subPlaceholder : key.getPlaceholders() ){ perspective.addPlaceholder( this, subPlaceholder );
addListener( new EntryListener(){ public void added( Entry parent, Entry child ){ add( child );
/** * Sets the child of this root. * @param child the child, can be <code>null</code> */ public void setChild( Entry child ){ if( child != null ){ if( child.asLeaf() == null && child.asNode() == null ){ throw new IllegalArgumentException( "child must either be a leaf or a node" ); } } if( this.child != null ){ this.child.setParent( null ); fireRemoved( this, this.child ); } this.child = child; if( this.child != null ){ this.child.setParent( this ); fireAdded( this, this.child ); } } }
dockable = combine( dockables, tree.getSelected( key ) ); return new Leaf( dockable, toSet( tree.getPlaceholders( key ) ), tree.getPlaceholderMap( key ), key.getNodeId() ); Entry childA = convert( tree.getLeft( key )); Entry childB = convert( tree.getRight( key )); Orientation orientation; if( tree.isHorizontal( key )){ return new Node( orientation, tree.getDivider( key ), childA, childB, toSet( tree.getPlaceholders( key ) ), tree.getPlaceholderMap( key ), key.getNodeId() );
@Override protected Entry getRoot( SplitDockPerspective station ){ return station.getRoot(); }