A opção de alinhamento controla como um pai é posicionado em
relação a seus nós-filhos. O alinhamento pode ser configurado globalmente,
neste caso, todos os nós são alinhados da mesma maneira, ou localmente em
cada nó, com o resultado de que ocorrem alinhamentos diferentes no mesmo
desenho.

Opções de alinhamento
Alinhamento Global
Para configurar o alinhamento global:
Use o método ibm_ilog.graphlayout.tree.TreeLayout.setGlobalAlignment:
treeLayout.setGlobalAlignment(ibm_ilog.graphlayout.tree.TreeLayout.WEST);
Os valores válidos para o alinhamento global são:
- ibm_ilog.graphlayout.tree.TreeLayout.CENTER (o padrão)O pai é centralizado sobre seus nós-filhos, considerando o centro dos nós-filhos.
- ibm_ilog.graphlayout.tree.TreeLayout.BORDER_CENTERO pai é centralizado sobre seus nós-filhos, considerando a borda dos nós-filhos. Se o tamanho do primeiro e do último filhos variar, o alinhamento do centro da borda posicionará o pai mais próximo do maior filho do que do alinhamento do centro padrão.
- ibm_ilog.graphlayout.tree.TreeLayout.EASTO pai é alinhado com a borda de seu filho mais ao leste. Por exemplo, se a direção do fluxo for para a parte inferior, leste será a direção à direita. Se a direção do fluxo for para a parte superior, leste será a direção à esquerda. Consulte Usando Direções da Bússola para Parâmetros de Layout Posicionais (TL) para obter detalhes.
- ibm_ilog.graphlayout.tree.TreeLayout.WESTO pai é alinhado com a borda de seu filho mais ao oeste. Por exemplo, se a direção do fluxo for para a parte inferior, oeste será a direção à esquerda. Se a direção do fluxo for para a direita, oeste será a direção para a parte inferior. Consulte Usando Direções da Bússola para Parâmetros de Layout Posicionais (TL) para obter detalhes.
- ibm_ilog.graphlayout.tree.TreeLayout.TIP_OVER_EASTThe child nodes are arranged sequentially instead of in parallel and the parent node is placed with an offset to the child nodes. The child nodes are to the east of the parent node. Para obter detalhes, consulte Alinhamento invertido.
- ibm_ilog.graphlayout.tree.TreeLayout.TIP_OVER_WESTThe child nodes are arranged sequentially instead of in parallel and the parent node is placed with an offset to the child nodes. The child nodes are to the west of the parent node. Para obter detalhes, consulte Alinhamento invertido.
- ibm_ilog.graphlayout.tree.TreeLayout.TIP_OVER_EAST_WESTThe child nodes are arranged sequentially instead of in parallel and the parent node is placed with an offset to the child nodes. The child nodes are arranged on both sides of the parent node. The first child node is placed to the east. Subsequent child nodes are placed to the east or the west, such that the space used on both sides is roughly the same; that is, the sum of the heights of the subtrees to the east is approximately the same as that of the subtrees to the west. Para obter detalhes, consulte Alinhamento invertido.
- ibm_ilog.graphlayout.tree.TreeLayout.TIP_OVER_BOTH_SIDESOs nós-filhos são organizados de forma sequencial em vez de paralela. Whereas the alignment
TIP_OVER
arranges all child nodes on the same side of the parent, this alignment arranges the child nodes on both sides of the parent. Unlike TIP_OVER_EAST_WEST alignment, this style does not try to optimize the space used on both sides, but always places the odd-numbered child nodes on the west and the even-numbered on the east. Each pair of child nodes, one on the west and one on the east, has its odd and even nodes aligned with each other. Para obter detalhes, consulte Alinhamento invertido. - ibm_ilog.graphlayout.tree.TreeLayout.MIXEDCada nó-pai pode ter um alinhamento diferente. O alinhamento de cada nó individual pode ser configurado com o resultado de que podem ocorrer alinhamentos diferentes no mesmo gráfico.
Alinhamento de Nós Individuais
Todos os nós possuem o mesmo alinhamento, a menos que o
alinhamento global esteja configurado como
MIXED
. Apenas quando o alinhamento
global estiver configurado como
MIXED
, cada nó poderá ter um estilo
de alinhamento individual. 
Diferentes alinhamentos combinados no mesmo desenho
Para especificar o alinhamento de um nó individual:
Use os métodos:
treeLayout.setGlobalAlignment(ibm_ilog.graphlayout.tree.TreeLayout.MIXED); treeLayout.setAlignment(graph.children[1], ibm_ilog.graphlayout.tree.TreeLayout.EAST);
Os valores válidos para
alignment
são: - ibm_ilog.graphlayout.tree.TreeLayout.CENTER (the default value)
- ibm_ilog.graphlayout.tree.TreeLayout.BORDER_CENTER
- ibm_ilog.graphlayout.tree.TreeLayout.EAST
- ibm_ilog.graphlayout.tree.TreeLayout.WEST
- ibm_ilog.graphlayout.tree.TreeLayout.TIP_OVER_EAST
- ibm_ilog.graphlayout.tree.TreeLayout.TIP_OVER_WEST
- ibm_ilog.graphlayout.tree.TreeLayout.TIP_OVER_EAST_WEST
- ibm_ilog.graphlayout.tree.TreeLayout.TIP_OVER_BOTH_SIDES
Alinhamento invertido
Normalmente, os nós-filhos de um nó são posicionados em uma
organização paralela,
com irmãos como vizinhos diretos uns dos outros. Tip-over alignments mean a sequential arrangement of the child
nodes instead.

Normal alignment and a tip-over alignment
O alinhamento invertido é útil quando a árvore possui muitas
folhas.
With normal alignment, a tree with many leaves would result in the
layout being wide. If the global alignment style is set to tip-over,
the drawing is tall rather than wide. Para balancear a largura e altura
do desenho, é possível configurar o alinhamento global como combinado.
Por exemplo:
treeLayout.setGlobalAlignment(ibm_ilog.graphlayout.tree.TreeLayout.MIXED);
Além disso, é possível configurar o alinhamento individual
como invertido para alguns pais com um alto número de nós-filhos, da
seguinte forma:
treeLayout.setAlignment(parent, ibm_ilog.graphlayout.tree.TreeLayout.TIP_OVER_EAST);
Tip-over alignments can be specified explicitly for some
or all of the nodes. Tree Layout offers layout modes that automatically
determine when to tip over, giving a drawing that fits into a specified
aspect ratio. Estes modos de layout são
descritos em
Modos de Layout Invertidos.
Tip-over-east alignment arranges the nodes on the east
side of the center line that starts at the parent node. The tip-over-west
alignment arranges the nodes on the west side of that line. There
are also two variants that distribute the subtrees on both sides of
that line. You can specify these variants at a parent node with a
high number of child nodes by the following code:
treeLayout.setAlignment(parent, ibm_ilog.graphlayout.tree.TreeLayout.TIP_OVER_EAST_WEST);
or:
treeLayout.setAlignment(parent, ibm_ilog.graphlayout.tree.TreeLayout.TIP_OVER_BOTH_SIDES);
The following figures show the difference between Tip-over-east-west
and tip-over-both-sides alignments.
![]() |
![]() |
Tip-over-east-west alignment | Tip-over-both-sides alignment |
Tip-over alignment works well with the orthogonal link
style; see Estilo de Link (TL). The following
figure shows the difference between tip over on one side and tip over
on two sides. Tip-over alignments are specified for the red nodes;
the blue nodes have center alignment.

Tip-over alignments
Child alignments
Global alignment is valid for all nodes. The alignment
specified at a node is valid for all child nodes of that node. Additionally,
you can specify exceptions for certain nodes that are aligned differently
than all other child nodes. This is useful for organization chart
displays. In an organization chart that shows a management hierarchy,
some of the people shown do not belong to the hierarchy. Instead,
they are associated with a particular member of the hierarchy. An
example could be a secretary associated with a manager of a company.
In an organization chart tree, the node representing the secretary
is normally displayed close to the node of the manager, but is not
mixed with the child nodes that represent the normal workers who report
to that manager.
To set the child alignment of a specific node:
Use os métodos:
treeLayout.setChildAlignment(node, alignment);
treeLayout.getChildAlignment(node);
The following values are valid for child alignment:
- ibm_ilog.graphlayout.tree.TreeLayout.UNSPECIFIED (the default value).No exceptional alignment is specified for the child node. It is aligned like normal child nodes.
- The child node is made a neighbor on the east of its parent.
- The child node is made a neighbor on the west of its parent.
- The child node layout is like tip-over-east alignment, but the node appears above all normal child nodes. The normal child nodes can have any alignment. If they also have tip-over-east alignment, you can distinguish the associate node by using a different spacing. Consulte o Parâmetros de espaçamento.
- The child node layout is like tip-over-west alignment, but the node appears above all normal child nodes. The normal child nodes can have any alignment. If they also have tip-over-west alignment, you can distinguish the associate node by using a different spacing. Consulte o Parâmetros de espaçamento.
- The child node layout is like tip-over-both-sides alignment, that is, alternating on the east and the west, but the node appears above all normal child nodes. The normal child nodes can have any alignment. If they also have tip-over-both-sides alignment, you can distinguish the associate node by using a different spacing. Consulte o Parâmetros de espaçamento.
In the following figures, the yellow nodes have child
alignments EAST_NEIGHBOR or WEST_NEIGHBOR, and the red nodes have
child alignments TIP_OVER_ASSOCIATE_EAST or TIP_OVER_ASSOCIATE_BOTH_SIDES.
The green nodes have unspecified child alignments, that is, they are
aligned with the global alignment style.
![]() |
![]() |
Alignments shown are for yellow node: east neighbor, for red nodes: tip over associate east, and for green nodes: center | Alignments shown are for yellow node: east neighbor, for red nodes: tip over associate east, and for green nodes: tip over both sides |
![]() |
![]() |
Alignments shown are for yellow node: west neighbor, for red nodes: tip over associate both sides, and for green nodes: center | Alignments shown are for yellow node: west neighbor, for red nodes: tip over associate both sides, and for green nodes: tip over both sides |