Class ResourcePool
- java.lang.Object
-
- org.eclipse.nebula.paperclips.core.internal.util.ResourcePool
-
public class ResourcePool extends java.lang.Object
Manages a pool of graphics resources for a graphics device (fonts, colors).
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<org.eclipse.swt.graphics.RGB,org.eclipse.swt.graphics.Color>
colors
private org.eclipse.swt.graphics.Device
device
private static java.util.Map<org.eclipse.swt.graphics.Device,ResourcePool>
devices
private java.util.Map<org.eclipse.swt.graphics.FontData,org.eclipse.swt.graphics.Font>
fonts
-
Constructor Summary
Constructors Modifier Constructor Description private
ResourcePool(org.eclipse.swt.graphics.Device device)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ResourcePool
forDevice(org.eclipse.swt.graphics.Device device)
Returns a SharedGraphics which creates resources on the given device.org.eclipse.swt.graphics.Color
getColor(org.eclipse.swt.graphics.RGB rgb)
Returns a color for the passed in RGB.org.eclipse.swt.graphics.Font
getFont(org.eclipse.swt.graphics.FontData fontData)
Returns a font for the passed in FontData.private static void
notDisposed(org.eclipse.swt.graphics.Device device)
-
-
-
Field Detail
-
devices
private static java.util.Map<org.eclipse.swt.graphics.Device,ResourcePool> devices
-
device
private final org.eclipse.swt.graphics.Device device
-
fonts
private final java.util.Map<org.eclipse.swt.graphics.FontData,org.eclipse.swt.graphics.Font> fonts
-
colors
private final java.util.Map<org.eclipse.swt.graphics.RGB,org.eclipse.swt.graphics.Color> colors
-
-
Method Detail
-
forDevice
public static ResourcePool forDevice(org.eclipse.swt.graphics.Device device)
Returns a SharedGraphics which creates resources on the given device.- Parameters:
device
- the device which resources will be created on.- Returns:
- a SharedGraphics which creates resources on the given device.
-
notDisposed
private static void notDisposed(org.eclipse.swt.graphics.Device device)
-
getFont
public org.eclipse.swt.graphics.Font getFont(org.eclipse.swt.graphics.FontData fontData)
Returns a font for the passed in FontData.- Parameters:
fontData
- FontData describing the required font.- Returns:
- a font for the passed in FontData.
-
getColor
public org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.graphics.RGB rgb)
Returns a color for the passed in RGB.- Parameters:
rgb
- RGB describing the required color.- Returns:
- a color for the passed in RGB.
-
-