org.vizzini.ui.game.boardgame
Class AbstractGridBoardUISwing

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.vizzini.ui.game.AbstractEnvironmentUISwing
                      extended by org.vizzini.ui.game.boardgame.AbstractGridBoardUISwing
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, IScoreListener, IStateListener, IGridBoardUI, IGridBoardUISwing, IEnvironmentUI, IListener
Direct Known Subclasses:
GridBoard3DUISwing, GridBoardUISwing

public abstract class AbstractGridBoardUISwing
extends AbstractEnvironmentUISwing
implements IGridBoardUISwing

Provides base functionality for Swing grid board environment user interfaces in the game framework.

Since:
v0.2
Version:
v0.3
Author:
Jeffrey M. Thompson
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String LABEL_PAINTED_PROPERTY
          Name of the label painted property.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AbstractGridBoardUISwing()
          Construct this object.
 
Method Summary
 void clearCurrentHighlight()
          Clear the current highlight.
 void clearLastMoveHighlight()
          Clear the last move highlight.
 void clearSelectionHighlight()
          Clear the selection highlight.
 void configure(Properties properties)
          Configure this environment.
protected  void fillAdditionalViewMenuItems(JMenu viewMenu)
          Fill in additional view menu items.
 Color getBoardColor()
          Return the board color.
 Color getCurrentColor()
          Return the current color.
 int getCurrentHighlightWidth()
           
 Color getFirstColor()
          Return the first color.
 Color getGridLineColor()
          Return the grid line color.
 Color getLabelColor()
          Return the label color.
 Color getLastMoveColor()
          Return the last move color.
 int getLastMoveHighlightWidth()
           
protected  AudioClip getPlacementAudioClip()
          Return the placement audio clip.
 Color getSecondColor()
          Return the second color.
 Color getSelectionColor()
          Return the selection color.
protected  HighlightData getSelectionHighlightData()
           
 int getSelectionHighlightWidth()
           
 void highlightCurrentPosition(IntegerPosition position)
          Set the current position.
 void highlightLastMovePosition(IntegerPosition position)
          Highlight the given position.
 void highlightSelectedPosition(IntegerPosition selectedPosition)
          Set the selected position.
 boolean isLabelPainted()
          Return true if the label painted flag is true.
protected  boolean isPositionUsable(IntegerPosition position)
          Return true if the given position is usable.
protected abstract  void reconcileBoard(IGridBoard board)
          Reconcile the token UIs with the real board environment.
 void setBoardColor(Color color)
          Set the board color.
 void setCurrentColor(Color color)
          Set the current color.
protected  void setCurrentHighlightData(HighlightData currentHighlightData)
           
 void setCurrentHighlightWidth(int currentHighlightWidth)
           
 void setFirstColor(Color color)
          Set the first color.
 void setGridLineColor(Color color)
          Set the grid line color.
 void setLabelColor(Color color)
          Set the label color.
 void setLabelPainted(boolean isLabelPainted)
          Set the label painted flag.
 void setLastMoveColor(Color color)
          Set the last move color.
 void setLastMoveHighlightWidth(int lastMoveHighlightWidth)
           
 void setSecondColor(Color color)
          Set the second color.
 void setSelectionColor(Color color)
          Set the selection color.
protected  void setSelectionHighlightData(HighlightData selectionHighlightData)
           
 void setSelectionHighlightWidth(int selectionHighlightWidth)
           
 void stateChange(StateEvent event)
          Respond to state change events.
 
Methods inherited from class org.vizzini.ui.game.AbstractEnvironmentUISwing
assignAgentListener, assignAgentListeners, getEnvironment, getSupport, init, isAudioOn, removeAgentListener, removeAgentListeners, reset, scoreChange, setAudioOn, setEnvironment
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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
 
Methods inherited from class java.awt.Container
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, 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, 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, hide, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.vizzini.ui.game.boardgame.IGridBoardUISwing
add, clearHighlights, getPositionForPoint, remove
 
Methods inherited from interface org.vizzini.ui.game.IEnvironmentUI
assignAgentListeners, getEnvironment, isAudioOn, removeAgentListeners, reset, setAudioOn, setEnvironment
 
Methods inherited from interface org.vizzini.game.event.IScoreListener
scoreChange
 

Field Detail

LABEL_PAINTED_PROPERTY

public static final String LABEL_PAINTED_PROPERTY
Name of the label painted property.

See Also:
Constant Field Values
Constructor Detail

AbstractGridBoardUISwing

public AbstractGridBoardUISwing()
Construct this object.

Since:
v0.2
Method Detail

clearCurrentHighlight

public void clearCurrentHighlight()
Clear the current highlight.

Specified by:
clearCurrentHighlight in interface IGridBoardUISwing
Since:
v0.3

clearLastMoveHighlight

public void clearLastMoveHighlight()
Clear the last move highlight.

Specified by:
clearLastMoveHighlight in interface IGridBoardUISwing
Since:
v0.3

clearSelectionHighlight

public void clearSelectionHighlight()
Clear the selection highlight.

Specified by:
clearSelectionHighlight in interface IGridBoardUISwing
Since:
v0.3

configure

public void configure(Properties properties)
               throws InstantiationException,
                      IllegalAccessException
Configure this environment. Extends the super method to set the colors.

Specified by:
configure in interface IEnvironmentUI
Overrides:
configure in class AbstractEnvironmentUISwing
Parameters:
properties - Source of configuration information.
Throws:
InstantiationException
IllegalAccessException
Since:
v0.2

getBoardColor

public Color getBoardColor()
Return the board color.

Specified by:
getBoardColor in interface IGridBoardUISwing
Since:
v0.2

getCurrentColor

public Color getCurrentColor()
Return the current color.

Specified by:
getCurrentColor in interface IGridBoardUISwing
Since:
v0.3

getCurrentHighlightWidth

public int getCurrentHighlightWidth()
Specified by:
getCurrentHighlightWidth in interface IGridBoardUISwing
Returns:
Return currentHighlightWidth.
Since:
v0.3

getFirstColor

public Color getFirstColor()
Return the first color.

Specified by:
getFirstColor in interface IGridBoardUISwing
Since:
v0.2

getGridLineColor

public Color getGridLineColor()
Return the grid line color.

Specified by:
getGridLineColor in interface IGridBoardUISwing
Since:
v0.2

getLabelColor

public Color getLabelColor()
Return the label color.

Specified by:
getLabelColor in interface IGridBoardUISwing
Since:
v0.2

getLastMoveColor

public Color getLastMoveColor()
Return the last move color.

Specified by:
getLastMoveColor in interface IGridBoardUISwing
Since:
v0.2

getLastMoveHighlightWidth

public int getLastMoveHighlightWidth()
Specified by:
getLastMoveHighlightWidth in interface IGridBoardUISwing
Returns:
Return lastMoveHighlightWidth.

getSecondColor

public Color getSecondColor()
Return the second color.

Specified by:
getSecondColor in interface IGridBoardUISwing
Since:
v0.2

getSelectionColor

public Color getSelectionColor()
Return the selection color.

Specified by:
getSelectionColor in interface IGridBoardUISwing
Since:
v0.2

getSelectionHighlightWidth

public int getSelectionHighlightWidth()
Specified by:
getSelectionHighlightWidth in interface IGridBoardUISwing
Returns:
Return selectionHighlightWidth.

highlightCurrentPosition

public void highlightCurrentPosition(IntegerPosition position)
Set the current position.

Specified by:
highlightCurrentPosition in interface IGridBoardUISwing
Since:
v0.3

highlightLastMovePosition

public void highlightLastMovePosition(IntegerPosition position)
Highlight the given position.

Specified by:
highlightLastMovePosition in interface IGridBoardUISwing
Since:
v0.2

highlightSelectedPosition

public void highlightSelectedPosition(IntegerPosition selectedPosition)
Set the selected position.

Specified by:
highlightSelectedPosition in interface IGridBoardUISwing
Since:
v0.2

isLabelPainted

public boolean isLabelPainted()
Return true if the label painted flag is true.

Specified by:
isLabelPainted in interface IGridBoardUISwing
Since:
v0.2

setBoardColor

public void setBoardColor(Color color)
Set the board color.

Specified by:
setBoardColor in interface IGridBoardUISwing
Since:
v0.2

setCurrentColor

public void setCurrentColor(Color color)
Set the current color.

Specified by:
setCurrentColor in interface IGridBoardUISwing
Since:
v0.3

setCurrentHighlightWidth

public void setCurrentHighlightWidth(int currentHighlightWidth)
Specified by:
setCurrentHighlightWidth in interface IGridBoardUISwing
Parameters:
currentHighlightWidth - The currentHighlightWidth to set.
Since:
v0.3

setFirstColor

public void setFirstColor(Color color)
Set the first color.

Specified by:
setFirstColor in interface IGridBoardUISwing
Since:
v0.2

setGridLineColor

public void setGridLineColor(Color color)
Set the grid line color.

Specified by:
setGridLineColor in interface IGridBoardUISwing
Since:
v0.2

setLabelColor

public void setLabelColor(Color color)
Set the label color.

Specified by:
setLabelColor in interface IGridBoardUISwing
Since:
v0.2

setLabelPainted

public void setLabelPainted(boolean isLabelPainted)
Set the label painted flag.

Specified by:
setLabelPainted in interface IGridBoardUISwing
Since:
v0.2

setLastMoveColor

public void setLastMoveColor(Color color)
Set the last move color.

Specified by:
setLastMoveColor in interface IGridBoardUISwing
Since:
v0.2

setLastMoveHighlightWidth

public void setLastMoveHighlightWidth(int lastMoveHighlightWidth)
Specified by:
setLastMoveHighlightWidth in interface IGridBoardUISwing
Parameters:
lastMoveHighlightWidth - The lastMoveHighlightWidth to set.

setSecondColor

public void setSecondColor(Color color)
Set the second color.

Specified by:
setSecondColor in interface IGridBoardUISwing
Since:
v0.2

setSelectionColor

public void setSelectionColor(Color color)
Set the selection color.

Specified by:
setSelectionColor in interface IGridBoardUISwing
Since:
v0.2

setSelectionHighlightWidth

public void setSelectionHighlightWidth(int selectionHighlightWidth)
Specified by:
setSelectionHighlightWidth in interface IGridBoardUISwing
Parameters:
selectionHighlightWidth - The selectionHighlightWidth to set.

stateChange

public void stateChange(StateEvent event)
Respond to state change events.

Specified by:
stateChange in interface IStateListener
Since:
v0.2

reconcileBoard

protected abstract void reconcileBoard(IGridBoard board)
Reconcile the token UIs with the real board environment.

Parameters:
board - The current board environment.
Since:
v0.2

fillAdditionalViewMenuItems

protected void fillAdditionalViewMenuItems(JMenu viewMenu)
Fill in additional view menu items. These menu items are placed below the other menu items.

Parameters:
viewMenu - View menu.
Since:
v0.2

getPlacementAudioClip

protected AudioClip getPlacementAudioClip()
Return the placement audio clip.

Since:
v0.2

getSelectionHighlightData

protected HighlightData getSelectionHighlightData()
Returns:
Return selectionHighlightData.
Since:
v0.3

isPositionUsable

protected boolean isPositionUsable(IntegerPosition position)
Return true if the given position is usable.

Since:
v0.3

setCurrentHighlightData

protected void setCurrentHighlightData(HighlightData currentHighlightData)
Parameters:
currentHighlightData - The currentHighlightData to set.
Since:
v0.3

setSelectionHighlightData

protected void setSelectionHighlightData(HighlightData selectionHighlightData)
Parameters:
selectionHighlightData - The selectionHighlightData to set.
Since:
v0.3


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02