 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.gui.dialog.shrinkmapsize;
22 import java.awt.Component;
23 import java.awt.Window;
24 import javax.swing.AbstractButton;
25 import javax.swing.Box;
26 import javax.swing.BoxLayout;
27 import javax.swing.JButton;
28 import javax.swing.JCheckBox;
29 import javax.swing.JComponent;
30 import javax.swing.JDialog;
31 import javax.swing.JLabel;
32 import javax.swing.JOptionPane;
33 import javax.swing.JPanel;
34 import javax.swing.WindowConstants;
42 import net.
sf.japi.swing.action.ActionBuilder;
43 import net.
sf.japi.swing.action.ActionBuilderFactory;
44 import net.
sf.japi.swing.action.ActionMethod;
45 import org.jetbrains.annotations.NotNull;
46 import org.jetbrains.annotations.Nullable;
63 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
133 public final JDialog
createDialog(@NotNull
final Component parentComponent, @NotNull
final String title) {
134 final JDialog result = super.createDialog(parentComponent, title);
135 result.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
136 result.getRootPane().setDefaultButton(
okButton);
137 result.setModal(
false);
149 label.setAlignmentX(0.0F);
153 final JPanel mainPanel =
new JPanel();
154 mainPanel.setLayout(
new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
156 mainPanel.add(label);
157 mainPanel.add(Box.createVerticalStrut(5));
160 mainPanel.add(Box.createVerticalStrut(5));
162 mainPanel.add(Box.createVerticalStrut(5));
176 final StringBuilder sb =
new StringBuilder(100);
204 if (sb.length() > 0) {
206 sb.insert(0,
"<html>");
245 public void setValue(@Nullable
final Object newValue) {
246 super.setValue(newValue);
247 if (newValue != UNINITIALIZED_VALUE) {
A getMapArchObject()
Returns the Map Arch Object with the meta information about the map.
void shrinkMapSize()
Shrinks the map model.
final JDialog dialog
The associated JDialog instance.
MapControl< G, A, R > getMapControl()
Return the controller of this view.
Base package of all Gridarta classes.
final JDialog createDialog(@NotNull final Component parentComponent, @NotNull final String title)
Defines common UI constants used in different dialogs.
static int getShrinkFlags(@NotNull final MapModel<?, ?, ?> mapModel)
Returns which borders contain empty squares.
Component getComponent()
Returns the component associated with this MapView that can be used as parent for dialogs.
String getTilePath(@NotNull Direction direction)
Returns a tile path.
void shrinkMapSizeDialogOk()
Action method for ok.
boolean isShrinkMapSizeDialogEast()
Action method for "shrinkMapSizeDialogEast".
Reflects a game object (object on a map).
static final long serialVersionUID
Serial Version UID.
static JLabel newLabel(@NotNull final ActionBuilder actionBuilder, @NotNull final String key)
Creates a new JLabel from a resource key.
final AbstractButton southCheckBox
Checkbox to remove empty squares at the south edge.
Graphical User Interface of Gridarta.
ShrinkMapSizeDialog(@NotNull final ShrinkMapSizeDialogManager< G, A, R > shrinkMapSizeDialogManager, @NotNull final MapView< G, A, R > mapView)
Creates a new instance.
void updateWarnings()
Updates the warnings label.
GameObjects are the objects based on Archetypes found on maps.
JPanel createPanel()
Creates the GUI.
final JLabel warnings
Text area for displaying warning messages.
final ShrinkMapSizeDialogManager< G, A, R > shrinkMapSizeDialogManager
The manager for this dialog.
final AbstractButton eastCheckBox
Checkbox to remove empty squares at the east edge.
Interface for MapArchObjects.
final JButton okButton
JButton for ok.
A map view consists of a map grid and a map cursor, and is attached to a map control.
final MapView< G, A, R > mapView
The affected map view of this dialog.
static final int SHRINK_SOUTH
Flag value: remove empty space from south border.
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
static final int SHRINK_EAST
Flag value: remove empty space from east border.
void setValue(@Nullable final Object newValue)
boolean isShrinkMapSizeDialogSouth()
Action method for "shrinkMapSizeDialogSouth".
void setShrinkMapSizeDialogSouth(final boolean flag)
Action method for "shrinkMapSizeDialogSouth".
Base classes for rendering maps.
void shrinkMapSizeDialogCancel()
Action method for cancel.
static final ActionBuilder ACTION_BUILDER
Action Builder.
Dialog to ask which empty borders to remove from a map.
Utility class for ActionBuilder related functions.
MapModel< G, A, R > getMapModel()
Returns the map model.
void setShrinkMapSizeDialogEast(final boolean flag)
Action method for "shrinkMapSizeDialogEast".
final JButton cancelButton
JButton for cancel.
void disposeDialog(@NotNull final MapView< G, A, R > mapView)
Disposes a dialog.
Window getDialog()
Returns the JDialog for this instance.
Border DIALOG_BORDER
The Border object to be used when creating dialogs.
Utility class to remove empty squares from a map's border.
static void shrinkMap(@NotNull final MapModel<?, ?, ?> mapModel, final int shrinkFlags)
Removes empty squares from a map's border.