net.sf.colossus.gui
Class ShowCreatureDetails

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by net.sf.colossus.guiutil.KDialog
                          extended by net.sf.colossus.gui.ShowCreatureDetails
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public final class ShowCreatureDetails
extends KDialog

A dialog frame that displays lots of (almost static) information about one specific creature type. i.e the power/skill, the musterings and the abilities in the different hazards. Non-static information that might be shown is the number of creatures left in the caretaker's stack. The dialog is thought to be popped up and closed if needed, displaying information about one selected creature type. The info in the dialog is updated if needed. Implementation details: The dialog mainly contains one JTextEdit control which itself display HTML text! It is thinkable, that the HTML text comes from an URL (easy to implement). Currently the whole HTML is built line by line like a servlet would do it. To figure out some of the more difficult properties of the creature I "simulate" a tiny battlefield, where the creature in question engages other creatures in different hazard terrains. This is of course highly dependent on the battle implementation. It can easily break. I tried to be very generic -- things that might break, should break on compilation time, and not display wrong information. TODO this dialog should have a SaveWindow attached to it. TODO hexside Hazards Clemens: I started adding the hexside hazards, but that is not completed; for one, the simulatedXXX setup cannot easily be extended calculate that right, and there it is dependent on "atop XXX" or "below XXX" . So, I leave the extended table creation there, but do not add the hexside hazards into the hazards Collection so that it just shows same as before. There is a lot of things that need improvement, see 2136671 Show creature detail window...

Author:
Towi, copied from ShowRecruitTree
See Also:
Serialized Form

Nested Class Summary
(package private)  class ShowCreatureDetails.SimulatedBattleHex
          helper class that catches some calls for the simulated critter.
(package private)  class ShowCreatureDetails.SimulatedCritter
          helper class to simulate a battle of the creature in question against an other creature.
 
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  BattleStrikeServerSide battleStrikeSS
           
private  java.util.Collection<Hazards> hazards
           
private static java.lang.String[] HEXSIDE_NAMES
          define hex side names for table column headers.
private static char[] HEXSIDES
          easy access to hex side identifiers.
private  IVariant ivariant
           
 
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
ShowCreatureDetails(javax.swing.JFrame parentFrame, CreatureType creature, java.awt.Point point, javax.swing.JScrollPane pane, Variant variant, ClientGUI clientGui)
          pops up the non-modal dialog.
 
Method Summary
private static void _head(java.lang.StringBuilder s, CreatureType cr)
          html header and start of page.
private static java.lang.String _low(java.lang.String s)
          wrap HTML code around s to make it dark, or gray.
private  void _section(java.lang.StringBuilder s, java.lang.String name)
          start of a named section.
private  void _trSpan(java.lang.StringBuilder s, java.lang.String name, java.lang.String value)
          a headered table row, the data column spans.
 void showCreatureDetails(java.awt.Container cnt, CreatureType creature, Variant variant)
           
 
Methods inherited from class net.sf.colossus.guiutil.KDialog
assertEDT, centerOnScreen, centerOnScreen, dispose, getUpperRightCorner, lowerRightCorner, placeRelative, setVisible, useSaveWindow
 
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, show, toBack
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, 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, 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, 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, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ivariant

private final IVariant ivariant

hazards

private final java.util.Collection<Hazards> hazards

battleStrikeSS

private final BattleStrikeServerSide battleStrikeSS

HEXSIDES

private static final char[] HEXSIDES
easy access to hex side identifiers.


HEXSIDE_NAMES

private static final java.lang.String[] HEXSIDE_NAMES
define hex side names for table column headers.

Constructor Detail

ShowCreatureDetails

public ShowCreatureDetails(javax.swing.JFrame parentFrame,
                           CreatureType creature,
                           java.awt.Point point,
                           javax.swing.JScrollPane pane,
                           Variant variant,
                           ClientGUI clientGui)
pops up the non-modal dialog. info can be updated if needed.

Parameters:
parentFrame - parent frame, i.e. the master board
creature - creature to show detailed info for.
point - coordinate on screen to display windows, or null.
pane - if 'point' is not null it is relative to this.
variant - the current Variant
clientGui - for now, the Client acting as deputy to answer Variant questions variant cannot answer yet, and we get iVariant from clientGui
Method Detail

showCreatureDetails

public void showCreatureDetails(java.awt.Container cnt,
                                CreatureType creature,
                                Variant variant)
Parameters:
cnt - the awt container where the info wil be shown in. it will be emptied.
creature - the creature that details you want to show

_head

private static void _head(java.lang.StringBuilder s,
                          CreatureType cr)
html header and start of page.


_section

private void _section(java.lang.StringBuilder s,
                      java.lang.String name)
start of a named section.

Parameters:
s - in/out

_trSpan

private void _trSpan(java.lang.StringBuilder s,
                     java.lang.String name,
                     java.lang.String value)
a headered table row, the data column spans.

Parameters:
s - in/out

_low

private static java.lang.String _low(java.lang.String s)
wrap HTML code around s to make it dark, or gray.