List of usage examples for com.vaadin.ui DateField DateField
public DateField(String caption, ValueChangeListener<LocalDate> valueChangeListener)
From source file:de.fatalix.timeline.web.root.block.TimelineConfigLayout.java
private Layout createLeftSide() { headline = new TextField(); headline.setInputPrompt("Your timeline headline..."); headline.setColumns(15);/*from w w w .j ava 2 s . co m*/ headline.setNullSettingAllowed(true); headline.addStyleName("timeline"); text = new TextArea(); text.setInputPrompt("Your timeline description..."); text.setColumns(30); text.setRows(10); text.setNullSettingAllowed(true); startDate = new DateField(null, new Date()); startDate.setDateFormat("dd-MM-yyyy"); startDate.setResolution(Resolution.DAY); Button createEventBtn = new Button("Add Event", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { TimelineEvent newEvent = new TimelineEvent(); newEvent.setTimeline(data); newEvent.setStartDate(new Date()); data.getEvents().add(newEvent); addTimelineEvent(newEvent); } }); return new VerticalLayout(headline, text, startDate, createEventBtn); }
From source file:de.fatalix.timeline.web.root.block.TimelineEventLayout.java
public TimelineEventLayout() { headline = new TextField(); headline.setInputPrompt("Your event headline..."); headline.setColumns(31);/*w ww . j a v a 2 s . co m*/ headline.setNullRepresentation(""); text = new TextArea(); text.setInputPrompt("Your event description..."); text.setColumns(31); text.setRows(10); text.setNullRepresentation(""); startDate = new DateField(null, new Date()); startDate.setDateFormat("dd-MM-yyyy"); startDate.setResolution(Resolution.DAY); startDate.setDescription("Set the start date of an event."); endDate = new DateField(); endDate.setDateFormat("dd-MM-yyyy"); endDate.setResolution(Resolution.DAY); endDate.setDescription("Set the end date of an event. Optional!"); deleteButton = new VerticalLayout(); deleteButton.setWidth(16, Unit.PIXELS); deleteButton.setHeight(16, Unit.PIXELS); deleteButton.addStyleName("delete"); deleteButton.setDescription("Click to remove this event"); deleteButton.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { for (EventDeleteListener listener : listeners) { listener.deleteEvent(TimelineEventLayout.this); } } }); HorizontalLayout dateLayout = new HorizontalLayout(); dateLayout.setWidth(100, Unit.PERCENTAGE); dateLayout.addComponents(startDate, endDate, deleteButton); dateLayout.setComponentAlignment(deleteButton, Alignment.MIDDLE_RIGHT); this.setMargin(true); this.setSpacing(true); this.addComponent(headline); this.addComponent(text); this.addComponent(dateLayout); }
From source file:edu.kit.dama.ui.admin.schedule.trigger.AtTriggerConfigurationPanel.java
License:Apache License
/** * Get the at date field./* ww w. j ava 2 s .c o m*/ * * @return The at date field. */ private DateField getAtDateField() { if (atDateField == null) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.HOUR, 1); atDateField = new DateField("SCHEDULE AT", cal.getTime()); atDateField.setDateFormat("dd.MM.yyyy HH:mm"); atDateField.setResolution(Resolution.MINUTE); atDateField.setImmediate(true); atDateField.setRequired(true); atDateField.setWidth("100%"); atDateField.addStyleName(CSSTokenContainer.BOLD_CAPTION); } return atDateField; }