@Override public DockableProperty findProperty( DockableProperty successor ){ SplitDockProperty split = new SplitDockProperty( x, y, width, height ); split.setSuccessor( successor ); if( parent != null ){ return parent.findProperty( split ); } return split; }
/** * Calculates how much of the rectangle given by the property lies inside * this node and how much of this node lies in the rectangle. The result * is a value between 0 and 1 which is 1 only if this node and the rectangle * are identical. The result is 0 if they do not have a shared area. * @param property the property that gives a rectangle * @return Area of intersection divided by the maxima of the area * of the rectangle and of this node. */ public double intersection( SplitDockProperty property ){ double rx1 = Math.max( x, property.getX() ); double ry1 = Math.max( y, property.getY() ); double rx2 = Math.min( x+width, property.getX() + property.getWidth() ); double ry2 = Math.min( y+height, property.getY() + property.getHeight() ); if( rx1 > rx2 || ry1 > ry2 ) return 0; if( property.getWidth() == 0 || property.getHeight() == 0 ) return 0; double max = Math.max( property.getWidth()*property.getHeight(), width*height ); return (rx2-rx1)*(ry2-ry1) / max; }
public DockableProperty copy() { SplitDockProperty copy = new SplitDockProperty( x, y, width, height ); copy( copy ); return copy; }
@Override public DockableProperty findProperty( DockableProperty successor ) { if( successor == null ){ return new SplitDockProperty( 0, 0, 1, 1 ); } return successor; }
public double getDivider( SplitDockProperty property ){ double divider = 0.5; if( bestNodePut == PutInfo.Put.LEFT ) { divider = property.getWidth() / bestNode.getWidth(); } else if( bestNodePut == PutInfo.Put.RIGHT ) { divider = 1 - property.getWidth() / bestNode.getWidth(); } else if( bestNodePut == PutInfo.Put.TOP ) { divider = property.getHeight() / bestNode.getHeight(); } else if( bestNodePut == PutInfo.Put.BOTTOM ) { divider = 1 - property.getHeight() / bestNode.getHeight(); } return Math.max(0, Math.min(1, divider)); } }
DockableProperty successor = property.getSuccessor(); if( station != null && successor != null ) { if( station.drop(dockable, successor) ) { boolean result = dropOver(info.bestLeaf, dockable, property.getSuccessor(), null, null); validate(); return result;
@Override public DockableProperty findProperty( DockableProperty successor ){ if( successor == null ){ return new SplitDockProperty( 0, 0, 1, 1 ); } return successor; }
public double getDivider( SplitDockProperty property ){ double divider = 0.5; if( bestNodePut == PutInfo.Put.LEFT ) { divider = property.getWidth() / bestNode.getWidth(); } else if( bestNodePut == PutInfo.Put.RIGHT ) { divider = 1 - property.getWidth() / bestNode.getWidth(); } else if( bestNodePut == PutInfo.Put.TOP ) { divider = property.getHeight() / bestNode.getHeight(); } else if( bestNodePut == PutInfo.Put.BOTTOM ) { divider = 1 - property.getHeight() / bestNode.getHeight(); } return Math.max(0, Math.min(1, divider)); } }
DockableProperty successor = property.getSuccessor(); if( station != null && successor != null ) { if( station.drop(dockable, successor) ) { boolean result = dropOver(info.bestLeaf, dockable, property.getSuccessor(), null, null); validate(); return result;
/** * Creates a new location by creating the child location of <code>location</code> using * <code>property</code> for that step. * @param location the location to expand * @param property the property that is the source of the next location * @return the new location or <code>null</code> if no conversion is possible */ protected CLocation expand( CLocation location, SplitDockProperty property ){ if( !(location instanceof CSplitLocation )){ location = new CSplitLocation( location ); } return new CRectangleLocation( (CSplitLocation)location, property.getX(), property.getY(), property.getWidth(), property.getHeight() ); }
@Override public DockableProperty findProperty( DockableProperty successor ){ SplitDockProperty split = new SplitDockProperty( x, y, width, height ); split.setSuccessor( successor ); if( parent != null ){ return parent.findProperty( split ); } return split; }
@Override public DockableProperty findProperty( DockableProperty successor ){ if( successor == null ){ return new SplitDockProperty( 0, 0, 1, 1 ); } return successor; }
if( property.getSuccessor() != null && info.bestLeafIntersection > 0.75 ){ DockStation station = info.bestLeaf.getDockable().asDockStation(); AsideAnswer answer;
/** * Creates a new location by creating the child location of <code>location</code> using * <code>property</code> for that step. * @param location the location to expand * @param property the property that is the source of the next location * @return the new location or <code>null</code> if no conversion is possible */ protected CLocation expand( CLocation location, SplitDockProperty property ){ if( !(location instanceof CSplitLocation )){ location = new CSplitLocation( location ); } return new CRectangleLocation( (CSplitLocation)location, property.getX(), property.getY(), property.getWidth(), property.getHeight() ); }
/** * Gets a {@link SplitDockProperty} that works as backup property * if the referenced placeholder is not found. * @param target the node that asks for this location * @return the location, not <code>null</code> */ public SplitDockProperty toSplitLocation( SplitNode target ){ if( backup instanceof SplitDockProperty ) return (SplitDockProperty)backup; if( backup instanceof SplitDockPathProperty ) return ((SplitDockPathProperty)backup).toLocation( target ); SplitDockProperty result = new SplitDockProperty( target.getX(), target.getY(), target.getWidth(), target.getHeight() ); result.setSuccessor( getSuccessor() ); return result; }
@Override public DockableProperty findProperty( DockableProperty successor ) { if( successor == null ){ return new SplitDockProperty( 0, 0, 1, 1 ); } return successor; }
if( property.getSuccessor() != null && info.bestLeafIntersection > 0.75 ){ DockStation station = info.bestLeaf.getDockable().asDockStation(); AsideAnswer answer;
double height = node.getHeight(); double left = Math.abs(x - property.getX()); double right = Math.abs(x + width - property.getX() - property.getWidth()); double top = Math.abs(y - property.getY()); double bottom = Math.abs(y + height - property.getY() - property.getHeight()); double kx = property.getX() + property.getWidth() / 2; double ky = property.getY() + property.getHeight() / 2;
SplitDockProperty property = new SplitDockProperty( x, y, w, h ); property.setSuccessor( getSuccessor() ); return property;
public DockableProperty createProperty() { return new SplitDockProperty(); } }