net.sf.magicproject.stack
Class MPhase

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 net.sf.magicproject.stack.MPhase
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class MPhase
extends javax.swing.JPanel
implements java.awt.event.MouseListener

Represents a phase of turn of one player. Severals breakpoint flags can be attached to a phase to control the turn flow.

Since:
0.21 a graphical representation of phase, 0.31 a graphical representation for each players, 0.4 phase settings are saved., 0.80 medium skip flag added.
Author:
Fabrice Daugan
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static javax.swing.JPopupMenu optionsMenu
          is the popupMenu displayable when you right-click to see options of this phase.
static MPhase[][] phases
          will contain all MPhase object of players
 PhaseType phaseType
          Phase type associated to this phase component
static javax.swing.JPopupMenu popupMenu
          is the popupMenu displayable when click to see hystory of stack
 boolean skipThisPhase
          Indicates if this phase has to be skipped.
static MPhase triggerPhase
          the last phase where popup trigger has been recorded
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
MPhase(PhaseType phaseType, int idPlayer, java.io.InputStream settingFile)
          Create a new instance of MPhase
 
Method Summary
 boolean breakpoint()
          Tell if this phase has the option "breapoint to this phase"
 boolean declineResponseMe()
          Indicates wether this phase has the option "decline response to my effects until this phase".
 boolean declineResponseOpponent()
          Indicates wether this phase has the option "decline response to opponent's effects until this phase".
 void loadSettings(java.io.InputStream input)
          Load settings of this phase from the specified input stream
 void mouseClicked(java.awt.event.MouseEvent e)
          is called when you click on me
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paint(java.awt.Graphics g)
          update this component
 void reset()
          remove all breakpoints and options of this phase
 void saveSettings(java.io.FileOutputStream out)
          Save settings of this phase to the specified output stream
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

popupMenu

public static javax.swing.JPopupMenu popupMenu
is the popupMenu displayable when click to see hystory of stack


optionsMenu

public static javax.swing.JPopupMenu optionsMenu
is the popupMenu displayable when you right-click to see options of this phase.


triggerPhase

public static MPhase triggerPhase
the last phase where popup trigger has been recorded


phases

public static MPhase[][] phases
will contain all MPhase object of players


phaseType

public PhaseType phaseType
Phase type associated to this phase component


skipThisPhase

public boolean skipThisPhase
Indicates if this phase has to be skipped. The beginning_of_... and phase_... events would not be raised. Nevertheless, the before_phase_... trigger the current phase, the the awakened abilities should be mana source and played in the background as abstract abilities.

Constructor Detail

MPhase

public MPhase(PhaseType phaseType,
              int idPlayer,
              java.io.InputStream settingFile)
       throws java.io.IOException
Create a new instance of MPhase

Parameters:
phaseType - is the phase type associated to this phase
idPlayer - is the player ownig this phase
settingFile - the setting file where phase settings would be read
Throws:
java.io.IOException - if error occurred while reading settings from settingFile
Method Detail

paint

public void paint(java.awt.Graphics g)
update this component

Overrides:
paint in class javax.swing.JComponent
Parameters:
g - the graphics of this component

saveSettings

public void saveSettings(java.io.FileOutputStream out)
                  throws java.io.IOException
Save settings of this phase to the specified output stream

Parameters:
out - is output stream where settings of this phase would be saved
Throws:
java.io.IOException - if error occurred while writting settings to settingFile

loadSettings

public void loadSettings(java.io.InputStream input)
                  throws java.io.IOException
Load settings of this phase from the specified input stream

Parameters:
input - is input stream where settings of this phase is saved
Throws:
java.io.IOException - if error occurred while reading settings from settingFile

reset

public void reset()
remove all breakpoints and options of this phase


breakpoint

public boolean breakpoint()
Tell if this phase has the option "breapoint to this phase"

Returns:
true if there is a breakpoint on this phase
See Also:
MASK_BREAKPOINT, Magic.manualSkip()

declineResponseMe

public boolean declineResponseMe()
Indicates wether this phase has the option "decline response to my effects until this phase".

Returns:
true if there is a 'skip all' on this phase
See Also:
MASK_SKIP_ALL, MASK_TMP_SKIP_ALL, MASK_SKIP_ALL_VERY, MASK_TMP_SKIP_ALL_VERY, Magic.manualSkip()

declineResponseOpponent

public boolean declineResponseOpponent()
Indicates wether this phase has the option "decline response to opponent's effects until this phase".

Returns:
true if this phase has the option "decline response to opponent's effects until this phase".
See Also:
MASK_SKIP_ALL_VERY, MASK_TMP_SKIP_ALL_VERY, MASK_SKIP_ALL_MEDIUM, MASK_TMP_SKIP_ALL_MEDIUM, Magic.manualSkip()

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
is called when you click on me

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - is the mouse event

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener


Copyright © 2003-2007 Magic-Project. All Rights Reserved.