20 package net.sf.gridarta.gui.panel.archetypechooser;
22 import java.awt.BorderLayout;
23 import java.util.prefs.Preferences;
24 import javax.swing.AbstractButton;
25 import javax.swing.Action;
26 import javax.swing.BorderFactory;
27 import javax.swing.ButtonGroup;
28 import javax.swing.JPanel;
29 import javax.swing.JTabbedPane;
30 import javax.swing.JToggleButton;
31 import javax.swing.SwingConstants;
32 import javax.swing.event.ChangeEvent;
33 import javax.swing.event.ChangeListener;
46 import net.
sf.japi.swing.action.ActionMethod;
47 import org.jetbrains.annotations.NotNull;
48 import org.jetbrains.annotations.Nullable;
106 private final JTabbedPane
tabDesktop =
new JTabbedPane(SwingConstants.TOP);
136 public void stateChanged(
final ChangeEvent e) {
137 final JTabbedPane tabbedPane = (JTabbedPane) e.getSource();
138 final int index = tabbedPane.getSelectedIndex();
163 public ArchetypeChooserView(
final boolean createDirectionPane, @NotNull
final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull
final FaceObjectProviders faceObjectProviders, @NotNull
final Action displayGameObjectNamesAction, @NotNull
final Action displayArchetypeNamesAction, @NotNull
final Action displayIconsOnlyAction, @NotNull
final DisplayMode<G, A, R> displayModeGameObjectNames, @NotNull
final DisplayMode<G, A, R> displayModeArchetypeNames, @NotNull
final DisplayMode<G, A, R> displayModeIconsOnly) {
164 super(
new BorderLayout());
181 public void selectedArchetypeChanged(@Nullable
final R selectedArchetype) {
185 public void directionChanged(@Nullable
final Integer direction) {
204 public void facesReloaded() {
206 if (archetypeChooserPanel !=
null) {
208 if (archetypePanel !=
null) {
209 archetypePanel.repaint();
215 faceObjectProviders.addFaceObjectProvidersListener(faceObjectProvidersListener);
220 final ButtonGroup buttonGroup =
new ButtonGroup();
225 switch (preferencesDisplayMode) {
241 if (createDirectionPane) {
245 if (selectedPanel !=
null) {
247 if (archetypePanel !=
null) {
262 if (existingPanel !=
null) {
263 return existingPanel;
271 for (i = 0; i <
tabDesktop.getTabCount() && panelName.compareToIgnoreCase(
tabDesktop.getTitleAt(i)) > 0; i++) {
273 tabDesktop.insertTab(panelName,
null, newPanel,
null, i);
285 for (
int i = 0; i <
tabDesktop.getTabCount(); i++) {
286 if (panelName.equals(
tabDesktop.getTitleAt(i))) {
303 return archetypePanel;
311 final int selectedIndex =
tabDesktop.indexOfComponent(selectedPanel);
312 if (selectedIndex == -1 || selectedIndex ==
tabDesktop.getSelectedIndex()) {