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);