/** * Gets the {@link FontModifier} which is currently represented by this {@link DockFont}. * @return the modifier, can be <code>null</code> */ public FontModifier font(){ return value(); }
/** * Removes a font from this title. * @param font the font to remove */ protected void removeFont( AbstractDockFont font ){ fonts.remove( font ); font.connect( null ); }
/** * 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 ); } } }
@Override protected void update( CDockable dockable, String key, FontModifier value ) { if( isObservedMapKey( key )){ for( String check : keys ){ set( check, get( manager.get( check ), check, dockable ), dockable ); } } }
/** * Makes sure that this {@link DockFont} reads its values from the * {@link FontManager} of <code>controller</code>.<br> * Use {@link #setManager(bibliothek.gui.dock.util.UIProperties) setManager(null)} to disconnect. * @param controller the new source for fonts, can be <code>null</code> */ public void connect( DockController controller ){ setManager( controller == null ? null : controller.getFonts() ); }
/** * Sets the font which should be used for <code>key</code>. * @param key the key of the font * @param font the new font, can be <code>null</code> */ public void setFont( String key, Font font ){ if( font == null ) setFont( key, (FontModifier)null ); else setFont( key, new ConstantFontModifier( font ) ); }
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 Font modify( Font font ) { int flags = 0; if( font.isBold() ) flags |= Font.BOLD; if( font.isItalic() ) flags |= Font.ITALIC; int newFlags = modify( flags, Font.ITALIC, italic ); newFlags = modify( newFlags, Font.BOLD, bold ); float size = this.size; if( sizeDelta ) size += font.getSize(); return font.deriveFont( newFlags, size ); }
private void updateFont(){ try{ onFontUpdate = true; component.setFont( original ); Font base = component.getFont(); Font modified; if( base == null || modifier == null ){ modified = original; } else{ modified = modifier.modify( base ); } component.setFont( modified ); } finally{ onFontUpdate = false; } } }
/** * 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 ); } } }
/** * Removes a font from this title. * @param font the font to remove */ protected void removeFont( AbstractDockFont font ){ fonts.remove( font ); font.connect( null ); }
/** * Gets the {@link FontModifier} which is currently represented by this {@link DockFont}. * @return the modifier, can be <code>null</code> */ public FontModifier font(){ return value(); }
@Override protected void update( CDockable dockable, String key, FontModifier value ) { if( isObservedMapKey( key )){ for( String check : keys ){ set( check, get( manager.get( check ), check, dockable ), dockable ); } } }
/** * Makes sure that this {@link DockFont} reads its values from the * {@link FontManager} of <code>controller</code>.<br> * Use {@link #setManager(bibliothek.gui.dock.util.UIProperties) setManager(null)} to disconnect. * @param controller the new source for fonts, can be <code>null</code> */ public void connect( DockController controller ){ setManager( controller == null ? null : controller.getFonts() ); }
/** * Sets the font which should be used for <code>key</code>. * @param key the key of the font * @param font the new font, can be <code>null</code> */ public void setFont( String key, Font font ){ if( font == null ) setFont( key, (FontModifier)null ); else setFont( key, new ConstantFontModifier( font ) ); }
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; }
/** * Adds a font to the list of fonts, this title will ensure that * <code>font</code> gets connected to a {@link FontManager} as soon * as this title is bound. * @param font the new font */ protected void addFont( AbstractDockFont font ){ fonts.add( font ); if( bound ){ font.connect( getDockable().getController() ); } }
/** * Adds a font to the list of fonts, this title will ensure that * <code>font</code> gets connected to a {@link FontManager} as soon * as this title is bound. * @param font the new font */ protected void addFont( AbstractDockFont font ){ fonts.add( font ); if( bound ){ font.connect( getDockable().getController() ); } }