/** * Gets a map containing some or all of the named layouts. * @param composition some composition to analyze * @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 layouts, might be empty */ public Map<String, DockLayoutComposition> listLayouts( DockLayoutComposition composition, boolean missingOnly ){ Map<String, DockLayoutComposition> map = new HashMap<String, DockLayoutComposition>(); listLayouts( composition, missingOnly, map ); return map; }
/** * Gets a map containing some or all of the named layouts. * @param composition some composition to analyze * @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 layouts, might be empty */ public Map<String, DockLayoutComposition> listLayouts( DockLayoutComposition composition, boolean missingOnly ){ Map<String, DockLayoutComposition> map = new HashMap<String, DockLayoutComposition>(); listLayouts( composition, missingOnly, map ); return map; }
/** * Tries to estimate the layouts 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, DockLayoutComposition> listLayouts( DockSituation situation, DockLayoutComposition layout ){ if( situation instanceof PredefinedDockSituation ){ Map<String, DockLayoutComposition> map = ((PredefinedDockSituation)situation).listLayouts( layout, true ); Map<String, DockLayoutComposition> result = new HashMap<String, DockLayoutComposition>(); for( Map.Entry<String, DockLayoutComposition> 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; }
private void listLayouts( DockLayoutComposition composition, boolean missingOnly, Map<String, DockLayoutComposition> map ){ String key = getKey( composition, missingOnly ); if( key != null){ map.put( key, composition ); } List<DockLayoutComposition> children = composition.getChildren(); if( children != null ){ for( DockLayoutComposition child : children ){ listLayouts( child, missingOnly, map ); } } }
private void listLayouts( DockLayoutComposition composition, boolean missingOnly, Map<String, DockLayoutComposition> map ){ String key = getKey( composition, missingOnly ); if( key != null){ map.put( key, composition ); } List<DockLayoutComposition> children = composition.getChildren(); if( children != null ){ for( DockLayoutComposition child : children ){ listLayouts( child, missingOnly, map ); } } }