Class CustomMediaFactory

java.lang.Object
org.csstudio.ui.util.CustomMediaFactory

public class CustomMediaFactory extends Object
A factory, which provides convinience methods for the creation of Images and Fonts. All resources created via this factory get automatically disposed, when the application is stopped.
  • Field Details

    • COLOR_LIGHT_BLUE

      public static final RGB COLOR_LIGHT_BLUE
    • COLOR_BLUE

      public static final RGB COLOR_BLUE
    • COLOR_WHITE

      public static final RGB COLOR_WHITE
    • COLOR_GRAY

      public static final RGB COLOR_GRAY
    • COLOR_DARK_GRAY

      public static final RGB COLOR_DARK_GRAY
    • COLOR_BLACK

      public static final RGB COLOR_BLACK
    • COLOR_RED

      public static final RGB COLOR_RED
    • COLOR_GREEN

      public static final RGB COLOR_GREEN
    • COLOR_YELLOW

      public static final RGB COLOR_YELLOW
    • COLOR_PINK

      public static final RGB COLOR_PINK
    • COLOR_CYAN

      public static final RGB COLOR_CYAN
    • COLOR_ORANGE

      public static final RGB COLOR_ORANGE
    • COLOR_PURPLE

      public static final RGB COLOR_PURPLE
    • COLOR_X11_PURPLE

      public static final RGB COLOR_X11_PURPLE
    • FONT_ARIAL

      public static final FontData FONT_ARIAL
      the font Arial in height of 9
  • Method Details

    • getInstance

      public static CustomMediaFactory getInstance()
    • getColor

      public Color getColor(int r, int g, int b)
      Create the Color for the given color information.
    • getColor

      public Color getColor(RGB rgb)
      Create the Color for the given RGB.
    • getFont

      public Font getFont(String name, int height, int style)
      Create the Font for the given information.
    • getFont

      public Font getFont(FontData[] fontData)
      Create the Font for the given FontData.
    • getFont

      public Font getFont(FontData[] fontData, int style)
      Create the Font for the given FontData and the given style code.
    • getFont

      public Font getFont(FontData fontData)
      Create the Font for the given FontData and the given style code.
    • getDefaultFont

      public Font getDefaultFont(int style)
      Return the system's default font.
      Parameters:
      style - additional styles, e.g. SWT.Bold
      Returns:
      The system's default font.
    • getImageFromPlugin

      public Image getImageFromPlugin(String pluginId, String relativePath)
      Load the Image from the given path in the given plugin.
      Parameters:
      pluginId - The id of the plugin that contains the requested image.
      relativePath - The resource path of the requested image.
      Returns:
      The Image from the given path in the given plugin.
    • getImageFromPlugin

      public Image getImageFromPlugin(Plugin plugin, String pluginId, String relativePath)
      Load the Image from the given path in the given plugin. Usually, this is the image found via the the given plug-in relative path. But this implementation also supports a hack for testing: If no plugin is running, because for example this is an SWT-only test, the path is used as is, i.e. relative to the current directory.
      Parameters:
      plugin - The plugin that contains the requested image.
      pluginId - The id of the plugin.
      relativePath - The image's relative path to the root of the plugin.
      Returns:
      The Image from the given path in the given plugin.
    • getImageDescriptorFromPlugin

      public ImageDescriptor getImageDescriptorFromPlugin(String pluginId, String relativePath)
      Load the ImageDescriptor from the given path in the given plugin.
      Parameters:
      pluginId - The id of the plugin that contains the requested image.
      relativePath - The resource path of the requested image.
      Returns:
      The ImageDescriptor from the given path in the given plugin.