Search in sources :

Example 6 with SnmpObjectId

use of org.netxms.client.snmp.SnmpObjectId in project netxms by netxms.

the class General method selectParameter.

/**
 * Select parameter
 */
private void selectParameter() {
    Dialog dlg;
    switch(origin.getSelectionIndex()) {
        case DataCollectionItem.INTERNAL:
            if (sourceNode.getObjectId() != 0)
                dlg = new SelectInternalParamDlg(getShell(), sourceNode.getObjectId());
            else
                dlg = new SelectInternalParamDlg(getShell(), dci.getNodeId());
            break;
        case DataCollectionItem.AGENT:
        case DataCollectionItem.DEVICE_DRIVER:
            if (sourceNode.getObjectId() != 0)
                dlg = new SelectAgentParamDlg(getShell(), sourceNode.getObjectId(), origin.getSelectionIndex(), false);
            else
                dlg = new SelectAgentParamDlg(getShell(), dci.getNodeId(), origin.getSelectionIndex(), false);
            break;
        case DataCollectionItem.SNMP:
        case DataCollectionItem.CHECKPOINT_SNMP:
            SnmpObjectId oid;
            try {
                oid = SnmpObjectId.parseSnmpObjectId(parameter.getText());
            } catch (SnmpObjectIdFormatException e) {
                oid = null;
            }
            if (sourceNode.getObjectId() != 0)
                dlg = new SelectSnmpParamDlg(getShell(), oid, sourceNode.getObjectId());
            else
                dlg = new SelectSnmpParamDlg(getShell(), oid, dci.getNodeId());
            break;
        case DataCollectionItem.WINPERF:
            if (sourceNode.getObjectId() != 0)
                dlg = new WinPerfCounterSelectionDialog(getShell(), sourceNode.getObjectId());
            else
                dlg = new WinPerfCounterSelectionDialog(getShell(), dci.getNodeId());
            break;
        case DataCollectionItem.SCRIPT:
            dlg = new SelectParameterScriptDialog(getShell());
            break;
        default:
            dlg = null;
            break;
    }
    if ((dlg != null) && (dlg.open() == Window.OK)) {
        IParameterSelectionDialog pd = (IParameterSelectionDialog) dlg;
        description.setText(pd.getParameterDescription());
        parameter.setText(pd.getParameterName());
        dataType.select(getDataTypePosition(pd.getParameterDataType()));
        editor.fireOnSelectItemListeners(origin.getSelectionIndex(), pd.getParameterName(), pd.getParameterDescription(), pd.getParameterDataType());
    }
}
Also used : SelectSnmpParamDlg(org.netxms.ui.eclipse.datacollection.dialogs.SelectSnmpParamDlg) SelectParameterScriptDialog(org.netxms.ui.eclipse.datacollection.dialogs.SelectParameterScriptDialog) DCIPropertyPageDialog(org.netxms.ui.eclipse.datacollection.propertypages.helpers.DCIPropertyPageDialog) IParameterSelectionDialog(org.netxms.ui.eclipse.datacollection.dialogs.IParameterSelectionDialog) WinPerfCounterSelectionDialog(org.netxms.ui.eclipse.datacollection.dialogs.WinPerfCounterSelectionDialog) Dialog(org.eclipse.jface.dialogs.Dialog) SnmpObjectIdFormatException(org.netxms.client.snmp.SnmpObjectIdFormatException) SelectAgentParamDlg(org.netxms.ui.eclipse.datacollection.dialogs.SelectAgentParamDlg) SnmpObjectId(org.netxms.client.snmp.SnmpObjectId) SelectParameterScriptDialog(org.netxms.ui.eclipse.datacollection.dialogs.SelectParameterScriptDialog) IParameterSelectionDialog(org.netxms.ui.eclipse.datacollection.dialogs.IParameterSelectionDialog) WinPerfCounterSelectionDialog(org.netxms.ui.eclipse.datacollection.dialogs.WinPerfCounterSelectionDialog) SelectInternalParamDlg(org.netxms.ui.eclipse.datacollection.dialogs.SelectInternalParamDlg)

Example 7 with SnmpObjectId

use of org.netxms.client.snmp.SnmpObjectId in project netxms by netxms.

the class EditColumnDialog method okPressed.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
	 */
@Override
protected void okPressed() {
    String oidText = snmpOid.getText().trim();
    if (!oidText.isEmpty()) {
        try {
            SnmpObjectId oid = SnmpObjectId.parseSnmpObjectId(oidText);
            column.setSnmpObjectId(oid);
        } catch (SnmpObjectIdFormatException e) {
            MessageDialogHelper.openWarning(getShell(), Messages.get().EditColumnDialog_Warning, Messages.get().EditColumnDialog_InvalidOID);
            return;
        }
    } else {
        column.setSnmpObjectId(null);
    }
    column.setName(name.getText().trim());
    column.setDisplayName(displayName.getText().trim());
    column.setInstanceColumn(checkInstanceColumn.getSelection());
    column.setInstanceLabelColumn(checkInstanceLabelColumn.getSelection());
    column.setDataType(getDataTypeByPosition(dataType.getSelectionIndex()));
    column.setAggregationFunction(aggregationFunction.getSelectionIndex());
    super.okPressed();
}
Also used : SnmpObjectIdFormatException(org.netxms.client.snmp.SnmpObjectIdFormatException) SnmpObjectId(org.netxms.client.snmp.SnmpObjectId)

Example 8 with SnmpObjectId

use of org.netxms.client.snmp.SnmpObjectId in project netxms by netxms.

the class EditColumnDialog method createDialogArea.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite dialogArea = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
    dialogArea.setLayout(layout);
    name = new LabeledText(dialogArea, SWT.NONE);
    name.setLabel(Messages.get().EditColumnDialog_Name);
    name.setText(columnObject.getName());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 350;
    name.setLayoutData(gd);
    format = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().EditColumnDialog_Format, WidgetHelper.DEFAULT_LAYOUT_DATA);
    for (int i = 0; i < formatNames.length; i++) format.add(formatNames[i]);
    format.select(columnObject.getFormat());
    Composite dataGroup = null;
    if (snmpColumn) {
        dataGroup = new Composite(dialogArea, SWT.NONE);
        layout = new GridLayout();
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        layout.horizontalSpacing = WidgetHelper.INNER_SPACING;
        layout.numColumns = 2;
        dataGroup.setLayout(layout);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        dataGroup.setLayoutData(gd);
    }
    data = new LabeledText(snmpColumn ? dataGroup : dialogArea, SWT.NONE);
    if (snmpColumn) {
        data.setLabel(Messages.get().EditColumnDialog_SNMP_OID);
        data.setText(columnObject.getSnmpOid());
    } else {
        data.setLabel(Messages.get().EditColumnDialog_SubstrIndex);
        data.setText(Integer.toString(columnObject.getSubstringIndex()));
    }
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 350;
    data.setLayoutData(gd);
    if (snmpColumn) {
        selectButton = new Button(dataGroup, SWT.PUSH);
        // $NON-NLS-1$
        selectButton.setText("...");
        gd = new GridData();
        gd.verticalAlignment = SWT.BOTTOM;
        selectButton.setLayoutData(gd);
        selectButton.addSelectionListener(new SelectionListener() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                SnmpObjectId initial;
                try {
                    initial = SnmpObjectId.parseSnmpObjectId(data.getText());
                } catch (SnmpObjectIdFormatException ex) {
                    initial = null;
                }
                MibSelectionDialog dlg = new MibSelectionDialog(getShell(), initial, 0);
                if (dlg.open() == Window.OK) {
                    data.setText(dlg.getSelectedObjectId().toString());
                }
            }

            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }
        });
    }
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) MibSelectionDialog(org.netxms.ui.eclipse.snmp.dialogs.MibSelectionDialog) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SnmpObjectIdFormatException(org.netxms.client.snmp.SnmpObjectIdFormatException) SnmpObjectId(org.netxms.client.snmp.SnmpObjectId) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 9 with SnmpObjectId

use of org.netxms.client.snmp.SnmpObjectId in project netxms by netxms.

the class TrapConfigurationDialog method addParameter.

/**
 * Add new parameter mapping
 */
private void addParameter() {
    SnmpTrapParameterMapping pm = new SnmpTrapParameterMapping(new SnmpObjectId());
    ParamMappingEditDialog dlg = new ParamMappingEditDialog(getShell(), pm);
    if (dlg.open() == Window.OK) {
        pmap.add(pm);
        paramList.setInput(pmap.toArray());
        paramList.setSelection(new StructuredSelection(pm));
    }
}
Also used : SnmpTrapParameterMapping(org.netxms.client.snmp.SnmpTrapParameterMapping) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SnmpObjectId(org.netxms.client.snmp.SnmpObjectId)

Example 10 with SnmpObjectId

use of org.netxms.client.snmp.SnmpObjectId in project netxms by netxms.

the class TrapConfigurationDialog method selectObjectId.

/**
 * Select OID using MIB selection dialog
 */
private void selectObjectId() {
    SnmpObjectId id;
    try {
        id = SnmpObjectId.parseSnmpObjectId(oid.getText());
    } catch (SnmpObjectIdFormatException e) {
        id = null;
    }
    MibSelectionDialog dlg = new MibSelectionDialog(getShell(), id, 0);
    if (dlg.open() == Window.OK) {
        oid.setText(dlg.getSelectedObjectId().toString());
        oid.setFocus();
    }
}
Also used : SnmpObjectIdFormatException(org.netxms.client.snmp.SnmpObjectIdFormatException) SnmpObjectId(org.netxms.client.snmp.SnmpObjectId)

Aggregations

SnmpObjectId (org.netxms.client.snmp.SnmpObjectId)11 SnmpObjectIdFormatException (org.netxms.client.snmp.SnmpObjectIdFormatException)8 Dialog (org.eclipse.jface.dialogs.Dialog)2 IParameterSelectionDialog (org.netxms.ui.eclipse.datacollection.dialogs.IParameterSelectionDialog)2 SelectAgentParamDlg (org.netxms.ui.eclipse.datacollection.dialogs.SelectAgentParamDlg)2 SelectParameterScriptDialog (org.netxms.ui.eclipse.datacollection.dialogs.SelectParameterScriptDialog)2 SelectSnmpParamDlg (org.netxms.ui.eclipse.datacollection.dialogs.SelectSnmpParamDlg)2 DCIPropertyPageDialog (org.netxms.ui.eclipse.datacollection.propertypages.helpers.DCIPropertyPageDialog)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 MibObject (org.netxms.client.snmp.MibObject)1 SnmpTrapParameterMapping (org.netxms.client.snmp.SnmpTrapParameterMapping)1 SnmpValue (org.netxms.client.snmp.SnmpValue)1 SelectInternalParamDlg (org.netxms.ui.eclipse.datacollection.dialogs.SelectInternalParamDlg)1