本文整理匯總了Java中org.eclipse.swt.widgets.DateTime.setDate方法的典型用法代碼示例。如果您正苦於以下問題:Java DateTime.setDate方法的具體用法?Java DateTime.setDate怎麽用?Java DateTime.setDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.DateTime
的用法示例。
在下文中一共展示了DateTime.setDate方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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());
}
示例2: createCalendarArea
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
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;
}
示例3: createDefaultArea
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
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;
}
示例4: createDialogArea
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
/**
* 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;
}
示例5: createDialogArea
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
@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;
}
示例6: createDialogArea
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
@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;
}
示例7: handlerFilterChangedEvent
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
/**
* 處理過濾條件發生變化時動態創建組件 ;
*/
private void handlerFilterChangedEvent() {
String optionName = baseDataBean.getOptionName();
String value = baseDataBean.getFilterVlaue();
if (optionName.equals(Messages.getString("dialog.ExportFilterComposite.creationDate"))
|| optionName.equals(Messages.getString("dialog.ExportFilterComposite.changeDate"))) {
if (!valueText.isDisposed()) {
valueText.dispose();
}
DateTime valueTextDateTime = new DateTime(dynaComposite, SWT.DATE | SWT.BORDER);
if (value != null) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
try {
Calendar c = Calendar.getInstance();
c.setTime(df.parse(value));
valueTextDateTime.setDate(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DATE));
} catch (Exception ex) {
ex.printStackTrace();
}
}
valueText = valueTextDateTime;
} else {
if (!valueText.isDisposed()) {
valueText.dispose();
}
valueText = new Text(dynaComposite, SWT.BORDER);
if (value != null) {
((Text) valueText).setText(value);
}
}
valueText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
dynaComposite.layout(true);
}
示例8: populateControls
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
public static void populateControls(DateTime calendar, DateTime time, AbsoluteDate date)
{
DateTimeComponents components = date.getComponents(utc);
DateComponents dateComp = components.getDate();
TimeComponents timeComp = components.getTime();
int seconds = (int) Math.round(timeComp.getSecond());
calendar.setDate(dateComp.getYear(), dateComp.getMonth() - 1, dateComp.getDay());
time.setTime(timeComp.getHour(), timeComp.getMinute(), seconds);
}
示例9: construct
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
@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 date = new DateTime(composite, SWT.DATE);
date.setDate(2013, 2, 8);
DateTime date2 = new DateTime(composite, SWT.DATE|SWT.DROP_DOWN);
date2.setDate(2013, 2, 8);
DateTime date3 = new DateTime(composite, SWT.DATE|SWT.SHORT);
date3.setDate(2012, 2, 8);
DateTime date4 = new DateTime(composite, SWT.DATE|SWT.MEDIUM);
date4.setDate(2011, 2, 8);
date4.setEnabled(false);
DateTime date5 = new DateTime(composite, SWT.DATE|SWT.LONG);
date5.setDate(2010, 2, 8);
return null;
}
示例10: construct
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
@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 c1 = new DateTime(composite, SWT.CALENDAR);
c1.setDate(2013, 02, 8);
return null;
}
示例11: SWTCalendarDialog
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
SWTCalendarDialog(Shell parent, Date date) {
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL | SWT.SHEET);
shell.setText("Choose Date...");
shell.setLayout(new GridLayout());
final DateTime dateTime = new DateTime(shell, SWT.CALENDAR | SWT.BORDER);
calendar = Calendar.getInstance();
calendar.setTime(date);
shell.addDisposeListener(e -> calendar.set(dateTime.getYear(), dateTime.getMonth(), dateTime.getDay()));
dateTime.setDate(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
}
示例12: createDialogArea
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent){
setTitle("Angaben zur Impfung ändern");
setTitleImage(ResourceManager.getPluginImage("at.medevit.elexis.impfplan.ui",
"rsc/icons/vaccination_logo.png"));
Patient sp = ElexisEventDispatcher.getSelectedPatient();
setMessage((sp!=null) ? sp.getLabel() : "missing patient name"); //$NON-NLS-1$
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));
Label lblAdministratingContact = new Label(container, SWT.NONE);
lblAdministratingContact
.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblAdministratingContact.setText("Verabreicht von");
txtAdministrator = new Text(container, SWT.BORDER);
administratorString = vacc.get(Vaccination.FLD_ADMINISTRATOR);
txtAdministrator.setText(vacc.getAdministratorLabel());
txtAdministrator.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e){
administratorString = txtAdministrator.getText();
}
});
txtAdministrator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
PersistentObjectProposalProvider<Mandant> mopp =
new PersistentObjectProposalProvider<Mandant>(Mandant.class) {
@Override
public String getLabelForObject(Mandant a){
return a.getMandantLabel();
}
};
ContentProposalAdapter mandatorProposalAdapter = new ContentProposalAdapter(
txtAdministrator, new TextContentAdapter(), mopp, null, null);
mandatorProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
mandatorProposalAdapter.addContentProposalListener(new IContentProposalListener() {
@Override
public void proposalAccepted(IContentProposal proposal){
PersistentObjectContentProposal<Mandant> prop =
(PersistentObjectContentProposal<Mandant>) proposal;
administratorString = prop.getPersistentObject().storeToString();
}
});
Label lblLotNo = new Label(container, SWT.NONE);
lblLotNo.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblLotNo.setText("Lot-Nr");
txtLotNo = new Text(container, SWT.BORDER);
txtLotNo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
txtLotNo.setText(vacc.getLotNo());
Label lblVerabreichungsdatum = new Label(container, SWT.NONE);
lblVerabreichungsdatum
.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblVerabreichungsdatum.setAlignment(SWT.RIGHT);
lblVerabreichungsdatum.setText("Verabreichungsdatum");
dateTimeDOA = new DateTime(container, SWT.BORDER);
TimeTool doa = vacc.getDateOfAdministration();
dateTimeDOA.setDate(doa.get(Calendar.YEAR), doa.get(Calendar.MONTH),
doa.get(Calendar.DAY_OF_MONTH));
if(vacc.get(Vaccination.FLD_ARTIKEL_REF).length()==0) {
// nachtragsimpfung mit formal unbekanntem artikel
Label lblImpfungGegen = new Label(container, SWT.NONE);
lblImpfungGegen.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
lblImpfungGegen.setAlignment(SWT.RIGHT);
lblImpfungGegen.setText("Impfung gegen");
vect = new VaccinationEffectCheckboxTreeViewer(container, SWT.BORDER,
vacc.get(Vaccination.FLD_VACC_AGAINST));
vect.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
}
return area;
}
示例13: setCalendar
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
/**
* DateTimeにCalendarの年月日をセットします
*
* @param cal
* @param dateTime
*/
private static void setCalendar(Calendar cal, DateTime dateTime) {
dateTime.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
}
示例14: createDialogArea
import org.eclipse.swt.widgets.DateTime; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
Composite tParent = (Composite) super.createDialogArea(parent);
tParent.setLayout(new GridLayout(2, false));
GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true);
parentData.widthHint = 500;
tParent.setLayoutData(parentData);
GridData gd = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create();
// 自定義屬性名稱
Label nameLbl = new Label(tParent, SWT.NONE);
nameLbl.setText(Messages.getString("tmxeditor.editElementAttrDialog.customAttrName"));
nameTxt = new Text(tParent, SWT.BORDER | SWT.READ_ONLY);
nameTxt.setText(oldName);
GridDataFactory.createFrom(gd).applyTo(nameTxt);
// 自定義屬性值
Label valueLbl = new Label(tParent, SWT.NONE);
valueLbl.setText(Messages.getString("tmxeditor.editElementAttrDialog.customAttrValue"));
if (oldName.equalsIgnoreCase("creationdate") || oldName.equalsIgnoreCase("changedate")) {
Composite com = new Composite(tParent, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
gl.marginLeft = 0;
gl.marginWidth = 0;
gl.marginHeight = 0;
gl.marginBottom = 0;
com.setLayout(gl);
dateWidget = new DateTime(com, SWT.DROP_DOWN);
timeWidget = new DateTime(com, SWT.DROP_DOWN | SWT.TIME | SWT.LONG);
GridDataFactory.createFrom(gd).applyTo(com);
Date strtodate = new Date();
if (oldValue != null) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd,HH:mm");
ParsePosition pos = new ParsePosition(0);
strtodate = formatter.parse(oldValue, pos);
if (strtodate == null) {
strtodate = new Date();
}
}
Calendar cl = Calendar.getInstance();
cl.setTime(strtodate);
dateWidget.setDate(cl.get(Calendar.YEAR), cl.get(Calendar.MONTH), cl.get(Calendar.DATE));
timeWidget.setTime(cl.get(Calendar.HOUR_OF_DAY), cl.get(Calendar.MINUTE), cl.get(Calendar.SECOND));
} else {
valueTxt = new Text(tParent, SWT.BORDER);
valueTxt.setText(oldValue);
valueTxt.setFocus();
valueTxt.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
getButton(Dialog.OK).setEnabled(!valueTxt.getText().isEmpty());
}
});
GridDataFactory.createFrom(gd).applyTo(valueTxt);
}
// 作用組
Group applyGroup = new Group(tParent, SWT.NONE);
applyGroup.setText(Messages.getString("tmxeditor.editElementAttrDialog.apply"));
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).applyTo(applyGroup);
GridLayoutFactory.swtDefaults().numColumns(3).applyTo(applyGroup);
// 當前選中行
curSelectRowBtn = new Button(applyGroup, SWT.RADIO);
curSelectRowBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
curSelectRowBtn.setText(Messages.getString("tmxeditor.editElementAttrDialog.current.line"));
curSelectRowBtn.setSelection(true);
// 所有過濾結果
allFilterResultBtn = new Button(applyGroup, SWT.RADIO);
allFilterResultBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
allFilterResultBtn.setText(Messages.getString("tmxeditor.editElementAttrDialog.allFilterResults"));
// 整個文件/記憶庫
allFileOrDBBtn = new Button(applyGroup, SWT.RADIO);
allFileOrDBBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
allFileOrDBBtn.setText(Messages.getString("tmxeditor.editElementAttrDialog.allFileDatabase"));
return tParent;
}