/** * Tries to add <code>Dockable</code> such that the boundaries given * by <code>property</code> are full filled. * @param dockable a new child of this station * @param property the preferred location of the child * @return <code>true</code> if the child could be added, <code>false</code> * if no location could be found */ public boolean drop( Dockable dockable, SplitDockProperty property ){ return drop(dockable, property, root()); }
/** * Removes all children from this station and then adds the contents * that are stored in <code>tree</code>. Calling this method is equivalent * to <code>dropTree( tree, true );</code> * @param tree the new set of children * @throws SplitDropTreeException If the tree is not acceptable. */ public void dropTree( SplitDockTree<Dockable> tree ){ dropTree(tree, true); }
factor = station.getRoot().getWidthFactor(); size = width; left = minimumLeft.width; factor = station.getRoot().getHeightFactor(); size = height; left = minimumLeft.height; double dividerNeed = station.getDividerSize() / factor;
public void setFrontDockable( Dockable dockable ){ Dockable old = getFrontDockable(); this.frontDockable = dockable; if( isFullScreen() && dockable != null ) setFullScreen(dockable); if( old != dockable ){ access.dockableSelected( old ); } }
@Deprecated @Todo( compatibility=Compatibility.BREAK_MAJOR, priority=Priority.ENHANCEMENT, target=Version.VERSION_1_1_3, description="remove this method" ) public boolean isVisible( Dockable dockable ){ return isStationVisible() && (!isFullScreen() || dockable == getFullScreen()); }
access.arm(); DockUtilities.checkLayoutLocked(); if( getDockableCount() == 0 ) { if( !DockUtilities.acceptable( this, dockable ) ){ return false; drop(dockable); return true; updateBounds(); DropInfo info = getDropInfo( property, dockable, root ); if( station != null && successor != null ) { if( station.drop(dockable, successor) ) { validate(); return true; if( station != null && DockUtilities.acceptable( station, dockable ) ) { station.drop(dockable); validate(); return true; boolean result = dropOver(info.bestLeaf, dockable, property.getSuccessor(), null, null); validate(); return result; return dropAside( info.bestNode, info.bestNodePut, dockable, null, divider, null );
throw new NullPointerException("next must not be null"); if( previous != next ) { Leaf leaf = root().getLeaf(previous); boolean wasFullScreen = isFullScreen() && getFullScreen() == previous; setFullScreen(next); revalidate(); repaint();
throw new IllegalArgumentException("Tree must not be null"); DockUtilities.checkLayoutLocked(); DockController controller = getController(); try { access.arm(); setFullScreen(null); removeAllDockables(); if( rootKey != null ) { Map<Leaf, Dockable> linksToSet = new HashMap<Leaf, Dockable>(); root().evolve(rootKey, checkValidity, linksToSet); for( Map.Entry<Leaf, Dockable> entry : linksToSet.entrySet() ) { entry.getKey().setDockable( entry.getValue(), null ); updateBounds();
if( station.getFullScreen() != null && DockUtilities.isAncestor( station.getFullScreen(), dockable )){ station.setFullScreen( null ); if( getStation().drop( dockable, property ) ){ return; station.setFullScreen( dockable ); station.setFullScreen( dockable );
/** * Switches the child which is in fullscreen-mode. If there is no child, * nothing will happen. If there is only one child, it will be set to * fullscreen (if it is not already fullscreen). */ public void setNextFullScreen(){ if( dockables.size() > 0 ) { if( fullScreenDockable == null ) setFullScreen(getDockable(0)); else { int index = indexOfDockable(fullScreenDockable.getDockable()); index++; index %= getDockableCount(); setFullScreen(getDockable(index)); } } }
public boolean process( Dockable dockable, MouseEvent event ){ if( event.isConsumed() || !isExpandOnDoubleclick() ) return false; else { if( dockable == SplitDockStation.this ) return false; dockable = unwrap(dockable); if( dockable != null ) { if( isFullScreen() ) { if( getFullScreen() == dockable ) { setFullScreen(null); event.consume(); } } else { setFullScreen(dockable); event.consume(); } return true; } return false; } }
split.setController( parent.getController() ); split.updateTheme(); split.setPlaceholders( placeholders ); split.drop( source.getOld() ); location.add( splitTarget.side, splitTarget.space, -1 ); split.drop( source.getNew(), location ); return split;
setNextFullScreen(); setFullScreen(null); getContentPane().remove(displayer.getComponent()); setFrontDockable(null);
if( station.getDockableCount() == 0 ) return null; if( station.getDockableCount() == 1 && station.getDockable( 0 ) == drop ) return null; if( SplitNode.above( 0, 0, station.getWidth(), station.getHeight(), x, y )){ if( SplitNode.above( 0, station.getHeight(), station.getWidth(), 0, x, y )){ info = new PutInfo( station.getRoot().getChild(), PutInfo.Put.TOP, drop, false ); info = new PutInfo( station.getRoot().getChild(), PutInfo.Put.RIGHT, drop, false ); if( SplitNode.above( 0, station.getHeight(), station.getWidth(), 0, x, y )){ info = new PutInfo( station.getRoot().getChild(), PutInfo.Put.LEFT, drop, false ); info = new PutInfo( station.getRoot().getChild(), PutInfo.Put.BOTTOM, drop, false ); if( leaf != null && station.getRoot().getChild() instanceof Node){ Node node = (Node)station.getRoot().getChild(); if( node.getLeft().isVisible() && node.getRight().isVisible() ){ if( info.getPut() == PutInfo.Put.TOP && node.getOrientation() == Orientation.VERTICAL && node.getLeft() == leaf )
setFullScreen(dockable); return true; Dockable currentFullScreen = getFullScreen(); if( currentFullScreen == null ) { return false; Leaf leaf = getRoot().getLeaf(currentFullScreen); setFullScreen(null); if( !dropOver(leaf, dockable, successor, null, null) ){ return false; setFullScreen(last);
public void setLayout( SplitDockStation station, SplitDockStationLayout layout, Map<Integer, Dockable> children, PlaceholderStrategy placeholders ) { DockableSplitDockTree tree = new DockableSplitDockTree(); DockableSplitDockTree.Key root = null; if( layout.getRoot() != null ){ root = handleEntry( layout.getRoot(), tree, children ); } if( root != null ){ tree.root( root ); } station.dropTree( tree, false ); PlaceholderStrategy oldStrategy = station.getPlaceholderStrategy().getStrategy(); if( placeholders != oldStrategy && placeholders != null ){ try{ station.setPlaceholderStrategy( placeholders ); } finally{ station.setPlaceholderStrategy( oldStrategy ); } } Dockable fullscreen = children.get( layout.getFullscreen() ); station.setFullScreen( fullscreen ); }
public void mouseDragged( MouseEvent e ){ if( station.isResizingEnabled() && !station.isDisabled() ) { if( pressed && current != null ) { divider = current.getDividerAt( e.getX() + deltaX, e.getY() + deltaY ); divider = current.validateDivider( divider ); repaint( bounds.x, bounds.y, bounds.width, bounds.height ); bounds = current.getDividerBounds( divider, bounds ); repaint( bounds.x, bounds.y, bounds.width, bounds.height ); if( station.isContinousDisplay() && current != null ) { setDivider( current, divider ); station.updateBounds(); } } } }
/** * Removes all children from this station.<br> * Note: clients may need to invoke {@link DockController#freezeLayout()} * and {@link DockController#meltLayout()} to ensure noone else adds or * removes <code>Dockable</code>s. */ public void removeAllDockables(){ DockController controller = getController(); try { access.arm(); DockUtilities.checkLayoutLocked(); if( controller != null ) controller.freezeLayout(); for( int i = getDockableCount() - 1; i >= 0; i-- ) removeDisplayer(i, null); root().setChild(null); } finally { if( controller != null ) controller.meltLayout(); access.fire(); } }
public PutInfo prepareDrop( SplitDockStation station, StationDropItem item ){ if( station.isFullScreen() ) return null; if( station.getDockableCount() == 0 ){ PutInfo putInfo = new PutInfo( null, PutInfo.Put.CENTER, item.getDockable(), true ); putInfo = validatePutInfo( station, putInfo ); return putInfo; } else{ Point point = new Point( item.getMouseX(), item.getMouseY() ); SwingUtilities.convertPointFromScreen( point, station ); PutInfo putInfo = station.getRoot().getPut( point.x, point.y, item.getDockable() ); if( putInfo == null && station.isAllowSideSnap() ){ putInfo = calculateSideSnap( station, point.x, point.y, null, item.getDockable() ); putInfo = validatePutInfo( station, putInfo ); } if( putInfo != null ){ putInfo.setDockable( item.getDockable() ); calculateDivider( station, putInfo, null, item ); } return putInfo; } }
public Dockable[] getMaximized(){ Dockable dockable = getStation().getFullScreen(); if( dockable == null ){ return null; } return new Dockable[]{ dockable }; }