Search in sources :

Example 11 with NetworkMapElement

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

the class ExtendedGraphViewer method inputChanged.

/* (non-Javadoc)
	 * @see org.eclipse.gef4.zest.core.viewers.GraphViewer#inputChanged(java.lang.Object, java.lang.Object)
	 */
@Override
protected void inputChanged(Object input, Object oldInput) {
    boolean dynamicLayoutEnabled = graph.isDynamicLayoutEnabled();
    graph.setDynamicLayout(false);
    super.inputChanged(input, oldInput);
    graph.setDynamicLayout(dynamicLayoutEnabled);
    decorationLayer.removeAll();
    decorationFigures.clear();
    if ((getContentProvider() instanceof MapContentProvider) && (getLabelProvider() instanceof MapLabelProvider)) {
        mapDecorations = ((MapContentProvider) getContentProvider()).getDecorations(input);
        if (mapDecorations != null) {
            MapLabelProvider lp = (MapLabelProvider) getLabelProvider();
            for (NetworkMapElement d : mapDecorations) {
                DecorationLayerAbstractFigure figure = (DecorationLayerAbstractFigure) lp.getFigure(d);
                figure.setLocation(new org.eclipse.draw2d.geometry.Point(d.getX(), d.getY()));
                decorationLayer.add(figure);
                decorationFigures.put(d.getId(), figure);
            }
        }
    }
}
Also used : NetworkMapElement(org.netxms.client.maps.elements.NetworkMapElement)

Example 12 with NetworkMapElement

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

the class MapContentProvider method inputChanged.

/* (non-Javadoc)
	 * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
	 */
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
    synchronized (cachedDciValues) {
        cachedDciValues.clear();
    }
    if (newInput instanceof NetworkMapPage) {
        page = (NetworkMapPage) newInput;
        synchronized (cachedDciValues) {
            for (NetworkMapElement e : page.getElements()) {
                if (e instanceof NetworkMapObject) {
                    long id = ((NetworkMapObject) e).getObjectId();
                    AbstractObject object = session.findObjectById(id);
                    if ((object != null) && (object instanceof AbstractNode)) {
                        cachedDciValues.put(id, null);
                    }
                }
            }
        }
    } else {
        page = null;
    }
}
Also used : NetworkMapPage(org.netxms.client.maps.NetworkMapPage) AbstractNode(org.netxms.client.objects.AbstractNode) NetworkMapElement(org.netxms.client.maps.elements.NetworkMapElement) AbstractObject(org.netxms.client.objects.AbstractObject) NetworkMapObject(org.netxms.client.maps.elements.NetworkMapObject)

Example 13 with NetworkMapElement

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

the class NetworkMapWidget 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

NetworkMapElement (org.netxms.client.maps.elements.NetworkMapElement)13 NetworkMapLink (org.netxms.client.maps.NetworkMapLink)6 NetworkMapObject (org.netxms.client.maps.elements.NetworkMapObject)5 AbstractObject (org.netxms.client.objects.AbstractObject)4 Point (org.eclipse.draw2d.geometry.Point)2 NetworkMapPage (org.netxms.client.maps.NetworkMapPage)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 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Dimension (org.eclipse.draw2d.geometry.Dimension)1 Graph (org.eclipse.gef4.zest.core.widgets.Graph)1 GraphNode (org.eclipse.gef4.zest.core.widgets.GraphNode)1 EntityLayout (org.eclipse.gef4.zest.layouts.interfaces.EntityLayout)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 Item (org.eclipse.swt.widgets.Item)1