public boolean drop( Dockable dockable, DockableProperty property ){ if( property instanceof ScreenDockProperty ) return drop( dockable, (ScreenDockProperty)property ); else return false; }
/** * Tries to add the <code>dockable</code> to this station, and uses * the <code>property</code> to determine its location. If the preferred * location overlaps an existing window, then the {@link Dockable} may be * added to a child-station of this station. * @param dockable the new {@link Dockable} * @param property the preferred location of the dockable * @return <code>true</code> if the dockable could be added, <code>false</code> * otherwise. */ public boolean drop( Dockable dockable, ScreenDockProperty property ){ return drop( dockable, property, true ); }
private void drop() { if( combine != null ){ combine( dropInfo, combiner, null ); } else{ Dimension size = dropSizeStrategy.getValue().getDropSize( ScreenDockStation.this, dockable ); ScreenDockProperty property = new ScreenDockProperty( titleX, titleY, size.width, size.height ); ScreenDockStation.this.drop( dockable, property, false ); } } }
public void drop( Dockable dockable ) { Window owner = getOwner(); int x = 30; int y = 30; if( owner != null ){ x += owner.getX(); y += owner.getY(); } Dimension preferred = dropSizeStrategy.getValue().getAddSize( this, dockable ); int width = Math.max( preferred.width, 100 ); int height = Math.max( preferred.height, 100 ); if( !drop( dockable, new ScreenDockProperty( x, y, width, height ) ) ){ addDockable( dockable, new Rectangle( x, y, width, height ) ); } }
/** * Called if the toolbar item defined by <code>source</code> has to be put * onto the {@link ScreenDockStation} defined by <code>source</code>. * * @param source * all the information about the operation * @param orientation * the preferred orientation of the new window, might be * <code>null</code> */ protected void execute( InserterSource source, Orientation orientation ){ final ToolbarStrategy strategy = getStrategy(); Dockable child = source.getItem().getDockable(); final Dockable item = strategy.ensureToolbarLayer( source.getParent(), child ); if( item != child ){ item.setController( controller ); item.asDockStation().drop( child ); item.setController( null ); } if( (orientation != null) && (item.asDockStation() instanceof OrientedDockStation) ) { ((OrientedDockStation) item).setOrientation( orientation ); } final ScreenDockStation station = (ScreenDockStation) source.getParent(); item.getComponent().validate(); final Dimension size = item.getComponent().getPreferredSize(); final ScreenDockProperty location = new ScreenDockProperty( source.getItem().getTitleX(), source.getItem().getTitleY(), size.width, size.height ); station.drop( item, location, false ); }