public DockLayoutInfo getSubChild( int childIndex, int subChildIndex ){ return root.children.get( childIndex ).leafs.get( subChildIndex ).composition.getLayout(); }
public DockableProperty validLocation(){ DockableProperty location = composition.getLayout().getLocation(); if( location != oldLocation ){ return location; } return null; } }
public DockLayoutInfo getChild( int childIndex ){ if( childIndex < 0 || childIndex >= getChildCount() ){ return null; } return root.children.get( childIndex ).composition.getLayout(); }
/** * Tries to guess the location of the elements stored in the tree * below <code>composition</code>. Invoking this method is the same as calling * <code>guessLocation( composition, composition.getLayout().getLocation() );</code>. * @param composition the composition whose location will be determined */ public void estimateLocations( DockLayoutComposition composition ){ estimateLocations( composition, composition.getLayout().getLocation() ); }
public void prepare(){ if( valid ){ oldLocation = composition.getLayout().getLocation(); for( Node child : children ){ child.prepare(); } } }
/** * Lists for all keys that can be found in <code>composition</code> its * estimated location.<br> * Note: This method will call {@link #estimateLocations(DockLayoutComposition)} * to get the most recent locations * @param composition some composition to search for keys and locations * @param missingOnly if set, then only locations of keys for which * no {@link DockLayout} is set are reported. This are the keys which most * likely will be ignored when calling {@link #convert(DockLayoutComposition)} * @return the map of keys and positions, might be empty */ public Map<String, DockableProperty> listEstimatedLocations( DockLayoutComposition composition, boolean missingOnly ){ return listEstimatedLocations( composition, composition.getLayout().getLocation(), missingOnly ); }
/** * Lists for all keys that can be found in <code>composition</code> its * estimated location.<br> * Note: This method will call {@link #estimateLocations(DockLayoutComposition)} * to get the most recent locations * @param composition some composition to search for keys and locations * @param missingOnly if set, then only locations of keys for which * no {@link DockLayout} is set are reported. This are the keys which most * likely will be ignored when calling {@link #convert(DockLayoutComposition)} * @return the map of keys and positions, might be empty */ public Map<String, DockableProperty> listEstimatedLocations( DockLayoutComposition composition, boolean missingOnly ){ return listEstimatedLocations( composition, composition.getLayout().getLocation(), missingOnly ); }
@Override public String getIdentifier( DockLayoutComposition composition ){ DockLayout<?> layout = composition.getLayout().getDataLayout(); if( layout != null && layout.getFactoryID().equals( KNOWN )){ PredefinedLayout predefined = (PredefinedLayout) layout.getData(); return predefined.getPredefined(); } return null; }
@Override public String getIdentifier( DockLayoutComposition composition ){ DockLayout<?> layout = composition.getLayout().getDataLayout(); if( layout != null && layout.getFactoryID().equals( KNOWN )){ PredefinedLayout predefined = (PredefinedLayout) layout.getData(); return predefined.getPredefined(); } return null; }
private void listEstimatedLocations( DockLayoutComposition composition, boolean missingOnly, Map<String, DockableProperty> map ){ DockableProperty location = composition.getLayout().getLocation(); if( location != null ){ String key = getKey( composition, missingOnly ); if( key != null){ map.put( key, location ); } } List<DockLayoutComposition> children = composition.getChildren(); if( children != null ){ for( DockLayoutComposition child : children ){ listEstimatedLocations( child, missingOnly, map ); } } }
private void listEstimatedLocations( DockLayoutComposition composition, boolean missingOnly, Map<String, DockableProperty> map ){ DockableProperty location = composition.getLayout().getLocation(); if( location != null ){ String key = getKey( composition, missingOnly ); if( key != null){ map.put( key, location ); } } List<DockLayoutComposition> children = composition.getChildren(); if( children != null ){ for( DockLayoutComposition child : children ){ listEstimatedLocations( child, missingOnly, map ); } } }
private void findVisible( Set<Dockable> visible, DockLayoutComposition layout ){ DockLayoutInfo info = layout.getLayout(); if( info != null ){ DockLayout<?> data = info.getDataLayout(); if( data != null ){ if( REPLACEMENT_FACTORY_ID.equals( data.getFactoryID() )){ CDockable dockable = (CDockable)data.getData(); visible.add( dockable.intern() ); } } } for( DockLayoutComposition child : layout.getChildren() ){ findVisible( visible, child ); } }
private void findVisible( Set<Dockable> visible, DockLayoutComposition layout ){ DockLayoutInfo info = layout.getLayout(); if( info != null ){ DockLayout<?> data = info.getDataLayout(); if( data != null ){ if( REPLACEMENT_FACTORY_ID.equals( data.getFactoryID() )){ CDockable dockable = (CDockable)data.getData(); visible.add( dockable.intern() ); } } } for( DockLayoutComposition child : layout.getChildren() ){ findVisible( visible, child ); } }
private void appendFirstOnEstimate( DockLayoutComposition composition, DockableProperty location ){ DockLayoutInfo info = composition.getLayout(); DockableProperty property = info.getLocation(); if( property != null ){ info.setLocation( DockUtilities.append( property, location ) ); } for( DockLayoutComposition child : composition.getChildren() ){ appendFirstOnEstimate( child, location ); } }
public void finish( DockableProperty newParentLocation ){ if( valid ){ DockableProperty newLeafLocation = validLocation(); if( newLeafLocation == null && newParentLocation != null ){ newLeafLocation = newParentLocation.copy(); } if( newLeafLocation != null ){ newLeafLocation.setSuccessor( oldLocation ); composition.getLayout().setLocation( newLeafLocation ); } else{ invalidate(); } } }
/** * Gets the name of element which is represented by <code>composition</code>. * @param composition the composition whose element key is searched * @param missingOnly if set, then the key will only be returned if <code>composition</code> * is not fully loaded * @return the key or <code>null</code> */ private String getKey( DockLayoutComposition composition, boolean missingOnly ){ DockLayoutInfo layout = composition.getLayout(); if( layout.getKind() != DockLayoutInfo.Data.DOCK_LAYOUT ) return null; if( !KNOWN.equals( layout.getDataLayout().getFactoryID() )) return null; PredefinedLayout preloaded = (PredefinedLayout)layout.getDataLayout().getData(); if( missingOnly && preloaded.getDelegate().getKind() == DockLayoutInfo.Data.DOCK_LAYOUT ){ // if there is such a Dockable registered then it is not missing... if( stringToElement.containsKey( preloaded.getPredefined() )){ return null; } } String key = preloaded.getPredefined(); return key; }
/** * Gets the name of element which is represented by <code>composition</code>. * @param composition the composition whose element key is searched * @param missingOnly if set, then the key will only be returned if <code>composition</code> * is not fully loaded * @return the key or <code>null</code> */ private String getKey( DockLayoutComposition composition, boolean missingOnly ){ DockLayoutInfo layout = composition.getLayout(); if( layout.getKind() != DockLayoutInfo.Data.DOCK_LAYOUT ) return null; if( !KNOWN.equals( layout.getDataLayout().getFactoryID() )) return null; PredefinedLayout preloaded = (PredefinedLayout)layout.getDataLayout().getData(); if( missingOnly && preloaded.getDelegate().getKind() == DockLayoutInfo.Data.DOCK_LAYOUT ){ // if there is such a Dockable registered then it is not missing... if( stringToElement.containsKey( preloaded.getPredefined() )){ return null; } } String key = preloaded.getPredefined(); return key; }
DockLayoutInfo info = composition.getLayout(); if( info != null ){ DockLayout<?> layout = info.getDataLayout();
DockLayoutInfo info = composition.getLayout(); if( info != null ){ DockLayout<?> layout = info.getDataLayout();
/** * Recursively tries to estimate the locations of all {@link DockLayoutInfo}s that can * be found in <code>map</code>.<br> * <b>Note:</b> this method does <i>not</i> call {@link DefaultLocationEstimationMap#finish()}. * @param map the root of the tree for which locations need to be estimated */ @SuppressWarnings("unchecked") protected void estimateLocations( DefaultLocationEstimationMap map ){ DockLayoutComposition composition = map.getRoot(); List<DockLayoutComposition> children = composition.getChildren(); if( children == null || children.size() == 0 ){ return; } DockLayout<Object> layout = (DockLayout<Object>)composition.getLayout().getDataLayout(); if( layout == null ){ return; } DockFactory<DockElement,?,Object> factory = (DockFactory<DockElement,?,Object>)getFactory( layout.getFactoryID() ); if( factory == null ){ return; } for( int i = 0, n = map.getChildCount(); i<n; i++ ){ estimateLocations( map.subMap( i ) ); } map.prepare(); factory.estimateLocations( layout.getData(), map ); map.finish(); }