use of org.eclipse.swt.widgets.Spinner in project abstools by abstools.
the class LineNumberDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
GridLayout gridLayout = new GridLayout(1, false);
Composite composite = (Composite) super.createDialogArea(parent);
composite.setLayout(gridLayout);
Composite stepsContainer = new Composite(composite, SWT.NONE);
stepsContainer.setLayout(gridLayout);
line = new Spinner(stepsContainer, SWT.NONE);
line.setMinimum(0);
line.setMaximum(Integer.MAX_VALUE);
line.setIncrement(1);
line.setSelection(0);
return composite;
}
use of org.eclipse.swt.widgets.Spinner in project tmdm-studio-se by Talend.
the class MDMServerConsolePreferencePage method doCreateContent.
private void doCreateContent(Composite parent) {
Composite composite1 = new Composite(parent, SWT.NONE);
composite1.setLayout(new GridLayout(3, false));
composite1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
new Label(composite1, SWT.NONE).setText(Messages.MDMServerConsolePrefsPage_RefreshLabel_1);
freqSpinner = new Spinner(composite1, SWT.BORDER | SWT.READ_ONLY);
freqSpinner.setMaximum(5);
freqSpinner.setMinimum(1);
GridDataFactory.fillDefaults().hint(10, SWT.DEFAULT).applyTo(freqSpinner);
new Label(composite1, SWT.NONE).setText(Messages.MDMServerConsolePrefsPage_RefreshLabel_2);
Composite composite2 = new Composite(parent, SWT.NONE);
composite2.setLayout(new GridLayout(2, false));
composite2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
new Label(composite2, SWT.NONE).setText(Messages.MDMServerConsolePrefsPage_Display_Buffer_Text);
bufferText = new Text(composite2, SWT.BORDER);
GridDataFactory.fillDefaults().hint(100, SWT.DEFAULT).applyTo(bufferText);
bufferText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String text = bufferText.getText().trim();
try {
int value = Integer.parseInt(text);
boolean isValid = value >= MIN_BUFFER_SIZE;
String errorMsg = isValid ? null : NLS.bind(Messages.MDMServerConsolePrefsPage_Error_Message1, MIN_BUFFER_SIZE);
setErrorMessage(errorMsg);
setValid(isValid);
} catch (NumberFormatException ex) {
setErrorMessage(Messages.MDMServerConsolePrefsPage_Error_Message);
setValid(false);
}
}
});
}
use of org.eclipse.swt.widgets.Spinner in project tmdm-studio-se by Talend.
the class ElementInfoConfigComposite method createControls.
private void createControls() {
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
setLayout(gridLayout);
autoExpandBtn = new Button(this, SWT.CHECK);
autoExpandBtn.setText(Messages.ElementInfoConfigComposite_AutoExpand);
autoExpandBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
final Label lblName = new Label(this, SWT.NONE);
lblName.setText(Messages.ElementInfoConfigComposite_Name);
txtName = new Text(this, SWT.BORDER);
final GridData gd_txtName = new GridData(SWT.FILL, SWT.CENTER, true, false);
txtName.setLayoutData(gd_txtName);
final Label lblReference = new Label(this, SWT.NONE);
// $NON-NLS-1$
lblReference.setText("Reference");
comboReference = new Combo(this, SWT.READ_ONLY);
final GridData gd_comboReference = new GridData(SWT.FILL, SWT.CENTER, true, false);
comboReference.setLayoutData(gd_comboReference);
occurrenceGroup = new Group(this, SWT.NONE);
final GridData gd_occurrenceGroup = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
occurrenceGroup.setLayoutData(gd_occurrenceGroup);
occurrenceGroup.setText(Messages.ElementInfoConfigComposite_Occurrence);
final GridLayout gridLayout_2 = new GridLayout();
gridLayout_2.numColumns = 3;
occurrenceGroup.setLayout(gridLayout_2);
final Label lblMinOcur = new Label(occurrenceGroup, SWT.NONE);
final GridData gd_lblMinOcur = new GridData(SWT.CENTER, SWT.CENTER, false, false);
lblMinOcur.setLayoutData(gd_lblMinOcur);
// $NON-NLS-1$
lblMinOcur.setText("Min");
new Label(occurrenceGroup, SWT.NONE);
final Label lblMaxOcur = new Label(occurrenceGroup, SWT.NONE);
final GridData gd_lblMaxOcur = new GridData(SWT.CENTER, SWT.CENTER, false, false);
lblMaxOcur.setLayoutData(gd_lblMaxOcur);
// $NON-NLS-1$
lblMaxOcur.setText("Max");
spinMin = new Spinner(occurrenceGroup, SWT.BORDER);
spinMin.setSelection(1);
spinMin.setMinimum(0);
spinMin.setMaximum(Integer.MAX_VALUE);
final Label label = new Label(occurrenceGroup, SWT.NONE);
// $NON-NLS-1$
label.setText("----->");
spinMax = new Spinner(occurrenceGroup, SWT.BORDER);
spinMax.setLayoutData(new GridData());
spinMax.setMaximum(Integer.MAX_VALUE);
spinMax.setMinimum(-1);
spinMax.setSelection(1);
initUIContents();
initUIListeners();
refresh();
}
use of org.eclipse.swt.widgets.Spinner in project portfolio by buchen.
the class ReportingPeriodDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
Composite editArea = new Composite(composite, SWT.NONE);
editArea.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
editArea.setLayout(new FormLayout());
radioLast = new Button(editArea, SWT.RADIO);
radioLast.setText(Messages.LabelReportingDialogLast);
years = new Spinner(editArea, SWT.BORDER);
years.setMinimum(0);
Label lblYears = new Label(editArea, SWT.NONE);
lblYears.setText(Messages.LabelReportingDialogYears);
months = new Spinner(editArea, SWT.BORDER);
months.setMinimum(0);
months.setMaximum(11);
Label lblMonths = new Label(editArea, SWT.NONE);
lblMonths.setText(Messages.LabelReportingDialogMonths);
radioLastDays = new Button(editArea, SWT.RADIO);
radioLastDays.setText(Messages.LabelReportingDialogLast);
days = new Spinner(editArea, SWT.BORDER);
days.setMinimum(1);
days.setMaximum(10000);
Label lblDays = new Label(editArea, SWT.NONE);
lblDays.setText(Messages.LabelReportingDialogDays);
radioLastTradingDays = new Button(editArea, SWT.RADIO);
radioLastTradingDays.setText(Messages.LabelReportingDialogLast);
tradingDays = new Spinner(editArea, SWT.BORDER);
tradingDays.setMinimum(1);
tradingDays.setMaximum(10000);
Label lblTradingDays = new Label(editArea, SWT.NONE);
lblTradingDays.setText(Messages.LabelReportingDialogTradingDays);
radioFromXtoY = new Button(editArea, SWT.RADIO);
radioFromXtoY.setText(Messages.LabelReportingDialogFrom);
dateFrom = new DatePicker(editArea);
Label lblTo = new Label(editArea, SWT.NONE);
lblTo.setText(Messages.LabelReportingDialogUntil);
dateTo = new DatePicker(editArea);
radioSinceX = new Button(editArea, SWT.RADIO);
radioSinceX.setText(Messages.LabelReportingDialogSince);
dateSince = new DatePicker(editArea);
radioYearX = new Button(editArea, SWT.RADIO);
radioYearX.setText(Messages.LabelReportingDialogYear);
year = new Spinner(editArea, SWT.BORDER);
year.setMinimum(Year.MIN_VALUE);
year.setMaximum(Year.MAX_VALUE);
//
// form layout
//
FormDataFactory.startingWith(radioLast).top(new FormAttachment(0, 10)).thenRight(years).thenRight(lblYears).thenRight(months).thenRight(lblMonths);
FormDataFactory.startingWith(radioLastDays).top(new FormAttachment(radioLast, 20)).thenRight(days).thenRight(lblDays);
FormDataFactory.startingWith(radioLastTradingDays).top(new FormAttachment(radioLastDays, 20)).thenRight(tradingDays).thenRight(lblTradingDays);
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
// under Mac OS X, the date input fields are not align with the text
// by default
FormDataFactory.startingWith(radioFromXtoY).top(new FormAttachment(radioLastTradingDays, 20)).thenRight(dateFrom.getControl()).top(new FormAttachment(radioFromXtoY, -1, SWT.TOP)).thenRight(lblTo).top(new FormAttachment(radioFromXtoY, 2, SWT.TOP)).thenRight(dateTo.getControl()).top(new FormAttachment(radioFromXtoY, -1, SWT.TOP));
FormDataFactory.startingWith(radioSinceX).top(new FormAttachment(radioFromXtoY, 20)).thenRight(dateSince.getControl()).top(new FormAttachment(radioSinceX, -1, SWT.TOP));
} else {
FormDataFactory.startingWith(radioFromXtoY).top(new FormAttachment(radioLastTradingDays, 20)).thenRight(dateFrom.getControl()).thenRight(lblTo).thenRight(dateTo.getControl());
FormDataFactory.startingWith(radioSinceX).top(new FormAttachment(radioFromXtoY, 20)).thenRight(dateSince.getControl());
}
FormDataFactory.startingWith(radioYearX).top(new FormAttachment(radioSinceX, 20)).thenRight(year);
//
// wiring
//
presetFromTemplate();
listen(radioLast, years, months);
listen(radioLastDays, days);
listen(radioLastTradingDays, tradingDays);
listen(radioFromXtoY, dateFrom.getControl(), dateTo.getControl());
listen(radioSinceX, dateSince.getControl());
listen(radioYearX, year);
return composite;
}
use of org.eclipse.swt.widgets.Spinner in project portfolio by buchen.
the class CSVImportDefinitionPage method createControl.
@Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
setControl(container);
container.setLayout(new FormLayout());
Label lblTarget = new Label(container, SWT.RIGHT);
lblTarget.setText(Messages.CSVImportLabelTarget);
Combo cmbTarget = new Combo(container, SWT.READ_ONLY);
ComboViewer target = new ComboViewer(cmbTarget);
target.setContentProvider(ArrayContentProvider.getInstance());
target.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
return ((Extractor) element).getLabel();
}
});
target.getCombo().setEnabled(!onlySecurityPrices);
target.addSelectionChangedListener(this);
Label lblDelimiter = new Label(container, SWT.NONE);
lblDelimiter.setText(Messages.CSVImportLabelDelimiter);
Combo cmbDelimiter = new Combo(container, SWT.READ_ONLY);
ComboViewer delimiter = new ComboViewer(cmbDelimiter);
delimiter.setContentProvider(ArrayContentProvider.getInstance());
delimiter.setInput(new Delimiter[] { //
new Delimiter(',', Messages.CSVImportSeparatorComma), //
new Delimiter(';', Messages.CSVImportSeparatorSemicolon), new Delimiter('\t', Messages.CSVImportSeparatorTab) });
cmbDelimiter.select(1);
delimiter.addSelectionChangedListener(this);
Label lblSkipLines = new Label(container, SWT.NONE);
lblSkipLines.setText(Messages.CSVImportLabelSkipLines);
final Spinner skipLines = new Spinner(container, SWT.BORDER);
skipLines.setMinimum(0);
skipLines.addModifyListener(event -> onSkipLinesChanged(skipLines.getSelection()));
Label lblEncoding = new Label(container, SWT.NONE);
lblEncoding.setText(Messages.CSVImportLabelEncoding);
Combo cmbEncoding = new Combo(container, SWT.READ_ONLY);
ComboViewer encoding = new ComboViewer(cmbEncoding);
encoding.setContentProvider(ArrayContentProvider.getInstance());
encoding.setInput(Charset.availableCharsets().values().toArray());
encoding.setSelection(new StructuredSelection(Charset.defaultCharset()));
encoding.addSelectionChangedListener(this);
final Button firstLineIsHeader = new Button(container, SWT.CHECK);
firstLineIsHeader.setText(Messages.CSVImportLabelFirstLineIsHeader);
firstLineIsHeader.setSelection(true);
firstLineIsHeader.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
onFirstLineIsHeaderChanged(firstLineIsHeader.getSelection());
}
});
Composite compositeTable = new Composite(container, SWT.NONE);
//
// form layout
//
int width = widest(lblTarget, lblDelimiter, lblEncoding);
FormDataFactory.startingWith(lblTarget).width(width).top(new FormAttachment(0, 5)).thenRight(cmbTarget).right(new FormAttachment(50, -5)).thenBelow(cmbDelimiter).label(lblDelimiter).right(new FormAttachment(50, -5)).thenBelow(cmbEncoding).label(lblEncoding).right(new FormAttachment(50, -5));
FormDataFactory.startingWith(cmbDelimiter).thenRight(lblSkipLines).suffix(skipLines);
FormDataFactory.startingWith(cmbEncoding).thenRight(firstLineIsHeader);
FormData data = new FormData();
data.top = new FormAttachment(cmbEncoding, 10);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.bottom = new FormAttachment(100, 0);
data.width = 100;
data.height = 100;
compositeTable.setLayoutData(data);
//
// table & columns
//
TableColumnLayout layout = new TableColumnLayout();
compositeTable.setLayout(layout);
tableViewer = new TableViewer(compositeTable, SWT.BORDER | SWT.FULL_SELECTION);
final Table table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
tableViewer.setLabelProvider(new ImportLabelProvider(importer));
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
table.addMouseListener(new MouseListener() {
@Override
public // NOSONAR
void mouseUp(// NOSONAR
MouseEvent e) {
}
@Override
public // NOSONAR
void mouseDown(// NOSONAR
MouseEvent e) {
}
@Override
public void mouseDoubleClick(MouseEvent e) {
TableItem item = table.getItem(0);
if (item == null)
return;
int columnIndex = -1;
for (int ii = 0; ii < table.getColumnCount(); ii++) {
Rectangle bounds = item.getBounds(ii);
int width = table.getColumn(ii).getWidth();
if (e.x >= bounds.x && e.x <= bounds.x + width)
columnIndex = ii;
}
if (columnIndex >= 0)
onColumnSelected(columnIndex);
}
});
//
// setup form elements
//
target.setInput(importer.getExtractors());
target.getCombo().select(importer.getExtractors().indexOf(importer.getExtractor()));
doProcessFile();
}
Aggregations