Class PtolemyPreferences

    • Field Detail

      • backgroundColor

        public ColorAttribute backgroundColor
        The background color.
      • PREFERENCES_FILE_NAME

        public static final java.lang.String PREFERENCES_FILE_NAME
        The file name where user-defined preferences are stored.
        See Also:
        Constant Field Values
      • PREFERENCES_WITHIN_CONFIGURATION

        public static final java.lang.String PREFERENCES_WITHIN_CONFIGURATION
        The location with the configuration of the preferences attribute.
        See Also:
        Constant Field Values
    • Method Detail

      • preferenceValue

        public static Token preferenceValue​(NamedObj context,
                                            java.lang.String preferenceName)
        Check to see whether a preference of the specified name is defined in the specified context, and if it is, return its value. Note that if there is an error in the expression for the preference, then this method will return null and report the error to standard out. This is done because we assume the error will normally be caught before this method is called.
        Parameters:
        context - The context for the preference.
        preferenceName - The name of the preference.
        Returns:
        The value of the preference, or null if it is not set.
      • preferenceValueLocal

        public static Token preferenceValueLocal​(NamedObj context,
                                                 java.lang.String preferenceName)
        Check to see whether a preference of the specified name is defined in the container of the specified context, either directly or within an instance of PtolemyPreferences, or globally, and if it is, return it's value. Do not look any higher in the hierarchy. Note that if there is an error in the expression for the preference, then this method will return null and report the error to standard out. This is done because we assume the error will normally be caught before this method is called.
        Parameters:
        context - The context for the preference.
        preferenceName - The name of the preference.
        Returns:
        The value of the preference, or null if it is not set.
      • save

        public void save()
                  throws java.io.IOException
        Save the preference values in this instance to the user preferences file.
        Throws:
        java.io.IOException - If an error occurs writing the file.
      • setAsDefault

        public void setAsDefault()
                          throws IllegalActionException
        Set the values in this instance of PtolemyPreferences to be the default values by creating entries in the Constants class so that these values are accessible to any expression.
        Throws:
        IllegalActionException - If any expression for a preference cannot be evaluated.
      • setDefaultPreferences

        public static void setDefaultPreferences​(Configuration configuration)
        Look for a default preferences object within the specified configuration, and set it as the default preferences. Then look for a user preferences file, and override the default preferences with the contents of that file. This method prints warning messages on standard out if there are problems with the preferences.
        Parameters:
        configuration - The specified configuration.