public class ArchetypeChooserControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends java.lang.Object implements java.lang.Iterable<R>, ObjectChooserTab<G,A,R>
Constructor and Description |
---|
ArchetypeChooserControl(ArchetypeChooserModel<G,A,R> archetypeChooserModel,
ArchetypeChooserView<G,A,R> archetypeChooserView)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Component |
getComponent()
Returns the component to show in the object chooser.
|
R |
getSelection()
Returns the selected game object.
|
java.util.List<R> |
getSelections()
Returns the selected game objects.
|
java.lang.String |
getTitle()
Returns the title to display in the object chooser.
|
boolean |
isMatching(G gameObject)
Returns whether the current selection matches the given game object.
|
java.util.Iterator<R> |
iterator()
Returns all archetypes in the panel.
|
void |
selectArchetype(R archetype)
Select an archetype.
|
void |
setActive(boolean active)
Called whenever this tab becomes active or inactive.
|
public ArchetypeChooserControl(@NotNull ArchetypeChooserModel<G,A,R> archetypeChooserModel, @NotNull ArchetypeChooserView<G,A,R> archetypeChooserView)
archetypeChooserModel
- the archetype chooser model to use; no new
archetypes must be added afterwardsarchetypeChooserView
- the archetype chooser view to usepublic void selectArchetype(@NotNull R archetype)
archetype
- the archetype to select@NotNull public java.util.Iterator<R> iterator()
@NotNull public java.awt.Component getComponent()
getComponent
in interface ObjectChooserTab<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public void setActive(boolean active)
setActive
in interface ObjectChooserTab<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
active
- whether this tab is activepublic boolean isMatching(@NotNull G gameObject)
isMatching
in interface ObjectChooserTab<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
gameObject
- the game object to compare to@Nullable public R getSelection()
getSelection
in interface ObjectChooserTab<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
null
if no game
objects are selected@NotNull public java.util.List<R> getSelections()
getSelections
in interface ObjectChooserTab<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
@NotNull public java.lang.String getTitle()
getTitle
in interface ObjectChooserTab<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>