Skip to content

Class Members

A class with properties, methods and freeform text

A class with properties, methods and freeform text

The UML specification essentially recognizes two types of class elements, structural elements and those that describe the behavior of a class. While many incarnations exist of these types, UMLBoard tries to keep it as simple as possible and provides only the two most important representatives: properties and operations. In addition, there is even a third type in UMLBoard that does not appear in the specification at all: free text elements.

You can create all these elements via the class context menu:

Context menu entries to create class members

Use the context menu of a class
to create new members.

To get a deeper look of each member type, just choose one from the navigation menu.

Sorting

1.7

To sort class members, click on an arbitrary member and open its context menu to select the Sort Members menu item. You can choose to either sort all members in descending or ascending order. Please note that all members get ordered, even those of different types than the selected one. This design decision was made as it's assumed to be relatively unlikely that one wants to sort only the properties of a class and leave the methods unordered.

Choose one member to sort all members of the owning class

Click on an arbitrary member to sort all members of a class.

Moving Members

1.7

You can move member from one class into another by dragging and dropping them onto the target class. This also works if you selected several members from different classes and add them to a single target class.

When you drag a member over a class, you should see a small indicator that shows at which position the member will be added. In that way, you can also reposition members within the same class, just drag them over the existing members until the indicator shows the desired position. This feature can be very handy, for example, if you want to split up an existing class into several base classes or extract members of a class into an interface etc.

Move members within the same class or to another class

You can move members within the same class or drag them to another class.

Drag and Copy Members

1.11

Starting with Version 1.11, when you drag a member from one class to another while keeping Cmd (Ctrl on Windows/Linux) pressed, the member will not be moved, but instead copied to the target class.

Copy members from one class to another via dragging

You can copy members by dragging them while pressing CMD/CTRL.

Clipboard Handling

1.7

Anbother easy way to exchange members between classes is the clipboard. Just select all members you want to move or copy, press either Cmd + C or Cmd + X ( Ctrl on Windows/Linux ) move your cursor over the target class and press Cmd + V ( Ctrl + V ) to move or paste the members into the new class.

The clipboard can be used to exchange members between classes

Use the clipboard to transfer members between classes.

Visibility

1.8

General

In UML, visibility is a concept for restricting or controlling access to certain elements. While the UML specification defines visibility on several levels, UMLBoard currently implements this feature only on the member level, and there for properties and methods. Three different access types are currently implemented:

  • Private members are only accessible within the class where they are defined, but not from any external class (including also derived classes). They are expressed by a - sign in front of the member. This setting is best used for class-specific implementation details, which others should not be able to modify.

  • Protected means that a member can only be accessed by its own class and all derived classes but not from any other type not part of the inheritance hierarchy. To conform to the standard, UMLBoard uses the # character to mark a member as protected. This visibility level can express that a specific member is an implementation detail. Still, parts of the implementation could be reused or adjusted by derived classes.

  • Public members can be accessed by all types, whether derived or external. Therefore, a public member can be considered part of the class's public interface. The + sign is used to characterize public members.

Note

The UML specification supports even a fourth visibility type, Package. The issue with package is also that it is utilized quite differently: Many programming languages use different names (like package in Java or internal in C#), and some even use this type in combination with others (like protected internal in C#). We, therefore, decided to keep it as simple as possible and focus only on the three most commonly used options.

Editing via Menu

To change the visibility of a member, select it and open its context menu. You should then be able to choose one of the three visibility levels.

Changing the visibility of a member

Use the context menu to change a member's visibility.

Choosing a specific menu item will set the corresponding visiblity, selecting the item again will remove the previously assigned visibility.

Editing through Typing

Another option is to change the visibility by typing: Double-click on the member's name and type the visibility sign (-, #, or +), followed by a space before you enter the member's name. UMLBoard will automatically parse the sign and set the corresponding visibility.

Changing the visibility of a member through typing

You can also change the visibility by editing a member's name.

To later edit the visibility, you have two options:

  1. Double-click on the visibility character to start typing. The edit field will contain the access specifier and the member name. To change the specifier, just enter a new sign. If you remove it from the edit field, it will also be removed from the member.

  2. Double-click only on the member name. While the access specifier is not visible in the edit field, you can still overwrite it by typing either -, #, or + followed by a space. Please note: When clicking on the name for editing, you cannot remove the specifier from the member. You have to click directly on the specifier or use the context menu to achieve this.

Setting Visibility when creating new Members

By default, new members don't have any visibility set after creation. To change this behavior, you can specify the default visibility that should be used when you create new properties or methods via the Settings dialog.

References and further readings


Last update: December 20, 2023