java类org.eclipse.swt.widgets.DateTime的实例源码

DatePickerDialog.java 文件源码 项目:TranskribusSwtGui 阅读 44 收藏 0 点赞 0 评论 0
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();
        } 
    }); 
}
DateEditor.java 文件源码 项目:gama 阅读 40 收藏 0 点赞 0 评论 0
@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;
}
TimeScheduleDialog.java 文件源码 项目:HMM 阅读 27 收藏 0 点赞 0 评论 0
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));
}
SlideoutTourFilter.java 文件源码 项目:mytourbook 阅读 24 收藏 0 点赞 0 评论 0
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;
}
SlideoutTourFilter.java 文件源码 项目:mytourbook 阅读 37 收藏 0 点赞 0 评论 0
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;
}
SlideoutTourFilter.java 文件源码 项目:mytourbook 阅读 30 收藏 0 点赞 0 评论 0
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();
    }
SlideoutTourFilter.java 文件源码 项目:mytourbook 阅读 25 收藏 0 点赞 0 评论 0
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());
    }
TourDataEditorView.java 文件源码 项目:mytourbook 阅读 37 收藏 0 点赞 0 评论 0
/**
 * 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);
    }
}
TourDataEditorView.java 文件源码 项目:mytourbook 阅读 28 收藏 0 点赞 0 评论 0
/**
 * 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);
        }
    }
}
CalendarImpl.java 文件源码 项目:jo-widgets 阅读 22 收藏 0 点赞 0 评论 0
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);
        }

    });
}
EnsembleDateWidgetHelper.java 文件源码 项目:OpenSPIFe 阅读 31 收藏 0 点赞 0 评论 0
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));
}
ExportFilterComposite.java 文件源码 项目:translationstudio8 阅读 32 收藏 0 点赞 0 评论 0
/**
 * 获取当前过滤条件的值
 * @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;
}
TaskEditor.java 文件源码 项目:codeexamples-eclipse 阅读 33 收藏 0 点赞 0 评论 0
@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());
}
ExportFilterComposite.java 文件源码 项目:tmxeditor8 阅读 27 收藏 0 点赞 0 评论 0
/**
 * 获取当前过滤条件的值
 * @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;
}
DateTimeDataElementComposite.java 文件源码 项目:birt 阅读 25 收藏 0 点赞 0 评论 0
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 );
}
WidgetModifyListener.java 文件源码 项目:redmine.rap 阅读 473 收藏 0 点赞 0 评论 0
@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);
    }
}
CDateTime.java 文件源码 项目:Runway-SDK 阅读 23 收藏 0 点赞 0 评论 0
public CDateTime(Composite parent, int style, boolean required)
{
  super(parent, SWT.BORDER);

  this.setLayout(new FillLayout());

  this.dateTime = new DateTime(this, style);

  if (!required)
  {
    this.empty = new Button(this, SWT.CHECK);
    this.empty.setText(Localizer.getMessage("NO_VALUE"));
  }

  this.pack();
}
DateAndTime.java 文件源码 项目:Runway-SDK 阅读 24 收藏 0 点赞 0 评论 0
public DateAndTime(Composite parent, int style, boolean required)
{
  super(parent, style);

  this.setLayout(new FillLayout());

  this.date = new DateTime(this, SWT.DATE);
  this.time = new DateTime(this, SWT.TIME);

  if (!required)
  {
    this.empty = new Button(this, SWT.CHECK);
    this.empty.setText(Localizer.getMessage("NO_VALUE"));
    this.empty.setSelection(false);
  }

  this.pack();
}
Time.java 文件源码 项目:q7.quality.mockups 阅读 32 收藏 0 点赞 0 评论 0
@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 time = new DateTime(composite, SWT.TIME);
    time.setTime(11, 22, 33);


    DateTime time2 = new DateTime(composite, SWT.TIME|SWT.SHORT);
    time2.setTime(11, 22, 33);

    DateTime time3 = new DateTime(composite, SWT.TIME|SWT.LONG);
    time3.setTime(11, 22, 33);


    DateTime time4 = new DateTime(composite, SWT.TIME|SWT.MEDIUM);
    time4.setTime(11, 22, 33);
    time4.setEnabled(false);


    return null;
}
DateTimeSelectorDialog.java 文件源码 项目:elexis-3-core 阅读 29 收藏 0 点赞 0 评论 0
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;
}
DateTimeSelectorDialog.java 文件源码 项目:elexis-3-core 阅读 24 收藏 0 点赞 0 评论 0
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;
}
DataBinding.java 文件源码 项目:olca-app 阅读 32 收藏 0 点赞 0 评论 0
private void initValue(Object bean, String property, DateTime dateTime) {
    try {
        Object val = Bean.getValue(bean, property);
        if (val == null)
            return;
        GregorianCalendar calendar = null;
        if (val instanceof Date) {
            calendar = new GregorianCalendar();
            calendar.setTime((Date) val);
        } else if (val instanceof GregorianCalendar)
            calendar = (GregorianCalendar) val;
        if (calendar != null) {
            dateTime.setDay(calendar.get(Calendar.DAY_OF_MONTH));
            dateTime.setMonth(calendar.get(Calendar.MONTH));
            dateTime.setYear(calendar.get(Calendar.YEAR));
        }
    } catch (Exception e) {
        error("Cannot set text value", e);
    }
}
DataBinding.java 文件源码 项目:olca-app 阅读 25 收藏 0 点赞 0 评论 0
private void setDateValue(Object bean, String property, DateTime dateTime) {
    log.trace("Change value {} @ {}", property, bean);
    GregorianCalendar calendar = new GregorianCalendar();
    calendar.set(Calendar.DAY_OF_MONTH, dateTime.getDay());
    calendar.set(Calendar.YEAR, dateTime.getYear());
    calendar.set(Calendar.MONTH, dateTime.getMonth());
    try {
        if (Bean.getType(bean, property) == Date.class)
            Bean.setValue(bean, property, calendar.getTime());
        else if (Bean.getType(bean, property) == GregorianCalendar.class)
            Bean.setValue(bean, property, calendar);
        else
            log.error("Cannot set bean value");
    } catch (Exception e) {
        error("Cannot set bean value", e);
    }
}
DatePeriodSelectorDialog.java 文件源码 项目:elexis-3-base 阅读 31 收藏 0 点赞 0 评论 0
/**
 * 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;
}
StepDatesEditorComposite.java 文件源码 项目:convertigo-eclipse 阅读 31 收藏 0 点赞 0 评论 0
private void createCalendars() {
    Label labelStart = new Label(this, SWT.NONE);
    labelStart.setText("Date de début");
    start = new DateTime(this, SWT.DATE | SWT.LONG);

    Label labelStop = new Label(this, SWT.NONE);
    labelStop.setText("Date de fin");
    stop = new DateTime(this, SWT.DATE | SWT.LONG);
}
ResourceChartDialogEx.java 文件源码 项目:logbook 阅读 29 收藏 0 点赞 0 评论 0
/**
 * DateTimeで選択されている日付からCalendarインスタンスを作成します
 *
 * @param dateTime
 * @return
 */
private static Calendar getCalendar(DateTime dateTime) {
    Calendar cal = DateUtils.truncate(Calendar.getInstance(TimeZone.getDefault()), Calendar.DAY_OF_MONTH);
    cal.set(Calendar.YEAR, dateTime.getYear());
    cal.set(Calendar.MONTH, dateTime.getMonth());
    cal.set(Calendar.DAY_OF_MONTH, dateTime.getDay());
    return cal;
}
DateTimeDialog.java 文件源码 项目:ForgedUI-Eclipse 阅读 29 收藏 0 点赞 0 评论 0
@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;
}
CreateAnnotationDialog.java 文件源码 项目:yamcs-studio 阅读 31 收藏 0 点赞 0 评论 0
private static Calendar toCalendar(DateTime dateWidget, DateTime timeWidget) {
    Calendar cal = TimeCatalogue.getInstance().getMissionTimeAsCalendar(true);
    cal.set(dateWidget.getYear(), dateWidget.getMonth(), dateWidget.getDay());
    cal.set(Calendar.HOUR_OF_DAY, timeWidget.getHours());
    cal.set(Calendar.MINUTE, timeWidget.getMinutes());
    cal.set(Calendar.SECOND, timeWidget.getSeconds());
    cal.set(Calendar.MILLISECOND, 0);
    return cal;
}
CreateReplayDialog.java 文件源码 项目:yamcs-studio 阅读 28 收藏 0 点赞 0 评论 0
@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;
}
RCPUtils.java 文件源码 项目:yamcs-studio 阅读 26 收藏 0 点赞 0 评论 0
public static Calendar toCalendar(DateTime dateWidget, DateTime timeWidget) {
    Calendar cal = Calendar.getInstance(TimeCatalogue.getInstance().getTimeZone());
    cal.set(dateWidget.getYear(), dateWidget.getMonth(), dateWidget.getDay());
    cal.set(Calendar.HOUR_OF_DAY, timeWidget.getHours());
    cal.set(Calendar.MINUTE, timeWidget.getMinutes());
    cal.set(Calendar.SECOND, timeWidget.getSeconds());
    cal.set(Calendar.MILLISECOND, 0);
    return cal;
}


问题


面经


文章

微信
公众号

扫码关注公众号