MCPcopy Create free account
hub / github.com/PCGen/pcgen / CharacterInfoTab

Interface CharacterInfoTab

code/src/java/pcgen/gui2/tabs/CharacterInfoTab.java:57–123  ·  view source on GitHub ↗

This interface must be implemented by all tabs that display character information: summary tab, classes tab, abilities tab, inventory tab, etc.... The goal of this class is to create a separation of UI models and the UI components that use them. By doing this, knowledge of the CharacterFacade can be

Source from the content-addressed store, hash-verified

55 * that would occur to any state would be in a call to {@code storeModels}.
56 */
57public interface CharacterInfoTab
58{
59
60 /**
61 * This gives the CharacterInfoTab a chance to store the models that it will
62 * use for a given character into a Hashtable. This returned Hashtable will
63 * be used as arguments in storeModels(Hashtable) and
64 * restoreModels(Hashtable).
65 * <p>
66 * Note: Character tabs implementing this method should <b>NOT</b> make any
67 * changes to its UI components, this method is purely meant to create
68 * models and making changes to the UI components could produce undesirable
69 * side effects.
70 *
71 * @param character the character that this state is for.
72 * @return a ModelMap containing the UI models created for this character
73 */
74 public ModelMap createModels(CharacterFacade character);
75
76 /**
77 * This restores this character tab to a state that contains the models for
78 * some given character. The models in question were created during the call
79 * to {@code createModels(CharacterFacade)} When this is called the tab
80 * should attach the models contained within this state to the UI components
81 * of this tab.
82 *
83 * @param models a ModelMap containing the models for this character
84 */
85 public void restoreModels(ModelMap models);
86
87 /**
88 * This is called to save any character specific info that might have
89 * changed since {@code restoreModels} was called. Implementors might
90 * also use this method to detach non swappable models from the UI
91 * components, i.e. listeners.
92 *
93 * @param models a ModelMap that contains the models for some character
94 */
95 public void storeModels(ModelMap models);
96
97 /**
98 * This returns an Action that will be used by the InfoTabbedPane to render
99 * the tab's title. Any changes in the Action's properties will be
100 * immediately rendered onto the tab's title space.
101 *
102 * @return an Action for the tab title
103 */
104 public TabTitle getTabTitle();
105
106 public static class ModelMap
107 {
108
109 private final HashMap<Object, Object> classMap = new HashMap<>();
110
111 public <T> T get(Class<T> key)
112 {
113 return (T) classMap.get(key);
114 }

Callers 24

setCharacterMethod · 0.95
ModelHandlerMethod · 0.65
PageItemMethod · 0.65
ModelHandlerMethod · 0.65
restoreModelsMethod · 0.65
restoreModelsMethod · 0.65
restoreModelsMethod · 0.65
valueChangedMethod · 0.65
installMethod · 0.65
restoreModelsMethod · 0.65
restoreModelsMethod · 0.65
setCharacterMethod · 0.65

Implementers 15

RaceInfoTabcode/src/java/pcgen/gui2/tabs/RaceInfo
TemplateInfoTabcode/src/java/pcgen/gui2/tabs/Template
ClassInfoTabcode/src/java/pcgen/gui2/tabs/ClassInf
InventoryInfoTabcode/src/java/pcgen/gui2/tabs/Inventor
DomainInfoTabcode/src/java/pcgen/gui2/tabs/DomainIn
CompanionInfoTabcode/src/java/pcgen/gui2/tabs/Companio
SkillInfoTabcode/src/java/pcgen/gui2/tabs/SkillInf
SummaryInfoTabcode/src/java/pcgen/gui2/tabs/SummaryI
TempBonusInfoTabcode/src/java/pcgen/gui2/tabs/TempBonu
AbilitiesInfoTabcode/src/java/pcgen/gui2/tabs/Abilitie
DescriptionInfoTabcode/src/java/pcgen/gui2/tabs/Descript
CharacterSheetInfoTabcode/src/java/pcgen/gui2/tabs/Characte

Calls

no outgoing calls

Tested by

no test coverage detected