/** * Adds <code>dockables</code> at location <code>x/y</code> with size <code>width/height</code> to an internal * list of pending commands to execute. This method does not change the layout of this area, but a call * to {@link #gridDeploy()} will.<br> * Calling this method several times with the same location and size has the same effect as calling it once, * but with a bigger array that contains all the dockables that would otherwise be added through many calls. * @param x the x-coordinate of <code>dockables</code>, can be any number * @param y the y-coordinate of <code>dockables</code>, can be any number * @param width the width of <code>dockables</code>, can be any number greater than 0 * @param height the height of <code>dockables</code>, can be any number greater than 0 * @param dockables the elements to add, should contain at least one item * @see #gridClear() * @see #gridDeploy() */ public void gridAdd( double x, double y, double width, double height, CDockablePerspective... dockables ){ gridChanges = true; grid.addDockable( x, y, width, height, convert( dockables ) ); }
/** * Adds <code>dockables</code> at location <code>x/y</code> with size <code>width/height</code> to an internal * list of pending commands to execute. This method does not change the layout of this area, but a call * to {@link #gridDeploy()} will.<br> * Calling this method several times with the same location and size has the same effect as calling it once, * but with a bigger array that contains all the dockables that would otherwise be added through many calls. * @param x the x-coordinate of <code>dockables</code>, can be any number * @param y the y-coordinate of <code>dockables</code>, can be any number * @param width the width of <code>dockables</code>, can be any number greater than 0 * @param height the height of <code>dockables</code>, can be any number greater than 0 * @param dockables the elements to add, should contain at least one item * @see #gridClear() * @see #gridDeploy() */ public void gridAdd( double x, double y, double width, double height, CDockablePerspective... dockables ){ gridChanges = true; grid.addDockable( x, y, width, height, convert( dockables ) ); }
private void handle( Entry entry, double x, double y, double width, double height ){ if( entry != null ){ if( entry.asLeaf() != null ) { PerspectiveDockable dockable = entry.asLeaf().getDockable(); if( dockable != null ) { grid.addDockable( x, y, width, height, dockable ); } } else{ Node node = entry.asNode(); double divider = node.getDivider(); if( node.getOrientation() == Orientation.HORIZONTAL ){ handle( node.getChildA(), x, y, width*divider, height ); handle( node.getChildB(), x+width*divider, y, width*(1-divider), height ); } else{ handle( node.getChildA(), x, y, width, height*divider ); handle( node.getChildB(), x, y+height*divider, width, height*(1-divider) ); } } } }
private void handle( Entry entry, double x, double y, double width, double height ){ if( entry != null ){ if( entry.asLeaf() != null ) { PerspectiveDockable dockable = entry.asLeaf().getDockable(); if( dockable != null ) { grid.addDockable( x, y, width, height, dockable ); } } else{ Node node = entry.asNode(); double divider = node.getDivider(); if( node.getOrientation() == Orientation.HORIZONTAL ){ handle( node.getChildA(), x, y, width*divider, height ); handle( node.getChildB(), x+width*divider, y, width*(1-divider), height ); } else{ handle( node.getChildA(), x, y, width, height*divider ); handle( node.getChildB(), x, y+height*divider, width, height*(1-divider) ); } } } }