/** * Tries to estimate the location of missing {@link Dockable}s. The * default implementation works with any {@link PredefinedDockSituation}. * @param situation the situation to use for transforming information * @param layout the layout to analyze * @return a map with <code>Dockable</code>-names as key or <code>null</code> */ protected Map<String, DockableProperty> listEstimateLocations( DockSituation situation, DockLayoutComposition layout ){ if( situation instanceof PredefinedDockSituation ){ Map<String, DockableProperty> map = ((PredefinedDockSituation)situation).listEstimatedLocations( layout, true ); Map<String, DockableProperty> result = new HashMap<String, DockableProperty>(); for( Map.Entry<String, DockableProperty> entry : map.entrySet() ){ String key = entry.getKey(); if( key.startsWith( DockFrontend.DOCKABLE_KEY_PREFIX )) result.put( key.substring( DockFrontend.DOCKABLE_KEY_PREFIX.length() ), entry.getValue() ); else if( key.startsWith( DockFrontend.ROOT_KEY_PREFIX )) result.put( key.substring( DockFrontend.ROOT_KEY_PREFIX.length() ), entry.getValue() ); else result.put( key, entry.getValue() ); } return result; } return null; }
/** * 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 location the location of <code>composition</code> itself * @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, DockableProperty location, boolean missingOnly ){ estimateLocations( composition, location ); Map<String, DockableProperty> map = new HashMap<String, DockableProperty>(); listEstimatedLocations( composition, missingOnly, map ); if( location != null ){ String key = getKey( composition, missingOnly ); if( key != null ){ map.put( key, location ); } } return map; }
/** * 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 ); }
/** * 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 location the location of <code>composition</code> itself * @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, DockableProperty location, boolean missingOnly ){ estimateLocations( composition, location ); Map<String, DockableProperty> map = new HashMap<String, DockableProperty>(); listEstimatedLocations( composition, missingOnly, map ); if( location != null ){ String key = getKey( composition, missingOnly ); if( key != null ){ map.put( key, location ); } } return 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 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 ); } } }