 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.gui.dialog.gameobjectattributes;
22 import java.awt.Component;
23 import javax.swing.text.Document;
24 import javax.swing.text.JTextComponent;
25 import javax.swing.text.Style;
32 import org.apache.log4j.Category;
33 import org.apache.log4j.Logger;
34 import org.jetbrains.annotations.NotNull;
35 import org.jetbrains.annotations.Nullable;
53 private final JTextComponent
input;
80 final String archetypeAttributeName =
getRef().getArchetypeAttributeName();
81 String oldValue = archetype.getAttributeString(archetypeAttributeName);
82 if (oldValue.isEmpty()) {
86 return oldValue.equals(encodedValue) ?
"" : archetypeAttributeName +
" " + encodedValue;
90 public void appendSummary(@NotNull
final Document doc, @NotNull
final Style style) {
91 final String text =
input.getText();
96 final String tmp = text.trim();
97 if (tmp.isEmpty() || tmp.startsWith(
"<")) {
101 addLine(doc, style,
"",
" = " + tmp);
128 LOG.warn(
"null bitmask");
final T ref
Reference to the attribute data.
Defines types of GameObjects with corresponding attributes.
T getRef()
Returns the attribute data.
AttributeBitmask getBitmask()
String getObjectText(@NotNull final G gameObject, @NotNull final Archetype< G, A, R > archetype, @NotNull final String @NotNull[] newMsg, @NotNull final ArchetypeType archetypeType)
Base package of all Gridarta classes.
DialogAttributeBitmask(@NotNull final ArchetypeAttributeBitmask ref, @NotNull final JTextComponent input)
Creates a new instance.
static final Category LOG
The Logger for printing log messages.
void setValue(final int value)
Set the active bitmask value.
String getText(final int value)
Generate the text to be displayed for a given bitmask value.
void addLine( @NotNull final Document doc, @NotNull final AttributeSet style, @NotNull final String prefix, @NotNull final String postfix)
Appends a line to a Document.
Reflects a game object (object on a map).
int value
Active bitmask value.
int decodeValue(@NotNull final String encodedValue)
Convert a value from external representation.
String encodeValue(final int value)
Convert a value to external representation.
A single Attribute, combining an ArchetypeAttribute with its input component(s).
GameObjects are the objects based on Archetypes found on maps.
void appendSummary(@NotNull final Document doc, @NotNull final Style style)
String getEncodedValue()
Get the active bitmask value in external file representation.
This class manages bitmask values which appear in Gridarta archetype attributes.
AttributeBitmask bitmask
Reference to the bitmask data.
int getValue()
Get the active bitmask value.
Interface for MapArchObjects.
Contains the data of one Gridarta Object-Type.
An ArchetypeAttribute for selecting bitmask values.
void setEncodedValue(@NotNull final String encodedValue)
Set the active bitmask value in external file representation.
Component getInput()
Returns the input ui component for editing the value.
DialogAttribute for types with bitmasks to choose from.
void setBitmask(@Nullable final AttributeBitmask bitmask)
final JTextComponent input
The input ui component for editing the value.