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.hasAttribute(archetypeAttributeName)) {
56 return archetypeAttributeName +
" 0.0";
60 final double value = (Double)
input.getValue();
63 if (archetype.getAttributeDouble(archetypeAttributeName) != value) {
64 return archetypeAttributeName +
" " + value;
66 }
catch (
final NumberFormatException ignored) {
75 public void appendSummary(@NotNull
final Document doc, @NotNull
final Style style) {
76 final String value =
input.getText();
77 if (value ==
null || value.isEmpty() || value.equals(
"0")) {
81 addLine(doc, style,
"",
" = " + value);