use of org.netxms.ui.eclipse.eventmanager.widgets.EventSelector in project netxms by netxms.
the class TrapConfigurationDialog 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.OUTER_SPACING;
dialogArea.setLayout(layout);
description = WidgetHelper.createLabeledText(dialogArea, SWT.BORDER, 300, Messages.get().TrapConfigurationDialog_Description, trap.getDescription(), WidgetHelper.DEFAULT_LAYOUT_DATA);
Composite oidSelection = new Composite(dialogArea, SWT.NONE);
layout = new GridLayout();
layout.horizontalSpacing = WidgetHelper.INNER_SPACING;
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 2;
oidSelection.setLayout(layout);
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
oidSelection.setLayoutData(gd);
oid = WidgetHelper.createLabeledText(oidSelection, SWT.BORDER, 300, Messages.get().TrapConfigurationDialog_TrapOID, (trap.getObjectId() != null) ? trap.getObjectId().toString() : "", // $NON-NLS-1$
WidgetHelper.DEFAULT_LAYOUT_DATA);
buttonSelect = new Button(oidSelection, SWT.PUSH);
buttonSelect.setText(Messages.get().TrapConfigurationDialog_Select);
gd = new GridData();
gd.widthHint = WidgetHelper.BUTTON_WIDTH_HINT;
gd.verticalAlignment = SWT.BOTTOM;
buttonSelect.setLayoutData(gd);
buttonSelect.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
selectObjectId();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
event = new EventSelector(dialogArea, SWT.NONE);
event.setLabel(Messages.get().TrapConfigurationDialog_Event);
event.setEventCode(trap.getEventCode());
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
event.setLayoutData(gd);
eventTag = WidgetHelper.createLabeledText(dialogArea, SWT.BORDER, SWT.DEFAULT, Messages.get().TrapConfigurationDialog_UserTag, trap.getUserTag(), WidgetHelper.DEFAULT_LAYOUT_DATA);
Label label = new Label(dialogArea, SWT.NONE);
label.setText(Messages.get().TrapConfigurationDialog_Parameters);
Composite paramArea = new Composite(dialogArea, SWT.NONE);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
paramArea.setLayoutData(gd);
layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 0;
layout.marginWidth = 0;
paramArea.setLayout(layout);
paramList = new TableViewer(paramArea, SWT.BORDER | SWT.FULL_SELECTION);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
gd.widthHint = 300;
paramList.getTable().setLayoutData(gd);
setupParameterList();
Composite buttonArea = new Composite(paramArea, SWT.NONE);
RowLayout btnLayout = new RowLayout();
btnLayout.type = SWT.VERTICAL;
btnLayout.marginBottom = 0;
btnLayout.marginLeft = 0;
btnLayout.marginRight = 0;
btnLayout.marginTop = 0;
btnLayout.fill = true;
btnLayout.spacing = WidgetHelper.OUTER_SPACING;
buttonArea.setLayout(btnLayout);
buttonAdd = new Button(buttonArea, SWT.PUSH);
buttonAdd.setText(Messages.get().TrapConfigurationDialog_Add);
buttonAdd.setLayoutData(new RowData(WidgetHelper.BUTTON_WIDTH_HINT, SWT.DEFAULT));
buttonAdd.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
addParameter();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
buttonEdit = new Button(buttonArea, SWT.PUSH);
buttonEdit.setText(Messages.get().TrapConfigurationDialog_Edit);
buttonEdit.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
editParameter();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
buttonDelete = new Button(buttonArea, SWT.PUSH);
buttonDelete.setText(Messages.get().TrapConfigurationDialog_Delete);
buttonDelete.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
deleteParameters();
}
});
buttonUp = new Button(buttonArea, SWT.PUSH);
buttonUp.setText(Messages.get().TrapConfigurationDialog_MoveUp);
buttonDown = new Button(buttonArea, SWT.PUSH);
buttonDown.setText(Messages.get().TrapConfigurationDialog_MoveDown);
return dialogArea;
}
Aggregations