use of org.netxms.client.maps.NetworkMapLink 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.NetworkMapLink in project netxms by netxms.
the class PredefinedMap method showLinkProperties.
/**
* Show properties for currently selected link
*/
private void showLinkProperties() {
updateObjectPositions();
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if ((selection.size() != 1) || !(selection.getFirstElement() instanceof NetworkMapLink))
return;
LinkEditor link = new LinkEditor((NetworkMapLink) selection.getFirstElement(), mapPage);
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, link);
if (dlg != null) {
dlg.open();
if (link.isModified())
saveMap();
}
}
use of org.netxms.client.maps.NetworkMapLink in project netxms by netxms.
the class IPNeighbors method buildMapPage.
/**
* Build map page
*/
protected void buildMapPage() {
// $NON-NLS-1$
mapPage = new NetworkMapPage(ID + "." + this.toString());
long rootElementId = mapPage.createElementId();
mapPage.addElement(new NetworkMapObject(rootElementId, rootObject.getObjectId()));
addSubnets(rootObject, rootElementId);
for (long objectId : rootObject.getChildIdList()) {
AbstractObject object = session.findObjectById(objectId);
if ((object != null) && (object instanceof VPNConnector)) {
AbstractObject peer = session.findObjectById(((VPNConnector) object).getPeerGatewayId());
if (peer != null) {
long elementId = mapPage.createElementId();
mapPage.addElement(new NetworkMapObject(elementId, peer.getObjectId()));
NetworkMapLink link = new NetworkMapLink(NetworkMapLink.VPN, rootElementId, elementId);
link.setName(object.getObjectName());
mapPage.addLink(link);
addSubnets(peer, elementId);
}
}
}
addDciToRequestList();
}
use of org.netxms.client.maps.NetworkMapLink in project netxms by netxms.
the class AbstractNetworkMapView method changeLinkLock.
/**
* Set link locked or unlocked
*/
protected void changeLinkLock() {
if ((currentSelection.size() != 1) || !(currentSelection.getFirstElement() instanceof NetworkMapLink))
return;
NetworkMapLink link = (NetworkMapLink) currentSelection.getFirstElement();
link.setLocked(actionLockLink.isChecked());
if (link.isLocked() && bendpointEditor != null) {
bendpointEditor.stop();
bendpointEditor = null;
} else if (link.getRouting() == NetworkMapLink.ROUTING_BENDPOINTS) {
bendpointEditor = new BendpointEditor(link, (GraphConnection) viewer.getGraphControl().getSelection().get(0), viewer);
}
}
use of org.netxms.client.maps.NetworkMapLink in project netxms by netxms.
the class AbstractNetworkMapView method addDciToRequestList.
/**
* Goes thought all links and trys to add to request list required DCIs.
*/
protected void addDciToRequestList() {
Collection<NetworkMapLink> linkList = mapPage.getLinks();
for (NetworkMapLink item : linkList) {
if (item.hasDciData()) {
for (SingleDciConfig value : item.getDciAsList()) {
if (value.type == SingleDciConfig.ITEM) {
dciValueProvider.addDci(value.getNodeId(), value.dciId, mapPage);
} else {
dciValueProvider.addDci(value.getNodeId(), value.dciId, value.column, value.instance, mapPage);
}
}
}
}
Collection<NetworkMapElement> mapElements = mapPage.getElements();
for (NetworkMapElement element : mapElements) {
if (element instanceof NetworkMapDCIContainer) {
NetworkMapDCIContainer item = (NetworkMapDCIContainer) element;
if (item.hasDciData()) {
for (SingleDciConfig value : item.getObjectDCIArray()) {
if (value.type == SingleDciConfig.ITEM) {
dciValueProvider.addDci(value.getNodeId(), value.dciId, mapPage);
} else {
dciValueProvider.addDci(value.getNodeId(), value.dciId, value.column, value.instance, mapPage);
}
}
}
}
if (element instanceof NetworkMapDCIImage) {
NetworkMapDCIImage item = (NetworkMapDCIImage) element;
DCIImageConfiguration config = item.getImageOptions();
SingleDciConfig value = config.getDci();
if (value.type == SingleDciConfig.ITEM) {
dciValueProvider.addDci(value.getNodeId(), value.dciId, mapPage);
} else {
dciValueProvider.addDci(value.getNodeId(), value.dciId, value.column, value.instance, mapPage);
}
}
}
}
Aggregations