Class FontMap

java.lang.Object
bibliothek.gui.dock.common.FontMap

public class FontMap extends Object
A map containing FontModifiers. Each FontMap is associated with exactly one CDockable. This map is used to set the font of various elements like titles or tabs. Changes in the map will immediately be forwarded and applied.
Author:
Benjamin Sigg
  • Field Details

    • FONT_KEY_TITLE

      public static final String FONT_KEY_TITLE
      key for font used in titles
      See Also:
    • FONT_KEY_TITLE_FOCUSED

      public static final String FONT_KEY_TITLE_FOCUSED
      key for font used in titles if the title is focused
      See Also:
    • FONT_KEY_MINIMIZED_BUTTON

      public static final String FONT_KEY_MINIMIZED_BUTTON
      key for font used on the button for a minimized dockable
      See Also:
    • FONT_KEY_MINIMIZED_BUTTON_FOCUSED

      public static final String FONT_KEY_MINIMIZED_BUTTON_FOCUSED
      key for font used on the focused button for a minimized dockable
      See Also:
    • FONT_KEY_TAB

      public static final String FONT_KEY_TAB
      key for font used on a tab
      See Also:
    • FONT_KEY_TAB_SELECTED

      public static final String FONT_KEY_TAB_SELECTED
      key for font used on a selected tab
      See Also:
    • FONT_KEY_TAB_FOCUSED

      public static final String FONT_KEY_TAB_FOCUSED
      key for font used on a focused tab
      See Also:
  • Constructor Details

    • FontMap

      public FontMap(CDockable dockable)
      Creates a new map
      Parameters:
      dockable - the owner of this map
  • Method Details

    • getDockable

      public CDockable getDockable()
      Gets the owner of this map.
      Returns:
      the owner
    • addListener

      public void addListener(FontMapListener listener)
      Adds a listener to this map.
      Parameters:
      listener - the new listener
    • removeListener

      public void removeListener(FontMapListener listener)
      Removes listener from this map.
      Parameters:
      listener - the listener to remove
    • getFont

      public FontModifier getFont(String key)
      Gets the font which is associated with key.
      Parameters:
      key - the key of the font
      Returns:
      the font or null
    • setFont

      public void setFont(String key, Font font)
      Sets the font which should be used for key.
      Parameters:
      key - the key of the font
      font - the new font, can be null
    • setFont

      public void setFont(String key, String... modifications)
      Tells to use a font that is derived from the original font of key. There are different modifications possible, all have to be supplied in the same form: key=value.
      Example: setFont( x, "i=!", "b=+", s=14" ); would create a modification that reverses the italic flag, sets any font to bold and creates only fonts of size 14
      • 'i': italic
        • '+': make the font italic
        • '-': make the font not italic
        • '!': reverse the italic property of the font
      • 'b': bold
        • '+': make the font bold
        • '-': make the font not bold
        • '!': reverse the bold property of the font
      • 's': size
        • '+number': increase the size by number
        • '-number': decrease the size by number
        • 'number': set the size to number
      Parameters:
      key - the key for the font
      modifications - a set of modifications
    • removeFont

      public void removeFont(String key)
      Ensures that the original font is used for key
      Parameters:
      key - the key which should no longer use a modified font
    • setFont

      public void setFont(String key, FontModifier font)
      Sets the font for key.
      Parameters:
      key - the key of the font
      font - the new value or null to set the default value