/** * Creates an array around <code>dockable</code>. * @param dockable the element that should be put into an array * @return the array of length 1 */ public D[] array( D dockable ){ D[] array = array( 1 ); array[0] = dockable; return array; }
/** * Creates an array around <code>dockable</code>. * @param dockable the element that should be put into an array * @return the array of length 1 */ public D[] array( D dockable ){ D[] array = array( 1 ); array[0] = dockable; return array; }
/** * Gets a list of all {@link Dockable}s that are known to this tree. * @return the list of elements */ public D[] getDockables(){ return dockables.toArray( array( dockables.size() ) ); }
/** * Gets a list of all {@link Dockable}s that are known to this tree. * @return the list of elements */ public D[] getDockables(){ return dockables.toArray( array( dockables.size() ) ); }
/** * Creates a key for the leaf <code>dockable</code>. * @param dockable the element for which a key is requested * @param nodeId the unique identifier for this node, can be -1 * @return the new key */ public Key put( D dockable, long nodeId ){ D[] array = array( 1 ); array[0] = dockable; return put( array, null, nodeId ); }
/** * Sets <code>dockable</code> as root, and returns a key to the root. * @param dockable the new root * @return the key to the root */ public Key root( D dockable ){ root = put( array( dockable )); return root; }
/** * Sets <code>dockable</code> as root, and returns a key to the root. * @param dockable the new root * @return the key to the root */ public Key root( D dockable ){ root = put( array( dockable )); return root; }
/** * Creates a key for the leaf <code>dockable</code>. * @param dockable the element for which a key is requested * @param nodeId the unique identifier for this node, can be -1 * @return the new key */ public Key put( D dockable, long nodeId ){ D[] array = array( 1 ); array[0] = dockable; return put( array, null, nodeId ); }
/** * Adds two elements vertically. * @param top the top element * @param bottom the bottom element * @param divider how much space the first element gets in respect * to the second element. Must be between 0 and 1. * @return a key of the combination of the two elements */ public Key vertical( D top, D bottom, double divider ){ return vertical( put( array( top ) ), put( array( bottom ) ), divider ); }
/** * Adds two elements horizontally. * @param left the left element * @param right the right element * @param divider how much space the first element gets in respect * to the second element. Must be between 0 and 1. * @return a key of the combination of the two elements */ public Key horizontal( D left, D right, double divider ){ return horizontal( put( array( left ) ), put( array( right ) ), divider ); }
/** * Adds two elements horizontally. * @param left the left element * @param right the right element * @param divider how much space the first element gets in respect * to the second element. Must be between 0 and 1. * @return a key of the combination of the two elements */ public Key horizontal( D left, D right, double divider ){ return horizontal( put( array( left ) ), put( array( right ) ), divider ); }
/** * Adds two elements vertically. * @param top the top element * @param bottom the bottom element * @param divider how much space the first element gets in respect * to the second element. Must be between 0 and 1. * @return a key of the combination of the two elements */ public Key vertical( D top, D bottom, double divider ){ return vertical( put( array( top ) ), put( array( bottom ) ), divider ); }
/** * Transforms a leaf of a {@link SplitDockStationLayout} into a key * of a {@link SplitDockTree}. * @param leaf the element to transform * @param tree the tree into which to add new keys * @param children the set of known children * @return the key or <code>null</code> */ private <D> SplitDockTree<D>.Key handleLeaf( SplitDockStationLayout.Leaf leaf, SplitDockTree<D> tree, Map<Integer, D> children ){ D dockable = children.get( leaf.getId() ); Path[] placeholders = leaf.getPlaceholders(); PlaceholderMap placeholderMap = leaf.getPlaceholderMap(); if( dockable != null ){ return tree.put( tree.array( dockable ), null, placeholders, placeholderMap, leaf.getNodeId() ); } else if( placeholders != null && placeholders.length > 0 ){ return tree.put( tree.array( 0 ), null, placeholders, placeholderMap, leaf.getNodeId() ); } return null; }