Search in sources :

Example 16 with NetworkMapLink

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++;
        }
    }
}
Also used : NetworkMapResource(org.netxms.client.maps.elements.NetworkMapResource) NetworkMapLink(org.netxms.client.maps.NetworkMapLink) ClusterResource(org.netxms.client.objects.ClusterResource)

Example 17 with NetworkMapLink

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();
    }
}
Also used : PropertyDialog(org.eclipse.ui.internal.dialogs.PropertyDialog) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) LinkEditor(org.netxms.ui.eclipse.networkmaps.views.helpers.LinkEditor) NetworkMapLink(org.netxms.client.maps.NetworkMapLink)

Example 18 with NetworkMapLink

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();
}
Also used : NetworkMapPage(org.netxms.client.maps.NetworkMapPage) AbstractObject(org.netxms.client.objects.AbstractObject) VPNConnector(org.netxms.client.objects.VPNConnector) NetworkMapObject(org.netxms.client.maps.elements.NetworkMapObject) NetworkMapLink(org.netxms.client.maps.NetworkMapLink)

Example 19 with NetworkMapLink

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);
    }
}
Also used : BendpointEditor(org.netxms.ui.eclipse.networkmaps.views.helpers.BendpointEditor) NetworkMapLink(org.netxms.client.maps.NetworkMapLink)

Example 20 with NetworkMapLink

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);
            }
        }
    }
}
Also used : NetworkMapDCIImage(org.netxms.client.maps.elements.NetworkMapDCIImage) NetworkMapElement(org.netxms.client.maps.elements.NetworkMapElement) DCIImageConfiguration(org.netxms.client.maps.configs.DCIImageConfiguration) NetworkMapDCIContainer(org.netxms.client.maps.elements.NetworkMapDCIContainer) NetworkMapLink(org.netxms.client.maps.NetworkMapLink) SingleDciConfig(org.netxms.client.maps.configs.SingleDciConfig)

Aggregations

NetworkMapLink (org.netxms.client.maps.NetworkMapLink)27 NetworkMapObject (org.netxms.client.maps.elements.NetworkMapObject)16 AbstractObject (org.netxms.client.objects.AbstractObject)12 NetworkMapPage (org.netxms.client.maps.NetworkMapPage)6 NetworkMapElement (org.netxms.client.maps.elements.NetworkMapElement)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 NXCPMessage (org.netxms.base.NXCPMessage)3 AccessPoint (org.netxms.client.objects.AccessPoint)3 Cluster (org.netxms.client.objects.Cluster)3 Container (org.netxms.client.objects.Container)3 Node (org.netxms.client.objects.Node)3 CoreException (org.eclipse.core.runtime.CoreException)2 Point (org.eclipse.draw2d.geometry.Point)2 PartInitException (org.eclipse.ui.PartInitException)2 ObjectStatus (org.netxms.client.constants.ObjectStatus)2 DCIImageConfiguration (org.netxms.client.maps.configs.DCIImageConfiguration)2 SingleDciConfig (org.netxms.client.maps.configs.SingleDciConfig)2 NetworkMapDCIContainer (org.netxms.client.maps.elements.NetworkMapDCIContainer)2 NetworkMapDCIImage (org.netxms.client.maps.elements.NetworkMapDCIImage)2 ClusterResource (org.netxms.client.objects.ClusterResource)2