use of org.eclipse.swt.widgets.DateTime in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_DateTime method test_setBackgroundAlphaCalendarDateTime.
@Test
public void test_setBackgroundAlphaCalendarDateTime() {
DateTime calendar = new DateTime(shell, SWT.CALENDAR);
Color color = new Color(calendar.getDisplay(), 255, 0, 0, 0);
calendar.setBackground(color);
assertEquals(color, calendar.getBackground());
Color fg = new Color(calendar.getDisplay(), 0, 255, 0, 0);
calendar.setForeground(fg);
assertEquals(color, calendar.getBackground());
color.dispose();
fg.dispose();
calendar.dispose();
}
use of org.eclipse.swt.widgets.DateTime in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_DateTime method setUp.
protected void setUp(int style) {
super.setUp();
datetime = new DateTime(shell, style);
setWidget(datetime);
}
use of org.eclipse.swt.widgets.DateTime in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_DateTime method test_setBackgroundAlphaDateDateTime.
@Test
public void test_setBackgroundAlphaDateDateTime() {
DateTime date = new DateTime(shell, SWT.DATE);
Color color = new Color(date.getDisplay(), 255, 0, 0, 0);
date.setBackground(color);
assertEquals(color, date.getBackground());
Color fg = new Color(date.getDisplay(), 0, 255, 0, 0);
date.setForeground(fg);
assertEquals(color, date.getBackground());
color.dispose();
fg.dispose();
date.dispose();
}
use of org.eclipse.swt.widgets.DateTime in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_DateTime method setUp.
@Override
@Before
public void setUp() {
super.setUp();
datetime = new DateTime(shell, style);
setWidget(datetime);
}
use of org.eclipse.swt.widgets.DateTime in project yamcs-studio by yamcs.
the class AddManualEventDialog method createDialogArea.
// private void validate() {
// String errorMessage = null;
// Calendar start = RCPUtils.toCalendar(startDate, startTime);
// Calendar stop = RCPUtils.toCalendar(stopDate, stopTime);
// if (start.after(stop))
// errorMessage = "Stop has to be greater than start";
//
// setErrorMessage(errorMessage);
// getButton(IDialogConstants.OK_ID).setEnabled(errorMessage == null);
// }
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 20;
layout.marginWidth = 20;
layout.verticalSpacing = 5;
container.setLayout(layout);
Label lbl = new Label(container, SWT.NONE);
lbl.setText("Generation Time:");
Composite startComposite = new Composite(container, SWT.NONE);
RowLayout rl = new RowLayout();
rl.marginLeft = 0;
rl.marginTop = 0;
rl.marginBottom = 0;
rl.center = true;
startComposite.setLayout(rl);
generationDatePicker = new DateTime(startComposite, SWT.DATE | SWT.LONG | SWT.DROP_DOWN | SWT.BORDER);
// generationDatePicker.addListener(SWT.Selection, e -> validate());
// generationDatePicker.addListener(SWT.FocusOut, e -> validate());
generationTimePicker = new DateTime(startComposite, SWT.TIME | SWT.LONG | SWT.BORDER);
// generationTimePicker.addListener(SWT.FocusOut, e -> validate());
if (generationTimeValue != null) {
generationDatePicker.setDate(generationTimeValue.get(Calendar.YEAR), generationTimeValue.get(Calendar.MONTH), generationTimeValue.get(Calendar.DAY_OF_MONTH));
generationTimePicker.setTime(generationTimeValue.get(Calendar.HOUR_OF_DAY), generationTimeValue.get(Calendar.MINUTE), generationTimeValue.get(Calendar.SECOND));
}
lbl = new Label(container, SWT.NONE);
lbl.setText("Source:");
lbl = new Label(container, SWT.NONE);
lbl.setText("Manual");
lbl = new Label(container, SWT.NONE);
lbl.setText("User:");
if (YamcsAuthorizations.getInstance().isAuthorizationEnabled()) {
userLbl = new Label(container, SWT.NONE);
userLbl.setText(YamcsAuthorizations.getInstance().getUsername());
} else {
userText = new Text(container, SWT.SINGLE);
userText.setLayoutData(new GridData(GridData.FILL_BOTH));
userText.setText("");
}
lbl = new Label(container, SWT.NONE);
lbl.setText("Message:");
messageText = new Text(container, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
GridData data = new GridData(GridData.FILL_BOTH);
data.verticalAlignment = SWT.CENTER;
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
messageText.setLayoutData(data);
GC gc = new GC(messageText);
try {
gc.setFont(messageText.getFont());
FontMetrics fm = gc.getFontMetrics();
/* Set the height to 5 rows of characters */
data.heightHint = 5 * fm.getHeight();
} finally {
gc.dispose();
}
messageText.setText("");
lbl = new Label(container, SWT.NONE);
lbl.setText("Severity:");
severityCombo = new Combo(container, SWT.DROP_DOWN);
severityCombo.add(EventSeverity.INFO.name(), EventSeverity.INFO_VALUE);
severityCombo.add(EventSeverity.WARNING.name(), EventSeverity.WARNING_VALUE);
severityCombo.add(EventSeverity.ERROR.name(), EventSeverity.ERROR_VALUE);
severityCombo.add(EventSeverity.WATCH.name(), EventSeverity.WATCH_VALUE);
// TODO use index,
severityCombo.add(EventSeverity.DISTRESS.name(), EventSeverity.DISTRESS_VALUE - 1);
// the value skips 4
severityCombo.add(EventSeverity.CRITICAL.name(), EventSeverity.CRITICAL_VALUE - 1);
severityCombo.add(EventSeverity.SEVERE.name(), EventSeverity.SEVERE_VALUE - 1);
severityCombo.select(EventSeverity.INFO_VALUE);
return container;
}
Aggregations