In the abstract the MhSystemConfiguration
and MhSystemConfigurationItem
s work together to provide both a configuration dialog for a product line, as well as initial values for products in that product line.
MhSystemConfiguration
The MhSystemConfiguration
object holds the MhSystemConfigurationItem
s for a product line. The MhSystemConfiguration
is registered to the package given to the configuration dialog. The MhSystemConfiguration
must be provided MhSystemConfigurationItem
s to populate the configuration dialog.
Registering MhSystemConfiguration
The MhSystemConfiguration
of a product line must be registered for it to function. Registering an MhSystemConfiguration
is done by calling the mhRegisterConfiguration
function, which takes the package to register the MhSystemConfiguration
to as well as the MhSystemConfiguration
to register.
The mhRegisterConfiguration
function should be called during extension startup.
MyCustomConfiguration config(); mhRegisterConfiguration(#"package.of.config", config);
Populating MhSystemConfiguration
A new MhSystemConfiguration
must override certain methods in order to populate its MhSystemConfigurationItem
s as well as provide its package. The following methods must be overridden when creating a new MhSystemConfiguration
.
Populating Package
The defaultPackage
method should be overridden to provide the package of the MhSystemConfiguration
. This method should return a symbol
representing the package of the MhSystemConfiguration
.
extend public symbol defaultPackage() { return #"config.package.here"; }
Populating Config Items
The createConfigItems
method should be overridden to provide the MhSystemConfigurationItem
s for the MhSystemConfiguration
. This method should return an array of MhSystemConfigurationItem
s.
/** * The configuration items. */ private MhSystemConfigurationItem[] createConfigItems() { return [ MhSystemConfigurationItem: MySystemConfigurationItem() ]; }
MhSystemConfigurationItem
The MhSystemConfigurationItem
represents a category of values to configure, such as the dimensions of a bay. The MhSystemConfigurationItem
Config Item Setup
The configurable values of an MhSystemConfigurationItem
are represented by its props
. Adding props
of different types to a MhSystemConfigurationItem
will add them to the configuration dialog.
The PropInputSetting
of these props will be used to create the UI of the configuration dialog. There are several methods available for determining invisible/read-only properties, and other methods for configuring the properties and other dialog features of a MhSystemConfigurationItem
.
Method | Description |
---|---|
bool isVisible(PropObj propertyOwner, str key) |
Determines if the property is visible in the configuration dialog. |
bool isReadOnly(PropObj propertyOwner, str key) |
Determines if the property is read only in the configuration dialog. |
str label() |
The label of the configuration item, displayed as a tab in the configuration dialog. |
str toolTip() |
The tool tip of the configuration item, displayed when the user hovers over the tab in the configuration dialog. |
str sortKey() |
The key used to sort the configuration items in the configuration dialog. |
Populating Shapes
In order for domains to be properly populated by the configuration dialog, the shapes
method must be overridden to provide all MhSnapperShape
s configured by the MhSystemConfigurationItem
. This method should return an array of MhSnapperShape
s.
/** * The shapes configured by this config item. */ public MhSnapperShape[] shapes() { return [MhSnapperShape: MyCustomshape()]; }
Comments
0 comments
Please sign in to leave a comment.