use of org.netxms.client.maps.elements.NetworkMapResource in project netxms by netxms.
the class ClusterTab method addOwnedResources.
/**
* @param id
* @param objectId
* @param resources
*/
private void addOwnedResources(NetworkMapPage page, long rootElementId, long objectId, List<ClusterResource> resources) {
long elementId = rootElementId * 100000;
for (ClusterResource r : resources) {
if (r.getCurrentOwner() == objectId) {
page.addElement(new NetworkMapResource(elementId, NetworkMapResource.CLUSTER_RESOURCE, r));
page.addLink(new NetworkMapLink(0, rootElementId, elementId));
elementId++;
}
}
}
use of org.netxms.client.maps.elements.NetworkMapResource 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