Package jmri.swing
Interface PreferencesPanel
-
- All Superinterfaces:
JmriServiceProviderInterface
- All Known Subinterfaces:
ManagingPreferencesPanel,PreferencesSubPanel
- All Known Implementing Classes:
BuildReportOptionPanel,ConnectionsPreferencesPanel,ConsistToolPrefsPanel,EditManifestHeaderTextPanel,EditManifestTextPanel,EditSwitchListTextPanel,FileLocationPane,FrameServletPreferencesPanel,GuiLafConfigPane,GuiLocalePreferencesPanel,HelpUtilPreferencesPanel,JmriSRCPServerPreferencesPanel,JmrixConfigPane,JsonServerPreferencesPanel,LnTcpPreferencesPanel,LoadAndStorePreferencesPanel,LogixNGPreferencesPanel,ManagerDefaultsConfigPane,OperationsPreferencesPanel,OperationsSettingsPanel,OptionPanel,PermissionPreferencesPanel,PreferencesPane,PrintMoreOptionPanel,PrintOptionPanel,ProfilePreferencesPanel,ProgrammerConfigPane,RailroadNamePreferencesPanel,RosterConfigPane,ShutdownPreferencesPanel,SimpleServerPreferencesPanel,StartupActionsPreferencesPanel,StreamConfigPane,SystemConsoleConfigPanel,ThrottlesPreferencesPane,UserMessagePreferencesPane,WarrantPreferencesPanel,WebServerPreferencesPanel,WiThrottlePrefsPanel
public interface PreferencesPanel extends JmriServiceProviderInterface
An interface to define methods that the Preferences Window can and should expect Preferences panels to implement. This class allows the Preferences Window become less formally aware of all possible preferences settings in JMRI, and to instead interrogate a PreferencesPanel for most of the information that the Preferences window requires to add the PreferencesPanel to the window.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.function.BooleanSuppliergetIsEnabled()Offers a way to tell if this panel is currently enabled or not.java.lang.StringgetLabelKey()Text displayed above the preferences panel This label is only displayed if the preferences panel is in a tabbed set of preferences.javax.swing.JComponentgetPreferencesComponent()Get the preferences component for displayjava.lang.StringgetPreferencesItem()Get the Preferences Item identifier.java.lang.StringgetPreferencesItemText()Get the text for the Preferences Item in the preferences window list of preferences categories.java.lang.StringgetPreferencesTooltip()The tooltip to display for a tabbed preferences paneldefault intgetSortOrder()Indicate the sort order to be used to sort PreferencesPanels in TabbedPreferences.java.lang.StringgetTabbedPreferencesTitle()Get the title for the tab containing this preferences item.booleanisDirty()Indicate that preferences need to be saved.booleanisPersistant()Indicates that this PrefernecesPanel should be stored across application starts by the PreferencesManager This should be true if the implementing class relies on theConfigureManagerstores and retrieves the preferences managed by the implementing class on behalf of the implementing class.booleanisPreferencesValid()Indicate that the preferences are valid.booleanisRestartRequired()Indicate that the preferences will not take effect until restarted.voidsavePreferences()Save any changes to preferences.
-
-
-
Method Detail
-
getPreferencesItem
java.lang.String getPreferencesItem()
Get the Preferences Item identifier. Multiple PreferencePanels can be displayed as tabs in a single item. Preferences items are listed in the menu on the left of the preferences window.- Returns:
- the preferences item identifier.
-
getPreferencesItemText
java.lang.String getPreferencesItemText()
Get the text for the Preferences Item in the preferences window list of preferences categories. Multiple PreferencePanels can be displayed as tabs in a single item. Preferences items are listed in the menu on the left of the preferences window.- Returns:
- the text for the preferences item.
-
getTabbedPreferencesTitle
java.lang.String getTabbedPreferencesTitle()
Get the title for the tab containing this preferences item.- Returns:
- a tab title
-
getLabelKey
java.lang.String getLabelKey()
Text displayed above the preferences panel This label is only displayed if the preferences panel is in a tabbed set of preferences. This label can contain multiple lines.- Returns:
- label text
-
getPreferencesComponent
javax.swing.JComponent getPreferencesComponent()
Get the preferences component for display- Returns:
- the preferences panel
-
isPersistant
boolean isPersistant()
Indicates that this PrefernecesPanel should be stored across application starts by the PreferencesManager This should be true if the implementing class relies on theConfigureManagerstores and retrieves the preferences managed by the implementing class on behalf of the implementing class.- Returns:
- false if the implementing class stores its own preferences
-
getPreferencesTooltip
java.lang.String getPreferencesTooltip()
The tooltip to display for a tabbed preferences panel- Returns:
- tooltip text
-
savePreferences
void savePreferences()
Save any changes to preferences. This method is called for every instance of a PreferencesPanel that is loaded byTabbedPreferencesifisPersistant()is false.
-
isDirty
boolean isDirty()
Indicate that preferences need to be saved.- Returns:
- true if preferences need to be saved, false otherwise
-
isRestartRequired
boolean isRestartRequired()
Indicate that the preferences will not take effect until restarted.- Returns:
- true if the application needs to restart
-
isPreferencesValid
boolean isPreferencesValid()
Indicate that the preferences are valid.- Returns:
- true if the preferences are valid, false otherwise
-
getSortOrder
default int getSortOrder()
Indicate the sort order to be used to sort PreferencesPanels in TabbedPreferences. PreferencesPanels with the same sort order value are alphabetically within that sort order.- Returns:
- the sort order; default implementation returns
Integer.MAX_VALUE.
-
getIsEnabled
default java.util.function.BooleanSupplier getIsEnabled()
Offers a way to tell if this panel is currently enabled or not. It's primarily used for permission panel to protect it from unauthorized changes.- Returns:
- A BooleanSupplier that tells if this panel is currently enabled. Or null if the panel is always enabled.
-
-