Search in sources :

Example 1 with SingleDciConfig

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

the class NXCSession method getLastValues.

/**
 * Get last DCI values for given Single Dci Config list
 *
 * @param dciConfig List with Single Dci Configs
 * @return List of DCI values
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public DciValue[] getLastValues(List<SingleDciConfig> dciConfig) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_DCI_VALUES);
    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;
    }
    return sendLastValuesMsg(msg);
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage) SingleDciConfig(org.netxms.client.maps.configs.SingleDciConfig)

Example 2 with SingleDciConfig

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

the class LinkDciValueProvider method getDciDataAsString.

/**
 * @param link
 * @return
 */
public String getDciDataAsString(NetworkMapLink link) {
    if (!link.hasDciData())
        // $NON-NLS-1$
        return "";
    // $NON-NLS-1$
    String result = "";
    SingleDciConfig[] dciList = link.getDciList();
    for (int i = 0; i < dciList.length; ) {
        DciValue v = getDciLastValue(dciList[i].dciId);
        if (v != null) {
            String formatString = dciList[i].getFormatString();
            // $NON-NLS-1$
            result += v.format(formatString.isEmpty() ? "%s" : formatString);
        }
        if (++i != dciList.length)
            // $NON-NLS-1$
            result += "\n";
    }
    return result;
}
Also used : DciValue(org.netxms.client.datacollection.DciValue) SingleDciConfig(org.netxms.client.maps.configs.SingleDciConfig)

Example 3 with SingleDciConfig

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

the class DCIContainerDataSources 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 4 with SingleDciConfig

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

the class DCIContainerDataSources 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 5 with SingleDciConfig

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

the class GeneralDCIImagePropertyPage method applyChanges.

/**
 * Apply changes
 *
 * @param isApply true if update operation caused by "Apply" button
 */
private boolean applyChanges(final boolean isApply) {
    if (dci.getDciId() == 0) {
        MessageDialogHelper.openError(getShell(), Messages.get().GeneralDCIImagePropertyPage_Error, Messages.get().GeneralDCIImagePropertyPage_DciNotSelected);
        return false;
    }
    selectedImage = image.getImageGuid();
    if (selectedImage == null || selectedImage == NXCommon.EMPTY_GUID) {
        MessageDialogHelper.openError(getShell(), Messages.get().GeneralDCIImagePropertyPage_Error, Messages.get().GeneralDCIImagePropertyPage_DefImageNotSelected);
        return false;
    }
    SingleDciConfig dciConf = config.getDci();
    if (dciConf == null)
        dciConf = new SingleDciConfig();
    dciConf.setDciId(dci.getDciId());
    dciConf.setNodeId(dci.getNodeId());
    dciConf.setName(dci.getDciToolTipInfo());
    dciConf.setType(dci.getDciObjectType());
    dciConf.setColumn(instanceColumn.getText());
    dciConf.setInstance(dataColumn.getText());
    config.setDci(dciConf);
    config.setDefaultImage(selectedImage);
    container.setImageOptions(config);
    return true;
}
Also used : 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