net.sf.freecol.common.resources
Class ChipResource

java.lang.Object
  extended by net.sf.freecol.common.resources.Resource
      extended by net.sf.freecol.common.resources.ChipResource

public class ChipResource
extends Resource

A Resource wrapping a "Chip", that is a small BufferedImage indicating the owner of a unit or mission, or the alarm of a native settlement. The URI is expected to look like this "urn:chip:mission:red:black", for example.

See Also:
Resource, Color

Field Summary
private  java.awt.Color background
          Describe background here.
private  java.awt.Color foreground
          Describe foreground here.
static int HEIGHT
           
private  java.awt.image.BufferedImage image
          Describe chip here.
private  java.util.Map<java.lang.Double,java.awt.Image> scaledImages
           
static java.lang.String SCHEME
           
private  java.lang.String type
          Describe type here.
static int WIDTH
           
 
Constructor Summary
private ChipResource(java.lang.String type, java.awt.Color bg, java.awt.Color fg)
           
(package private) ChipResource(java.net.URI resourceLocator)
          Do not use directly.
 
Method Summary
static ChipResource colorChip(java.awt.Color color)
           
private  void createAlarmChip(boolean visited)
           
private  void createColorChip()
           
private  void createMissionChip()
           
 java.awt.Color getBackground()
          Get the Background value.
 java.awt.Color getForeground()
          Get the Foreground value.
 java.awt.Image getImage()
          Get the Image value.
 java.awt.Image getImage(double scale)
           
 java.lang.String getType()
          Get the Type value.
static ChipResource missionChip(java.awt.Color color, boolean expert)
           
 void preload()
          Preloading is a noop for this resource type.
 void setBackground(java.awt.Color newBackground)
          Set the Background value.
 void setForeground(java.awt.Color newForeground)
          Set the Foreground value.
 
Methods inherited from class net.sf.freecol.common.resources.Resource
getResourceLocator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCHEME

public static final java.lang.String SCHEME
See Also:
Constant Field Values

WIDTH

public static final int WIDTH
See Also:
Constant Field Values

HEIGHT

public static final int HEIGHT
See Also:
Constant Field Values

foreground

private java.awt.Color foreground
Describe foreground here.


background

private java.awt.Color background
Describe background here.


image

private java.awt.image.BufferedImage image
Describe chip here.


type

private final java.lang.String type
Describe type here.


scaledImages

private java.util.Map<java.lang.Double,java.awt.Image> scaledImages
Constructor Detail

ChipResource

private ChipResource(java.lang.String type,
                     java.awt.Color bg,
                     java.awt.Color fg)

ChipResource

ChipResource(java.net.URI resourceLocator)
Do not use directly.

Parameters:
resourceLocator - The URI used when loading this resource.
See Also:
ResourceFactory.createResource(URI)
Method Detail

preload

public void preload()
Preloading is a noop for this resource type.

Specified by:
preload in class Resource

getForeground

public final java.awt.Color getForeground()
Get the Foreground value.

Returns:
a Color value

setForeground

public final void setForeground(java.awt.Color newForeground)
Set the Foreground value.

Parameters:
newForeground - The new Foreground value.

getBackground

public final java.awt.Color getBackground()
Get the Background value.

Returns:
a Color value

setBackground

public final void setBackground(java.awt.Color newBackground)
Set the Background value.

Parameters:
newBackground - The new Background value.

getType

public final java.lang.String getType()
Get the Type value.

Returns:
a String value

getImage

public final java.awt.Image getImage()
Get the Image value.

Returns:
a BufferedImage value

getImage

public final java.awt.Image getImage(double scale)

createColorChip

private void createColorChip()

createMissionChip

private void createMissionChip()

createAlarmChip

private void createAlarmChip(boolean visited)

colorChip

public static ChipResource colorChip(java.awt.Color color)

missionChip

public static ChipResource missionChip(java.awt.Color color,
                                       boolean expert)