@Override protected SplitNode getRightChild( SplitNode node ){ return ((Node)node).getRight(); }
@Override protected SplitNode getRightChild( SplitNode node ){ return ((Node)node).getRight(); }
public Cell getRightmostCell( SplitNode node ){ while( node != null ){ if( node instanceof Node ){ node = ((Node)node).getRight(); } else{ return cells.get( node ); } } return null; }
@Override public SplitNode getChild( int location ){ switch( location ){ case 0: return getLeft(); case 1: return getRight(); default: return null; } }
public Leaf getLastLeafOfColumn(){ SplitNode node = root; while( node != null ){ if( node instanceof Root ){ node = ((Root)node).getChild(); } else if( node instanceof Node ){ node = ((Node)node).getRight(); } else if( node instanceof Leaf ){ return (Leaf)node; } else { node = null; } } return null; }
private SplitNode traverseDown( SplitNode node ){ while( node instanceof Node ){ Node n = (Node)node; boolean left = n.getLeft().isVisible(); boolean right = n.getRight().isVisible(); if( !left && right ){ node = n.getRight(); } else if( left && !right ){ node = n.getLeft(); } else{ break; } } return node; }
/** * Creates a new node-element. * @param layout the layout that uses this node * @param parent the parent of this node * @param node the node that is represented by this node-element */ public ResizeNode( LockedResizeLayoutManager<T> layout, ResizeElement<T> parent, Node node ){ super( parent, layout ); this.node = node; children[0] = layout.toElement( this, node.getLeft() ); children[1] = layout.toElement( this, node.getRight() ); }
/** * Creates a new node-element. * @param layout the layout that uses this node * @param parent the parent of this node * @param node the node that is represented by this node-element */ public ResizeNode( LockedResizeLayoutManager<T> layout, ResizeElement<T> parent, Node node ){ super( parent, layout ); this.node = node; children[0] = layout.toElement( this, node.getLeft() ); children[1] = layout.toElement( this, node.getRight() ); }
/** * Follows the tree downwards using the {@link Node#getRight() right} path until a {@link Leaf} * is found, the cell matching that leaf is returned. * @param node the starting point of the search * @return a cell or <code>null</code> */ public PersistentCell getHeadCell( SplitNode node ){ while( node != null ){ if( node instanceof Leaf ){ Dockable dockable = ((Leaf)node).getDockable(); for( Column column : getColumns().values() ){ if( column.cells.get( node ) != null ){ PersistentCell cell = column.getPersistentColumn().getCells().get( dockable ); if( cell != null ){ return cell; } } } node = null; } if( node instanceof Node ){ node = ((Node)node).getRight(); } else{ node = null; } } return null; }
public double validateDivider( SplitDockStation station, double divider, Node node ){ divider = Math.min( 1, Math.max( 0, divider )); SplitNode left = node.getLeft(); SplitNode right = node.getRight(); Dimension leftMin = null; Dimension rightMin = null; if( left != null ){ leftMin = left.getMinimumSize(); } if( right != null ){ rightMin = right.getMinimumSize(); } if( leftMin == null ){ leftMin = new Dimension(); } if( rightMin == null ){ rightMin = new Dimension(); } return validateDivider( station, divider, leftMin, rightMin, node.getOrientation(), node.getWidth(), node.getHeight() ); }
public double validateDivider( SplitDockStation station, double divider, Node node ){ divider = Math.min( 1, Math.max( 0, divider )); SplitNode left = node.getLeft(); SplitNode right = node.getRight(); Dimension leftMin = null; Dimension rightMin = null; if( left != null ){ leftMin = left.getMinimumSize(); } if( right != null ){ rightMin = right.getMinimumSize(); } if( leftMin == null ){ leftMin = new Dimension(); } if( rightMin == null ){ rightMin = new Dimension(); } return validateDivider( station, divider, leftMin, rightMin, node.getOrientation(), node.getWidth(), node.getHeight() ); }
SplitNode child = ((Node)node).getRight(); while( child != null ){ Column result = getColumns().get( child );
Dimension right = column.getPreferredSize( ((Node) node).getRight() ); if( left == null ) { preferredSize = right;
neighbor = ((Node)parent).getRight();
/** * Gets the number of gaps between the leafs of this cell * @return the number of gaps */ public int getGaps(){ if( node instanceof Leaf ) { return 0; } if( node instanceof Node ) { int left = column.getGaps( ((Node) node).getLeft() ); int right = column.getGaps( ((Node) node).getRight() ); if( left == -1 ) { return right; } if( right == -1 ) { return left; } if( left == -1 && right == -1 ) { return -1; } return left + 1 + right; } else if( node instanceof Root ) { return column.getGaps( ((Root) node).getChild() ); } else { return -1; } } }
/** * Gets the size of the gap that is currently to be used by <code>node</code> * @param node the node whose inner gap is requested * @param map detailed information about the layout of this station * @return the size of the inner gap */ public int getGap( Node node, WizardNodeMap map ){ Column column = map.getColumn( node ); if( column == null ){ return 0; } SplitNode root = column.getRoot().getParent(); while( root != null ){ if( root == node ){ return getGap( column.getIndex() ); } root = root.getParent(); } Cell cell = column.getLeftmostCell( node.getRight() ); if( cell == null ){ return getGap( column.getIndex() ); } else{ return getGap( column.getIndex(), cell.getIndex() ); } }
if( !parent.hasPlaceholders() ){ Node node = (Node)parent; SplitNode other = node.getLeft() == this ? node.getRight() : node.getLeft();
int right = applyPersistentSizes( ((Node)node).getRight(), map ); int gap = gap( (Node)node, map );