Disabling Components

Any component can be disabled (grayed-out) by calling setEnabled(false) on their SettingsModel. You can register a ChangeListener with a SettingsModel and change the enable status of a second component depending on the value of the first one, for example. A disabled SettingsModels will still store, save, and load a value (this way a value entered in the enabled component is preserved). When you start using the values from the SettingsModels in your NodeModel implementation, you need to check the enable status by calling isEnabled(). When changing the values in the SettingsModels (or when instantiating them and assigning an initial value,) you need to carefully maintain a consistent state between those SettingsModels whose states depend on each other. For example, if you have a model that holds a string value and whose enable status depends on a boolean SettingsModel, you need to make sure that you disable the string model whenever you assign false to the boolean model (and, if you initialize the boolean model with false, disable the string model!).

See section SettingsModelListener for an example.


What are you looking for?