org.uberfire.ext.widgets.common.client.common.DatePicker.setFormat()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.uberfire.ext.widgets.common.client.common.DatePicker.setFormat()方法的一些代码示例,展示了DatePicker.setFormat()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DatePicker.setFormat()方法的具体详情如下:
包路径:org.uberfire.ext.widgets.common.client.common.DatePicker
类名称:DatePicker
方法名:setFormat

DatePicker.setFormat介绍

[英]Set the format of the Date shown in the TextBox component. This is converted to BS3's Date Format that the underlying jQuery-based BS3 DatePicker uses to convert values in the TextBox to selections in the popup date picker element.
[中]设置文本框组件中显示的日期格式。这将转换为BS3的日期格式,基本的基于jQuery的BS3日期选择器使用该格式将文本框中的值转换为弹出日期选择器元素中的选择。

代码示例

代码示例来源:origin: org.jbpm/jbpm-console-ng-generic-client

/**
 * Creates a new UTCDateBox with the medium date format for the
 * current locale.
 */
public UTCDateBox() {
  datePicker = GWT.create(DatePicker.class);
  datePicker.setFormat(DateUtils.getDateFormatMask());
  initWidget(datePicker);
}

代码示例来源:origin: org.drools/drools-wb-guided-rule-editor-client

@Test
public void testInitDatePickerByRuleAttribute() {
  final DatePicker datePicker = mock(DatePicker.class);
  final String attributeValue = "31-May-2018";
  doReturn(attributeValue).when(ruleAttribute).getValue();
  factory.initDatePickerByRuleAttribute(datePicker, ruleAttribute);
  // not robust verifications because of Date formatting / parsing is mocked by GwtMockito
  verify(datePicker).setFormat(any());
  verify(datePicker).setValue(notNull(Date.class));
}

代码示例来源:origin: kiegroup/drools-wb

@Test
public void testInitDatePickerByRuleAttribute() {
  final DatePicker datePicker = mock(DatePicker.class);
  final String attributeValue = "31-May-2018";
  doReturn(attributeValue).when(ruleAttribute).getValue();
  factory.initDatePickerByRuleAttribute(datePicker, ruleAttribute);
  // not robust verifications because of Date formatting / parsing is mocked by GwtMockito
  verify(datePicker).setFormat(any());
  verify(datePicker).setValue(notNull(Date.class));
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-search-screen-client

@PostConstruct
public void init() {
  initWidget( uiBinder.createAndBindUi( this ) );
  accordion.setId( DOM.createUniqueId() );
  formAccordionHeader.setDataParent( accordion.getId() );
  formAccordionHeader.setDataTargetWidget( formAccordionCollapse );
  resultAccordionHeader.setDataParent( accordion.getId() );
  resultAccordionHeader.setDataTargetWidget( resultAccordionCollapse );
  createdAfter.setFormat( ApplicationPreferences.getDroolsDateFormat() );
  createdBefore.setFormat( ApplicationPreferences.getDroolsDateFormat() );
  lastModifiedAfter.setFormat( ApplicationPreferences.getDroolsDateFormat() );
  lastModifiedBefore.setFormat( ApplicationPreferences.getDroolsDateFormat() );
  formGroup.setStyleName( null );
  formatTypeahead.setDatasets( new StringDataset( new ArrayList<String>() {{
    for ( final ClientResourceType resourceType : clientTypeRegistry.getRegisteredTypes() ) {
      add( resourceType.getShortName() );
    }
  }} ) );
}

代码示例来源:origin: org.uberfire/uberfire-widgets-commons

public DatePicker(final boolean allowEmptyValues) {
  datePicker = GWT.create(org.gwtbootstrap3.extras.datepicker.client.ui.DatePicker.class);
  this.allowEmptyValues = allowEmptyValues;
  datePicker.setContainer(RootPanel.get());
  datePicker.setAutoClose(true);
  setLocaleName();
  setFormat(gwtDateFormat);
  //When the popup Date Picker component is hidden assert empty values
  datePicker.addHideHandler(new HideHandler() {
    @Override
    public void onHide(HideEvent hideEvent) {
      final Date value = getDataPickerDate();
      if (!allowEmptyValues && value == null) {
        doSetValue(new Date(),
              true);
      } else {
        doSetValue(value,
              true);
      }
    }
  });
  initWidget(datePicker);
}

代码示例来源:origin: kiegroup/appformer

public DatePicker(final boolean allowEmptyValues) {
  datePicker = GWT.create(org.gwtbootstrap3.extras.datepicker.client.ui.DatePicker.class);
  this.allowEmptyValues = allowEmptyValues;
  datePicker.setContainer(RootPanel.get());
  datePicker.setAutoClose(true);
  setLocaleName();
  setFormat(gwtDateFormat);
  //When the popup Date Picker component is hidden assert empty values
  datePicker.addHideHandler(new HideHandler() {
    @Override
    public void onHide(HideEvent hideEvent) {
      final Date value = getDataPickerDate();
      if (!allowEmptyValues && value == null) {
        doSetValue(new Date(),
              true);
      } else {
        doSetValue(value,
              true);
      }
    }
  });
  initWidget(datePicker);
}

代码示例来源:origin: org.jbpm/jbpm-console-ng-generic-client

@Test
  public void testSettingFormatValue() {
    UTCDateBox newUTCDateBox = new UTCDateBox();
    DatePicker newdatePicker = newUTCDateBox.getDateBox();
    long now = System.currentTimeMillis();
    newUTCDateBox.setValue(now);

    verify(newdatePicker).setFormat(DateUtils.getDateFormatMask());
  }
}

代码示例来源:origin: org.drools/drools-wb-guided-rule-editor-client

protected void initDatePickerByRuleAttribute(final DatePicker datePicker, final RuleAttribute ruleAttribute) {
  datePicker.addValueChangeHandler(event -> {
    final Date date = datePicker.getValue();
    final String sDate = (date == null ? null : DATE_FORMATTER.format(datePicker.getValue()));
    ruleAttribute.setValue(sDate);
  });
  datePicker.setFormat(DATE_FORMAT);
  datePicker.setValue(assertDateValue(ruleAttribute));
}

代码示例来源:origin: kiegroup/drools-wb

protected void initDatePickerByRuleAttribute(final DatePicker datePicker, final RuleAttribute ruleAttribute) {
  datePicker.addValueChangeHandler(event -> {
    final Date date = datePicker.getValue();
    final String sDate = (date == null ? null : DATE_FORMATTER.format(datePicker.getValue()));
    ruleAttribute.setValue(sDate);
  });
  datePicker.setFormat(DATE_FORMAT);
  datePicker.setValue(assertDateValue(ruleAttribute));
}

代码示例来源:origin: kiegroup/appformer

datePicker.setFormat(gwtDateFormat);
verify(datePickerMock).setLanguage(DatePickerLanguage.ES);
datePicker.setFormat(gwtDateFormat);
verify(datePickerMock).setLanguage(DatePickerLanguage.FR);
datePicker.setFormat(gwtDateFormat);
verify(datePickerMock).setLanguage(DatePickerLanguage.JA);
datePicker.setFormat(gwtDateFormat);
verify(datePickerMock).setLanguage(DatePickerLanguage.PT_BR);
datePicker.setFormat(gwtDateFormat);
verify(datePickerMock).setLanguage(DatePickerLanguage.ZH_CN);
datePicker.setFormat(gwtDateFormat);
verify(datePickerMock).setLanguage(DatePickerLanguage.DE);
datePicker.setFormat(gwtDateFormat);
verify(datePickerMock).setLanguage(DatePickerLanguage.ZH_TW);
datePicker.setFormat(gwtDateFormat);
verify(datePickerMock).setLanguage(DatePickerLanguage.RU);
datePicker.setFormat(gwtDateFormat);
verify(datePickerMock).setLanguage(DatePickerLanguage.EN);

代码示例来源:origin: org.drools/drools-wb-guided-dtable-editor-client

private Widget makeDateSelector(final DTCellValue52 value) {
    //If read-only return a label
    if (isReadOnly) {
      Label dateLabel = new Label();
      dateLabel.setText(format.format(value.getDateValue()));
      return dateLabel;
    }

    final DatePicker datePicker = new DatePicker(allowEmptyValues);

    // Wire up update handler
    datePicker.addChangeDateHandler((e) -> value.setDateValue(datePicker.getValue()));

    datePicker.setFormat(DATE_FORMAT);
    datePicker.setValue(value.getDateValue());

    return datePicker;
  }
}

代码示例来源:origin: kiegroup/drools-wb

private Widget makeDateSelector(final DTCellValue52 value) {
    //If read-only return a label
    if (isReadOnly) {
      Label dateLabel = new Label();
      dateLabel.setText(format.format(value.getDateValue()));
      return dateLabel;
    }

    final DatePicker datePicker = new DatePicker(allowEmptyValues);

    // Wire up update handler
    datePicker.addChangeDateHandler((e) -> value.setDateValue(datePicker.getValue()));

    datePicker.setFormat(DATE_FORMAT);
    datePicker.setValue(value.getDateValue());

    return datePicker;
  }
}

代码示例来源:origin: kiegroup/drools-wb

public DSLDateSelector(DSLVariableValue selectedDate) {
  // Wire up update handler
  datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {
    @Override
    public void onValueChange(final ValueChangeEvent<Date> event) {
      updateSentence();
    }
  });
  datePicker.setFormat(DATE_FORMAT);
  datePicker.setValue(assertDateValue(selectedDate));
  //Wrap widget within a HorizontalPanel to add a space before and after the Widget
  HorizontalPanel hp = new HorizontalPanel();
  hp.add(new HTML("&nbsp;"));
  hp.add(datePicker);
  hp.add(new HTML("&nbsp;"));
  initWidget(hp);
}

代码示例来源:origin: org.drools/drools-wb-guided-rule-editor-client

public DSLDateSelector(DSLVariableValue selectedDate) {
  // Wire up update handler
  datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {
    @Override
    public void onValueChange(final ValueChangeEvent<Date> event) {
      updateSentence();
    }
  });
  datePicker.setFormat(DATE_FORMAT);
  datePicker.setValue(assertDateValue(selectedDate));
  //Wrap widget within a HorizontalPanel to add a space before and after the Widget
  HorizontalPanel hp = new HorizontalPanel();
  hp.add(new HTML("&nbsp;"));
  hp.add(datePicker);
  hp.add(new HTML("&nbsp;"));
  initWidget(hp);
}

代码示例来源:origin: kiegroup/appformer

@Test
public void testSetFormat() {
  datePicker = new DatePicker(datePickerMock);
  String gwtDateFormat = "dd-MMM-yyyy";
  DateTimeFormat gwtDateTimeFormat = DateTimeFormat.getFormat(gwtDateFormat);
  datePicker.setLocaleName("en");
  datePicker.setFormat(gwtDateFormat);
  verify(datePickerMock).setLanguage(DatePickerLanguage.EN);
  verify(datePickerMock).setFormat(DatePickerFormatUtilities.convertToBS3DateFormat(gwtDateFormat));
  Date now = new Date();
  now = gwtDateTimeFormat.parse(gwtDateTimeFormat.format(now));
  datePicker.setValue(now);
  verify(textBox).setValue(gwtDateTimeFormat.format(now));
  when(textBox.getValue()).thenReturn(gwtDateTimeFormat.format(now));
  assertEquals(now,
         datePicker.getValue());
}

代码示例来源:origin: kiegroup/drools-wb

datePicker.setFormat(DATE_FORMAT);
datePicker.setValue(assertDateValue());

代码示例来源:origin: org.drools/drools-wb-guided-rule-editor-client

datePicker.setFormat(DATE_FORMAT);
datePicker.setValue(assertDateValue());

代码示例来源:origin: org.drools/drools-wb-guided-dtree-editor-client

valueEditor.setFormat(DATE_FORMAT);
valueEditor.setValue((Date) hasValue.getValue().getValue());

代码示例来源:origin: org.drools/drools-wb-guided-rule-editor-client

datePicker.setFormat(DATE_FORMAT);
datePicker.setValue(getSanitizedDateValue());

代码示例来源:origin: kiegroup/drools-wb

datePicker.setFormat(DATE_FORMAT);
datePicker.setValue(getSanitizedDateValue());

相关文章