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:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,RootPaneContainer
,WindowConstants
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) final class
helper class that catches some calls for the simulated critter.(package private) final class
helper class to simulate a battle of the creature in question against an other creature.Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.Type
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BattleStrikeServerSide
private final Collection
<Hazards> private static final String[]
define hex side names for table column headers.private static final char[]
easy access to hex side identifiers.private final 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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
-
Constructor Summary
ConstructorsConstructorDescriptionShowCreatureDetails
(JFrame parentFrame, CreatureType creature, Point point, JScrollPane pane, Variant variant, ClientGUI clientGui) pops up the non-modal dialog. -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
_head
(StringBuilder s, CreatureType cr) html header and start of page.private static String
wrap HTML code around s to make it dark, or gray.private void
_section
(StringBuilder s, String name) start of a named section.private void
_trSpan
(StringBuilder s, String name, String value) a headered table row, the data column spans.void
showCreatureDetails
(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 Details
-
ivariant
-
hazards
-
battleStrikeSS
-
HEXSIDES
private static final char[] HEXSIDESeasy access to hex side identifiers. -
HEXSIDE_NAMES
define hex side names for table column headers.
-
-
Constructor Details
-
ShowCreatureDetails
public ShowCreatureDetails(JFrame parentFrame, CreatureType creature, Point point, 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 Details
-
showCreatureDetails
- 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
html header and start of page. -
_section
start of a named section.- Parameters:
s
- in/out
-
_trSpan
a headered table row, the data column spans.- Parameters:
s
- in/out
-
_low
wrap HTML code around s to make it dark, or gray.
-