public final class NegotiationDialog extends FreeColDialog<DiplomaticTrade>
Modifier and Type | Class and Description |
---|---|
private class |
NegotiationDialog.ColonyTradeItemPanel |
private class |
NegotiationDialog.GoldTradeItemPanel |
private class |
NegotiationDialog.GoodsTradeItemPanel |
private class |
NegotiationDialog.InciteTradeItemPanel |
private class |
NegotiationDialog.RemoveAction |
class |
NegotiationDialog.StanceTradeItemPanel
Class for the stance trade panel.
|
private class |
NegotiationDialog.UnitTradeItemPanel |
FreeColDialog.DialogType
javax.swing.JDialog.AccessibleJDialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
freeColClient, modal, options
accessibleContext, rootPane, rootPaneCheckingEnabled
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
NegotiationDialog(FreeColClient freeColClient,
javax.swing.JFrame frame,
FreeColGameObject our,
FreeColGameObject other,
DiplomaticTrade agreement,
StringTemplate comment)
Creates a new
NegotiationDialog instance. |
Modifier and Type | Method and Description |
---|---|
void |
addColonyTradeItem(Player source,
Colony colony)
Adds a
ColonyTradeItem to the list of TradeItems. |
void |
addGoldTradeItem(Player source,
int amount)
Adds a
GoldTradeItem to the list of TradeItems. |
void |
addGoodsTradeItem(Player source,
Goods goods)
Adds a
GoodsTradeItem to the list of TradeItems. |
void |
addInciteTradeItem(Player source,
Player victim)
Add an
InciteTradeItem to the list of trade items. |
void |
addStanceTradeItem(Stance stance)
Trade a stance change between the players.
|
void |
addUnitTradeItem(Player source,
Unit unit)
Adds a
UnitTradeItem to the list of TradeItems. |
private java.util.List<Goods> |
getAnyGoods(GoodsLocation gl)
Gets a list of all possible storable goods (one cargo load).
|
DiplomaticTrade |
getResponse()
Get the response from this dialog.
|
private javax.swing.JButton |
getTradeItemButton(TradeItem item)
Gets a trade item button for a given item.
|
private java.util.List<Unit> |
getUnitUnitList(Unit unit)
Get a list of units to offer that are associated with a given unit.
|
void |
removeNotify() |
void |
removeTradeItems(java.lang.Class<? extends TradeItem> itemClass)
Remove trade items of a given type.
|
private void |
updateDialog()
Update the entire dialog.
|
private void |
updateSummary()
Update the text summary of the proposed transaction.
|
choices, getFreeColClient, getGame, getGUI, getImageLibrary, getMyPlayer, getSpecification, getValue, igc, initializeDialog, isModal, propertyChange, requestFocus, responded, setSubcomponentsNotOpaque, setValue, setVisible
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getModalityType, getTitle, hide, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBack
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
private static final java.util.logging.Logger logger
private static final int HUGE_DEMAND
private static final java.lang.String ADD
private static final java.lang.String CLEAR
private final Player otherPlayer
private final DiplomaticTrade agreement
private final StringTemplate comment
private NegotiationDialog.StanceTradeItemPanel stancePanel
private NegotiationDialog.GoldTradeItemPanel goldOfferPanel
private NegotiationDialog.GoldTradeItemPanel goldDemandPanel
private NegotiationDialog.ColonyTradeItemPanel colonyOfferPanel
private NegotiationDialog.ColonyTradeItemPanel colonyDemandPanel
private NegotiationDialog.GoodsTradeItemPanel goodsOfferPanel
private NegotiationDialog.GoodsTradeItemPanel goodsDemandPanel
private NegotiationDialog.InciteTradeItemPanel inciteOfferPanel
private NegotiationDialog.InciteTradeItemPanel inciteDemandPanel
private NegotiationDialog.UnitTradeItemPanel unitOfferPanel
private NegotiationDialog.UnitTradeItemPanel unitDemandPanel
private javax.swing.JPanel summary
private StringTemplate demand
private StringTemplate offer
private java.lang.String exchangeMessage
private ChoiceItem<DiplomaticTrade> send
private ChoiceItem<DiplomaticTrade> accept
public NegotiationDialog(FreeColClient freeColClient, javax.swing.JFrame frame, FreeColGameObject our, FreeColGameObject other, DiplomaticTrade agreement, StringTemplate comment)
NegotiationDialog
instance.freeColClient
- The FreeColClient
for the game.frame
- The owner frame.our
- Our FreeColGameObject
that is negotiating.other
- The other FreeColGameObject
.agreement
- The DiplomaticTrade
agreement that
is being negotiated.comment
- An optional StringTemplate
commentary message.public DiplomaticTrade getResponse()
getResponse
in class FreeColDialog<DiplomaticTrade>
private java.util.List<Goods> getAnyGoods(GoodsLocation gl)
gl
- The GoodsLocation
for the goods.Goods
.private java.util.List<Unit> getUnitUnitList(Unit unit)
unit
- The Unit
that is trading.Unit
s.private void updateDialog()
private javax.swing.JButton getTradeItemButton(TradeItem item)
item
- The TradeItem
to make a button for.JButton
for the item.private void updateSummary()
public void removeTradeItems(java.lang.Class<? extends TradeItem> itemClass)
itemClass
- The class of TradeItem
to remove.public void addColonyTradeItem(Player source, Colony colony)
ColonyTradeItem
to the list of TradeItems.source
- The sourced Player
.colony
- The Colony
to add.public void addGoldTradeItem(Player source, int amount)
GoldTradeItem
to the list of TradeItems.source
- The source Player
.amount
- The amount of gold.public void addGoodsTradeItem(Player source, Goods goods)
GoodsTradeItem
to the list of TradeItems.source
- The source Player
.goods
- The Goods
to add.public void addInciteTradeItem(Player source, Player victim)
InciteTradeItem
to the list of trade items.source
- The source Player
.victim
- The Player
to be attacked.public void addStanceTradeItem(Stance stance)
stance
- The Stance
to trade.public void addUnitTradeItem(Player source, Unit unit)
UnitTradeItem
to the list of TradeItems.source
- The source Player
.unit
- The Unit
to add.public void removeNotify()
removeNotify
in class FreeColDialog<DiplomaticTrade>