Working with Containers in Diagram Editor

The container is a type of diagram element that can contain other nested elements (e.g. UML Package, UI Window, etc.). The article shows how to work with the containers, describes their capabilities, and explains various configuration options.

Moving Container

An empty container (container without any nested elements) can be moved in the same way as any other diagram element. Just press the left mouse button over the container bounds and drag it to a new position.

If a container contains some nested elements, you cannot move it this way by default. The selection within the container is preferred. However, you can still use the Move grip (four arrows icon ✢) placed near the left top corner of the container.

If you do not want the behavior to be changed depending on container content - you can turn off the option 'Prefer selection over move inside containers' - it is available in Options / Diagram Editor / Container. Then if you want to select the elements inside a container, you can still do it, when you hold the ALT key during the mouse actions.

Adding Elements to Container

If you want to add an element to a container, just drag the desired element and drop it over the container. You can insert a new element directly into a container. If you have several elements placed close to each other in the diagram you can draw a new container around them and the elements will be included in the created container.

There are several variations of this behavior. You can choose when an element will be added to a container from these options:

  • Partially overlapped elements
  • Fully overlapped elements
  • When cursor over container

Container Inflation

There are several settings according to container inflation. If you add a new element to a container and the element overlaps it, there are several options for how the editor can react:

  • ask whether you want to inflate the container (turn on the setting Options/Diagram Editor/Container/Ask for container inflation)
  • always inflate the container (turn on the setting Options/Diagram Editor/Container/Auto inflate)
  • do nothing about it (turn off both settings mentioned above - Options/Diagram Editor/Container/Ask for container inflation and Auto inflate)

Container Header

Sometimes, a container can be so large that does not fit in the editor window. Then you can see the nested content, but it may be not certain what it belongs to. There is an option (turned on by default) called 'Pin container headers' (Options/Diagram Editor/Container) that ensures that the name (or header) of the container will be always visible within the diagram editor window. It is especially useful for UML swimlanes or lifelines.

Container Layout

An automatic layout can be applied to all nested elements in the container. There are several options for the container layout:

  • Simple - the default option - elements stay where they were placed relative to the container.
  • Stack - depending on the stack settings, the nested elements are placed one after another vertically (or horizontally) so their width (or height) is aligned with container width (or height).
  • Flow - the nested elements are placed in rows (or columns) and their size is preserved.
  • Table - the nested elements are aligned to a table grid.

To change the container layout, right-click on it to show the context menu and choose the desired option from the Container Layout submenu. The submenu also provides a setting for the layout direction. For advanced container settings, choose the Container Layout Setting item.

Container Layouts
Container Layouts

New Comment