Java Code Examples for org.eclipse.swt.widgets.DateTime#setLayoutData()

The following examples show how to use org.eclipse.swt.widgets.DateTime#setLayoutData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TaskEditor.java    From codeexamples-eclipse with Eclipse Public License 1.0 6 votes vote down vote up
@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());
}
 
Example 2
Source File: DateTimeDataElementComposite.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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 );
}
 
Example 3
Source File: DateTimeSelectorDialog.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
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;
}
 
Example 4
Source File: DateTimeSelectorDialog.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
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;
}
 
Example 5
Source File: Widgets.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
public static DateTime date(Composite parent, String label, String property, ModelEditor<?> editor,
		FormToolkit toolkit) {
	toolkit.createLabel(parent, label, SWT.NONE);
	DateTime dateTime = new DateTime(parent, SWT.DATE | SWT.DROP_DOWN);
	GridData data = new GridData();
	data.widthHint = 150;
	dateTime.setLayoutData(data);
	editor.getBinding().onDate(() -> editor.getModel(), property, dateTime);
	new CommentControl(parent, toolkit, property, editor.getComments());
	return dateTime;
}