Search in sources :

Example 6 with SingleDciConfig

use of org.netxms.client.maps.configs.SingleDciConfig in project netxms by netxms.

the class NXCSession method getActiveThresholds.

/**
 * Get active thresholds
 *
 * @param dciConfig Dci config
 * @return list of active thresholds
 * @throws IOException
 * @throws NXCException
 */
public List<Threshold> getActiveThresholds(List<SingleDciConfig> dciConfig) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_ACTIVE_THRESHOLDS);
    long base = NXCPCodes.VID_DCI_VALUES_BASE;
    msg.setFieldInt32(NXCPCodes.VID_NUM_ITEMS, dciConfig.size());
    for (SingleDciConfig c : dciConfig) {
        c.fillMessage(msg, base);
        base += 10;
    }
    sendMessage(msg);
    final NXCPMessage response = waitForRCC(msg.getMessageId());
    int count = response.getFieldAsInt32(NXCPCodes.VID_NUM_THRESHOLDS);
    List<Threshold> list = new ArrayList<Threshold>(count);
    base = NXCPCodes.VID_DCI_THRESHOLD_BASE;
    for (int i = 0; i < count; i++, base += 20) {
        list.add(new Threshold(response, base));
    }
    return list;
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage) ArrayList(java.util.ArrayList) ConnectionPoint(org.netxms.client.topology.ConnectionPoint) AccessPoint(org.netxms.client.objects.AccessPoint) SingleDciConfig(org.netxms.client.maps.configs.SingleDciConfig) Threshold(org.netxms.client.datacollection.Threshold)

Example 7 with SingleDciConfig

use of org.netxms.client.maps.configs.SingleDciConfig in project netxms by netxms.

the class LinkDataSources method editItem.

/**
 * Edit selected item
 */
private void editItem() {
    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    SingleDciConfig dci = (SingleDciConfig) selection.getFirstElement();
    if (dci == null)
        return;
    DataSourceEditDlg dlg = new DataSourceEditDlg(getShell(), dci);
    if (dlg.open() == Window.OK) {
        viewer.update(dci, null);
    }
}
Also used : DataSourceEditDlg(org.netxms.ui.eclipse.networkmaps.dialogs.DataSourceEditDlg) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SingleDciConfig(org.netxms.client.maps.configs.SingleDciConfig)

Example 8 with SingleDciConfig

use of org.netxms.client.maps.configs.SingleDciConfig in project netxms by netxms.

the class LinkDataSources method addItem.

/**
 * Add new item
 */
private void addItem() {
    SelectDciDialog dlg = new SelectDciDialog(getShell(), 0);
    if (dlg.open() == Window.OK) {
        List<DciValue> selection = dlg.getSelection();
        List<SingleDciConfig> select = new ArrayList<SingleDciConfig>();
        for (DciValue item : selection) {
            SingleDciConfig dci = new SingleDciConfig(item);
            select.add(dci);
            labelProvider.addCacheEntry(dci.getNodeId(), dci.dciId, dci.name);
            dciList.add(dci);
        }
        viewer.setInput(dciList.toArray());
        viewer.setSelection(new StructuredSelection(select));
    }
}
Also used : DciValue(org.netxms.client.datacollection.DciValue) ArrayList(java.util.ArrayList) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SelectDciDialog(org.netxms.ui.eclipse.datacollection.dialogs.SelectDciDialog) SingleDciConfig(org.netxms.client.maps.configs.SingleDciConfig)

Example 9 with SingleDciConfig

use of org.netxms.client.maps.configs.SingleDciConfig in project netxms by netxms.

the class GeneralDCIImagePropertyPage method createContents.

@Override
protected Control createContents(Composite parent) {
    container = (NetworkMapDCIImage) getElement().getAdapter(NetworkMapDCIImage.class);
    config = container.getImageOptions();
    SingleDciConfig dciConf = config.getDci();
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.makeColumnsEqualWidth = true;
    dialogArea.setLayout(layout);
    dci = new DciSelector(dialogArea, SWT.NONE, false);
    dci.setLabel(Messages.get().GeneralDCIImagePropertyPage_DataSource);
    if (dciConf != null) {
        dci.setDciId(dciConf.getNodeId(), dciConf.getDciId());
        dci.setDciObjectType(dciConf.getType());
    }
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    dci.setLayoutData(gd);
    instanceColumn = new LabeledText(dialogArea, SWT.NONE);
    instanceColumn.setLabel(Messages.get().GeneralDCIImagePropertyPage_Column);
    if (dciConf != null)
        instanceColumn.setText(dciConf.getColumn());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    instanceColumn.setLayoutData(gd);
    dataColumn = new LabeledText(dialogArea, SWT.NONE);
    dataColumn.setLabel(Messages.get().GeneralDCIImagePropertyPage_Instance);
    if (dciConf != null)
        dataColumn.setText(dciConf.getInstance());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    dataColumn.setLayoutData(gd);
    image = new ImageSelector(dialogArea, SWT.NONE);
    image.setLabel(Messages.get().GeneralDCIImagePropertyPage_DefaultImage);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    image.setLayoutData(gd);
    try {
        selectedImage = config.getDefaultImage();
        image.setImageGuid(selectedImage, true);
    } catch (Exception e) {
    }
    return dialogArea;
}
Also used : DciSelector(org.netxms.ui.eclipse.datacollection.widgets.DciSelector) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) GridData(org.eclipse.swt.layout.GridData) ImageSelector(org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector) SingleDciConfig(org.netxms.client.maps.configs.SingleDciConfig)

Example 10 with SingleDciConfig

use of org.netxms.client.maps.configs.SingleDciConfig 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

SingleDciConfig (org.netxms.client.maps.configs.SingleDciConfig)11 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 ArrayList (java.util.ArrayList)3 DciValue (org.netxms.client.datacollection.DciValue)3 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 NXCPMessage (org.netxms.base.NXCPMessage)2 NetworkMapLink (org.netxms.client.maps.NetworkMapLink)2 DCIImageConfiguration (org.netxms.client.maps.configs.DCIImageConfiguration)2 NetworkMapDCIContainer (org.netxms.client.maps.elements.NetworkMapDCIContainer)2 NetworkMapDCIImage (org.netxms.client.maps.elements.NetworkMapDCIImage)2 NetworkMapElement (org.netxms.client.maps.elements.NetworkMapElement)2 SelectDciDialog (org.netxms.ui.eclipse.datacollection.dialogs.SelectDciDialog)2 DataSourceEditDlg (org.netxms.ui.eclipse.networkmaps.dialogs.DataSourceEditDlg)2 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Threshold (org.netxms.client.datacollection.Threshold)1 AccessPoint (org.netxms.client.objects.AccessPoint)1 ConnectionPoint (org.netxms.client.topology.ConnectionPoint)1 DciSelector (org.netxms.ui.eclipse.datacollection.widgets.DciSelector)1