Class PickmapChooserControl<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.PickmapChooserControl<G,A,R>
-
- All Implemented Interfaces:
ObjectChooserTab<G,A,R>,EditorAction
public class PickmapChooserControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends java.lang.Object implements EditorAction, ObjectChooserTab<G,A,R>
Manages the pickmap panel and most pickmap-related code in general.
-
-
Constructor Summary
Constructors Constructor Description PickmapChooserControl(@NotNull PickmapChooserModel<G,A,R> pickmapChooserModel, @NotNull PickmapSettings pickmapSettings, @NotNull NewMapDialogFactory<G,A,R> newMapDialogFactory, @NotNull MapFolderTree<G,A,R> mapFolderTree, @NotNull MapManager<G,A,R> mapManager, @NotNull java.awt.Component parent, @NotNull MapViewsManager<G,A,R> mapViewsManager, @NotNull FileControl<G,A,R> fileControl, @NotNull PickmapChooserView<G,A,R> pickmapChooserView)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNewPickmap()Invoked when user wants to open a new pickmap.booleancanExit()Invoked when the user wants to exit the application.voiddeletePickmap()Invoked when the user wants to delete the active pickmap.@NotNull java.awt.ComponentgetComponent()Returns the component to show in the object chooser.GgetSelection()Returns the selected game object.@NotNull java.util.List<G>getSelections()Returns the selected game objects.@NotNull java.lang.StringgetTitle()Returns the title to display in the object chooser.booleanisLockAllPickmaps()Returns whether all pickmaps are locked.booleanisMatching(G gameObject)Returns whether the current selection matches the given game object.voidopenPickmapMap()Opens the active pickmap as a normal map for extensive editing.voidrevertPickmap()Invoked when user wants to revert the current pickmap to previously saved state.voidsavePickmap()Saves the current active pickmap.voidsetAction(@NotNull javax.swing.Action action, @NotNull java.lang.String name)Sets theActioninstance for this editor action.voidsetActive(boolean active)Called whenever this tab becomes active or inactive.voidsetLockAllPickmaps(boolean lockAllPickmaps)Sets whether all pickmaps are locked.voidsetPopupMenu(@NotNull javax.swing.JPopupMenu popupMenu)Sets the popup menu to show.
-
-
-
Constructor Detail
-
PickmapChooserControl
public PickmapChooserControl(@NotNull @NotNull PickmapChooserModel<G,A,R> pickmapChooserModel, @NotNull @NotNull PickmapSettings pickmapSettings, @NotNull @NotNull NewMapDialogFactory<G,A,R> newMapDialogFactory, @NotNull @NotNull MapFolderTree<G,A,R> mapFolderTree, @NotNull @NotNull MapManager<G,A,R> mapManager, @NotNull @NotNull java.awt.Component parent, @NotNull @NotNull MapViewsManager<G,A,R> mapViewsManager, @NotNull @NotNull FileControl<G,A,R> fileControl, @NotNull @NotNull PickmapChooserView<G,A,R> pickmapChooserView)Creates a new instance.- Parameters:
pickmapChooserModel- the pickmap chooser model to controlpickmapSettings- the pickmap settings to usenewMapDialogFactory- the factory for creating new pickmapsmapFolderTree- the map folder tree instancemapManager- the map manager instanceparent- the parent componentmapViewsManager- the map viewsfileControl- the file control instancepickmapChooserView- the view for this controller
-
-
Method Detail
-
setPopupMenu
public void setPopupMenu(@NotNull @NotNull javax.swing.JPopupMenu popupMenu)Sets the popup menu to show.- Parameters:
popupMenu- the popup menu to use
-
isLockAllPickmaps
@ActionMethod public boolean isLockAllPickmaps()
Returns whether all pickmaps are locked.- Returns:
trueif all pickmaps are locked
-
getSelection
@Nullable public G getSelection()
Description copied from interface:ObjectChooserTabReturns the selected game object.- Specified by:
getSelectionin interfaceObjectChooserTab<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Returns:
- one of the selected game objects or
nullif no game objects are selected
-
canExit
public boolean canExit()
Invoked when the user wants to exit the application.- Returns:
trueif exiting the application is allowed
-
getComponent
@NotNull public @NotNull java.awt.Component getComponent()
Description copied from interface:ObjectChooserTabReturns the component to show in the object chooser.- Specified by:
getComponentin interfaceObjectChooserTab<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Returns:
- the component to show
-
setActive
public void setActive(boolean active)
Description copied from interface:ObjectChooserTabCalled whenever this tab becomes active or inactive.- Specified by:
setActivein interfaceObjectChooserTab<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
active- whether this tab is active
-
isMatching
public boolean isMatching(@NotNull G gameObject)Description copied from interface:ObjectChooserTabReturns whether the current selection matches the given game object.- Specified by:
isMatchingin interfaceObjectChooserTab<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
gameObject- the game object to compare to- Returns:
- whether the game object matches
-
getSelections
@NotNull public @NotNull java.util.List<G> getSelections()
Description copied from interface:ObjectChooserTabReturns the selected game objects.- Specified by:
getSelectionsin interfaceObjectChooserTab<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Returns:
- the selected game objects
-
getTitle
@NotNull public @NotNull java.lang.String getTitle()
Description copied from interface:ObjectChooserTabReturns the title to display in the object chooser.- Specified by:
getTitlein interfaceObjectChooserTab<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Returns:
- the title
-
addNewPickmap
@ActionMethod public void addNewPickmap()
Invoked when user wants to open a new pickmap.
-
openPickmapMap
@ActionMethod public void openPickmapMap()
Opens the active pickmap as a normal map for extensive editing.
-
deletePickmap
@ActionMethod public void deletePickmap()
Invoked when the user wants to delete the active pickmap.
-
savePickmap
@ActionMethod public void savePickmap()
Saves the current active pickmap.
-
revertPickmap
@ActionMethod public void revertPickmap()
Invoked when user wants to revert the current pickmap to previously saved state.
-
setLockAllPickmaps
@ActionMethod public void setLockAllPickmaps(boolean lockAllPickmaps)
Sets whether all pickmaps are locked.- Parameters:
lockAllPickmaps-trueif all pickmaps are locked
-
setAction
public void setAction(@NotNull @NotNull javax.swing.Action action, @NotNull @NotNull java.lang.String name)Description copied from interface:EditorActionSets theActioninstance for this editor action.- Specified by:
setActionin interfaceEditorAction- Parameters:
action- the action instancename- the name of the action
-
-