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;
53 final String archetypeAttributeName =
getRef().getArchetypeAttributeName();
54 if (input.getText().trim().isEmpty()) {
55 if (archetype.getAttributeLong(archetypeAttributeName) != 0L) {
56 return archetypeAttributeName +
" 0";
60 final long value = ((Number) input.getValue()).longValue();
61 if (archetype.getAttributeLong(archetypeAttributeName) != value) {
62 return archetypeAttributeName +
" " + value;
64 }
catch (
final NumberFormatException ignored) {
73 public void appendSummary(@NotNull
final Document doc, @NotNull
final Style style) {
74 final String value = input.getText();
75 if (value == null || value.isEmpty() || value.equals(
"0")) {
79 addLine(doc, style,
"",
" = " + value);
An ArchetypeAttribute for selecting long integer values.
void appendSummary(@NotNull final Document doc, @NotNull final Style style)
Contains the data of one Gridarta Object-Type.
T getRef()
Returns the attribute data.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
final JFormattedTextField input
The input ui component for editing the value.
GameObjects are the objects based on Archetypes found on maps.
final T ref
Reference to the attribute data.
DialogAttributeLong(@NotNull final ArchetypeAttributeLong ref, @NotNull final JFormattedTextField input)
Creates a new instance.
Indicates that an attribute cannot be encoded.
A single Attribute, combining an ArchetypeAttribute with its input component(s).
void addLine( @NotNull final Document doc, @NotNull final AttributeSet style, @NotNull final String prefix, @NotNull final String postfix)
Appends a line to a Document.
String getObjectText(@NotNull final G gameObject, @NotNull final Archetype< G, A, R > archetype, @NotNull final String[] newMsg, @NotNull final ArchetypeType archetypeType)
Defines types of GameObjects with corresponding attributes.
Interface for MapArchObjects.