Package net.sf.colossus.gui
Class ShowCreatureDetails
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Dialog
-
- javax.swing.JDialog
-
- net.sf.colossus.guiutil.KDialog
-
- 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
Nested Classes Modifier and Type Class Description (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, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description 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.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBack
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, 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, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
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 boardcreature
- 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 VariantclientGui
- 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.
-
-