Search in sources :

Example 11 with WidgetFactory

use of org.netxms.ui.eclipse.tools.WidgetFactory in project netxms by netxms.

the class LogParserEditor method createGeneralArea.

/**
 * @param generalArea
 */
private void createGeneralArea(Composite generalArea) {
    GridLayout layout = new GridLayout();
    layout.makeColumnsEqualWidth = false;
    layout.numColumns = 3;
    generalArea.setLayout(layout);
    if (!isSyslogParser) {
        labelFileName = new LabeledText(generalArea, SWT.NONE);
        labelFileName.setLabel("Parsing file path");
        // $NON-NLS-1$
        labelFileName.setText((parser.getFile() != null) ? parser.getFile() : "");
        GridData gd = new GridData();
        gd.grabExcessHorizontalSpace = true;
        gd.horizontalAlignment = SWT.FILL;
        labelFileName.setLayoutData(gd);
        labelFileName.getTextControl().addModifyListener(new ModifyListener() {

            @Override
            public void modifyText(ModifyEvent e) {
                fireModifyListeners();
                for (LogParserRule rule : parser.getRules()) {
                    if (rule.getEditor() != null)
                        rule.getEditor().updateWindowsEventLogFields();
                }
            }
        });
        String[] items = { "AUTO", "ACP", "UTF-8", "UCS-2", "UCS-2LE", "UCS-2BE", "UCS-4", "UCS-4LE", "UCS-4BE" };
        gd = new GridData();
        comboFileEncoding = (Combo) WidgetHelper.createLabeledCombo(generalArea, SWT.BORDER | SWT.READ_ONLY, "Parsing file encoding", gd);
        comboFileEncoding.setItems(items);
        comboFileEncoding.select((parser.getEncoding() != null) ? Arrays.asList(items).indexOf(parser.getEncoding()) : 0);
        comboFileEncoding.addModifyListener(new ModifyListener() {

            @Override
            public void modifyText(ModifyEvent e) {
                fireModifyListeners();
            }
        });
    }
    final WidgetFactory spinnerFactory = new WidgetFactory() {

        @Override
        public Control createControl(Composite parent, int style) {
            return new Spinner(parent, style);
        }
    };
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    spinerTrace = (Spinner) WidgetHelper.createLabeledControl(generalArea, SWT.BORDER, spinnerFactory, "Trace level", gd);
    spinerTrace.setMinimum(0);
    spinerTrace.setMaximum(9);
    spinerTrace.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            fireModifyListeners();
        }
    });
    spinerTrace.setSelection(parser.getTrace() != null ? parser.getTrace() : 0);
    checkProcessAll = toolkit.createButton(generalArea, "Process all", SWT.CHECK);
    checkProcessAll.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fireModifyListeners();
        }
    });
}
Also used : LogParserModifyListener(org.netxms.ui.eclipse.serverconfig.widgets.helpers.LogParserModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Spinner(org.eclipse.swt.widgets.Spinner) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) LogParserRule(org.netxms.ui.eclipse.serverconfig.widgets.helpers.LogParserRule) WidgetFactory(org.netxms.ui.eclipse.tools.WidgetFactory) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Aggregations

GridLayout (org.eclipse.swt.layout.GridLayout)11 Composite (org.eclipse.swt.widgets.Composite)11 WidgetFactory (org.netxms.ui.eclipse.tools.WidgetFactory)11 GridData (org.eclipse.swt.layout.GridData)10 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7 Spinner (org.eclipse.swt.widgets.Spinner)6 LabeledText (org.netxms.ui.eclipse.widgets.LabeledText)6 SelectionListener (org.eclipse.swt.events.SelectionListener)5 ModifyEvent (org.eclipse.swt.events.ModifyEvent)3 ModifyListener (org.eclipse.swt.events.ModifyListener)3 Button (org.eclipse.swt.widgets.Button)3 ScriptEditor (org.netxms.ui.eclipse.nxsl.widgets.ScriptEditor)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 DashboardComposite (org.netxms.ui.eclipse.widgets.DashboardComposite)2 File (java.io.File)1 Date (java.util.Date)1 Control (org.eclipse.swt.widgets.Control)1 FileDialog (org.eclipse.swt.widgets.FileDialog)1 Group (org.eclipse.swt.widgets.Group)1 Text (org.eclipse.swt.widgets.Text)1