/** * 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 )); } }
if( x >= bounds.x && x <= bounds.x + bounds.width ){ if( y < bounds.y ){ return new PutInfo( columns[i].getRoot(), Put.TOP, drop, false ); return new PutInfo( columns[i].getRoot(), Put.BOTTOM, drop, false ); return new PutInfo( columns[i].getRoot(), Put.LEFT, drop, false ); return new PutInfo( columns[i].getRoot(), Put.RIGHT, drop, false ); return new PutInfo( leftMost( getRoot() ), Put.LEFT, drop, false ); return new PutInfo( rightMost( getRoot() ), Put.RIGHT, drop, false ); if( y >= bounds.y && y <= bounds.y + bounds.height ){ if( x < bounds.x ){ return new PutInfo( columns[i].getRoot(), Put.LEFT, drop, false ); return new PutInfo( columns[i].getRoot(), Put.RIGHT, drop, false ); return new PutInfo( columns[i].getRoot(), Put.TOP, drop, false ); return new PutInfo( columns[i].getRoot(), Put.BOTTOM, drop, false ); return new PutInfo( leftMost( getRoot() ), Put.TOP, drop, false ); return new PutInfo( rightMost( getRoot() ), Put.BOTTOM, drop, false );
public PutInfo prepareDrop( SplitDockStation station, StationDropItem item ){ if( station.isFullScreen() ) return null; if( station.getDockableCount() == 0 ){ PutInfo putInfo = new PutInfo( null, PutInfo.Put.CENTER, item.getDockable(), true ); putInfo = validatePutInfo( station, putInfo ); return putInfo; } else{ Point point = new Point( item.getMouseX(), item.getMouseY() ); SwingUtilities.convertPointFromScreen( point, station ); PutInfo putInfo = station.getRoot().getPut( point.x, point.y, item.getDockable() ); if( putInfo == null && station.isAllowSideSnap() ){ putInfo = calculateSideSnap( station, point.x, point.y, null, item.getDockable() ); putInfo = validatePutInfo( station, putInfo ); } if( putInfo != null ){ putInfo.setDockable( item.getDockable() ); calculateDivider( station, putInfo, null, item ); } return putInfo; } }
public PutInfo prepareDrop( SplitDockStation station, StationDropItem item ){ if( station.isFullScreen() ) return null; if( station.getDockableCount() == 0 ){ PutInfo putInfo = new PutInfo( null, PutInfo.Put.CENTER, item.getDockable(), true ); putInfo = validatePutInfo( station, putInfo ); return putInfo; } else{ Point point = new Point( item.getMouseX(), item.getMouseY() ); SwingUtilities.convertPointFromScreen( point, station ); PutInfo putInfo = station.getRoot().getPut( point.x, point.y, item.getDockable() ); if( putInfo == null && station.isAllowSideSnap() ){ putInfo = calculateSideSnap( station, point.x, point.y, null, item.getDockable() ); putInfo = validatePutInfo( station, putInfo ); } if( putInfo != null ){ putInfo.setDockable( item.getDockable() ); calculateDivider( station, putInfo, null, item ); } return putInfo; } }
if( SplitNode.above( 0, station.getHeight(), station.getWidth(), 0, x, y )){ info = new PutInfo( station.getRoot().getChild(), PutInfo.Put.TOP, drop, false ); info = new PutInfo( station.getRoot().getChild(), PutInfo.Put.RIGHT, drop, false ); if( SplitNode.above( 0, station.getHeight(), station.getWidth(), 0, x, y )){ info = new PutInfo( station.getRoot().getChild(), PutInfo.Put.LEFT, drop, false ); info = new PutInfo( station.getRoot().getChild(), PutInfo.Put.BOTTOM, drop, false );
if( SplitNode.above( 0, station.getHeight(), station.getWidth(), 0, x, y )){ info = new PutInfo( station.getRoot().getChild(), PutInfo.Put.TOP, drop, false ); info = new PutInfo( station.getRoot().getChild(), PutInfo.Put.RIGHT, drop, false ); if( SplitNode.above( 0, station.getHeight(), station.getWidth(), 0, x, y )){ info = new PutInfo( station.getRoot().getChild(), PutInfo.Put.LEFT, drop, false ); info = new PutInfo( station.getRoot().getChild(), PutInfo.Put.BOTTOM, drop, false );
PutInfo info = new PutInfo( leaf, Put.TITLE, dockable, true ); source = new SplitDockCombinerSource( info, this, null ); target = combiner.prepare( source, Enforcement.HARD );
PutInfo info = new PutInfo( leaf, Put.TITLE, dockable, true ); source = new SplitDockCombinerSource( info, this, null ); target = combiner.prepare( source, Enforcement.HARD );