source: josm/trunk/src/org/openstreetmap/josm/gui/preferences/TabPreferenceSetting.java@ 17178

Last change on this file since 17178 was 17178, checked in by simon04, 4 years ago

see #7548 - Re-organize the preference dialog (icons)

  • Property svn:eol-style set to native
File size: 3.7 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.preferences;
3
4import java.awt.Component;
5
6import javax.swing.ImageIcon;
7
8import org.openstreetmap.josm.tools.ImageProvider;
9
10/**
11 * Preference settings, that display a top level tab.
12 *
13 * This preference setting's addGui method is called after the user clicked the tab.
14 */
15public interface TabPreferenceSetting extends PreferenceSetting {
16
17 /**
18 * Called during preferences dialog initialization to display the preferences tab with the returned icon.
19 * @return The icon name in the preferences folder.
20 */
21 String getIconName();
22
23 /**
24 * Returns the icon for this preference setting
25 * @param size the icon size
26 * @return the icon or {@code null}
27 */
28 default ImageIcon getIcon(ImageProvider.ImageSizes size) {
29 String iconName = getIconName();
30 return iconName == null || iconName.isEmpty() ? null : ImageProvider.get("preferences", iconName, size);
31 }
32
33 /**
34 * Called during preferences tab initialization to display its title.
35 * @return The title of this preferences tab.
36 */
37 String getTitle();
38
39 /**
40 * Called during preferences dialog initialization to display the preferences tab with the returned tooltip.
41 * @return The tooltip of this preferences tab.
42 */
43 String getTooltip();
44
45 /**
46 * Called during preferences tab initialization to display a description in one sentence for this tab.
47 * Will be displayed in italic under the title.
48 * @return The description of this preferences tab.
49 */
50 String getDescription();
51
52 /**
53 * Adds a new sub preference settings tab with the given title and component.
54 * @param sub The new sub preference settings.
55 * @param title The tab title.
56 * @param component The tab component.
57 * @since 5631
58 */
59 void addSubTab(SubPreferenceSetting sub, String title, Component component);
60
61 /**
62 * Adds a new sub preference settings tab with the given title, component and tooltip.
63 * @param sub The new sub preference settings.
64 * @param title The tab title.
65 * @param component The tab component.
66 * @param tip The tab tooltip.
67 * @since 5631
68 */
69 void addSubTab(SubPreferenceSetting sub, String title, Component component, String tip);
70
71 /**
72 * Registers a sub preference settings to an existing tab component.
73 * @param sub The new sub preference settings.
74 * @param component The component for which a tab already exists.
75 * @since 5631
76 */
77 void registerSubTab(SubPreferenceSetting sub, Component component);
78
79 /**
80 * Returns the tab component related to the specified sub preference settings
81 * @param sub The requested sub preference settings.
82 * @return The component related to the specified sub preference settings, or null.
83 * @since 5631
84 */
85 Component getSubTab(SubPreferenceSetting sub);
86
87 /**
88 * Returns the currently selected sub preference setting
89 * @return the currently selected sub preference setting
90 */
91 Class<? extends SubPreferenceSetting> getSelectedSubTab();
92
93 /**
94 * Selects the specified sub preference settings, if applicable. Not all Tab preference settings need to implement this.
95 * @param subPref The sub preference settings to be selected.
96 * @return true if the specified preference settings have been selected, false otherwise.
97 * @since 5631
98 */
99 boolean selectSubTab(SubPreferenceSetting subPref);
100
101 /**
102 * Returns the help context for this preferences settings tab.
103 * @return the help context for this preferences settings tab
104 * @since 13431
105 */
106 String getHelpContext();
107}
Note: See TracBrowser for help on using the repository browser.