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