@Override public boolean isOfUse(){ if( !getAccess().isTreeAutoCleanupEnabled() ){ return true; } return handle != null || hasPlaceholders(); }
/** * Tells whether the position of the mouse <code>x/y</code> would result in a drag and drop operation where * {@link Put#CENTER} is appropriate. * @param bounds the boundaries of the {@link Dockable}, this {@link Leaf} or any other representation of * the {@link Dockable} * @param x the x-coordinate of the mouse * @param y the y-coordinate of the mouse * @return whether the location of the mouse would allow a combination of the {@link Dockable}s */ protected boolean isCenterPut( Rectangle bounds, int x, int y ){ float sideSnapSize = getAccess().getOwner().getSideSnapSize(); return x > bounds.x + sideSnapSize*bounds.width && x < bounds.x + bounds.width - sideSnapSize*bounds.width && y > bounds.y + sideSnapSize*bounds.height && y < bounds.y + bounds.height - sideSnapSize*bounds.height; }
@Override public boolean isInOverrideZone( int x, int y, double factorW, double factorH ){ float sideSnapSize = getAccess().getOwner().getSideSnapSize(); Rectangle bounds = getBounds(); if( x > bounds.x + sideSnapSize*bounds.width && x < bounds.x + bounds.width - sideSnapSize*bounds.width && y > bounds.y + sideSnapSize*bounds.height && y < bounds.y + bounds.height - sideSnapSize*bounds.height ){ return false; } return true; }
if( handle != null ){ if( updatePlaceholders ){ getAccess().getPlaceholderSet().set( this, handle.getDockable() ); getAccess().removeHandle( handle, token ); handle = null; handle = getAccess().newHandle( dockable ); getAccess().getPlaceholderSet().set( this, dockable ); getAccess().addHandle( handle, token );
/** * Resets the boundaries of the {@link DockableDisplayer} of this {@link Leaf}, using the current {@link Span}s * as well. */ public void resetDisplayerBounds(){ DockableDisplayer displayer = getDisplayer(); StationChildHandle fullscreen = getAccess().getFullScreenDockable(); if( displayer != null && (fullscreen == null || displayer != fullscreen.getDisplayer() )){ Rectangle bounds = getBounds(); bounds = getAccess().getSpanStrategy().modifyBounds( bounds, this ); Component component = displayer.getComponent(); component.setBounds( bounds ); if( component instanceof JComponent ){ ((JComponent)component).revalidate(); } } }
/** * Assuming the mouse at <code>x/y</code> is within <code>bounds</code>, this method calculates which one * of the non-combining {@link Put}s describe the situation best. The method creates and validates a new * {@link PutInfo}. * @param bounds the boundaries of the {@link Dockable}, the {@link Leaf} or any other representation of the * {@link Dockable}. * @param x the x-coordinate of the mouse * @param y the y-coordinate of the mouse * @param drop the item that is about to be dropped * @param centered whether the mouse position alone would usually require one of the combining {@link Put}s * @return the new drag and drop operation, or <code>null</code> if the suggested operation is not valid */ protected PutInfo createSidePut( Rectangle bounds, int x, int y, Dockable drop, boolean centered ){ if( above( bounds.x, bounds.y, bounds.x + bounds.width, bounds.y + bounds.height, x, y )){ if( above( bounds.x, bounds.y + bounds.height, bounds.x + bounds.width, bounds.y, x, y )) return getAccess().validatePutInfo( new PutInfo( this, PutInfo.Put.TOP, drop, centered )); else return getAccess().validatePutInfo( new PutInfo( this, PutInfo.Put.RIGHT, drop, centered )); } else{ if( above( bounds.x, bounds.y + bounds.height, bounds.x + bounds.width, bounds.y, x, y )) return getAccess().validatePutInfo( new PutInfo( this, PutInfo.Put.LEFT, drop, centered )); else return getAccess().validatePutInfo( new PutInfo( this, PutInfo.Put.BOTTOM, drop, centered )); } }
private void updatePlaceholders( Dockable dockable, boolean keep, PlaceholderStrategy strategy ){ Path placeholder = strategy.getPlaceholderFor( dockable ); if( placeholder != null ){ if( !keep ){ getAccess().getPlaceholderSet().set( null, placeholder ); } else { getAccess().getPlaceholderSet().set( this, placeholder ); } } DockStation station = dockable.asDockStation(); if( station != null ){ for( int i = 0, n = station.getDockableCount(); i<n; i++ ){ updatePlaceholders( station.getDockable( i ), keep, strategy ); } } }
if( station != null && stationLocation != null ){ if( dockable.accept( station ) && station.accept( dockable )){ DockController controller = getAccess().getOwner().getController(); DockAcceptance acceptance = controller == null ? null : controller.getAcceptance(); if( acceptance == null || acceptance.accept( station, dockable )){ boolean done = station.drop( dockable, stationLocation ); if( done ){ getAccess().getPlaceholderSet().set( null, placeholder, this ); return true; boolean done = getAccess().drop( dockable, selfLocation, this ); if( done ){ removePlaceholder( placeholder );
if( station != null && stationLocation != null ){ if( dockable.accept( station ) && station.accept( dockable )){ DockController controller = getAccess().getOwner().getController(); DockAcceptance acceptance = controller == null ? null : controller.getAcceptance(); if( acceptance == null || acceptance.accept( station, dockable )){ return getAccess().drop( dockable, property.toLocation( this ), this );
SplitDockAccess access = getAccess(); PlaceholderStrategy strategy = access.getOwner().getPlaceholderStrategy(); if( strategy != null ){