/** * 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(); } } }
public void setLocation( int childIndex, DockableProperty location ){ if( location != null ){ getChild( childIndex ).setLocation( location ); } }
@SuppressWarnings("unchecked") public void layoutPerspective( PerspectiveElement element, PredefinedLayout layout, Map<Integer, PerspectiveDockable> children ){ DockLayoutInfo delegate = layout.getDelegate(); if( delegate.getKind() == DockLayoutInfo.Data.DOCK_LAYOUT && shouldLayout( element, perspective )){ String factoryId = delegate.getDataLayout().getFactoryID(); DockFactory factory = getFactory( factoryId ); if( factory != null ){ factory.layoutPerspective( element, delegate.getDataLayout().getData(), children ); } } }
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(); } } }
@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 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 ); } }
/** * 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 ); }
public boolean equalsNoSuccessor( DockableProperty property ){ DockableProperty successor = this.successor; DockableProperty successorProperty = property.getSuccessor(); try{ this.successor = null; property.setSuccessor( null ); return equals( property ); } finally{ this.successor = successor; property.setSuccessor( successorProperty ); } }
public DockableProperty validLocation(){ DockableProperty location = composition.getLayout().getLocation(); if( location != oldLocation ){ return location; } return null; } }
public void setLocation( int childIndex, int subChildIndex, DockableProperty location ){ if( location != null ){ getSubChild( childIndex, subChildIndex ).setLocation( location ); } }
@Override public void setSuccessor( DockableProperty successor ){ super.setSuccessor( successor ); if( backup != null ){ backup.setSuccessor( successor ); } }
/** * Tells whether to ignore this element when saving. If an element is ignored, no * factory is needed for it. This implementation forwards * the call to the {@link DockSituationIgnore} of this situation. * @param element the element which might not be saved * @return <code>true</code> if the element should not be saved */ protected boolean ignoreElement( DockElement element ){ if( ignore == null ) return false; return ignore.ignoreElement( element ); }
/** * Gets the id of <code>factory</code>. The default behavior is just to * return {@link DockFactory#getID()}. Note that this method should be * a bijection to {@link #getAdjacentFactory(String)}. * @param factory the factory whose id is needed * @return the id of the factory */ protected String getAdjacentID( AdjacentDockFactory<?> factory ){ return factory.getID(); }
public boolean ignoreChildren( DockStation station ) { for( DockSituationIgnore ignore : ignores ){ if( !ignore.ignoreChildren( station )) return false; } return true; } public boolean ignoreChildren( PerspectiveStation station ){
@SuppressWarnings("unchecked") public void layoutPerspective( PerspectiveElement element, PredefinedLayout layout, Map<Integer, PerspectiveDockable> children ){ DockLayoutInfo delegate = layout.getDelegate(); if( delegate.getKind() == DockLayoutInfo.Data.DOCK_LAYOUT && shouldLayout( element, perspective )){ String factoryId = delegate.getDataLayout().getFactoryID(); DockFactory factory = getFactory( factoryId ); if( factory != null ){ factory.layoutPerspective( element, delegate.getDataLayout().getData(), children ); } } }
@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; }
/** * 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 ); }
@SuppressWarnings("unchecked") public void estimateLocations( PredefinedLayout layout, LocationEstimationMap children ){ DockLayoutInfo delegate = layout.getDelegate(); if( delegate.getKind() == DockLayoutInfo.Data.DOCK_LAYOUT ){ String factoryId = delegate.getDataLayout().getFactoryID(); DockFactory<DockElement,?,Object> factory = (DockFactory<DockElement,?,Object>)getFactory( factoryId ); if( factory != null ){ factory.estimateLocations( delegate.getDataLayout().getData(), children ); } } }
@SuppressWarnings("unchecked") public void estimateLocations( PredefinedLayout layout, LocationEstimationMap children ){ DockLayoutInfo delegate = layout.getDelegate(); if( delegate.getKind() == DockLayoutInfo.Data.DOCK_LAYOUT ){ String factoryId = delegate.getDataLayout().getFactoryID(); DockFactory<DockElement,?,Object> factory = (DockFactory<DockElement,?,Object>)getFactory( factoryId ); if( factory != null ){ factory.estimateLocations( delegate.getDataLayout().getData(), children ); } } }