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;
54 final String archetypeAttributeName =
ref.getArchetypeAttributeName();
56 if (
input.getText().trim().isEmpty()) {
60 value = ((Number)
input.getValue()).intValue();
61 }
catch (
final NumberFormatException ignored) {
66 if (value <
ref.getMinValue() || value >
ref.getMaxValue()) {
70 return archetype.getAttributeInt(archetypeAttributeName) == value ?
"" : archetypeAttributeName +
" " + value;
74 public void appendSummary(@NotNull
final Document doc, @NotNull
final Style style) {
75 final String value =
input.getText();
76 if (value ==
null || value.isEmpty() || value.equals(
"0")) {
80 addLine(doc, style,
"",
" = " + value);