gpt4 book ai didi

org.hippoecm.frontend.plugins.yui.datetime.YuiDateTimeField类的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 19:59:31 26 4
gpt4 key购买 nike

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

YuiDateTimeField介绍

[英]Semi-fork of YUI DateTimeField from Wicket extensions. Replaces Wicket extensions YUI behaviors with a YuiDatePickerso it fit's in the Hippo ECM YUI framework. DatePicker can be configured using a frontend:pluginconfig node with name datepicker.
[中]Wicket extensions的YUI DateTimeField的半叉子。将Wicket extensions YUI行为替换为YUIDatePickers,使其适合Hippo ECM YUI框架。可以使用名为[$0$]的前端:pluginconfig节点配置DatePicker。

代码示例

代码示例来源:origin: org.onehippo.cms7/hippo-cms-api

private void updateDateTime() {
  final Date date = getDate();
  if (date != null) {
    final MutableDateTime dateTime = new MutableDateTime(date);
    try {
      final TimeZone zone = getClientTimeZone();
      if (zone != null) {
        dateTime.setZone(DateTimeZone.forTimeZone(zone));
      }
      setHourAndMinutes(dateTime);
      // the date will be in the server's timezone
      setDate(dateTime.toDate());
      setModelObject(dateTime.toDate());
    } catch (final RuntimeException e) {
      error(e.getMessage());
      invalid();
    }
  }
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-api

@Override
  protected DateTimeFormatter getFormat(final Locale locale) {
    return DateTimeFormat.forPattern(YuiDateTimeField.this.getDatePattern()).withLocale(getLocale());
  }
});

代码示例来源:origin: org.onehippo.cms7/hippo-cms-yui

public void onUpdate(AjaxRequestTarget target) {
  updateDateTime(getDate(), getHours(), getMinutes());
  if (target != null) {
    target.addComponent(this);
  }
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-api

this.settings.setLanguage(getLocale().getLanguage());
setOutputMarkupId(true);
final DateTextField dateField = (DateTextField) get("date");
dateField.setLabel(Model.of(getString(DATE_LABEL)));
final int dateLength = calculateDateLength();
final TextField hoursField = (TextField) get("hours");
hoursField.setLabel(Model.of(getString(HOURS_LABEL)));
final TextField minutesField = (TextField) get("minutes");
minutesField.setLabel(Model.of(getString(MINUTES_LABEL)));
add(currentDateLink = new AjaxLink<Date>("current-date") {
  @Override
  public void onClick(final AjaxRequestTarget target) {
currentDateLink.add(new Label("current-date-label", getTodayLinkLabel()));
currentDateLink.add(TitleAttribute.set(getTodayLinkTooltip()));
  get(name).add(new AjaxFormComponentUpdatingBehavior("onchange") {

代码示例来源:origin: org.onehippo.cms7/hippo-cms-yui

private void updateDateTime(Date date, Integer hours, Integer minutes) {
  if(date!=null) {
    MutableDateTime datetime = new MutableDateTime(date);
    try {
      TimeZone zone = getClientTimeZone();
      if (zone != null) {
        datetime.setZone(DateTimeZone.forTimeZone(zone));
      }
      if (hours != null) {
        datetime.set(DateTimeFieldType.hourOfDay(), hours % 24);
        datetime.setMinuteOfHour(minutes != null ? minutes : 0);
      }
      // the date will be in the server's timezone
      setDate(datetime.toDate());
      //setModelObject(datetime.toDate());
    } catch (RuntimeException e) {
      error(e.getMessage());
      invalid();
    }
  }
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-yui

@Override
public void onClick(AjaxRequestTarget target) {
  ((FormComponent<Date>) YuiDateTimeField.this.get("date")).clearInput();
  MutableDateTime date = new MutableDateTime(new Date());
  boolean use12HourFormat = use12HourFormat();
  int hours = date.getHourOfDay() % (use12HourFormat ? 12 : 24);
  setHours(hours);
  setMinutes(date.getMinuteOfHour());
  setDate(date.toDate());
  if (target != null) {
    target.addComponent(YuiDateTimeField.this);
  }
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-workflow-frontend

public DatePickerComponent(String id, IModel<Date> dateModel, IModel<String> label) {
  super(id);
  add(new Label("question", label));
  add(CssClass.append("date-picker-container"));
  Calendar minimum = Calendar.getInstance();
  minimum.setTime(dateModel.getObject());
  minimum.set(Calendar.SECOND, 0);
  minimum.set(Calendar.MILLISECOND, 0);
  // if you want to round upwards, the following ought to be executed: minimum.add(Calendar.MINUTE, 1);
  dateModel.setObject(minimum.getTime());
  YuiDateTimeField ydtf = new YuiDateTimeField("value", dateModel);
  ydtf.add(new FutureDateValidator());
  add(ydtf);
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-yui

setOutputMarkupId(true);
DateTextField dateField = (DateTextField) get("date");
for (IBehavior b : dateField.getBehaviors()) {
  dateField.remove(b);
add(today = new AjaxLink<Date>("today") {
  private static final long serialVersionUID = 1L;
  get(name).add(new AjaxFormComponentUpdatingBehavior("onChange") {
    private static final long serialVersionUID = 1L;
add(CSSPackageResource.getHeaderContribution(YuiDateTimeField.class, "yuidatetime.css"));

代码示例来源:origin: org.onehippo.cms7/hippo-plugin-dashboard-document-wizard

add(dateLabel);
final YuiDateTimeField dateField = new YuiDateTimeField("date", new PropertyModel<>(this, "date"));
dateField.setRequired(true);
add(dateField);
if (!classificationType.equals(ClassificationType.DATE) && !classificationType.equals(ClassificationType.LISTDATE)) {
  dateLabel.setVisible(false);
  dateField.setVisible(false);

代码示例来源:origin: org.onehippo.cms7/hippo-cms-yui

public DateFieldWidget(String id, IModel<Date> model, IPluginContext context, IPluginConfig config) {
  super(id, model);
  
  YuiDatePickerSettings settings = new YuiDatePickerSettings();
  if (config.containsKey("datepicker")) {
    try {
      PluginConfigMapper.populate(settings, config.getPluginConfig("datepicker"));
    } catch (MappingException e) {
      throw new RuntimeException(e);
    }
  }
  YuiDateTimeField dateTimeField = new YuiDateTimeField("widget", model, settings);
  boolean todayLinkVisible = config.getAsBoolean("show.today.button", true);
  dateTimeField.setTodayLinkVisible(todayLinkVisible);
  add(dateTimeField);
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-api

void setHourAndMinutes(final MutableDateTime dateTime) {
  final Integer hours = getHours();
  if (hours != null) {
    dateTime.set(DateTimeFieldType.hourOfDay(), hours % 24);
    final Integer minutes = getMinutes();
    dateTime.setMinuteOfHour(minutes != null ? minutes : 0);
  }
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-api

protected YuiDateTimeField newYuiDateTimeField(final String id, final IModel<Date> model, final YuiDatePickerSettings settings) {
    final boolean hideTime = config.getAsBoolean(CONFIG_HIDE_TIME, false);
    return hideTime
        ? new YuiDateField(id, model, settings)
        : new YuiDateTimeField(id, model, settings);
  }
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-yui

@Override
public String getDatePattern() {
  return YuiDateTimeField.this.getDatePattern();
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-api

@Override
public String getDatePattern(final Locale locale) {
  return YuiDateTimeField.this.getDatePattern();
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com