 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.gui.panel.tools;
22 import java.awt.Component;
23 import java.awt.Container;
24 import java.awt.GridBagConstraints;
25 import java.awt.GridBagLayout;
26 import java.awt.Point;
27 import javax.swing.JComboBox;
28 import javax.swing.JPanel;
45 import net.
sf.japi.swing.action.ActionBuilder;
46 import net.
sf.japi.swing.action.ActionBuilderFactory;
47 import org.jetbrains.annotations.NotNull;
48 import org.jetbrains.annotations.Nullable;
85 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta.gui.panel.tools");
131 public InsertionTool(@NotNull
final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull
final ObjectChooser<G, A, R> objectChooser, @NotNull
final PickmapSettings pickmapSettings, @NotNull
final InsertionModeSet<G, A, R> insertionModeSet, @NotNull
final MapViewSettings mapViewSettings) {
175 final Point p = e.getMapLocation();
198 @Nullable
final G insertedObject;
201 if (selectedGameObject !=
null) {
202 final G head = selectedGameObject.
getHead();
205 final Point point =
new Point();
206 for (R part = head.getArchetype(); part !=
null; part = part.getMultiNext()) {
207 point.x = p.x + part.getMultiX();
208 point.y = p.y + part.getMultiY();
216 insertedObject =
null;
242 throw new AssertionError();
256 final Container panel =
new JPanel();
257 panel.setLayout(
new GridBagLayout());
259 final GridBagConstraints gbcLabel =
new GridBagConstraints();
260 gbcLabel.anchor = GridBagConstraints.EAST;
262 final GridBagConstraints gbcComboBox =
new GridBagConstraints();
263 gbcComboBox.fill = GridBagConstraints.HORIZONTAL;
264 gbcComboBox.weightx = 1.0;
265 gbcComboBox.gridwidth = GridBagConstraints.REMAINDER;
267 final GridBagConstraints gbcCheckBox =
new GridBagConstraints();
268 gbcCheckBox.fill = GridBagConstraints.HORIZONTAL;
269 gbcCheckBox.gridwidth = GridBagConstraints.REMAINDER;
281 final String[] options = {
ActionBuilderUtils.
getString(
ACTION_BUILDER,
"insertionTool.mode.auto"),
ActionBuilderUtils.
getString(
ACTION_BUILDER,
"insertionTool.mode.topmost"),
ActionBuilderUtils.
getString(
ACTION_BUILDER,
"insertionTool.mode.aboveFloor"),
ActionBuilderUtils.
getString(
ACTION_BUILDER,
"insertionTool.mode.belowFloor"),
ActionBuilderUtils.
getString(
ACTION_BUILDER,
"insertionTool.mode.bottommost"), };
282 final JComboBox<?> comboBox =
new JComboBox<>(options);
InsertionMode getTopmostInsertionMode()
Returns the "topmost" insertion mode.
A MouseOpEvent is an event triggered for a MouseOpListener.
A MapModel reflects the data of a map.
A getMapArchObject()
Returns the Map Arch Object with the meta information about the map.
G insertBaseObject(@NotNull BaseObject< G, A, R, ?> baseObject, @NotNull Point pos, boolean allowMany, boolean join, @NotNull InsertionMode insertionMode)
Inserts a BaseObject to a map.
Base package of all Gridarta classes.
void endTransaction()
End a transaction.
boolean isPointValid(@Nullable Point pos)
Checks whether the given coordinate is within map bounds.
void beginTransaction(@NotNull String name)
Starts a new transaction.
boolean isAutojoin()
Returns whether "autojoin" is enabled.
Reflects a game object (object on a map).
Container for settings that affect the rendering of maps.
InsertionMode getBelowFloorInsertionMode()
Returns the "below floor" insertion mode.
Graphical User Interface of Gridarta.
InsertionMode getAutoInsertionMode()
Returns the "auto" insertion mode.
boolean setLocationSafe(@Nullable final Point p)
Move cursor to a new location.
GameObjects are the objects based on Archetypes found on maps.
boolean isPickmap()
Return flag that indicates whether this is a pickmap or not.
Utility class for Swing related functions.
Interface for MapArchObjects.
The model component of the selected square control.
boolean isLocked()
Returns whether pickmaps are immutable.
BaseObject< G, A, R, ?> getSelection()
Returns the active arch in the left-side panel.
MapCursor provides methods to move and drag on map.
InsertionMode getBottommostInsertionMode()
Returns the "bottommost" insertion mode.
void setLocation(@NotNull final Point p)
Move cursor to a new location.
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
void setSelectedGameObject(@Nullable final G gameObject)
Sets the currently selected GameObject.
Common base interface for ObjectChoosers.
T getHead()
Return the head part of a multi-part object.
MapSquare< G, A, R > getMapSquare(@NotNull Point pos)
Get the square at a specified location.
Base classes for rendering maps.
static Component createLabel(@NotNull final String key, @Nullable final Component component)
Creates a javax.swing.JLabel instance.
InsertionMode getAboveFloorInsertionMode()
Returns the "above floor" insertion mode.
Currently nothing more than a marker interface for unification.
Utility class for ActionBuilder related functions.
MapModel< G, A, R > getMapModel()
Returns the map model.
G getSelectedGameObject()
Returns the currently selected GameObject within this list (currently selected MapSquare).
Displays the contents of the currently selected map square.
Container for settings that affect pickmaps.