• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PopupDateField类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vaadin.ui.PopupDateField的典型用法代码示例。如果您正苦于以下问题:Java PopupDateField类的具体用法?Java PopupDateField怎么用?Java PopupDateField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PopupDateField类属于com.vaadin.ui包,在下文中一共展示了PopupDateField类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getPropertyField

import com.vaadin.ui.PopupDateField; //导入依赖的package包/类
@Override
public Field getPropertyField(FormProperty formProperty) {
  // Writable string
  PopupDateField dateField = new PopupDateField(getPropertyLabel(formProperty));
  String datePattern = (String) formProperty.getType().getInformation("datePattern");
  dateField.setDateFormat(datePattern);
  dateField.setRequired(formProperty.isRequired());
  dateField.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));
  dateField.setEnabled(formProperty.isWritable());

  if (formProperty.getValue() != null) {
    // Try parsing the current value
    SimpleDateFormat dateFormat = new SimpleDateFormat(datePattern);

    try {
      Date date = dateFormat.parse(formProperty.getValue());
      dateField.setValue(date);
    } catch (ParseException e) {
      // TODO: what happens if current value is illegal date?
    }
  }
  return dateField;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:24,代码来源:DateFormPropertyRenderer.java


示例2: getFieldValue

import com.vaadin.ui.PopupDateField; //导入依赖的package包/类
@Override
public String getFieldValue(FormProperty formProperty, Field field) {
  PopupDateField dateField = (PopupDateField) field;
  Date selectedDate = (Date) dateField.getValue();
  
  if(selectedDate != null) {
    // Use the datePattern specified in the form property type
    String datePattern = (String) formProperty.getType().getInformation("datePattern");
    SimpleDateFormat dateFormat = new SimpleDateFormat(datePattern);
    return dateFormat.format(selectedDate);
  }
  
  return null;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:15,代码来源:DateFormPropertyRenderer.java


示例3: getHandler

import com.vaadin.ui.PopupDateField; //导入依赖的package包/类
/**
 * Method to find I18NHandler for the component
 * @param component
 * @return {@link I18NComponentHandler}
 */
public static I18NComponentHandler getHandler (Component component) {
	if (componentHandler != null && component != null) {
		I18NComponentHandler handler = componentHandler.get(component.getClass());
		if (handler != null)
			return handler;
	}
	if (component instanceof Label)
		return new I18NLableHandler((Label)component);
	if (component instanceof AbstractTextField)
		return new I18NFieldHandler((AbstractTextField)component);
	if (component instanceof PopupDateField)
		return new I18NFieldHandler((PopupDateField)component);
	if (component instanceof Table)
		return new I18NTableHandler((Table)component);
	if (component instanceof AbstractSelect)
		return new I18NAbstractSelectHandler((AbstractSelect)component);
	if (component instanceof TabSheet || component.getParent() instanceof TabSheet)
		return new I18NTabSheetHandler(component);
	if  (component instanceof JUploader) 
		return new I18NJUploadHandler((JUploader) component);
	if (component instanceof MenuBar) 
		return new I18NMenuBarHandler((MenuBar) component);
	if (component instanceof AbstractComponent)
		return new I18NAbstractComponentHandler ((AbstractComponent)component);
	return  new I18NComponentHandler(component);
}
 
开发者ID:lkumarjain,项目名称:jain-I18n,代码行数:32,代码来源:I18NComponentHandlerFactory.java


示例4: applyI18N

import com.vaadin.ui.PopupDateField; //导入依赖的package包/类
public void applyI18N(Component component, Locale locale) {
	super.applyI18N(component, locale);

	if (component instanceof AbstractTextField) {
		((AbstractTextField) component).setInputPrompt(getInputPrompt(locale));
		((AbstractTextField) component).setRequiredError(getRequiredError(locale));
	} else if (component instanceof ComboBox) {
		((ComboBox) component).setInputPrompt(getInputPrompt(locale));
		((ComboBox) component).setRequiredError(getRequiredError(locale));
	} else if (component instanceof PopupDateField) {
		((PopupDateField) component).setInputPrompt(getInputPrompt(locale));
		((PopupDateField) component).setRequiredError(getRequiredError(locale));
	}
}
 
开发者ID:lkumarjain,项目名称:jain-I18n,代码行数:15,代码来源:I18NFieldHandler.java


示例5: createOrderTimeField

import com.vaadin.ui.PopupDateField; //导入依赖的package包/类
@SuppressWarnings("unused")
private static PopupDateField createOrderTimeField() {
    PopupDateField orderTimeField = new PopupDateField();
    orderTimeField.setResolution(Resolution.SECOND);
    return orderTimeField;
}
 
开发者ID:Legioth,项目名称:AllAboutGridWebinar,代码行数:7,代码来源:AllAboutGridUI.java


示例6: I18NFieldHandler

import com.vaadin.ui.PopupDateField; //导入依赖的package包/类
public I18NFieldHandler(PopupDateField component) {
	super(component);
	this.i18NInputPrompt = component.getInputPrompt();
	this.i18NRequiredError = component.getRequiredError();
}
 
开发者ID:lkumarjain,项目名称:jain-I18n,代码行数:6,代码来源:I18NFieldHandler.java


示例7: buildMainLayout

import com.vaadin.ui.PopupDateField; //导入依赖的package包/类
@AutoGenerated
private AbsoluteLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new AbsoluteLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("560px");
	mainLayout.setHeight("300px");
	mainLayout.setMargin(true);
	
	// top-level component properties
	setWidth("560px");
	setHeight("300px");
	
	// protocolTypeField
	protocolTypeField = new TextField();
	protocolTypeField.setCaption("Tipo Procolo");
	protocolTypeField.setImmediate(false);
	protocolTypeField.setWidth("340px");
	protocolTypeField.setHeight("24px");
	protocolTypeField.setTabIndex(1);
	mainLayout.addComponent(protocolTypeField, "top:56.0px;left:20.0px;");
	
	// fileNameField
	fileNameField = new TextField();
	fileNameField.setCaption("Nombre Fichero");
	fileNameField.setImmediate(false);
	fileNameField.setWidth("340px");
	fileNameField.setHeight("-1px");
	mainLayout.addComponent(fileNameField, "top:17.0px;left:20.0px;");
	
	// protocolDateField
	protocolDateField = new PopupDateField();
	protocolDateField.setCaption("Fecha Protocolo");
	protocolDateField.setImmediate(false);
	protocolDateField.setWidth("160px");
	protocolDateField.setHeight("-1px");
	mainLayout.addComponent(protocolDateField, "top:20.0px;left:380.0px;");
	
	// payloadField
	payloadField = new TextArea();
	payloadField.setCaption("Carga Protocolo");
	payloadField.setImmediate(false);
	payloadField.setWidth("520px");
	payloadField.setHeight("180px");
	mainLayout.addComponent(payloadField, "top:100.0px;left:20.0px;");
	
	return mainLayout;
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:49,代码来源:ProtocolViewForm.java


示例8: buildForm

import com.vaadin.ui.PopupDateField; //导入依赖的package包/类
private Component buildForm() {
	HorizontalLayout form = new HorizontalLayout();
	form.setWidth("100%");

	// initPacksSources();

	/*
	 * packsSelect = new ComboBox();
	 * packsSelect.setInputPrompt(Messages.getString(
	 * "Caption.Button.ChoosePack")); for (String packTitle : sortedPacks) {
	 * packsSelect.addItem(packTitle); }
	 * packsSelect.setTextInputAllowed(false);
	 * packsSelect.setNullSelectionAllowed(false);
	 * packsSelect.setRequired(true);
	 * packsSelect.setRequiredError(Messages.getString(
	 * "Message.Error.NoPackSelected"));
	 * packsSelect.setValidationVisible(false);
	 * form.addComponent(packsSelect);
	 */

	dateFieldFrom = new PopupDateField();
	dateFieldFrom.setResolution(Resolution.SECOND);
	dateFieldFrom.setDateFormat(Messages.getString("Format.DateTime"));
	dateFieldFrom.setInputPrompt(Messages.getString("Caption.Field.DateFrom"));
	dateFieldFrom.setImmediate(true);
	dateFieldFrom.setValidationVisible(false);
	form.addComponent(dateFieldFrom);

	dateFieldTo = new PopupDateField();
	dateFieldTo.setResolution(Resolution.SECOND);
	dateFieldTo.setDateFormat(Messages.getString("Format.DateTime"));
	dateFieldTo.setInputPrompt(Messages.getString("Caption.Field.DateTo"));
	dateFieldTo.setImmediate(true);
	dateFieldTo.setValidationVisible(false);
	form.addComponent(dateFieldTo);

	Validator dateValidator = new Validator() {
		@Override
		public void validate(Object value) throws InvalidValueException {
			if (dateFieldFrom.getValue() == null && dateFieldTo.getValue() == null) {
				throw new InvalidValueException(Messages.getString("Message.Error.NoDateSelected"));
			}

		}
	};
	dateFieldFrom.addValidator(dateValidator);
	dateFieldTo.addValidator(dateValidator);

	Button selectionButton = new Button(Messages.getString("Caption.Button.ShowTests"));
	selectionButton.addClickListener(new ClickListener() {
		@Override
		public void buttonClick(ClickEvent event) {
			try {
				// packsSelect.validate();
				dateFieldFrom.validate();
				dateFieldTo.validate();

				// Pack pack = packMap.get(packsSelect.getValue());
				Date dateFrom = (Date) dateFieldFrom.getValue();
				Date dateTo = (Date) dateFieldTo.getValue();

				showTests(dateFrom, dateTo);

			} catch (InvalidValueException e) {
				// packsSelect.setValidationVisible(!packsSelect.isValid());
				dateFieldFrom.setValidationVisible(!dateFieldFrom.isValid());
				dateFieldTo.setValidationVisible(!dateFieldTo.isValid());
				Notification.show(e.getMessage(), Type.WARNING_MESSAGE);
			}
		}
	});
	form.addComponent(selectionButton);

	return form;
}
 
开发者ID:tilioteo,项目名称:hypothesis,代码行数:76,代码来源:ExportScorePresenterImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LoadStoreParameter类代码示例发布时间:2022-05-22
下一篇:
Java IdentityManager类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap