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);
}
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;
}
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);
}
}
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));
}
}
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;
}
Aggregations