Gridarta Editor
net.sf.gridarta.mainactions.RandomFillDialog Class Reference

Displays a dialog asking for parameters for the "random fill" function. More...

+ Collaboration diagram for net.sf.gridarta.mainactions.RandomFillDialog:

Public Member Functions

int getFillDensity ()
 Returns the fill density. More...
 
boolean isRandomFillSkipAdjacentSquares ()
 Action method for "skip adjacent squares" action. More...
 
void randomFillCancel ()
 Action method to close the dialog with "Cancel". More...
 
 RandomFillDialog ()
 Creates a new instance. More...
 
void randomFillOkay ()
 Action method to close the dialog with "OK". More...
 
void setRandomFillSkipAdjacentSquares (final boolean skipAdjacentSquares)
 Action method for "skip adjacent squares" action. More...
 
boolean showRandomFillDialog (@NotNull final Component parent)
 Displays the random fill dialog. More...
 

Private Member Functions

boolean isOkButtonEnabled ()
 Returns whether the "OK" button is enabled. More...
 
void updateOkButton ()
 Updates the enabled state of the "OK" button depending on the dialog's contents. More...
 

Private Attributes

final JButton cancelButton = new JButton(ACTION_BUILDER.createAction(false, "randomFillCancel", this))
 The "Cancel" button. More...
 
JDialog dialog
 The JDialog instance or. More...
 
final JTextComponent fillDensityTextField = new JTextField(16)
 The text field for specifying the fill density. More...
 
final JButton okButton = new JButton(ACTION_BUILDER.createAction(false, "randomFillOkay", this))
 The "OK" button. More...
 
final JOptionPane optionPane = new JOptionPane()
 The JOptionPane instance used to create dialogs. More...
 
boolean skipAdjacentSquares
 Whether adjacent squares are checked. More...
 
final WindowListener windowListener
 The WindowListener attached to dialog to call JOptionPane#selectInitialValue() after the dialog has been shown. More...
 

Static Private Attributes

static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
 Action Builder to create Actions. More...
 

Detailed Description

Displays a dialog asking for parameters for the "random fill" function.

Author
Andreas Kirschbaum

Definition at line 51 of file RandomFillDialog.java.

Constructor & Destructor Documentation

◆ RandomFillDialog()

Member Function Documentation

◆ getFillDensity()

int net.sf.gridarta.mainactions.RandomFillDialog.getFillDensity ( )

Returns the fill density.

Returns
the fill density

Definition at line 260 of file RandomFillDialog.java.

References net.sf.gridarta.utils.NumberUtils.parseInt().

Referenced by net.sf.gridarta.mainactions.MainActions< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.fillRandom(), and net.sf.gridarta.mainactions.RandomFillDialog.isOkButtonEnabled().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isOkButtonEnabled()

boolean net.sf.gridarta.mainactions.RandomFillDialog.isOkButtonEnabled ( )
private

Returns whether the "OK" button is enabled.

Returns
whether the "OK" button is enabled

Definition at line 251 of file RandomFillDialog.java.

References net.sf.gridarta.mainactions.RandomFillDialog.getFillDensity().

Referenced by net.sf.gridarta.mainactions.RandomFillDialog.randomFillOkay(), net.sf.gridarta.mainactions.RandomFillDialog.showRandomFillDialog(), and net.sf.gridarta.mainactions.RandomFillDialog.updateOkButton().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRandomFillSkipAdjacentSquares()

boolean net.sf.gridarta.mainactions.RandomFillDialog.isRandomFillSkipAdjacentSquares ( )

Action method for "skip adjacent squares" action.

Returns
whether the checkbox is checked

Definition at line 226 of file RandomFillDialog.java.

References net.sf.gridarta.mainactions.RandomFillDialog.skipAdjacentSquares.

Referenced by net.sf.gridarta.mainactions.MainActions< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.fillRandom().

+ Here is the caller graph for this function:

◆ randomFillCancel()

void net.sf.gridarta.mainactions.RandomFillDialog.randomFillCancel ( )

Action method to close the dialog with "Cancel".

Definition at line 243 of file RandomFillDialog.java.

◆ randomFillOkay()

void net.sf.gridarta.mainactions.RandomFillDialog.randomFillOkay ( )

Action method to close the dialog with "OK".

Definition at line 215 of file RandomFillDialog.java.

References net.sf.gridarta.mainactions.RandomFillDialog.isOkButtonEnabled().

+ Here is the call graph for this function:

◆ setRandomFillSkipAdjacentSquares()

void net.sf.gridarta.mainactions.RandomFillDialog.setRandomFillSkipAdjacentSquares ( final boolean  skipAdjacentSquares)

Action method for "skip adjacent squares" action.

Parameters
skipAdjacentSquareswhether the checkbox is checked

Definition at line 235 of file RandomFillDialog.java.

References net.sf.gridarta.mainactions.RandomFillDialog.skipAdjacentSquares.

◆ showRandomFillDialog()

boolean net.sf.gridarta.mainactions.RandomFillDialog.showRandomFillDialog ( @NotNull final Component  parent)

Displays the random fill dialog.

Parameters
parentthe parent component for the dialog
Returns
whether the dialog was closed with "OK"

Definition at line 193 of file RandomFillDialog.java.

References net.sf.gridarta.mainactions.RandomFillDialog.dialog, net.sf.gridarta.utils.ActionBuilderUtils.getString(), net.sf.gridarta.mainactions.RandomFillDialog.isOkButtonEnabled(), and net.sf.gridarta.mainactions.RandomFillDialog.okButton.

Referenced by net.sf.gridarta.mainactions.MainActions< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.fillRandom().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateOkButton()

void net.sf.gridarta.mainactions.RandomFillDialog.updateOkButton ( )
private

Updates the enabled state of the "OK" button depending on the dialog's contents.

Definition at line 184 of file RandomFillDialog.java.

References net.sf.gridarta.mainactions.RandomFillDialog.isOkButtonEnabled().

Referenced by net.sf.gridarta.mainactions.RandomFillDialog.RandomFillDialog().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ ACTION_BUILDER

final ActionBuilder net.sf.gridarta.mainactions.RandomFillDialog.ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
staticprivate

Action Builder to create Actions.

Definition at line 57 of file RandomFillDialog.java.

◆ cancelButton

final JButton net.sf.gridarta.mainactions.RandomFillDialog.cancelButton = new JButton(ACTION_BUILDER.createAction(false, "randomFillCancel", this))
private

The "Cancel" button.

Definition at line 75 of file RandomFillDialog.java.

◆ dialog

JDialog net.sf.gridarta.mainactions.RandomFillDialog.dialog
private

The JDialog instance or.

null

if not yet created.

Definition at line 87 of file RandomFillDialog.java.

Referenced by net.sf.gridarta.mainactions.RandomFillDialog.showRandomFillDialog().

◆ fillDensityTextField

final JTextComponent net.sf.gridarta.mainactions.RandomFillDialog.fillDensityTextField = new JTextField(16)
private

The text field for specifying the fill density.

Definition at line 81 of file RandomFillDialog.java.

◆ okButton

final JButton net.sf.gridarta.mainactions.RandomFillDialog.okButton = new JButton(ACTION_BUILDER.createAction(false, "randomFillOkay", this))
private

◆ optionPane

final JOptionPane net.sf.gridarta.mainactions.RandomFillDialog.optionPane = new JOptionPane()
private

The JOptionPane instance used to create dialogs.

Definition at line 63 of file RandomFillDialog.java.

◆ skipAdjacentSquares

boolean net.sf.gridarta.mainactions.RandomFillDialog.skipAdjacentSquares
private

◆ windowListener

final WindowListener net.sf.gridarta.mainactions.RandomFillDialog.windowListener
private

The WindowListener attached to dialog to call JOptionPane#selectInitialValue() after the dialog has been shown.

Definition at line 139 of file RandomFillDialog.java.


The documentation for this class was generated from the following file: