/** * Gets an array containing all the {@link ScreenDockWindow}s that are currently shown by the {@link #getStation() station}. * @return all the windows */ public ScreenDockWindow[] getWindows(){ int count = station.getDockableCount(); ScreenDockWindow[] windows = new ScreenDockWindow[ count ]; for( int i = 0; i < count; i++ ){ windows[i] = station.getWindow( i ); } return windows; }
/** * Gets an array containing all the {@link ScreenDockWindow}s that are currently shown by the {@link #getStation() station}. * @return all the windows */ public ScreenDockWindow[] getWindows(){ int count = station.getDockableCount(); ScreenDockWindow[] windows = new ScreenDockWindow[ count ]; for( int i = 0; i < count; i++ ){ windows[i] = station.getWindow( i ); } return windows; }
public DockStationDropLayer[] getLayers() { DockStationDropLayer[] result = new DockStationDropLayer[ getDockableCount()+1 ]; result[0] = new ScreenLayer( this ); for( int i = 1; i < result.length; i++ ){ result[i] = new ScreenWindowLayer( this, getWindow( i-1 )); } return result; }
/** * Gets all the {@link ScreenDockWindow}s of the {@link #getStation() station} that are attracted to <code>window</code>. * @param window the window that has moved and whose partners are searched * @return all the partner windows, may be empty, is never <code>null</code>, does not contain <code>window</code> */ public ScreenDockWindow[] getAttracted( ScreenDockWindow window ){ List<ScreenDockWindow> result = new ArrayList<ScreenDockWindow>(); int count = station.getDockableCount(); for( int i = 0; i < count; i++ ){ ScreenDockWindow next = station.getWindow( i ); if( next != window ){ Attraction attraction = getAttraction( window.getDockable(), next.getDockable() ); switch( attraction ){ case STRONGLY_ATTRACTED: case ATTRACTED: result.add( next ); break; } } } return result.toArray( new ScreenDockWindow[ result.size() ] ); }
/** * Gets all the {@link ScreenDockWindow}s of the {@link #getStation() station} that are attracted to <code>window</code>. * @param window the window that has moved and whose partners are searched * @return all the partner windows, may be empty, is never <code>null</code>, does not contain <code>window</code> */ public ScreenDockWindow[] getAttracted( ScreenDockWindow window ){ List<ScreenDockWindow> result = new ArrayList<ScreenDockWindow>(); int count = station.getDockableCount(); for( int i = 0; i < count; i++ ){ ScreenDockWindow next = station.getWindow( i ); if( next != window ){ Attraction attraction = getAttraction( window.getDockable(), next.getDockable() ); switch( attraction ){ case STRONGLY_ATTRACTED: case ATTRACTED: result.add( next ); break; } } } return result.toArray( new ScreenDockWindow[ result.size() ] ); }
public void setLayout( ScreenDockStation station, ScreenDockStationLayout layout, Map<Integer, Dockable> children, PlaceholderStrategy placeholders ) { for( int i = station.getDockableCount()-1; i >= 0; i-- ) station.removeDockable( i ); if( layout instanceof RetroScreenDockStationLayout ){ RetroScreenDockStationLayout retro = (RetroScreenDockStationLayout) layout; for( int i = 0, n = retro.size(); i<n; i++ ){ Dockable dockable = children.get( retro.id( i ) ); if( dockable != null ){ Rectangle location = new Rectangle( retro.x( i ), retro.y( i ), retro.width( i ), retro.height( i )); station.addDockable( dockable, location, true ); } } } else{ station.setPlaceholders( layout.getPlaceholders().filter( placeholders ), children ); } }
public void setPlaceholders( PlaceholderMap placeholders ){ DockUtilities.checkLayoutLocked(); if( getDockableCount() > 0 ){ throw new IllegalStateException( "there are children on this station" ); } try{ DockablePlaceholderList<ScreenDockWindowHandle> next = new DockablePlaceholderList<ScreenDockWindowHandle>( placeholders ); if( getController() != null ){ dockables.setStrategy( null ); dockables.unbind(); dockables = next; dockables.bind(); dockables.setStrategy( getPlaceholderStrategy() ); } else{ dockables = next; } } catch( IllegalArgumentException ex ){ // ignore } }
public void handleResizeRequest( CControl control ) { for( int i = 0, n = station.getDockableCount(); i<n; i++ ){ ScreenDockWindow window = station.getWindow( i ); RequestDimension size = getAndClearResizeRequest( station.getDockable( i ) ); if( size != null ){ Insets insets = window.getDockableInsets(); Rectangle bounds = window.getWindowBounds(); int width; if( size.isWidthSet() ) width = size.getWidth() + insets.left + insets.right; else width = bounds.width; int height; if( size.isHeightSet() ) height = size.getHeight() + insets.top + insets.bottom; else height = bounds.height; window.setWindowBounds( new Rectangle( bounds.x + (bounds.width - width)/2, bounds.y + (bounds.height - height)/2, width, height ) ); } } }
public void handleResizeRequest( CControl control ) { for( int i = 0, n = station.getDockableCount(); i<n; i++ ){ ScreenDockWindow window = station.getWindow( i ); RequestDimension size = getAndClearResizeRequest( station.getDockable( i ) ); if( size != null ){ Insets insets = window.getDockableInsets(); Rectangle bounds = window.getWindowBounds(); int width; if( size.isWidthSet() ) width = size.getWidth() + insets.left + insets.right; else width = bounds.width; int height; if( size.isHeightSet() ) height = size.getHeight() + insets.top + insets.bottom; else height = bounds.height; window.setWindowBounds( new Rectangle( bounds.x + (bounds.width - width)/2, bounds.y + (bounds.height - height)/2, width, height ) ); } } }
if( getDockableCount() > 0 ){ throw new IllegalStateException( "must not have any children" );