Gridarta Editor
AttributesPaneBuilder.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.gui.dialog.gameobjectattributes;
21 
22 import java.awt.Color;
23 import java.awt.Component;
24 import java.awt.Container;
25 import java.awt.GridBagConstraints;
26 import java.awt.GridBagLayout;
27 import java.awt.Insets;
28 import java.awt.event.FocusListener;
29 import java.io.File;
30 import java.text.DecimalFormat;
31 import java.text.NumberFormat;
32 import java.util.ArrayList;
33 import java.util.Collection;
34 import java.util.Collections;
35 import java.util.regex.Pattern;
36 import javax.swing.BorderFactory;
37 import javax.swing.Box;
38 import javax.swing.DefaultComboBoxModel;
39 import javax.swing.ImageIcon;
40 import javax.swing.JButton;
41 import javax.swing.JCheckBox;
42 import javax.swing.JComboBox;
43 import javax.swing.JComponent;
44 import javax.swing.JFormattedTextField;
45 import javax.swing.JLabel;
46 import javax.swing.JPanel;
47 import javax.swing.JScrollPane;
48 import javax.swing.JTabbedPane;
49 import javax.swing.JTextArea;
50 import javax.swing.JTextField;
51 import javax.swing.filechooser.FileFilter;
52 import javax.swing.text.DefaultFormatterFactory;
53 import javax.swing.text.NumberFormatter;
104 import net.sf.gridarta.utils.HtmlUtils;
105 import org.jetbrains.annotations.NotNull;
106 import org.jetbrains.annotations.Nullable;
107 
113 public class AttributesPaneBuilder<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> {
114 
118  @NotNull
119  private static final Color FLOAT_COLOR = new Color(19, 134, 0);
120 
124  @NotNull
125  private static final Color INT_COLOR = new Color(74, 70, 156);
126 
130  @NotNull
131  private static final Pattern PARAGRAPH_DELIMITER = Pattern.compile("\n+");
132 
137  @NotNull
139 
143  @NotNull
144  private final Component parent;
145 
149  @NotNull
151 
156  @NotNull
158 
162  @NotNull
164 
169  @NotNull
171 
175  @NotNull
177 
181  @NotNull
182  private final FileFilter mapFileFilter;
183 
187  @NotNull
188  private final FileFilter scriptFileFilter;
189 
194  @NotNull
195  private final FaceObjects faceObjects;
196 
200  @NotNull
202 
206  @NotNull
208 
213  private final int undefinedSpellIndex;
214 
218  @NotNull
219  private final TreasureTree treasureTree;
220 
225  @NotNull
226  private final ImageIcon noFaceSquareIcon;
227 
232  @NotNull
233  private final ImageIcon unknownSquareIcon;
234 
238  @NotNull
240 
245  @NotNull
246  private final JTabbedPane tabbedPane = new JTabbedPane();
247 
248  @NotNull
249  private final FocusListener focusListener = new ScrollToVisibleFocusListener();
250 
254  @NotNull
255  private final Collection<DialogAttribute<G, A, R, ?>> dialogAttributes = new ArrayList<>();
256 
260  @Nullable
262 
267  @NotNull
269 
276  private void adjustTooltip(@Nullable final JComponent component, @NotNull final ArchetypeAttribute attribute) {
277  @NotNull final String desc = attribute.getDescription();
278  if (component != null && !desc.isEmpty()) {
279  final StringBuilder sb = new StringBuilder("<html>");
280  for (final String paragraph : PARAGRAPH_DELIMITER.split(desc)) {
281  sb.append("<p>").append(HtmlUtils.encode(paragraph)).append("</p>");
282  }
283  component.setToolTipText(sb.toString());
284  }
285  }
286 
287  @Override
288  public void visit(@NotNull final ArchetypeAttributeAnimationName archetypeAttribute) {
289  final String attributeName = archetypeAttribute.getArchetypeAttributeName();
290  final String defaultText = attributes.getAttributeString(attributeName);
292  adjustTooltip(input, archetypeAttribute);
293  final JLabel cLabel = new JLabel(archetypeAttribute.getAttributeName() + ": ");
294  adjustTooltip(cLabel, archetypeAttribute);
295  guiInfo = new GuiInfoTwoColumn<>(new DialogAttributeAnimationName<G, A, R>(archetypeAttribute, input), cLabel, input);
296  }
297 
298  @Override
299  public void visit(@NotNull final ArchetypeAttributeBitmask archetypeAttribute) {
300  final JTextArea input = new JTextArea();
301  final DialogAttributeBitmask<G, A, R> tmpAttribute = new DialogAttributeBitmask<>(archetypeAttribute, input);
302  final AttributeBitmask bitmask = archetypeTypeSet.getBitmask(archetypeAttribute.getBitmaskName());
303  if (bitmask == null) {
304  final JLabel row = new JLabel("Error: Undefined Bitmask");
305  guiInfo = new GuiInfoRow<>(tmpAttribute, row);
306  } else {
307  tmpAttribute.setBitmask(bitmask);
308  final JButton label = new JButton(new MaskChangeAL<>(archetypeAttribute.getAttributeName() + ":", tmpAttribute));
309  adjustTooltip(label, archetypeAttribute);
310  input.setBackground(parent.getBackground());
311  input.setEditable(false);
312  input.setBorder(BorderFactory.createLineBorder(Color.gray));
313  input.setText(bitmask.getText(tmpAttribute.getValue()));
314  adjustTooltip(input, archetypeAttribute);
315  tmpAttribute.setEncodedValue(attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName()));
316  guiInfo = new GuiInfoTwoColumn<>(tmpAttribute, label, input);
317  }
318  }
319 
320  @Override
321  public void visit(@NotNull final ArchetypeAttributeBool archetypeAttribute) {
322  final JCheckBox input = new JCheckBox(archetypeAttribute.getAttributeName(), attributes.getAttributeInt(archetypeAttribute.getArchetypeAttributeName()) == 1);
323  adjustTooltip(input, archetypeAttribute);
324  guiInfo = new GuiInfoRow<>(new DialogAttributeBool<G, A, R>(archetypeAttribute, input), input);
325  }
326 
327  @Override
328  public void visit(@NotNull final ArchetypeAttributeBoolSpec archetypeAttribute) {
329  final String attributeString = attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName());
330  final boolean defaultValue;
331  if (archetypeAttribute.getTrueValue().equals("0")) {
332  defaultValue = attributeString.isEmpty() || attributeString.equals("0");
333  } else {
334  defaultValue = attributeString.equals(archetypeAttribute.getTrueValue());
335  }
336  final JCheckBox input = new JCheckBox(archetypeAttribute.getAttributeName(), defaultValue);
337  adjustTooltip(input, archetypeAttribute);
338  guiInfo = new GuiInfoRow<>(new DialogAttributeBoolSpec<G, A, R>(archetypeAttribute, input), input);
339  }
340 
341  @Override
342  public void visit(@NotNull final ArchetypeAttributeFaceName archetypeAttribute) {
343  final String attributeName = archetypeAttribute.getArchetypeAttributeName();
344  final String defaultText = attributes.getAttributeString(attributeName);
345  final FaceComponent input = new FaceComponent(defaultText, faceObjects, faceObjectProviders, noFaceSquareIcon, unknownSquareIcon, archetypeAttribute.getDescription());
346  adjustTooltip(input, archetypeAttribute);
347  final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ":");
348  adjustTooltip(label, archetypeAttribute);
349  guiInfo = new GuiInfoTwoColumn<>(new DialogAttributeFaceName<G, A, R>(archetypeAttribute, input), label, input);
350  }
351 
352  @Override
353  public void visit(@NotNull final ArchetypeAttributeFixed archetypeAttribute) {
354  throw new AssertionError();
355  }
356 
357  @Override
358  public void visit(@NotNull final ArchetypeAttributeFloat archetypeAttribute) {
359  final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": ");
360  adjustTooltip(label, archetypeAttribute);
361  label.setForeground(FLOAT_COLOR);
362  final int fieldLength = archetypeAttribute.getInputLength() == 0 ? ArchetypeAttribute.TEXTFIELD_COLUMNS : archetypeAttribute.getInputLength();
363  final DecimalFormat format = new DecimalFormat("#0.0#");
364  format.setMaximumFractionDigits(10);
365  format.setGroupingUsed(false);
366  final NumberFormatter formatter = new NumberFormatter(format);
367  formatter.setValueClass(Double.class);
368  final DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter);
369  final Number value = attributes.getAttributeDouble(archetypeAttribute.getArchetypeAttributeName());
370  final JFormattedTextField input = new JFormattedTextField(factory, value);
371  input.setColumns(fieldLength);
372  adjustTooltip(input, archetypeAttribute);
373  guiInfo = new GuiInfoTwoColumn<>(new DialogAttributeFloat<G, A, R>(archetypeAttribute, input), label, input);
374  }
375 
376  @Override
377  public void visit(@NotNull final ArchetypeAttributeInt archetypeAttribute) {
378  final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": ");
379  adjustTooltip(label, archetypeAttribute);
380  label.setForeground(INT_COLOR);
381  final int fieldLength = archetypeAttribute.getInputLength() == 0 ? ArchetypeAttribute.TEXTFIELD_COLUMNS : archetypeAttribute.getInputLength();
382  final NumberFormat format = NumberFormat.getIntegerInstance();
383  format.setGroupingUsed(false);
384  final NumberFormatter formatter = new NumberFormatter(format);
385  final DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter);
386  final Number value = attributes.getAttributeInt(archetypeAttribute.getArchetypeAttributeName());
387  final JFormattedTextField input = new JFormattedTextField(factory, value);
388  input.setColumns(fieldLength);
389  adjustTooltip(input, archetypeAttribute);
390  guiInfo = new GuiInfoTwoColumn<>(new DialogAttributeInt<G, A, R>(archetypeAttribute, input), label, input);
391  }
392 
393  @Override
394  public void visit(@NotNull final ArchetypeAttributeInvSpell archetypeAttribute) {
395  final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": ");
396  adjustTooltip(label, archetypeAttribute);
397  label.setForeground(INT_COLOR);
398  final JComboBox<?> input = buildInvSpellBox(gameObjectSpells, attributes, archetypeAttribute.isOptionalSpell(), archetypeAttribute.getAttributeName());
399  adjustTooltip(input, archetypeAttribute);
400  guiInfo = new GuiInfoTwoColumn<>(new DialogAttributeInvSpell<>(archetypeAttribute.isOptionalSpell(), archetypeAttribute, input, gameObjectSpells), label, input);
401  }
402 
403  @Override
404  public void visit(@NotNull final ArchetypeAttributeList archetypeAttribute) {
405  final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": ");
406  adjustTooltip(label, archetypeAttribute);
407  label.setForeground(INT_COLOR);
408  final JComponent component;
409  final JComboBox<?> input;
410  final ArchetypeTypeList list = archetypeTypeSet.getList(archetypeAttribute.getListName());
411  if (list == null) {
412  // error: list data is missing or corrupt
413  input = new JComboBox<>();
414  component = new JLabel("Error: Undefined List");
415  } else {
416  input = buildArrayBox(list, attributes.getAttributeInt(archetypeAttribute.getArchetypeAttributeName()), archetypeAttribute.getAttributeName());
417  component = input;
418  }
419  adjustTooltip(input, archetypeAttribute);
420  guiInfo = new GuiInfoTwoColumn<>(new DialogAttributeList<G, A, R>(archetypeAttribute, input, archetypeTypeSet), label, component);
421  }
422 
423  @Override
424  public void visit(@NotNull final ArchetypeAttributeList2 archetypeAttribute) {
425  final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": ");
426  adjustTooltip(label, archetypeAttribute);
427  label.setForeground(INT_COLOR);
428  final int value = attributes.getAttributeInt(archetypeAttribute.getArchetypeAttributeName());
429 
430  final JComponent component1;
431  @Nullable final JComboBox<?> input1;
432  final ArchetypeTypeList list1 = archetypeTypeSet.getList(archetypeAttribute.getListName1());
433  if (list1 == null) {
434  // error: list data is missing or corrupt
435  input1 = new JComboBox<>();
436  component1 = new JLabel("Error: Undefined List");
437  } else {
438  input1 = buildArrayBox(list1, value & 0x0F, archetypeAttribute.getAttributeName());
439  component1 = input1;
440  }
441 
442  final JComponent component2;
443  @Nullable final JComboBox<?> input2;
444  final ArchetypeTypeList list2 = archetypeTypeSet.getList(archetypeAttribute.getListName2());
445  if (list2 == null) {
446  // error: list data is missing or corrupt
447  input2 = new JComboBox<>();
448  component2 = new JLabel("Error: Undefined List");
449  } else {
450  input2 = buildArrayBox(list2, value >> 4, archetypeAttribute.getAttributeName());
451  component2 = input2;
452  }
453 
454  adjustTooltip(input1, archetypeAttribute);
455  adjustTooltip(input2, archetypeAttribute);
456  final JComponent component = new JPanel(new GridBagLayout());
457  final GridBagConstraints gbc = new GridBagConstraints();
458  gbc.weightx = 1.0;
459  gbc.fill = GridBagConstraints.HORIZONTAL;
460  component.add(component1, gbc);
461  component.add(component2, gbc);
462  adjustTooltip(component, archetypeAttribute);
463  guiInfo = new GuiInfoTwoColumn<>(new DialogAttributeList2<G, A, R>(archetypeAttribute, input1, input2, archetypeTypeSet), label, component);
464  }
465 
466  @Override
467  public void visit(@NotNull final ArchetypeAttributeLong archetypeAttribute) {
468  final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": ");
469  adjustTooltip(label, archetypeAttribute);
470  label.setForeground(INT_COLOR);
471  final int fieldLength = archetypeAttribute.getInputLength() == 0 ? ArchetypeAttribute.TEXTFIELD_COLUMNS : archetypeAttribute.getInputLength();
472  final NumberFormat format = NumberFormat.getIntegerInstance();
473  format.setGroupingUsed(false);
474  final NumberFormatter formatter = new NumberFormatter(format);
475  final DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter);
476  final Number value = attributes.getAttributeLong(archetypeAttribute.getArchetypeAttributeName());
477  final JFormattedTextField input = new JFormattedTextField(factory, value);
478  input.setColumns(fieldLength);
479  adjustTooltip(input, archetypeAttribute);
480  guiInfo = new GuiInfoTwoColumn<>(new DialogAttributeLong<G, A, R>(archetypeAttribute, input), label, input);
481  }
482 
483  @Override
484  public void visit(@NotNull final ArchetypeAttributeMapPath archetypeAttribute) {
486  final MapFile mapFile = mapSquare == null ? null : mapSquare.getMapModel().getMapFile();
487  final File relativeReference = mapFile == null ? new File(projectSettings.getMapsDirectory(), "dummy") : mapFile.getFile();
488  final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": ");
489  adjustTooltip(label, archetypeAttribute);
490  final TilePanel tilePanel = new TilePanel(mapFileFilter, attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName()), relativeReference, projectSettings.getMapsDirectory());
491  adjustTooltip(tilePanel, archetypeAttribute);
492  guiInfo = new GuiInfoTwoColumn<>(new DialogAttributeMapPath<G, A, R>(archetypeAttribute, tilePanel), label, tilePanel);
493  }
494 
495  @Override
496  public void visit(@NotNull final ArchetypeAttributeScriptFile archetypeAttribute) {
497  final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": ");
498  adjustTooltip(label, archetypeAttribute);
499  final File mapsDirectory = projectSettings.getMapsDirectory();
500  final TilePanel tilePanel = new TilePanel(scriptFileFilter, attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName()), new File(mapsDirectory, "dummy"), mapsDirectory);
501  adjustTooltip(tilePanel, archetypeAttribute);
502  guiInfo = new GuiInfoTwoColumn<>(new DialogAttributeScriptFile<G, A, R>(archetypeAttribute, tilePanel), label, tilePanel);
503  }
504 
505  @Override
506  public void visit(@NotNull final ArchetypeAttributeSpell archetypeAttribute) {
507  final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": ");
508  adjustTooltip(label, archetypeAttribute);
509  label.setForeground(INT_COLOR);
510  final JComboBox<?> input = buildSpellBox(attributes, numberSpells, undefinedSpellIndex, false, archetypeAttribute);
511  adjustTooltip(input, archetypeAttribute);
512  guiInfo = new GuiInfoTwoColumn<>(new DialogAttributeSpell<G, A, R>(archetypeAttribute, input, numberSpells), label, input);
513  }
514 
515  @Override
516  public void visit(@NotNull final ArchetypeAttributeString archetypeAttribute) {
517  final String defaultText = attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName());
518  final JTextField input = new JTextField(defaultText, ArchetypeAttribute.TEXTFIELD_COLUMNS);
519  adjustTooltip(input, archetypeAttribute);
520  final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": ");
521  adjustTooltip(label, archetypeAttribute);
522  guiInfo = new GuiInfoTwoColumn<>(new DialogAttributeString<G, A, R>(archetypeAttribute, input), label, input);
523  }
524 
525  @Override
526  public void visit(@NotNull final ArchetypeAttributeText archetypeAttribute) {
527  final String text;
528  if (archetypeAttribute.getArchetypeAttributeName().equals("msg") && attributes instanceof GameObject) {
529  text = ((GameObject<?, ?, ?>) attributes).getMsgText(true);
530  } else {
531  text = "";
532  }
533  final SyntaxDocument document = new SyntaxDocument();
534  document.setTokenMarker(TokenMarkerFactory.createTokenMarker(archetypeAttribute.getFileExtension()));
535  final JEditTextArea input = new JEditTextArea(textAreaDefaults, document, false);
536  input.setText(text == null ? "" : text);
537  input.setCaretPosition(0);
538  input.setBorder(BorderFactory.createEmptyBorder(3, 7, 0, 0));
539  adjustTooltip(input, archetypeAttribute);
540  guiInfo = new GuiInfoGlue<>(new DialogAttributeText<G, A, R>(archetypeAttribute, input), input);
541  }
542 
543  @Override
544  public void visit(@NotNull final ArchetypeAttributeTreasure archetypeAttribute) {
545  String treasureName = attributes.getAttributeString(archetypeAttribute.getArchetypeAttributeName());
546  if (treasureName.trim().isEmpty() || treasureName.trim().equalsIgnoreCase("none")) {
547  treasureName = CFTreasureListTree.NONE_SYM;
548  }
549  final JTextField input = new JTextField(" " + treasureName, ArchetypeAttribute.TEXTFIELD_COLUMNS);
550  adjustTooltip(input, archetypeAttribute);
551  input.setEditable(false);
552  final DialogAttributeTreasure<G, A, R> tmpAttribute = new DialogAttributeTreasure<>(archetypeAttribute, input, treasureTree);
553  final JButton label = new JButton(new ViewTreasurelistAL(input, parent, treasureListTree));
554  adjustTooltip(label, archetypeAttribute);
555  guiInfo = new GuiInfoTwoColumn<>(tmpAttribute, label, input);
556  }
557 
558  @Override
559  public void visit(@NotNull final ArchetypeAttributeZSpell archetypeAttribute) {
560  final JLabel label = new JLabel(archetypeAttribute.getAttributeName() + ": ");
561  adjustTooltip(label, archetypeAttribute);
562  label.setForeground(INT_COLOR);
563  final JComboBox<?> input = buildSpellBox(attributes, numberSpells, undefinedSpellIndex, true, archetypeAttribute);
564  adjustTooltip(input, archetypeAttribute);
565  guiInfo = new GuiInfoTwoColumn<>(new DialogAttributeZSpell<G, A, R>(archetypeAttribute, input, numberSpells, undefinedSpellIndex), label, input);
566  }
567 
568  };
569 
592  public AttributesPaneBuilder(@NotNull final Attributes attributes, @NotNull final Component parent, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final CFTreasureListTree treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ProjectSettings projectSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final ImageIcon noFaceSquareIcon, @NotNull final ImageIcon unknownSquareIcon, @NotNull final TextAreaDefaults textAreaDefaults) {
593  this.attributes = attributes;
594  this.parent = parent;
595  this.archetypeTypeSet = archetypeTypeSet;
596  this.treasureListTree = treasureListTree;
597  this.faceObjectProviders = faceObjectProviders;
598  this.animationObjects = animationObjects;
599  this.projectSettings = projectSettings;
600  this.mapFileFilter = mapFileFilter;
601  this.scriptFileFilter = scriptFileFilter;
602  this.faceObjects = faceObjects;
603  this.gameObjectSpells = gameObjectSpells;
604  this.numberSpells = numberSpells;
605  this.undefinedSpellIndex = undefinedSpellIndex;
606  this.treasureTree = treasureTree;
607  this.noFaceSquareIcon = noFaceSquareIcon;
608  this.unknownSquareIcon = unknownSquareIcon;
609  this.textAreaDefaults = textAreaDefaults;
610  }
611 
616  @NotNull
617  public Component getTabbedPane() {
618  return tabbedPane;
619  }
620 
625  @NotNull
626  public Iterable<DialogAttribute<G, A, R, ?>> getDialogAttributes() {
627  return Collections.unmodifiableCollection(dialogAttributes);
628  }
629 
636  public void buildAttribute(@NotNull final Attributes attributes, @NotNull final Iterable<ArchetypeAttributeSection> archetypeType) {
637  this.attributes = attributes;
638  tabbedPane.removeAll();
639  int sectionId = 0;
640  for (final ArchetypeAttributeSection archetypeAttributeSection : archetypeType) {
641  final Component panel = makeAttributePanel(archetypeAttributeSection);
642  if (panel != null) {
643  final String sectionName = archetypeAttributeSection.getSectionName();
644  final String title;
645  if (sectionName.length() <= 1) {
646  title = sectionName;
647  } else {
648  title = sectionName.substring(0, 1).toUpperCase() + sectionName.substring(1);
649  }
650  tabbedPane.addTab(title, null, panel);
651  sectionId++;
652  }
653  }
654 
655  tabbedPane.setSelectedIndex(sectionId > 0 ? 0 : -1);
656  tabbedPane.validate();
657  }
658 
666  @Nullable
667  private Component makeAttributePanel(@NotNull final Iterable<ArchetypeAttribute> archetypeAttributeSection) {
668  int matchingAttributes = 0; // number of attributes in this section
669  boolean hasBitmask = false; // true if this section contains a bitmask attribute
670 
671  // first we check how many attributes this section has
672  for (final ArchetypeAttribute archetypeAttribute : archetypeAttributeSection) {
673  // count number of attributes
674  if (!(archetypeAttribute instanceof ArchetypeAttributeFixed)) {
675  matchingAttributes++;
676  }
677  // check for bitmask attributes
678  if (!hasBitmask && archetypeAttribute instanceof ArchetypeAttributeBitmask) {
679  hasBitmask = true;
680  }
681  }
682  if (matchingAttributes == 0) {
683  return null;
684  }
685 
686  // All attribute-"lines" go into this panel:
687  final JPanel panel = new JPanel(new GridBagLayout());
688  final Insets gbcInsets = new Insets(2, 2, 2, 2);
689 
690  final GridBagConstraints gbc = new GridBagConstraints();
691  gbc.insets = gbcInsets;
692  gbc.fill = GridBagConstraints.HORIZONTAL;
693  final Object labelGbc = gbc.clone();
694  gbc.weightx = 1.0;
695  gbc.gridwidth = GridBagConstraints.REMAINDER;
696  final Object compGbc = gbc.clone();
697  gbc.anchor = GridBagConstraints.WEST;
698  final Object rowGbc = gbc.clone();
699  gbc.fill = GridBagConstraints.BOTH;
700  gbc.gridwidth = 2;
701  gbc.weighty = 1.0;
702  final Object glueGbc = gbc.clone();
703 
704  boolean hasGlue = false;
705  // now add the entries, line by line
706  for (final ArchetypeAttribute archetypeAttribute : archetypeAttributeSection) {
707  if (!(archetypeAttribute instanceof ArchetypeAttributeFixed)) {
708  guiInfo = null;
709  archetypeAttribute.visit(archetypeAttributeVisitor);
710  final GuiInfo<G, A, R, ?> tmpGuiInfo = guiInfo;
711  assert tmpGuiInfo != null;
712 
713  dialogAttributes.add(tmpGuiInfo.getAttribute());
714  addElement(panel, tmpGuiInfo.getLabel(), labelGbc);
715  addElement(panel, tmpGuiInfo.getComponent(), compGbc);
716  addElement(panel, tmpGuiInfo.getRow(), rowGbc);
717  addElement(panel, tmpGuiInfo.getGlue(), glueGbc);
718  hasGlue |= tmpGuiInfo.getGlue() != null;
719  }
720  }
721 
722  if (!hasGlue) {
723  // if the component does not already have glue, put glue inside to align its contents to the top.
724  panel.add(Box.createGlue(), glueGbc);
725  }
726  final JScrollPane panelReturn = new JScrollPane(panel);
727  panelReturn.getVerticalScrollBar().setUnitIncrement(8);
728  return panelReturn;
729  }
730 
737  private void addElement(@NotNull final Container container, @Nullable final Component component, @NotNull final Object constraints) {
738  if (component != null) {
739  container.add(component, constraints);
740  component.addFocusListener(focusListener);
741  }
742  }
743 
752  @NotNull
753  private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> JComboBox<?> buildInvSpellBox(@NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Attributes attributes, final boolean isOptionalSpell, @NotNull final String attributeName) {
754  if (!(attributes instanceof BaseObject)) {
755  throw new IllegalArgumentException("attributes class must extend BaseObject: " + attributes.getClass().getName());
756  }
758  final int selectedIndex;
759  @Nullable final String title;
760  switch (baseObject.countInvObjects()) {
761  case 0:
762  selectedIndex = gameObjectSpells.size();
763  title = isOptionalSpell ? null : "<none>";
764  break;
765 
766  default:
767  selectedIndex = gameObjectSpells.size() + (isOptionalSpell ? 1 : 0);
768  title = "<multiple>";
769  break;
770 
771  case 1:
772  final GameObject<?, ?, ?> invObject = baseObject.iterator().next();
773  final String invObjectArchetypeName = invObject.getArchetype().getArchetypeName();
774  int index = 0;
775  @Nullable String tmpTitle = "<customized spell>";
776  for (final GameObjectSpell<?, ?, ?> spellObject : gameObjectSpells) {
777  if (invObjectArchetypeName.equals(spellObject.getArchetypeName())) {
778  tmpTitle = invObject.isDefaultGameObject() ? null : spellObject.getName() + " <customized>";
779  break;
780  }
781  index++;
782  }
783  selectedIndex = tmpTitle == null ? index : gameObjectSpells.size() + (isOptionalSpell ? 1 : 0);
784  title = tmpTitle;
785  break;
786  }
787 
788  final DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>();
789  for (final Spell spell : gameObjectSpells) {
790  model.addElement(spell.getName());
791  }
792  if (isOptionalSpell) {
793  model.addElement("<none>");
794  }
795  if (title != null) {
796  model.addElement(title);
797  }
798  final JComboBox<?> comboBox = new JComboBox<>(model);
799  comboBox.setSelectedIndex(selectedIndex);
800  comboBox.setMaximumRowCount(10);
801  comboBox.setKeySelectionManager(new StringKeyManager(comboBox));
802  comboBox.setName(attributeName);
803  return comboBox;
804  }
805 
813  @NotNull
814  private static JComboBox<?> buildArrayBox(@NotNull final ArchetypeTypeList listData, final int value, @NotNull final String attributeName) {
815  final String[] array = new String[listData.size()];
816  boolean hasSelection = false;
817  int selectedIndex = 0;
818  for (int i = 0; i < array.length; i++) {
819  array[i] = listData.get(i).getSecond();
820  if (!hasSelection && listData.get(i).getFirst() == value) {
821  hasSelection = true;
822  selectedIndex = i;
823  }
824  }
825  final JComboBox<?> comboBox = new JComboBox<>(array);
826  comboBox.setSelectedIndex(selectedIndex);
827  comboBox.setMaximumRowCount(10);
828  comboBox.setKeySelectionManager(new StringKeyManager(comboBox));
829  comboBox.setName(attributeName);
830  return comboBox;
831  }
832 
842  @NotNull
843  private static JComboBox<?> buildSpellBox(@NotNull final Attributes attributes, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, final boolean isZSpell, @NotNull final ArchetypeAttribute archetypeAttribute) {
844  int spellNumber = attributes.getAttributeInt(archetypeAttribute.getArchetypeAttributeName());
845 
846  if (spellNumber < 0 || spellNumber >= numberSpells.size()) {
847  spellNumber = undefinedSpellIndex;
848  }
849 
850  final int selectedIndex;
851  if (spellNumber == undefinedSpellIndex && isZSpell) {
852  selectedIndex = 0;
853  } else {
854  selectedIndex = 1 + AbstractArchetypeAttributeSpell.findSpellIndex(numberSpells, spellNumber);
855  }
856 
857  final DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>();
858  model.addElement("<none>");
859  for (final Spell spell : numberSpells) {
860  model.addElement(spell.getName());
861  }
862  final JComboBox<?> comboBox = new JComboBox<>(model);
863  comboBox.setSelectedIndex(selectedIndex);
864  comboBox.setMaximumRowCount(10);
865  comboBox.setKeySelectionManager(new StringKeyManager(comboBox));
866  comboBox.setName(archetypeAttribute.getAttributeName());
867  return comboBox;
868  }
869 
870 }
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeList
Definition: DialogAttributeList.java:33
net.sf.gridarta.model.archetypetype
Defines types of GameObjects with corresponding attributes.
Definition: AbstractArchetypeAttributeInvSpell.java:20
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.guiInfo
GuiInfo< G, A, R, ?> guiInfo
The return value for archetypeAttributeVisitor.
Definition: AttributesPaneBuilder.java:261
net.sf.gridarta.textedit.textarea.TextAreaDefaults
Encapsulates default settings for a text area.
Definition: TextAreaDefaults.java:26
net.sf.gridarta.model.archetypetype.ArchetypeTypeSet.getList
ArchetypeTypeList getList(@NotNull final String listName)
Returns a list type definition.
Definition: ArchetypeTypeSet.java:202
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeText
Definition: DialogAttributeText.java:33
net.sf.gridarta.model.archetypetype.ArchetypeAttributeAnimationName
An ArchetypeAttribute for selecting animation names.
Definition: ArchetypeAttributeAnimationName.java:29
net.sf.gridarta.textedit.textarea.JEditTextArea
jEdit's text area component.
Definition: JEditTextArea.java:91
net.sf.gridarta.gui.utils.FaceComponent
A JPanel that allows the user to select a face name.
Definition: FaceComponent.java:41
net.sf.gridarta.model.archetypetype.ArchetypeAttributeVisitor
Interface for visitors of ArchetypeAttributes.
Definition: ArchetypeAttributeVisitor.java:28
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.faceObjects
final FaceObjects faceObjects
The FaceObjects instance for choosing face names.
Definition: AttributesPaneBuilder.java:195
net.sf.gridarta.model.baseobject.Attributes.getAttributeLong
long getAttributeLong(@NotNull String attributeName)
Returns an attribute value of this Archetype as long.
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeInvSpell
Definition: DialogAttributeInvSpell.java:34
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.buildAttribute
void buildAttribute(@NotNull final Attributes attributes, @NotNull final Iterable< ArchetypeAttributeSection > archetypeType)
Constructs the central part of the attribute dialog, containing the object's attributes.
Definition: AttributesPaneBuilder.java:636
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeInt
Definition: DialogAttributeInt.java:32
net.sf.gridarta.gui.dialog.gameobjectattributes.StringKeyManager
KeySelectionManager to manage the select-per-keystroke in a JComboBox (The default KeySelectionManage...
Definition: StringKeyManager.java:35
net.sf.gridarta.textedit.textarea
This package contains the other part of the script editor.
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.gameObjectSpells
final Spells< GameObjectSpell< G, A, R > > gameObjectSpells
The game object spells to use.
Definition: AttributesPaneBuilder.java:201
net.sf.gridarta
Base package of all Gridarta classes.
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.archetypeAttributeVisitor
final ArchetypeAttributeVisitor archetypeAttributeVisitor
The ArchetypeAttributeVisitor for creating GUI elements for ArchetypeAttributes.
Definition: AttributesPaneBuilder.java:268
net.sf.gridarta.model.mapmodel.MapSquare
A single Map Square.
Definition: MapSquare.java:45
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.buildSpellBox
static JComboBox<?> buildSpellBox(@NotNull final Attributes attributes, @NotNull final Spells< NumberSpell > numberSpells, final int undefinedSpellIndex, final boolean isZSpell, @NotNull final ArchetypeAttribute archetypeAttribute)
Constructs the combo box of the available spells.
Definition: AttributesPaneBuilder.java:843
net.sf.gridarta.model.anim.AnimationObjects
AnimationObjects is a container for AnimationObjects.
Definition: AnimationObjects.java:30
net.sf.gridarta.gui.dialog.gameobjectattributes.GuiInfoRow
A GuiInfo that fills one component horizontally.
Definition: GuiInfoRow.java:34
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.projectSettings
final ProjectSettings projectSettings
The ProjectSettings instance.
Definition: AttributesPaneBuilder.java:176
net.sf.gridarta.model.archetypetype.ArchetypeAttributeFloat
An ArchetypeAttribute for selecting floating point values.
Definition: ArchetypeAttributeFloat.java:29
net.sf.gridarta.model.spells.GameObjectSpell
Describes a numbered in-game spell.
Definition: GameObjectSpell.java:33
net.sf
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.scriptFileFilter
final FileFilter scriptFileFilter
The FileFilter to use for script files.
Definition: AttributesPaneBuilder.java:188
net.sf.gridarta.model.mapmodel
Definition: AboveFloorInsertionMode.java:20
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.buildInvSpellBox
static< G extends GameObject< G, A, R > A extends R extends Archetype< G, A, R > JComboBox<?> buildInvSpellBox(@NotNull final Spells< GameObjectSpell< G, A, R >> gameObjectSpells, @NotNull final Attributes attributes, final boolean isOptionalSpell, @NotNull final String attributeName)
Definition: AttributesPaneBuilder.java:753
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeBoolSpec
Definition: DialogAttributeBoolSpec.java:34
net.sf.gridarta.utils.HtmlUtils
Utility class for HTML related functions.
Definition: HtmlUtils.java:28
net.sf.gridarta.gui.dialog.gameobjectattributes.GuiInfo.getRow
abstract Component getRow()
Returns the row component to display filled horizontally or.
net.sf.gridarta.model.archetypetype.AbstractArchetypeAttributeSpell.findSpellIndex
static int findSpellIndex(@NotNull final Spells< NumberSpell > numberSpells, final int number)
Returns the spell index for a spell number.
Definition: AbstractArchetypeAttributeSpell.java:50
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.INT_COLOR
static final Color INT_COLOR
Color for int values.
Definition: AttributesPaneBuilder.java:125
net.sf.gridarta.model.archetypetype.AttributeBitmask.getText
String getText(final int value)
Generate the text to be displayed for a given bitmask value.
Definition: AttributeBitmask.java:102
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.addElement
void addElement(@NotNull final Container container, @Nullable final Component component, @NotNull final Object constraints)
Adds a Component to a Container.
Definition: AttributesPaneBuilder.java:737
net.sf.gridarta.model.archetype
Definition: AbstractArchetype.java:20
net.sf.gridarta.model.face.FaceObjectProviders
Provider for faces of GameObjects and Archetypes.
Definition: FaceObjectProviders.java:46
net.sf.gridarta.model.archetypetype.ArchetypeAttributeLong
An ArchetypeAttribute for selecting long integer values.
Definition: ArchetypeAttributeLong.java:29
net.sf.gridarta.model.gameobject.GameObject
Reflects a game object (object on a map).
Definition: GameObject.java:36
net.sf.gridarta.var.crossfire.model.gameobject.GameObject.isDefaultGameObject
boolean isDefaultGameObject()
Definition: GameObject.java:121
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeBool
Definition: DialogAttributeBool.java:34
net.sf.gridarta.textedit
net.sf.gridarta.model.baseobject.Attributes.getAttributeString
String getAttributeString(@NotNull String attributeName)
Returns the requested attribute value of this GameObject as {}.
net.sf.gridarta.model.archetypetype.ArchetypeTypeSet
Manages ArchetypeType instances, list, and bitmask definitions.
Definition: ArchetypeTypeSet.java:40
net.sf.gridarta.gui.dialog.gameobjectattributes.GuiInfoTwoColumn
A GuiInfo that displays a label and another component in two columns.
Definition: GuiInfoTwoColumn.java:35
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.mapFileFilter
final FileFilter mapFileFilter
The FileFilter to use for map files.
Definition: AttributesPaneBuilder.java:182
net.sf.gridarta.textedit.textarea.SyntaxDocument
A document implementation that can be tokenized by the syntax highlighting system.
Definition: SyntaxDocument.java:29
net.sf.gridarta.gui
Graphical User Interface of Gridarta.
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.getTabbedPane
Component getTabbedPane()
Returns the JTabbedPane that contains all attribute tabs.
Definition: AttributesPaneBuilder.java:617
net.sf.gridarta.model.archetypetype.ArchetypeAttributeBool
An ArchetypeAttribute for selecting boolean values.
Definition: ArchetypeAttributeBool.java:29
net.sf.gridarta.gui.utils.AnimationComponent
A JPanel that allows the user to select an animation name.
Definition: AnimationComponent.java:41
net.sf.gridarta.gui.dialog.gameobjectattributes.GuiInfo.getComponent
abstract Component getComponent()
Returns the component to display in the second column or.
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeTreasure
Definition: DialogAttributeTreasure.java:36
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder
Builder for game object attribute panels.
Definition: AttributesPaneBuilder.java:113
net.sf.gridarta.model.baseobject.Attributes
A set of key/value pairs.
Definition: Attributes.java:28
net.sf.gridarta.model.archetypetype.ArchetypeTypeList
A list definition.
Definition: ArchetypeTypeList.java:33
net.sf.gridarta.utils.HtmlUtils.encode
static String encode(@NotNull final String str)
Encodes a string so that the result can be embedded into HTML.
Definition: HtmlUtils.java:53
net.sf.gridarta.model.gameobject
GameObjects are the objects based on Archetypes found on maps.
Definition: AbstractGameObject.java:20
net.sf.gridarta.textedit.textarea.tokenmarker
Definition: CrossfireDialogTokenMarker.java:20
net
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.treasureListTree
final CFTreasureListTree treasureListTree
The CFTreasureListTree to use.
Definition: AttributesPaneBuilder.java:157
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.AttributesPaneBuilder
AttributesPaneBuilder(@NotNull final Attributes attributes, @NotNull final Component parent, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final CFTreasureListTree treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ProjectSettings projectSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells< GameObjectSpell< G, A, R >> gameObjectSpells, @NotNull final Spells< NumberSpell > numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final ImageIcon noFaceSquareIcon, @NotNull final ImageIcon unknownSquareIcon, @NotNull final TextAreaDefaults textAreaDefaults)
Creates a new instance.
Definition: AttributesPaneBuilder.java:592
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.makeAttributePanel
Component makeAttributePanel(@NotNull final Iterable< ArchetypeAttribute > archetypeAttributeSection)
This method creates an attribute panel for one section of attributes.
Definition: AttributesPaneBuilder.java:667
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeFloat
Definition: DialogAttributeFloat.java:32
net.sf.gridarta.gui.dialog.gameobjectattributes.MaskChangeAL
ActionListener for the change buttons of bitmasks.
Definition: MaskChangeAL.java:45
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeLong
Definition: DialogAttributeLong.java:32
net.sf.gridarta.model.archetypetype.ArchetypeAttributeList
An ArchetypeAttribute for selecting a value from a list.
Definition: ArchetypeAttributeList.java:29
net.sf.gridarta.model.archetypetype.AttributeBitmask
This class manages bitmask values which appear in Gridarta archetype attributes.
Definition: AttributeBitmask.java:42
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeList2
A DialogAttribute for ArchetypeAttributeList2.
Definition: DialogAttributeList2.java:37
net.sf.gridarta.model.archetypetype.ArchetypeAttributeBoolSpec
An ArchetypeAttribute for selecting boolean values having specific "true" and "false" values.
Definition: ArchetypeAttributeBoolSpec.java:30
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeBitmask.getValue
int getValue()
Get the active bitmask value.
Definition: DialogAttributeBitmask.java:108
net.sf.gridarta.model.archetypetype.ArchetypeAttribute
This Class contains the data of one archetype attribute.
Definition: ArchetypeAttribute.java:28
net.sf.gridarta.model.archetypetype.ArchetypeAttributeMapPath
An ArchetypeAttribute for selecting map path names.
Definition: ArchetypeAttributeMapPath.java:29
net.sf.gridarta.model.treasurelist.TreasureTree
Stores all defined treasure lists.
Definition: TreasureTree.java:32
net.sf.gridarta.gui.dialog.gameobjectattributes.ViewTreasurelistAL
An Action for the buttons on treasurelists.
Definition: ViewTreasurelistAL.java:34
list
This document describes some hints and requirements for general development on the CrossfireEditor If you plan to make changes to the editor code or setup please read the following and keep it in derived from a basic editor application called Gridder by Pasi Ker�nen so please communicate with best through the cf devel mailing list
Definition: Developer_README.txt:13
net.sf.gridarta.model.maparchobject.MapArchObject
Interface for MapArchObjects.
Definition: MapArchObject.java:40
net.sf.gridarta.model.baseobject.Attributes.getAttributeDouble
double getAttributeDouble(@NotNull String attributeName)
Returns an attribute value of this Archetype as double.
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.animationObjects
final AnimationObjects animationObjects
The AnimationObjects instance for choosing animation names.
Definition: AttributesPaneBuilder.java:170
net.sf.gridarta.model.archetypetype.ArchetypeAttributeInvSpell
An ArchetypeAttribute for selecting a spell encoded as an inventory game object.
Definition: ArchetypeAttributeInvSpell.java:30
net.sf.gridarta.textedit.textarea.tokenmarker.TokenMarkerFactory.createTokenMarker
static TokenMarker createTokenMarker(@Nullable final File file)
Creates a suitable TokenMarker for a given file.
Definition: TokenMarkerFactory.java:80
net.sf.gridarta.model.spells.NumberSpell
Describes a numbered in-game spell.
Definition: NumberSpell.java:28
net.sf.gridarta.model.mapmodel.MapFile.getFile
File getFile()
Returns a File for this map file.
Definition: MapFile.java:102
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.numberSpells
final Spells< NumberSpell > numberSpells
The numbered spells.
Definition: AttributesPaneBuilder.java:207
net.sf.gridarta.textedit.textarea.JEditTextArea.setCaretPosition
void setCaretPosition(final int caret)
Sets the caret position.
Definition: JEditTextArea.java:631
net.sf.gridarta.model.face.FaceObjects
FaceObjects is a container for FaceObjects.
Definition: FaceObjects.java:31
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.buildArrayBox
static JComboBox<?> buildArrayBox(@NotNull final ArchetypeTypeList listData, final int value, @NotNull final String attributeName)
Constructs the combo box for arrays of "list data".
Definition: AttributesPaneBuilder.java:814
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.archetypeTypeSet
final ArchetypeTypeSet archetypeTypeSet
Reference to the ArchetypeTypeSet.
Definition: AttributesPaneBuilder.java:150
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.faceObjectProviders
final FaceObjectProviders faceObjectProviders
The FaceObjectProviders for looking up faces.
Definition: AttributesPaneBuilder.java:163
net.sf.gridarta.model.archetypetype.ArchetypeAttribute.TEXTFIELD_COLUMNS
static final int TEXTFIELD_COLUMNS
The width (columns) for input fields like textfields or JChooseBoxes.
Definition: ArchetypeAttribute.java:33
net.sf.gridarta.model.archetypetype.ArchetypeAttributeTreasure
An ArchetypeAttribute representing a treasurelist.
Definition: ArchetypeAttributeTreasure.java:29
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.undefinedSpellIndex
final int undefinedSpellIndex
The index for "no spell".
Definition: AttributesPaneBuilder.java:213
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeZSpell
Definition: DialogAttributeZSpell.java:34
net.sf.gridarta.gui.dialog.gameobjectattributes.GuiInfo.getGlue
abstract Component getGlue()
Returns the glue component to display filled both horizontally and vertically or.
net.sf.gridarta.model.spells.Spell
Describes an in-game spell.
Definition: Spell.java:28
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.PARAGRAPH_DELIMITER
static final Pattern PARAGRAPH_DELIMITER
A Pattern that matches one or more NL characters.
Definition: AttributesPaneBuilder.java:131
net.sf.gridarta.model.baseobject.BaseObject
Definition: BaseObject.java:34
net.sf.gridarta.model.mapmodel.MapFile
The location of a map file with a map directory.
Definition: MapFile.java:31
net.sf.gridarta.model.archetypetype.ArchetypeAttributeString
An ArchetypeAttribute for selecting string values.
Definition: ArchetypeAttributeString.java:29
net.sf.gridarta.gui.dialog.gameobjectattributes.ScrollToVisibleFocusListener
Definition: ScrollToVisibleFocusListener.java:28
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeAnimationName
Definition: DialogAttributeAnimationName.java:32
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.textAreaDefaults
final TextAreaDefaults textAreaDefaults
The TextAreaDefaults for text fields.
Definition: AttributesPaneBuilder.java:239
net.sf.gridarta.model.archetypetype.ArchetypeAttributeInt
An ArchetypeAttribute for selecting integer values.
Definition: ArchetypeAttributeInt.java:29
net.sf.gridarta.model.settings.ProjectSettings
Settings that apply to a project.
Definition: ProjectSettings.java:29
net.sf.gridarta.model.baseobject.Attributes.getAttributeInt
int getAttributeInt(@NotNull String attributeName)
Returns an attribute value of this Archetype as int.
net.sf.gridarta.model.mapmodel.MapSquare.getMapModel
MapModel< G, A, R > getMapModel()
Returns the MapModel this map square is part of.
Definition: MapSquare.java:99
net.sf.gridarta.model.spells
Definition: ArchetypeSetSpellLoader.java:20
net.sf.gridarta.gui.treasurelist.CFTreasureListTree.NONE_SYM
static final String NONE_SYM
The string displayed in attribute dialog for "none".
Definition: CFTreasureListTree.java:67
net.sf.gridarta.gui.dialog.gameobjectattributes.GuiInfo.getAttribute
DialogAttribute< G, A, R, T > getAttribute()
Returns the DialogAttribute this entry represents.
Definition: GuiInfo.java:55
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeString
Definition: DialogAttributeString.java:34
net.sf.gridarta.model.archetypetype.ArchetypeAttributeSection
A set of ArchetypeAttributes.
Definition: ArchetypeAttributeSection.java:32
net.sf.gridarta.model.gameobject.GameObject.getMapSquareOptional
MapSquare< G, A, R > getMapSquareOptional()
Returns the MapSquare this game object is part of.
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.FLOAT_COLOR
static final Color FLOAT_COLOR
Color for float values.
Definition: AttributesPaneBuilder.java:119
net.sf.gridarta.model
net.sf.gridarta.model.archetype.Archetype
Reflects an Archetype.
Definition: Archetype.java:41
net.sf.gridarta.model.archetypetype.ArchetypeAttributeList2
An ArchetypeAttribute for selecting a value from two lists.
Definition: ArchetypeAttributeList2.java:28
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeScriptFile
Definition: DialogAttributeScriptFile.java:32
net.sf.gridarta.gui.dialog.gameobjectattributes.GuiInfo.getLabel
abstract Component getLabel()
Returns the label to display in the first column or.
net.sf.gridarta.model.baseobject
Definition: AbstractBaseObject.java:20
net.sf.gridarta.gui.map
Base classes for rendering maps.
Definition: AbstractPerMapDialogManager.java:20
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeMapPath
Definition: DialogAttributeMapPath.java:32
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.unknownSquareIcon
final ImageIcon unknownSquareIcon
The ImageIcon for undefined animations.
Definition: AttributesPaneBuilder.java:233
net.sf.gridarta.model.face
The face is the appearance of an object.
Definition: AbstractFaceObjects.java:20
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.noFaceSquareIcon
final ImageIcon noFaceSquareIcon
The ImageIcon for no animations.
Definition: AttributesPaneBuilder.java:226
net.sf.gridarta.model.anim
Gridarta can handle frame information of animations and allow the selection of an animation using a t...
Definition: AbstractAnimationObjects.java:20
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.getDialogAttributes
Iterable< DialogAttribute< G, A, R, ?> > getDialogAttributes()
Returns all DialogAttributes in the dialog.
Definition: AttributesPaneBuilder.java:626
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeFaceName
Definition: DialogAttributeFaceName.java:32
net.sf.gridarta.var.crossfire.model.gameobject.GameObject<?, ?, ?>
net.sf.gridarta.model.archetypetype.ArchetypeAttributeFixed
An ArchetypeAttribute displaying a fixed string.
Definition: ArchetypeAttributeFixed.java:29
net.sf.gridarta.model.archetypetype.ArchetypeAttributeScriptFile
An ArchetypeAttribute for selecting script files.
Definition: ArchetypeAttributeScriptFile.java:29
net.sf.gridarta.model.archetypetype.ArchetypeAttributeSpell
An ArchetypeAttribute for selecting spells encoded as in integer attribute.
Definition: ArchetypeAttributeSpell.java:30
net.sf.gridarta.model.archetypetype.ArchetypeTypeSet.getBitmask
AttributeBitmask getBitmask(@NotNull final String bitmaskName)
Returns a bitmask type by name.
Definition: ArchetypeTypeSet.java:221
net.sf.gridarta.textedit.textarea.SyntaxDocument.setTokenMarker
void setTokenMarker(@Nullable final TokenMarker tokenMarker)
Sets the token marker that is to be used to split lines of this document up into tokens.
Definition: SyntaxDocument.java:52
net.sf.gridarta.model.maparchobject
Definition: AbstractMapArchObject.java:20
net.sf.gridarta.model.archetypetype.ArchetypeAttributeBitmask
An ArchetypeAttribute for selecting bitmask values.
Definition: ArchetypeAttributeBitmask.java:29
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.attributes
Attributes attributes
The game object being modified.
Definition: AttributesPaneBuilder.java:138
net.sf.gridarta.model.archetypetype.ArchetypeAttributeText
An ArchetypeAttribute for selecting text fields.
Definition: ArchetypeAttributeText.java:30
net.sf.gridarta.model.archetypetype.AbstractArchetypeAttributeSpell
Abstract base class for ArchetypeAttributes for spells.
Definition: AbstractArchetypeAttributeSpell.java:31
net.sf.gridarta.gui.utils
Definition: AnimationComponent.java:20
net.sf.gridarta.model.settings.ProjectSettings.getMapsDirectory
File getMapsDirectory()
Returns the default maps directory.
net.sf.gridarta.textedit.textarea.tokenmarker.TokenMarkerFactory
A factory for creatingTokenMarker instances for Files.
Definition: TokenMarkerFactory.java:32
net.sf.gridarta.model.mapmodel.MapModel.getMapFile
MapFile getMapFile()
Returns the map file.
net.sf.gridarta.model.baseobject.BaseObject.countInvObjects
int countInvObjects()
Counts the number of all inventory items (recursively).
net.sf.gridarta.model.spells.Spells
Common base class for spells and spell lists.
Definition: Spells.java:33
net.sf.gridarta.gui.treasurelist
Definition: CFTreasureListTree.java:20
net.sf.gridarta.model.treasurelist
Definition: ArchTreasureObj.java:20
net.sf.gridarta.gui.dialog.gameobjectattributes.GuiInfoGlue
A GuiInfo that fills one component both horizontally and vertically.
Definition: GuiInfoGlue.java:34
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeSpell
Definition: DialogAttributeSpell.java:34
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.parent
final Component parent
The parent component for dialogs.
Definition: AttributesPaneBuilder.java:144
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.treasureTree
final TreasureTree treasureTree
The TreasureTree to use.
Definition: AttributesPaneBuilder.java:219
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.dialogAttributes
final Collection< DialogAttribute< G, A, R, ?> > dialogAttributes
All DialogAttributes in the dialog.
Definition: AttributesPaneBuilder.java:255
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.tabbedPane
final JTabbedPane tabbedPane
The central tabbed pane (the place where all the attribute tabs are).
Definition: AttributesPaneBuilder.java:246
net.sf.gridarta.utils
Definition: ActionBuilderUtils.java:20
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeBitmask.setEncodedValue
void setEncodedValue(@NotNull final String encodedValue)
Set the active bitmask value in external file representation.
Definition: DialogAttributeBitmask.java:139
net.sf.gridarta.gui.treasurelist.CFTreasureListTree
The CFTreasureListTree class fully manages treasurelists.
Definition: CFTreasureListTree.java:61
net.sf.gridarta.model.settings
Definition: AbstractDefaultProjectSettings.java:20
net.sf.gridarta.model.archetypetype.ArchetypeAttributeZSpell
An ArchetypeAttribute for selecting an optional spell encoded as an integer attribute.
Definition: ArchetypeAttributeZSpell.java:30
net.sf.gridarta.gui.map.maptilepane
Definition: AbstractMapTilePane.java:20
net.sf.gridarta.textedit.textarea.JEditTextArea.setText
void setText(@NotNull final String text)
Sets the entire text of this text area.
Definition: JEditTextArea.java:550
net.sf.gridarta.gui.map.maptilepane.TilePanel
A tile panel displays exactly one direction for map tiling.
Definition: TilePanel.java:52
net.sf.gridarta.gui.dialog.gameobjectattributes.AttributesPaneBuilder.focusListener
final FocusListener focusListener
Definition: AttributesPaneBuilder.java:249
net.sf.gridarta.model.archetypetype.ArchetypeAttributeFaceName
An ArchetypeAttribute for selecting face names.
Definition: ArchetypeAttributeFaceName.java:29
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeBitmask< G, A, R >
net.sf.gridarta.gui.dialog.gameobjectattributes.GuiInfo< G, A, R, ?>
net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeBitmask.setBitmask
void setBitmask(@Nullable final AttributeBitmask bitmask)
Definition: DialogAttributeBitmask.java:149