|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Window java.awt.Dialog javax.swing.JDialog soc.client.SOCSpecialItemDialog
class SOCSpecialItemDialog
This is a modal dialog for info / actions related to known SOCSpecialItem
s.
Its content will be specific to the scenario using Special Items, such as SC_WOND
.
This dialog class keeps special item types' actions in one place, instead of adding new classes
when new scenarios use them.
Currently used by:
SC_WOND
- Show Wonder info and pick one to build
typeKey
is unknown, this dialog shouldn't be called.
This dialog is work in progress: Currently it's functional but ugly.
I18N:
In the SC_WOND
scenario, the Wonder names are keyed strings
game.specitem.sc_wond.w1
- game.specitem.sc_wond.w5
. Some Wonders require
a settlement or city at certain node locations, which are named as keyed strings
board.nodelist._SC_WOND.N1
- board.nodelist._SC_WOND.N3
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JDialog |
---|
javax.swing.JDialog.AccessibleJDialog |
Nested classes/interfaces inherited from class java.awt.Dialog |
---|
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType |
Nested classes/interfaces inherited from class java.awt.Window |
---|
java.awt.Window.AccessibleAWTWindow |
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 javax.swing.JButton |
bClose
Button to close dialog without taking any action. |
private javax.swing.JButton[] |
buttons
Item pick buttons. |
private boolean |
didSetLocation
Place dialog in center once when displayed (in doLayout), don't change position afterwards |
private SOCGame |
ga
|
private SOCPlayerInterface |
pi
|
private static SOCStringManager |
strings
i18n text strings; will use same locale as SOCPlayerClient's string manager. |
private java.lang.String |
typeKey
Special items' typeKey , such as _SC_WOND . |
Fields inherited from class javax.swing.JDialog |
---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Dialog |
---|
DEFAULT_MODALITY_TYPE |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
SOCSpecialItemDialog(SOCPlayerInterface pi,
java.lang.String typeKey)
Creates a new SOCSpecialItemDialog object for known types of special items. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
A button was clicked to choose a special item such as a Wonder. |
private javax.swing.JComponent |
buildRequirementsText(java.util.List<SOCSpecialItem.Requirement> reqs)
Build and return a text component to display the requirements for this special item. |
void |
doLayout()
Call Container.doLayout() , then if this is the first time placing it,
place the dialog in the top-center of the game window. |
Methods inherited from class javax.swing.JDialog |
---|
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 |
Methods inherited from class java.awt.Dialog |
---|
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setModalityType, setResizable, setTitle, setUndecorated, setVisible, show, toBack |
Methods inherited from class java.awt.Window |
---|
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, toFront |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, transferFocusBackward, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, 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, isOpaque, 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, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final SOCStringManager strings
private final java.lang.String typeKey
typeKey
, such as _SC_WOND
.
private javax.swing.JButton[] buttons
private javax.swing.JButton bClose
private final SOCPlayerInterface pi
private final SOCGame ga
private boolean didSetLocation
Constructor Detail |
---|
public SOCSpecialItemDialog(SOCPlayerInterface pi, java.lang.String typeKey) throws java.lang.IllegalArgumentException
pack()
and setVisible(true)
to show the modal dialog;
this dialog's code will request any action chosen by the player.
Right now, _SC_WOND
is the only known typeKey
.
pi
- PlayerInterface that owns this dialogtypeKey
- Special item type key; see the SOCSpecialItem
class javadoc for details
java.lang.IllegalArgumentException
- if the typeKey
is unknown hereMethod Detail |
---|
private javax.swing.JComponent buildRequirementsText(java.util.List<SOCSpecialItem.Requirement> reqs)
This method is mentioned in the SOCSpecialItem.Requirement javadoc; if it's refactored or renamed, please update that javadoc.
reqs
- Special item requirements to build text for using i18n string keys
(see class javadoc
). If null or empty, returns new JLabel
("").
JLabel
(single requirement)
or JTextArea
(multiple requirements, shown one per line).
The component will have a plain font and an empty border 3px wide on the left and right,
0px top and bottom.public void doLayout()
Container.doLayout()
, then if this is the first time placing it,
place the dialog in the top-center of the game window.
doLayout
in class java.awt.Container
public void actionPerformed(java.awt.event.ActionEvent e)
buttons
[i] and send the server a pick-item command.
actionPerformed
in interface java.awt.event.ActionListener
e
- AWT event, from a button source
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |