Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.DateTime


            logger.debug("creating date field");
            label = new Label(generalGroup, SWT.RIGHT);
            label.setText(Messages.getString("campaign.editor.inception.label"));
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));

            inception = new DateTime(generalGroup, SWT.BORDER);
            inception.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
            Calendar cal = new GregorianCalendar();
            cal.setTime(campaign.getInception());
            inception.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
            inception.setTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
View Full Code Here


    _dlg.setLayout(new GridLayout(1, false));

    if ((style & SWT.CALENDAR) == SWT.CALENDAR)
      {
      _calDate = new DateTime(_dlg, SWT.CALENDAR | SWT.LONG);

      GridData gdCal = new GridData();
      gdCal.grabExcessHorizontalSpace = true;
      gdCal.horizontalAlignment = SWT.FILL;
      _calDate.setLayoutData(gdCal);
      }

    new Label(_dlg, SWT.NONE);

    if ((style & SWT.TIME) == SWT.TIME)
      {
      _calTime = new DateTime(_dlg, SWT.TIME);

      GridData gdCal = new GridData();
      gdCal.grabExcessHorizontalSpace = true;
      gdCal.horizontalAlignment = SWT.FILL;
      _calTime.setLayoutData(gdCal);
View Full Code Here

          break;

        case T_Date:
          createLabel(parent);
          _wid = new DateTime(parent, SWT.DATE | SWT.DROP_DOWN);
          break;

        case T_Time:
          createLabel(parent);
          _wid = new DateTime(parent, SWT.TIME);
          break;

        case T_TimeStamp:
          createLabel(parent);
          _wid = new DateTime(parent, SWT.DATE | SWT.DROP_DOWN);
          break;

        case T_Color: // Color

          createLabel(parent);
View Full Code Here

    Label labelQuarter = new Label(topLevel, SWT.NONE);
    quarter = new Text(topLevel, SWT.BORDER);
    Label labelUpdatedBy = new Label(topLevel, SWT.NONE);
    updatedBy = new Text(topLevel, SWT.BORDER);
    Label labelUpdateDate = new Label(topLevel, SWT.NONE);
    updateDate = new DateTime(topLevel, SWT.CALENDAR);
    Label labelEngineers = new Label(topLevel, SWT.None);

    Control engineersEdit = createEngineersEditor(topLevel);

    // content
View Full Code Here

  private void createToolBarForWindowsOS(IToolBarManager toolBar) {
    toolBar.add(new ControlContribution("rabbit.ui.fromDateTime") {
      @Override
      protected Control createControl(Composite parent) {
        final Calendar dateToBind = preferences.getStartDate();
        final DateTime fromDateTime = new DateTime(parent, SWT.DROP_DOWN
            | SWT.BORDER);
        fromDateTime
            .setToolTipText("Select the start date for the data to be displayed");
        updateDateTime(fromDateTime, dateToBind);
        fromDateTime.addListener(SWT.Selection, new Listener() {
          @Override
          public void handleEvent(Event event) {
            updateDate(dateToBind, fromDateTime);
          }
        });
        return fromDateTime;
      }
    });
    createSpace(toolBar);
    toolBar.add(new ControlContribution("rabbit.ui.toDateTime") {
      @Override
      protected Control createControl(Composite parent) {
        final Calendar dateToBind = preferences.getEndDate();
        final DateTime toDateTime = new DateTime(parent, SWT.DROP_DOWN
            | SWT.BORDER);
        toDateTime
            .setToolTipText("Select the end date for the data to be displayed");
        updateDateTime(toDateTime, dateToBind);
        toDateTime.addListener(SWT.Selection, new Listener() {
          @Override
          public void handleEvent(Event event) {
            updateDate(dateToBind, toDateTime);
          }
        });
View Full Code Here

        close();
      }
    });

    Calendar cal = getCalendar();
    dateTime = new DateTime(shell, SWT.CALENDAR);
    dateTime.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal
        .get(Calendar.DAY_OF_MONTH));
    dateTime.addListener(SWT.MouseDoubleClick, new Listener() {
      @Override
      public void handleEvent(Event event) {
View Full Code Here

                    final Shell dialog = new Shell( open.getShell(),
                                                    SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL );
                    dialog.setText( "Set date:" );
                    dialog.setLayout( new GridLayout( 1,
                                                      false ) );
                    final DateTime calendar = new DateTime( dialog,
                                                            SWT.CALENDAR );

                    Date date = new Date();
                    try {
                        String txt = field.getText();
                        if ( txt != null && txt.length() > 0 ) {
                            date = formatter.parse( txt );
                        }
                    } catch ( ParseException e1 ) {
                        e1.printStackTrace();
                    }

                    calendar.setDate( date.getYear() + 1900,
                                      date.getMonth(),
                                      date.getDate() );

                    Point p2 = open.toDisplay( 0,
                                               0 );

                    int x = p2.x;
                    int y = p2.y + 20;

                    dialog.setLocation( x,
                                        y );

                    Button ok = new Button( dialog,
                                            SWT.PUSH );
                    ok.setText( "OK" );
                    ok.setLayoutData( new GridData( SWT.FILL,
                                                    SWT.CENTER,
                                                    false,
                                                    false ) );
                    ok.addSelectionListener( new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                            field.setText( formatter.format( new Date( calendar.getYear() - 1900,
                                                                       calendar.getMonth(),
                                                                       calendar.getDay() ) ) );
                            updateSentence();
                            modeller.setDirty( true );
                            dialog.close();
                        }
                    } );
View Full Code Here

                    final Shell dialog = new Shell( open.getShell(),
                                                    SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL );
                    dialog.setText( "Set date:" );
                    dialog.setLayout( new GridLayout( 1,
                                                      false ) );
                    final DateTime calendar = new DateTime( dialog,
                                                            SWT.CALENDAR );

                    Date date = new Date();
                    try {
                        String txt = field.getText();
                        if ( txt != null && txt.length() > 0 ) {
                            date = formatter.parse( txt );
                        }
                    } catch ( ParseException e1 ) {
                        e1.printStackTrace();
                    }

                    calendar.setDate( date.getYear() + 1900,
                                      date.getMonth(),
                                      date.getDate() );

                    Point p2 = open.toDisplay( 0,
                                               0 );

                    int x = p2.x;
                    int y = p2.y + 20;

                    dialog.setLocation( x,
                                        y );

                    Button ok = new Button( dialog,
                                            SWT.PUSH );
                    ok.setText( "OK" );
                    ok.setLayoutData( new GridData( SWT.FILL,
                                                    SWT.CENTER,
                                                    false,
                                                    false ) );
                    ok.addSelectionListener( new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                            field.setText( formatter.format( new Date( calendar.getYear() - 1900,
                                                                       calendar.getMonth(),
                                                                       calendar.getDay() ) ) );
                            updateSentence();
                            modeller.setDirty( true );
                            dialog.close();
                        }
                    } );
View Full Code Here

        dateLabel.setLayoutData( new GridData( SWT.NONE, SWT.TOP, false, false ) );

        Composite rightComposite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );

        // Calendar
        dateCalendar = new DateTime( rightComposite, SWT.CALENDAR | SWT.BORDER );
        dateCalendar.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
    }
View Full Code Here

        dateLabel.setLayoutData( new GridData( SWT.NONE, SWT.TOP, false, false ) );

        Composite rightComposite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );

        // Calendar
        dateCalendar = new DateTime( rightComposite, SWT.CALENDAR | SWT.BORDER );
        dateCalendar.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
    }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.DateTime

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.