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

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

public final class ProductionLabel
extends AbstractGoodsLabel

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.JLabel
javax.swing.JLabel.AccessibleJLabel
 
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 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  int stockNumber
          The smallest number to display above the goodsIcons.
private  java.awt.Image stringImage
           
private  java.lang.String toolTipPrefix
          Describe toolTipPrefix here.
 
Fields inherited from class javax.swing.JLabel
labelFor
 
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 javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ProductionLabel(FreeColClient freeColClient, GUI gui, AbstractGoods goods)
          Creates a new ProductionLabel instance.
ProductionLabel(FreeColClient freeColClient, GUI gui, AbstractGoods goods, AbstractGoods maximum)
          Creates a new ProductionLabel instance.
ProductionLabel(FreeColClient freeColClient, GUI gui, AbstractGoods goods, int maximum)
          Creates a new ProductionLabel instance.
ProductionLabel(FreeColClient freeColClient, GUI gui, GoodsType goodsType, int amount)
          Creates a new ProductionLabel instance.
 
Method Summary
 boolean drawPlus()
          Get the DrawPlus value.
 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 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 getStockNumber()
          Get the stockNumber value.
private  java.awt.Image getStringImage()
           
 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 net.sf.freecol.client.gui.panel.AbstractGoodsLabel
getAmount, getGoods, getGUI, getType, isPartialChosen, isToEquip, setPartialChosen, toEquip
 
Methods inherited from class javax.swing.JLabel
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, 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
 
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, 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

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.


goodsIcon

private javax.swing.ImageIcon goodsIcon
The goodsIcon for this type of production.


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.


stringImage

private java.awt.Image stringImage
Constructor Detail

ProductionLabel

public ProductionLabel(FreeColClient freeColClient,
                       GUI gui,
                       AbstractGoods goods)
Creates a new ProductionLabel instance.

Parameters:
goods - a AbstractGoods value
parent - a Canvas value

ProductionLabel

public ProductionLabel(FreeColClient freeColClient,
                       GUI gui,
                       AbstractGoods goods,
                       AbstractGoods maximum)
Creates a new ProductionLabel instance.

Parameters:
goods - a AbstractGoods value
maximum - an AbstractGoods value
parent - a Canvas value

ProductionLabel

public ProductionLabel(FreeColClient freeColClient,
                       GUI gui,
                       GoodsType goodsType,
                       int amount)
Creates a new ProductionLabel instance.

Parameters:
goodsType - a GoodsType value
amount - an int value
parent - a Canvas value

ProductionLabel

public ProductionLabel(FreeColClient freeColClient,
                       GUI gui,
                       AbstractGoods goods,
                       int maximum)
Creates a new ProductionLabel instance.

Parameters:
goods - a AbstractGoods value
maximum - a AbstractGoods value
parent - a Canvas value
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.

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.

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

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.

getStringImage

private java.awt.Image getStringImage()