Go to the documentation of this file.
20 package net.sf.gridarta.gui.panel.gameobjectattributes;
22 import java.awt.BorderLayout;
23 import java.awt.Container;
24 import java.awt.Dimension;
25 import java.awt.Frame;
26 import java.awt.GridLayout;
27 import javax.swing.Action;
28 import javax.swing.DefaultListModel;
29 import javax.swing.JButton;
30 import javax.swing.JList;
31 import javax.swing.JPanel;
32 import javax.swing.JScrollPane;
33 import javax.swing.ListModel;
34 import javax.swing.ListSelectionModel;
35 import javax.swing.ScrollPaneConstants;
36 import javax.swing.border.EtchedBorder;
37 import javax.swing.event.ListSelectionListener;
49 import net.
sf.japi.swing.action.ActionBuilder;
50 import net.
sf.japi.swing.action.ActionBuilderFactory;
51 import net.
sf.japi.swing.action.ActionMethod;
52 import org.jetbrains.annotations.NotNull;
53 import org.jetbrains.annotations.Nullable;
66 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
108 private final JPanel
panel =
new JPanel();
163 public EventsTab(@NotNull
final Frame
parent, @NotNull
final MapManager<G, A, R> mapManager, @NotNull
final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull
final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull
final ScriptArchData<G, A, R> scriptArchData, @NotNull
final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull
final ScriptArchUtils scriptArchUtils) {
164 super(gameObjectAttributesModel);
174 scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
175 scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
176 scrollPane.setPreferredSize(
new Dimension(80, 40));
178 final Container buttons =
new JPanel(
new GridLayout(4, 1));
184 panel.setLayout(
new BorderLayout());
186 panel.add(buttons, BorderLayout.EAST);
187 panel.setPreferredSize(
new Dimension(100, 40));
189 eventList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
190 final ListSelectionListener listSelectionListener = e ->
updateActions();
191 eventList.addListSelectionListener(listSelectionListener);
192 refresh(gameObjectAttributesModel.getSelectedGameObject());
212 protected final void refresh(@Nullable
final G gameObject) {
214 if (gameObject ==
null || !gameObject.isScripted()) {
216 final ListModel<?> listModel =
eventList.getModel();
217 if (listModel !=
null && listModel.getSize() > 0) {
218 eventList.setModel(
new DefaultListModel<>());
239 protected void apply(@NotNull
final G gameObject) {
281 if (gameObject ==
null) {
286 final G selectedHead = gameObject.
getHead();
317 if (gameObject ==
null) {
321 final ListModel<?> listModel =
eventList.getModel();
322 if (listModel ==
null || listModel.getSize() <= 0) {
326 final int index =
eventList.getSelectedIndex();
332 final G selectedHead = gameObject.
getHead();
355 private void setEventPanelButtonState(
final boolean newButton,
final boolean modifyButton,
final boolean pathButton,
final boolean removeButton) {
final ScriptArchDataUtils< G, A, R > scriptArchDataUtils
boolean doAddNewEvent(final boolean performAction)
boolean doEditEvent(@NotNull final ScriptTask task, final boolean performAction)
boolean isEmpty(@NotNull G gameObject)
EventsTab(@NotNull final Frame parent, @NotNull final MapManager< G, A, R > mapManager, @NotNull final GameObjectAttributesModel< G, A, R > gameObjectAttributesModel, @NotNull final ScriptArchEditor< G, A, R > scriptArchEditor, @NotNull final ScriptArchData< G, A, R > scriptArchData, @NotNull final ScriptArchDataUtils< G, A, R > scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils)
final Action aEventRemove
final JScrollPane scrollPane
MapModel< G, A, R > getMapModel()
void modifyEventScript(final int eventIndex, final ScriptTask task, @NotNull final JList< String > panelList, @NotNull final MapManager<?, ?, ?> mapManager, @NotNull final Frame parent, @NotNull final Iterable< G > gameObject)
final ScriptArchUtils scriptArchUtils
void setTabSeverity( @NotNull final Severity tabSeverity)
GameObject< G, A, R > selectedGameObject
final ScriptArchEditor< G, A, R > scriptArchEditor
static final ActionBuilder ACTION_BUILDER
void beginTransaction(@NotNull String name)
MapSquare< G, A, R > getMapSquare(@NotNull Point pos)
final MapManager< G, A, R > mapManager
final Action aEventEditData
void setEventPanelButtonState(final boolean newButton, final boolean modifyButton, final boolean pathButton, final boolean removeButton)
final ScriptArchData< G, A, R > scriptArchData
final JList< String > eventList
final Action aEventAddNew
void addEventScript(@NotNull final G gameObject, @NotNull final ScriptArchData< G, A, R > scriptArchData, @NotNull final Frame parent)
void addEventsToJList(@NotNull JList< String > list, @NotNull Iterable<? extends GameObject<?, ?, ?>> gameObject)
final void refresh(@Nullable final G gameObject)
void apply(@NotNull final G gameObject)