Search in sources :

Example 21 with NetworkMapObject

use of org.netxms.client.maps.elements.NetworkMapObject in project netxms by netxms.

the class ServiceComponentsElement method addServiceComponents.

/**
 * Add parent services for given object
 *
 * @param object
 */
private void addServiceComponents(AbstractObject object, long parentElementId) {
    Iterator<Long> it = object.getChildren();
    while (it.hasNext()) {
        long objectId = it.next();
        AbstractObject child = session.findObjectById(objectId);
        if ((child != null) && ((child instanceof Container) || (child instanceof Cluster) || (child instanceof Node) || (child instanceof Condition))) {
            long elementId = mapPage.createElementId();
            mapPage.addElement(new NetworkMapObject(elementId, objectId));
            mapPage.addLink(new NetworkMapLink(NetworkMapLink.NORMAL, parentElementId, elementId));
            addServiceComponents(child, elementId);
        }
    }
}
Also used : Condition(org.netxms.client.objects.Condition) Container(org.netxms.client.objects.Container) AbstractObject(org.netxms.client.objects.AbstractObject) Node(org.netxms.client.objects.Node) Cluster(org.netxms.client.objects.Cluster) NetworkMapObject(org.netxms.client.maps.elements.NetworkMapObject) NetworkMapLink(org.netxms.client.maps.NetworkMapLink)

Aggregations

NetworkMapObject (org.netxms.client.maps.elements.NetworkMapObject)21 NetworkMapLink (org.netxms.client.maps.NetworkMapLink)13 AbstractObject (org.netxms.client.objects.AbstractObject)13 NetworkMapPage (org.netxms.client.maps.NetworkMapPage)8 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 Cluster (org.netxms.client.objects.Cluster)3 Container (org.netxms.client.objects.Container)3 Node (org.netxms.client.objects.Node)3 NXCPMessage (org.netxms.base.NXCPMessage)2 AccessPoint (org.netxms.client.objects.AccessPoint)2 Condition (org.netxms.client.objects.Condition)2 ConnectionPoint (org.netxms.client.topology.ConnectionPoint)2 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 UUID (java.util.UUID)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 Image (org.eclipse.swt.graphics.Image)1 Point (org.eclipse.swt.graphics.Point)1