當前位置: 首頁>>代碼示例>>Java>>正文


Java DateTime類代碼示例

本文整理匯總了Java中org.eclipse.swt.widgets.DateTime的典型用法代碼示例。如果您正苦於以下問題:Java DateTime類的具體用法?Java DateTime怎麽用?Java DateTime使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DateTime類屬於org.eclipse.swt.widgets包,在下文中一共展示了DateTime類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createUI_Field_Date

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
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;
}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:23,代碼來源:SlideoutTourFilter.java

示例2: DatePickerDialog

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
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();
		} 
    }); 
}
 
開發者ID:Transkribus,項目名稱:TranskribusSwtGui,代碼行數:26,代碼來源:DatePickerDialog.java

示例3: createCustomParameterControl

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
@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;
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:20,代碼來源:DateEditor.java

示例4: createArea

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
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));
}
 
開發者ID:AlexWengh,項目名稱:HMM,代碼行數:23,代碼來源:TimeScheduleDialog.java

示例5: createUI_Field_Time

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
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;
}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:26,代碼來源:SlideoutTourFilter.java

示例6: onField_Select_DateTime

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
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();
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:23,代碼來源:SlideoutTourFilter.java

示例7: updateUI_PropertyDetail_Date

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
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());
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:21,代碼來源:SlideoutTourFilter.java

示例8: createUISection_122_DateTime_Col1

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
/**
 * 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);
	}
}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:26,代碼來源:TourDataEditorView.java

示例9: createUISection_123_DateTime_Col2

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
/**
 * 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);
		}
	}
}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:23,代碼來源:TourDataEditorView.java

示例10: CalendarImpl

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
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);
        }

    });
}
 
開發者ID:jo-source,項目名稱:jo-widgets,代碼行數:24,代碼來源:CalendarImpl.java

示例11: setDate

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
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));
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:17,代碼來源:EnsembleDateWidgetHelper.java

示例12: getValue

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
/**
 * 獲取當前過濾條件的值
 * @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;
}
 
開發者ID:heartsome,項目名稱:translationstudio8,代碼行數:25,代碼來源:ExportFilterComposite.java

示例13: createPartControl

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
@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());
}
 
開發者ID:vogellacompany,項目名稱:codeexamples-eclipse,代碼行數:27,代碼來源:TaskEditor.java

示例14: createDatePicker

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
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 );
}
 
開發者ID:eclipse,項目名稱:birt,代碼行數:17,代碼來源:DateTimeDataElementComposite.java

示例15: handleEvent

import org.eclipse.swt.widgets.DateTime; //導入依賴的package包/類
@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);
	}
}
 
開發者ID:jaloncad,項目名稱:redmine.rap,代碼行數:17,代碼來源:WidgetModifyListener.java


注:本文中的org.eclipse.swt.widgets.DateTime類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。