20 package net.sf.gridarta.gui.map.viewaction;
22 import java.awt.Container;
23 import java.util.Arrays;
24 import java.util.Comparator;
25 import java.util.LinkedList;
26 import java.util.List;
27 import javax.swing.Action;
38 import net.
sf.japi.swing.action.ActionMethod;
39 import org.jetbrains.annotations.NotNull;
40 import org.jetbrains.annotations.Nullable;
58 private final List<ViewAction>
viewActions =
new LinkedList<>();
73 public void mapCreated(@NotNull
final MapControl<G, A, R> mapControl,
final boolean interactive) {
97 public void gridVisibleChanged(
final boolean gridVisible) {
102 public void lightVisibleChanged(
final boolean lightVisible) {
107 public void smoothingChanged(
final boolean smoothing) {
112 public void tileStretchingChanged(
final boolean tileStretching) {
117 public void doubleFacesChanged(
final boolean doubleFaces) {
122 public void alphaTypeChanged(
final int alphaType) {
127 public void editTypeChanged(
final int editType) {
132 public void autojoinChanged(
final boolean autojoin) {
145 mapManager.addMapManagerListener(mapManagerListener);
157 return String.CASE_INSENSITIVE_ORDER.compare(o1.
getName(), o2.
getName());
166 public void init(@NotNull
final Iterable<NamedGameObjectMatcher> gameObjectMatchers) {
168 viewActions.add(
new ViewAction(mapViewSettings, matcher));
176 public void setMenu(@Nullable
final Container viewActionsMenu) {
177 if (viewActionsMenu == null) {
182 Arrays.sort(actions, ACTION_NAME_COMPARATOR);
185 viewActionsMenu.add(viewAction.getCheckBoxMenuItem(), index++);
202 for (
final ViewAction viewAction : viewActions) {
203 viewAction.updateAction();
208 public void setAction(@NotNull
final Action action, @NotNull
final String name) {
A MapManager manages all opened maps.
This package contains classes related to matching GameObjects, so called GameObjectMatchers.
final MapViewSettingsListener mapViewSettingsListener
The MapViewSettingsListener attached to mapViewSettings to detect edit types changes.
void resetView()
Action method for "reset view".
Action to manage one edit type represented by one NamedGameObjectMatcher.
Decorates an arbitrary GameObjectMatcher with a localized name that is suitable for the user interfac...
void addMapViewSettingsListener(@NotNull MapViewSettingsListener listener)
Register a MapViewSettingsListener.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
String getName()
Returns the name for sorting the menu entries.
Interface for listeners listening to MapManager changes.
Interface for event listeners that are interested in changes on MapViewSettings.
Container for settings that affect the rendering of maps.
GameObjects are the objects based on Archetypes found on maps.
final List< ViewAction > viewActions
The view actions.
void setAction(@NotNull final Action action, @NotNull final String name)
Sets the Action instance for this editor action.
void init(@NotNull final Iterable< NamedGameObjectMatcher > gameObjectMatchers)
Creates the view actions.
void updateActions()
Update the actions' state to the current edit mode.
ViewActions(@NotNull final MapViewSettings mapViewSettings, @NotNull final MapManager< G, A, R > mapManager)
Create a new instance.
Currently nothing more than a marker interface for unification.
final MapViewSettings mapViewSettings
The map view settings instance.
static final Comparator< ViewAction > ACTION_NAME_COMPARATOR
The comparator for sorting menu entries.
void unsetEditType(int editType)
Set the map view to hide squares of the given type.
final MapManagerListener< G, A, R > mapManagerListener
The map manager listener which is attached to the current map if the current map is tracked...
void setMenu(@Nullable final Container viewActionsMenu)
Sets the menu to add the actions to.
Manages edit type actions in "view" menu.
Interface for MapArchObjects.