Java 类org.eclipse.swt.widgets.DateTime 实例源码
项目:TranskribusSwtGui
文件:DatePickerDialog.java
public DatePickerDialog(Shell parent){
super(parent);
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.CLOSE);
shell.setText("Choose Due Date...");
shell.setLayout(new GridLayout());
final DateTime dateTime = new DateTime(shell, SWT.CALENDAR | SWT.BORDER);
shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
int month = dateTime.getMonth()+1;
String monthStr = Integer.toString(month);
if (month < 10){
monthStr = "0"+month;
}
int day = dateTime.getDay();
String dayStr = Integer.toString(day);
if (day < 10){
dayStr = "0"+day;
}
date = dateTime.getYear() + "-" + monthStr + "-" + dayStr;
//date = dateTime.toString();
}
});
}
项目:gama
文件:DateEditor.java
@Override
public Control createCustomParameterControl(final Composite compo) {
edit = new Composite(compo, SWT.NONE);
final GridLayout pointEditorLayout = new GridLayout(2, true);
pointEditorLayout.horizontalSpacing = 10;
pointEditorLayout.verticalSpacing = 0;
pointEditorLayout.marginHeight = 0;
pointEditorLayout.marginWidth = 0;
edit.setLayout(pointEditorLayout);
date = new DateTime(edit, SWT.DROP_DOWN | SWT.BORDER | SWT.DATE | SWT.LONG);
time = new DateTime(edit, SWT.DROP_DOWN | SWT.BORDER | SWT.TIME | SWT.LONG);
date.setBackground(IGamaColors.PARAMETERS_BACKGROUND.color());
date.addSelectionListener(this);
time.setBackground(IGamaColors.PARAMETERS_BACKGROUND.color());
time.addSelectionListener(this);
edit.setBackground(IGamaColors.PARAMETERS_BACKGROUND.color());
displayParameterValue();
return edit;
}
项目:HMM
文件:TimeScheduleDialog.java
protected void createArea(Composite parent) {
Composite area = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, true);
layout.marginWidth = 10;
layout.horizontalSpacing = 10;
area.setLayout(layout);
area.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
Label label = new Label(area, SWT.LEFT);
label.setText("Set the build start time and interval days:");
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
time = new DateTime(area, SWT.TIME);
time.setTime(calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND));
time.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
interval = new Combo(area, SWT.DROP_DOWN | SWT.BORDER);
for(int i = 1; i <= 14; ++i)
interval.add(String.valueOf(i));
interval.select(intervalDays - 1);
interval.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
}
项目:mytourbook
文件:SlideoutTourFilter.java
private int createUI_Field_Date(final Composite parent,
final TourFilterProperty filterProperty,
final int fieldNo) {
final DateTime dtTourDate = new DateTime(parent, SWT.DATE | SWT.MEDIUM | SWT.DROP_DOWN | SWT.BORDER);
dtTourDate.setData(filterProperty);
dtTourDate.setData(FIELD_NO, fieldNo);
dtTourDate.addFocusListener(_keepOpenListener);
dtTourDate.addSelectionListener(_fieldSelectionListener_DateTime);
GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(dtTourDate);
if (fieldNo == 1) {
filterProperty.uiDateTime1 = dtTourDate;
} else {
filterProperty.uiDateTime2 = dtTourDate;
}
return 1;
}
项目:mytourbook
文件:SlideoutTourFilter.java
private int createUI_Field_Time(final Composite parent,
final TourFilterProperty filterProperty,
final int fieldNo) {
final DateTime dtTourTime = new DateTime(parent, SWT.TIME | SWT.SHORT | SWT.BORDER);
dtTourTime.setData(filterProperty);
dtTourTime.setData(FIELD_NO, fieldNo);
dtTourTime.addFocusListener(_keepOpenListener);
dtTourTime.addSelectionListener(_fieldSelectionListener_DateTime);
GridDataFactory
.fillDefaults()//
.align(SWT.END, SWT.CENTER)
.applyTo(dtTourTime);
if (fieldNo == 1) {
filterProperty.uiDateTime1 = dtTourTime;
} else {
filterProperty.uiDateTime2 = dtTourTime;
}
return 1;
}
项目:mytourbook
文件:SlideoutTourFilter.java
private void onField_Select_DateTime(final SelectionEvent event) {
final DateTime dateTime = (DateTime) (event.widget);
final TourFilterProperty filterProperty = (TourFilterProperty) dateTime.getData();
final int fieldNo = (int) dateTime.getData(FIELD_NO);
final LocalDateTime localDateTime = LocalDateTime.of(
dateTime.getYear(),
dateTime.getMonth() + 1,
dateTime.getDay(),
dateTime.getHours(),
dateTime.getMinutes());
if (fieldNo == 1) {
filterProperty.dateTime1 = localDateTime;
} else {
filterProperty.dateTime2 = localDateTime;
}
fireModifyEvent();
}
项目:mytourbook
文件:SlideoutTourFilter.java
private void updateUI_PropertyDetail_Date(final TourFilterProperty filterProperty, final int fieldNo) {
DateTime uiDateTime;
LocalDateTime dateTime;
if (fieldNo == 1) {
uiDateTime = filterProperty.uiDateTime1;
dateTime = filterProperty.dateTime1;
} else {
uiDateTime = filterProperty.uiDateTime2;
dateTime = filterProperty.dateTime2;
}
uiDateTime.setYear(dateTime.getYear());
uiDateTime.setMonth(dateTime.getMonthValue() - 1);
uiDateTime.setDay(dateTime.getDayOfMonth());
}
项目:mytourbook
文件:TourDataEditorView.java
/**
* 1. column
*/
private void createUISection_122_DateTime_Col1(final Composite section) {
final Composite container = _tk.createComposite(section);
GridDataFactory.fillDefaults().applyTo(container);
GridLayoutFactory.fillDefaults().numColumns(3).applyTo(container);
_firstColumnContainerControls.add(container);
{
/*
* date
*/
final Label label = _tk.createLabel(container, Messages.tour_editor_label_tour_date);
_firstColumnControls.add(label);
_dtTourDate = new DateTime(container, SWT.DATE | SWT.MEDIUM | SWT.DROP_DOWN | SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(_dtTourDate);
_tk.adapt(_dtTourDate, true, false);
_dtTourDate.addSelectionListener(_dateTimeListener);
//////////////////////////////////////
createUI_LabelSeparator(container);
}
}
项目:mytourbook
文件:TourDataEditorView.java
/**
* 2. column
*/
private void createUISection_123_DateTime_Col2(final Composite section) {
final Composite container = _tk.createComposite(section);
GridDataFactory.fillDefaults().applyTo(container);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(container);
{
{
/*
* start time
*/
_lblStartTime = _tk.createLabel(container, Messages.tour_editor_label_start_time);
_secondColumnControls.add(_lblStartTime);
_dtStartTime = new DateTime(container, SWT.TIME | SWT.MEDIUM | SWT.BORDER);
_tk.adapt(_dtStartTime, true, false);
_dtStartTime.addSelectionListener(_dateTimeListener);
}
}
}
项目:jo-widgets
文件:CalendarImpl.java
public CalendarImpl(final Object parentUiReference, final ICalendarSetupSpi setup, final SwtImageRegistry imageRegistry) {
super(new DateTime((Composite) parentUiReference, SWT.CALENDAR), imageRegistry);
this.inputObservable = new InputObservable();
getUiReference().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
final Calendar calendar = new GregorianCalendar();
calendar.set(Calendar.YEAR, getUiReference().getYear());
calendar.set(Calendar.MONTH, getUiReference().getMonth());
calendar.set(Calendar.DAY_OF_MONTH, getUiReference().getDay());
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
date = calendar.getTime();
inputObservable.fireInputChanged(date);
}
});
}
项目:OpenSPIFe
文件:EnsembleDateWidgetHelper.java
public static void setDate(DateTime dt, Date d) {
if (d == null) {
d = new Date();
}
Calendar cal = MissionConstants.getInstance().getMissionCalendar();
cal.setTime(d);
dt.setYear(cal.get(Calendar.YEAR));
dt.setMonth(cal.get(Calendar.MONTH));
dt.setDay(cal.get(Calendar.DAY_OF_MONTH));
// dt.setHours(cal.get(Calendar.HOUR_OF_DAY));
// dt.setMinutes(cal.get(Calendar.MINUTE));
// dt.setSeconds(cal.get(Calendar.SECOND));
}
项目:translationstudio8
文件:ExportFilterComposite.java
/**
* 获取当前过滤条件的值
* @return ;
*/
public ExportFilterComponentBean getValue() {
if (valueText instanceof Text) {
this.baseDataBean.setFilterVlaue(((Text) valueText).getText());
}
else if (valueText instanceof DateTime) {
DateTime temp = (DateTime) valueText;
StringBuffer bf = new StringBuffer();
bf.append(temp.getYear());
bf.append("-");
DecimalFormat df = new DecimalFormat("00");
bf.append(df.format(temp.getMonth() + 1));
bf.append("-");
bf.append(df.format(temp.getDay()));
bf.append(" 00:00:00"); // 补全时间
this.baseDataBean.setFilterVlaue(bf.toString());
}
return this.baseDataBean;
}
项目:codeexamples-eclipse
文件:TaskEditor.java
@Override
public void createPartControl(Composite parent) {
GridLayout layout = new GridLayout();
layout.numColumns = 2;
parent.setLayout(layout);
new Label(parent, SWT.NONE).setText("Summary");
Text text = new Text(parent, SWT.BORDER);
text.setText(todo.getSummary());
text.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
new Label(parent, SWT.NONE).setText("Description");
Text lastName = new Text(parent, SWT.BORDER);
lastName.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
lastName.setText(todo.getDescription());
new Label(parent, SWT.NONE).setText("Done");
Button doneBtn = new Button(parent, SWT.CHECK);
doneBtn.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
doneBtn.setSelection(todo.isDone());
new Label(parent, SWT.NONE).setText("Due Date");
DateTime dueDate = new DateTime(parent, SWT.CHECK);
dueDate.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
Date date = todo.getDueDate();
dueDate.setDate(date.getYear(), date.getMonth(), date.getDay());
}
项目:tmxeditor8
文件:ExportFilterComposite.java
/**
* 获取当前过滤条件的值
* @return ;
*/
public ExportFilterComponentBean getValue() {
if (valueText instanceof Text) {
this.baseDataBean.setFilterVlaue(((Text) valueText).getText());
}
else if (valueText instanceof DateTime) {
DateTime temp = (DateTime) valueText;
StringBuffer bf = new StringBuffer();
bf.append(temp.getYear());
bf.append("-");
DecimalFormat df = new DecimalFormat("00");
bf.append(df.format(temp.getMonth() + 1));
bf.append("-");
bf.append(df.format(temp.getDay()));
bf.append(" 00:00:00"); // 补全时间
this.baseDataBean.setFilterVlaue(bf.toString());
}
return this.baseDataBean;
}
项目:birt
文件:DateTimeDataElementComposite.java
protected void createDatePicker( int style )
{
btnDate = new Button( this, SWT.CHECK );
btnDate.addListener( SWT.Selection, this );
pickerDate = new DateTime( this, SWT.DATE | style );
pickerDate.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
pickerDate.addListener( SWT.Selection, this );
btnTime = new Button( this, SWT.CHECK );
btnTime.addListener( SWT.Selection, this );
pickerTime = new DateTime( this, SWT.TIME | style );
pickerTime.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
pickerTime.addListener( SWT.Selection, this );
}
项目:redmine.rap
文件:WidgetModifyListener.java
@Override
public void handleEvent(Event event) {
// Locals
String sourceValue = null;
Object source = event.widget;
if (source instanceof DateTime) {
sourceValue = ControlUtils.getDateTimeStringValue((DateTime) source);
}
// Set dirty flag
if (!sourceValue.equals(originalValue)) {
editor.setDirty(Boolean.TRUE);
editor.setEnabledSaveAction(Boolean.TRUE);
}
}
项目:Runway-SDK
文件:CDateTime.java
public CDateTime(Composite parent, int style, boolean required)
{
super(parent, SWT.BORDER);
this.setLayout(new FillLayout());
this.dateTime = new DateTime(this, style);
if (!required)
{
this.empty = new Button(this, SWT.CHECK);
this.empty.setText(Localizer.getMessage("NO_VALUE"));
}
this.pack();
}
项目:Runway-SDK
文件:DateAndTime.java
public DateAndTime(Composite parent, int style, boolean required)
{
super(parent, style);
this.setLayout(new FillLayout());
this.date = new DateTime(this, SWT.DATE);
this.time = new DateTime(this, SWT.TIME);
if (!required)
{
this.empty = new Button(this, SWT.CHECK);
this.empty.setText(Localizer.getMessage("NO_VALUE"));
this.empty.setSelection(false);
}
this.pack();
}
项目:q7.quality.mockups
文件:Time.java
@Override
public Control construct(Composite parent) {
// TODO Auto-generated method stub
Composite composite = new Composite(parent, SWT.NONE);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL)
.grab(true, true).applyTo(composite);
GridLayoutFactory.swtDefaults().numColumns(1).applyTo(composite);
DateTime time = new DateTime(composite, SWT.TIME);
time.setTime(11, 22, 33);
DateTime time2 = new DateTime(composite, SWT.TIME|SWT.SHORT);
time2.setTime(11, 22, 33);
DateTime time3 = new DateTime(composite, SWT.TIME|SWT.LONG);
time3.setTime(11, 22, 33);
DateTime time4 = new DateTime(composite, SWT.TIME|SWT.MEDIUM);
time4.setTime(11, 22, 33);
time4.setEnabled(false);
return null;
}
项目:elexis-3-core
文件:DateTimeSelectorDialog.java
private Composite createCalendarArea(Composite parent){
Composite composite = new Composite(parent, SWT.NONE);
GridLayout gd = new GridLayout(1, false);
gd.marginLeft = 2; // SWT BUG
composite.setLayout(gd);
dateSelection = new DateTime(composite, SWT.CALENDAR);
dateSelection.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
Composite dateComposite = new Composite(composite, SWT.NONE);
dateComposite.setLayout(new GridLayout(2, true));
dateComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label label = new Label(dateComposite, SWT.NONE);
label.setText("Zeitpunkt");
label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
timeSelection = new DateTime(dateComposite, SWT.TIME);
timeSelection.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
timeSelection.setTime(date.get(Calendar.HOUR_OF_DAY), date.get(Calendar.MINUTE),
date.get(Calendar.SECOND));
dateSelection.setDate(date.get(Calendar.YEAR), date.get(Calendar.MONTH),
date.get(Calendar.DAY_OF_MONTH));
getShell().setText(Messages.DateTimeSelectorDialog_enterDate); //$NON-NLS-1$
return composite;
}
项目:elexis-3-core
文件:DateTimeSelectorDialog.java
private Composite createDefaultArea(Composite parent){
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
Label label = new Label(composite, SWT.NONE);
label.setText("Zeitpunkt");
label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
Composite dateComposite = new Composite(composite, SWT.NONE);
dateComposite.setLayout(new GridLayout(2, true));
dateComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
timeSelection = new DateTime(dateComposite, SWT.TIME);
timeSelection.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
dateSelection = new DateTime(dateComposite, SWT.CALENDAR);
dateSelection.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
timeSelection.setTime(date.get(Calendar.HOUR_OF_DAY), date.get(Calendar.MINUTE),
date.get(Calendar.SECOND));
dateSelection.setDate(date.get(Calendar.YEAR), date.get(Calendar.MONTH),
date.get(Calendar.DAY_OF_MONTH));
getShell().setText(Messages.DateTimeSelectorDialog_enterDate); //$NON-NLS-1$
return composite;
}
项目:olca-app
文件:DataBinding.java
private void initValue(Object bean, String property, DateTime dateTime) {
try {
Object val = Bean.getValue(bean, property);
if (val == null)
return;
GregorianCalendar calendar = null;
if (val instanceof Date) {
calendar = new GregorianCalendar();
calendar.setTime((Date) val);
} else if (val instanceof GregorianCalendar)
calendar = (GregorianCalendar) val;
if (calendar != null) {
dateTime.setDay(calendar.get(Calendar.DAY_OF_MONTH));
dateTime.setMonth(calendar.get(Calendar.MONTH));
dateTime.setYear(calendar.get(Calendar.YEAR));
}
} catch (Exception e) {
error("Cannot set text value", e);
}
}
项目:olca-app
文件:DataBinding.java
private void setDateValue(Object bean, String property, DateTime dateTime) {
log.trace("Change value {} @ {}", property, bean);
GregorianCalendar calendar = new GregorianCalendar();
calendar.set(Calendar.DAY_OF_MONTH, dateTime.getDay());
calendar.set(Calendar.YEAR, dateTime.getYear());
calendar.set(Calendar.MONTH, dateTime.getMonth());
try {
if (Bean.getType(bean, property) == Date.class)
Bean.setValue(bean, property, calendar.getTime());
else if (Bean.getType(bean, property) == GregorianCalendar.class)
Bean.setValue(bean, property, calendar);
else
log.error("Cannot set bean value");
} catch (Exception e) {
error("Cannot set bean value", e);
}
}
项目:elexis-3-base
文件:DatePeriodSelectorDialog.java
/**
* Create contents of the dialog.
*
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent){
setMessage("Bitte wählen Sie die anzuzeigende Zeitperiode");
setTitle("Zeitperiode setzen");
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
container.setLayout(new GridLayout(2, false));
container.setLayoutData(new GridData(GridData.FILL_BOTH));
startDateTime = new DateTime(container, SWT.CALENDAR);
startDateTime.setDate(_startDate.get(Calendar.YEAR), _startDate.get(Calendar.MONTH),
_startDate.get(Calendar.DAY_OF_MONTH));
startDateTime.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
endDateTime = new DateTime(container, SWT.CALENDAR);
endDateTime.setDate(_endDate.get(Calendar.YEAR), _endDate.get(Calendar.MONTH),
_endDate.get(Calendar.DAY_OF_MONTH));
endDateTime.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
return area;
}
项目:convertigo-eclipse
文件:StepDatesEditorComposite.java
private void createCalendars() {
Label labelStart = new Label(this, SWT.NONE);
labelStart.setText("Date de début");
start = new DateTime(this, SWT.DATE | SWT.LONG);
Label labelStop = new Label(this, SWT.NONE);
labelStop.setText("Date de fin");
stop = new DateTime(this, SWT.DATE | SWT.LONG);
}
项目:logbook
文件:ResourceChartDialogEx.java
/**
* DateTimeで選択されている日付からCalendarインスタンスを作成します
*
* @param dateTime
* @return
*/
private static Calendar getCalendar(DateTime dateTime) {
Calendar cal = DateUtils.truncate(Calendar.getInstance(TimeZone.getDefault()), Calendar.DAY_OF_MONTH);
cal.set(Calendar.YEAR, dateTime.getYear());
cal.set(Calendar.MONTH, dateTime.getMonth());
cal.set(Calendar.DAY_OF_MONTH, dateTime.getDay());
return cal;
}
项目:ForgedUI-Eclipse
文件:DateTimeDialog.java
@Override
protected Control createDialogArea(Composite parent) {
// create a composite with standard margins and spacing
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
applyDialogFont(composite);
if (showTime){
Label timeLbl = new Label(composite, SWT.NULL);
timeLbl.setText("Time:");
time = new DateTime(composite, SWT.TIME);
if (currentValue!= null){
time.setTime(currentValue.get(Calendar.HOUR_OF_DAY),
currentValue.get(Calendar.MINUTE),
currentValue.get(Calendar.SECOND));
}
}
if (showDate){
Label dateLbl = new Label(composite, SWT.NULL);
dateLbl.setText("Date:");
date = new DateTime(composite, SWT.CALENDAR);
if (currentValue!= null){
date.setDate(currentValue.get(Calendar.YEAR),
currentValue.get(Calendar.MONTH),
currentValue.get(Calendar.DAY_OF_MONTH));
}
}
return composite;
}
项目:yamcs-studio
文件:CreateAnnotationDialog.java
private static Calendar toCalendar(DateTime dateWidget, DateTime timeWidget) {
Calendar cal = TimeCatalogue.getInstance().getMissionTimeAsCalendar(true);
cal.set(dateWidget.getYear(), dateWidget.getMonth(), dateWidget.getDay());
cal.set(Calendar.HOUR_OF_DAY, timeWidget.getHours());
cal.set(Calendar.MINUTE, timeWidget.getMinutes());
cal.set(Calendar.SECOND, timeWidget.getSeconds());
cal.set(Calendar.MILLISECOND, 0);
return cal;
}
项目:yamcs-studio
文件:CreateReplayDialog.java
@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 = 2;
container.setLayout(layout);
Label lbl = new Label(container, SWT.NONE);
lbl.setText("Start At:");
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);
startDate = new DateTime(startComposite, SWT.DATE | SWT.LONG | SWT.DROP_DOWN | SWT.BORDER);
startTime = new DateTime(startComposite, SWT.TIME | SWT.LONG | SWT.BORDER);
if (startTimeValue != null) {
startDate.setDate(startTimeValue.get(Calendar.YEAR), startTimeValue.get(Calendar.MONTH),
startTimeValue.get(Calendar.DAY_OF_MONTH));
startTime.setTime(startTimeValue.get(Calendar.HOUR_OF_DAY), startTimeValue.get(Calendar.MINUTE),
startTimeValue.get(Calendar.SECOND));
}
lbl = new Label(container, SWT.NONE);
lbl.setText("Name:");
name = new Text(container, SWT.BORDER);
name.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
name.setText(nameValue);
return container;
}
项目:yamcs-studio
文件:RCPUtils.java
public static Calendar toCalendar(DateTime dateWidget, DateTime timeWidget) {
Calendar cal = Calendar.getInstance(TimeCatalogue.getInstance().getTimeZone());
cal.set(dateWidget.getYear(), dateWidget.getMonth(), dateWidget.getDay());
cal.set(Calendar.HOUR_OF_DAY, timeWidget.getHours());
cal.set(Calendar.MINUTE, timeWidget.getMinutes());
cal.set(Calendar.SECOND, timeWidget.getSeconds());
cal.set(Calendar.MILLISECOND, 0);
return cal;
}
项目:scenarioo-example-swtbot-e4
文件:OrdersSearchDialog.java
private void createDeliveryDateTime(final Composite container) {
Label deliveryDateLabel = new Label(container, SWT.NONE);
deliveryDateLabel.setText("Delivery Date");
deliveryDateTime = new DateTime(container, SWT.BORDER | SWT.SINGLE);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
deliveryDateTime.setLayoutData(gridData);
}
项目:Permo
文件:DateTimeWidget.java
private DateTime createDateWidget(final Composite parent) {
final DateTime dateWidget = new DateTime(parent, SWT.DATE | SWT.DROP_DOWN);
dateWidget.setDay(Dates.Defaults.DAY);
dateWidget.setMonth(Dates.Defaults.MONTH);
dateWidget.setYear(Dates.Defaults.YEAR);
return dateWidget;
}
项目:Permo
文件:DateTimeWidget.java
private DateTime createTimeWidget(final Composite parent) {
final DateTime timeWidget = new DateTime(parent, SWT.TIME | SWT.DROP_DOWN);
timeWidget.setHours(Dates.Defaults.HOURS);
timeWidget.setMinutes(Dates.Defaults.MINUTES);
timeWidget.setSeconds(Dates.Defaults.SECONDS);
return timeWidget;
}
项目:plan
文件:PlanProposalProvider.java
@Override
public void completeActivity_Start(EObject model, Assignment assignment, final ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
//completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
ConfigurableCompletionProposal pickColor = (ConfigurableCompletionProposal) createCompletionProposal("Pick a date...",
context);
if (pickColor != null) {
pickColor.setTextApplier(
new ReplacementTextApplier() {
@Override
public String getActualReplacementString(
ConfigurableCompletionProposal proposal) {
Display display = context.getViewer().getTextWidget().getDisplay();
Shell ns = new Shell(display);
ns.setLayout (new RowLayout ());
final DateTime calendar = new DateTime (ns, SWT.CALENDAR);
DateSelectionAdapter ds = new DateSelectionAdapter (calendar,ns);
calendar.addSelectionListener (ds);
ns.pack();
ns.open();
while (!ns.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
return ds.dateString;
}
});
acceptor.accept(pickColor);
}
}
项目:plan
文件:PlanProposalProvider.java
@Override
public void completeActivity_End(EObject model, Assignment assignment, final ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
//completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
ConfigurableCompletionProposal pickColor = (ConfigurableCompletionProposal) createCompletionProposal("Pick a date...",
context);
if (pickColor != null) {
pickColor.setTextApplier(
new ReplacementTextApplier() {
@Override
public String getActualReplacementString(
ConfigurableCompletionProposal proposal) {
Display display = context.getViewer().getTextWidget().getDisplay();
Shell ns = new Shell(display);
ns.setLayout (new RowLayout ());
final DateTime calendar = new DateTime (ns, SWT.CALENDAR);
DateSelectionAdapter ds = new DateSelectionAdapter (calendar,ns);
calendar.addSelectionListener (ds);
ns.pack();
ns.open();
while (!ns.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
return ds.dateString;
}
});
acceptor.accept(pickColor);
}
}
项目:plan
文件:PlanProposalProvider.java
@Override
public void completeCheckPoint_End(EObject model, Assignment assignment, final ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
//completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
ConfigurableCompletionProposal pickColor = (ConfigurableCompletionProposal) createCompletionProposal("Pick a date...",
context);
if (pickColor != null) {
pickColor.setTextApplier(
new ReplacementTextApplier() {
@Override
public String getActualReplacementString(
ConfigurableCompletionProposal proposal) {
Display display = context.getViewer().getTextWidget().getDisplay();
Shell ns = new Shell(display);
ns.setLayout (new RowLayout ());
final DateTime calendar = new DateTime (ns, SWT.CALENDAR);
DateSelectionAdapter ds = new DateSelectionAdapter (calendar,ns);
calendar.addSelectionListener (ds);
ns.pack();
ns.open();
while (!ns.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
return ds.dateString;
}
});
acceptor.accept(pickColor);
}
}
项目:plan
文件:CalendarDialog.java
@Override
protected Control createDialogArea(Composite parent) {
//GridLayout layout = new GridLayout();
//layout.numColumns = 1;
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
composite.setLayout(layout);
calendar = new DateTime (parent, SWT.CALENDAR);
// DateSelectionAdapter ds = new DateSelectionAdapter (calendar,ns);
//calendar.addSelectionListener(ds);
return composite;
}
项目:afbb-bibo
文件:BindingHelper.java
public static <E> Binding bindDate(final DateTime dateTime, final E entity, final Class<E> entityClass,
final String propertyName, final DataBindingContext bindingContext) {
// FIXME problem with null value
final ISWTObservableValue targetObservable = SWTObservables.observeSelection(dateTime);
final IObservableValue modelObservable = BeanProperties.value(entityClass, propertyName).observe(entity);
final Binding binding = bindingContext.bindValue(targetObservable, modelObservable);
return binding;
}
项目:SPELL
文件:ConditionDialog.java
/***************************************************************************
* Create the absolute time condition panel
**************************************************************************/
protected void createAbsoluteTimePanel()
{
m_absTimePanel = new Composite(m_stackContainer, SWT.NONE);
m_absTimePanel.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout gl = new GridLayout();
gl.numColumns = 1;
m_absTimePanel.setLayout(gl);
Label l = new Label(m_absTimePanel, SWT.BOLD);
l.setText("Choose the date and time to start the procedure:");
m_calendar = new DateTime(m_absTimePanel, SWT.CALENDAR | SWT.BORDER
| SWT.LONG);
m_absTime = new DateTime(m_absTimePanel, SWT.TIME);
}
项目:OpenSPIFe
文件:CalendarPickerDialog.java
public static void setDate(DateTime dt, Date date) {
if (date == null) {
initialDate = new Date();
}
initialDate = date;
Calendar calendar = MissionConstants.getInstance().getMissionCalendar();
calendar.setTime(initialDate);
dt.setYear(calendar.get(Calendar.YEAR));
dt.setMonth(calendar.get(Calendar.MONTH));
dt.setDay(calendar.get(Calendar.DAY_OF_MONTH));
}