/** * Gets the size of this node in pixel. * @return the size of the node */ public Dimension getSize(){ Root root = getRoot(); double fw = root.getWidthFactor(); double fh = root.getHeightFactor(); return new Dimension( (int)(width * fw + 0.5), (int)(height * fh + 0.5 )); } /**
/** * Tells whether the location x/y is in the override zone. * @param x the x-coordinate of the mouse * @param y the y-coordinate of the mouse * @return <code>true</code> if this station should have priority * over all other stations when the mouse is in x/y. */ public boolean isInOverrideZone( int x, int y ){ double factorW = getWidthFactor(); double factorH = getHeightFactor(); return isInOverrideZone( x, y, factorW, factorH ); }
public double getDividerAt( int x, int y ){ Root root = getRoot(); if( orientation == Orientation.HORIZONTAL ){ double mx = x / root.getWidthFactor(); return (mx - this.x) / width; } else{ double my = y / root.getHeightFactor(); return (my - this.y) / height; } }
/** * Gets the size and location of this node in pixel where the point * 0/0 is equal to the point 0/0 on the owner-station. This method calculates * these values anew, clients interested in the current bounds should * use {@link VisibleSplitNode#getCurrentBounds()}. * @return the size and location */ public Rectangle getBounds(){ Root root = getRoot(); double fw = root.getWidthFactor(); double fh = root.getHeightFactor(); Rectangle rec = new Rectangle( (int)(x * fw + 0.5), (int)(y * fh + 0.5), (int)(width * fw + 0.5), (int)(height * fh + 0.5 )); Rectangle base = root.getBaseBounds(); rec.x = Math.min( base.width, Math.max( base.x, rec.x )); rec.y = Math.min( base.height, Math.max( base.y, rec.y )); rec.width = Math.min( base.width - rec.x + base.x, Math.max( 0, rec.width )); rec.height = Math.min( base.height - rec.y + base.y, Math.max( 0, rec.height )); return rec; }
/** * Gets the preferred operation when dragging the {@link Dockable} * <code>drop</code> to the location <code>x/y</code>. * @param x the x-coordinate of the mouse * @param y the y-coordinate of the mouse * @param drop the Dockable which will be dropped * @return where to trop the Dockable or <code>null</code> */ public PutInfo getPut( int x, int y, Dockable drop ){ double factorW = getWidthFactor(); double factorH = getHeightFactor(); return getPut( x, y, factorW, factorH, drop ); }
/** * Gets the space that a divider needs in the height. * @return the height of a divider */ public double getDividerHeight(){ return node.getStation().getDividerSize() / node.getRoot().getHeightFactor(); }
/** * Gets the space that a divider needs in the height. * @return the height of a divider */ public double getDividerHeight(){ return node.getStation().getDividerSize() / node.getRoot().getHeightFactor(); }
factor = station.getRoot().getHeightFactor(); size = height; left = minimumLeft.height;
factor = station.getRoot().getHeightFactor(); size = height; left = minimumLeft.height;
double factorH = root.getHeightFactor(); int dividerSize = getAccess().getOwner().getDividerSize();
@Override public ResizeRequest getRequest( RequestDimension size, Leaf leaf ) { if( size != null ){ Rectangle modified = leaf.getCurrentBounds(); // +0.1: to work against a later integer conversion that might round down double deltaWidth = size.getWidth() + 0.001 - modified.width; double deltaHeight = size.getHeight() + 0.001 - modified.height; Root root = leaf.getRoot(); deltaWidth /= root.getWidthFactor(); deltaHeight /= root.getHeightFactor(); return new ResizeRequest( deltaWidth, deltaHeight, size.isWidthSet() ? 1 : -1, size.isHeightSet() ? 1 : -1 ); } return null; }
@Override public ResizeRequest getRequest( RequestDimension size, Leaf leaf ) { if( size != null ){ Rectangle modified = leaf.getCurrentBounds(); // +0.1: to work against a later integer conversion that might round down double deltaWidth = size.getWidth() + 0.001 - modified.width; double deltaHeight = size.getHeight() + 0.001 - modified.height; Root root = leaf.getRoot(); deltaWidth /= root.getWidthFactor(); deltaHeight /= root.getHeightFactor(); return new ResizeRequest( deltaWidth, deltaHeight, size.isWidthSet() ? 1 : -1, size.isHeightSet() ? 1 : -1 ); } return null; }