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() ); }
/** * Transforms a node of a {@link SplitDockStationLayout} into a key * of a {@link SplitDockTree}. * @param node the element to transform * @param tree the tree into which to add new keys * @param children the set of known children * @return the key or <code>null</code> */ private <D> SplitDockTree<D>.Key handleNode( SplitDockStationLayout.Node node, SplitDockTree<D> tree,Map<Integer, D> children ){ SplitDockTree<D>.Key a = handleEntry( node.getChildA(), tree, children ); SplitDockTree<D>.Key b = handleEntry( node.getChildB(), tree, children ); if( a == null ) return b; if( b == null ) return a; switch( node.getOrientation() ){ case HORIZONTAL: return tree.horizontal( a, b, node.getDivider(), node.getPlaceholders(), node.getPlaceholderMap(), node.getNodeId() ); case VERTICAL: return tree.vertical( a, b, node.getDivider(), node.getPlaceholders(), node.getPlaceholderMap(), node.getNodeId() ); } return null; }
public void setLayout( SplitDockStation station, SplitDockStationLayout layout, Map<Integer, Dockable> children, PlaceholderStrategy placeholders ) { DockableSplitDockTree tree = new DockableSplitDockTree(); DockableSplitDockTree.Key root = null; if( layout.getRoot() != null ){ root = handleEntry( layout.getRoot(), tree, children ); } if( root != null ){ tree.root( root ); } station.dropTree( tree, false ); PlaceholderStrategy oldStrategy = station.getPlaceholderStrategy().getStrategy(); if( placeholders != oldStrategy && placeholders != null ){ try{ station.setPlaceholderStrategy( placeholders ); } finally{ station.setPlaceholderStrategy( oldStrategy ); } } Dockable fullscreen = children.get( layout.getFullscreen() ); station.setFullScreen( fullscreen ); }