当前位置: 首页>>代码示例>>Java>>正文


Java DateField.setDateFormat方法代码示例

本文整理汇总了Java中com.vaadin.ui.DateField.setDateFormat方法的典型用法代码示例。如果您正苦于以下问题:Java DateField.setDateFormat方法的具体用法?Java DateField.setDateFormat怎么用?Java DateField.setDateFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.ui.DateField的用法示例。


在下文中一共展示了DateField.setDateFormat方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: genDateField

import com.vaadin.ui.DateField; //导入方法依赖的package包/类
public static <T> DateField genDateField(Binder<T> binder, String propertyId, final java.text.SimpleDateFormat dateFormat) {
    DateField dateField = new DateField();

    binder.bind(dateField, propertyId);
    if (dateFormat != null) {
        dateField.setDateFormat(dateFormat.toPattern());
    }
    dateField.setWidth("100%");

    dateField.setResolution(DateResolution.DAY);
    dateField.addStyleName(STYLENAME_GRIDCELLFILTER);
    dateField.addStyleName(ValoTheme.DATEFIELD_TINY);
    dateField.addValueChangeListener(e -> {
        if (binder.isValid()) {
            dateField.setComponentError(null);
        }
    });
    return dateField;
}
 
开发者ID:melistik,项目名称:vaadin-grid-util,代码行数:20,代码来源:FieldFactory.java

示例2: ReportParameterDateTimeRange

import com.vaadin.ui.DateField; //导入方法依赖的package包/类
public ReportParameterDateTimeRange(String caption, String startParameterName, String endParameterName)
{
	super(caption, new String[] { startParameterName, endParameterName });
	Preconditions.checkNotNull(startParameterName);
	Preconditions.checkNotNull(endParameterName);
	this.startParameterName = startParameterName;
	this.endParameterName = endParameterName;
	startfield = new DateField(caption, new DateTime().withTimeAtStartOfDay().toDate());
	startfield.setResolution(Resolution.DAY);
	startfield.setDateFormat("yyyy/MM/dd");

	startfield.setValidationVisible(true);

	endfield = new DateField("To", new DateTime().withTimeAtStartOfDay().toDate());
	endfield.setResolution(Resolution.DAY);
	endfield.setDateFormat("yyyy/MM/dd");

	endfield.setValidationVisible(true);
	createValidators();

	endAdjustment = -1;

}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:24,代码来源:ReportParameterDateTimeRange.java

示例3: provideEditorComponent

import com.vaadin.ui.DateField; //导入方法依赖的package包/类
@Override
public DateField provideEditorComponent(ColumnDefinition columnDefinition) {
	DateField dateField = new DateField();

	if (columnDefinition.getFormat().isPresent()) {
		dateField.setDateFormat(columnDefinition.getFormat().get());
	} else if (configurationProvider.getDateFormatPattern().isPresent()) {
		dateField.setDateFormat(configurationProvider.getDateFormatPattern().get());
	}

	return dateField;
}
 
开发者ID:peterl1084,项目名称:bean-grid,代码行数:13,代码来源:BeanGridDateFieldComponentProvider.java

示例4: getDateField

import com.vaadin.ui.DateField; //导入方法依赖的package包/类
/**
 * @param caption
 * @param bindName
 * @return
 */
private DateField getDateField(String caption, String bindName) {
	DateField dateField = new DateField(caption);
	dateField.setImmediate(true);
	dateField.setValidationVisible(false);
	dateField.setDateFormat(DATE_FORMAT);
	fieldGroup.bind(dateField, bindName);
	return dateField;
}
 
开发者ID:KrishnaPhani,项目名称:KrishnasSpace,代码行数:14,代码来源:BasicFormImpl.java

示例5: createDateField

import com.vaadin.ui.DateField; //导入方法依赖的package包/类
/**
 * Creates a date field.
 * @param pid property name.
 * @param propertyType property type.
 * @return a new field to select a date.
 */
public Field createDateField(String pid, Class<?> propertyType) {
	Field field = null;
	if(Date.class.isAssignableFrom(propertyType)) {
		DateField dateField = new DateField();
		dateField.setResolution(DateField.RESOLUTION_DAY);
		dateField.setDateFormat(Utils.getDateFormatPattern());
		field = dateField;
	}
       
       return field;
}
 
开发者ID:alejandro-du,项目名称:enterprise-app,代码行数:18,代码来源:DefaultCrudFieldFactory.java

示例6: bindDateField

import com.vaadin.ui.DateField; //导入方法依赖的package包/类
public DateField bindDateField(AbstractLayout form, ValidatingFieldGroup<E> group, String fieldLabel,
		String fieldName, String dateFormat, Resolution resolution)
{
	DateField field = new SplitDateField(fieldLabel);
	field.setDateFormat(dateFormat);
	field.setResolution(resolution);

	field.setImmediate(true);
	field.setWidth("100%");
	addValueChangeListeners(field);
	doBinding(group, fieldName, field);
	form.addComponent(field);
	return field;
}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:15,代码来源:FormHelper.java

示例7: newDateField

import com.vaadin.ui.DateField; //导入方法依赖的package包/类
/**
 * Create a new DateField with format for current locale and given style.
 * @param style DateFormat style
 * @return a new DateField
 */
public static DateField newDateField(int style) {
	DateField df = new DateField();
	Locale locale = LocaleContextHolder.getLocale();
	df.setLocale(locale);
	DateFormat dateFormat = DateFormat.getDateInstance(style);
	
	if (dateFormat instanceof SimpleDateFormat) {
		SimpleDateFormat sdf = (SimpleDateFormat) dateFormat;
		df.setDateFormat(sdf.toPattern());
	}
	
	return df;
}
 
开发者ID:chelu,项目名称:jdal,代码行数:19,代码来源:FormUtils.java

示例8: initAboutSection

import com.vaadin.ui.DateField; //导入方法依赖的package包/类
protected void initAboutSection() {
  // Header
  HorizontalLayout header = new HorizontalLayout();
  header.setWidth(100, UNITS_PERCENTAGE);
  header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
  infoPanelLayout.addComponent(header);
  
  Label aboutLabel = createProfileHeader(infoPanelLayout, i18nManager.getMessage(Messages.PROFILE_ABOUT));
  header.addComponent(aboutLabel);
  header.setExpandRatio(aboutLabel, 1.0f);
  
  // only show edit/save buttons if current user matches
  if (isCurrentLoggedInUser) {
    Button actionButton = null;
    if (!editable) {
      actionButton = initEditProfileButton();
    } else {
      actionButton = initSaveProfileButton();
    }
    header.addComponent(actionButton);
    header.setComponentAlignment(actionButton, Alignment.MIDDLE_RIGHT);
  }
  
  // 'About' fields
  GridLayout aboutLayout = createInfoSectionLayout(2, 4); 
  
  // Name
  if (!editable && (isDefined(user.getFirstName()) || isDefined(user.getLastName()) )) {
    addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_NAME), user.getFirstName() + " " + user.getLastName());
  } else if (editable) {
    firstNameField = new TextField();
    firstNameField.focus();
    addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_FIRST_NAME), firstNameField, user.getFirstName());
    lastNameField = new TextField();
    addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LAST_NAME), lastNameField, user.getLastName());
  }
  
  // Job title
  if (!editable && isDefined(jobTitle)) {
    addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_JOBTITLE), jobTitle);
  } else if (editable) {
    jobTitleField = new TextField();
    addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_JOBTITLE), jobTitleField, jobTitle);
  }
  
  // Birthdate
  if (!editable && isDefined(birthDate)) {
    addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_BIRTHDATE), birthDate);
  } else if (editable) {
    birthDateField = new DateField();
    birthDateField.setDateFormat(Constants.DEFAULT_DATE_FORMAT);
    birthDateField.setResolution(DateField.RESOLUTION_DAY);
    try {
      birthDateField.setValue(new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT).parse(birthDate));
    } catch (Exception e) {} // do nothing
    addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_BIRTHDATE), birthDateField, null);
  }
  
  // Location
  if (!editable && isDefined(location)) {
    addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LOCATION), location);
  } else if (editable) {
    locationField = new TextField();
    addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LOCATION), locationField, location);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:67,代码来源:ProfilePanel.java

示例9: createForm

import com.vaadin.ui.DateField; //导入方法依赖的package包/类
private FormLayout createForm() {
	TextField numberTextField = new TextField("Number");
	numberTextField.setRequired(true);
	numberTextField.setRequiredError("Please enter a flight number!");
	numberTextField.setNullRepresentation("");
	numberTextField.addValidator(new RegexpValidator("\\w\\w\\d\\d\\d", "Please enter a valid flight number!"));

	TextField airlineTextField = new TextField("Airline");
	airlineTextField.setRequired(true);
	airlineTextField.setRequiredError("Please enter an airline!");
	airlineTextField.setNullRepresentation("");

	ComboBox departureAirportField = new ComboBox("Departure Airport");
	departureAirportField.setTextInputAllowed(false);
	departureAirportField.setRequired(true);
	departureAirportField.setRequiredError("Please select a depature airport!");
	departureAirportField.setItemCaptionPropertyId("name");
	departureAirportField.setContainerDataSource(airportContainer);

	ComboBox destinationAirportField = new ComboBox("Destination Airport");
	destinationAirportField.setTextInputAllowed(false);
	destinationAirportField.setRequired(true);
	destinationAirportField.setRequiredError("Please select a destination airport!");
	destinationAirportField.setItemCaptionPropertyId("name");
	destinationAirportField.setContainerDataSource(airportContainer);

	TextField priceField = new TextField("Price");
	priceField.setRequired(true);
	priceField.setRequiredError("Please enter a price!");
	priceField.setNullRepresentation("");
	priceField.setConverter(new StringToBigDecimalConverter());
	priceField.addValidator(new BigDecimalRangeValidator("Please enter a valid price!", new BigDecimal("0.01"), null));

	DateField departureField = new DateField("Departure Date");
	departureField.setDateFormat("dd.MM.yyyy");
	departureField.setRequired(true);
	departureField.setRequiredError("Please enter a departure date!");
	departureField.addValidator(new DateRangeValidator("Please enter departure date in the future!", new Date(), null, Resolution.DAY));

	flightFieldGroup.bind(numberTextField, "number");
	flightFieldGroup.bind(airlineTextField, "airline");
	flightFieldGroup.bind(departureAirportField, "departureAirport");
	flightFieldGroup.bind(destinationAirportField, "destinationAirport");
	flightFieldGroup.bind(priceField, "price");
	flightFieldGroup.bind(departureField, "date");

	return new FormLayout(numberTextField, airlineTextField, departureAirportField, destinationAirportField, priceField, departureField);
}
 
开发者ID:sboe0705,项目名称:flightservice,代码行数:49,代码来源:FlightMaintenanceView.java


注:本文中的com.vaadin.ui.DateField.setDateFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。