Type Sets and Types
The Types manager is accessible from:
- Ribbon / Process / Lists / Types
- Menu / Tools / Lists / Types
Type
Software Ideas Modeler recognizes a type entity that is useful in various diagram kinds, such as UML diagrams and entity-relationship diagrams. A type can be assigned to an attribute, property, operation, and operation parameter.
The type has the following properties:
- ID - unique identifier of the type
- Name - the name of the type that will be displayed in the diagrams
- Template - specifies the text definition of the type with its parameters in the target language. The default template is {{Name}} - which means the target language representation is the same as the type name. The template supports the following tags:
- {{Name}} - type name
- {{?}} - parameter definition
- Type representation - the semantic meaning of the type - String, Boolean, Any Number, etc.
- Generic - if a type is marked as a generic one, it can be used as a base type of a derived type.
- Base type - only a generic type can be used as a base type of the type.
- Default size
- Description - textual explanation of the type.
- Parameters - provides additional specifications to the type
Generic Types
A generic type can be specialized by other types. E.g. a type set can contain a generic type for the list (List{{?}}), which can be used as a specific type List
If a type set contains a generic type and you use a specific type in your diagram, Software Ideas Modeler will create a new derived type for it and add it to the custom types automatically.
Type Parameters
The type parameter modifies the meaning of the target type. It can The type parameter has the following properties:
- Name - full name of the type parameter
- Kind - a parameter can be a flag / numeric / text
- Meaning - specifies the general meaning of the parameter - it can be Length, Nullable, Pointer, Reference, or Other
- Template - defines how the type transforms the type textual representation in the target language (it is applied in the source code generation)
- Code - short code of the parameter which is used in the diagrams as a part of the type definition (e.g. ? for nullability or * for the pointer)
- Description
Type Set
A type set groups all types and derived types of a programming or scripting language. It can also include the parameters (e.g. nullability, size) that can be used by types in the given type set.
Default Type Set
Software Ideas Modeler allows you to set a default type set for the new projects - open Options (Ribbon / File / Options) and choose a type set from Default type set drop down in the General tab, in the 'Project Defaults' group. This setting does not affect existing projects with its defined default type set.
The default type set is defined on several levels in the project. There is a main type set from the whole project. Then each folder and diagram can have its own type set different from the main one. You can change the default type set using the Properties dialog (for the project, folder, or diagram).
Types Manager
Types manager allows you to create and edit new types and type sets. It contains a tab control with two tab pages: Type Sets and Custom Types.
The type Sets tab contains a list of all available type sets. You can check the items you want to use in your project (the checked type sets will appear in the Default Type Set drop-downs).
In the top part, the tab offers a bar with several buttons:
- New Type Set - creates a new type set
- Edit Type Set - edits the selected type set
- Delete Type Set - deletes the selected type set
- Import Type Set - imports a type set from an XML file to the user profile
- Export Type Set - exports a type set to an XML file in the chosen file path
The Custom Types tab contains a list of types and derived types defined in the current projects. It allows you to edit and delete the existing custom types and add new custom types and parameters.
Type Set Editor
If you click on the Edit Type Set button in the Types window, the selected type set will open in the Type Set Editor. The window is divided into two main parts - the list of defined types, derived types and parameters is on the left, and the properties editor is on the right.
There is a command bar above the list of the types - it offers the following buttons:
- Add Type/Add Parameter split button - adds a new type or type parameter
- Remove button - removes the selected type or parameter from the type set.
The list contains three list groups:
- Types
- Derived types
- Parameters
The properties editor on the right allows you to set the properties of the selected type or parameter. The editor changes according to the selected item - it offers different edit fields for types and for type parameters.
If a type is selected in the list the editor offers two tabs:
- General - provides the edit boxes for the type properties.
- Parameters - provides a list of all parameters that are defined in the edited type set. You can check the parameters that are applicable to the edited type.
How to Assign Type to Field
If you want to assign a type to a field, right-click on the field and choose a type from the Change Type submenu of the context menu. The submenu offers the types from the current type sets and custom types.
If you are using the ribbon interface, the faster way is to select the field and choose the type from the Types gallery in the ribbon context tab Field.
If you are editing the field definition in the edit box in the diagram editor, you can enter the type name manually. If the type with the given name does not exist, it will be created as a custom type. If it is possible, the custom type will be created as a derived type of a generic type, otherwise as an independent type.
You can also edit the type in the Properties dialog. Right-click on the field, choose Properties, and change the type using the Type combo box on the General tab.
New Comment