enum field definition
Overview
Next Design allows you to define input method fields that select a value from a selection. Such fields are called enumerated fields.
The steps for defining enumerated fields are described below in the following order:
- add enum fields
- remove enum definition
- change enum settings
Image of enum field definition
Add an enum field
There are multiple ways to add enum fields:
- Define an enum in the class diagram and add a field
- Define a new enum when adding a field
Defining Enum Types and Adding Fields in Class Diagrams
To add an enum field in a class diagram, follow these steps:
- Drag and drop an [Enum] from the class toolbox and enter a name.
- The newly added enum type has [enum_literal_1] defined as the first choice. To change the value of an option, double-click the option you want to change, or select it and press the f2 key.
- To add a choice to an enum type, move the pointer over the value display area of the enum type, click the + icon that appears in the upper right corner of the value display area, and enter the value for the choice.
- This defines a set of choices as an enum.
- To add a field of the defined enum type to an entity, just like adding a field to an entity, click the [+] icon that appears in the upper right corner of the entity's field display area and select Add New. Open the Fields dialog.
- When specifying the data type in the Add New Fields dialog, just like specifying an existing entity, click the [...] button to the far right of Data Type to open the finder .
- Find and click an enum type from the list on the finder to enter that enum type in the Data Type.
- Enter the setting items in the [Add New Fields] dialog and press the [OK] button.
- This will add an enum field to the entity.
Defining a new enum when adding a field
To define a new enum at the same time as adding a field to an entity, do the following:
- Open the Add New Fields dialog as you would add a field to an entity.
- When specifying the data type in the [Add New Fields] dialog, click [New Enum Type...] from the data type choices to open the [New Enum Type] dialog.
- Enter the setting items in the [New Enum Type] dialog.
- Enums must always have at least one choice. To add a choice to an enum type, click the + icon at the bottom right of the Enum Literal grid to open the New Enum Literal dialog.
- Enter the setting items in the [New Enum Literal] dialog and press the [OK] button to return to the [New Enum Type] dialog and add options to the enumeration type.
- Enter the setting items in the [New Enum Type] dialog and press the [OK] button to return to the [Add New Fields] dialog and enter the enumeration type in [Data Type].
- Enter the setting items in the [Add New Fields] dialog and click the [OK] button.
- This will define a new enum and add a field of that enum to the entity at the same time.
remove enum definition
There are multiple ways to remove enums:
- Remove the enum from the metamodel
- Remove the enum from the class diagram (hide it from the class diagram without removing it from the metamodel)
Remove the enum from the metamodel
To remove an enum from the metamodel, just as you would remove an entity:
- If you want to delete an enumeration used as a data type in a field of an entity, delete the corresponding field in advance.
- Select the target enum type in the class diagram and execute [Delete From Model] from the context menu.
- As a result, the target enum type is deleted from the class diagram and also from the meta model, and the target enum type is also deleted from the profile navigator.
- If you select the target enumeration type in the class diagram and press the delete key, it will just be deleted from the class diagram, just like [Delete From Diagram] in the context menu. It is not removed from the profile and remains on the profile navigator.
Enums can also be removed from the metamodel with the following steps:
- Select the target enumeration type in the profile navigator and execute [Delete] from the context menu or press the delete key.
Remove enum from class diagram
To remove an enum from a class diagram and hide it:
- Select the target enumeration type in the class diagram and execute [Delete From Diagram] from the context menu, or press the delete key.
- This removes it from the class diagram, but not the metamodel and leaves the enum in question on the profile navigator. To reappear on the class diagram, go to [Metamodel definition > Model structure definition > Add entity > Add existing entity to class diagram](./model-structure-definition#model-structure-definition-- add-exist-entity-to-class-diagram) manually to the class diagram.
Change enum settings
To add choices to the enum or change the order of the choices, use the inspector and do the following:
- Click View > Pane > Inspector from the ribbon to display the inspector on the right side of the screen.
- Select the desired enum in the class diagram or profile navigator.
- Select Enum Type from the tabs at the top of the inspector.
- To add choices to the enum type, click the [+] icon at the bottom right of the [Enum Literal] grid in the [Enum] group, enter the settings in the [New Enum Literal] dialog, and click [ Click the OK button.
- To remove a choice from an enum type, select the value to remove in the Enum Literal grid in the Enum group and click the minus icon in the lower right corner.
- To change the order of the choices defined in the enum, select the value to change in the Enum Literal grid in the Enum group and click the ↑ and ↓ icons in the lower left corner. increase.