soc.client
Class SOCBoardPanel.ResourceTradeAllMenu

java.lang.Object
  extended byjava.awt.MenuComponent
      extended byjava.awt.MenuItem
          extended byjava.awt.Menu
              extended byjava.awt.PopupMenu
                  extended bysoc.client.SOCHandPanel.ResourceTradePopupMenu
                      extended bysoc.client.SOCBoardPanel.ResourceTradeAllMenu
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.MenuContainer, java.io.Serializable
Enclosing class:
SOCBoardPanel

static class SOCBoardPanel.ResourceTradeAllMenu
extends SOCHandPanel.ResourceTradePopupMenu

Menu for right-click on 3-for-1 port to trade all resource types with bank/port. Menu items won't necessarily say "trade 3", because the user may have a 2-for-1 port, or may not have a 3-for-1 port (cost 4).

Author:
Jeremy D Monin

Nested Class Summary
 
Nested classes inherited from class java.awt.PopupMenu
java.awt.PopupMenu.AccessibleAWTPopupMenu
 
Nested classes inherited from class java.awt.Menu
java.awt.Menu.AccessibleAWTMenu
 
Nested classes inherited from class java.awt.MenuItem
java.awt.MenuItem.AccessibleAWTMenuItem
 
Nested classes inherited from class java.awt.MenuComponent
java.awt.MenuComponent.AccessibleAWTMenuComponent
 
Field Summary
private  SOCBoardPanel bpanel
           
protected  SOCHandPanel hpan
           
private  SOCHandPanel.ResourceTradeTypeMenu[] tradeFromTypes
           
 
Fields inherited from class java.awt.PopupMenu
 
Fields inherited from class java.awt.Menu
 
Fields inherited from class java.awt.MenuItem
 
Fields inherited from class java.awt.MenuComponent
 
Constructor Summary
SOCBoardPanel.ResourceTradeAllMenu(SOCBoardPanel bp, SOCHandPanel hp)
          Temporary menu for board popup menu
 
Method Summary
 void destroy()
          Cleanup, for removing this menu.
 void setEnabledIfCanTrade(boolean itemsOnly)
          Enable or disable based on gamestate and player's resources.
 void show(int x, int y)
          Show menu at this position.
 
Methods inherited from class java.awt.PopupMenu
addNotify, getAccessibleContext, show
 
Methods inherited from class java.awt.Menu
add, add, addSeparator, countItems, getItem, getItemCount, insert, insert, insertSeparator, isTearOff, paramString, remove, remove, removeAll, removeNotify
 
Methods inherited from class java.awt.MenuItem
addActionListener, deleteShortcut, disable, disableEvents, enable, enable, enableEvents, getActionCommand, getActionListeners, getLabel, getListeners, getShortcut, isEnabled, processActionEvent, processEvent, removeActionListener, setActionCommand, setEnabled, setLabel, setShortcut
 
Methods inherited from class java.awt.MenuComponent
dispatchEvent, getFont, getName, getParent, getPeer, getTreeLock, postEvent, setFont, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

bpanel

private SOCBoardPanel bpanel

tradeFromTypes

private SOCHandPanel.ResourceTradeTypeMenu[] tradeFromTypes

hpan

protected SOCHandPanel hpan
Constructor Detail

SOCBoardPanel.ResourceTradeAllMenu

public SOCBoardPanel.ResourceTradeAllMenu(SOCBoardPanel bp,
                                          SOCHandPanel hp)
                                   throws java.lang.IllegalStateException
Temporary menu for board popup menu

Throws:
java.lang.IllegalStateException - If client not current player
Method Detail

show

public void show(int x,
                 int y)
Show menu at this position. Before showing, enable or disable based on gamestate and player's resources.

Specified by:
show in class SOCHandPanel.ResourceTradePopupMenu
Parameters:
x - Mouse x-position relative to colorsquare
y - Mouse y-position relative to colorsquare
See Also:
SOCHandPanel.ResourceTradePopupMenu.setEnabledIfCanTrade(boolean)

setEnabledIfCanTrade

public void setEnabledIfCanTrade(boolean itemsOnly)
Enable or disable based on gamestate and player's resources.

Specified by:
setEnabledIfCanTrade in class SOCHandPanel.ResourceTradePopupMenu
Parameters:
itemsOnly - If true, enable/disable items, instead of the menu itself. The submenus are considered items. Items within submenus are also items.

destroy

public void destroy()
Cleanup, for removing this menu.

Specified by:
destroy in class SOCHandPanel.ResourceTradePopupMenu