// ! inner transitions) should be added to the tree item
public NodeNetInfo(AbstractPetriNetElementModel node, boolean addChildren) {
// Initialize the display of this item
super("");
m_nodeObject = node;
ModelElementContainer rootOwningContainer = m_nodeObject.getRootOwningContainer();
m_nodeOwner = rootOwningContainer != null ? rootOwningContainer.getOwningElement() : null;
setUserObject(getNodeString(m_nodeObject, m_nodeOwner));
// set the type of the element
typeId = node.getType();
// if the element is a transition-operator
if (node instanceof OperatorTransitionModel) {
OperatorTransitionModel otm = (OperatorTransitionModel) node;
typeId = otm.getOperatorType();
}
// Generic approach to detect whether this element has any children:
// Elements with children implement InnerElementContainer
if (addChildren && (node instanceof InnerElementContainer) &&
(typeId == OperatorTransitionModel.XOR_SPLIT_TYPE
|| typeId == OperatorTransitionModel.ANDJOIN_XORSPLIT_TYPE
|| typeId == OperatorTransitionModel.XORJOIN_ANDSPLIT_TYPE
|| typeId == OperatorTransitionModel.XOR_SPLITJOIN_TYPE
|| typeId == OperatorTransitionModel.SUBP_TYPE)) {
// Add sub-elements as tree items
InnerElementContainer operator = (InnerElementContainer) node;
ModelElementContainer simpleTransContainer = operator.getSimpleTransContainer();
// Recursively call ourselves to add inner nodes
Iterator<AbstractPetriNetElementModel> innerIterator = simpleTransContainer.getRootElements().iterator();
while (innerIterator.hasNext()) {
try {
AbstractPetriNetElementModel current = (AbstractPetriNetElementModel) innerIterator.next();
AbstractPetriNetElementModel owningElement = current.getRootOwningContainer().getOwningElement();
if ((owningElement != null)