gov.nasa.gsfc.drl.rtstps.viewer.bulbs
Class Bulb

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.viewer.bulbs.Bulb

 class Bulb
extends java.lang.Object

This class represents a bulb icon and a label that could be displayed in a bulb gadget. It loads bulb images.

I have cached the image icons in a static map so that I don't waste time and resources loading them multiple times. I defer creating an ImageIcon until someone actually demands it.

Bulb colors are passes as lowercase text string ("red","green", etc). This class then loads the image file, which it expects to find in the images directory. The file name must have the form:
colorTextString + "Bulb.gif"

This class is an AbstractBulbGadget utility. It exists primarily to provide a value object in a map.


Field Summary
private  javax.swing.ImageIcon icon
          The image icon for this bulb color.
private static java.util.Map<java.lang.String,javax.swing.ImageIcon> imageMap
          This is a static map of bulb images, (String,ImageIcon).
private  java.lang.String label
          The label that accompanies the icon.
 
Constructor Summary
Bulb(java.lang.String color, java.lang.String label)
          Create a bulb.
 
Method Summary
private  boolean createImageIcon(java.lang.String color)
           
(package private)  javax.swing.ImageIcon getIcon()
          Get the icon.
(package private)  java.lang.String getLabel()
          Get the label.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageMap

private static java.util.Map<java.lang.String,javax.swing.ImageIcon> imageMap
This is a static map of bulb images, (String,ImageIcon). I store them here so that I only have to load them once.


icon

private javax.swing.ImageIcon icon
The image icon for this bulb color.


label

private java.lang.String label
The label that accompanies the icon. It is NOT the bulb color.

Constructor Detail

Bulb

Bulb(java.lang.String color,
     java.lang.String label)
Create a bulb.

Parameters:
color - A color such as "red", "yellow", "green", and "gray"
label - A label that is printed next to the bulb
Method Detail

getIcon

final javax.swing.ImageIcon getIcon()
Get the icon.


getLabel

final java.lang.String getLabel()
Get the label. It may be null.


createImageIcon

private boolean createImageIcon(java.lang.String color)