20 package net.sf.gridarta.gui.panel.objectchoicedisplay;
22 import java.awt.Color;
23 import java.awt.GridBagConstraints;
24 import java.awt.GridBagLayout;
25 import javax.swing.JLabel;
26 import javax.swing.JPanel;
30 import net.
sf.japi.swing.action.ActionBuilder;
31 import net.
sf.japi.swing.action.ActionBuilderFactory;
32 import org.jetbrains.annotations.NotNull;
33 import org.jetbrains.annotations.Nullable;
52 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
90 setLayout(
new GridBagLayout());
92 final GridBagConstraints gcl =
new GridBagConstraints();
93 final GridBagConstraints gcr =
new GridBagConstraints();
94 gcl.fill = GridBagConstraints.HORIZONTAL;
95 gcr.fill = GridBagConstraints.HORIZONTAL;
100 gcl.anchor = GridBagConstraints.WEST;
101 gcr.anchor = GridBagConstraints.WEST;
103 gcr.gridwidth = GridBagConstraints.REMAINDER;
106 add(gameObjectNameLabel, gcr);
109 add(gameObjectArchetypeNameLabel, gcr);
112 add(gameObjectTypeLabel, gcr);
115 add(gameObjectExtentsLabel, gcr);
126 if (gameObject == null) {
127 if (isPickmapActive) {
129 gameObjectNameLabel.setForeground(Color.BLUE);
131 gameObjectNameLabel.setText(null);
133 gameObjectArchetypeNameLabel.setText(null);
134 gameObjectTypeLabel.setText(null);
135 gameObjectExtentsLabel.setText(null);
139 gameObjectNameLabel.setForeground(Color.BLACK);
140 gameObjectNameLabel.setText(objName);
142 gameObjectArchetypeNameLabel.setText(headObject.
getArchetype().getArchetypeName());
144 gameObjectTypeLabel.setText(archetypeTypeSet.
getDisplayName(headObject));
147 gameObjectExtentsLabel.setText(ACTION_BUILDER.format(
"objectChooser.tileSize", headObject.
getMultiRefCount(), headObject.
getSizeX(), headObject.
getSizeY()));
T getHead()
Return the head part of a multi-part object.
final JLabel gameObjectArchetypeNameLabel
Display the selected game object's archetype name.
Manages ArchetypeType instances, list, and bitmask definitions.
int getMultiRefCount()
Returns the number of parts for multi-part heads.
final JLabel gameObjectTypeLabel
Display the selected game object's type information.
int getSizeY()
Determines the vertical extent in squares.
final JLabel gameObjectNameLabel
Displays the selected game object's name.
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
Base package of all Gridarta classes.
int getSizeX()
Determines the horizontal extent in squares.
ObjectChoiceDisplay(@NotNull final ArchetypeTypeSet archetypeTypeSet)
Creates a new instance.
final ArchetypeTypeSet archetypeTypeSet
The ArchetypeTypeSet for looking up game object types.
R getArchetype()
Returns the Archetype this GameObject is based on.
String getBestName()
Returns the name which is best appropriate to describe this GameObject.
final JLabel gameObjectExtentsLabel
Displays the selected game object's extents.
Utility class for ActionBuilder related functions.
void showObjectChooserQuickObject(@Nullable final BaseObject<?, ?, ?, ?> gameObject, final boolean isPickmapActive)
Displays information about the selected game object.
static final ActionBuilder ACTION_BUILDER
The ActionBuilder.
boolean isMulti()
Returns whether this Archetype is a multi-part object.
String getDisplayName(@NotNull final BaseObject<?, ?, ?, ?> baseObject)
Returns a description of this type.
static JLabel newLabel(@NotNull final ActionBuilder actionBuilder, @NotNull final String key)
Creates a new JLabel from a resource key.
The object choice display shows information about the selected object in the object chooser...
static final long serialVersionUID
The serial version UID.
Defines types of GameObjects with corresponding attributes.