use of org.netxms.client.maps.elements.NetworkMapObject in project netxms by netxms.
the class NetworkMapWidget method onObjectChange.
/**
* Called by session listener when NetXMS object was changed.
*
* @param object changed NetXMS object
*/
private void onObjectChange(final AbstractObject object) {
if (mapPage == null)
return;
NetworkMapObject element = mapPage.findObjectElement(object.getObjectId());
if (element != null)
viewer.refresh(element, true);
List<NetworkMapLink> links = mapPage.findLinksWithStatusObject(object.getObjectId());
if (links != null)
for (NetworkMapLink l : links) viewer.refresh(l);
}
use of org.netxms.client.maps.elements.NetworkMapObject in project netxms by netxms.
the class ServiceComponents 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);
}
}
}
use of org.netxms.client.maps.elements.NetworkMapObject in project netxms by netxms.
the class ServiceComponents method buildMapPage.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.networkmaps.views.NetworkMap#buildMapPage()
*/
@Override
protected void buildMapPage() {
mapPage = new NetworkMapPage(ID + rootObject.getObjectId());
long elementId = mapPage.createElementId();
mapPage.addElement(new NetworkMapObject(elementId, rootObject.getObjectId()));
addServiceComponents(rootObject, elementId);
addDciToRequestList();
}
use of org.netxms.client.maps.elements.NetworkMapObject in project netxms by netxms.
the class VlanMap method collectVlanInfo.
/**
* Recursively collect VLAN information starting from given node
*
* @param page map page
* @param root root node
* @throws Exception
* @throws NXCException
*/
private long collectVlanInfo(NetworkMapPage page, Node root) throws Exception {
if (page.findObjectElement(root.getObjectId()) != null)
return -1;
long rootElementId = mapPage.createElementId();
page.addElement(new NetworkMapObject(rootElementId, root.getObjectId()));
List<VlanInfo> vlans = session.getVlans(root.getObjectId());
for (VlanInfo vlan : vlans) {
if (vlan.getVlanId() == vlanId) {
Port[] ports = vlan.getPorts();
for (Port port : ports) {
processVlanPort(page, root, port, rootElementId);
}
break;
}
}
return rootElementId;
}
use of org.netxms.client.maps.elements.NetworkMapObject in project netxms by netxms.
the class MapLabelProvider method getImage.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
*/
@Override
public Image getImage(Object element) {
if (element instanceof NetworkMapObject) {
AbstractObject object = session.findObjectById(((NetworkMapObject) element).getObjectId());
if (object != null) {
// First, check if object has custom map image set
final UUID objectImageGuid = object.getImage();
if (objectImageGuid != null && !objectImageGuid.equals(NXCommon.EMPTY_GUID)) {
return ImageProvider.getInstance(viewer.getControl().getDisplay()).getImage(objectImageGuid);
}
// Try registered network map image providers
Image img = MapImageProvidersManager.getInstance().getMapImage(object);
if (img != null)
return img;
// Use built-in image as last resort
switch(object.getObjectClass()) {
case AbstractObject.OBJECT_NODE:
if ((((Node) object).getCapabilities() & Node.NC_IS_BRIDGE) != 0)
return imgNodeSwitch;
if ((((Node) object).getCapabilities() & Node.NC_IS_ROUTER) != 0)
return imgNodeRouter;
if ((((Node) object).getCapabilities() & Node.NC_IS_PRINTER) != 0)
return imgNodePrinter;
if (// $NON-NLS-1$
((Node) object).getPlatformName().startsWith("windows"))
return imgNodeWindows;
if (// $NON-NLS-1$
((Node) object).getPlatformName().startsWith("Linux"))
return imgNodeLinux;
if (// $NON-NLS-1$
((Node) object).getPlatformName().startsWith("FreeBSD"))
return imgNodeFreeBSD;
return imgNodeGeneric;
case AbstractObject.OBJECT_SUBNET:
return imgSubnet;
case AbstractObject.OBJECT_CONTAINER:
return imgService;
case AbstractObject.OBJECT_CLUSTER:
return imgCluster;
case AbstractObject.OBJECT_ACCESSPOINT:
return imgAccessPoint;
case AbstractObject.OBJECT_NETWORKMAP:
return imgNetMap;
case AbstractObject.OBJECT_INTERFACE:
return imgInterface;
default:
return imgOther;
}
} else {
return imgUnknown;
}
} else if (element instanceof NetworkMapResource) {
return imgResCluster;
}
return null;
}
Aggregations