public class MaritimeTradeOverlay extends OverlayView implements IMaritimeTradeOverlay
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
private java.awt.event.ActionListener |
actionListener |
private int |
BORDER_WIDTH |
(package private) java.awt.image.BufferedImage |
brickImg |
private int |
BUTTON_TEXT_SIZE |
private javax.swing.JPanel |
buttonPanel |
private javax.swing.JButton |
cancelButton |
private java.awt.event.ActionListener |
getActionListener |
private javax.swing.JLabel |
getAmount |
(package private) ResourceType[] |
getAvailables |
private javax.swing.JButton |
getbrick |
private javax.swing.JButton |
getore |
private javax.swing.JButton |
getreload |
private javax.swing.JButton |
getsheep |
private javax.swing.JButton |
getwheat |
private javax.swing.JButton |
getwood |
private java.awt.event.ActionListener |
giveActionListener |
private javax.swing.JLabel |
giveAmount |
(package private) ResourceType[] |
giveAvailables |
private javax.swing.JButton |
givebrick |
private javax.swing.JButton |
giveore |
private javax.swing.JButton |
givereload |
private javax.swing.JButton |
givesheep |
private javax.swing.JButton |
givewheat |
private javax.swing.JButton |
givewood |
private javax.swing.JLabel |
label |
private int |
LABEL_TEXT_SIZE |
private javax.swing.JPanel |
mainPane |
(package private) java.awt.image.BufferedImage |
oreImg |
(package private) java.awt.image.BufferedImage |
reloadImg |
(package private) java.lang.String |
resourceImageFolder |
(package private) java.awt.image.BufferedImage |
sheepImg |
private javax.swing.JButton |
tradeButton |
(package private) java.awt.image.BufferedImage |
wheatImg |
(package private) java.awt.image.BufferedImage |
woodImg |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
MaritimeTradeOverlay() |
Modifier and Type | Method and Description |
---|---|
private javax.swing.JPanel |
createButtonPane() |
private javax.swing.JPanel |
createGetPane() |
private javax.swing.JPanel |
createGivePane() |
private void |
createListeners() |
private javax.swing.JPanel |
createWholePanel() |
IMaritimeTradeController |
getController()
Controller getter
|
void |
hideGetOptions()
Hides the "get" resources and undo components.
|
void |
hideGiveOptions()
Hides the "give" resources and undo components.
|
private void |
initImages() |
void |
reset()
Resets the view to its initial state.
|
static java.awt.image.BufferedImage |
resize(java.awt.image.BufferedImage image,
int width,
int height) |
void |
selectGetOption(ResourceType selectedResource,
int amount)
Selects the resource the user has selected to receive.
|
void |
selectGiveOption(ResourceType selectedResource,
int amount)
Selects the resource the user has selected to give.
|
void |
setCancelEnabled(boolean enabled)
Enables or disables the cancel button.
|
void |
setStateMessage(java.lang.String message)
Sets the message on the button indicating the state of the trade.
|
void |
setTradeEnabled(boolean enable)
Enables or disables the trade button.
|
void |
showGetOptions(ResourceType[] enabledResources)
Shows all the "get" resources, enabling the ones the player can receive,
and disabling the ones he can't.
|
void |
showGiveOptions(ResourceType[] enabledResources)
Shows all the "give" resources, enabling the ones the player can give,
and disabling the ones he can't.
|
closeModal, isModalShowing, setWindow, showModal
setController
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, 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
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
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, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
closeModal, isModalShowing, showModal
setController
private final int LABEL_TEXT_SIZE
private final int BUTTON_TEXT_SIZE
private final int BORDER_WIDTH
private javax.swing.JLabel label
private javax.swing.JPanel mainPane
java.awt.image.BufferedImage reloadImg
java.awt.image.BufferedImage woodImg
java.awt.image.BufferedImage brickImg
java.awt.image.BufferedImage sheepImg
java.awt.image.BufferedImage wheatImg
java.awt.image.BufferedImage oreImg
java.lang.String resourceImageFolder
private javax.swing.JButton givereload
private javax.swing.JLabel giveAmount
private javax.swing.JButton givewood
private javax.swing.JButton givebrick
private javax.swing.JButton givesheep
private javax.swing.JButton givewheat
private javax.swing.JButton giveore
ResourceType[] giveAvailables
private javax.swing.JButton getreload
private javax.swing.JLabel getAmount
private javax.swing.JButton getwood
private javax.swing.JButton getbrick
private javax.swing.JButton getsheep
private javax.swing.JButton getwheat
private javax.swing.JButton getore
ResourceType[] getAvailables
private java.awt.event.ActionListener actionListener
private java.awt.event.ActionListener giveActionListener
private java.awt.event.ActionListener getActionListener
private javax.swing.JButton tradeButton
private javax.swing.JButton cancelButton
private javax.swing.JPanel buttonPanel
private void initImages()
public IMaritimeTradeController getController()
IView
getController
in interface IView
getController
in class PanelView
public void reset()
IMaritimeTradeOverlay
reset
in interface IMaritimeTradeOverlay
public void hideGetOptions()
IMaritimeTradeOverlay
hideGetOptions
in interface IMaritimeTradeOverlay
public void hideGiveOptions()
IMaritimeTradeOverlay
hideGiveOptions
in interface IMaritimeTradeOverlay
public void selectGetOption(ResourceType selectedResource, int amount)
IMaritimeTradeOverlay
selectGetOption
in interface IMaritimeTradeOverlay
selectedResource
- The "get" resource selected by the useramount
- The amount of the specified "get" resource the user will
receive (e.g., 1)public void selectGiveOption(ResourceType selectedResource, int amount)
IMaritimeTradeOverlay
selectGiveOption
in interface IMaritimeTradeOverlay
selectedResource
- The "give" resource selected by the useramount
- The amount of the specified "give" resource the user will give
(e.g., 3)public void setStateMessage(java.lang.String message)
IMaritimeTradeOverlay
setStateMessage
in interface IMaritimeTradeOverlay
message
- The new state messagepublic void setTradeEnabled(boolean enable)
IMaritimeTradeOverlay
setTradeEnabled
in interface IMaritimeTradeOverlay
enable
- Whether or not the user may currently execute the tradepublic void setCancelEnabled(boolean enabled)
IMaritimeTradeOverlay
setCancelEnabled
in interface IMaritimeTradeOverlay
enabled
- Whether or not the user may cancel the trade operationpublic void showGetOptions(ResourceType[] enabledResources)
IMaritimeTradeOverlay
showGetOptions
in interface IMaritimeTradeOverlay
enabledResources
- Array of "get" resources that should be enabled.public void showGiveOptions(ResourceType[] enabledResources)
IMaritimeTradeOverlay
showGiveOptions
in interface IMaritimeTradeOverlay
enabledResources
- Array of "give" resources that should be enabled.private void createListeners()
private javax.swing.JPanel createWholePanel()
private javax.swing.JPanel createGetPane()
private javax.swing.JPanel createGivePane()
private javax.swing.JPanel createButtonPane()
public static java.awt.image.BufferedImage resize(java.awt.image.BufferedImage image, int width, int height)