/** * Sets the {@link FontBridge} which should be used for a certain kind * of {@link DockFont}s. The bridges will be installed with priority * {@link Priority#DEFAULT} at all {@link FontManager}s. * @param kind the kind of {@link DockFont} the bridges will handle * @param factory the factory for new bridges, can be <code>null</code> */ public void putFontBridgeFactory( Path kind, FontBridgeFactory factory ){ fontBridgeFactories.put( kind, factory ); for( Controller setting : controllers ){ FontManager fonts = setting.controller.getFonts(); FontBridge oldBridge = setting.fonts.remove( kind ); FontBridge newBridge = factory == null ? null : factory.create( fonts ); if( newBridge == null ){ setting.fonts.remove( kind ); if( oldBridge != null ){ fonts.unpublish( Priority.DEFAULT, kind ); } } else{ setting.fonts.put( kind, newBridge ); fonts.publish( Priority.DEFAULT, kind, newBridge ); } } }
/** * Sets the {@link FontBridge} which should be used for a certain kind * of {@link DockFont}s. The bridges will be installed with priority * {@link Priority#DEFAULT} at all {@link FontManager}s. * @param kind the kind of {@link DockFont} the bridges will handle * @param factory the factory for new bridges, can be <code>null</code> */ public void putFontBridgeFactory( Path kind, FontBridgeFactory factory ){ fontBridgeFactories.put( kind, factory ); for( Controller setting : controllers ){ FontManager fonts = setting.controller.getFonts(); FontBridge oldBridge = setting.fonts.remove( kind ); FontBridge newBridge = factory == null ? null : factory.create( fonts ); if( newBridge == null ){ setting.fonts.remove( kind ); if( oldBridge != null ){ fonts.unpublish( Priority.DEFAULT, kind ); } } else{ setting.fonts.put( kind, newBridge ); fonts.publish( Priority.DEFAULT, kind, newBridge ); } } }
public void uninstall( DockController controller ) { delegate.uninstall( controller ); for( int i = 0, n = controllers.size(); i<n; i++ ){ Controller settings = controllers.get( i ); if( settings.controller == controller ){ controllers.remove( i-- ); n--; ColorManager colors = controller.getColors(); for( ColorBridge bridge : settings.colors.values() ){ colors.unpublish( Priority.DEFAULT, bridge ); } FontManager fonts = controller.getFonts(); for( FontBridge bridge : settings.fonts.values() ){ fonts.unpublish( Priority.DEFAULT, bridge ); } } } for( DockThemeExtension extension : extensions ){ extension.uninstall( controller, this ); } this.extensions = null; }
public void uninstall( DockController controller ) { delegate.uninstall( controller ); for( int i = 0, n = controllers.size(); i<n; i++ ){ Controller settings = controllers.get( i ); if( settings.controller == controller ){ controllers.remove( i-- ); n--; ColorManager colors = controller.getColors(); for( ColorBridge bridge : settings.colors.values() ){ colors.unpublish( Priority.DEFAULT, bridge ); } FontManager fonts = controller.getFonts(); for( FontBridge bridge : settings.fonts.values() ){ fonts.unpublish( Priority.DEFAULT, bridge ); } } } for( DockThemeExtension extension : extensions ){ extension.uninstall( controller, this ); } this.extensions = null; }