Search in sources :

Example 6 with MibObject

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

the class MibSelectionDialog 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.verticalSpacing = WidgetHelper.DIALOG_SPACING;
    layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    layout.numColumns = (nodeId != 0) ? 3 : 2;
    dialogArea.setLayout(layout);
    /* MIB tree */
    Composite mibTreeGroup = new Composite(dialogArea, SWT.NONE);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = WidgetHelper.INNER_SPACING;
    mibTreeGroup.setLayout(layout);
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessVerticalSpace = true;
    gd.verticalAlignment = SWT.FILL;
    gd.verticalSpan = 2;
    mibTreeGroup.setLayoutData(gd);
    Label label = new Label(mibTreeGroup, SWT.NONE);
    label.setText(Messages.get().MibSelectionDialog_MIBTree);
    mibTree = new MibBrowser(mibTreeGroup, SWT.BORDER);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessVerticalSpace = true;
    gd.verticalAlignment = SWT.FILL;
    gd.widthHint = 500;
    gd.heightHint = 250;
    mibTree.setLayoutData(gd);
    mibTree.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            onMibTreeSelectionChanged();
        }
    });
    // $NON-NLS-1$
    oid = WidgetHelper.createLabeledText(dialogArea, SWT.BORDER, 500, Messages.get().MibSelectionDialog_OID, "", WidgetHelper.DEFAULT_LAYOUT_DATA);
    oid.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            onManualOidChange();
        }
    });
    if (nodeId != 0) {
        Button button = new Button(dialogArea, SWT.PUSH);
        button.setText(Messages.get().MibSelectionDialog_Walk);
        gd = new GridData();
        gd.widthHint = WidgetHelper.BUTTON_WIDTH_HINT;
        gd.verticalAlignment = SWT.BOTTOM;
        button.setLayoutData(gd);
        button.addSelectionListener(new SelectionListener() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                doWalk();
            }

            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }
        });
    }
    details = new MibObjectDetails(dialogArea, SWT.NONE, false, mibTree);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    gd.verticalAlignment = SWT.FILL;
    gd.horizontalSpan = (nodeId != 0) ? 2 : 1;
    details.setLayoutData(gd);
    if (initialSelection != null) {
        MibObject object = MibCache.getMibTree().findObject(initialSelection, false);
        if (object != null) {
            mibTree.setSelection(object);
        }
    }
    return dialogArea;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Label(org.eclipse.swt.widgets.Label) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) MibObjectDetails(org.netxms.ui.eclipse.snmp.widgets.MibObjectDetails) MibBrowser(org.netxms.ui.eclipse.snmp.widgets.MibBrowser) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MibObject(org.netxms.client.snmp.MibObject) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 7 with MibObject

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

the class MibSelectionDialog method onMibTreeSelectionChanged.

/**
 * Handler for selection change in MIB tree
 */
private void onMibTreeSelectionChanged() {
    MibObject object = mibTree.getSelection();
    if ((object != null) && updateObjectId) {
        SnmpObjectId objectId = object.getObjectId();
        // $NON-NLS-1$
        oid.setText((objectId != null) ? objectId.toString() : "");
    }
    details.setObject(object);
}
Also used : SnmpObjectId(org.netxms.client.snmp.SnmpObjectId) MibObject(org.netxms.client.snmp.MibObject)

Example 8 with MibObject

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

the class MibSelectionDialog method onManualOidChange.

/**
 * Handler for manual OID change
 */
private void onManualOidChange() {
    MibObject o = MibCache.findObject(oid.getText(), false);
    if (o != null) {
        updateObjectId = false;
        mibTree.setSelection(o);
        updateObjectId = true;
    }
}
Also used : MibObject(org.netxms.client.snmp.MibObject)

Aggregations

MibObject (org.netxms.client.snmp.MibObject)8 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)2 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)2 ModifyEvent (org.eclipse.swt.events.ModifyEvent)2 ModifyListener (org.eclipse.swt.events.ModifyListener)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)2 MibBrowser (org.netxms.ui.eclipse.snmp.widgets.MibBrowser)2 MibObjectDetails (org.netxms.ui.eclipse.snmp.widgets.MibObjectDetails)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Action (org.eclipse.jface.action.Action)1 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1