 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.gui.panel.gameobjectattributes;
22 import java.awt.Color;
23 import java.awt.GridLayout;
24 import javax.swing.JPanel;
25 import javax.swing.JScrollPane;
26 import javax.swing.JTextArea;
27 import javax.swing.ScrollPaneConstants;
28 import javax.swing.border.EtchedBorder;
35 import org.jetbrains.annotations.NotNull;
36 import org.jetbrains.annotations.Nullable;
54 private final JPanel
textPanel =
new JPanel(
new GridLayout(1, 1));
67 super(gameObjectAttributesModel);
72 sta.setBorder(
new EtchedBorder());
73 sta.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
74 sta.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
80 refresh(gameObjectAttributesModel.getSelectedGameObject());
90 protected final void refresh(@Nullable
final G gameObject) {
91 final boolean hasMessage;
92 if (gameObject ==
null) {
96 final String msgText = gameObject.getMsgText(
false);
97 if (msgText ==
null) {
98 final String archMsgText = gameObject.getArchetype().getMsgText(
false);
99 if (archMsgText ==
null) {
125 protected void apply(@NotNull
final G gameObject) {
126 gameObject.setMsgText(
getMsgText(gameObject));
141 if (msgText.isEmpty()) {
147 final String archetypeMsgText = archetype.
getMsgText(
false);
148 if (archetypeMsgText ==
null) {
151 if (msgText.equals(archetypeMsgText)) {
162 private void setArchTextArea(@NotNull
final String objText, @NotNull
final Color color) {
MODIFIED
The tab contents are modified from defaults.
Base package of all Gridarta classes.
final void refresh(@Nullable final G gameObject)
String getMsgText(boolean queryArchetype)
Returns the message bound to this object.
String getMsgText(@NotNull final GameObject< G, A, R > gameObject)
Returns the message text to be set.
Reflects a game object (object on a map).
Base class for GameObjectAttributesTab implementations.
String defaultArchTextAreaValue
The initial value of the archTextArea.
Graphical User Interface of Gridarta.
R getArchetype()
Returns the Archetype this GameObject is based on.
Severity levels for colors of tabs.
GameObjects are the objects based on Archetypes found on maps.
Interface for MapArchObjects.
MsgTextTab(@NotNull final GameObjectAttributesModel< G, A, R > gameObjectAttributesModel)
Creates a new instance.
void setArchTextArea(@NotNull final String objText, @NotNull final Color color)
Updates the value of the archTextArea.
Utility class for string manipulation.
void addAutoApply( @NotNull final Component component)
Registers a component that auto-applies when the focus is lost.
void setTabSeverity( @NotNull final Severity tabSeverity)
Sets the tab severity.
void apply(@NotNull final G gameObject)
The "Msg Text" tab in the game object attributes panel.
static String removeTrailingWhitespaceFromLines(@NotNull final CharSequence str)
Removes trailing whitespace from all lines of a string.
final JPanel textPanel
The content panel.
DEFAULT
The tab contents are unchanged from defaults.
final JTextArea archTextArea
Arch text field.