public double getActualDivider(){ return validateDivider( getDivider() ); }
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() ); }
/** * Constructs a new node. * @param access the access to the owner-station of this node * @param left the left child * @param right the right child * @param id the unique id of this node */ public Node( SplitDockAccess access, SplitNode left, SplitNode right, long id ){ super( access, id ); setRight( right ); setLeft( left ); }
@Override public void handleNode( Node node ){ switch( node.getOrientation() ){ case HORIZONTAL: node.setOrientation( Orientation.VERTICAL ); break; case VERTICAL: node.setOrientation( Orientation.HORIZONTAL ); break; } }
SplitNode parent = node.getParent(); if( parent instanceof Node ){ if( ((Node)parent).getOrientation() == Orientation.HORIZONTAL ){ if( put == Put.TOP || put == Put.BOTTOM ){ parent = null; SplitNode neighbor = null; if( put == Put.LEFT || put == Put.TOP ){ neighbor = ((Node)parent).getLeft(); neighbor = ((Node)parent).getRight();
ResizeRequest beta = getRight().getRequest(); boolean horizontal = node.getOrientation() == Orientation.HORIZONTAL; getLeft().adapt( deltaWidth * node.getDivider(), deltaHeight ); getRight().adapt( deltaWidth * (1-node.getDivider()), deltaHeight ); getLeft().adapt( deltaWidth, deltaHeight * node.getDivider()); getRight().adapt( deltaHeight, deltaHeight * (1-node.getDivider())); double divider = node.getDivider(); double width = node.getWidth(); divider = Math.min( 1.0, Math.max( 0.0, divider ) ); node.setDivider( divider ); double divider = node.getDivider(); double height = node.getHeight(); divider = Math.min( 1.0, Math.max( 0.0, divider ) ); node.setDivider( divider );
private double validateHeadNode( double divider, Node node, WizardNodeMap map ){ if( side() == Side.RIGHT || side() == Side.BOTTOM ){ if( divider < node.getDivider() ){ if( divider > node.getDivider() ){ head = map.getHeadColumn( node.getRight() ); head = map.getHeadColumn( node.getLeft() ); if( side().getHeaderOrientation() == Orientation.HORIZONTAL ){ min = head.getMinimumSize().width + gap(); available = node.getSize().width; available = node.getSize().height;
node.setLeft( child ); node.setRight( neighbor ); node.setOrientation( Orientation.VERTICAL ); node.setLeft( neighbor ); node.setRight( child ); node.setOrientation( Orientation.VERTICAL ); node.setLeft( child ); node.setRight( neighbor ); node.setOrientation( Orientation.HORIZONTAL ); node.setLeft( neighbor ); node.setRight( child ); node.setOrientation( Orientation.HORIZONTAL ); node.setDivider(divider); parent.setChild(node, location);
@Override public boolean insert( SplitDockPlaceholderProperty property, Dockable dockable ){ Path placeholder = property.getPlaceholder(); if( hasPlaceholder( placeholder )){ Leaf leaf = create( dockable, -1 ); if( leaf == null ){ return false; getAccess().getPlaceholderSet().set( null, placeholder, this ); leaf.setPlaceholders( getPlaceholders() ); Node node = createNode( -1 ); node.setDivider( 0.5 ); if( width > height ){ node.setOrientation( Orientation.HORIZONTAL ); node.setOrientation( Orientation.VERTICAL ); SplitNode parent = getParent(); int location = parent.getChildLocation( this ); node.setLeft( leaf ); node.setRight( this );
if( n.getLeft() != null && n.getLeft().isVisible() && n.getRight() != null && n.getRight().isVisible() ) { if( n.getOrientation() == Orientation.HORIZONTAL ) { double dividerWidth = factorW > 0 ? Math.max( 0, gap( n, map ) / factorW ) : 0.0; double dividerLocation = width * n.getDivider(); updateBounds( n.getLeft(), x, y, dividerLocation - dividerWidth / 2, height, map ); updateBounds( n.getRight(), x + dividerLocation + dividerWidth / 2, y, width - dividerLocation - dividerWidth / 2, height, map ); double dividerLocation = height * n.getDivider(); updateBounds( n.getLeft(), x, y, width, dividerLocation - dividerHeight / 2, map ); updateBounds( n.getRight(), x, y + dividerLocation + dividerHeight / 2, width, height - dividerLocation - dividerHeight / 2, map ); updateBounds( n.getLeft(), x, y, width, height, map ); updateBounds( n.getRight(), x, y, width, height, map );
SplitNode superParent = parent.getParent(); if( superParent instanceof Root ){ n.setOrientation( side.getHeaderOrientation() ); return; if( n.getLeft() == node ){ if( s.getLeft() == n ){ s.setLeft( node ); SplitNode old = s.getRight(); s.setRight( n ); n.setLeft( old ); n.setLeft( s.getLeft() ); s.setLeft( node ); if( s.getRight() == n ){ s.setRight( node ); SplitNode old = s.getLeft(); s.setLeft( n ); n.setRight( old ); n.setRight( s.getRight() ); s.setRight( node ); n.setOrientation( side.getColumnOrientation() ); s.setOrientation( side.getHeaderOrientation() );
Node n = (Node)node; int left = applyPersistentSizes( n.getLeft(), column, map ); int right = applyPersistentSizes( n.getRight(), column, map ); if( n.getLeft() == null || !n.getLeft().isVisible() ){ return right; if( n.getRight() == null || !n.getRight().isVisible() ){ return left; ((Node)node).setDivider( (left + gap/2) / (double)(left + right + gap)); return left + gap + right;
@Override public void evolve( SplitDockTree<Dockable>.Key key, boolean checkValidity, Map<Leaf, Dockable> linksToSet ){ SplitDockTree<Dockable> tree = key.getTree(); setPlaceholders( tree.getPlaceholders( key ) ); setPlaceholderMap( tree.getPlaceholderMap( key ) ); if( tree.isHorizontal( key )){ orientation = SplitDockStation.Orientation.HORIZONTAL; setLeft( create( tree.getLeft( key ), checkValidity, linksToSet )); setRight( create( tree.getRight( key ), checkValidity, linksToSet )); setDivider( tree.getDivider( key )); } else{ orientation = SplitDockStation.Orientation.VERTICAL; setLeft( create( tree.getTop( key ), checkValidity, linksToSet )); setRight( create( tree.getBottom( key ), checkValidity, linksToSet )); setDivider( tree.getDivider( key )); } }
@Override protected Orientation getOrientation( SplitNode node ){ return ((Node)node).getOrientation(); }
public double validateDivider( Column column, double divider, Node node, WizardNodeMap map ){ if( divider > node.getDivider() ){ return divider; } Cell head = column.getRightmostCell( node.getLeft() ); if( head == null ){ return divider; } int min; int available; if( side().getHeaderOrientation() == Orientation.HORIZONTAL ){ min = node.getLeft().getSize().height - head.getNode().getSize().height + head.getMinimumSize().height; available = node.getSize().height; } else{ min = node.getLeft().getSize().width - head.getNode().getSize().width + head.getMinimumSize().width; available = node.getSize().width; } double minDividier = (min + gap()/2) / (double)(available + gap()); return Math.max( minDividier, divider ); }
@Override protected SplitNode getRightChild( SplitNode node ){ return ((Node)node).getRight(); }
/** * Gets the space that a divider needs in the height. * @return the height of a divider */ public double getDividerHeight(){ return node.getStation().getDividerSize() / node.getRoot().getHeightFactor(); }
@Override protected SplitNode getLeftChild( SplitNode node ){ return ((Node)node).getLeft(); }