Class PickmapChooserModel<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
- java.lang.Object
-
- net.sf.gridarta.gui.panel.pickmapchooser.PickmapChooserModel<G,A,R>
-
- All Implemented Interfaces:
java.lang.Iterable<PickmapState<G,A,R>>
public class PickmapChooserModel<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends java.lang.Object implements java.lang.Iterable<PickmapState<G,A,R>>
Maintains loadedPickmapStateinstances.
-
-
Constructor Summary
Constructors Constructor Description PickmapChooserModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddMapFile(@NotNull PickmapState<G,A,R> pickmapState)Adds a map file.voidaddPickmapChooserListener(@NotNull PickmapChooserModelListener<G,A,R> pickmapChooserModelListener)Adds aPickmapChooserModelListenerto be notified.voidclear()Removes all map files.voidfireActivePickmapChanged(@Nullable PickmapState<G,A,R> pickmapState)Notifies all listeners that the active pickmap has changes.@NotNull PickmapState<G,A,R>get(int index)Returns a map file by index.@Nullable PickmapState<G,A,R>getPickmap(@NotNull java.io.File file)Returns the pickmap by file name.intindexOf(@NotNull PickmapState<G,A,R> pickmapState)Returns the index of a map file.booleanisEmpty()Returns whether no pickmaps exist in the current folder.@NotNull java.util.Iterator<PickmapState<G,A,R>>iterator()intremoveMapFile(@NotNull PickmapState<G,A,R> pickmapState)Removes a map file.intrevertMapFile(@NotNull MapControl<G,A,R> oldPickmap, @NotNull PickmapState<G,A,R> pickmapState)Reverts a map file.
-
-
-
Method Detail
-
addMapFile
public int addMapFile(@NotNull @NotNull PickmapState<G,A,R> pickmapState)Adds a map file.- Parameters:
pickmapState- the map file to add- Returns:
- the insertion index
-
removeMapFile
public int removeMapFile(@NotNull @NotNull PickmapState<G,A,R> pickmapState)Removes a map file.- Parameters:
pickmapState- the map file to remove- Returns:
- the removed index or
-1if the map file does not exist
-
revertMapFile
public int revertMapFile(@NotNull @NotNull MapControl<G,A,R> oldPickmap, @NotNull @NotNull PickmapState<G,A,R> pickmapState)Reverts a map file.- Parameters:
oldPickmap- the old pickmap controlpickmapState- the map file to revert- Returns:
- the reverted index or
-1if the map file does not exist
-
getPickmap
@Nullable public @Nullable PickmapState<G,A,R> getPickmap(@NotNull @NotNull java.io.File file)
Returns the pickmap by file name.- Parameters:
file- the file name- Returns:
- the pickmap, or
nullif the file is unknown
-
isEmpty
public boolean isEmpty()
Returns whether no pickmaps exist in the current folder.- Returns:
- whether no pickmaps exist
-
indexOf
public int indexOf(@NotNull @NotNull PickmapState<G,A,R> pickmapState)Returns the index of a map file.- Parameters:
pickmapState- the map file to search- Returns:
- the index or
-1if the map file does not exist
-
iterator
@NotNull public @NotNull java.util.Iterator<PickmapState<G,A,R>> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<G extends GameObject<G,A,R>>
-
get
@NotNull public @NotNull PickmapState<G,A,R> get(int index)
Returns a map file by index.- Parameters:
index- the index- Returns:
- the map file
-
clear
public void clear()
Removes all map files.
-
addPickmapChooserListener
public void addPickmapChooserListener(@NotNull @NotNull PickmapChooserModelListener<G,A,R> pickmapChooserModelListener)Adds aPickmapChooserModelListenerto be notified.- Parameters:
pickmapChooserModelListener- the listener to add
-
fireActivePickmapChanged
public void fireActivePickmapChanged(@Nullable @Nullable PickmapState<G,A,R> pickmapState)Notifies all listeners that the active pickmap has changes.- Parameters:
pickmapState- the active pickmap
-
-