Search in sources :

Example 6 with EventSelector

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;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) RowData(org.eclipse.swt.layout.RowData) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) EventSelector(org.netxms.ui.eclipse.eventmanager.widgets.EventSelector) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Label(org.eclipse.swt.widgets.Label) TableViewer(org.eclipse.jface.viewers.TableViewer) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

GridData (org.eclipse.swt.layout.GridData)6 GridLayout (org.eclipse.swt.layout.GridLayout)6 Composite (org.eclipse.swt.widgets.Composite)6 EventSelector (org.netxms.ui.eclipse.eventmanager.widgets.EventSelector)6 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 Label (org.eclipse.swt.widgets.Label)4 SelectionListener (org.eclipse.swt.events.SelectionListener)3 Button (org.eclipse.swt.widgets.Button)3 LabeledText (org.netxms.ui.eclipse.widgets.LabeledText)3 RowLayout (org.eclipse.swt.layout.RowLayout)2 Group (org.eclipse.swt.widgets.Group)2 TableViewer (org.eclipse.jface.viewers.TableViewer)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 RowData (org.eclipse.swt.layout.RowData)1 Combo (org.eclipse.swt.widgets.Combo)1 Spinner (org.eclipse.swt.widgets.Spinner)1 Text (org.eclipse.swt.widgets.Text)1 EventObject (org.netxms.client.events.EventObject)1