Class NewMapDialog<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JOptionPane
-
- net.sf.gridarta.gui.dialog.newmap.AbstractNewMapDialog<G,A,R>
-
- net.sf.gridarta.gui.dialog.newmap.AbstractMapsizeNewMapDialog<G,A,R>
-
- net.sf.gridarta.gui.dialog.newmap.NewMapDialog<G,A,R>
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,javax.accessibility.Accessible
public class NewMapDialog<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends AbstractMapsizeNewMapDialog<G,A,R>
Dialog to create a new map file.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JOptionPane
javax.swing.JOptionPane.AccessibleJOptionPane
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
-
Fields inherited from class net.sf.gridarta.gui.dialog.newmap.AbstractNewMapDialog
PREFERENCES
-
Fields inherited from class javax.swing.JOptionPane
CANCEL_OPTION, CLOSED_OPTION, DEFAULT_OPTION, ERROR_MESSAGE, icon, ICON_PROPERTY, INFORMATION_MESSAGE, INITIAL_SELECTION_VALUE_PROPERTY, INITIAL_VALUE_PROPERTY, initialSelectionValue, initialValue, INPUT_VALUE_PROPERTY, inputValue, message, MESSAGE_PROPERTY, MESSAGE_TYPE_PROPERTY, messageType, NO_OPTION, OK_CANCEL_OPTION, OK_OPTION, OPTION_TYPE_PROPERTY, options, OPTIONS_PROPERTY, optionType, PLAIN_MESSAGE, QUESTION_MESSAGE, SELECTION_VALUES_PROPERTY, selectionValues, UNINITIALIZED_VALUE, value, VALUE_PROPERTY, WANTS_INPUT_PROPERTY, wantsInput, WARNING_MESSAGE, YES_NO_CANCEL_OPTION, YES_NO_OPTION, YES_OPTION
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description NewMapDialog(@NotNull MapViewsManager<G,A,R> mapViewsManager, @NotNull MapArchObjectFactory<A> mapArchObjectFactory, @NotNull java.awt.Component parentComponent, boolean showMapSizeDefault, boolean showMapDifficulty, int defaultWidth, int defaultHeight, int defaultDifficulty)Creates a "new map" dialog.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddFields(@NotNull javax.swing.JPanel panel, @NotNull java.awt.GridBagConstraints gbcLabel, @NotNull java.awt.GridBagConstraints gbcField)Adds additional fields to the dialog.protected @NotNull javax.swing.JPanelcreateMapNamePanel()protected booleancreateNew()Checks the given values and creates a new map.protected @Nullable Size2DgetMapSize()Validate the map size fields and return the result.protected voidinit2()Initializes the dialog.booleanisMapSizeDefault()Set whether to override the default map size.protected booleanisOkButtonEnabled()Returns whether the "OK" button is enabled depending on the dialog's contents.voidsetMapSizeDefault(boolean mapSizeDefault)Set whether to override the default map size.-
Methods inherited from class net.sf.gridarta.gui.dialog.newmap.AbstractMapsizeNewMapDialog
getMapHeight, getMapWidth, setMapSizeEnabled
-
Methods inherited from class net.sf.gridarta.gui.dialog.newmap.AbstractNewMapDialog
addDocumentListener, createMapParametersPanel, init1, mapCancel, mapOkay, setValue, updateOkButton
-
Methods inherited from class javax.swing.JOptionPane
createDialog, createDialog, createInternalFrame, getAccessibleContext, getDesktopPaneForComponent, getFrameForComponent, getIcon, getInitialSelectionValue, getInitialValue, getInputValue, getMaxCharactersPerLineCount, getMessage, getMessageType, getOptions, getOptionType, getRootFrame, getSelectionValues, getUI, getUIClassID, getValue, getWantsInput, paramString, selectInitialValue, setIcon, setInitialSelectionValue, setInitialValue, setInputValue, setMessage, setMessageType, setOptions, setOptionType, setRootFrame, setSelectionValues, setUI, setWantsInput, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showInputDialog, showInputDialog, showInputDialog, showInputDialog, showInputDialog, showInputDialog, showInternalConfirmDialog, showInternalConfirmDialog, showInternalConfirmDialog, showInternalConfirmDialog, showInternalInputDialog, showInternalInputDialog, showInternalInputDialog, showInternalMessageDialog, showInternalMessageDialog, showInternalMessageDialog, showInternalOptionDialog, showMessageDialog, showMessageDialog, showMessageDialog, showOptionDialog, 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, getBaseline, getBaselineResizeBehavior, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Constructor Detail
-
NewMapDialog
public NewMapDialog(@NotNull @NotNull MapViewsManager<G,A,R> mapViewsManager, @NotNull @NotNull MapArchObjectFactory<A> mapArchObjectFactory, @NotNull @NotNull java.awt.Component parentComponent, boolean showMapSizeDefault, boolean showMapDifficulty, int defaultWidth, int defaultHeight, int defaultDifficulty)Creates a "new map" dialog.- Parameters:
mapViewsManager- the map views manager to usemapArchObjectFactory- the map arch object factory instanceparentComponent- the parent component of this dialogshowMapSizeDefault- whether to show the "mapSizeDefault" checkboxshowMapDifficulty- whether to show the "mapDifficulty" fielddefaultWidth- the default width for new mapsdefaultHeight- the default height for new mapsdefaultDifficulty- the default difficulty for new maps
-
-
Method Detail
-
init2
protected void init2()
Description copied from class:AbstractNewMapDialogInitializes the dialog.- Overrides:
init2in classAbstractNewMapDialog<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
-
createMapNamePanel
@NotNull protected @NotNull javax.swing.JPanel createMapNamePanel()
- Specified by:
createMapNamePanelin classAbstractNewMapDialog<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
-
addFields
protected void addFields(@NotNull @NotNull javax.swing.JPanel panel, @NotNull @NotNull java.awt.GridBagConstraints gbcLabel, @NotNull @NotNull java.awt.GridBagConstraints gbcField)Description copied from class:AbstractNewMapDialogAdds additional fields to the dialog. Will be called once when the dialog is created.- Overrides:
addFieldsin classAbstractMapsizeNewMapDialog<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
panel- the panel to add the fields togbcLabel- the grid bag constraints for the label partgbcField- the grid bag constraints for the input field
-
createNew
protected boolean createNew()
Description copied from class:AbstractNewMapDialogChecks the given values and creates a new map.- Specified by:
createNewin classAbstractNewMapDialog<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Returns:
trueif the map was created,falseif the parameters were wrong
-
isOkButtonEnabled
protected boolean isOkButtonEnabled()
Description copied from class:AbstractNewMapDialogReturns whether the "OK" button is enabled depending on the dialog's contents.- Overrides:
isOkButtonEnabledin classAbstractNewMapDialog<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Returns:
- whether the "OK" button is enabled
-
isMapSizeDefault
@ActionMethod public boolean isMapSizeDefault()
Set whether to override the default map size.- Returns:
- mapSizeDefault
trueif the user wants to specify her own map size, otherwisefalse
-
setMapSizeDefault
@ActionMethod public void setMapSizeDefault(boolean mapSizeDefault)
Set whether to override the default map size.- Parameters:
mapSizeDefault-trueif the user wants to specify her own map size, otherwisefalse
-
getMapSize
@Nullable protected @Nullable Size2D getMapSize()
Validate the map size fields and return the result.- Overrides:
getMapSizein classAbstractMapsizeNewMapDialog<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Returns:
- whether the map size if the fields are valid or else
null
-
-