com.tensegrity.gui.swt
Class SwtColorRegistry

java.lang.Object
  extended byorg.eclipse.jface.resource.ResourceRegistry
      extended byorg.eclipse.jface.resource.ColorRegistry
          extended bycom.tensegrity.gui.swt.SwtColorRegistry

public class SwtColorRegistry
extends org.eclipse.jface.resource.ColorRegistry

This is the main class for administing colors within the SWT package. Every class which has to keep references to SWT Color objects, should use this class.

Right now we extend the ColorRegistry class provided by jface. Since this class does not provide a method for removing colors, we probably have to write our own registry class if memory consumption becomes a big problem.

Version:
$Id: SwtColorRegistry.java,v 1.2 2005/06/07 09:48:31 ArndHouben Exp $
Author:
Arnd Houben

Field Summary
 
Fields inherited from class org.eclipse.jface.resource.ColorRegistry
display, displayRunnable
 
Method Summary
 boolean contains(org.eclipse.swt.graphics.RGB color)
          Checks if the specified color is already known
 org.eclipse.swt.graphics.Color get(org.eclipse.swt.graphics.RGB color)
          Returns a Color instance corresponding to the given RGB object, or null, if the registry doesn't have one
static SwtColorRegistry getInstance()
          Returns the used SwtColorRegistry instance.
 java.lang.String getKeyFor(org.eclipse.swt.graphics.RGB color)
          Returns a key for the specified color
 java.lang.String put(org.eclipse.swt.graphics.RGB color)
          Adds the specified color to the registry and returns a generate key
 
Methods inherited from class org.eclipse.jface.resource.ColorRegistry
clearCaches, get, getKeySet, getRGB, hasValueFor, put
 
Methods inherited from class org.eclipse.jface.resource.ResourceRegistry
addListener, fireMappingChanged, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static final SwtColorRegistry getInstance()
Returns the used SwtColorRegistry instance.

Returns:
the SwtColorRegistry which should be used

put

public final java.lang.String put(org.eclipse.swt.graphics.RGB color)
Adds the specified color to the registry and returns a generate key

Parameters:
color - an RGB instance which describes this color
Returns:
a key for retrieving the color back

get

public final org.eclipse.swt.graphics.Color get(org.eclipse.swt.graphics.RGB color)
Returns a Color instance corresponding to the given RGB object, or null, if the registry doesn't have one

Parameters:
color - an RGB object to create the color from
Returns:
a Color instance, or null if the registry doesn't have one

getKeyFor

public final java.lang.String getKeyFor(org.eclipse.swt.graphics.RGB color)
Returns a key for the specified color

Parameters:
color - RGB instance to create a key for
Returns:
a key to identify the given color

contains

public final boolean contains(org.eclipse.swt.graphics.RGB color)
Checks if the specified color is already known

Parameters:
color - a RGB instance
Returns:
true if this registry contains the given color, false otherwise


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.