net.sf.freecol.client.gui.panel
Class ProductionMultiplesLabel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by net.sf.freecol.client.gui.panel.ProductionMultiplesLabel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public final class ProductionMultiplesLabel
extends javax.swing.JComponent

The ProductionLabel represents Goods that are produced in a WorkLocation or Settlement. It is similar to the GoodsLabel.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  boolean centered
          Whether the ProductionLabel should be centered.
private  int compressedWidth
          The compressed width of the ProductionLabel.
private  int displayNumber
          The smallest number to display above the goodsIcons.
private  boolean drawPlus
          Whether to display positive integers with a "+" sign.
private  javax.swing.ImageIcon[] goodsIcon
          The goodsIcon for this type of production.
private  GoodsType[] goodsType
          The type of goods being produced.
private static java.util.logging.Logger logger
           
private  int maxIcons
          The maximum number of goodsIcons to display.
private  int maximumProduction
          The amount of goods that could be produced.
private  Canvas parent
           
private  int[] production
          The amount of goods being produced.
private  int stockNumber
          The smallest number to display above the goodsIcons.
private  java.lang.String toolTipPrefix
          Describe toolTipPrefix here.
private  int totalProduction
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ProductionMultiplesLabel(java.util.List<AbstractGoods> goods, Canvas parent)
          Allow labels to include multiple goods.
 
Method Summary
 boolean drawPlus()
          Get the DrawPlus value.
 Canvas getCanvas()
          Returns the parent Canvas object.
 int getCompressedWidth()
          Get the CompressedWidth value.
 int getDisplayNumber()
          Get the DisplayNumber value.
 javax.swing.ImageIcon getGoodsIcon()
          Get the GoodsIcon value.
 int getMaxGoodsIcons()
          Get the MaxGoodsIcons value.
 int getMaximumIconHeight()
          Need to determine the tallest icon TODO: Why does this use the image instead of the Icon like width??
 int getMaximumIconWidth()
          Need to determine what the phatest icon is
 int getMaximumProduction()
          Get the MaximumProduction value.
 java.awt.Dimension getPreferredSize()
          Overrides the getPreferredSize method.
 int getPreferredWidth()
          Returns only the width component of the preferred size.
 int getProduction()
          Get the Production value.
 int getStockNumber()
          Get the stockNumber value.
 java.lang.String getToolTipPrefix()
          Get the ToolTipPrefix value.
 boolean isCentered()
          Get the Centered value.
 void paintComponent(java.awt.Graphics g)
          Paints this ProductionLabel.
 void setCentered(boolean newCentered)
          Set the Centered value.
 void setCompressedWidth(int newCompressedWidth)
          Set the CompressedWidth value.
 void setDisplayNumber(int newDisplayNumber)
          Set the DisplayNumber value.
 void setDrawPlus(boolean newDrawPlus)
          Set the DrawPlus value.
 void setGoodsIcon(javax.swing.ImageIcon newGoodsIcon)
          Set the GoodsIcon value.
 void setMaxGoodsIcons(int newMaxGoodsIcons)
          Set the MaxGoodsIcons value.
 void setMaximumProduction(int newMaximumProduction)
          Set the MaximumProduction value.
 void setProduction(int newProduction)
          Set the Production value.
 void setStockNumber(int newStockNumber)
          Set the stockNumber value.
 void setToolTipPrefix(java.lang.String newToolTipPrefix)
          Set the ToolTipPrefix value.
private  void updateToolTipText()
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

private static java.util.logging.Logger logger

parent

private final Canvas parent

maxIcons

private int maxIcons
The maximum number of goodsIcons to display.


drawPlus

private boolean drawPlus
Whether to display positive integers with a "+" sign.


centered

private boolean centered
Whether the ProductionLabel should be centered.


compressedWidth

private int compressedWidth
The compressed width of the ProductionLabel.


goodsType

private GoodsType[] goodsType
The type of goods being produced.


goodsIcon

private javax.swing.ImageIcon[] goodsIcon
The goodsIcon for this type of production. Indexes correlate with goodsType[].


production

private int[] production
The amount of goods being produced. Indexes correlate with goodsType[].


totalProduction

private int totalProduction

maximumProduction

private int maximumProduction
The amount of goods that could be produced.


displayNumber

private int displayNumber
The smallest number to display above the goodsIcons.


stockNumber

private int stockNumber
The smallest number to display above the goodsIcons. used to Show stored items in ReportColonyPanel


toolTipPrefix

private java.lang.String toolTipPrefix
Describe toolTipPrefix here.

Constructor Detail

ProductionMultiplesLabel

public ProductionMultiplesLabel(java.util.List<AbstractGoods> goods,
                                Canvas parent)
Allow labels to include multiple goods. This is especially useful for Food.

Parameters:
goods - The goods to display.
parent -
Method Detail

getToolTipPrefix

public java.lang.String getToolTipPrefix()
Get the ToolTipPrefix value.

Returns:
a String value

setToolTipPrefix

public void setToolTipPrefix(java.lang.String newToolTipPrefix)
Set the ToolTipPrefix value.

Parameters:
newToolTipPrefix - The new ToolTipPrefix value.

getCanvas

public Canvas getCanvas()
Returns the parent Canvas object.

Returns:
This ProductionLabel's Canvas.

getDisplayNumber

public int getDisplayNumber()
Get the DisplayNumber value.

Returns:
an int value

setDisplayNumber

public void setDisplayNumber(int newDisplayNumber)
Set the DisplayNumber value.

Parameters:
newDisplayNumber - The new DisplayNumber value.

getGoodsIcon

public javax.swing.ImageIcon getGoodsIcon()
Get the GoodsIcon value.

Returns:
an ImageIcon value

setGoodsIcon

public void setGoodsIcon(javax.swing.ImageIcon newGoodsIcon)
Set the GoodsIcon value.

Parameters:
newGoodsIcon - The new GoodsIcon value.

getProduction

public int getProduction()
Get the Production value.

Returns:
an int value

setProduction

public void setProduction(int newProduction)
Set the Production value.

Parameters:
newProduction - The new Production value.

updateToolTipText

private void updateToolTipText()

getMaximumProduction

public int getMaximumProduction()
Get the MaximumProduction value.

Returns:
an int value

setMaximumProduction

public void setMaximumProduction(int newMaximumProduction)
Set the MaximumProduction value.

Parameters:
newMaximumProduction - The new MaximumProduction value.

getMaxGoodsIcons

public int getMaxGoodsIcons()
Get the MaxGoodsIcons value.

Returns:
an int value

setMaxGoodsIcons

public void setMaxGoodsIcons(int newMaxGoodsIcons)
Set the MaxGoodsIcons value.

Parameters:
newMaxGoodsIcons - The new MaxGoodsIcons value.

getStockNumber

public int getStockNumber()
Get the stockNumber value. used to Show stored items in ReportColonyPanel

Returns:
an int value

setStockNumber

public void setStockNumber(int newStockNumber)
Set the stockNumber value. used to Show stored items in ReportColonyPanel

Parameters:
newStockNumber - The new StockNumber value.

drawPlus

public boolean drawPlus()
Get the DrawPlus value.

Returns:
a boolean value

setDrawPlus

public void setDrawPlus(boolean newDrawPlus)
Set the DrawPlus value.

Parameters:
newDrawPlus - The new DrawPlus value.

isCentered

public boolean isCentered()
Get the Centered value.

Returns:
a boolean value

setCentered

public void setCentered(boolean newCentered)
Set the Centered value.

Parameters:
newCentered - The new Centered value.

getCompressedWidth

public int getCompressedWidth()
Get the CompressedWidth value.

Returns:
an int value

setCompressedWidth

public void setCompressedWidth(int newCompressedWidth)
Set the CompressedWidth value.

Parameters:
newCompressedWidth - The new CompressedWidth value.

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides the getPreferredSize method.

Overrides:
getPreferredSize in class javax.swing.JComponent
Returns:
a Dimension value

getPreferredWidth

public int getPreferredWidth()
Returns only the width component of the preferred size.

Returns:
an int value

getMaximumIconWidth

public int getMaximumIconWidth()
Need to determine what the phatest icon is

Returns:
the width

getMaximumIconHeight

public int getMaximumIconHeight()
Need to determine the tallest icon TODO: Why does this use the image instead of the Icon like width??

Returns:
the height

paintComponent

public void paintComponent(java.awt.Graphics g)
Paints this ProductionLabel.

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
g - The graphics context in which to do the painting.