@SuppressWarnings("unchecked") public PredefinedLayout getLayout( DockElement element, Map<Dockable, Integer> children ) { if( shouldLayout( element )){ String factoryId = UNKNOWN + PredefinedDockSituation.super.getID( element ); DockFactory<DockElement,?,Object> factory = (DockFactory<DockElement,?,Object>)getFactory( factoryId ); if( factory == null ) throw new IllegalStateException( "Missing factory: " + factoryId ); Object data = factory.getLayout( element, children ); DockLayout<Object> layout = new DockLayout<Object>( factoryId, data ); return new PredefinedLayout( elementToString.get( element ), new DockLayoutInfo( layout )); } else{ return new PredefinedLayout( elementToString.get( element ), new DockLayoutInfo() ); } }
@SuppressWarnings("unchecked") public PredefinedLayout getLayout( DockElement element, Map<Dockable, Integer> children ) { if( shouldLayout( element )){ String factoryId = UNKNOWN + PredefinedDockSituation.super.getID( element ); DockFactory<DockElement,?,Object> factory = (DockFactory<DockElement,?,Object>)getFactory( factoryId ); if( factory == null ) throw new IllegalStateException( "Missing factory: " + factoryId ); Object data = factory.getLayout( element, children ); DockLayout<Object> layout = new DockLayout<Object>( factoryId, data ); return new PredefinedLayout( elementToString.get( element ), new DockLayoutInfo( layout )); } else{ return new PredefinedLayout( elementToString.get( element ), new DockLayoutInfo() ); } }
@Override protected DockLayoutInfo fillMissing( DockLayoutInfo info ) { DockLayout<?> layout = info.getDataLayout(); if( KNOWN.equals( layout.getFactoryID() )){ PredefinedLayout preloaded = (PredefinedLayout)layout.getData(); DockLayoutInfo delegate = preloaded.getDelegate(); DockLayoutInfo newDelegate = null; if( delegate.getKind() == DockLayoutInfo.Data.BYTE ){ newDelegate = fillMissingStream( preloaded ); } else if( delegate.getKind() == DockLayoutInfo.Data.XML ){ newDelegate = fillMissingXML( preloaded ); } if( newDelegate != null ){ info = new DockLayoutInfo( new DockLayout<PredefinedLayout>( KNOWN, new PredefinedLayout( preloaded.getPredefined(), newDelegate ))); } } return info; }
@Override protected DockLayoutInfo fillMissing( DockLayoutInfo info ) { DockLayout<?> layout = info.getDataLayout(); if( KNOWN.equals( layout.getFactoryID() )){ PredefinedLayout preloaded = (PredefinedLayout)layout.getData(); DockLayoutInfo delegate = preloaded.getDelegate(); DockLayoutInfo newDelegate = null; if( delegate.getKind() == DockLayoutInfo.Data.BYTE ){ newDelegate = fillMissingStream( preloaded ); } else if( delegate.getKind() == DockLayoutInfo.Data.XML ){ newDelegate = fillMissingXML( preloaded ); } if( newDelegate != null ){ info = new DockLayoutInfo( new DockLayout<PredefinedLayout>( KNOWN, new PredefinedLayout( preloaded.getPredefined(), newDelegate ))); } } return info; }
@SuppressWarnings("unchecked") public PredefinedLayout getPerspectiveLayout( PerspectiveElement element, Map<PerspectiveDockable, Integer> children ){ if( perspective == null ){ throw new IllegalStateException( "the perspective of this factory is not set, meaning this factory cannot be used handling perspective dependent tasks" ); } DockLayoutInfo info; if( shouldLayout( element, perspective )){ String factoryId = UNKNOWN + PredefinedDockSituation.super.getID( element ); DockFactory factory = getFactory( factoryId ); if( factory == null ) throw new IllegalStateException( "Missing factory: " + factoryId ); Object data = factory.getPerspectiveLayout( element, children ); DockLayout<Object> layout = new DockLayout<Object>( factoryId, data ); info = new DockLayoutInfo( layout ); } else{ info = new DockLayoutInfo(); } String key = perspective.get( element ); if( key == null ){ throw new IllegalStateException( "Expected a key for an element, the element should be known to the perspective, otherwise this method would not have been called: '" + element +"'" ); } return new PredefinedLayout( key, info ); }
@SuppressWarnings("unchecked") public PredefinedLayout getPerspectiveLayout( PerspectiveElement element, Map<PerspectiveDockable, Integer> children ){ if( perspective == null ){ throw new IllegalStateException( "the perspective of this factory is not set, meaning this factory cannot be used handling perspective dependent tasks" ); } DockLayoutInfo info; if( shouldLayout( element, perspective )){ String factoryId = UNKNOWN + PredefinedDockSituation.super.getID( element ); DockFactory factory = getFactory( factoryId ); if( factory == null ) throw new IllegalStateException( "Missing factory: " + factoryId ); Object data = factory.getPerspectiveLayout( element, children ); DockLayout<Object> layout = new DockLayout<Object>( factoryId, data ); info = new DockLayoutInfo( layout ); } else{ info = new DockLayoutInfo(); } String key = perspective.get( element ); if( key == null ){ throw new IllegalStateException( "Expected a key for an element, the element should be known to the perspective, otherwise this method would not have been called: '" + element +"'" ); } return new PredefinedLayout( key, info ); }
return null; return new PredefinedLayout( preloaded, info );
return null; return new PredefinedLayout( preloaded, info );
return new PredefinedLayout( preload, new DockLayoutInfo() ); return new PredefinedLayout( preload, new DockLayoutInfo( xdelegate )); return new PredefinedLayout( preload, new DockLayoutInfo( layout ) );
return new PredefinedLayout( preload, new DockLayoutInfo() ); return new PredefinedLayout( preload, new DockLayoutInfo( xdelegate )); return new PredefinedLayout( preload, new DockLayoutInfo( layout ) );