Package jmri.util.gui

Class GuiLafPreferencesManager

    • Method Detail

      • isInitialized

        public boolean isInitialized​(Profile profile)
        Description copied from interface: PreferencesManager
        Test if the PreferencesManager is initialized without errors for the provided Profile. Note that although both this method and PreferencesManager.isInitializedWithExceptions(jmri.profile.Profile) can be false, if isInitializedWithExceptions(Profile) returns true, this method must return false.
        Specified by:
        isInitialized in interface PreferencesManager
        Parameters:
        profile - the configuration profile to test against; may be null to test for exceptions thrown when initializing for this user regardless of profile
        Returns:
        true if the provider is initialized without exceptions
      • getRequires

        @Nonnull
        public java.util.Collection<java.lang.Class<? extends PreferencesManager>> getRequires()
        Description copied from interface: PreferencesManager
        Get the set of PreferencesManagers that must be initialized prior to initializing this PreferencesManager. It is generally preferable to require an Interface or an abstract Class instead of a concrete Class, since that allows all (or any) concrete implementations of the required class to be initialized to provide required services for the requiring PreferencesManager instance.

        Note that for any set of PreferencesManagers with the same requirements, or with a circular dependency between each other, the order in which the PreferencesManagers in that set are initialized should be considered non-deterministic.

        Specified by:
        getRequires in interface PreferencesManager
        Returns:
        A set or list of classes. If there are no dependencies, return an empty set instead of null.
      • getProvides

        @Nonnull
        public java.lang.Iterable<java.lang.Class<?>> getProvides()
        Description copied from interface: PreferencesManager
        Get the set of Classes that this PreferencesManager can be registered as a provider of in the InstanceManager.
        Specified by:
        getProvides in interface PreferencesManager
        Returns:
        A set or list of classes. If this PreferencesManager provides an instance of no other Interfaces or abstract Classes than PreferencesManager, return an empty set instead of null.
      • savePreferences

        public void savePreferences​(Profile profile)
        Description copied from interface: PreferencesManager
        Save the preferences that this provider manages for the provided Profile.
        Specified by:
        savePreferences in interface PreferencesManager
        Parameters:
        profile - the profile associated with the preferences to save; may be null to save preferences that apply to the current user regardless of profile
      • getLocale

        public java.util.Locale getLocale()
        Returns:
        the locale
      • setLocale

        public void setLocale​(java.util.Locale locale)
        Parameters:
        locale - the locale to set
      • getFont

        public java.awt.Font getFont()
        Returns:
        the currently selected font
      • setFont

        public void setFont​(java.awt.Font newFont)
        Sets a new font
        Parameters:
        newFont - the new font to set
      • setFontByName

        public void setFontByName​(java.lang.String newFontName)
        Sets a new font by name
        Parameters:
        newFontName - the name of the new font to set
      • getDefaultFont

        public java.awt.Font getDefaultFont()
        Returns:
        the current Look and Feel default font
      • setDefaultFont

        public void setDefaultFont()
        Called to load the current Look and Feel default font, based on looking up the "List.font".
      • getFontSize

        public int getFontSize()
        Returns:
        the currently selected font size
      • setFontSize

        public void setFontSize​(int newFontSize)
        Set the new font size. If newFontSize is non-zero and less than 9, the font size is set to 9 or if greater than 36, the font size is set to 36.
        Parameters:
        newFontSize - the new font size to set
      • getDefaultFontSize

        public int getDefaultFontSize()
        Get the default font size for the current Look and Feel.
        Returns:
        the default font size
      • setDefaultFontSize

        public void setDefaultFontSize()
        Get the default font size for the current Look and Feel, based on looking up the "List.font" size.
      • setToolTipDismissDelay

        public void setToolTipDismissDelay​(int time)
        Sets the time a tooltip is displayed before it goes away.

        Note that this preference takes effect immediately.

        Parameters:
        time - the delay in seconds.
      • getToolTipDismissDelay

        public int getToolTipDismissDelay()
        Get the time a tooltip is displayed before being dismissed.
        Returns:
        the delay in seconds
      • setNonStandardMouseEvent

        public void setNonStandardMouseEvent​(boolean nonStandardMouseEvent)
        Parameters:
        nonStandardMouseEvent - the nonStandardMouseEvent to set
      • setGraphicTableState

        public void setGraphicTableState​(boolean graphicTableState)
        Parameters:
        graphicTableState - the graphicTableState to set
      • setOblockEditTabbed

        public void setOblockEditTabbed​(boolean tabbed)
        Parameters:
        tabbed - the Editor interface to set (fasle = desktop)
      • getMaxComboRows

        public int getMaxComboRows()
        Returns:
        the number of combo box rows to be displayed.
      • setMaxComboRows

        public void setMaxComboRows​(int maxRows)
        Set a new value for the number of combo box rows to be displayed.
        Parameters:
        maxRows - The new value, zero for no limit
      • setEditorUseOldLocSize

        public void setEditorUseOldLocSize​(boolean editorUseOldLocSize)
        Parameters:
        editorUseOldLocSize - the editorUseOldLocSize value to set
      • getJFileChooserFormat

        public int getJFileChooserFormat()
        JFileChooser Type
        Returns:
        0 default, 1 List 2 Detail
      • setJFileChooserFormat

        public void setJFileChooserFormat​(int jFileChooserFormat)
        Parameters:
        jFileChooserFormat - the JFileChooser 0 default, 1 list, 2 detail
      • getLookAndFeel

        public java.lang.String getLookAndFeel()
        Get the name of the class implementing the preferred look and feel. Note this may not be the in-use look and feel if the preferred look and feel is not available on the current platform; and will be overwritten if preferences are saved on a platform where the preferred look and feel is not available.
        Returns:
        the look and feel class name
      • setLookAndFeel

        public void setLookAndFeel​(java.lang.String lookAndFeel)
        Set the name of the class implementing the preferred look and feel. Note this change only takes effect after the application is restarted, because Java has some issues setting the look and feel correctly on already open windows.
        Parameters:
        lookAndFeel - the look and feel class name
      • applyLookAndFeel

        public void applyLookAndFeel()
        Apply the existing look and feel.
      • setLocaleMinimally

        public static void setLocaleMinimally​(Profile profile)
        Stand-alone service routine to set the default Locale.

        Intended to be invoked early, as soon as a profile is available, to ensure the correct language is set as startup proceeds. Must be followed eventually by a complete setLocale(java.util.Locale).

        Parameters:
        profile - The profile to get the locale from
      • isDirty

        public boolean isDirty()
        Check if preferences need to be saved.
        Returns:
        true if preferences need to be saved
      • isRestartRequired

        public boolean isRestartRequired()
        Check if application needs to restart to apply preferences.
        Returns:
        true if preferences are only applied on application start
      • firePropertyChange

        public void firePropertyChange​(java.lang.String propertyName,
                                       boolean oldValue,
                                       boolean newValue)
        Fire a property change.
        Specified by:
        firePropertyChange in interface PropertyChangeFirer
        Overrides:
        firePropertyChange in class Bean
        Parameters:
        propertyName - the programmatic name of the property that was changed
        oldValue - the old value of the property
        newValue - the new value of the property
      • firePropertyChange

        public void firePropertyChange​(java.lang.String propertyName,
                                       int oldValue,
                                       int newValue)
        Fire a property change.
        Specified by:
        firePropertyChange in interface PropertyChangeFirer
        Overrides:
        firePropertyChange in class Bean
        Parameters:
        propertyName - the programmatic name of the property that was changed
        oldValue - the old value of the property
        newValue - the new value of the property
      • firePropertyChange

        public void firePropertyChange​(java.lang.String propertyName,
                                       java.lang.Object oldValue,
                                       java.lang.Object newValue)
        Fire a property change.
        Specified by:
        firePropertyChange in interface PropertyChangeFirer
        Overrides:
        firePropertyChange in class Bean
        Parameters:
        propertyName - the programmatic name of the property that was changed
        oldValue - the old value of the property
        newValue - the new value of the property
      • getInitializationExceptions

        @Nonnull
        public java.util.List<java.lang.Exception> getInitializationExceptions​(Profile profile)
        Description copied from interface: PreferencesManager
        Get the set of exceptions thrown during initialization for the provided Profile.
        Specified by:
        getInitializationExceptions in interface PreferencesManager
        Parameters:
        profile - the configuration profile to test against; may be null to test for exceptions thrown when initializing for this user regardless of profile
        Returns:
        A list of exceptions. If there are no exceptions, return an empty set instead of null.