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