20 package net.sf.gridarta.gui.dialog.gameobjectattributes;
22 import javax.swing.JFormattedTextField;
23 import javax.swing.text.Document;
24 import javax.swing.text.Style;
30 import org.jetbrains.annotations.NotNull;
38 private final JFormattedTextField
input;
56 if (input.getText().trim().isEmpty()) {
60 value = ((Number) input.getValue()).intValue();
61 }
catch (
final NumberFormatException ignored) {
70 if (archetype.getAttributeInt(archetypeAttributeName) != value) {
71 return archetypeAttributeName +
" " + value;
78 public void appendSummary(@NotNull
final Document doc, @NotNull
final Style style) {
79 final String value = input.getText();
80 if (value == null || value.isEmpty() || value.equals(
"0")) {
84 addLine(doc, style,
"",
" = " + value);
final JFormattedTextField input
The input ui component for editing the value.
String getObjectText(@NotNull final G gameObject, @NotNull final Archetype< G, A, R > archetype, @NotNull final String[] newMsg, @NotNull final ArchetypeType archetypeType)
Contains the data of one Gridarta Object-Type.
T getRef()
Returns the attribute data.
String getArchetypeAttributeName()
Returns the archetype attribute name.
DialogAttributeInt(@NotNull final ArchetypeAttributeInt ref, @NotNull final JFormattedTextField input)
Creates a new instance.
Base package of all Gridarta classes.
int getMaxValue()
Returns the maximum allowed value.
Reflects a game object (object on a map).
int getMinValue()
Returns the minimum allowed value.
GameObjects are the objects based on Archetypes found on maps.
final T ref
Reference to the attribute data.
Indicates that an attribute cannot be encoded.
A single Attribute, combining an ArchetypeAttribute with its input component(s).
An ArchetypeAttribute for selecting integer values.
void addLine( @NotNull final Document doc, @NotNull final AttributeSet style, @NotNull final String prefix, @NotNull final String postfix)
Appends a line to a Document.
void appendSummary(@NotNull final Document doc, @NotNull final Style style)
Defines types of GameObjects with corresponding attributes.
Interface for MapArchObjects.