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

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

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

DatePicker.setValue介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public class Controller implements Initializable {

  @FXML 
  DatePicker checkInDatePicker;

  ...

  @Override
  public void initialize(URL location, ResourceBundle resources) {
    checkInDatePicker.setValue(LocalDate.now());
  }
}

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

@Override
public void setValue(Date value) {
  input.setValue(value);
}

代码示例来源:origin: org.dashbuilder/dashbuilder-displayer-client

@Override
public void setValue(Date value) {
  input.setValue(value);
}

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

@Override
public void setValue( Date value ) {
  datePicker.setValue( value );
}

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

/**
 * Sets the value in the DateBox.
 *
 * @param value
 *            A time measured in the number of milliseconds since January 1,
 *            1970, 00:00:00 GMT. This time should be at midnight in GMT for
 *            the Date selected.
 *            <p>
 *            If value is null or represents a negative number, the DateBox
 *            will have no value.
 */
@Override
public void setValue(Long value, boolean fireEvents) {
  datePicker.setValue(UTCDateBox.utc2date(value), fireEvents);
}

代码示例来源:origin: stackoverflow.com

private final Locale myLocale = Locale.getDefault(Locale.Category.FORMAT);

@Override
public void start(Stage primaryStage) {
  DatePicker datePicker=new DatePicker();
  datePicker.setValue(LocalDate.now());
  datePicker.setOnShowing(e-> Locale.setDefault(Locale.Category.FORMAT,Locale.ENGLISH));
  datePicker.setOnShown(e-> Locale.setDefault(Locale.Category.FORMAT,myLocale));
  ...
}

代码示例来源:origin: stackoverflow.com

private final Locale myLocale = Locale.getDefault(Locale.Category.FORMAT);

@Override
public void start(Stage primaryStage) {
  DatePicker datePicker=new DatePicker();
  datePicker.setValue(LocalDate.now());
  datePicker.setOnShowing(e-> Locale.setDefault(Locale.Category.FORMAT,Locale.ENGLISH));
  datePicker.setOnHiding(e-> Locale.setDefault(Locale.Category.FORMAT,myLocale));
  datePicker.setOnAction(e-> Locale.setDefault(Locale.Category.FORMAT,myLocale));
  ...
}

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

/**
 * Callback to set the value of a DatePicker based on the Cells value.
 * @param cell The Cell to be rendered.
 * @return
 */
public static <E extends SingleValueDOMElement<Date, DatePicker>> Consumer<E> makeOnCreationCallback(final GridCell<Date> cell) {
  return (e) -> {
    final DatePicker widget = e.getWidget();
    final Date value;
    if (hasValue(cell)) {
      value = cell.getValue().getValue();
    } else {
      value = new Date();
    }
    widget.setValue(convertFromServerTimeZone(value));
  };
}

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

/**
 * Callback to set the value of a DatePicker based on the Cells value.
 * @param cell The Cell to be rendered.
 * @return
 */
public static <E extends SingleValueDOMElement<Date, DatePicker>> Consumer<E> makeOnCreationCallback(final GridCell<Date> cell) {
  return (e) -> {
    final DatePicker widget = e.getWidget();
    final Date value;
    if (hasValue(cell)) {
      value = cell.getValue().getValue();
    } else {
      value = new Date();
    }
    widget.setValue(convertFromServerTimeZone(value));
  };
}

代码示例来源:origin: org.kie.workbench.widgets/kie-wb-decorated-grid-widget

@Test
public void testStartEditing() {
  final Cell.Context context = mock(Cell.Context.class);
  final Element parent = mock(Element.class);
  final Date expectedDate = makeDate("04-01-2018 00:00:00 -0300");
  cell.startEditing(context, parent, expectedDate);
  verify(datePicker).setValue(dateCaptor.capture());
  final Date actualDate = dateCaptor.getValue();
  assertEquals(expectedDate, actualDate);
}

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

@Test
public void testSetValue() {
  utcDateBoxTest.setValue(null);
  verify(datePicker).setValue(UTCDateBox.utc2date(null), false);
  long nextDueDate = System.currentTimeMillis() + 1800 * 1000;
  utcDateBoxTest.setValue(nextDueDate);
  verify(datePicker).setValue(UTCDateBox.utc2date(nextDueDate), false);
}

代码示例来源: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.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 testMakeOnCreationCallback() {
  final DatePickerDOMElement datePickerDomElement = mock(DatePickerDOMElement.class);
  final DatePicker datePickerWidget = mock(DatePicker.class);
  final String serverDate = "05-01-2018 06:00:00 +0300";
  final String dateConvertedFromServerTimezone = "05-01-2018 00:00:00 -0300";
  final Consumer<SingleValueDOMElement<Date, DatePicker>> callback = ConsumerFactory.makeOnCreationCallback(makeGridCell(asDate(serverDate)));
  when(datePickerDomElement.getWidget()).thenReturn(datePickerWidget);
  callback.accept(datePickerDomElement);
  verify(datePickerWidget).setValue(asDate(dateConvertedFromServerTimezone));
}

代码示例来源: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: 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);
}

相关文章