/** * Gets all the dockables that were {@link #addDockable(double, double, double, double, Object...) added} * to this grid at location <code>x,y,width,height</code> * @param x the x-coordinate * @param y the y-coordinate * @param width the width, more than 0 * @param height the height, more than 0 * @return the dockables, <code>null</code> if there are no dockables at this location */ public D[] getDockables( double x, double y, double width, double height ){ Node<D> node = nodeAt( x, y, width, height ); if( node == null ){ return null; } D[] copy = array( node.dockables.length ); System.arraycopy( node.dockables, 0, copy, 0, copy.length ); return copy; }
/** * Gets all the dockables that were {@link #addDockable(double, double, double, double, Object...) added} * to this grid at location <code>x,y,width,height</code> * @param x the x-coordinate * @param y the y-coordinate * @param width the width, more than 0 * @param height the height, more than 0 * @return the dockables, <code>null</code> if there are no dockables at this location */ public D[] getDockables( double x, double y, double width, double height ){ Node<D> node = nodeAt( x, y, width, height ); if( node == null ){ return null; } D[] copy = array( node.dockables.length ); System.arraycopy( node.dockables, 0, copy, 0, copy.length ); return copy; }
/** * Unpacks any existing {@link DockStation} at location <code>x,y,width,height</code>. All children * of all {@link DockStation}s are removed and re-added as if {@link #addDockable(double, double, double, double, Object...)} * would have been called multiple times. * @param x the x-coordinate * @param y the y-coordinate * @param width the width, more than 0 * @param height the height, more than 0 */ public void unpack( double x, double y, double width, double height ){ Node<D> node = nodeAt( x, y, width, height ); if( node != null && node.dockables != null ){ List<D> copy = new ArrayList<D>(); for( D dockable : node.dockables ){ for( D unpacked : unpack( dockable )){ copy.add( unpacked ); } } D[] unpacked = copy.toArray( array( copy.size() )); node.dockables = unpacked; } }
/** * Unpacks any existing {@link DockStation} at location <code>x,y,width,height</code>. All children * of all {@link DockStation}s are removed and re-added as if {@link #addDockable(double, double, double, double, Object...)} * would have been called multiple times. * @param x the x-coordinate * @param y the y-coordinate * @param width the width, more than 0 * @param height the height, more than 0 */ public void unpack( double x, double y, double width, double height ){ Node<D> node = nodeAt( x, y, width, height ); if( node != null && node.dockables != null ){ List<D> copy = new ArrayList<D>(); for( D dockable : node.dockables ){ for( D unpacked : unpack( dockable )){ copy.add( unpacked ); } } D[] unpacked = copy.toArray( array( copy.size() )); node.dockables = unpacked; } }