Search in sources :

Example 1 with SelectDciDialog

use of org.netxms.ui.eclipse.datacollection.dialogs.SelectDciDialog in project netxms by netxms.

the class SummaryTableColumns method importColumns.

/**
 * Import Columns from node
 */
private void importColumns() {
    final SelectDciDialog dialog = new SelectDciDialog(getShell(), 0);
    dialog.setAllowTemplateItems(true);
    dialog.setEnableEmptySelection(false);
    if (dialog.open() == Dialog.OK) {
        final List<DciValue> selection = dialog.getSelection();
        List<DciSummaryTableColumn> select = new ArrayList<DciSummaryTableColumn>();
        for (DciValue item : selection) {
            DciSummaryTableColumn column = new DciSummaryTableColumn(item.getDescription(), item.getName(), 0, ";");
            select.add(column);
            columns.add(column);
        }
        viewer.setInput(columns.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) DciSummaryTableColumn(org.netxms.client.datacollection.DciSummaryTableColumn) SelectDciDialog(org.netxms.ui.eclipse.datacollection.dialogs.SelectDciDialog)

Example 2 with SelectDciDialog

use of org.netxms.ui.eclipse.datacollection.dialogs.SelectDciDialog in project netxms by netxms.

the class DataSources 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<ChartDciConfig> select = new ArrayList<ChartDciConfig>();
        for (DciValue item : selection) {
            ChartDciConfig dci = new ChartDciConfig(item);
            select.add(dci);
            labelProvider.addCacheEntry(dci.nodeId, dci.dciId, dci.name);
            dciList.add(dci);
        }
        viewer.setInput(dciList.toArray());
        viewer.setSelection(new StructuredSelection(select));
    }
}
Also used : ChartDciConfig(org.netxms.client.datacollection.ChartDciConfig) 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)

Example 3 with SelectDciDialog

use of org.netxms.ui.eclipse.datacollection.dialogs.SelectDciDialog in project netxms by netxms.

the class DciSelector method selectionButtonHandler.

/* (non-Javadoc)
	 * @see org.netxms.ui.eclipse.widgets.AbstractSelector#selectionButtonHandler()
	 */
@Override
protected void selectionButtonHandler() {
    SelectDciDialog dlg = new SelectDciDialog(getShell(), fixedNode ? nodeId : 0);
    dlg.setEnableEmptySelection(true);
    dlg.setDcObjectType(dcObjectType);
    dlg.setSingleSelection(true);
    dlg.setAllowNoValueObjects(allowNoValueObjects);
    if (dlg.open() == Window.OK) {
        List<DciValue> dci = dlg.getSelection();
        if (dci != null && dci.size() == 1) {
            setDciId(dci.get(0).getNodeId(), dci.get(0).getId());
            dciName = dci.get(0).getName();
            dciObjectType = dci.get(0).getDcObjectType();
        } else {
            setDciId(fixedNode ? nodeId : 0, 0);
            dciName = null;
        }
    }
}
Also used : DciValue(org.netxms.client.datacollection.DciValue) SelectDciDialog(org.netxms.ui.eclipse.datacollection.dialogs.SelectDciDialog)

Example 4 with SelectDciDialog

use of org.netxms.ui.eclipse.datacollection.dialogs.SelectDciDialog 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 SelectDciDialog

use of org.netxms.ui.eclipse.datacollection.dialogs.SelectDciDialog in project netxms by netxms.

the class ConditionData 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<ConditionDciInfo> select = new ArrayList<ConditionDciInfo>();
        for (DciValue item : selection) {
            ConditionDciInfo dci = new ConditionDciInfo(item.getNodeId(), item.getId(), item.getDcObjectType(), Threshold.F_LAST, 1);
            labelProvider.addCacheEntry(dci.getNodeId(), dci.getDciId(), item.getDescription());
            dciList.add(dci);
            select.add(dci);
            viewer.setInput(dciList.toArray());
            isModified = true;
            viewer.setSelection(new StructuredSelection(dci));
            editItem();
        }
        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) ConditionDciInfo(org.netxms.client.datacollection.ConditionDciInfo) SelectDciDialog(org.netxms.ui.eclipse.datacollection.dialogs.SelectDciDialog)

Aggregations

SelectDciDialog (org.netxms.ui.eclipse.datacollection.dialogs.SelectDciDialog)9 DciValue (org.netxms.client.datacollection.DciValue)8 ArrayList (java.util.ArrayList)7 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)7 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)7 ChartDciConfig (org.netxms.client.datacollection.ChartDciConfig)3 SingleDciConfig (org.netxms.client.maps.configs.SingleDciConfig)2 ConditionDciInfo (org.netxms.client.datacollection.ConditionDciInfo)1 DciSummaryTableColumn (org.netxms.client.datacollection.DciSummaryTableColumn)1