soc.client
Class SOCBoardPanel.BoardPopupMenu

java.lang.Object
  extended byjava.awt.MenuComponent
      extended byjava.awt.MenuItem
          extended byjava.awt.Menu
              extended byjava.awt.PopupMenu
                  extended bysoc.client.SOCBoardPanel.BoardPopupMenu
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.MenuContainer, java.io.Serializable
Enclosing class:
SOCBoardPanel

private class SOCBoardPanel.BoardPopupMenu
extends java.awt.PopupMenu
implements java.awt.event.ActionListener

This class creates a popup menu on the board, to trade or build or cancel building.


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
(package private)  SOCBoardPanel bp
          our parent boardpanel
(package private)  java.awt.MenuItem buildRoadItem
           
(package private)  java.awt.MenuItem buildSettleItem
           
(package private)  java.awt.MenuItem cancelBuildItem
           
private  int cancelBuildType
           
private  int hoverCityID
          hover settlement or city node ID, or 0, at menu-show time
private  int hoverRoadID
          hover road ID, or 0, at menu-show time
private  int hoverSettlementID
          hover settlement or city node ID, or 0, at menu-show time
protected  boolean isInitialPlacement
          Will this be for initial placement (send putpiece right away), or for placement during game (send build, receive gamestate, send putpiece)?
private  int menuPlayerID
          determined at menu-show time
private  boolean menuPlayerIsCurrent
          determined at menu-show time
(package private)  SOCHandPanel.ResourceTradePopupMenu portTradeSubmenu
          determined at menu-show time, only over a useable port.
(package private)  java.awt.MenuItem upgradeCityItem
           
private  boolean wantsCancel
          determined at menu-show time
 
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.BoardPopupMenu(SOCBoardPanel bpanel)
          create a new BoardPopupMenu on this board
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handling the menu items
 void showBuild(int x, int y, int hR, int hS, int hC)
          Custom show method that finds current game status and player status.
 void showCancelBuild(int buildType, int x, int y, int hilightAt)
          Custom 'cancel' show method for when placing a road/settlement/city, giving the build/cancel options for that type of piece.
(package private)  void tryBuild(int ptype)
          Assumes player is current, and player is non-null, when called
(package private)  void tryCancel()
           
 
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

bp

SOCBoardPanel bp
our parent boardpanel


buildRoadItem

java.awt.MenuItem buildRoadItem

buildSettleItem

java.awt.MenuItem buildSettleItem

upgradeCityItem

java.awt.MenuItem upgradeCityItem

cancelBuildItem

java.awt.MenuItem cancelBuildItem

portTradeSubmenu

SOCHandPanel.ResourceTradePopupMenu portTradeSubmenu
determined at menu-show time, only over a useable port. Added then, and removed at next menu-show


menuPlayerID

private int menuPlayerID
determined at menu-show time


menuPlayerIsCurrent

private boolean menuPlayerIsCurrent
determined at menu-show time


wantsCancel

private boolean wantsCancel
determined at menu-show time


cancelBuildType

private int cancelBuildType

hoverRoadID

private int hoverRoadID
hover road ID, or 0, at menu-show time


hoverSettlementID

private int hoverSettlementID
hover settlement or city node ID, or 0, at menu-show time


hoverCityID

private int hoverCityID
hover settlement or city node ID, or 0, at menu-show time


isInitialPlacement

protected boolean isInitialPlacement
Will this be for initial placement (send putpiece right away), or for placement during game (send build, receive gamestate, send putpiece)?

Constructor Detail

SOCBoardPanel.BoardPopupMenu

public SOCBoardPanel.BoardPopupMenu(SOCBoardPanel bpanel)
create a new BoardPopupMenu on this board

Method Detail

showCancelBuild

public void showCancelBuild(int buildType,
                            int x,
                            int y,
                            int hilightAt)
Custom 'cancel' show method for when placing a road/settlement/city, giving the build/cancel options for that type of piece.

Parameters:
buildType - piece type (SOCPlayingPiece.ROAD, CITY, SETTLEMENT)
x - Mouse x-position
y - Mouse y-position
hilightAt - Current hover/hilight coordinates of piece being cancelled/placed

showBuild

public void showBuild(int x,
                      int y,
                      int hR,
                      int hS,
                      int hC)
Custom show method that finds current game status and player status. Also checks for hovering-over-port for port-trade submenu.

Parameters:
x - Mouse x-position
y - Mouse y-position
hR - Hover road ID, or 0
hS - Hover settle ID, or 0
hC - Hover city ID, or 0

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Handling the menu items

Specified by:
actionPerformed in interface java.awt.event.ActionListener

tryBuild

void tryBuild(int ptype)
Assumes player is current, and player is non-null, when called


tryCancel

void tryCancel()