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