new-config-property
Adds a new configuration property to the application, with persistence and UI support.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Adds a new configuration property to the application, with persistence and UI support.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | new-config-property |
| description | Adds a new configuration property to the application, with persistence and UI support. |
The ca.corbett.musicplayer.AppConfig class is the central (singleton) manager of application configuration.
This class makes use of the *Property classes from the ca.corbett.extras.properties package in the
swing-extras library. A property wrapper class exists for most common types of properties:
BooleanProperty: wraps a simple yes/no or on/off option, represented as a checkbox in the UI.ShortTextProperty: a single-line text input field.LongTextProperty: a multi-line text input field.IntegerProperty: for selecting a whole number from a defined range. Example: TCP port selection.DecimalProperty: for selecting a floating-point number from a defined range.ColorProperty: can be used to select a single color, or a color gradient (using a custom gradient color chooser)FontProperty: for selecting a font, with optional style selection and foreground/background color choosers.ComboProperty: for selecting an item from a predefined list of options.EnumProperty: for selecting a specific enum value from a caller-defined enum.These property classes all extend AbstractProperty.
save() to immediately persist the new value.createInternalProperties() method is the place to instantiate the new property.setHelpText() (from AbstractProperty) to give the user some context about the property.createInternalProperties()The first parameter to most property constructors is the name for the new property. This internal identifier
is used to categorize the property. Most importantly, this determines which tab or group the new property will
appear in, when rendered on the properties dialog. Try to match the new property to some existing group.
For example, a new property that affects the cosmetic aspects of the desktop pane should go into the
existing UI.Desktop group. The property name is always written as <majorGroup>.<minorGroup>.<uniquePropertyName>.
If the new property does not belong to any existing group, create a new major and minor group for it.
The user prompt: "I want to add a new config property to store the user's preferred name. The new property should be in the UI.General group."
Step-by-step:
ShortTextProperty is most appropriate.AppConfig called userPreferredName.getUserPreferredName() method so the current value can be queried programmatically.setHelpText().UI.General, so we use UI.General.userPreferredName for the property name.createInternalProperties().mvn package or so) and ensure the build looks good.