Gridarta Editor
net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R > Class Template Reference

A dialog to ask the user for a map to open. More...

+ Collaboration diagram for net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:

Public Member Functions

void goMapApply ()
 Action method for apply. More...
 
void goMapCancel ()
 Action method for cancel. More...
 
 GoMapDialog (@NotNull final Window parent, @NotNull final MapsIndex mapsIndex, @NotNull final MapViewsManager< G, A, R > mapViewsManager)
 Creates a new instance. More...
 
void goMapScrollBottom ()
 Action method for scroll bottom. More...
 
void goMapScrollDown ()
 Action method for scroll down. More...
 
void goMapScrollPageDown ()
 Action method for scroll page down. More...
 
void goMapScrollPageUp ()
 Action method for scroll page up. More...
 
void goMapScrollTop ()
 Action method for scroll top. More...
 
void goMapScrollUp ()
 Action method for scroll up. More...
 
void goMapSelectDown ()
 Action method for select down. More...
 
void goMapSelectUp ()
 Action method for select up. More...
 
void showDialog ()
 Opens the dialog. More...
 

Private Member Functions

void doSearch ()
 Updates the maps display from the map name input field. More...
 
boolean goMap ()
 Opens the selected maps. More...
 

Private Attributes

final DelayedChangeManager delayedChangeManager
 A DelayedChangeManager for updating search results after {} changes. More...
 
final JDialog dialog
 The JDialog instance. More...
 
boolean dialogShown
 Whether dialog is currently shown. More...
 
final IndexListener< MapFileindexListener
 The IndexListener attached to mapsIndex to update search results after index changes. More...
 
final JTextComponent input
 The map name input field. More...
 
final JList< MapFilelist = new JList<>(listModel)
 The JList showing the matching maps. More...
 
final GoMapListModel listModel = new GoMapListModel()
 The list model containing the search results. More...
 
final Comparator< MapFilemapNameComparator
 A Comparator that orders map files by map name. More...
 
final MapsIndex mapsIndex
 The MapsIndex for looking up maps. More...
 
final MapViewsManager< G, A, R > mapViewsManager
 The MapViewsManager for opening maps. More...
 
final WindowListener windowListener
 The WindowListener attached to dialog to track opening/closing the dialog. More...
 

Static Private Attributes

static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
 The ActionBuilder. More...
 

Detailed Description

A dialog to ask the user for a map to open.

Author
Andreas Kirschbaum

Definition at line 69 of file GoMapDialog.java.

Constructor & Destructor Documentation

◆ GoMapDialog()

net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.GoMapDialog ( @NotNull final Window  parent,
@NotNull final MapsIndex  mapsIndex,
@NotNull final MapViewsManager< G, A, R >  mapViewsManager 
)

Creates a new instance.

Parameters
parentthe parent component for this dialog
mapsIndexthe maps index to use
mapViewsManagerthe map views manager for opening maps

Definition at line 261 of file GoMapDialog.java.

References net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.ACTION_BUILDER, net.sf.gridarta.gui.utils.SwingUtils.addAction(), net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.dialog, net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doSearch(), net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.goMapApply(), net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.input, net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.list, net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapsIndex, net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapViewsManager, net.sf.gridarta.utils.ActionBuilderUtils.newLabel(), net.sf.gridarta.gui.utils.TextComponentUtils.setAutoSelectOnFocus(), and net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.windowListener.

+ Here is the call graph for this function:

Member Function Documentation

◆ doSearch()

◆ goMap()

◆ goMapApply()

◆ goMapCancel()

◆ goMapScrollBottom()

◆ goMapScrollDown()

◆ goMapScrollPageDown()

◆ goMapScrollPageUp()

void net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.goMapScrollPageUp ( )

◆ goMapScrollTop()

void net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.goMapScrollTop ( )

◆ goMapScrollUp()

◆ goMapSelectDown()

◆ goMapSelectUp()

◆ showDialog()

Member Data Documentation

◆ ACTION_BUILDER

◆ delayedChangeManager

final DelayedChangeManager net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.delayedChangeManager
private
Initial value:
= new DelayedChangeManager(100, 1000, new DelayedChangeListener() {
@Override
public void change() {
if (!dialogShown) {
return;
}
SwingUtilities.invokeLater(() -> {
if (dialogShown) {
}
});
}
})

A DelayedChangeManager for updating search results after {} changes.

Definition at line 237 of file GoMapDialog.java.

◆ dialog

◆ dialogShown

boolean net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.dialogShown
private

Whether dialog is currently shown.

Definition at line 116 of file GoMapDialog.java.

◆ indexListener

final IndexListener<MapFile> net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.indexListener
private
Initial value:
= new IndexListener<MapFile>() {
@Override
public void valueAdded(@NotNull final MapFile value) {
}
@Override
public void valueRemoved(@NotNull final MapFile value) {
}
@Override
public void nameChanged() {
}
@Override
public void pendingChanged() {
}
@Override
public void indexingFinished() {
}
}

The IndexListener attached to mapsIndex to update search results after index changes.

The listener is attached only if {} is set; if the dialog is closed, changes are not tracked.

Definition at line 150 of file GoMapDialog.java.

◆ input

◆ list

final JList<MapFile> net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.list = new JList<>(listModel)
private

The JList showing the matching maps.

Definition at line 111 of file GoMapDialog.java.

Referenced by net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doSearch(), net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.goMap(), net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.GoMapDialog(), net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.goMapScrollBottom(), net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.goMapScrollDown(), net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.goMapScrollPageDown(), net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.goMapScrollPageUp(), net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.goMapScrollTop(), net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.goMapScrollUp(), net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.goMapSelectDown(), and net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.goMapSelectUp().

◆ listModel

◆ mapNameComparator

final Comparator<MapFile> net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapNameComparator
private
Initial value:
= new Comparator<MapFile>() {
@Override
public int compare(@NotNull final MapFile o1, @NotNull final MapFile o2) {
final String name1 = mapsIndex.getName(o1);
final String name2 = mapsIndex.getName(o2);
if (name1 == null) {
return name2 == null ? 0 : -1;
}
if (name2 == null) {
return +1;
}
final int cmp = name1.compareToIgnoreCase(name2);
return cmp == 0 ? o1.getFile().compareTo(o2.getFile()) : cmp;
}
}

A Comparator that orders map files by map name.

Definition at line 122 of file GoMapDialog.java.

Referenced by net.sf.gridarta.gui.dialog.gomap.GoMapDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doSearch().

◆ mapsIndex

◆ mapViewsManager

◆ windowListener


The documentation for this class was generated from the following file:
net.sf.gridarta.gui.dialog.gomap.GoMapDialog.dialogShown
boolean dialogShown
Whether dialog is currently shown.
Definition: GoMapDialog.java:116
net.sf.gridarta.gui.dialog.gomap.GoMapDialog.doSearch
void doSearch()
Updates the maps display from the map name input field.
Definition: GoMapDialog.java:361
net.sf.gridarta.model.index.AbstractIndex.getName
String getName(@NotNull final V value)
Returns the name associated with a value.
Definition: AbstractIndex.java:233
net.sf.gridarta.gui.dialog.gomap.GoMapDialog.delayedChangeManager
final DelayedChangeManager delayedChangeManager
A DelayedChangeManager for updating search results after {} changes.
Definition: GoMapDialog.java:237
net.sf.gridarta.utils.DelayedChangeManager.change
void change()
Delivers a change event to the associated DelayedChangeListener.
Definition: DelayedChangeManager.java:208
net.sf.gridarta.gui.dialog.gomap.GoMapDialog.mapsIndex
final MapsIndex mapsIndex
The MapsIndex for looking up maps.
Definition: GoMapDialog.java:93
net.sf.gridarta.utils.DelayedChangeManager.finish
void finish()
Finishes a series of change events.
Definition: DelayedChangeManager.java:218