@Override public PutInfo getPut( int x, int y, double factorW, double factorH, Dockable drop ) { DockableDisplayer displayer = getDisplayer(); if( displayer == null ) return null; Rectangle bounds = getBounds(); PutInfo result = null; boolean centered = false; bounds = removeTitle( bounds ); if( isTitlePut( bounds, x, y )){ centered = true; result = getAccess().validatePutInfo( new PutInfo( this, PutInfo.Put.TITLE, drop, true )); return result; if( isCenterPut( bounds, x, y )){ centered = true; result = getAccess().validatePutInfo( new PutInfo( this, PutInfo.Put.CENTER, drop, true )); return result; result = createSidePut( bounds, x, y, drop, centered ); return getAccess().validatePutInfo( new PutInfo( this, PutInfo.Put.CENTER, drop, centered ));
@Override public Leaf getLeaf( Dockable dockable ) { Dockable mine = getDockable(); if( mine != null && dockable == getDockable() ){ return this; } else{ return null; } }
@Override public RequestDimension prepareResize( Leaf leaf ) { boolean lockedWidth = isLockedHorizontally( leaf.getDockable() ); boolean lockedHeight = isLockedVertically( leaf.getDockable() ); if( !lockedWidth && !lockedHeight ) return null; RequestDimension request = new RequestDimension(); Rectangle bounds = leaf.getCurrentBounds(); if( lockedWidth ){ double width = leaf.getWidth(); if( width > 0 ){ request.setWidth( bounds.width ); } } if( lockedHeight ){ double height = leaf.getHeight(); if( height > 0 ){ request.setHeight( bounds.height ); } } return request; }
@Override public void handleLeaf( Leaf leaf ) { if( leaf.hasPlaceholder( placeholder )){ result = leaf.getDockable(); } }
@Override public <N> N submit( SplitTreeFactory<N> factory ){ PlaceholderMap map = getPlaceholderMap(); if( map == null ){ Dockable dockable = getDockable(); if( dockable != null ){ DockStation station = dockable.asDockStation(); if( station != null ){ map = station.getPlaceholders(); } } } return factory.leaf( getDockable(), getId(), getPlaceholders(), map ); }
/** * Creates a {@link DockableProperty} for the location of <code>dockable</code>. * The location is encoded directly as the coordinates x,y,width and height * of the <code>dockable</code>. * @param dockable the element whose location is searched * @return the location */ public SplitDockProperty getDockableLocationProperty( Dockable dockable ){ Leaf leaf = getRoot().getLeaf(dockable); return new SplitDockProperty(leaf.getX(), leaf.getY(), leaf.getWidth(), leaf.getHeight()); }
@Override public boolean insert( SplitDockPlaceholderProperty property, Dockable dockable ){ Path placeholder = property.getPlaceholder(); if( hasPlaceholder( placeholder )){ DockStation station = getDockable().asDockStation(); DockableProperty stationLocation = property.getSuccessor(); 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; SplitDockProperty selfLocation = new SplitDockProperty( getX(), getY(), getWidth(), getHeight() ); selfLocation.setSuccessor( property.getSuccessor() ); boolean done = getAccess().drop( dockable, selfLocation, this ); if( done ){ removePlaceholder( placeholder );
Dockable dockable = getDockable(); SplitDockAccess access = getAccess(); PlaceholderStrategy strategy = access.getOwner().getPlaceholderStrategy(); if( strategy != null ){ updatePlaceholders( dockable, keepCurrent, strategy ); setPlaceholderMap( station.getPlaceholders() ); if( hasPlaceholders() ){ Placeholder placeholder = createPlaceholder( getId() ); placeholder.setPlaceholders( getPlaceholders() ); movePlaceholderMap( placeholder ); replace( placeholder ); delete( true );
@Override public RequestDimension prepareResize( Leaf leaf ) { RequestDimension request = getAndClearResizeRequest( leaf.getDockable() ); if( request != null ){ Insets insets = leaf.getDisplayer().getDockableInsets(); if( request.isWidthSet() ) request.setWidth( request.getWidth() + insets.left + insets.right ); if( request.isHeightSet() ) request.setHeight( request.getHeight() + insets.top + insets.bottom ); return request; } return super.prepareResize( leaf ); } }
@Override public boolean aside( AsideRequest request ){ if( request.getPlaceholder() != null ){ addPlaceholder( request.getPlaceholder() ); DockStation station = getDockable().asDockStation(); if( station == null ){ AsideAnswer answer = request.forward( getStation().getCombiner(), getPlaceholderMap() ); if( answer.isCanceled() ){ return false; } setPlaceholderMap( answer.getLayout() ); } else{ AsideAnswer answer = request.forward( station ); if( answer.isCanceled() ){ return false; } } } return true; }
DockStation station = info.bestLeaf.getDockable().asDockStation(); AsideAnswer answer; if( station != null ){ PlaceholderMap layout = info.bestLeaf.getPlaceholderMap(); answer = request.forward( getCombiner(), layout ); if( !answer.isCanceled() ){ info.bestLeaf.setPlaceholderMap( answer.getLayout() ); info.bestLeaf.setPlaceholderMap( answer.getLayout() );
if( !DockUtilities.acceptable( this, leaf.getDockable(), dockable ) ){ return false; if( leaf.getDockable() != null ){ Dockable oldDockable = leaf.getDockable(); DockHierarchyLock.Token token = DockHierarchyLock.acquireUnlinking( this, oldDockable ); try{ dockStationListeners.fireDockableRemoving( oldDockable ); leaf.setDockable( null, token ); dockStationListeners.fireDockableRemoved( oldDockable ); leaf.setPlaceholderMap(null); try{ dockStationListeners.fireDockableAdding(combination); leaf.setDockable( combination, token );
public DockableDisplayer getOldDisplayer(){ SplitNode node = info.getNode(); if( node instanceof Leaf ){ return ((Leaf)node).getDisplayer(); } return null; }
@Override public void toString( int tabs, StringBuilder out ) { Dockable dockable = getDockable(); out.append( "Leaf[ " ); if( dockable != null ){ out.append( dockable.getTitleText() ); out.append( ", " ); } out.append( "placeholders={" ); Path[] placeholders = getPlaceholders(); if( placeholders != null ){ for( int i = 0; i < placeholders.length; i++ ){ if( i > 0 ){ out.append( ", " ); } out.append( placeholders[i].toString() ); } } out.append( "}, " ); out.append( "id=" ); out.append( getId() ); out.append( ", bounds=" ); out.append( getBounds() ); out.append( " ]" ); } }
if( depth < property.size() ){ Leaf leaf = create( dockable, property.getLeafId() ); if( leaf == null ){ return false; split( property, depth, leaf ); leaf.setDockable( dockable, null ); return true; DockStation station = getDockable().asDockStation(); DockableProperty stationLocation = property.getSuccessor(); 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 );
/** * 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(); } } }
if( putInfo.getLeaf() != null ) { if( fire ){ token = DockHierarchyLock.acquireUnlinking( SplitDockStation.this, putInfo.getLeaf().getDockable() ); putInfo.getLeaf().setDockable( null, token ); putInfo.setLeaf(null);
@Override public void handleLeaf( Leaf leaf ){ Dimension preferredSize = getPreferredSize( leaf ); if( preferredSize != null ){ int size; int preferred; if( side().getHeaderOrientation() == Orientation.HORIZONTAL ){ size = leaf.getSize().height; preferred = preferredSize.height; } else{ size = leaf.getSize().width; preferred = preferredSize.width; } leafs.put( leaf.getDockable(), new PersistentCell( size, preferred )); } } } );
@Override public boolean aside( SplitDockPathProperty property, int index, AsideRequest request ){ if( request.getPlaceholder() != null ){ if( index < property.size() ){ DockStation station = getDockable().asDockStation(); if( station == null ){ Placeholder placeholder = createPlaceholder( property.getLeafId() ); split( property, index, placeholder ); return placeholder.aside( request ); } } else{ return aside( request ); } } return true; }