20 package net.sf.gridarta.gui.dialog.plugin.parameter.archetype;
22 import java.awt.Dimension;
23 import java.awt.event.ItemEvent;
24 import java.awt.event.ItemListener;
25 import javax.swing.JComboBox;
26 import javax.swing.JComponent;
27 import javax.swing.JPanel;
37 import org.jetbrains.annotations.NotNull;
48 private final JComboBox<Archetype<G, A, R>>
value =
new JComboBox<>();
55 private final JComponent
config =
new JPanel();
69 public ArchetypeParameterView(@NotNull
final ArchetypeParameter<G, A, R> parameter, @NotNull
final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull
final ArchetypeSet<G, A, R> archetypeSet, @NotNull
final ObjectChooser<G, A, R> objectChooser, @NotNull
final FaceObjectProviders faceObjectProviders) {
72 value.setMaximumRowCount(4);
74 value.setModel(archComboBoxModel);
75 value.setEditable(
true);
76 value.setEditor(archComboBoxEditor);
77 value.setPreferredSize(
new Dimension(value.getPreferredSize().width, archComboBoxEditor.getEditorComponent().getPreferredSize().height));
78 value.setSelectedItem(parameter.getValueOrNull());
79 value.addItemListener(
new ItemListener() {
82 public void itemStateChanged(
final ItemEvent e) {
83 if (e.getStateChange() == ItemEvent.SELECTED) {
Graphical User Interface of Gridarta.
A PluginParameterView for an ArchetypeParameter.
JComponent getConfigComponent()
Returns a JComponent for editing the parameter configuration.
String getArchetypeName()
Returns the name of this archetype.
Interface for views that display plugin parameters.
final JComboBox< Archetype< G, A, R > > value
The component for editing the parameter's value.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
GameObjects are the objects based on Archetypes found on maps.
A PluginParameter that holds an Archetype value.
The model of the game object attributes dialog.
ArchetypeParameterView(@NotNull final ArchetypeParameter< G, A, R > parameter, @NotNull final GameObjectAttributesModel< G, A, R > gameObjectAttributesModel, @NotNull final ArchetypeSet< G, A, R > archetypeSet, @NotNull final ObjectChooser< G, A, R > objectChooser, @NotNull final FaceObjectProviders faceObjectProviders)
Creates a new instance.
final JComponent config
The component for editing the parameter's configuration.
Provider for faces of GameObjects and Archetypes.
The face is the appearance of an object.
Interface that captures similarities between different ArchetypeSet implementations.
Common base interface for ObjectChoosers.
JComponent getValueComponent()
Returns a JComponent for editing the parameter value.
Interface for MapArchObjects.