5.9.4. Editing the Graph¶
The operations described here are accessible in both hierarchical and flat graph windows.
Graph elements can be created:
by a source code analysis,
by further automated analyses,
by imports from external tools (such as UML tools),
and manually by the user.
Graph elements are created manually using the
Node Tool and the
Edge Tool from the Toolbox. The element type
currently
selected in the palette window will be used for creation.
5.9.4.1. Creating Nodes¶
Activate the
Node Tool, select the desired node type from the
Node Types palette, and click inside the graph window where the new node
should be placed.
A new node icon appears at the click position, and the Create node
dialog appears, requesting a name for the new node. The supplied node name is used as the
value for the Source.Name attribute of the new node. The new node
is automatically assigned a unique random value for its Linkage.Name attribute.
Note
Holding Shift while clicking bypasses the renaming dialog. This can be useful when
creating multiple nodes quickly. The nodes can be renamed later
using
Edit →
Rename... from
the context menu.
Note
You can reset the unique random linkage name assigned to a node by selecting the
node and choosing
Edit →
New selection identity. This unlinks the node from existing GXL
files and layouts and assigns it a new identity.
Creating a new node anywhere inside a target node, including on its node symbol, makes the new node a child of the target node. If the target node is collapsed, it is expanded so that the new node is visible. While moving the mouse pointer, the current target node is highlighted. Placing a node on the graph background, where no node is highlighted, makes it a top-level node.
If the node in which you want to create a child node is currently collapsed, you can expand it by double-clicking. See section Expanding and Collapsing Nodes.
Dragging from the Node Types palette¶
Alternatively, you can drag a node type
icon from the Node Types palette into the graph window and drop it where
the new node should be placed. This creates a node in the same way as the
Node Tool does, including target area highlighting and the subsequent
Create node dialog, which can be bypassed by holding Shift while
dropping.
Spring-loaded expansion¶
While dragging a node type icon, hovering the mouse pointer over a collapsed node
expands it, allowing a new node to be created inside without manual expansion. Moving
the pointer out of the node without releasing the mouse button collapses it again. This
works at any depth. Once a node is expanded, you can hover over one of its
children to expand it, repeating this process until you reach the desired parent node.
The dwell time required to expand a node is configured via the
/Tools/Gravis/node_tool/spring_load_delay option in axivion_config. Set
this option to 0 to disable automatic expansion.
Note
Once a new node is created, it appears at an arbitrary position in all other open windows showing the same view where the node’s parent is expanded.
5.9.4.2. Editing the Hierarchy¶
To relocate nodes within the node hierarchy, activate the
Hierarchy Tool. Use it to move nodes from one parent
to another by dragging them into the expanded area of the desired parent node.
Dragging a node onto the window background makes it a top-level node.
Holding Shift during the drag includes all sibling nodes that share the same selection/marking state as the dragged node. For example, dragging a selected node while holding Shift also drags all other selected nodes under the same parent.
The target area for the new parent node is highlighted during the drag.
Note
The prospective parent node must be expanded before the drag operation begins.
Note
Nodes can be selected and deselected in the
Hierarchy Tool
just as they are in the
Select Tool, without needing to
switch tools.
5.9.4.3. Creating Edges¶
Activate the
Edge Tool and select the desired edge type from the
Edge Types palette. First, select the source node of the new edge by
clicking on it. The source node is highlighted, and a rubber-band style edge appears.
Clicking another node selects the target node and creates the edge. Right-click or
press Escape to cancel the operation.
Note
The newly created edge automatically appears in all other windows showing the same view, provided that both its source and target nodes are currently displayed.
Note
If you create a duplicate edge of the same type between the same two nodes, a warning appears allowing you to cancel the operation.
Note
Adding a hierarchical edge is not possible using the
Edge Tool.
The hierarchy can only be edited using the
Hierarchy
Tool. This ensures the integrity of the hierarchical structure by preventing the
accidental creation of cycles.
5.9.4.4. Editing Edges¶
The
Edge Tool can also be used to edit existing edges. To
change the source or target node of an edge, move the pointer over the edge near its
start or end. The pointer changes to a four-arrow icon, indicating that the edge
endpoint can be modified. Press and hold the left mouse button to drag the endpoint
to a different node. Potential target nodes are highlighted
as the pointer moves
over them. Release the mouse button over a highlighted node to confirm the new endpoint.
The edge is re-routed from/to its new source/target node.
If the mouse button is released over empty space, the edge reverts to its original
location.
The direction of an edge can be reversed using
Edit →
Reverse edge from
its context menu. If the edge appears in multiple views, it is updated in all
of them; therefore, an additional confirmation step is required.
5.9.4.5. Creating and Editing Notes¶
Notes (sometimes called comments) are useful for documentation, particularly in architecture diagrams. They can be used to add extra information to the diagram as a whole or to individual nodes.
An example diagram using notes¶
Adding notes to your diagram¶
Add note... is only available if the graph schema contains the node type
UML Element and the edge type UML Relation.
Attaching a note to a node¶
To create a new note linked to an existing node, open the context menu over the node and
choose
Edit →
Add note.... This
opens the Notes Editor, a rich text editor window, in which you can
compose the note. See The Notes Editor below for how to
use the Notes Editor.
After clicking on Insert note in the Notes Editor, the note appears near
the node it refers to. It is linked to the node with a dashed line.
The note is an ordinary node of type UML Note in the graph
and supports all Gravis node features, such as layouts, selection operations,
etc. The dashed line linking it to its associated node is an ordinary edge of type
UML NoteLink.
Adding free notes¶
To create a free top-level note that is not linked to any node, open the context menu
over the window background and choose
Edit →
Add note.... Free notes are useful for headings or general information
about a diagram. They can also be used inside components to add general information. To
add a free note inside a component, create it at the top level, then move it inside the
component using the Hierarchy Tool (see Editing the
hierarchy).
A free note inside a component¶
Repositioning, resizing and collapsing notes¶
You can reposition and resize a note using the usual Gravis features, just like
any other node: drag the note itself or its resize handle using a suitable tool, such as
the Navigate Tool or Select Tool.
To save space, you can collapse a note by double-clicking it. Double-click it again to re-expand it.
A note in collapsed and expanded state¶
You can link a note to a different node by retargeting the linking edge using the
Edge Tool (see Editing Edges).
You can turn a linked note into a standalone note by deleting the linking edge. To do
this, open the context menu over the edge and choose
Edit →
Delete edge.
You can link a note to as many nodes as you like by creating additional UML
NoteLink edges using the Edge Tool.
Sometimes it is useful to maintain a link between a note and a node that is not currently displayed
but remains in the graph and can be retrieved when needed. You can achieve this by
hiding the linking edge instead of deleting it (see Hiding
Elements). You can determine which node the
note is linked to without unhiding the edge by choosing
Visualization →
Focus on node (see
Focus on Nodes).
Hint
Since notes are ordinary nodes, you can also add a note to another note.
Editing a note¶
To edit a note, open its context menu and choose
Edit →
Edit text..., or simply double-click the note while holding
down the Shift key. This opens the Notes Editor window.
The Notes Editor¶
The Notes Editor is used to create and edit notes. It offers standard text
editing features. While editing, all changes can be undone or redone using the
undo and
redo buttons (shortcuts: Ctrl+Z for undo, and Ctrl+Y on
Windows or Ctrl+Shift+Z on Linux for redo).
When invoked via
Add note..., clicking on Insert note
inserts the new note into the diagram. When invoked via Edit text...,
clicking on Update note updates the edited note in the diagram. Clicking
on Cancel closes the dialog without changing the diagram.
The Notes Editor¶
Text character properties¶
The following controls are used to change text character properties:
Make the selected text bold. |
|
Make the selected text italic. |
|
Underline the selected text. |
|
Strike out the selected text. |
|
Display the selected text in a monospace font (e. g., for code references). |
|
Change the color of the selected text. |
|
Enter a URL to turn the selected text into a link. |
If any of the controls are used while there is no text selection, the properties are set on the caret and applied to text that is subsequently entered.
Text paragraph properties¶
The following controls are used to change text paragraph properties:
Turn the paragraphs into a list with bullets. |
|
Turn the paragraphs into a list with numbers. |
|
Make the paragraphs left aligned. |
|
Make the paragraphs centered. |
|
Make the paragraphs right aligned. |
If any of the controls are used while there is no text selection, the properties are applied to the paragraph containing the caret.
Inserting rules and images¶
Click on to insert a horizontal line between paragraphs.
Click on to insert an image into the text. This opens a file chooser to
browse for an image file in JPEG, PNG, or SVG format. After a suitable
image file has been chosen, the
Insert image dialog is shown:
You can insert the image using an absolute or relative filename reference. The absolute
filename can be seen by hovering the mouse pointer over the Absolute
filename option. The relative filename is displayed next to Relative
filename:. A relative reference is used by default, if possible. If the graph has not
been saved yet, the only available option is an absolute reference. Graph files with
relative image references can be moved between platforms and systems, provided that both
the graph file and the referenced images are transferred together while maintaining
their relative positions in the filesystem. The downside of relative references
is that they may become invalid if the graph file is moved within the file hierarchy
without also moving the images.
The Scale image size section allows you to control the size at which an
image is inserted. Note that the absolute width and height are stored in the note;
therefore, if the dimensions of the referenced image file change later, the image will
be squashed into the originally defined rectangle.
Customizing Notes¶
To change the background color of a note, choose
Visualization →
Node color... from the
note’s context menu. See Expanded area color.
To change the text size in a note, choose
Visualization →
Base font size... from
the note’s context menu and enter a font size in points. This value is
specific to the current diagram and is stored in saved layouts.
A customized note¶
5.9.4.6. Deleting Elements¶
Delete a single graph element using
Edit →
Delete node or
Delete edge from its context menu.
Delete multiple graph elements simultaneously by selecting them and then using
Edit →
Delete
selection from the graph window’s context menu.
See Section Working with Selections and the Marking.
5.9.4.7. Editing Attributes¶
Editing Node Names¶
The name of a node (i.e., the value of its Source.Name attribute) can be
changed via
Edit →
Rename... from
the node’s context menu or by pressing F2 while the pointer is over the node.
The name can also be edited directly on the canvas: click the node and then click its name, ensuring enough time between the two clicks so they are not interpreted as a double-click. An edit field will appear over the name. Press Enter or click elsewhere to save the new name, or Esc to discard it. An empty name is discarded as well. This method works for node types that display the node name below the node, which is the default. It does not work for node types configured to show other information, e.g., the value of a different attribute.
Names containing line breaks are displayed over multiple lines. Since Enter ends the edit, line breaks cannot be added directly on the canvas; they must be pasted in.
Editing Arbitrary Attributes¶
All attributes can be inspected, added, modified, or removed via
Open →
Node
Information... or
Open →
Edge
Information.... These dialogs contain an attribute area that displays the
values of all set attributes as a hierarchical tree. Dots in
the attribute names separate levels; for example, the attributes Source.File,
Source.Line, and Source.Name are shown as File, Line, and
Name under a common parent item, Source.
Editing Attribute Values¶
Selecting Edit... from the context menu or double-clicking a row opens the
Edit attribute dialog, which allows you to change the value of the selected
attribute.
Note
A toggle attribute (boolean flag) cannot be changed. The only way to modify it is to remove it.
Caution
The identities of graph elements are defined by their attributes. Changing the
values of certain attributes (most notably Linkage.Name) may alter a
node’s identity, causing GXL files and layouts to no longer refer to that node.
Deleting Attributes¶
An attribute can be removed by selecting Delete from its context menu.
Adding Attributes¶
To add an attribute that is not yet present, select Add
attribute... from the context menu of the attribute area. After choosing the
attribute key (i.e., the name of the attribute) from the Key: drop-down menu,
the Type: field will display the attribute type. Enter the desired value
in the Value: field and click OK to add the attribute.