public void widgetSelected( SelectionEvent e ) { final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM ); dialog.setText( BaseMessages.getString( PKG, "JobGetPOP.SelectDate" ) ); dialog.setImage( GUIResource.getInstance().getImageSpoon() ); dialog.setLayout( new GridLayout( 3, false ) ); final DateTime calendar = new DateTime( dialog, SWT.CALENDAR ); final DateTime time = new DateTime( dialog, SWT.TIME | SWT.TIME ); new Label( dialog, SWT.NONE ); new Label( dialog, SWT.NONE ); Button ok = new Button( dialog, SWT.PUSH ); ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) ); ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) ); ok.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { Calendar cal = Calendar.getInstance(); cal.set( Calendar.YEAR, calendar.getYear() ); cal.set( Calendar.MONTH, calendar.getMonth() ); cal.set( Calendar.DAY_OF_MONTH, calendar.getDay() ); cal.set( Calendar.HOUR_OF_DAY, time.getHours() ); cal.set( Calendar.MINUTE, time.getMinutes() ); cal.set( Calendar.SECOND, time.getSeconds() ); wReadFrom.setText( new SimpleDateFormat( JobEntryGetPOP.DATE_PATTERN ).format( cal.getTime() ) ); dialog.close(); } } ); dialog.setDefaultButton( ok ); dialog.pack(); dialog.open(); } } );
public void widgetSelected( SelectionEvent e ) { final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM ); dialog.setText( BaseMessages.getString( PKG, "MailInput.SelectDate" ) ); dialog.setImage( GUIResource.getInstance().getImageSpoon() ); dialog.setLayout( new GridLayout( 3, false ) ); final DateTime calendar = new DateTime( dialog, SWT.CALENDAR ); final DateTime time = new DateTime( dialog, SWT.TIME | SWT.TIME ); new Label( dialog, SWT.NONE ); new Label( dialog, SWT.NONE ); Button ok = new Button( dialog, SWT.PUSH ); ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) ); ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) ); ok.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { Calendar cal = Calendar.getInstance(); cal.set( Calendar.YEAR, calendar.getYear() ); cal.set( Calendar.MONTH, calendar.getMonth() ); cal.set( Calendar.DAY_OF_MONTH, calendar.getDay() ); cal.set( Calendar.HOUR_OF_DAY, time.getHours() ); cal.set( Calendar.MINUTE, time.getMinutes() ); cal.set( Calendar.SECOND, time.getSeconds() ); wReadFrom.setText( new SimpleDateFormat( MailInputMeta.DATE_PATTERN ).format( cal.getTime() ) ); dialog.close(); } } ); dialog.setDefaultButton( ok ); dialog.pack(); dialog.open(); } } );
public void widgetSelected( SelectionEvent e ) { final Shell dialogto = new Shell( shell, SWT.DIALOG_TRIM ); dialogto.setText( BaseMessages.getString( PKG, "MailInput.SelectDate" ) ); dialogto.setImage( GUIResource.getInstance().getImageSpoon() ); dialogto.setLayout( new GridLayout( 3, false ) ); final DateTime calendarto = new DateTime( dialogto, SWT.CALENDAR | SWT.BORDER ); final DateTime timeto = new DateTime( dialogto, SWT.TIME | SWT.TIME ); new Label( dialogto, SWT.NONE ); new Label( dialogto, SWT.NONE ); Button okto = new Button( dialogto, SWT.PUSH ); okto.setText( BaseMessages.getString( PKG, "System.Button.OK" ) ); okto.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) ); okto.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { Calendar cal = Calendar.getInstance(); cal.set( Calendar.YEAR, calendarto.getYear() ); cal.set( Calendar.MONTH, calendarto.getMonth() ); cal.set( Calendar.DAY_OF_MONTH, calendarto.getDay() ); cal.set( Calendar.HOUR_OF_DAY, timeto.getHours() ); cal.set( Calendar.MINUTE, timeto.getMinutes() ); cal.set( Calendar.SECOND, timeto.getSeconds() ); wReadTo.setText( new SimpleDateFormat( MailInputMeta.DATE_PATTERN ).format( cal.getTime() ) ); dialogto.close(); } } ); dialogto.setDefaultButton( okto ); dialogto.pack(); dialogto.open(); } } );
public void widgetSelected( SelectionEvent e ) { final Shell dialogto = new Shell( shell, SWT.DIALOG_TRIM ); dialogto.setText( BaseMessages.getString( PKG, "JobGetPOP.SelectDate" ) ); dialogto.setImage( GUIResource.getInstance().getImageSpoon() ); dialogto.setLayout( new GridLayout( 3, false ) ); final DateTime calendarto = new DateTime( dialogto, SWT.CALENDAR | SWT.BORDER ); final DateTime timeto = new DateTime( dialogto, SWT.TIME | SWT.TIME ); new Label( dialogto, SWT.NONE ); new Label( dialogto, SWT.NONE ); Button okto = new Button( dialogto, SWT.PUSH ); okto.setText( BaseMessages.getString( PKG, "System.Button.OK" ) ); okto.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) ); okto.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { Calendar cal = Calendar.getInstance(); cal.set( Calendar.YEAR, calendarto.getYear() ); cal.set( Calendar.MONTH, calendarto.getMonth() ); cal.set( Calendar.DAY_OF_MONTH, calendarto.getDay() ); cal.set( Calendar.HOUR_OF_DAY, timeto.getHours() ); cal.set( Calendar.MINUTE, timeto.getMinutes() ); cal.set( Calendar.SECOND, timeto.getSeconds() ); wReadTo.setText( new SimpleDateFormat( JobEntryGetPOP.DATE_PATTERN ).format( cal.getTime() ) ); dialogto.close(); } } ); dialogto.setDefaultButton( okto ); dialogto.pack(); dialogto.open(); } } );
/** * Creates the "Example" widgets. */ @Override void createExampleWidgets () { /* Compute the widget style */ int style = getDefaultStyle(); if (dateButton.getSelection ()) style |= SWT.DATE; if (timeButton.getSelection ()) style |= SWT.TIME; if (calendarButton.getSelection ()) style |= SWT.CALENDAR; if (shortButton.getSelection ()) style |= SWT.SHORT; if (mediumButton.getSelection ()) style |= SWT.MEDIUM; if (longButton.getSelection ()) style |= SWT.LONG; if (dropDownButton.getSelection ()) style |= SWT.DROP_DOWN; if (borderButton.getSelection ()) style |= SWT.BORDER; if (weekNumbersButton.getSelection ()) style |= SWT.CALENDAR_WEEKNUMBERS; /* Create the example widgets */ dateTime1 = new DateTime (dateTimeGroup, style); }
startTime = new DateTime(area, SWT.TIME | SWT.BORDER); gridData = new GridData(); gridData.horizontalSpan = 2;
shell.setLayout(layout); DateTime calendar = new DateTime(shell, SWT.CALENDAR | SWT.LONG ); GridData gridData = new GridData(GridData.FILL_BOTH); calendar.setLayoutData(gridData);
calendar = new DateTime(this, SWT.CALENDAR); calendar.addSelectionListener(new SelectionAdapter() {
dateClock = new org.eclipse.swt.widgets.DateTime( c, style | SWT.BORDER | SWT.DATE | ( showDay ? SWT.MEDIUM : SWT.SHORT ) ); dateClock.setLayoutData(clockGD); timeClock = new org.eclipse.swt.widgets.DateTime( c, style | SWT.BORDER | SWT.TIME | SWT.MEDIUM ); timeClock.setLayoutData(clockGD);
argumentsDate = new DateTime(multiArgumentComposite, SWT.DATE | SWT.MEDIUM | SWT.BORDER); data= new GridData(SWT.FILL, SWT.FILL, true, false); argumentsDate.setLayoutData(data);
void createPopupShell (int year, int month, int day) { popupShell = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP); popupCalendar = new DateTime (popupShell, SWT.CALENDAR); if (font != null) popupCalendar.setFont (font); if (fg != null) popupCalendar.setForeground (fg); if (bg != null) popupCalendar.setBackground (bg); mouseEventListener = new Listener () { @Override public void handleEvent (Event event) { if (event.widget instanceof Control) { Control c = (Control)event.widget; if (c != down && c.getShell () != popupShell) dropDownCalendar (false); } } }; int [] listeners = {SWT.Close, SWT.MouseUp, SWT.Paint}; for (int i=0; i < listeners.length; i++) { popupShell.addListener (listeners [i], popupListener); } listeners = new int [] {SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose}; for (int i=0; i < listeners.length; i++) { popupCalendar.addListener (listeners [i], popupListener); } addListener (SWT.Dispose, popupListener); if (year != -1) popupCalendar.setDate (year, month, day); }
DateTime dateTime = new DateTime(parent, style);
void createPopupShell (int year, int month, int day) { popupShell = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP); popupCalendar = new DateTime (popupShell, SWT.CALENDAR); if (font != null) popupCalendar.setFont (font); if (fg != null) popupCalendar.setForeground (fg); if (bg != null) popupCalendar.setBackground (bg); mouseEventListener = new Listener () { @Override public void handleEvent (Event event) { if (event.widget instanceof Control) { Control c = (Control)event.widget; if (c != down && c.getShell () != popupShell) dropDownCalendar (false); } } }; int [] listeners = {SWT.Close, SWT.MouseUp, SWT.Paint}; for (int i=0; i < listeners.length; i++) { popupShell.addListener (listeners [i], popupListener); } listeners = new int [] {SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose}; for (int i=0; i < listeners.length; i++) { popupCalendar.addListener (listeners [i], popupListener); } addListener (SWT.Dispose, popupListener); if (year != -1) popupCalendar.setDate (year, month, day); }
void createPopupShell (int year, int month, int day) { popupShell = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP); popupCalendar = new DateTime (popupShell, SWT.CALENDAR); if (font != null) popupCalendar.setFont (font); if (fg != null) popupCalendar.setForeground (fg); if (bg != null) popupCalendar.setBackground (bg); mouseEventListener = new Listener () { @Override public void handleEvent (Event event) { if (event.widget instanceof Control) { Control c = (Control)event.widget; if (c != down && c.getShell () != popupShell) dropDownCalendar (false); } } }; int [] listeners = {SWT.Close, SWT.MouseUp, SWT.Paint}; for (int i=0; i < listeners.length; i++) { popupShell.addListener (listeners [i], popupListener); } listeners = new int [] {SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose}; for (int i=0; i < listeners.length; i++) { popupCalendar.addListener (listeners [i], popupListener); } addListener (SWT.Dispose, popupListener); if (year != -1) popupCalendar.setDate (year, month, day); }
popupShell.isPopup = true; popupShell.window.setHasShadow(true); popupCalendar = new DateTime (popupShell, SWT.CALENDAR); if (font != null) popupCalendar.setFont (font);
@Override public Object create(ActionContext actionContext) { dateTime = new DateTime((Composite) actionContext.get("parent"), SWT.TIME | SWT.LONG | SWT.BORDER); dateTime.addSelectionListener(new SelectionListener() { @Override
DateTime dateTime = new DateTime((Composite) actionContext.get("parent"), SWT.TIME | SWT.LONG | SWT.BORDER);