/** * Gets the location and size of the area which can be occupied by the children. * @return the boundaries of the base {@link Component} * @see #setBaseBounds(Rectangle) */ public Rectangle getBaseBounds(){ if( baseBounds != null ){ return baseBounds; } JComponent base = getAccess().getOwner().getBasePane(); Insets insets = base.getInsets(); int x = 0; int y = 0; int width = base.getWidth(); int height = base.getHeight(); if( insets != null ){ x = insets.left; y = insets.top; width -= insets.left + insets.right; height -= insets.top + insets.bottom; } return new Rectangle( x, y, width, height ); }
@Override public boolean insert( SplitDockPlaceholderProperty property, Dockable dockable ){ boolean done = child != null && child.insert( property, dockable ); if( !done ){ return getAccess().drop( dockable, property.toSplitLocation( this ), this ); } return true; }
@Override public void updateBounds( double x, double y, double width, double height, double factorW, double factorH, boolean components ) { super.updateBounds( x, y, width, height, factorW, factorH, components ); if( child != null ){ Rectangle bounds = new Rectangle( (int)(x * factorW), (int)(y * factorH), (int)(width * factorW), (int)(height * factorH)); Rectangle refitted = getAccess().getSpanStrategy().modifyBounds( bounds, this ); if( !bounds.equals( refitted ) && factorW > 0 && factorH > 0 ){ x = refitted.x / factorW; y = refitted.y / factorH; width = refitted.width / factorW; height = refitted.height / factorH; } child.updateBounds( x, y, width, height, factorW, factorH, components ); } treeChanged = false; }
/** * Sets the child of this root. Every root has only one child.<br> * Note that setting the child to <code>null</code> does not delete * the child from the system, only a call to {@link SplitNode#delete(boolean)} * does that. * @param child the child of the root, can be <code>null</code> */ public void setChild( SplitNode child ){ if( this.child != child ){ if( this.child != null ) this.child.setParent( null ); this.child = child; if( child != null ){ child.delete( false ); child.setParent( this ); } treeChanged(); if( child != null ){ ensureIdUniqueAsync(); } getAccess().getOwner().revalidate(); getAccess().getOwner().repaint(); getAccess().repositioned( this ); } }