public Dockable getFrontDockable() { if( frontWindow == null ) return null; else return frontWindow.getDockable(); }
public void setFullscreen( ScreenDockWindow window, boolean fullscreen ){ if( fullscreen ){ window.setNormalBounds( window.getWindowBounds() ); window.setWindowBounds( new Rectangle( 0, 0, desktop.getWidth(), desktop.getHeight() ) ); } else{ Rectangle bounds = window.getNormalBounds(); if( bounds != null ){ window.setWindowBounds( bounds ); window.setNormalBounds( null ); } } } }
/** * Gets the current normal bounds of the window represented by this handle. * @return the boundaries, not <code>null</code> */ public Rectangle getBounds(){ Rectangle result = null; if( window != null ){ if( window.isFullscreen() ){ result = window.getNormalBounds(); } if( result == null ){ result = window.getWindowBounds(); } } return result; } }
@Override public Rectangle checkSize( ScreenDockWindow window ){ Point center = window.getTitleCenter(); if( center == null ){ Rectangle target = window.getWindowBounds(); center = new Point( target.width/2, target.height/2 ); } return validate( window, window.getWindowBounds(), center, center ); }
configuration = getConfiguration( oldWindow.getDockable() ); newWindow = createWindow( configuration ); Dockable dockable = oldWindow.getDockable(); Rectangle bounds = oldWindow.getNormalBounds(); if( bounds == null ){ bounds = oldWindow.getWindowBounds(); boolean fullscreen = oldWindow.isFullscreen(); boolean visible = oldWindow.isVisible(); oldWindow.setDockable( null ); oldWindow.setPaintCombining( null ); oldWindow.setController( null ); oldWindow.setFullscreenStrategy( null ); oldWindow.destroy(); handle.setWindow( newWindow, configuration ); newWindow.setController( getController() ); newWindow.setFullscreenStrategy( getFullscreenStrategy() ); newWindow.setWindowBounds( bounds ); newWindow.setFullscreen( fullscreen ); newWindow.setVisible( true ); newWindow.setPreventFocusStealing( true ); newWindow.setVisible( true ); Timer timer = new Timer( delay, new ActionListener(){
final Insets insets = window.getDockableInsets(); final int height = insets.top + insets.bottom + preferred.height; Rectangle bounds = window.getNormalBounds(); if (bounds == null){ bounds = window.getWindowBounds(); if (window.isFullscreen()){ window.setNormalBounds(bounds); } else{ window.setWindowBounds(bounds);
ScreenDockWindow window = createWindow(configuration); register( dockable, placeholder, window, configuration ); window.setDockable( dockable ); window.validate(); Insets estimate = window.getDockableInsets(); if( estimate != null ){ bounds.x -= estimate.left; window.setWindowBounds( bounds ); window.validate(); window.validate(); Point offset = window.getOffsetDrop(); if( offset != null ){ Rectangle windowBounds = window.getWindowBounds(); windowBounds = new Rectangle( windowBounds.x + offset.x, windowBounds.y + offset.y, windowBounds.width, windowBounds.height ); window.setWindowBounds( windowBounds ); window.setVisible( true );
private void handleMousePressed( MouseEvent e ){ if( !e.isConsumed() && !window.isFullscreen() ){ int buttons = MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON2_DOWN_MASK | MouseEvent.BUTTON3_DOWN_MASK; buttons &= e.getModifiersEx(); startBoundaries = window.getWindowBounds(); startPoint = e.getPoint(); convertPointToScreen( startPoint, e.getComponent() ); magnet = window.getStation().getMagnetController().start( window ); DockController controller = window.getStation().getController(); if( controller != null ){ relocator = controller.getRelocator().createRemote( window.getDockable() ); relocator.setShowImageWindow( false ); DockableDisplayer displayer = window.getDockableDisplayer(); if( displayer != null ){ relocator.setTitle( displayer.getTitle() );
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 ) ); } } }
/** * Creates a new operation. * @param window the window that is reshaped */ public Operation( ScreenDockWindow window ){ this.window = window; for( ScreenDockWindow check : getWindows() ){ initialBoundaries.put( check, check.getWindowBounds() ); } }
public void run() { ScreenDockWindow window = station.getWindow( parent ); if( window != null ){ window.validate(); Dimension newSize = dockable.getComponent().getSize(); int dw = oldSize.width - newSize.width; int dh = oldSize.height - newSize.height; Rectangle bounds = window.getWindowBounds(); bounds.width += dw; bounds.height += dh; window.setWindowBounds( bounds ); } } } );
ScreenDockWindow window = createWindow( configuration ); ScreenDockWindowHandle handle = new ScreenDockWindowHandle( dockable, window, configuration ); window.setController( getController() ); window.setFullscreenStrategy( getFullscreenStrategy() ); window.setDockable( dockable ); window.setWindowBounds( new Rectangle( x, y, width, height ) ); window.setVisible( isShowing() ); window.validate(); window.setFullscreen( fullscreen );
private void move() { DockUtilities.checkLayoutLocked(); if( combine != null ){ combine( dropInfo, combiner, null ); } else{ ScreenDockWindow window = getWindow( dockable ); Point zero = window.getOffsetMove(); if( zero == null ) zero = new Point( 0, 0 ); Rectangle bounds = window.getWindowBounds(); bounds = new Rectangle( titleX - zero.x, titleY - zero.y, bounds.width, bounds.height ); window.setWindowBounds( bounds ); } }
/** * Sets the fullscreen mode of <code>window</code>. * @param wrapper the wrapper around <code>window</code> * @param window the window whose state is to be changed * @param fullscreen the new state */ public void setFullscreen( ScreenDockWindow wrapper, Window window, boolean fullscreen ){ if( isFullscreen( wrapper, window ) != fullscreen ){ if( fullscreen ){ Rectangle bounds = findBestFullscreenBounds( window ); if( bounds != null ){ wrapper.setNormalBounds( wrapper.getWindowBounds() ); window.setBounds( bounds.x-1, bounds.y-1, bounds.width+2, bounds.height+2 ); } } else{ Rectangle bounds = wrapper.getNormalBounds(); if( bounds != null ){ window.setBounds( bounds ); wrapper.setNormalBounds( null ); } } } }
/** * Invoked when a {@link ScreenDockWindow} is no longer needed. This * method removes some listeners from the window. If overridden * by a subclass, the subclass should ensure that this implementation * is invoked too. * @param dockable the element for which <code>window</code> was used * @param window the old window */ protected void deregister( Dockable dockable, ScreenDockWindow window ){ if( frontWindow == window ) frontWindow = null; int index = indexOf( window.getDockable() ); saveLocation( index ); dockables.remove( index ); getRootHandler().removeRoot( window.getComponent() ); window.setDockable( null ); window.setPaintCombining( null ); window.setController( null ); window.setFullscreenStrategy( null ); for( ScreenDockStationListener listener : screenDockStationListeners() ){ listener.windowDeregistering( this, dockable, window ); } window.destroy(); }
@Override public void layoutContainer( Container parent ){ Rectangle bounds = window.getWindowBounds(); Dimension size = windowComponent.getPreferredSize(); if( bounds.width != size.width || bounds.height != size.height ){ window.setWindowBounds( new Rectangle( bounds.getLocation(), size ) ); } super.layoutContainer( parent ); } }
private void addBorder( Area area ){ ScreenDockWindow window = getCallback().getWindow(); Insets insets = window.getDockableInsets(); Dimension size = window.getWindowBounds().getSize(); if( insets.top > 0 ){ area.add( new Area( new Rectangle( 0, 0, size.width, insets.top ))); } if( insets.bottom > 0 ){ area.add( new Area( new Rectangle( 0, size.height - insets.bottom - 1, size.width, insets.bottom ))); } if( insets.left > 0 ){ area.add( new Area( new Rectangle( 0, 0, insets.left, size.height ))); } if( insets.right > 0 ){ area.add( new Area( new Rectangle( size.width - insets.right - 1, 0, insets.right, size.height ))); } }
public boolean beginVisit( Node node, boolean revisit ){ if( revisit ){ return false; } ScreenDockWindow window = node.getWindow(); if( window != request.getWindow() ){ Rectangle bounds = request.getInitialBounds( window ); bounds.x += dx; bounds.y += dy; window.setWindowBounds( bounds ); } return true; }
/** * Gets a list of all children of this station that are currently in fullscreen mode. * @return a list of children, not <code>null</code> */ public Dockable[] getFullscreenChildren() { List<Dockable> result = new ArrayList<Dockable>(); for( ScreenDockWindowHandle handle : dockables.dockables() ){ ScreenDockWindow window = handle.getWindow(); if( window.isFullscreen() ){ result.add( window.getDockable() ); } } return result.toArray( new Dockable[ result.size() ] ); }
candidate = window.inCombineArea( x, y ); candidate = window.contains( x, y ); Dockable child = window.getDockable();