 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.gui.panel.selectedsquare;
22 import javax.swing.DefaultListModel;
28 import org.jetbrains.annotations.NotNull;
29 import org.jetbrains.annotations.Nullable;
45 private final DefaultListModel<G>
model;
75 if (mapSquare ==
null) {
76 model.removeAllElements();
81 int currentSelectionIndex = -1;
82 int firstVisibleIndex = -1;
86 boolean foundVisibleIndex =
false;
87 for (
final G node : mapSquare.reverse()) {
89 if (node == gameObject) {
97 foundVisibleIndex =
true;
101 if (currentSelectionIndex == -1 && tmpSelect != -1) {
102 currentSelectionIndex = tmpSelect;
109 final int selectedIndex;
110 if (currentSelectionIndex != -1) {
111 selectedIndex = currentSelectionIndex;
112 }
else if (firstVisibleIndex != -1) {
113 selectedIndex = firstVisibleIndex;
117 return selectedIndex;
127 private int addInvObjects(@NotNull
final G node, @Nullable
final G gameObject) {
128 int selListCounter = -1;
129 for (
final G invObject : node.getHead().reverse()) {
130 if (invObject == gameObject) {
135 final int tmpListCounter =
addInvObjects(invObject, gameObject);
136 if (tmpListCounter != -1) {
137 selListCounter = tmpListCounter;
140 return selListCounter;
153 model.addElement(gameObject);
int updateIndex
The next index to update.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
Container for settings that affect the rendering of maps.
int update(@Nullable final GameObjectContainer< G, A, R > mapSquare, @Nullable final G gameObject)
Updates the model to reflect a net.sf.gridarta.model.mapmodel.MapSquare.
GameObjects are the objects based on Archetypes found on maps.
Interface for MapArchObjects.
boolean isEditType(int editType)
Get information on the current state of edit type.
void addElement(final G gameObject)
Adds one GameObject to model.
final DefaultListModel< G > model
The DefaultListModel to update.
int addInvObjects(@NotNull final G node, @Nullable final G gameObject)
Add inventory objects to an arch in the SelectedSquareView recursively.
ModelUpdater(@NotNull final DefaultListModel< G > model, @NotNull final MapViewSettings mapViewSettings)
Creates a new instance.
Base class for classes that contain GameObjects as children in the sense of containment.
Updates a DefaultListModel instance to reflect the contents of a net.sf.gridarta.model....
final MapViewSettings mapViewSettings
The MapViewSettings to use.
boolean isEditTypeSet()
Returns whether a editType value is set so that not all squares are displayed.