List of usage examples for com.vaadin.ui InlineDateField InlineDateField
public InlineDateField(ValueChangeListener<LocalDate> valueChangeListener)
From source file:com.cavisson.gui.dashboard.components.controls.DateFields.java
License:Apache License
public DateFields() { setMargin(true);/*from www . j a v a2s. c o m*/ Label h1 = new Label("Date Fields"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); DateField date = new DateField("Default resolution"); setDate(date); row.addComponent(date); date = new DateField("Error"); setDate(date); date.setComponentError(new UserError("Fix it, now!")); row.addComponent(date); date = new DateField("Error, borderless"); setDate(date); date.setComponentError(new UserError("Fix it, now!")); date.addStyleName("borderless"); row.addComponent(date); CssLayout group = new CssLayout(); group.setCaption("Grouped with a Button"); group.addStyleName("v-component-group"); row.addComponent(group); final DateField date2 = new DateField(); group.addComponent(date2); Button today = new Button("Today", new ClickListener() { @Override public void buttonClick(ClickEvent event) { date2.setValue(new Date()); } }); group.addComponent(today); date = new DateField("Default resolution, explicit size"); setDate(date); row.addComponent(date); date.setWidth("260px"); date.setHeight("60px"); date = new DateField("Second resolution"); setDate(date); date.setResolution(Resolution.SECOND); row.addComponent(date); date = new DateField("Minute resolution"); setDate(date); date.setResolution(Resolution.MINUTE); row.addComponent(date); date = new DateField("Hour resolution"); setDate(date); date.setResolution(Resolution.HOUR); row.addComponent(date); date = new DateField("Disabled"); setDate(date); date.setResolution(Resolution.HOUR); date.setEnabled(false); row.addComponent(date); date = new DateField("Day resolution"); setDate(date); date.setResolution(Resolution.DAY); row.addComponent(date); date = new DateField("Month resolution"); setDate(date); date.setResolution(Resolution.MONTH); row.addComponent(date); date = new DateField("Year resolution"); setDate(date); date.setResolution(Resolution.YEAR); row.addComponent(date); date = new DateField("Custom color"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("color1"); row.addComponent(date); date = new DateField("Custom color"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("color2"); row.addComponent(date); date = new DateField("Custom color"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("color3"); row.addComponent(date); date = new DateField("Small"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("small"); row.addComponent(date); date = new DateField("Large"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("large"); row.addComponent(date); date = new DateField("Borderless"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("borderless"); row.addComponent(date); date = new DateField("Week numbers"); setDate(date); date.setResolution(Resolution.DAY); date.setLocale(new Locale("fi", "fi")); date.setShowISOWeekNumbers(true); row.addComponent(date); date = new DateField("US locale"); setDate(date); date.setResolution(Resolution.SECOND); date.setLocale(new Locale("en", "US")); row.addComponent(date); date = new DateField("Custom format"); setDate(date); date.setDateFormat("E dd/MM/yyyy"); row.addComponent(date); date = new DateField("Tiny"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("tiny"); row.addComponent(date); date = new DateField("Huge"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("huge"); row.addComponent(date); date = new InlineDateField("Date picker"); setDate(date); row.addComponent(date); date = new InlineDateField("Date picker with week numbers"); setDate(date); date.setLocale(new Locale("fi", "fi")); date.setShowISOWeekNumbers(true); row.addComponent(date); }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getDateFieldPreviews() { Layout grid = getPreviewLayout("Date fields"); Date dateValue = null;/*from w w w . j av a2 s . c om*/ try { dateValue = new SimpleDateFormat("yyyyMMdd", Locale.US).parse("20110101"); } catch (ParseException e) { e.printStackTrace(); } DateField date = new DateField(); date.setValue(dateValue); date.setResolution(DateField.RESOLUTION_MIN); grid.addComponent(date); date = new DateField("Small date"); date.setValue(dateValue); date.setResolution(DateField.RESOLUTION_YEAR); date.setStyleName("small"); grid.addComponent(date); date = new DateField("Big date"); date.setValue(dateValue); date.setResolution(DateField.RESOLUTION_MONTH); date.setStyleName("big"); grid.addComponent(date); date = new InlineDateField("Inline date"); date.setValue(dateValue); date.setResolution(DateField.RESOLUTION_DAY); grid.addComponent(date); date = new InlineDateField("Inline date, year resolution"); date.setValue(dateValue); date.setResolution(DateField.RESOLUTION_MONTH); grid.addComponent(date); return grid; }
From source file:roart.client.MyVaadinUI.java
private InlineDateField getReindexDateLower() { InlineDateField tf = new InlineDateField("Reindex on before date"); // Create a DateField with the default style // Set the date and time to present Date date = new Date(); // temp fix//from ww w .j av a2 s . c o m date.setHours(0); date.setMinutes(0); date.setSeconds(0); tf.setValue(date); // Handle changes in the value tf.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { // Assuming that the value type is a String Date date = (Date) event.getProperty().getValue(); // Do something with the value ControlService maininst = new ControlService(); long time = date.getTime(); try { maininst.reindexdatelower("" + time, true); Notification.show("Request sent"); } catch (Exception e) { log.error(Constants.EXCEPTION, e); } } }); // Fire value changes immediately when the field loses focus tf.setImmediate(true); return tf; }
From source file:roart.client.MyVaadinUI.java
private InlineDateField getReindexDateHigher() { InlineDateField tf = new InlineDateField("Reindex on after date"); // Create a DateField with the default style // Set the date and time to present Date date = new Date(); // temp fix/* w w w. jav a 2s. co m*/ date.setHours(0); date.setMinutes(0); date.setSeconds(0); tf.setValue(date); // Handle changes in the value tf.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { // Assuming that the value type is a String Date date = (Date) event.getProperty().getValue(); // Do something with the value ControlService maininst = new ControlService(); long time = date.getTime(); try { maininst.reindexdatehigher("" + time, true); Notification.show("Request sent"); } catch (Exception e) { log.error(Constants.EXCEPTION, e); } } }); // Fire value changes immediately when the field loses focus tf.setImmediate(true); return tf; }